All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir
@ 2019-07-22 12:06 Xiaolong Ye
  2019-07-22 12:06 ` [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir rule destroy failure Xiaolong Ye
  2019-07-23  5:28 ` [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir Xing, Beilei
  0 siblings, 2 replies; 6+ messages in thread
From: Xiaolong Ye @ 2019-07-22 12:06 UTC (permalink / raw)
  To: Ferruh Yigit, Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, stable

i40e FDIR doesn't allow to create flow with empty spec and mask for
ethertype pattern. Without this patch, below flow would be created
successfully which is unexpected.

> flow create 0 ingress pattern eth / end actions drop / end

Fixes: 7d83c152a207 ("net/i40e: parse flow director filter")
Cc: stable@dpdk.org
Cc: beilei.xing@intel.com

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/i40e_flow.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 48a6782a8..3c0af70c0 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -2442,6 +2442,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	uint64_t input_set = I40E_INSET_NONE;
 	uint16_t frag_off;
 	enum rte_flow_item_type item_type;
+	enum rte_flow_item_type next_type;
 	enum rte_flow_item_type l3 = RTE_FLOW_ITEM_TYPE_END;
 	enum rte_flow_item_type cus_proto = RTE_FLOW_ITEM_TYPE_END;
 	uint32_t i, j;
@@ -2482,6 +2483,16 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_ETH:
 			eth_spec = item->spec;
 			eth_mask = item->mask;
+			next_type = (item + 1)->type;
+
+			if (next_type == RTE_FLOW_ITEM_TYPE_END &&
+						(!eth_spec || !eth_mask)) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "NULL eth spec/mask.");
+				return -rte_errno;
+			}
 
 			if (eth_spec && eth_mask) {
 				if (!rte_is_zero_ether_addr(&eth_mask->src) ||
@@ -2494,8 +2505,6 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				}
 			}
 			if (eth_spec && eth_mask && eth_mask->type) {
-				enum rte_flow_item_type next = (item + 1)->type;
-
 				if (eth_mask->type != RTE_BE16(0xffff)) {
 					rte_flow_error_set(error, EINVAL,
 						      RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2506,7 +2515,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 
 				ether_type = rte_be_to_cpu_16(eth_spec->type);
 
-				if (next == RTE_FLOW_ITEM_TYPE_VLAN ||
+				if (next_type == RTE_FLOW_ITEM_TYPE_VLAN ||
 				    ether_type == RTE_ETHER_TYPE_IPV4 ||
 				    ether_type == RTE_ETHER_TYPE_IPV6 ||
 				    ether_type == RTE_ETHER_TYPE_ARP ||
-- 
2.17.0


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

* [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir rule destroy failure
  2019-07-22 12:06 [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir Xiaolong Ye
@ 2019-07-22 12:06 ` Xiaolong Ye
  2019-07-23  7:11   ` Xing, Beilei
  2019-07-23  5:28 ` [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir Xing, Beilei
  1 sibling, 1 reply; 6+ messages in thread
From: Xiaolong Ye @ 2019-07-22 12:06 UTC (permalink / raw)
  To: Ferruh Yigit, Beilei Xing, Qi Zhang; +Cc: dev, Xiaolong Ye, stable, xiaoyun.li

We should tear down the fdir when the last flow is destroyed, current
logic is opposite to expected behavior, this patch fixes this issue.

Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
Cc: stable@dpdk.org
Cc: xiaoyun.li@intel.com

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/i40e/i40e_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 3c0af70c0..c60c9e240 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -4771,7 +4771,7 @@ i40e_flow_destroy(struct rte_eth_dev *dev,
 		       &((struct i40e_fdir_filter *)flow->rule)->fdir, 0);
 
 		/* If the last flow is destroyed, disable fdir. */
-		if (!ret && !TAILQ_EMPTY(&pf->fdir.fdir_list)) {
+		if (!ret && TAILQ_EMPTY(&pf->fdir.fdir_list)) {
 			i40e_fdir_teardown(pf);
 			dev->data->dev_conf.fdir_conf.mode =
 				   RTE_FDIR_MODE_NONE;
-- 
2.17.0


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

* Re: [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir
  2019-07-22 12:06 [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir Xiaolong Ye
  2019-07-22 12:06 ` [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir rule destroy failure Xiaolong Ye
@ 2019-07-23  5:28 ` Xing, Beilei
  2019-07-23  7:08   ` Zhang, Qi Z
  1 sibling, 1 reply; 6+ messages in thread
From: Xing, Beilei @ 2019-07-23  5:28 UTC (permalink / raw)
  To: Ye, Xiaolong, Yigit, Ferruh, Zhang, Qi Z; +Cc: dev, stable



> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Monday, July 22, 2019 8:07 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; stable@dpdk.org
> Subject: [PATCH 1/2] net/i40e: fix ether pattern rule for fdir
> 
> i40e FDIR doesn't allow to create flow with empty spec and mask for
> ethertype pattern. Without this patch, below flow would be created
> successfully which is unexpected.
> 
> > flow create 0 ingress pattern eth / end actions drop / end
> 
> Fixes: 7d83c152a207 ("net/i40e: parse flow director filter")
> Cc: stable@dpdk.org
> Cc: beilei.xing@intel.com
> 
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/i40e/i40e_flow.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index
> 48a6782a8..3c0af70c0 100644
> --- a/drivers/net/i40e/i40e_flow.c
> +++ b/drivers/net/i40e/i40e_flow.c
> @@ -2442,6 +2442,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
> *dev,
>  	uint64_t input_set = I40E_INSET_NONE;
>  	uint16_t frag_off;
>  	enum rte_flow_item_type item_type;
> +	enum rte_flow_item_type next_type;
>  	enum rte_flow_item_type l3 = RTE_FLOW_ITEM_TYPE_END;
>  	enum rte_flow_item_type cus_proto = RTE_FLOW_ITEM_TYPE_END;
>  	uint32_t i, j;
> @@ -2482,6 +2483,16 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
> *dev,
>  		case RTE_FLOW_ITEM_TYPE_ETH:
>  			eth_spec = item->spec;
>  			eth_mask = item->mask;
> +			next_type = (item + 1)->type;
> +
> +			if (next_type == RTE_FLOW_ITEM_TYPE_END &&
> +						(!eth_spec || !eth_mask)) {
> +				rte_flow_error_set(error, EINVAL,
> +
> RTE_FLOW_ERROR_TYPE_ITEM,
> +						   item,
> +						   "NULL eth spec/mask.");
> +				return -rte_errno;
> +			}
> 
>  			if (eth_spec && eth_mask) {
>  				if (!rte_is_zero_ether_addr(&eth_mask->src)
> || @@ -2494,8 +2505,6 @@ i40e_flow_parse_fdir_pattern(struct
> rte_eth_dev *dev,
>  				}
>  			}
>  			if (eth_spec && eth_mask && eth_mask->type) {
> -				enum rte_flow_item_type next = (item + 1)-
> >type;
> -
>  				if (eth_mask->type != RTE_BE16(0xffff)) {
>  					rte_flow_error_set(error, EINVAL,
> 
> RTE_FLOW_ERROR_TYPE_ITEM,
> @@ -2506,7 +2515,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
> *dev,
> 
>  				ether_type = rte_be_to_cpu_16(eth_spec-
> >type);
> 
> -				if (next == RTE_FLOW_ITEM_TYPE_VLAN ||
> +				if (next_type ==
> RTE_FLOW_ITEM_TYPE_VLAN ||
>  				    ether_type == RTE_ETHER_TYPE_IPV4 ||
>  				    ether_type == RTE_ETHER_TYPE_IPV6 ||
>  				    ether_type == RTE_ETHER_TYPE_ARP ||
> --
> 2.17.0

Acked-by: Beilei Xing <beilei.xing@intel.com>


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

* Re: [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir
  2019-07-23  5:28 ` [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir Xing, Beilei
@ 2019-07-23  7:08   ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2019-07-23  7:08 UTC (permalink / raw)
  To: Xing, Beilei, Ye, Xiaolong, Yigit, Ferruh; +Cc: dev, stable



> -----Original Message-----
> From: Xing, Beilei
> Sent: Tuesday, July 23, 2019 1:28 PM
> To: Ye, Xiaolong <xiaolong.ye@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH 1/2] net/i40e: fix ether pattern rule for fdir
> 
> 
> 
> > -----Original Message-----
> > From: Ye, Xiaolong
> > Sent: Monday, July 22, 2019 8:07 PM
> > To: Yigit, Ferruh <ferruh.yigit@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH 1/2] net/i40e: fix ether pattern rule for fdir
> >
> > i40e FDIR doesn't allow to create flow with empty spec and mask for
> > ethertype pattern. Without this patch, below flow would be created
> > successfully which is unexpected.
> >
> > > flow create 0 ingress pattern eth / end actions drop / end
> >
> > Fixes: 7d83c152a207 ("net/i40e: parse flow director filter")
> > Cc: stable@dpdk.org
> > Cc: beilei.xing@intel.com
> >
> > Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> > ---
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


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

* Re: [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir rule destroy failure
  2019-07-22 12:06 ` [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir rule destroy failure Xiaolong Ye
@ 2019-07-23  7:11   ` Xing, Beilei
  2019-07-23  7:16     ` Zhang, Qi Z
  0 siblings, 1 reply; 6+ messages in thread
From: Xing, Beilei @ 2019-07-23  7:11 UTC (permalink / raw)
  To: Ye, Xiaolong, Yigit, Ferruh, Zhang, Qi Z; +Cc: dev, stable, Li, Xiaoyun



> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Monday, July 22, 2019 8:07 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; stable@dpdk.org;
> Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH 2/2] net/i40e: fix fdir rule destroy failure
> 
> We should tear down the fdir when the last flow is destroyed, current logic is
> opposite to expected behavior, this patch fixes this issue.
> 
> Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
> Cc: stable@dpdk.org
> Cc: xiaoyun.li@intel.com
> 
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/i40e/i40e_flow.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index
> 3c0af70c0..c60c9e240 100644
> --- a/drivers/net/i40e/i40e_flow.c
> +++ b/drivers/net/i40e/i40e_flow.c
> @@ -4771,7 +4771,7 @@ i40e_flow_destroy(struct rte_eth_dev *dev,
>  		       &((struct i40e_fdir_filter *)flow->rule)->fdir, 0);
> 
>  		/* If the last flow is destroyed, disable fdir. */
> -		if (!ret && !TAILQ_EMPTY(&pf->fdir.fdir_list)) {
> +		if (!ret && TAILQ_EMPTY(&pf->fdir.fdir_list)) {
>  			i40e_fdir_teardown(pf);
>  			dev->data->dev_conf.fdir_conf.mode =
>  				   RTE_FDIR_MODE_NONE;
> --
> 2.17.0

Acked-by: Beilei Xing <beilei.xing@intel.com>

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

* Re: [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir rule destroy failure
  2019-07-23  7:11   ` Xing, Beilei
@ 2019-07-23  7:16     ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2019-07-23  7:16 UTC (permalink / raw)
  To: Xing, Beilei, Ye, Xiaolong, Yigit, Ferruh; +Cc: dev, stable, Li, Xiaoyun



> -----Original Message-----
> From: Xing, Beilei
> Sent: Tuesday, July 23, 2019 3:12 PM
> To: Ye, Xiaolong <xiaolong.ye@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: RE: [PATCH 2/2] net/i40e: fix fdir rule destroy failure
> 
> 
> 
> > -----Original Message-----
> > From: Ye, Xiaolong
> > Sent: Monday, July 22, 2019 8:07 PM
> > To: Yigit, Ferruh <ferruh.yigit@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>;
> > stable@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>
> > Subject: [PATCH 2/2] net/i40e: fix fdir rule destroy failure
> >
> > We should tear down the fdir when the last flow is destroyed, current
> > logic is opposite to expected behavior, this patch fixes this issue.
> >
> > Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
> > Cc: stable@dpdk.org
> > Cc: xiaoyun.li@intel.com
> >
> > Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> > ---
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2019-07-23  7:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 12:06 [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir Xiaolong Ye
2019-07-22 12:06 ` [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir rule destroy failure Xiaolong Ye
2019-07-23  7:11   ` Xing, Beilei
2019-07-23  7:16     ` Zhang, Qi Z
2019-07-23  5:28 ` [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir Xing, Beilei
2019-07-23  7:08   ` Zhang, Qi Z

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.