Skip to contentSkip to conversation

ixgbe: Fix secpath usage for IPsec TX offload.

PATCH In review Steffen Klassert 6 participants 8 messages Sep 12, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbe: Fix secpath usage for IPsec TX offload.

The ixgbe driver currently does IPsec TX offloading based on an existing secpath. However, the secpath can also come from the RX side, in this case it is misinterpreted for TX offload and the packets are dropped with a "bad sa_idx" error. Fix this by using the xfrm_offload() function to test for TX offload.

Fixes 592594704761 ("ixgbe: process the Tx ipsec offload")
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
index 9bcae44e9883..ae31bd57127c 100644
@@ -36,6 +36,7 @@
 #include <net/vxlan.h>
 #include <net/mpls.h>
 #include <net/xdp_sock.h>
+#include <net/xfrm.h>
 
 #include "ixgbe.h"
 #include "ixgbe_common.h"
@@ -8696,7 +8697,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
 #endif /* IXGBE_FCOE */
 
 #ifdef CONFIG_IXGBE_IPSEC
-	if (secpath_exists(skb) &&
+	if (xfrm_offload(skb) &&
 	    !ixgbe_ipsec_tx(tx_ring, first, &ipsec_tx))
 		goto out_drop;
 #endif
Signature · 1 line
2.17.1
maintainer
#1 lore raw

From: Steffen Klassert <[email protected]>
Date: Thu, 12 Sep 2019 13:01:44 +0200

Quoted 10 lines

The ixgbe driver currently does IPsec TX offloading based on an existing secpath. However, the secpath can also come from the RX side, in this case it is misinterpreted for TX offload and the packets are dropped with a "bad sa_idx" error. Fix this by using the xfrm_offload() function to test for TX offload.

Fixes 592594704761 ("ixgbe: process the Tx ipsec offload")

I'll apply this directly and queue it up for -stable, thanks.

#2 lore raw
Quoted 10 lines · David Miller

From: Steffen Klassert <[email protected]>
Date: Thu, 12 Sep 2019 13:01:44 +0200

Quoted 7 lines

The ixgbe driver currently does IPsec TX offloading based on an existing secpath. However, the secpath can also come from the RX side, in this case it is misinterpreted for TX offload and the packets are dropped with a "bad sa_idx" error. Fix this by using the xfrm_offload() function to test for TX offload.

Quoted 5 lines
Quoted 3 lines
Fixes 592594704761 ("ixgbe: process the Tx ipsec offload")

I'll apply this directly and queue it up for -stable, thanks.

Thanks Dave!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20190912/16161466/attachment.asc>

#3 lore raw
In reply to Steffen Klassert
Quoted 7 lines · Steffen Klassert

The ixgbe driver currently does IPsec TX offloading based on an existing secpath. However, the secpath can also come from the RX side, in this case it is misinterpreted for TX offload and the packets are dropped with a "bad sa_idx" error. Fix this by using the xfrm_offload() function to test for TX offload.

Does this patch also need to be ported to the ixgbevf driver? I can replicate the bad sa_idx error using a VM that's using a VF & the ixgebvf  driver.

#4 lore raw
Quoted 8 lines · Jonathan Tooker
Quoted 7 lines · Steffen Klassert

The ixgbe driver currently does IPsec TX offloading based on an existing secpath. However, the secpath can also come from the RX side, in this case it is misinterpreted for TX offload and the packets are dropped with a "bad sa_idx" error. Fix this by using the xfrm_offload() function to test for TX offload.

Quoted 4 lines

Does this patch also need to be ported to the ixgbevf driver? I can replicate the bad sa_idx error using a VM that's using a VF & the ixgebvf? driver.

Yes.
sln

#5 lore raw
In reply to Jonathan Tooker
Quoted 8 lines · Jonathan Tooker
Quoted 7 lines · Steffen Klassert

The ixgbe driver currently does IPsec TX offloading based on an existing secpath. However, the secpath can also come from the RX side, in this case it is misinterpreted for TX offload and the packets are dropped with a "bad sa_idx" error. Fix this by using the xfrm_offload() function to test for TX offload.

Quoted 4 lines

Does this patch also need to be ported to the ixgbevf driver? I can replicate the bad sa_idx error using a VM that's using a VF & the ixgebvf driver.

I am putting together a patch for ixgbevf right now.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20190912/ebfd966e/attachment.asc>

Acked-by on v1 1/1
#6 lore raw
In reply to Steffen Klassert
Quoted 6 lines · Steffen Klassert

The ixgbe driver currently does IPsec TX offloading based on an existing secpath. However, the secpath can also come from the RX side, in this case it is misinterpreted for TX offload and the packets are dropped with a "bad sa_idx" error. Fix this by using the xfrm_offload() function to test for TX offload.

Quoted 29 lines
Fixes 592594704761 ("ixgbe: process the Tx ipsec offload")
---
  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
index 9bcae44e9883..ae31bd57127c 100644
@@ -36,6 +36,7 @@
  #include <net/vxlan.h>
  #include <net/mpls.h>
  #include <net/xdp_sock.h>
+#include <net/xfrm.h>
 
  #include "ixgbe.h"
  #include "ixgbe_common.h"
@@ -8696,7 +8697,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
  #endif /* IXGBE_FCOE */
 
  #ifdef CONFIG_IXGBE_IPSEC
-	if (secpath_exists(skb) &&
+	if (xfrm_offload(skb) &&
  	    !ixgbe_ipsec_tx(tx_ring, first, &ipsec_tx))
  		goto out_drop;
  #endif
Tested-by on v1 1/1
#7 lore raw
In reply to Steffen Klassert
Quoted 10 lines · Steffen Klassert

The ixgbe driver currently does IPsec TX offloading based on an existing secpath. However, the secpath can also come from the RX side, in this case it is misinterpreted for TX offload and the packets are dropped with a "bad sa_idx" error. Fix this by using the xfrm_offload() function to test for TX offload.

Fixes 592594704761 ("ixgbe: process the Tx ipsec offload")
Quoted 27 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
index 9bcae44e9883..ae31bd57127c 100644
@@ -36,6 +36,7 @@
 #include <net/vxlan.h>
 #include <net/mpls.h>
 #include <net/xdp_sock.h>
+#include <net/xfrm.h>
 
 #include "ixgbe.h"
 #include "ixgbe_common.h"
@@ -8696,7 +8697,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff 
 *skb,
 #endif /* IXGBE_FCOE */
 
 #ifdef CONFIG_IXGBE_IPSEC
-	if (secpath_exists(skb) &&
+	if (xfrm_offload(skb) &&
 	    !ixgbe_ipsec_tx(tx_ring, first, &ipsec_tx))
 		goto out_drop;

#endif