Skip to content

Commit

Permalink
3c359: use netstats in net_device structure
Browse files Browse the repository at this point in the history
Use net_device_stats from net_device structure instead of local.
Kill xl_get_stats function, because by default it is used identical
internal_stats function from net/core/dev.c

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Paulius Zaleckas authored and Jeff Garzik committed May 13, 2008
1 parent 4711c84 commit 94f9d29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
20 changes: 6 additions & 14 deletions drivers/net/tokenring/3c359.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ static void xl_dn_comp(struct net_device *dev);
static int xl_close(struct net_device *dev);
static void xl_set_rx_mode(struct net_device *dev);
static irqreturn_t xl_interrupt(int irq, void *dev_id);
static struct net_device_stats * xl_get_stats(struct net_device *dev);
static int xl_set_mac_address(struct net_device *dev, void *addr) ;
static void xl_arb_cmd(struct net_device *dev);
static void xl_asb_cmd(struct net_device *dev) ;
Expand Down Expand Up @@ -343,7 +342,6 @@ static int __devinit xl_probe(struct pci_dev *pdev,
dev->stop=&xl_close;
dev->do_ioctl=NULL;
dev->set_multicast_list=&xl_set_rx_mode;
dev->get_stats=&xl_get_stats ;
dev->set_mac_address=&xl_set_mac_address ;
SET_NETDEV_DEV(dev, &pdev->dev);

Expand Down Expand Up @@ -921,7 +919,7 @@ static void xl_rx(struct net_device *dev)
adv_rx_ring(dev) ;

adv_rx_ring(dev) ; /* One more time just for luck :) */
xl_priv->xl_stats.rx_dropped++ ;
dev->stats.rx_dropped++ ;

writel(ACK_INTERRUPT | UPCOMPACK | LATCH_ACK , xl_mmio + MMIO_COMMAND) ;
return ;
Expand Down Expand Up @@ -957,7 +955,7 @@ static void xl_rx(struct net_device *dev)
if (skb==NULL) { /* Still need to fix the rx ring */
printk(KERN_WARNING "%s: dev_alloc_skb failed in rx, single buffer \n",dev->name) ;
adv_rx_ring(dev) ;
xl_priv->xl_stats.rx_dropped++ ;
dev->stats.rx_dropped++ ;
writel(ACK_INTERRUPT | UPCOMPACK | LATCH_ACK , xl_mmio + MMIO_COMMAND) ;
return ;
}
Expand All @@ -971,8 +969,8 @@ static void xl_rx(struct net_device *dev)
xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
adv_rx_ring(dev) ;
xl_priv->xl_stats.rx_packets++ ;
xl_priv->xl_stats.rx_bytes += frame_length ;
dev->stats.rx_packets++ ;
dev->stats.rx_bytes += frame_length ;

netif_rx(skb2) ;
} /* if multiple buffers */
Expand Down Expand Up @@ -1182,8 +1180,8 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
txd->buffer = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE));
txd->buffer_length = cpu_to_le32(skb->len) | TXDNFRAGLAST;
xl_priv->tx_ring_skb[tx_head] = skb ;
xl_priv->xl_stats.tx_packets++ ;
xl_priv->xl_stats.tx_bytes += skb->len ;
dev->stats.tx_packets++ ;
dev->stats.tx_bytes += skb->len ;

/*
* Set the nextptr of the previous descriptor equal to this descriptor, add XL_TX_RING_SIZE -1
Expand Down Expand Up @@ -1463,12 +1461,6 @@ static void xl_srb_bh(struct net_device *dev)
return ;
}

static struct net_device_stats * xl_get_stats(struct net_device *dev)
{
struct xl_private *xl_priv = netdev_priv(dev);
return (struct net_device_stats *) &xl_priv->xl_stats;
}

static int xl_set_mac_address (struct net_device *dev, void *addr)
{
struct sockaddr *saddr = addr ;
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/tokenring/3c359.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@ struct xl_private {
struct wait_queue *srb_wait;
volatile int asb_queued;

struct net_device_stats xl_stats ;

u16 mac_buffer ;
u16 xl_lan_status ;
u8 xl_ring_speed ;
Expand Down

0 comments on commit 94f9d29

Please sign in to comment.