DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: fix FDIR input set conflict issue
@ 2021-06-24  7:07 beilei.xing
  2021-06-24  7:29 ` [dpdk-dev] [PATCH v2] " beilei.xing
  0 siblings, 1 reply; 4+ messages in thread
From: beilei.xing @ 2021-06-24  7:07 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, Beilei Xing, stable

From: Beilei Xing <beilei.xing@intel.com>

Currently, there'll be conflict error when running
the folowing commands:
1. flow create 0 ingress
     pattern eth / ipv4 / udp src is 32 / end
     actions queue index 2 / end
2. flow destroy 0 rule 0
3. flow create 0 ingress
     pattern eth / ipv4 / udp dst is 32 / end
     actions queue index 2 / end

This patch fixes the input set conflict issue.

Fixes: 42044b69c67d ("net/i40e: support input set selection for FDIR")
Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
Cc: stable@dpdk.org

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 5 +++++
 drivers/net/i40e/i40e_ethdev.h | 2 +-
 drivers/net/i40e/i40e_fdir.c   | 7 ++++---
 drivers/net/i40e/i40e_flow.c   | 2 +-
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index dd61258739..df716c180f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1087,6 +1087,7 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	char fdir_hash_name[RTE_HASH_NAMESIZE];
 	uint32_t alloc = hw->func_caps.fd_filters_guaranteed;
 	uint32_t best = hw->func_caps.fd_filters_best_effort;
+	enum i40e_filter_pctype pctype;
 	struct rte_bitmap *bmp = NULL;
 	uint32_t bmp_size;
 	void *mem = NULL;
@@ -1135,6 +1136,10 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 		goto err_fdir_filter_array_alloc;
 	}
 
+	for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
+	     pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++)
+		pf->fdir.flow_count[pctype] = 0;
+
 	fdir_info->fdir_space_size = alloc + best;
 	fdir_info->fdir_actual_cnt = 0;
 	fdir_info->fdir_guarantee_total_space = alloc;
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index ba6acd1878..585a0d8eb2 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -788,7 +788,7 @@ struct i40e_fdir_info {
 	bool flex_pit_flag[I40E_MAX_FLXPLD_LAYER];
 	bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX];
 
-	bool inset_flag[I40E_FILTER_PCTYPE_MAX]; /* Mark if input set is set */
+	uint32_t flow_count[I40E_FILTER_PCTYPE_MAX];
 
 	uint32_t flex_flow_count[I40E_MAX_FLXPLD_LAYER];
 };
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 20658816ee..6f73936091 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1607,13 +1607,13 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
 	}
 
 	/* Check if the configuration is conflicted */
-	if (pf->fdir.inset_flag[pctype] &&
+	if (pf->fdir.flow_count[pctype] &&
 	    memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t))) {
 		PMD_DRV_LOG(ERR, "Conflict with the first rule's input set.");
 		return -EINVAL;
 	}
 
-	if (pf->fdir.inset_flag[pctype] &&
+	if (pf->fdir.flow_count[pctype] &&
 	    !memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
 		return 0;
 
@@ -1666,7 +1666,6 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
 	I40E_WRITE_FLUSH(hw);
 
 	pf->fdir.input_set[pctype] = input_set;
-	pf->fdir.inset_flag[pctype] = 1;
 	return 0;
 }
 
@@ -1890,11 +1889,13 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
 	}
 
 	if (add) {
+		fdir_info->flow_count[pctype]++;
 		fdir_info->fdir_actual_cnt++;
 		if (fdir_info->fdir_invalprio == 1 &&
 				fdir_info->fdir_guarantee_free_space > 0)
 			fdir_info->fdir_guarantee_free_space--;
 	} else {
+		fdir_info->flow_count[pctype]--;
 		fdir_info->fdir_actual_cnt--;
 		if (fdir_info->fdir_invalprio == 1 &&
 				fdir_info->fdir_guarantee_free_space <
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 2cc9ad9ef7..ff8441b378 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -4940,7 +4940,7 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf)
 
 		for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
 		     pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
-			pf->fdir.inset_flag[pctype] = 0;
+			pf->fdir.flow_count[pctype] = 0;
 			pf->fdir.flex_mask_flag[pctype] = 0;
 		}
 
-- 
2.26.2


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

* [dpdk-dev] [PATCH v2] net/i40e: fix FDIR input set conflict issue
  2021-06-24  7:07 [dpdk-dev] [PATCH] net/i40e: fix FDIR input set conflict issue beilei.xing
@ 2021-06-24  7:29 ` beilei.xing
  2021-06-24  9:34   ` Chen, LingliX
  0 siblings, 1 reply; 4+ messages in thread
From: beilei.xing @ 2021-06-24  7:29 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, Beilei Xing, stable

From: Beilei Xing <beilei.xing@intel.com>

Currently, there'll be conflict error when running
the following commands:
1. flow create 0 ingress
     pattern eth / ipv4 / udp src is 32 / end
     actions queue index 2 / end
2. flow destroy 0 rule 0
3. flow create 0 ingress
     pattern eth / ipv4 / udp dst is 32 / end
     actions queue index 2 / end

This patch fixes the input set conflict issue.

Fixes: 42044b69c67d ("net/i40e: support input set selection for FDIR")
Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
Cc: stable@dpdk.org

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

V2 change:
 - fix typo.

 drivers/net/i40e/i40e_ethdev.c | 5 +++++
 drivers/net/i40e/i40e_ethdev.h | 2 +-
 drivers/net/i40e/i40e_fdir.c   | 7 ++++---
 drivers/net/i40e/i40e_flow.c   | 2 +-
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index dd61258739..df716c180f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1087,6 +1087,7 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	char fdir_hash_name[RTE_HASH_NAMESIZE];
 	uint32_t alloc = hw->func_caps.fd_filters_guaranteed;
 	uint32_t best = hw->func_caps.fd_filters_best_effort;
+	enum i40e_filter_pctype pctype;
 	struct rte_bitmap *bmp = NULL;
 	uint32_t bmp_size;
 	void *mem = NULL;
@@ -1135,6 +1136,10 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 		goto err_fdir_filter_array_alloc;
 	}
 
+	for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
+	     pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++)
+		pf->fdir.flow_count[pctype] = 0;
+
 	fdir_info->fdir_space_size = alloc + best;
 	fdir_info->fdir_actual_cnt = 0;
 	fdir_info->fdir_guarantee_total_space = alloc;
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index ba6acd1878..585a0d8eb2 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -788,7 +788,7 @@ struct i40e_fdir_info {
 	bool flex_pit_flag[I40E_MAX_FLXPLD_LAYER];
 	bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX];
 
-	bool inset_flag[I40E_FILTER_PCTYPE_MAX]; /* Mark if input set is set */
+	uint32_t flow_count[I40E_FILTER_PCTYPE_MAX];
 
 	uint32_t flex_flow_count[I40E_MAX_FLXPLD_LAYER];
 };
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 20658816ee..6f73936091 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1607,13 +1607,13 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
 	}
 
 	/* Check if the configuration is conflicted */
-	if (pf->fdir.inset_flag[pctype] &&
+	if (pf->fdir.flow_count[pctype] &&
 	    memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t))) {
 		PMD_DRV_LOG(ERR, "Conflict with the first rule's input set.");
 		return -EINVAL;
 	}
 
-	if (pf->fdir.inset_flag[pctype] &&
+	if (pf->fdir.flow_count[pctype] &&
 	    !memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
 		return 0;
 
@@ -1666,7 +1666,6 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
 	I40E_WRITE_FLUSH(hw);
 
 	pf->fdir.input_set[pctype] = input_set;
-	pf->fdir.inset_flag[pctype] = 1;
 	return 0;
 }
 
@@ -1890,11 +1889,13 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
 	}
 
 	if (add) {
+		fdir_info->flow_count[pctype]++;
 		fdir_info->fdir_actual_cnt++;
 		if (fdir_info->fdir_invalprio == 1 &&
 				fdir_info->fdir_guarantee_free_space > 0)
 			fdir_info->fdir_guarantee_free_space--;
 	} else {
+		fdir_info->flow_count[pctype]--;
 		fdir_info->fdir_actual_cnt--;
 		if (fdir_info->fdir_invalprio == 1 &&
 				fdir_info->fdir_guarantee_free_space <
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 2cc9ad9ef7..ff8441b378 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -4940,7 +4940,7 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf)
 
 		for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
 		     pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
-			pf->fdir.inset_flag[pctype] = 0;
+			pf->fdir.flow_count[pctype] = 0;
 			pf->fdir.flex_mask_flag[pctype] = 0;
 		}
 
-- 
2.26.2


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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix FDIR input set conflict issue
  2021-06-24  7:29 ` [dpdk-dev] [PATCH v2] " beilei.xing
