All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Alexander Duyck <alexander.h.duyck@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, guru.anbalagane@oracle.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 14/15] i40e: Limit TX descriptor count in cases where frag size is greater than 16K
Date: Tue, 20 Sep 2016 20:43:51 -0700	[thread overview]
Message-ID: <1474429432-102772-15-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1474429432-102772-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Alexander Duyck <alexander.h.duyck@intel.com>

The i40e driver was incorrectly assuming that we would always be pulling
no more than 1 descriptor from each fragment.  It is in fact possible for
us to end up with the case where 2 descriptors worth of data may be pulled
when a frame is larger than one of the pieces generated when aligning the
payload to either 4K or pieces smaller than 16K.

To adjust for this we just need to make certain to test all the way to the
end of the fragments as it is possible for us to span 2 descriptors in the
block before us so we need to guarantee that even the last 6 descriptors
have enough data to fill a full frame.

Change-ID: Ic2ecb4d6b745f447d334e66c14002152f50e2f99
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 7 ++-----
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index f8d6623..bf7bb7c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2621,9 +2621,7 @@ bool __i40e_chk_linearize(struct sk_buff *skb)
 		return false;
 
 	/* We need to walk through the list and validate that each group
-	 * of 6 fragments totals at least gso_size.  However we don't need
-	 * to perform such validation on the last 6 since the last 6 cannot
-	 * inherit any data from a descriptor after them.
+	 * of 6 fragments totals at least gso_size.
 	 */
 	nr_frags -= I40E_MAX_BUFFER_TXD - 2;
 	frag = &skb_shinfo(skb)->frags[0];
@@ -2654,8 +2652,7 @@ bool __i40e_chk_linearize(struct sk_buff *skb)
 		if (sum < 0)
 			return true;
 
-		/* use pre-decrement to avoid processing last fragment */
-		if (!--nr_frags)
+		if (!nr_frags--)
 			break;
 
 		sum -= skb_frag_size(stale++);
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 0130458..e3427eb 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1832,9 +1832,7 @@ bool __i40evf_chk_linearize(struct sk_buff *skb)
 		return false;
 
 	/* We need to walk through the list and validate that each group
-	 * of 6 fragments totals at least gso_size.  However we don't need
-	 * to perform such validation on the last 6 since the last 6 cannot
-	 * inherit any data from a descriptor after them.
+	 * of 6 fragments totals at least gso_size.
 	 */
 	nr_frags -= I40E_MAX_BUFFER_TXD - 2;
 	frag = &skb_shinfo(skb)->frags[0];
@@ -1865,8 +1863,7 @@ bool __i40evf_chk_linearize(struct sk_buff *skb)
 		if (sum < 0)
 			return true;
 
-		/* use pre-decrement to avoid processing last fragment */
-		if (!--nr_frags)
+		if (!nr_frags--)
 			break;
 
 		sum -= skb_frag_size(stale++);
-- 
2.7.4

  parent reply	other threads:[~2016-09-21  3:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  3:43 [net-next 00/15][pull request] 40GbE Intel Wired LAN Driver Updates 2016-09-20 Jeff Kirsher
2016-09-21  3:43 ` [net-next 01/15] i40e: Introduce VF port representor/control netdevs Jeff Kirsher
2016-09-21  4:22   ` Or Gerlitz
2016-09-21  5:45     ` Samudrala, Sridhar
2016-09-21  7:04       ` Or Gerlitz
2016-09-21 16:59         ` Samudrala, Sridhar
2016-09-21 19:21           ` Or Gerlitz
2016-09-21 21:23             ` Jeff Kirsher
2016-09-21  3:43 ` [net-next 02/15] i40e: Enable VF specific ethtool statistics via VF Port representor netdevs Jeff Kirsher
2016-09-21  4:26   ` Or Gerlitz
2016-09-21  5:59     ` Samudrala, Sridhar
2016-09-21  6:54       ` Or Gerlitz
2016-09-21  3:43 ` [net-next 03/15] i40e: Introduce devlink interface Jeff Kirsher
2016-09-21  3:43 ` [net-next 04/15] i40e: fix setting user defined RSS hash key Jeff Kirsher
2016-09-21  3:43 ` [net-next 05/15] i40e: fix "dump port" command when NPAR enabled Jeff Kirsher
2016-09-21  3:43 ` [net-next 06/15] i40e: return correct opcode to VF Jeff Kirsher
2016-09-21  3:43 ` [net-next 07/15] i40e: Fix to check for NULL Jeff Kirsher
2016-09-21  3:43 ` [net-next 08/15] i40e: Fix for extra byte swap in tunnel setup Jeff Kirsher
2016-09-21  3:43 ` [net-next 09/15] i40e: avoid potential null pointer dereference when assigning len Jeff Kirsher
2016-09-21  3:43 ` [net-next 10/15] i40e: Add support for switchdev API for Switch ID Jeff Kirsher
2016-09-21  3:43 ` [net-next 11/15] i40evf: Fix link state event handling Jeff Kirsher
2016-09-21  3:43 ` [net-next 12/15] i40e: Sync link state between VFs and VF Port representors(VFPR) Jeff Kirsher
2016-09-21  3:43 ` [net-next 13/15] i40evf: remove unnecessary error checking against i40evf_up_complete Jeff Kirsher
2016-09-21  3:43 ` Jeff Kirsher [this message]
2016-09-21  3:43 ` [net-next 15/15] i40evf: remove unnecessary error checking against i40e_shutdown_adminq Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474429432-102772-15-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=guru.anbalagane@oracle.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.