* [PATCH v3 RFC 0/2] ixgbe: ixgbe_atr() bug fixes
@ 2016-10-17 21:12 Sowmini Varadhan
  2016-10-17 21:12 ` [PATCH V3 RFC 1/2] ixgbe: ixgbe_atr() should access udp_hdr(skb) only for UDP packets Sowmini Varadhan
  2016-10-17 21:12 ` [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers Sowmini Varadhan
  0 siblings, 2 replies; 7+ messages in thread
From: Sowmini Varadhan @ 2016-10-17 21:12 UTC (permalink / raw)
  To: alexander.h.duyck; +Cc: netdev, intel-wired-lan, Sowmini Varadhan
Two bug fixes:
- ixgbe_atr() should check for protocol == udp in the
  skb->encapsulation case (instead of !=)
- ixgbe_atr() should make sure the non-paged data has the
  needed network/transport header for computing l4_proto.
v3: Alex Duyck comments
Sowmini Varadhan (2):
  ixgbe: ixgbe_atr() should access udp_hdr(skb) only for UDP packets
  ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has
    network/transport headers
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH V3 RFC 1/2] ixgbe: ixgbe_atr() should access udp_hdr(skb) only for UDP packets
  2016-10-17 21:12 [PATCH v3 RFC 0/2] ixgbe: ixgbe_atr() bug fixes Sowmini Varadhan
