DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice/base: fix bm mask set and find switch recipe method
@ 2020-04-28  6:22 Wei Zhao
  2020-04-28  6:49 ` Zhao1, Wei
  2020-04-29  8:42 ` [dpdk-dev] [PATCH v2] " Wei Zhao
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Zhao @ 2020-04-28  6:22 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

When we download a switch rule for ipv6 with esp payload
"eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"

if we don't add bm bit set check for tun_type, then a packet of
ipv4 with esp payload

"sendp([Ether(dst="00:00:00:00:01:00")/IP(proto=50)/ESP(spi=1)/
("X"*480)], iface="ens5f0", count=10)"

will also go to queue index 2. And also, we need to do tun_type
check, or the second rule of following can not be download because
of rejection from switch rule download function ice_aq_sw_rules().

"eth / ipv4 / esp spi is 1 / end actions queue index 5 / end"

"eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 15 ++++++++++-----
 drivers/net/ice/base/ice_switch.h |  2 ++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index e64b03136..7d5d57938 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -5278,11 +5278,8 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
 			/* If for "i"th recipe the found was never set to false
 			 * then it means we found our match
 			 */
-			if (ice_is_prof_rule(tun_type) &&
-			    tun_type == recp[i].tun_type && found)
-				return i; /* Return the recipe ID */
-			else if (!ice_is_prof_rule(tun_type) && found)
-				return i; /* Return the recipe ID */
+			if (tun_type == recp[i].tun_type && found)
+				return i;
 		}
 	}
 	return ICE_MAX_NUM_RECIPES;
@@ -5998,9 +5995,11 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 		prof_type = ICE_PROF_TUN_PPPOE;
 		break;
 	case ICE_SW_TUN_PROFID_IPV6_ESP:
+	case ICE_SW_TUN_IPV6_ESP:
 		ice_set_bit(ICE_PROFID_IPV6_ESP, bm);
 		return;
 	case ICE_SW_TUN_PROFID_IPV6_AH:
+	case ICE_SW_TUN_IPV6_AH:
 		ice_set_bit(ICE_PROFID_IPV6_AH, bm);
 		return;
 	case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
@@ -6029,6 +6028,12 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 	case ICE_SW_TUN_IPV4_L2TPV3:
 		ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm);
 		return;
+	case ICE_SW_TUN_IPV4_ESP:
+		ice_set_bit(ICE_PROFID_IPV4_ESP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_AH:
+		ice_set_bit(ICE_PROFID_IPV4_AH, bm);
+		return;
 	case ICE_SW_TUN_AND_NON_TUN:
 	default:
 		prof_type = ICE_PROF_ALL;
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 09dc1f236..6bb742d2f 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -16,7 +16,9 @@
 #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
 
 /* Switch Profile IDs for Profile related switch rules */
+#define ICE_PROFID_IPV4_ESP		71
 #define ICE_PROFID_IPV6_ESP		72
+#define ICE_PROFID_IPV4_AH		73
 #define ICE_PROFID_IPV6_AH		74
 #define ICE_PROFID_IPV4_NAT_T		75
 #define ICE_PROFID_IPV6_NAT_T		76
-- 
2.19.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] net/ice/base: fix bm mask set and find switch recipe method
  2020-04-28  6:22 [dpdk-dev] [PATCH] net/ice/base: fix bm mask set and find switch recipe method Wei Zhao
