aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorYi Zou <yi.zou@intel.com>2009-06-08 10:38:44 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-09 08:25:37 -0400
commit3d8fd38567729202afd0ff3904c818ed0cb1de52 (patch)
treee911c9f525a9ed2bbec13d6b58db41c5119936e0 /drivers/net
parent18760f1e74e8dfe8f30d4891e66163d1e6feb893 (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')
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.c6
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.h1
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c40
3 files changed, 42 insertions, 5 deletions
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index d5939de8ba28..3c3bf1f07b81 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -280,7 +280,9 @@ out_noddp_unmap:
280 * 280 *
281 * This checks ddp status. 281 * This checks ddp status.
282 * 282 *
283 * Returns : 0 for success and skb will not be delivered to ULD 283 * Returns : < 0 indicates an error or not a FCiE ddp, 0 indicates
284 * not passing the skb to ULD, > 0 indicates is the length of data
285 * being ddped.
284 */ 286 */
285int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, 287int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
286 union ixgbe_adv_rx_desc *rx_desc, 288 union ixgbe_adv_rx_desc *rx_desc,
@@ -334,6 +336,8 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
334 /* return 0 to bypass going to ULD for DDPed data */ 336 /* return 0 to bypass going to ULD for DDPed data */
335 if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP) 337 if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP)
336 rc = 0; 338 rc = 0;
339 else
340 rc = ddp->len;
337 } 341 }
338 342
339ddp_out: 343ddp_out:
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.h b/drivers/net/ixgbe/ixgbe_fcoe.h
index b7f9b63aa49f..c5b50026a897 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.h
+++ b/drivers/net/ixgbe/ixgbe_fcoe.h
@@ -28,6 +28,7 @@
28#ifndef _IXGBE_FCOE_H 28#ifndef _IXGBE_FCOE_H
29#define _IXGBE_FCOE_H 29#define _IXGBE_FCOE_H
30 30
31#include <scsi/fc/fc_fs.h>
31#include <scsi/fc/fc_fcoe.h> 32#include <scsi/fc/fc_fcoe.h>
32 33
33/* shift bits within STAT fo FCSTAT */ 34/* shift bits within STAT fo FCSTAT */
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;