diff options
author | Ajit Khaparde <ajitkhaparde@gmail.com> | 2010-02-19 08:57:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-19 20:11:53 -0500 |
commit | 91992e446cadbbde1a304de6954afd715af5121e (patch) | |
tree | c35db4f51eee079a19018e251ec4f03a9c410d79 /drivers/net/benet/be_main.c | |
parent | 294aedcf875b982e2d3bd6d2d9b8124ccb163bf6 (diff) |
be2net: Maintain tx and rx counters in driver
For certain skews of the BE adapter, H/W Tx and Rx
counters could be common for more than one interface.
Add Tx and Rx counters in the adapter structure
(to maintain stats on a per interfae basis).
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r-- | drivers/net/benet/be_main.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index f66704460876..de0830e14aa5 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -159,13 +159,10 @@ void netdev_stats_update(struct be_adapter *adapter) | |||
159 | struct net_device_stats *dev_stats = &adapter->netdev->stats; | 159 | struct net_device_stats *dev_stats = &adapter->netdev->stats; |
160 | struct be_erx_stats *erx_stats = &hw_stats->erx; | 160 | struct be_erx_stats *erx_stats = &hw_stats->erx; |
161 | 161 | ||
162 | dev_stats->rx_packets = port_stats->rx_total_frames; | 162 | dev_stats->rx_packets = drvr_stats(adapter)->be_rx_pkts; |
163 | dev_stats->tx_packets = port_stats->tx_unicastframes + | 163 | dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts; |
164 | port_stats->tx_multicastframes + port_stats->tx_broadcastframes; | 164 | dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes; |
165 | dev_stats->rx_bytes = (u64) port_stats->rx_bytes_msd << 32 | | 165 | dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes; |
166 | (u64) port_stats->rx_bytes_lsd; | ||
167 | dev_stats->tx_bytes = (u64) port_stats->tx_bytes_msd << 32 | | ||
168 | (u64) port_stats->tx_bytes_lsd; | ||
169 | 166 | ||
170 | /* bad pkts received */ | 167 | /* bad pkts received */ |
171 | dev_stats->rx_errors = port_stats->rx_crc_errors + | 168 | dev_stats->rx_errors = port_stats->rx_crc_errors + |
@@ -322,12 +319,13 @@ static void be_tx_rate_update(struct be_adapter *adapter) | |||
322 | } | 319 | } |
323 | 320 | ||
324 | static void be_tx_stats_update(struct be_adapter *adapter, | 321 | static void be_tx_stats_update(struct be_adapter *adapter, |
325 | u32 wrb_cnt, u32 copied, bool stopped) | 322 | u32 wrb_cnt, u32 copied, u32 gso_segs, bool stopped) |
326 | { | 323 | { |
327 | struct be_drvr_stats *stats = drvr_stats(adapter); | 324 | struct be_drvr_stats *stats = drvr_stats(adapter); |
328 | stats->be_tx_reqs++; | 325 | stats->be_tx_reqs++; |
329 | stats->be_tx_wrbs += wrb_cnt; | 326 | stats->be_tx_wrbs += wrb_cnt; |
330 | stats->be_tx_bytes += copied; | 327 | stats->be_tx_bytes += copied; |
328 | stats->be_tx_pkts += (gso_segs ? gso_segs : 1); | ||
331 | if (stopped) | 329 | if (stopped) |
332 | stats->be_tx_stops++; | 330 | stats->be_tx_stops++; |
333 | } | 331 | } |
@@ -472,7 +470,8 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, | |||
472 | 470 | ||
473 | be_txq_notify(adapter, txq->id, wrb_cnt); | 471 | be_txq_notify(adapter, txq->id, wrb_cnt); |
474 | 472 | ||
475 | be_tx_stats_update(adapter, wrb_cnt, copied, stopped); | 473 | be_tx_stats_update(adapter, wrb_cnt, copied, |
474 | skb_shinfo(skb)->gso_segs, stopped); | ||
476 | } else { | 475 | } else { |
477 | txq->head = start; | 476 | txq->head = start; |
478 | dev_kfree_skb_any(skb); | 477 | dev_kfree_skb_any(skb); |
@@ -619,6 +618,7 @@ static void be_rx_stats_update(struct be_adapter *adapter, | |||
619 | stats->be_rx_compl++; | 618 | stats->be_rx_compl++; |
620 | stats->be_rx_frags += numfrags; | 619 | stats->be_rx_frags += numfrags; |
621 | stats->be_rx_bytes += pktsize; | 620 | stats->be_rx_bytes += pktsize; |
621 | stats->be_rx_pkts++; | ||
622 | } | 622 | } |
623 | 623 | ||
624 | static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) | 624 | static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) |