sbni: use internal net_device_stats
Convert to use existing net_device_stats. This driver, has bad style, of using commas, when brackets should be used... Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
39549b1e83
commit
fe6c6fbbcd
@@ -68,7 +68,6 @@
|
|||||||
/* device private data */
|
/* device private data */
|
||||||
|
|
||||||
struct net_local {
|
struct net_local {
|
||||||
struct net_device_stats stats;
|
|
||||||
struct timer_list watchdog;
|
struct timer_list watchdog;
|
||||||
|
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
@@ -117,7 +116,6 @@ static int sbni_open( struct net_device * );
|
|||||||
static int sbni_close( struct net_device * );
|
static int sbni_close( struct net_device * );
|
||||||
static int sbni_start_xmit( struct sk_buff *, struct net_device * );
|
static int sbni_start_xmit( struct sk_buff *, struct net_device * );
|
||||||
static int sbni_ioctl( struct net_device *, struct ifreq *, int );
|
static int sbni_ioctl( struct net_device *, struct ifreq *, int );
|
||||||
static struct net_device_stats *sbni_get_stats( struct net_device * );
|
|
||||||
static void set_multicast_list( struct net_device * );
|
static void set_multicast_list( struct net_device * );
|
||||||
|
|
||||||
static irqreturn_t sbni_interrupt( int, void * );
|
static irqreturn_t sbni_interrupt( int, void * );
|
||||||
@@ -723,13 +721,11 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno,
|
|||||||
nl->wait_frameno = 0,
|
nl->wait_frameno = 0,
|
||||||
nl->inppos = 0,
|
nl->inppos = 0,
|
||||||
#ifdef CONFIG_SBNI_MULTILINE
|
#ifdef CONFIG_SBNI_MULTILINE
|
||||||
((struct net_local *)netdev_priv(nl->master))
|
nl->master->stats.rx_errors++,
|
||||||
->stats.rx_errors++,
|
nl->master->stats.rx_missed_errors++;
|
||||||
((struct net_local *)netdev_priv(nl->master))
|
|
||||||
->stats.rx_missed_errors++;
|
|
||||||
#else
|
#else
|
||||||
nl->stats.rx_errors++,
|
dev->stats.rx_errors++,
|
||||||
nl->stats.rx_missed_errors++;
|
dev->stats.rx_missed_errors++;
|
||||||
#endif
|
#endif
|
||||||
/* now skip all frames until is_first != 0 */
|
/* now skip all frames until is_first != 0 */
|
||||||
} else
|
} else
|
||||||
@@ -742,13 +738,11 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno,
|
|||||||
*/
|
*/
|
||||||
nl->wait_frameno = 0,
|
nl->wait_frameno = 0,
|
||||||
#ifdef CONFIG_SBNI_MULTILINE
|
#ifdef CONFIG_SBNI_MULTILINE
|
||||||
((struct net_local *)netdev_priv(nl->master))
|
nl->master->stats.rx_errors++,
|
||||||
->stats.rx_errors++,
|
nl->master->stats.rx_crc_errors++;
|
||||||
((struct net_local *)netdev_priv(nl->master))
|
|
||||||
->stats.rx_crc_errors++;
|
|
||||||
#else
|
#else
|
||||||
nl->stats.rx_errors++,
|
dev->stats.rx_errors++,
|
||||||
nl->stats.rx_crc_errors++;
|
dev->stats.rx_crc_errors++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return frame_ok;
|
return frame_ok;
|
||||||
@@ -756,15 +750,16 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno,
|
|||||||
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
send_complete( struct net_local *nl )
|
send_complete( struct net_device *dev )
|
||||||
{
|
{
|
||||||
|
struct net_local *nl = netdev_priv(dev);
|
||||||
|
|
||||||
#ifdef CONFIG_SBNI_MULTILINE
|
#ifdef CONFIG_SBNI_MULTILINE
|
||||||
((struct net_local *)netdev_priv(nl->master))->stats.tx_packets++;
|
nl->master->stats.tx_packets++;
|
||||||
((struct net_local *)netdev_priv(nl->master))->stats.tx_bytes
|
nl->master->stats.tx_bytes += nl->tx_buf_p->len;
|
||||||
+= nl->tx_buf_p->len;
|
|
||||||
#else
|
#else
|
||||||
nl->stats.tx_packets++;
|
dev->stats.tx_packets++;
|
||||||
nl->stats.tx_bytes += nl->tx_buf_p->len;
|
dev->stats.tx_bytes += nl->tx_buf_p->len;
|
||||||
#endif
|
#endif
|
||||||
dev_kfree_skb_irq( nl->tx_buf_p );
|
dev_kfree_skb_irq( nl->tx_buf_p );
|
||||||
|
|
||||||
@@ -792,7 +787,7 @@ interpret_ack( struct net_device *dev, unsigned ack )
|
|||||||
nl->maxframe,
|
nl->maxframe,
|
||||||
nl->tx_buf_p->len - nl->outpos);
|
nl->tx_buf_p->len - nl->outpos);
|
||||||
else
|
else
|
||||||
send_complete( nl ),
|
send_complete( dev ),
|
||||||
#ifdef CONFIG_SBNI_MULTILINE
|
#ifdef CONFIG_SBNI_MULTILINE
|
||||||
netif_wake_queue( nl->master );
|
netif_wake_queue( nl->master );
|
||||||
#else
|
#else
|
||||||
@@ -881,13 +876,11 @@ drop_xmit_queue( struct net_device *dev )
|
|||||||
dev_kfree_skb_any( nl->tx_buf_p ),
|
dev_kfree_skb_any( nl->tx_buf_p ),
|
||||||
nl->tx_buf_p = NULL,
|
nl->tx_buf_p = NULL,
|
||||||
#ifdef CONFIG_SBNI_MULTILINE
|
#ifdef CONFIG_SBNI_MULTILINE
|
||||||
((struct net_local *)netdev_priv(nl->master))
|
nl->master->stats.tx_errors++,
|
||||||
->stats.tx_errors++,
|
nl->master->stats.tx_carrier_errors++;
|
||||||
((struct net_local *)netdev_priv(nl->master))
|
|
||||||
->stats.tx_carrier_errors++;
|
|
||||||
#else
|
#else
|
||||||
nl->stats.tx_errors++,
|
dev->stats.tx_errors++,
|
||||||
nl->stats.tx_carrier_errors++;
|
dev->stats.tx_carrier_errors++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nl->tx_frameno = 0;
|
nl->tx_frameno = 0;
|
||||||
@@ -1017,14 +1010,13 @@ indicate_pkt( struct net_device *dev )
|
|||||||
#ifdef CONFIG_SBNI_MULTILINE
|
#ifdef CONFIG_SBNI_MULTILINE
|
||||||
skb->protocol = eth_type_trans( skb, nl->master );
|
skb->protocol = eth_type_trans( skb, nl->master );
|
||||||
netif_rx( skb );
|
netif_rx( skb );
|
||||||
++((struct net_local *)netdev_priv(nl->master))->stats.rx_packets;
|
++nl->master->stats.rx_packets;
|
||||||
((struct net_local *)netdev_priv(nl->master))->stats.rx_bytes +=
|
nl->master->stats.rx_bytes += nl->inppos;
|
||||||
nl->inppos;
|
|
||||||
#else
|
#else
|
||||||
skb->protocol = eth_type_trans( skb, dev );
|
skb->protocol = eth_type_trans( skb, dev );
|
||||||
netif_rx( skb );
|
netif_rx( skb );
|
||||||
++nl->stats.rx_packets;
|
++dev->stats.rx_packets;
|
||||||
nl->stats.rx_bytes += nl->inppos;
|
dev->stats.rx_bytes += nl->inppos;
|
||||||
#endif
|
#endif
|
||||||
nl->rx_buf_p = NULL; /* protocol driver will clear this sk_buff */
|
nl->rx_buf_p = NULL; /* protocol driver will clear this sk_buff */
|
||||||
}
|
}
|
||||||
@@ -1197,7 +1189,7 @@ sbni_open( struct net_device *dev )
|
|||||||
handler_attached:
|
handler_attached:
|
||||||
|
|
||||||
spin_lock( &nl->lock );
|
spin_lock( &nl->lock );
|
||||||
memset( &nl->stats, 0, sizeof(struct net_device_stats) );
|
memset( &dev->stats, 0, sizeof(struct net_device_stats) );
|
||||||
memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) );
|
memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) );
|
||||||
|
|
||||||
card_start( dev );
|
card_start( dev );
|
||||||
@@ -1413,7 +1405,7 @@ enslave( struct net_device *dev, struct net_device *slave_dev )
|
|||||||
|
|
||||||
/* Summary statistics of MultiLine operation will be stored
|
/* Summary statistics of MultiLine operation will be stored
|
||||||
in master's counters */
|
in master's counters */
|
||||||
memset( &snl->stats, 0, sizeof(struct net_device_stats) );
|
memset( &slave_dev->stats, 0, sizeof(struct net_device_stats) );
|
||||||
netif_stop_queue( slave_dev );
|
netif_stop_queue( slave_dev );
|
||||||
netif_wake_queue( dev ); /* Now we are able to transmit */
|
netif_wake_queue( dev ); /* Now we are able to transmit */
|
||||||
|
|
||||||
@@ -1464,14 +1456,6 @@ emancipate( struct net_device *dev )
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static struct net_device_stats *
|
|
||||||
sbni_get_stats( struct net_device *dev )
|
|
||||||
{
|
|
||||||
return &((struct net_local *)netdev_priv(dev))->stats;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_multicast_list( struct net_device *dev )
|
set_multicast_list( struct net_device *dev )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user