diff options
author | Ayyappan Veeraiyan <ayyappan.veeraiyan@intel.com> | 2008-02-01 18:59:19 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-02-05 13:31:37 -0500 |
commit | d2f4fbe2982b3b9e46deea8d7288ea8f8d7b5bc4 (patch) | |
tree | fbbf554fb01a2cab86fe5e083561bedee9c715d5 /drivers/net/ixgbe/ixgbe_main.c | |
parent | 6f11eef7790828c33b4f6fc41aed9815ad047e7c (diff) |
ixgbe: add real-time traffic counters
Just like our other drivers before we can switch ixgbe to
provide real-time packet/byte counters to the stack easily.
Signed-off-by: Ayyappan Veeraiyan <ayyappan.veeraiyan@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 6e7d90e69b52..ead49e54f31b 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -275,6 +275,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter, | |||
275 | if (total_tx_packets >= tx_ring->work_limit) | 275 | if (total_tx_packets >= tx_ring->work_limit) |
276 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, tx_ring->eims_value); | 276 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, tx_ring->eims_value); |
277 | 277 | ||
278 | adapter->net_stats.tx_bytes += total_tx_bytes; | ||
279 | adapter->net_stats.tx_packets += total_tx_packets; | ||
278 | cleaned = total_tx_packets ? true : false; | 280 | cleaned = total_tx_packets ? true : false; |
279 | return cleaned; | 281 | return cleaned; |
280 | } | 282 | } |
@@ -443,6 +445,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_adapter *adapter, | |||
443 | u16 hdr_info, vlan_tag; | 445 | u16 hdr_info, vlan_tag; |
444 | bool is_vlan, cleaned = false; | 446 | bool is_vlan, cleaned = false; |
445 | int cleaned_count = 0; | 447 | int cleaned_count = 0; |
448 | unsigned int total_rx_bytes = 0, total_rx_packets = 0; | ||
446 | 449 | ||
447 | i = rx_ring->next_to_clean; | 450 | i = rx_ring->next_to_clean; |
448 | upper_len = 0; | 451 | upper_len = 0; |
@@ -522,6 +525,11 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_adapter *adapter, | |||
522 | } | 525 | } |
523 | 526 | ||
524 | ixgbe_rx_checksum(adapter, staterr, skb); | 527 | ixgbe_rx_checksum(adapter, staterr, skb); |
528 | |||
529 | /* probably a little skewed due to removing CRC */ | ||
530 | total_rx_bytes += skb->len; | ||
531 | total_rx_packets++; | ||
532 | |||
525 | skb->protocol = eth_type_trans(skb, netdev); | 533 | skb->protocol = eth_type_trans(skb, netdev); |
526 | ixgbe_receive_skb(adapter, skb, is_vlan, vlan_tag); | 534 | ixgbe_receive_skb(adapter, skb, is_vlan, vlan_tag); |
527 | netdev->last_rx = jiffies; | 535 | netdev->last_rx = jiffies; |
@@ -550,6 +558,9 @@ next_desc: | |||
550 | if (cleaned_count) | 558 | if (cleaned_count) |
551 | ixgbe_alloc_rx_buffers(adapter, rx_ring, cleaned_count); | 559 | ixgbe_alloc_rx_buffers(adapter, rx_ring, cleaned_count); |
552 | 560 | ||
561 | adapter->net_stats.rx_bytes += total_rx_bytes; | ||
562 | adapter->net_stats.rx_packets += total_rx_packets; | ||
563 | |||
553 | return cleaned; | 564 | return cleaned; |
554 | } | 565 | } |
555 | 566 | ||
@@ -2088,10 +2099,6 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
2088 | adapter->stats.bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); | 2099 | adapter->stats.bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); |
2089 | 2100 | ||
2090 | /* Fill out the OS statistics structure */ | 2101 | /* Fill out the OS statistics structure */ |
2091 | adapter->net_stats.rx_packets = adapter->stats.gprc; | ||
2092 | adapter->net_stats.tx_packets = adapter->stats.gptc; | ||
2093 | adapter->net_stats.rx_bytes = adapter->stats.gorc; | ||
2094 | adapter->net_stats.tx_bytes = adapter->stats.gotc; | ||
2095 | adapter->net_stats.multicast = adapter->stats.mprc; | 2102 | adapter->net_stats.multicast = adapter->stats.mprc; |
2096 | 2103 | ||
2097 | /* Rx Errors */ | 2104 | /* Rx Errors */ |