diff options
author | Yi Zou <yi.zou@intel.com> | 2009-06-08 10:38:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-09 08:25:37 -0400 |
commit | 3d8fd38567729202afd0ff3904c818ed0cb1de52 (patch) | |
tree | e911c9f525a9ed2bbec13d6b58db41c5119936e0 /drivers/net/ixgbe/ixgbe_main.c | |
parent | 18760f1e74e8dfe8f30d4891e66163d1e6feb893 (diff) |
ixgbe: Include offloaded FCoE data into total rx/tx statistics for 82599
Include offloaded FCoE data into total rx/tx statistics for 82599 so they
are properly reflected by ethtool or ifconfig.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 09994e920d5d..a551a96ce676 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -293,12 +293,24 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, | |||
293 | 293 | ||
294 | if (cleaned && skb) { | 294 | if (cleaned && skb) { |
295 | unsigned int segs, bytecount; | 295 | unsigned int segs, bytecount; |
296 | unsigned int hlen = skb_headlen(skb); | ||
296 | 297 | ||
297 | /* gso_segs is currently only valid for tcp */ | 298 | /* gso_segs is currently only valid for tcp */ |
298 | segs = skb_shinfo(skb)->gso_segs ?: 1; | 299 | segs = skb_shinfo(skb)->gso_segs ?: 1; |
300 | #ifdef IXGBE_FCOE | ||
301 | /* adjust for FCoE Sequence Offload */ | ||
302 | if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) | ||
303 | && (skb->protocol == htons(ETH_P_FCOE)) && | ||
304 | skb_is_gso(skb)) { | ||
305 | hlen = skb_transport_offset(skb) + | ||
306 | sizeof(struct fc_frame_header) + | ||
307 | sizeof(struct fcoe_crc_eof); | ||
308 | segs = DIV_ROUND_UP(skb->len - hlen, | ||
309 | skb_shinfo(skb)->gso_size); | ||
310 | } | ||
311 | #endif /* IXGBE_FCOE */ | ||
299 | /* multiply data chunks by size of headers */ | 312 | /* multiply data chunks by size of headers */ |
300 | bytecount = ((segs - 1) * skb_headlen(skb)) + | 313 | bytecount = ((segs - 1) * hlen) + skb->len; |
301 | skb->len; | ||
302 | total_packets += segs; | 314 | total_packets += segs; |
303 | total_bytes += bytecount; | 315 | total_bytes += bytecount; |
304 | } | 316 | } |
@@ -683,6 +695,9 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
683 | bool cleaned = false; | 695 | bool cleaned = false; |
684 | int cleaned_count = 0; | 696 | int cleaned_count = 0; |
685 | unsigned int total_rx_bytes = 0, total_rx_packets = 0; | 697 | unsigned int total_rx_bytes = 0, total_rx_packets = 0; |
698 | #ifdef IXGBE_FCOE | ||
699 | int ddp_bytes = 0; | ||
700 | #endif /* IXGBE_FCOE */ | ||
686 | 701 | ||
687 | i = rx_ring->next_to_clean; | 702 | i = rx_ring->next_to_clean; |
688 | rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i); | 703 | rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i); |
@@ -793,9 +808,11 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
793 | skb->protocol = eth_type_trans(skb, adapter->netdev); | 808 | skb->protocol = eth_type_trans(skb, adapter->netdev); |
794 | #ifdef IXGBE_FCOE | 809 | #ifdef IXGBE_FCOE |
795 | /* if ddp, not passing to ULD unless for FCP_RSP or error */ | 810 | /* if ddp, not passing to ULD unless for FCP_RSP or error */ |
796 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) | 811 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { |
797 | if (!ixgbe_fcoe_ddp(adapter, rx_desc, skb)) | 812 | ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb); |
813 | if (!ddp_bytes) | ||
798 | goto next_desc; | 814 | goto next_desc; |
815 | } | ||
799 | #endif /* IXGBE_FCOE */ | 816 | #endif /* IXGBE_FCOE */ |
800 | ixgbe_receive_skb(q_vector, skb, staterr, rx_ring, rx_desc); | 817 | ixgbe_receive_skb(q_vector, skb, staterr, rx_ring, rx_desc); |
801 | 818 | ||
@@ -821,6 +838,21 @@ next_desc: | |||
821 | if (cleaned_count) | 838 | if (cleaned_count) |
822 | ixgbe_alloc_rx_buffers(adapter, rx_ring, cleaned_count); | 839 | ixgbe_alloc_rx_buffers(adapter, rx_ring, cleaned_count); |
823 | 840 | ||
841 | #ifdef IXGBE_FCOE | ||
842 | /* include DDPed FCoE data */ | ||
843 | if (ddp_bytes > 0) { | ||
844 | unsigned int mss; | ||
845 | |||
846 | mss = adapter->netdev->mtu - sizeof(struct fcoe_hdr) - | ||
847 | sizeof(struct fc_frame_header) - | ||
848 | sizeof(struct fcoe_crc_eof); | ||
849 | if (mss > 512) | ||
850 | mss &= ~511; | ||
851 | total_rx_bytes += ddp_bytes; | ||
852 | total_rx_packets += DIV_ROUND_UP(ddp_bytes, mss); | ||
853 | } | ||
854 | #endif /* IXGBE_FCOE */ | ||
855 | |||
824 | rx_ring->total_packets += total_rx_packets; | 856 | rx_ring->total_packets += total_rx_packets; |
825 | rx_ring->total_bytes += total_rx_bytes; | 857 | rx_ring->total_bytes += total_rx_bytes; |
826 | adapter->net_stats.rx_bytes += total_rx_bytes; | 858 | adapter->net_stats.rx_bytes += total_rx_bytes; |