Commit ac99533f authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

wan: convert sdla driver to net_device_ops

Also use internal net_device_stats
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f70d5949
...@@ -714,19 +714,19 @@ static int sdla_transmit(struct sk_buff *skb, struct net_device *dev) ...@@ -714,19 +714,19 @@ static int sdla_transmit(struct sk_buff *skb, struct net_device *dev)
switch (ret) switch (ret)
{ {
case SDLA_RET_OK: case SDLA_RET_OK:
flp->stats.tx_packets++; dev->stats.tx_packets++;
ret = DLCI_RET_OK; ret = DLCI_RET_OK;
break; break;
case SDLA_RET_CIR_OVERFLOW: case SDLA_RET_CIR_OVERFLOW:
case SDLA_RET_BUF_OVERSIZE: case SDLA_RET_BUF_OVERSIZE:
case SDLA_RET_NO_BUFS: case SDLA_RET_NO_BUFS:
flp->stats.tx_dropped++; dev->stats.tx_dropped++;
ret = DLCI_RET_DROP; ret = DLCI_RET_DROP;
break; break;
default: default:
flp->stats.tx_errors++; dev->stats.tx_errors++;
ret = DLCI_RET_ERR; ret = DLCI_RET_ERR;
break; break;
} }
...@@ -807,7 +807,7 @@ static void sdla_receive(struct net_device *dev) ...@@ -807,7 +807,7 @@ static void sdla_receive(struct net_device *dev)
if (i == CONFIG_DLCI_MAX) if (i == CONFIG_DLCI_MAX)
{ {
printk(KERN_NOTICE "%s: Received packet from invalid DLCI %i, ignoring.", dev->name, dlci); printk(KERN_NOTICE "%s: Received packet from invalid DLCI %i, ignoring.", dev->name, dlci);
flp->stats.rx_errors++; dev->stats.rx_errors++;
success = 0; success = 0;
} }
} }
...@@ -819,7 +819,7 @@ static void sdla_receive(struct net_device *dev) ...@@ -819,7 +819,7 @@ static void sdla_receive(struct net_device *dev)
if (skb == NULL) if (skb == NULL)
{ {
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
flp->stats.rx_dropped++; dev->stats.rx_dropped++;
success = 0; success = 0;
} }
else else
...@@ -859,7 +859,7 @@ static void sdla_receive(struct net_device *dev) ...@@ -859,7 +859,7 @@ static void sdla_receive(struct net_device *dev)
if (success) if (success)
{ {
flp->stats.rx_packets++; dev->stats.rx_packets++;
dlp = netdev_priv(master); dlp = netdev_priv(master);
(*dlp->receive)(skb, master); (*dlp->receive)(skb, master);
} }
...@@ -1590,13 +1590,14 @@ static int sdla_set_config(struct net_device *dev, struct ifmap *map) ...@@ -1590,13 +1590,14 @@ static int sdla_set_config(struct net_device *dev, struct ifmap *map)
return err; return err;
} }
static struct net_device_stats *sdla_stats(struct net_device *dev) static const struct net_device_ops sdla_netdev_ops = {
{ .ndo_open = sdla_open,
struct frad_local *flp; .ndo_stop = sdla_close,
flp = netdev_priv(dev); .ndo_do_ioctl = sdla_ioctl,
.ndo_set_config = sdla_set_config,
return(&flp->stats); .ndo_start_xmit = sdla_transmit,
} .ndo_change_mtu = sdla_change_mtu,
};
static void setup_sdla(struct net_device *dev) static void setup_sdla(struct net_device *dev)
{ {
...@@ -1604,20 +1605,13 @@ static void setup_sdla(struct net_device *dev) ...@@ -1604,20 +1605,13 @@ static void setup_sdla(struct net_device *dev)
netdev_boot_setup_check(dev); netdev_boot_setup_check(dev);
dev->netdev_ops = &sdla_netdev_ops;
dev->flags = 0; dev->flags = 0;
dev->type = 0xFFFF; dev->type = 0xFFFF;
dev->hard_header_len = 0; dev->hard_header_len = 0;
dev->addr_len = 0; dev->addr_len = 0;
dev->mtu = SDLA_MAX_MTU; dev->mtu = SDLA_MAX_MTU;
dev->open = sdla_open;
dev->stop = sdla_close;
dev->do_ioctl = sdla_ioctl;
dev->set_config = sdla_set_config;
dev->get_stats = sdla_stats;
dev->hard_start_xmit = sdla_transmit;
dev->change_mtu = sdla_change_mtu;
flp->activate = sdla_activate; flp->activate = sdla_activate;
flp->deactivate = sdla_deactivate; flp->deactivate = sdla_deactivate;
flp->assoc = sdla_assoc; flp->assoc = sdla_assoc;
......
...@@ -153,7 +153,6 @@ struct frhdr ...@@ -153,7 +153,6 @@ struct frhdr
struct dlci_local struct dlci_local
{ {
struct net_device_stats stats;
struct net_device *master; struct net_device *master;
struct net_device *slave; struct net_device *slave;
struct dlci_conf config; struct dlci_conf config;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment