DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: fix flow validation for unsupported patterns
@ 2020-08-28  2:33 Guinan Sun
  2020-08-31  4:22 ` Zhang, Qi Z
  2020-09-08  3:15 ` [dpdk-dev] [PATCH v2] " Guinan Sun
  0 siblings, 2 replies; 5+ messages in thread
From: Guinan Sun @ 2020-08-28  2:33 UTC (permalink / raw)
  To: dev; +Cc: Qi Zhang, Qiming Yang, Guinan Sun, stable

When loading the OS default package and the pipeline mode is enabled
by the "pipeline-mode-support=1" operation. In this case, the wrong
parser is selected for processing and it will cause the unsupported
patterns(pppoes/pfcp/l2tpv3/esp/ah) to be validated successfully.
This patch corrects the parser selection issue.

Fixes: 47d460d63233 ("net/ice: rework switch filter")
Cc: stable@dpdk.org

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 drivers/net/ice/ice_switch_filter.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index c4b00b6a2..884fbaae2 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1806,7 +1806,8 @@ ice_switch_init(struct ice_adapter *ad)
 	else
 		return -EINVAL;
 
-	if (ad->devargs.pipe_mode_support)
+	if (ad->devargs.pipe_mode_support &&
+	    ad->active_pkg_type != ICE_PKG_TYPE_OS_DEFAULT)
 		ret = ice_register_parser(perm_parser, ad);
 	else
 		ret = ice_register_parser(dist_parser, ad);
@@ -1824,7 +1825,8 @@ ice_switch_uninit(struct ice_adapter *ad)
 	else
 		dist_parser = &ice_switch_dist_parser_os;
 
-	if (ad->devargs.pipe_mode_support)
+	if (ad->devargs.pipe_mode_support &&
+	    ad->active_pkg_type != ICE_PKG_TYPE_OS_DEFAULT)
 		ice_unregister_parser(perm_parser, ad);
 	else
 		ice_unregister_parser(dist_parser, ad);
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] net/ice: fix flow validation for unsupported patterns
  2020-08-28  2:33 [dpdk-dev] [PATCH] net/ice: fix flow validation for unsupported patterns Guinan Sun
@ 2020-08-31  4:22 ` Zhang, Qi Z
  2020-09-01  7:19   ` Sun, GuinanX
  2020-09-08  3:15 ` [dpdk-dev] [PATCH v2] " Guinan Sun
  1 sibling, 1 reply; 5+ messages in thread
From: Zhang, Qi Z @ 2020-08-31  4:22 UTC (permalink / raw)
  To: Sun, GuinanX, dev; +Cc: Yang, Qiming, stable



> -----Original Message-----
> From: Sun, GuinanX <guinanx.sun@intel.com>
> Sent: Friday, August 28, 2020 10:33 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Sun, GuinanX <guinanx.sun@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] net/ice: fix flow validation for unsupported patterns
> 
> When loading the OS default package and the pipeline mode is enabled by the
> "pipeline-mode-support=1" operation. In this case, the wrong parser is selected
> for processing and it will cause the unsupported
> patterns(pppoes/pfcp/l2tpv3/esp/ah) to be validated successfully.
> This patch corrects the parser selection issue.
> 
> Fixes: 47d460d63233 ("net/ice: rework switch filter")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
>  drivers/net/ice/ice_switch_filter.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_switch_filter.c
> b/drivers/net/ice/ice_switch_filter.c
> index c4b00b6a2..884fbaae2 100644
> --- a/drivers/net/ice/ice_switch_filter.c
> +++ b/drivers/net/ice/ice_switch_filter.c
> @@ -1806,7 +1806,8 @@ ice_switch_init(struct ice_adapter *ad)
>  	else
>  		return -EINVAL;
> 
> -	if (ad->devargs.pipe_mode_support)
> +	if (ad->devargs.pipe_mode_support &&
> +	    ad->active_pkg_type != ICE_PKG_TYPE_OS_DEFAULT)
>  		ret = ice_register_parser(perm_parser, ad);

This is not correct, package type should not related with pipe line mode.


>  	else
>  		ret = ice_register_parser(dist_parser, ad); @@ -1824,7 +1825,8 @@
> ice_switch_uninit(struct ice_adapter *ad)
>  	else
>  		dist_parser = &ice_switch_dist_parser_os;
> 
> -	if (ad->devargs.pipe_mode_support)
> +	if (ad->devargs.pipe_mode_support &&
> +	    ad->active_pkg_type != ICE_PKG_TYPE_OS_DEFAULT)
>  		ice_unregister_parser(perm_parser, ad);
>  	else
>  		ice_unregister_parser(dist_parser, ad);
> --
> 2.17.1


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

* Re: [dpdk-dev] [PATCH] net/ice: fix flow validation for unsupported patterns
  2020-08-31  4:22 ` Zhang, Qi Z