@ 2020-04-28  6:49 ` Zhao1, Wei
  2020-04-29 10:16   ` Fu, Qi
  2020-04-29  8:42 ` [dpdk-dev] [PATCH v2] " Wei Zhao
  1 sibling, 1 reply; 6+ messages in thread
From: Zhao1, Wei @ 2020-04-28  6:49 UTC (permalink / raw)
  To: dev; +Cc: Zhang, Qi Z, Fu, Qi

Add fuqi

> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Tuesday, April 28, 2020 2:22 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH] net/ice/base: fix bm mask set and find switch recipe method
> 
> When we download a switch rule for ipv6 with esp payload "eth / ipv6 / esp spi
> is 1 / end actions queue index 2 / end"
> 
> if we don't add bm bit set check for tun_type, then a packet of
> ipv4 with esp payload
> 
> "sendp([Ether(dst="00:00:00:00:01:00")/IP(proto=50)/ESP(spi=1)/
> ("X"*480)], iface="ens5f0", count=10)"
> 
> will also go to queue index 2. And also, we need to do tun_type check, or the
> second rule of following can not be download because of rejection from switch
> rule download function ice_aq_sw_rules().
> 
> "eth / ipv4 / esp spi is 1 / end actions queue index 5 / end"
> 
> "eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/ice/base/ice_switch.c | 15 ++++++++++-----
> drivers/net/ice/base/ice_switch.h |  2 ++
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ice/base/ice_switch.c
> b/drivers/net/ice/base/ice_switch.c
> index e64b03136..7d5d57938 100644
> --- a/drivers/net/ice/base/ice_switch.c
> +++ b/drivers/net/ice/base/ice_switch.c
> @@ -5278,11 +5278,8 @@ static u16 ice_find_recp(struct ice_hw *hw, struct
> ice_prot_lkup_ext *lkup_exts,
>  			/* If for "i"th recipe the found was never set to false
>  			 * then it means we found our match
>  			 */
> -			if (ice_is_prof_rule(tun_type) &&
> -			    tun_type == recp[i].tun_type && found)
> -				return i; /* Return the recipe ID */
> -			else if (!ice_is_prof_rule(tun_type) && found)
> -				return i; /* Return the recipe ID */
> +			if (tun_type == recp[i].tun_type && found)
> +				return i;
>  		}
>  	}
>  	return ICE_MAX_NUM_RECIPES;
> @@ -5998,9 +5995,11 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw,
> struct ice_adv_rule_info *rinfo,
>  		prof_type = ICE_PROF_TUN_PPPOE;
>  		break;
>  	case ICE_SW_TUN_PROFID_IPV6_ESP:
> +	case ICE_SW_TUN_IPV6_ESP:
>  		ice_set_bit(ICE_PROFID_IPV6_ESP, bm);
>  		return;
>  	case ICE_SW_TUN_PROFID_IPV6_AH:
> +	case ICE_SW_TUN_IPV6_AH:
>  		ice_set_bit(ICE_PROFID_IPV6_AH, bm);
>  		return;
>  	case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
> @@ -6029,6 +6028,12 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw,
> struct ice_adv_rule_info *rinfo,
>  	case ICE_SW_TUN_IPV4_L2TPV3:
>  		ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm);
>  		return;
> +	case ICE_SW_TUN_IPV4_ESP:
> +		ice_set_bit(ICE_PROFID_IPV4_ESP, bm);
> +		return;
> +	case ICE_SW_TUN_IPV4_AH:
> +		ice_set_bit(ICE_PROFID_IPV4_AH, bm);
> +		return;
>  	case ICE_SW_TUN_AND_NON_TUN:
>  	default:
>  		prof_type = ICE_PROF_ALL;
> diff --git a/drivers/net/ice/base/ice_switch.h
> b/drivers/net/ice/base/ice_switch.h
> index 09dc1f236..6bb742d2f 100644
> --- a/drivers/net/ice/base/ice_switch.h
> +++ b/drivers/net/ice/base/ice_switch.h
> @@ -16,7 +16,9 @@
>  #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
> 
>  /* Switch Profile IDs for Profile related switch rules */
> +#define ICE_PROFID_IPV4_ESP		71
>  #define ICE_PROFID_IPV6_ESP		72
> +#define ICE_PROFID_IPV4_AH		73
>  #define ICE_PROFID_IPV6_AH		74
>  #define ICE_PROFID_IPV4_NAT_T		75
>  #define ICE_PROFID_IPV6_NAT_T		76
> --
> 2.19.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] net/ice/base: fix bm mask set and find switch recipe method
  2020-04-28  6:22 [dpdk-dev] [PATCH] net/ice/base: fix bm mask set and find switch recipe method Wei Zhao
  2020-04-28  6:49 ` Zhao1, Wei