@ 2016-10-17 21:12 ` Sowmini Varadhan
  2016-10-17 21:12 ` [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers Sowmini Varadhan
  1 sibling, 0 replies; 7+ messages in thread
From: Sowmini Varadhan @ 2016-10-17 21:12 UTC (permalink / raw)
  To: alexander.h.duyck; +Cc: netdev, intel-wired-lan, Sowmini Varadhan
Commit 9f12df906cd8 ("ixgbe: Store VXLAN port number in network order")
incorrectly checks for hdr.ipv4->protocol != IPPROTO_UDP
in ixgbe_atr(). This check should be for "==" instead.
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index a244d9a..eceb47b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7653,7 +7653,7 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
 	hdr.network = skb_network_header(skb);
 	if (skb->encapsulation &&
 	    first->protocol == htons(ETH_P_IP) &&
-	    hdr.ipv4->protocol != IPPROTO_UDP) {
+	    hdr.ipv4->protocol == IPPROTO_UDP) {
 		struct ixgbe_adapter *adapter = q_vector->adapter;
 
 		/* verify the port is recognized as VXLAN */
-- 
1.7.1
^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers
  2016-10-17 21:12 [PATCH v3 RFC 0/2] ixgbe: ixgbe_atr() bug fixes Sowmini Varadhan
  2016-10-17 21:12 ` [PATCH V3 RFC 1/2] ixgbe: ixgbe_atr() should access udp_hdr(skb) only for UDP packets Sowmini Varadhan
@ 2016-10-17 21:12 ` Sowmini Varadhan
  2016-10-17 22:29   ` [Intel-wired-lan] " Alexander Duyck
  1 sibling, 1 reply; 7+ messages in thread
From: Sowmini Varadhan @ 2016-10-17 21:12 UTC (permalink / raw)
  To: alexander.h.duyck; +Cc: netdev, intel-wired-lan, Sowmini Varadhan
For some Tx paths (e.g., tpacket_snd()), ixgbe_atr may be
passed down an sk_buff that has the network and transport
header in the paged data, so it needs to make sure these
headers are available in the headlen bytes to calculate the
l4_proto.
This patch expect that network and transport headers are
already available in the non-paged header dat.  The assumption
is that the caller has set this up if l4_proto based Tx
steering is desired.
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
v3: add unlikely(); remove needless check for hdr.network against
    skb_tail_pointer(); refactor check to make sure we have tcp header
    in non-paged part.
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index eceb47b..a9d2b0c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -54,6 +54,7 @@
 #include <net/pkt_cls.h>
 #include <net/tc_act/tc_gact.h>
 #include <net/tc_act/tc_mirred.h>
+#include <net/vxlan.h>
 
 #include "ixgbe.h"
 #include "ixgbe_common.h"
@@ -7651,11 +7652,17 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
 	/* snag network header to get L4 type and address */
 	skb = first->skb;
 	hdr.network = skb_network_header(skb);
+	if (unlikely(hdr.network <= skb->data))
+		return;
 	if (skb->encapsulation &&
 	    first->protocol == htons(ETH_P_IP) &&
 	    hdr.ipv4->protocol == IPPROTO_UDP) {
 		struct ixgbe_adapter *adapter = q_vector->adapter;
 
+		if (unlikely(skb_tail_pointer(skb) < hdr.network +
+					    VXLAN_HEADROOM))
+			return;
+
 		/* verify the port is recognized as VXLAN */
 		if (adapter->vxlan_port &&
 		    udp_hdr(skb)->dest == adapter->vxlan_port)
@@ -7666,6 +7673,12 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
 			hdr.network = skb_inner_network_header(skb);
 	}
 
+	/* Make sure we have at least [minimum IPv4 header + TCP]
+	 * or [IPv6 header] bytes
+	 */
+	if (unlikely(skb_tail_pointer(skb) < hdr.network + 40))
+		return;
+
 	/* Currently only IPv4/IPv6 with TCP is supported */
 	switch (hdr.ipv4->version) {
 	case IPVERSION:
@@ -7685,6 +7698,10 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
 	if (l4_proto != IPPROTO_TCP)
 		return;
 
+	if (unlikely(skb_tail_pointer(skb) < hdr.network +
+					     hlen + sizeof(struct tcphdr)))
+			return;
+
 	th = (struct tcphdr *)(hdr.network + hlen);
 
 	/* skip this packet since the socket is closing */
-- 
1.7.1
^ permalink raw reply related	[flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers
  2016-10-17 21:12 ` [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers Sowmini Varadhan
@ 2016-10-17 22:29   ` Alexander Duyck
  2016-10-17 22:37     ` Jeff Kirsher
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Duyck @ 2016-10-17 22:29 UTC (permalink / raw)
  To: Sowmini Varadhan, Jeff Kirsher
  Cc: Duyck, Alexander H, Netdev, intel-wired-lan
On Mon, Oct 17, 2016 at 2:12 PM, Sowmini Varadhan
<sowmini.varadhan@oracle.com> wrote:
> For some Tx paths (e.g., tpacket_snd()), ixgbe_atr may be
> passed down an sk_buff that has the network and transport
> header in the paged data, so it needs to make sure these
> headers are available in the headlen bytes to calculate the
> l4_proto.
>
> This patch expect that network and transport headers are
> already available in the non-paged header dat.  The assumption
> is that the caller has set this up if l4_proto based Tx
> steering is desired.
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
This all looks correct to me.  I would recommend having Jeff pull it
in to be submitted to the net queue.
Reviewed-by: Alexander Duyck <alexander.h.duyck@intel.com>
^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers
  2016-10-17 22:29   ` [Intel-wired-lan] " Alexander Duyck
@ 2016-10-17 22:37     ` Jeff Kirsher
  2016-10-17 22:47       ` Sowmini Varadhan
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Kirsher @ 2016-10-17 22:37 UTC (permalink / raw)
  To: Alexander Duyck, Sowmini Varadhan
  Cc: Duyck, Alexander H, Netdev, intel-wired-lan
[-- Attachment #1: Type: text/plain, Size: 995 bytes --]
On Mon, 2016-10-17 at 15:29 -0700, Alexander Duyck wrote:
> On Mon, Oct 17, 2016 at 2:12 PM, Sowmini Varadhan
> <sowmini.varadhan@oracle.com> wrote:
> > 
> > For some Tx paths (e.g., tpacket_snd()), ixgbe_atr may be
> > passed down an sk_buff that has the network and transport
> > header in the paged data, so it needs to make sure these
> > headers are available in the headlen bytes to calculate the
> > l4_proto.
> > 
> > This patch expect that network and transport headers are
> > already available in the non-paged header dat.  The assumption
> > is that the caller has set this up if l4_proto based Tx
> > steering is desired.
> > 
> > Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> 
> This all looks correct to me.  I would recommend having Jeff pull it
> in to be submitted to the net queue.
> 
> Reviewed-by: Alexander Duyck <alexander.h.duyck@intel.com>
Sowmini, can you re-submit this to intel-wired-lan but without the RFC in
the title?
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers
  2016-10-17 22:37     ` Jeff Kirsher
@ 2016-10-17 22:47       ` Sowmini Varadhan
  2016-10-17 22:48         ` Jeff Kirsher
  0 siblings, 1 reply; 7+ messages in thread
From: Sowmini Varadhan @ 2016-10-17 22:47 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: Alexander Duyck, Duyck, Alexander H, Netdev, intel-wired-lan
On (10/17/16 15:37), Jeff Kirsher wrote:
> > Reviewed-by: Alexander Duyck <alexander.h.duyck@intel.com>
> 
> Sowmini, can you re-submit this to intel-wired-lan but without the RFC in
> the title?
V4 resubmitted.. I think I just inadvertently forgot to add Alex as the
reviewed-by.. could you please fix that (or I can resubmit v5 if needed).
--Sowmini
^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers
  2016-10-17 22:47       ` Sowmini Varadhan
@ 2016-10-17 22:48         ` Jeff Kirsher
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Kirsher @ 2016-10-17 22:48 UTC (permalink / raw)
  To: Sowmini Varadhan
  Cc: Alexander Duyck, Duyck, Alexander H, Netdev, intel-wired-lan
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
On Mon, 2016-10-17 at 18:47 -0400, Sowmini Varadhan wrote:
> On (10/17/16 15:37), Jeff Kirsher wrote:
> > > Reviewed-by: Alexander Duyck <alexander.h.duyck@intel.com>
> > 
> > Sowmini, can you re-submit this to intel-wired-lan but without the RFC
> in
> > the title?
> 
> V4 resubmitted.. I think I just inadvertently forgot to add Alex as the
> reviewed-by.. could you please fix that (or I can resubmit v5 if needed).
No need to resubmit, I can make sure Alex's reviewed-by gets added.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply	[flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-10-17 22:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-17 21:12 [PATCH v3 RFC 0/2] ixgbe: ixgbe_atr() bug fixes Sowmini Varadhan
2016-10-17 21:12 ` [PATCH V3 RFC 1/2] ixgbe: ixgbe_atr() should access udp_hdr(skb) only for UDP packets Sowmini Varadhan
2016-10-17 21:12 ` [PATCH V3 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers Sowmini Varadhan
2016-10-17 22:29   ` [Intel-wired-lan] " Alexander Duyck
2016-10-17 22:37     ` Jeff Kirsher
2016-10-17 22:47       ` Sowmini Varadhan
2016-10-17 22:48         ` Jeff Kirsher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).