@ 2020-09-01  7:19   ` Sun, GuinanX
  0 siblings, 0 replies; 5+ messages in thread
From: Sun, GuinanX @ 2020-09-01  7:19 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: Yang, Qiming

Hi qi

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Monday, August 31, 2020 12:23 PM
> To: Sun, GuinanX <guinanx.sun@intel.com>; dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH] net/ice: fix flow validation for unsupported patterns
> 
> 
> 
> > -----Original Message-----
> > From: Sun, GuinanX <guinanx.sun@intel.com>
> > Sent: Friday, August 28, 2020 10:33 AM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> > <qiming.yang@intel.com>; Sun, GuinanX <guinanx.sun@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH] net/ice: fix flow validation for unsupported patterns
> >
> > When loading the OS default package and the pipeline mode is enabled
> > by the "pipeline-mode-support=1" operation. In this case, the wrong
> > parser is selected for processing and it will cause the unsupported
> > patterns(pppoes/pfcp/l2tpv3/esp/ah) to be validated successfully.
> > This patch corrects the parser selection issue.
> >
> > Fixes: 47d460d63233 ("net/ice: rework switch filter")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> > ---
> >  drivers/net/ice/ice_switch_filter.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ice/ice_switch_filter.c
> > b/drivers/net/ice/ice_switch_filter.c
> > index c4b00b6a2..884fbaae2 100644
> > --- a/drivers/net/ice/ice_switch_filter.c
> > +++ b/drivers/net/ice/ice_switch_filter.c
> > @@ -1806,7 +1806,8 @@ ice_switch_init(struct ice_adapter *ad)
> >  	else
> >  		return -EINVAL;
> >
> > -	if (ad->devargs.pipe_mode_support)
> > +	if (ad->devargs.pipe_mode_support &&
> > +	    ad->active_pkg_type != ICE_PKG_TYPE_OS_DEFAULT)
> >  		ret = ice_register_parser(perm_parser, ad);
> 
> This is not correct, package type should not related with pipe line mode.

Under the premise of pipe-mode support, the choice of parser for different package types will be added.
Patch v2 will fix it.

> 
> 
> >  	else
> >  		ret = ice_register_parser(dist_parser, ad); @@ -1824,7
> +1825,8 @@
> > ice_switch_uninit(struct ice_adapter *ad)
> >  	else
> >  		dist_parser = &ice_switch_dist_parser_os;
> >
> > -	if (ad->devargs.pipe_mode_support)
> > +	if (ad->devargs.pipe_mode_support &&
> > +	    ad->active_pkg_type != ICE_PKG_TYPE_OS_DEFAULT)
> >  		ice_unregister_parser(perm_parser, ad);
> >  	else
> >  		ice_unregister_parser(dist_parser, ad);
> > --
> > 2.17.1


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

* [dpdk-dev] [PATCH v2] net/ice: fix flow validation for unsupported patterns
  2020-08-28  2:33 [dpdk-dev] [PATCH] net/ice: fix flow validation for unsupported patterns Guinan Sun
  2020-08-31  4:22 ` Zhang, Qi Z