@ 2020-04-29  8:42 ` Wei Zhao
  2020-05-06  5:17   ` Ye Xiaolong
  1 sibling, 1 reply; 6+ messages in thread
From: Wei Zhao @ 2020-04-29  8:42 UTC (permalink / raw)
  To: dev; +Cc: qi.fu, qi.z.zhang, Wei Zhao

When we download a switch rule for ipv6 with esp payload
"eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"

if we don't add bm bit set check for tun_type, then a packet of
ipv4 with esp payload

"sendp([Ether(dst="00:00:00:00:01:00")/IP(proto=50)/ESP(spi=1)/
("X"*480)], iface="ens5f0", count=10)"

will also go to queue index 2. And also, we need to do tun_type
check, or the second rule of following can not be download because
of rejection from switch rule download function ice_aq_sw_rules().

"eth / ipv4 / esp spi is 1 / end actions queue index 5 / end"

"eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"

Fixes: 4f11962fce84 ("net/ice/base: support AH ESP and NAT-T on switch")
Fixes: 99d8ba79efbe ("net/ice/base: force switch to use different recipe")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 13 +++++++++----
 drivers/net/ice/base/ice_switch.h |  2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 957142a10..f3d52d2dc 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -5285,10 +5285,7 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
 			/* If for "i"th recipe the found was never set to false
 			 * then it means we found our match
 			 */
-			if (ice_is_prof_rule(tun_type) &&
-			    tun_type == recp[i].tun_type && found)
-				return i; /* Return the recipe ID */
-			else if (!ice_is_prof_rule(tun_type) && found)
+			if (tun_type == recp[i].tun_type && found)
 				return i; /* Return the recipe ID */
 		}
 	}
@@ -6005,9 +6002,11 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 		prof_type = ICE_PROF_TUN_PPPOE;
 		break;
 	case ICE_SW_TUN_PROFID_IPV6_ESP:
+	case ICE_SW_TUN_IPV6_ESP:
 		ice_set_bit(ICE_PROFID_IPV6_ESP, bm);
 		return;
 	case ICE_SW_TUN_PROFID_IPV6_AH:
+	case ICE_SW_TUN_IPV6_AH:
 		ice_set_bit(ICE_PROFID_IPV6_AH, bm);
 		return;
 	case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
@@ -6036,6 +6035,12 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 	case ICE_SW_TUN_IPV4_L2TPV3:
 		ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm);
 		return;
+	case ICE_SW_TUN_IPV4_ESP:
+		ice_set_bit(ICE_PROFID_IPV4_ESP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_AH:
+		ice_set_bit(ICE_PROFID_IPV4_AH, bm);
+		return;
 	case ICE_SW_TUN_AND_NON_TUN:
 	default:
 		prof_type = ICE_PROF_ALL;
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 09dc1f236..6bb742d2f 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -16,7 +16,9 @@
 #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
 
 /* Switch Profile IDs for Profile related switch rules */
+#define ICE_PROFID_IPV4_ESP		71
 #define ICE_PROFID_IPV6_ESP		72
+#define ICE_PROFID_IPV4_AH		73
 #define ICE_PROFID_IPV6_AH		74
 #define ICE_PROFID_IPV4_NAT_T		75
 #define ICE_PROFID_IPV6_NAT_T		76
-- 
2.19.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] net/ice/base: fix bm mask set and find switch recipe method
  2020-04-28  6:49 ` Zhao1, Wei
@ 2020-04-29 10:16   ` Fu, Qi
  2020-04-30  2:17     ` Zhang, Qi Z
  0 siblings, 1 reply; 6+ messages in thread
From: Fu, Qi @ 2020-04-29 10:16 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: Zhang, Qi Z

Tested-by: Fu, Qi <qi.fu@intel.com>

> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Tuesday, April 28, 2020 2:50 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Fu, Qi <qi.fu@intel.com>
> Subject: RE: [PATCH] net/ice/base: fix bm mask set and find switch recipe
> method
> 
> Add fuqi
> 
> > -----Original Message-----
> > From: Zhao1, Wei <wei.zhao1@intel.com>
> > Sent: Tuesday, April 28, 2020 2:22 PM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> > <wei.zhao1@intel.com>
> > Subject: [PATCH] net/ice/base: fix bm mask set and find switch recipe
> > method
> >
> > When we download a switch rule for ipv6 with esp payload "eth / ipv6 /
> > esp spi is 1 / end actions queue index 2 / end"
> >
> > if we don't add bm bit set check for tun_type, then a packet of
> > ipv4 with esp payload
> >
> > "sendp([Ether(dst="00:00:00:00:01:00")/IP(proto=50)/ESP(spi=1)/
> > ("X"*480)], iface="ens5f0", count=10)"
> >
> > will also go to queue index 2. And also, we need to do tun_type check,
> > or the second rule of following can not be download because of
> > rejection from switch rule download function ice_aq_sw_rules().
> >
> > "eth / ipv4 / esp spi is 1 / end actions queue index 5 / end"
> >
> > "eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> >  drivers/net/ice/base/ice_switch.c | 15 ++++++++++-----
> > drivers/net/ice/base/ice_switch.h |  2 ++
> >  2 files changed, 12 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ice/base/ice_switch.c
> > b/drivers/net/ice/base/ice_switch.c
> > index e64b03136..7d5d57938 100644
> > --- a/drivers/net/ice/base/ice_switch.c
> > +++ b/drivers/net/ice/base/ice_switch.c
> > @@ -5278,11 +5278,8 @@ static u16 ice_find_recp(struct ice_hw *hw,
> > struct ice_prot_lkup_ext *lkup_exts,
> >  			/* If for "i"th recipe the found was never set to false
> >  			 * then it means we found our match
> >  			 */
> > -			if (ice_is_prof_rule(tun_type) &&
> > -			    tun_type == recp[i].tun_type && found)
> > -				return i; /* Return the recipe ID */
> > -			else if (!ice_is_prof_rule(tun_type) && found)
> > -				return i; /* Return the recipe ID */
> > +			if (tun_type == recp[i].tun_type && found)
> > +				return i;
> >  		}
> >  	}
> >  	return ICE_MAX_NUM_RECIPES;
> > @@ -5998,9 +5995,11 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw,
> > struct ice_adv_rule_info *rinfo,
> >  		prof_type = ICE_PROF_TUN_PPPOE;
> >  		break;
> >  	case ICE_SW_TUN_PROFID_IPV6_ESP:
> > +	case ICE_SW_TUN_IPV6_ESP:
> >  		ice_set_bit(ICE_PROFID_IPV6_ESP, bm);
> >  		return;
> >  	case ICE_SW_TUN_PROFID_IPV6_AH:
> > +	case ICE_SW_TUN_IPV6_AH:
> >  		ice_set_bit(ICE_PROFID_IPV6_AH, bm);
> >  		return;
> >  	case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
> > @@ -6029,6 +6028,12 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw,
> > struct ice_adv_rule_info *rinfo,
> >  	case ICE_SW_TUN_IPV4_L2TPV3:
> >  		ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm);
> >  		return;
> > +	case ICE_SW_TUN_IPV4_ESP:
> > +		ice_set_bit(ICE_PROFID_IPV4_ESP, bm);
> > +		return;
> > +	case ICE_SW_TUN_IPV4_AH:
> > +		ice_set_bit(ICE_PROFID_IPV4_AH, bm);
> > +		return;
> >  	case ICE_SW_TUN_AND_NON_TUN:
> >  	default:
> >  		prof_type = ICE_PROF_ALL;
> > diff --git a/drivers/net/ice/base/ice_switch.h
> > b/drivers/net/ice/base/ice_switch.h
> > index 09dc1f236..6bb742d2f 100644
> > --- a/drivers/net/ice/base/ice_switch.h
> > +++ b/drivers/net/ice/base/ice_switch.h
> > @@ -16,7 +16,9 @@
> >  #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
> >
> >  /* Switch Profile IDs for Profile related switch rules */
> > +#define ICE_PROFID_IPV4_ESP		71
> >  #define ICE_PROFID_IPV6_ESP		72
> > +#define ICE_PROFID_IPV4_AH		73
> >  #define ICE_PROFID_IPV6_AH		74
> >  #define ICE_PROFID_IPV4_NAT_T		75
> >  #define ICE_PROFID_IPV6_NAT_T		76
> > --
> > 2.19.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] net/ice/base: fix bm mask set and find switch recipe method
  2020-04-29 10:16   ` Fu, Qi
@ 2020-04-30  2:17     ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2020-04-30  2:17 UTC (permalink / raw)
  To: Fu, Qi, Zhao1, Wei, dev



> -----Original Message-----
> From: Fu, Qi <qi.fu@intel.com>
> Sent: Wednesday, April 29, 2020 6:16 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: RE: [PATCH] net/ice/base: fix bm mask set and find switch recipe
> method
> 
> Tested-by: Fu, Qi <qi.fu@intel.com>
> 
> > -----Original Message-----
> > From: Zhao1, Wei <wei.zhao1@intel.com>
> > Sent: Tuesday, April 28, 2020 2:50 PM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Fu, Qi <qi.fu@intel.com>
> > Subject: RE: [PATCH] net/ice/base: fix bm mask set and find switch
> > recipe method
> >
> > Add fuqi
> >
> > > -----Original Message-----
> > > From: Zhao1, Wei <wei.zhao1@intel.com>
> > > Sent: Tuesday, April 28, 2020 2:22 PM
> > > To: dev@dpdk.org
> > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> > > <wei.zhao1@intel.com>
> > > Subject: [PATCH] net/ice/base: fix bm mask set and find switch
> > > recipe method
> > >
> > > When we download a switch rule for ipv6 with esp payload "eth / ipv6
> > > / esp spi is 1 / end actions queue index 2 / end"
> > >
> > > if we don't add bm bit set check for tun_type, then a packet of
> > > ipv4 with esp payload
> > >
> > > "sendp([Ether(dst="00:00:00:00:01:00")/IP(proto=50)/ESP(spi=1)/
> > > ("X"*480)], iface="ens5f0", count=10)"
> > >
> > > will also go to queue index 2. And also, we need to do tun_type
> > > check, or the second rule of following can not be download because
> > > of rejection from switch rule download function ice_aq_sw_rules().
> > >
> > > "eth / ipv4 / esp spi is 1 / end actions queue index 5 / end"
> > >
> > > "eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"
> > >
> > > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/ice/base: fix bm mask set and find switch recipe method
  2020-04-29  8:42 ` [dpdk-dev] [PATCH v2] " Wei Zhao
@ 2020-05-06  5:17   ` Ye Xiaolong
  0 siblings, 0 replies; 6+ messages in thread
From: Ye Xiaolong @ 2020-05-06  5:17 UTC (permalink / raw)
  To: Wei Zhao; +Cc: dev, qi.fu, qi.z.zhang

On 04/29, Wei Zhao wrote:
>When we download a switch rule for ipv6 with esp payload
>"eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"
>
>if we don't add bm bit set check for tun_type, then a packet of
>ipv4 with esp payload
>
>"sendp([Ether(dst="00:00:00:00:01:00")/IP(proto=50)/ESP(spi=1)/
>("X"*480)], iface="ens5f0", count=10)"
>
>will also go to queue index 2. And also, we need to do tun_type
>check, or the second rule of following can not be download because
>of rejection from switch rule download function ice_aq_sw_rules().
>
>"eth / ipv4 / esp spi is 1 / end actions queue index 5 / end"
>
>"eth / ipv6 / esp spi is 1 / end actions queue index 2 / end"
>
>Fixes: 4f11962fce84 ("net/ice/base: support AH ESP and NAT-T on switch")
>Fixes: 99d8ba79efbe ("net/ice/base: force switch to use different recipe")
>
>Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
>---
> drivers/net/ice/base/ice_switch.c | 13 +++++++++----
> drivers/net/ice/base/ice_switch.h |  2 ++
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
>index 957142a10..f3d52d2dc 100644
>--- a/drivers/net/ice/base/ice_switch.c
>+++ b/drivers/net/ice/base/ice_switch.c
>@@ -5285,10 +5285,7 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
> 			/* If for "i"th recipe the found was never set to false
> 			 * then it means we found our match
> 			 */
>-			if (ice_is_prof_rule(tun_type) &&
>-			    tun_type == recp[i].tun_type && found)
>-				return i; /* Return the recipe ID */
>-			else if (!ice_is_prof_rule(tun_type) && found)
>+			if (tun_type == recp[i].tun_type && found)
> 				return i; /* Return the recipe ID */
> 		}
> 	}
>@@ -6005,9 +6002,11 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
> 		prof_type = ICE_PROF_TUN_PPPOE;
> 		break;
> 	case ICE_SW_TUN_PROFID_IPV6_ESP:
>+	case ICE_SW_TUN_IPV6_ESP:
> 		ice_set_bit(ICE_PROFID_IPV6_ESP, bm);
> 		return;
> 	case ICE_SW_TUN_PROFID_IPV6_AH:
>+	case ICE_SW_TUN_IPV6_AH:
> 		ice_set_bit(ICE_PROFID_IPV6_AH, bm);
> 		return;
> 	case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
>@@ -6036,6 +6035,12 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
> 	case ICE_SW_TUN_IPV4_L2TPV3:
> 		ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm);
> 		return;
>+	case ICE_SW_TUN_IPV4_ESP:
>+		ice_set_bit(ICE_PROFID_IPV4_ESP, bm);
>+		return;
>+	case ICE_SW_TUN_IPV4_AH:
>+		ice_set_bit(ICE_PROFID_IPV4_AH, bm);
>+		return;
> 	case ICE_SW_TUN_AND_NON_TUN:
> 	default:
> 		prof_type = ICE_PROF_ALL;
>diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
>index 09dc1f236..6bb742d2f 100644
>--- a/drivers/net/ice/base/ice_switch.h
>+++ b/drivers/net/ice/base/ice_switch.h
>@@ -16,7 +16,9 @@
> #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
> 
> /* Switch Profile IDs for Profile related switch rules */
>+#define ICE_PROFID_IPV4_ESP		71
> #define ICE_PROFID_IPV6_ESP		72
>+#define ICE_PROFID_IPV4_AH		73
> #define ICE_PROFID_IPV6_AH		74
> #define ICE_PROFID_IPV4_NAT_T		75
> #define ICE_PROFID_IPV6_NAT_T		76
>-- 
>2.19.1
>

Applied to dpdk-next-net-intel, Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-06  5:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28  6:22 [dpdk-dev] [PATCH] net/ice/base: fix bm mask set and find switch recipe method Wei Zhao
2020-04-28  6:49 ` Zhao1, Wei
2020-04-29 10:16   ` Fu, Qi
2020-04-30  2:17     ` Zhang, Qi Z
2020-04-29  8:42 ` [dpdk-dev] [PATCH v2] " Wei Zhao
2020-05-06  5:17   ` Ye Xiaolong

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git