Skip to content

Commit

Permalink
wan: convert sdla driver to net_device_ops
Browse files Browse the repository at this point in the history
Also use internal net_device_stats

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Mar 27, 2009
1 parent f70d594 commit ac99533
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
36 changes: 15 additions & 21 deletions drivers/net/wan/sdla.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,19 +714,19 @@ static int sdla_transmit(struct sk_buff *skb, struct net_device *dev)
switch (ret)
{
case SDLA_RET_OK:
flp->stats.tx_packets++;
dev->stats.tx_packets++;
ret = DLCI_RET_OK;
break;

case SDLA_RET_CIR_OVERFLOW:
case SDLA_RET_BUF_OVERSIZE:
case SDLA_RET_NO_BUFS:
flp->stats.tx_dropped++;
dev->stats.tx_dropped++;
ret = DLCI_RET_DROP;
break;

default:
flp->stats.tx_errors++;
dev->stats.tx_errors++;
ret = DLCI_RET_ERR;
break;
}
Expand Down Expand Up @@ -807,7 +807,7 @@ static void sdla_receive(struct net_device *dev)
if (i == CONFIG_DLCI_MAX)
{
printk(KERN_NOTICE "%s: Received packet from invalid DLCI %i, ignoring.", dev->name, dlci);
flp->stats.rx_errors++;
dev->stats.rx_errors++;
success = 0;
}
}
Expand All @@ -819,7 +819,7 @@ static void sdla_receive(struct net_device *dev)
if (skb == NULL)
{
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
flp->stats.rx_dropped++;
dev->stats.rx_dropped++;
success = 0;
}
else
Expand Down Expand Up @@ -859,7 +859,7 @@ static void sdla_receive(struct net_device *dev)

if (success)
{
flp->stats.rx_packets++;
dev->stats.rx_packets++;
dlp = netdev_priv(master);
(*dlp->receive)(skb, master);
}
Expand Down Expand Up @@ -1590,34 +1590,28 @@ static int sdla_set_config(struct net_device *dev, struct ifmap *map)
return err;
}

static struct net_device_stats *sdla_stats(struct net_device *dev)
{
struct frad_local *flp;
flp = netdev_priv(dev);

return(&flp->stats);
}
static const struct net_device_ops sdla_netdev_ops = {
.ndo_open = sdla_open,
.ndo_stop = sdla_close,
.ndo_do_ioctl = sdla_ioctl,
.ndo_set_config = sdla_set_config,
.ndo_start_xmit = sdla_transmit,
.ndo_change_mtu = sdla_change_mtu,
};

static void setup_sdla(struct net_device *dev)
{
struct frad_local *flp = netdev_priv(dev);

netdev_boot_setup_check(dev);

dev->netdev_ops = &sdla_netdev_ops;
dev->flags = 0;
dev->type = 0xFFFF;
dev->hard_header_len = 0;
dev->addr_len = 0;
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->deactivate = sdla_deactivate;
flp->assoc = sdla_assoc;
Expand Down
1 change: 0 additions & 1 deletion include/linux/if_frad.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ struct frhdr

struct dlci_local
{
struct net_device_stats stats;
struct net_device *master;
struct net_device *slave;
struct dlci_conf config;
Expand Down

0 comments on commit ac99533

Please sign in to comment.