@ 2020-09-08  3:15 ` Guinan Sun
  2020-09-09  8:48   ` Zhang, Qi Z
  1 sibling, 1 reply; 5+ messages in thread
From: Guinan Sun @ 2020-09-08  3:15 UTC (permalink / raw)
  To: dev; +Cc: Qi Zhang, Qiming Yang, Guinan Sun, stable

When loading the OS default package and the pipeline mode is enabled
by the "pipeline-mode-support=1" operation. In this case, the wrong
parser is selected for processing and it will cause the unsupported
patterns(pppoes/pfcp/l2tpv3/esp/ah) to be validated successfully.
This patch corrects the parser selection issue.

Fixes: 47d460d63233 ("net/ice: rework switch filter")
Cc: stable@dpdk.org

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
v2:
* Add parser selector in pipline-mode.
---
 drivers/net/ice/ice_switch_filter.c | 100 ++++++++++++++++++++++------
 1 file changed, 81 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 24320ac7d..4dfeeef50 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -139,7 +139,42 @@ struct sw_meta {
 
 static struct ice_flow_parser ice_switch_dist_parser_os;
 static struct ice_flow_parser ice_switch_dist_parser_comms;
-static struct ice_flow_parser ice_switch_perm_parser;
+static struct ice_flow_parser ice_switch_perm_parser_os;
+static struct ice_flow_parser ice_switch_perm_parser_comms;
+
+static struct
+ice_pattern_match_item ice_switch_pattern_dist_os[] = {
+	{pattern_ethertype,
+			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
+	{pattern_ethertype_vlan,
+			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
+	{pattern_eth_arp,
+			ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4,
+			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,
+			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,
+			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
+	{pattern_eth_ipv6,
+			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,
+			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,
+			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
+			ICE_SW_INSET_DIST_VXLAN_IPV4, ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
+			ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
+			ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4,
+			ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
+			ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
+			ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE},
+};
 
 static struct
 ice_pattern_match_item ice_switch_pattern_dist_comms[] = {
@@ -147,6 +182,8 @@ ice_pattern_match_item ice_switch_pattern_dist_comms[] = {
 			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
 	{pattern_ethertype_vlan,
 			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
+	{pattern_eth_arp,
+			ICE_INSET_NONE, ICE_INSET_NONE},
 	{pattern_eth_ipv4,
 			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
 	{pattern_eth_ipv4_udp,
@@ -228,7 +265,7 @@ ice_pattern_match_item ice_switch_pattern_dist_comms[] = {
 };
 
 static struct
-ice_pattern_match_item ice_switch_pattern_dist_os[] = {
+ice_pattern_match_item ice_switch_pattern_perm_os[] = {
 	{pattern_ethertype,
 			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
 	{pattern_ethertype_vlan,
@@ -248,25 +285,27 @@ ice_pattern_match_item ice_switch_pattern_dist_os[] = {
 	{pattern_eth_ipv6_tcp,
 			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
 	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_DIST_VXLAN_IPV4, ICE_INSET_NONE},
+			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
 	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE},
+			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
 	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE},
+			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
 	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE},
+			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
 	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE},
+			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
 	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE},
+			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
 };
 
 static struct
-ice_pattern_match_item ice_switch_pattern_perm[] = {
+ice_pattern_match_item ice_switch_pattern_perm_comms[] = {
 	{pattern_ethertype,
 			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
 	{pattern_ethertype_vlan,
 			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
+	{pattern_eth_arp,
+		ICE_INSET_NONE, ICE_INSET_NONE},
 	{pattern_eth_ipv4,
 			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
 	{pattern_eth_ipv4_udp,
@@ -1813,7 +1852,7 @@ ice_switch_init(struct ice_adapter *ad)
 {
 	int ret = 0;
 	struct ice_flow_parser *dist_parser;
-	struct ice_flow_parser *perm_parser = &ice_switch_perm_parser;
+	struct ice_flow_parser *perm_parser;
 
 	if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
 		dist_parser = &ice_switch_dist_parser_comms;
@@ -1822,10 +1861,16 @@ ice_switch_init(struct ice_adapter *ad)
 	else
 		return -EINVAL;
 
-	if (ad->devargs.pipe_mode_support)
+	if (ad->devargs.pipe_mode_support) {
+		if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
+			perm_parser = &ice_switch_perm_parser_comms;
+		else
+			perm_parser = &ice_switch_perm_parser_os;
+
 		ret = ice_register_parser(perm_parser, ad);
-	else
+	} else {
 		ret = ice_register_parser(dist_parser, ad);
+	}
 	return ret;
 }
 
@@ -1833,17 +1878,25 @@ static void
 ice_switch_uninit(struct ice_adapter *ad)
 {
 	struct ice_flow_parser *dist_parser;
-	struct ice_flow_parser *perm_parser = &ice_switch_perm_parser;
+	struct ice_flow_parser *perm_parser;
 
 	if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
 		dist_parser = &ice_switch_dist_parser_comms;
-	else
+	else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT)
 		dist_parser = &ice_switch_dist_parser_os;
+	else
+		return;
+
+	if (ad->devargs.pipe_mode_support) {
+		if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
+			perm_parser = &ice_switch_perm_parser_comms;
+		else
+			perm_parser = &ice_switch_perm_parser_os;
 
-	if (ad->devargs.pipe_mode_support)
 		ice_unregister_parser(perm_parser, ad);
-	else
+	} else {
 		ice_unregister_parser(dist_parser, ad);
+	}
 }
 
 static struct
@@ -1877,10 +1930,19 @@ ice_flow_parser ice_switch_dist_parser_comms = {
 };
 
 static struct
-ice_flow_parser ice_switch_perm_parser = {
+ice_flow_parser ice_switch_perm_parser_os = {
+	.engine = &ice_switch_engine,
+	.array = ice_switch_pattern_perm_os,
+	.array_len = RTE_DIM(ice_switch_pattern_perm_os),
+	.parse_pattern_action = ice_switch_parse_pattern_action,
+	.stage = ICE_FLOW_STAGE_PERMISSION,
+};
+
+static struct
+ice_flow_parser ice_switch_perm_parser_comms = {
 	.engine = &ice_switch_engine,
-	.array = ice_switch_pattern_perm,
-	.array_len = RTE_DIM(ice_switch_pattern_perm),
+	.array = ice_switch_pattern_perm_comms,
+	.array_len = RTE_DIM(ice_switch_pattern_perm_comms),
 	.parse_pattern_action = ice_switch_parse_pattern_action,
 	.stage = ICE_FLOW_STAGE_PERMISSION,
 };
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v2] net/ice: fix flow validation for unsupported patterns
  2020-09-08  3:15 ` [dpdk-dev] [PATCH v2] " Guinan Sun
@ 2020-09-09  8:48   ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2020-09-09  8:48 UTC (permalink / raw)
  To: Sun, GuinanX, dev; +Cc: Yang, Qiming, stable



> -----Original Message-----
> From: Sun, GuinanX <guinanx.sun@intel.com>
> Sent: Tuesday, September 8, 2020 11:15 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Sun, GuinanX <guinanx.sun@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/ice: fix flow validation for unsupported patterns
> 
> When loading the OS default package and the pipeline mode is enabled by the
> "pipeline-mode-support=1" operation. In this case, the wrong parser is selected
> for processing and it will cause the unsupported
> patterns(pppoes/pfcp/l2tpv3/esp/ah) to be validated successfully.
> This patch corrects the parser selection issue.
> 
> Fixes: 47d460d63233 ("net/ice: rework switch filter")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2020-09-09  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28  2:33 [dpdk-dev] [PATCH] net/ice: fix flow validation for unsupported patterns Guinan Sun
2020-08-31  4:22 ` Zhang, Qi Z
2020-09-01  7:19   ` Sun, GuinanX
2020-09-08  3:15 ` [dpdk-dev] [PATCH v2] " Guinan Sun
2020-09-09  8:48   ` Zhang, Qi Z

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).