@ 2021-06-24  9:34   ` Chen, LingliX
  2021-06-30  2:00     ` Zhang, Qi Z
  0 siblings, 1 reply; 4+ messages in thread
From: Chen, LingliX @ 2021-06-24  9:34 UTC (permalink / raw)
  To: Xing, Beilei, Zhang, Qi Z; +Cc: dev, Xing, Beilei, stable


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of beilei.xing@intel.com
> Sent: Thursday, June 24, 2021 3:30 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix FDIR input set conflict issue
> 
> From: Beilei Xing <beilei.xing@intel.com>
> 
> Currently, there'll be conflict error when running the following commands:
> 1. flow create 0 ingress
>      pattern eth / ipv4 / udp src is 32 / end
>      actions queue index 2 / end
> 2. flow destroy 0 rule 0
> 3. flow create 0 ingress
>      pattern eth / ipv4 / udp dst is 32 / end
>      actions queue index 2 / end
> 
> This patch fixes the input set conflict issue.
> 
> Fixes: 42044b69c67d ("net/i40e: support input set selection for FDIR")
> Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>

Tested-by: Lingli Chen <linglix.chen@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix FDIR input set conflict issue
  2021-06-24  9:34   ` Chen, LingliX
@ 2021-06-30  2:00     ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2021-06-30  2:00 UTC (permalink / raw)
  To: Chen, LingliX, Xing, Beilei; +Cc: dev, Xing, Beilei, stable



> -----Original Message-----
> From: Chen, LingliX <linglix.chen@intel.com>
> Sent: Thursday, June 24, 2021 5:35 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2] net/i40e: fix FDIR input set conflict issue
> 
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of beilei.xing@intel.com
> > Sent: Thursday, June 24, 2021 3:30 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH v2] net/i40e: fix FDIR input set conflict issue
> >
> > From: Beilei Xing <beilei.xing@intel.com>
> >
> > Currently, there'll be conflict error when running the following commands:
> > 1. flow create 0 ingress
> >      pattern eth / ipv4 / udp src is 32 / end
> >      actions queue index 2 / end
> > 2. flow destroy 0 rule 0
> > 3. flow create 0 ingress
> >      pattern eth / ipv4 / udp dst is 32 / end
> >      actions queue index 2 / end
> >
> > This patch fixes the input set conflict issue.
> >
> > Fixes: 42044b69c67d ("net/i40e: support input set selection for FDIR")
> > Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> 
> Tested-by: Lingli Chen <linglix.chen@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, other threads:[~2021-06-30  2:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  7:07 [dpdk-dev] [PATCH] net/i40e: fix FDIR input set conflict issue beilei.xing
2021-06-24  7:29 ` [dpdk-dev] [PATCH v2] " beilei.xing
2021-06-24  9:34   ` Chen, LingliX
2021-06-30  2:00     ` 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).