DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: add a structure for RSS
@ 2019-11-12  8:12 Simei Su
  2019-11-12 13:37 ` Zhang, Qi Z
  2019-11-13  2:03 ` [dpdk-dev] [PATCH v2] net/ice: fix flow destroy issue " Simei Su
  0 siblings, 2 replies; 6+ messages in thread
From: Simei Su @ 2019-11-12  8:12 UTC (permalink / raw)
  To: qi.z.zhang, xiaolong.ye, qiming.yang; +Cc: dev, simei.su

This patch adds a structure to include a flag to indicate if it
is a simple_xor flow so that it's easier to remove the config
when destroying the flow. The patch also simplifies code implementation
logic in ice_hash_create().

In ice_hash_create(), whatever the hash_function is, the filter_ptr->symm
is always 0 and when we destroy the flow, the ice_rem_rss_cfg() is never
carried out. So the destroy function never works well. The patch fixes
this issue and at the same time distinguishes semanteme between simple_xor
and symmetric_toeplitz.

Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/ice/ice_hash.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index 57e7d55..d884343 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -41,6 +41,11 @@ struct rss_meta {
 	uint8_t hash_function;
 };
 
+struct ice_hash_flow_cfg {
+	bool simple_xor;
+	struct ice_rss_cfg rss_cfg;
+};
+
 static int
 ice_hash_init(struct ice_adapter *ad);
 
@@ -452,14 +457,14 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 	struct ice_vsi *vsi = pf->main_vsi;
 	int ret;
 	uint32_t reg;
-	struct ice_rss_cfg *filter_ptr;
+	struct ice_hash_flow_cfg *filter_ptr;
 
 	uint32_t headermask = ((struct rss_meta *)meta)->pkt_hdr;
 	uint64_t hash_field = ((struct rss_meta *)meta)->hash_flds;
 	uint8_t hash_function = ((struct rss_meta *)meta)->hash_function;
 
 	filter_ptr = rte_zmalloc("ice_rss_filter",
-				sizeof(struct ice_rss_cfg), 0);
+				sizeof(struct ice_hash_flow_cfg), 0);
 	if (!filter_ptr) {
 		rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
@@ -474,19 +479,20 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 			(2 << VSIQF_HASH_CTL_HASH_SCHEME_S);
 		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
 
-		filter_ptr->symm = 0;
+		filter_ptr->simple_xor = 1;
 
 		goto out;
-	} else if (hash_function == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
-		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 1);
-		if (ret) {
-			rte_flow_error_set(error, EINVAL,
-					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-					"rss flow create fail");
-			goto error;
-		}
 	} else {
-		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 0);
+		filter_ptr->rss_cfg.packet_hdr = headermask;
+		filter_ptr->rss_cfg.hashed_flds = hash_field;
+		filter_ptr->rss_cfg.symm =
+			(hash_function ==
+				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ);
+
+		ret = ice_add_rss_cfg(hw, vsi->idx,
+				filter_ptr->rss_cfg.hashed_flds,
+				filter_ptr->rss_cfg.packet_hdr,
+				filter_ptr->rss_cfg.symm);
 		if (ret) {
 			rte_flow_error_set(error, EINVAL,
 					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
@@ -495,9 +501,6 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 		}
 	}
 
-	filter_ptr->packet_hdr = headermask;
-	filter_ptr->hashed_flds = hash_field;
-
 out:
 	flow->rule = filter_ptr;
 	rte_free(meta);
@@ -519,11 +522,11 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 	struct ice_vsi *vsi = pf->main_vsi;
 	int ret;
 	uint32_t reg;
-	struct ice_rss_cfg *filter_ptr;
+	struct ice_hash_flow_cfg *filter_ptr;
 
-	filter_ptr = (struct ice_rss_cfg *)flow->rule;
+	filter_ptr = (struct ice_hash_flow_cfg *)flow->rule;
 
-	if (filter_ptr->symm == 0) {
+	if (filter_ptr->simple_xor == 1) {
 		/* Return to symmetric_toeplitz state. */
 		reg = ICE_READ_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id));
 		reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) |
@@ -531,7 +534,8 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
 	} else {
 		ret = ice_rem_rss_cfg(hw, vsi->idx,
-			filter_ptr->hashed_flds, filter_ptr->packet_hdr);
+				filter_ptr->rss_cfg.hashed_flds,
+				filter_ptr->rss_cfg.packet_hdr);
 		if (ret) {
 			rte_flow_error_set(error, EINVAL,
 					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/ice: add a structure for RSS
  2019-11-12  8:12 [dpdk-dev] [PATCH] net/ice: add a structure for RSS Simei Su
@ 2019-11-12 13:37 ` Zhang, Qi Z
  2019-11-13  1:12   ` Su, Simei
  2019-11-13  2:03 ` [dpdk-dev] [PATCH v2] net/ice: fix flow destroy issue " Simei Su
  1 sibling, 1 reply; 6+ messages in thread
From: Zhang, Qi Z @ 2019-11-12 13:37 UTC (permalink / raw)
  To: Su, Simei, Ye, Xiaolong, Yang, Qiming; +Cc: dev



> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Tuesday, November 12, 2019 4:12 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>;
> Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Su, Simei <simei.su@intel.com>
> Subject: [PATCH] net/ice: add a structure for RSS


Add a structure is not the patch's purpose, we want to fix the flow destroy issue, and we need to add a new flag (new structure) for this fix.
So please change the title to "fix ...."

> 
> This patch adds a structure to include a flag to indicate if it is a simple_xor flow
> so that it's easier to remove the config when destroying the flow. The patch
> also simplifies code implementation logic in ice_hash_create().
> 
> In ice_hash_create(), whatever the hash_function is, the filter_ptr->symm is
> always 0 and when we destroy the flow, the ice_rem_rss_cfg() is never carried
> out. So the destroy function never works well. The patch fixes this issue and at
> the same time distinguishes semanteme between simple_xor and
> symmetric_toeplitz.

Please put above segment at first in the commit log.

> 
> Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")
> 
> Signed-off-by: Simei Su <simei.su@intel.com>
> ---
>  drivers/net/ice/ice_hash.c | 42 +++++++++++++++++++++++-------------------
>  1 file changed, 23 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index
> 57e7d55..d884343 100644
> --- a/drivers/net/ice/ice_hash.c
> +++ b/drivers/net/ice/ice_hash.c
> @@ -41,6 +41,11 @@ struct rss_meta {
>  	uint8_t hash_function;
>  };
> 
> +struct ice_hash_flow_cfg {
> +	bool simple_xor;
> +	struct ice_rss_cfg rss_cfg;
> +};
> +
>  static int
>  ice_hash_init(struct ice_adapter *ad);
> 
> @@ -452,14 +457,14 @@ struct ice_hash_match_type ice_hash_type_list[] = {
>  	struct ice_vsi *vsi = pf->main_vsi;
>  	int ret;
>  	uint32_t reg;
> -	struct ice_rss_cfg *filter_ptr;
> +	struct ice_hash_flow_cfg *filter_ptr;
> 
>  	uint32_t headermask = ((struct rss_meta *)meta)->pkt_hdr;
>  	uint64_t hash_field = ((struct rss_meta *)meta)->hash_flds;
>  	uint8_t hash_function = ((struct rss_meta *)meta)->hash_function;
> 
>  	filter_ptr = rte_zmalloc("ice_rss_filter",
> -				sizeof(struct ice_rss_cfg), 0);
> +				sizeof(struct ice_hash_flow_cfg), 0);
>  	if (!filter_ptr) {
>  		rte_flow_error_set(error, EINVAL,
>  				RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> @@ -474,19 +479,20 @@ struct ice_hash_match_type ice_hash_type_list[] = {
>  			(2 << VSIQF_HASH_CTL_HASH_SCHEME_S);
>  		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
> 
> -		filter_ptr->symm = 0;
> +		filter_ptr->simple_xor = 1;
> 
>  		goto out;
> -	} else if (hash_function ==
> RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
> -		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 1);
> -		if (ret) {
> -			rte_flow_error_set(error, EINVAL,
> -					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> -					"rss flow create fail");
> -			goto error;
> -		}
>  	} else {
> -		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 0);
> +		filter_ptr->rss_cfg.packet_hdr = headermask;
> +		filter_ptr->rss_cfg.hashed_flds = hash_field;
> +		filter_ptr->rss_cfg.symm =
> +			(hash_function ==
> +				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ);
> +
> +		ret = ice_add_rss_cfg(hw, vsi->idx,
> +				filter_ptr->rss_cfg.hashed_flds,
> +				filter_ptr->rss_cfg.packet_hdr,
> +				filter_ptr->rss_cfg.symm);
>  		if (ret) {
>  			rte_flow_error_set(error, EINVAL,
>  					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> @@ -495,9 +501,6 @@ struct ice_hash_match_type ice_hash_type_list[] = {
>  		}
>  	}
> 
> -	filter_ptr->packet_hdr = headermask;
> -	filter_ptr->hashed_flds = hash_field;
> -
>  out:
>  	flow->rule = filter_ptr;
>  	rte_free(meta);
> @@ -519,11 +522,11 @@ struct ice_hash_match_type ice_hash_type_list[] = {
>  	struct ice_vsi *vsi = pf->main_vsi;
>  	int ret;
>  	uint32_t reg;
> -	struct ice_rss_cfg *filter_ptr;
> +	struct ice_hash_flow_cfg *filter_ptr;
> 
> -	filter_ptr = (struct ice_rss_cfg *)flow->rule;
> +	filter_ptr = (struct ice_hash_flow_cfg *)flow->rule;
> 
> -	if (filter_ptr->symm == 0) {
> +	if (filter_ptr->simple_xor == 1) {
>  		/* Return to symmetric_toeplitz state. */
>  		reg = ICE_READ_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id));
>  		reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) | @@ -531,7
> +534,8 @@ struct ice_hash_match_type ice_hash_type_list[] = {
>  		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
>  	} else {
>  		ret = ice_rem_rss_cfg(hw, vsi->idx,
> -			filter_ptr->hashed_flds, filter_ptr->packet_hdr);
> +				filter_ptr->rss_cfg.hashed_flds,
> +				filter_ptr->rss_cfg.packet_hdr);
>  		if (ret) {
>  			rte_flow_error_set(error, EINVAL,
>  					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> --
> 1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/ice: add a structure for RSS
  2019-11-12 13:37 ` Zhang, Qi Z
@ 2019-11-13  1:12   ` Su, Simei
  0 siblings, 0 replies; 6+ messages in thread
From: Su, Simei @ 2019-11-13  1:12 UTC (permalink / raw)
  To: Zhang, Qi Z, Ye, Xiaolong, Yang, Qiming; +Cc: dev

Hi, Qi

> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Tuesday, November 12, 2019 9:38 PM
> To: Su, Simei <simei.su@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>;
> Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] net/ice: add a structure for RSS
> 
> 
> 
> > -----Original Message-----
> > From: Su, Simei <simei.su@intel.com>
> > Sent: Tuesday, November 12, 2019 4:12 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Ye, Xiaolong
> > <xiaolong.ye@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> > Cc: dev@dpdk.org; Su, Simei <simei.su@intel.com>
> > Subject: [PATCH] net/ice: add a structure for RSS
> 
> 
> Add a structure is not the patch's purpose, we want to fix the flow destroy
> issue, and we need to add a new flag (new structure) for this fix.
> So please change the title to "fix ...."
> 

  Ok, I will change it in v2.

> >
> > This patch adds a structure to include a flag to indicate if it is a
> > simple_xor flow so that it's easier to remove the config when
> > destroying the flow. The patch also simplifies code implementation logic in
> ice_hash_create().
> >
> > In ice_hash_create(), whatever the hash_function is, the
> > filter_ptr->symm is always 0 and when we destroy the flow, the
> > ice_rem_rss_cfg() is never carried out. So the destroy function never
> > works well. The patch fixes this issue and at the same time
> > distinguishes semanteme between simple_xor and symmetric_toeplitz.
> 
> Please put above segment at first in the commit log.
> 

  Ok, Thanks!

Br
Simei

> >
> > Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")
> >
> > Signed-off-by: Simei Su <simei.su@intel.com>
> > ---
> >  drivers/net/ice/ice_hash.c | 42
> > +++++++++++++++++++++++-------------------
> >  1 file changed, 23 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
> > index
> > 57e7d55..d884343 100644
> > --- a/drivers/net/ice/ice_hash.c
> > +++ b/drivers/net/ice/ice_hash.c
> > @@ -41,6 +41,11 @@ struct rss_meta {
> >  	uint8_t hash_function;
> >  };
> >
> > +struct ice_hash_flow_cfg {
> > +	bool simple_xor;
> > +	struct ice_rss_cfg rss_cfg;
> > +};
> > +
> >  static int
> >  ice_hash_init(struct ice_adapter *ad);
> >
> > @@ -452,14 +457,14 @@ struct ice_hash_match_type ice_hash_type_list[]
> = {
> >  	struct ice_vsi *vsi = pf->main_vsi;
> >  	int ret;
> >  	uint32_t reg;
> > -	struct ice_rss_cfg *filter_ptr;
> > +	struct ice_hash_flow_cfg *filter_ptr;
> >
> >  	uint32_t headermask = ((struct rss_meta *)meta)->pkt_hdr;
> >  	uint64_t hash_field = ((struct rss_meta *)meta)->hash_flds;
> >  	uint8_t hash_function = ((struct rss_meta *)meta)->hash_function;
> >
> >  	filter_ptr = rte_zmalloc("ice_rss_filter",
> > -				sizeof(struct ice_rss_cfg), 0);
> > +				sizeof(struct ice_hash_flow_cfg), 0);
> >  	if (!filter_ptr) {
> >  		rte_flow_error_set(error, EINVAL,
> >  				RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -474,19
> +479,20 @@ struct
> > ice_hash_match_type ice_hash_type_list[] = {
> >  			(2 << VSIQF_HASH_CTL_HASH_SCHEME_S);
> >  		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
> >
> > -		filter_ptr->symm = 0;
> > +		filter_ptr->simple_xor = 1;
> >
> >  		goto out;
> > -	} else if (hash_function ==
> > RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
> > -		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 1);
> > -		if (ret) {
> > -			rte_flow_error_set(error, EINVAL,
> > -					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> > -					"rss flow create fail");
> > -			goto error;
> > -		}
> >  	} else {
> > -		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 0);
> > +		filter_ptr->rss_cfg.packet_hdr = headermask;
> > +		filter_ptr->rss_cfg.hashed_flds = hash_field;
> > +		filter_ptr->rss_cfg.symm =
> > +			(hash_function ==
> > +				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ);
> > +
> > +		ret = ice_add_rss_cfg(hw, vsi->idx,
> > +				filter_ptr->rss_cfg.hashed_flds,
> > +				filter_ptr->rss_cfg.packet_hdr,
> > +				filter_ptr->rss_cfg.symm);
> >  		if (ret) {
> >  			rte_flow_error_set(error, EINVAL,
> >  					RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@
> -495,9 +501,6 @@ struct
> > ice_hash_match_type ice_hash_type_list[] = {
> >  		}
> >  	}
> >
> > -	filter_ptr->packet_hdr = headermask;
> > -	filter_ptr->hashed_flds = hash_field;
> > -
> >  out:
> >  	flow->rule = filter_ptr;
> >  	rte_free(meta);
> > @@ -519,11 +522,11 @@ struct ice_hash_match_type ice_hash_type_list[]
> = {
> >  	struct ice_vsi *vsi = pf->main_vsi;
> >  	int ret;
> >  	uint32_t reg;
> > -	struct ice_rss_cfg *filter_ptr;
> > +	struct ice_hash_flow_cfg *filter_ptr;
> >
> > -	filter_ptr = (struct ice_rss_cfg *)flow->rule;
> > +	filter_ptr = (struct ice_hash_flow_cfg *)flow->rule;
> >
> > -	if (filter_ptr->symm == 0) {
> > +	if (filter_ptr->simple_xor == 1) {
> >  		/* Return to symmetric_toeplitz state. */
> >  		reg = ICE_READ_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id));
> >  		reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) | @@ -531,7
> > +534,8 @@ struct ice_hash_match_type ice_hash_type_list[] = {
> >  		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
> >  	} else {
> >  		ret = ice_rem_rss_cfg(hw, vsi->idx,
> > -			filter_ptr->hashed_flds, filter_ptr->packet_hdr);
> > +				filter_ptr->rss_cfg.hashed_flds,
> > +				filter_ptr->rss_cfg.packet_hdr);
> >  		if (ret) {
> >  			rte_flow_error_set(error, EINVAL,
> >  					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> > --
> > 1.8.3.1


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

* [dpdk-dev] [PATCH v2] net/ice: fix flow destroy issue for RSS
  2019-11-12  8:12 [dpdk-dev] [PATCH] net/ice: add a structure for RSS Simei Su
  2019-11-12 13:37 ` Zhang, Qi Z
@ 2019-11-13  2:03 ` Simei Su
  2019-11-14  4:52   ` Zhang, Qi Z
  2019-11-14  6:25   ` Ye Xiaolong
  1 sibling, 2 replies; 6+ messages in thread
From: Simei Su @ 2019-11-13  2:03 UTC (permalink / raw)
  To: qi.z.zhang, qiming.yang; +Cc: dev, xiaolong.ye, simei.su

In ice_hash_create(), whatever the hash_function is, the filter_ptr->symm
is always 0 and when we destroy the flow, the ice_rem_rss_cfg() is never
carried out. So the destroy function never works well. The patch fixes
this issue and at the same time distinguishes semanteme between simple_xor
and symmetric_toeplitz.

To fix this issue, the patch adds a new structure to include a flag to
indicate if it is a simple_xor flow so that it's easier to remove the
config when destroying the flow. The patch also simplifies code
implementation logic in ice_hash_create().

Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/ice/ice_hash.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index 57e7d55..d884343 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -41,6 +41,11 @@ struct rss_meta {
 	uint8_t hash_function;
 };
 
+struct ice_hash_flow_cfg {
+	bool simple_xor;
+	struct ice_rss_cfg rss_cfg;
+};
+
 static int
 ice_hash_init(struct ice_adapter *ad);
 
@@ -452,14 +457,14 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 	struct ice_vsi *vsi = pf->main_vsi;
 	int ret;
 	uint32_t reg;
-	struct ice_rss_cfg *filter_ptr;
+	struct ice_hash_flow_cfg *filter_ptr;
 
 	uint32_t headermask = ((struct rss_meta *)meta)->pkt_hdr;
 	uint64_t hash_field = ((struct rss_meta *)meta)->hash_flds;
 	uint8_t hash_function = ((struct rss_meta *)meta)->hash_function;
 
 	filter_ptr = rte_zmalloc("ice_rss_filter",
-				sizeof(struct ice_rss_cfg), 0);
+				sizeof(struct ice_hash_flow_cfg), 0);
 	if (!filter_ptr) {
 		rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
@@ -474,19 +479,20 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 			(2 << VSIQF_HASH_CTL_HASH_SCHEME_S);
 		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
 
-		filter_ptr->symm = 0;
+		filter_ptr->simple_xor = 1;
 
 		goto out;
-	} else if (hash_function == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
-		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 1);
-		if (ret) {
-			rte_flow_error_set(error, EINVAL,
-					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-					"rss flow create fail");
-			goto error;
-		}
 	} else {
-		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 0);
+		filter_ptr->rss_cfg.packet_hdr = headermask;
+		filter_ptr->rss_cfg.hashed_flds = hash_field;
+		filter_ptr->rss_cfg.symm =
+			(hash_function ==
+				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ);
+
+		ret = ice_add_rss_cfg(hw, vsi->idx,
+				filter_ptr->rss_cfg.hashed_flds,
+				filter_ptr->rss_cfg.packet_hdr,
+				filter_ptr->rss_cfg.symm);
 		if (ret) {
 			rte_flow_error_set(error, EINVAL,
 					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
@@ -495,9 +501,6 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 		}
 	}
 
-	filter_ptr->packet_hdr = headermask;
-	filter_ptr->hashed_flds = hash_field;
-
 out:
 	flow->rule = filter_ptr;
 	rte_free(meta);
@@ -519,11 +522,11 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 	struct ice_vsi *vsi = pf->main_vsi;
 	int ret;
 	uint32_t reg;
-	struct ice_rss_cfg *filter_ptr;
+	struct ice_hash_flow_cfg *filter_ptr;
 
-	filter_ptr = (struct ice_rss_cfg *)flow->rule;
+	filter_ptr = (struct ice_hash_flow_cfg *)flow->rule;
 
-	if (filter_ptr->symm == 0) {
+	if (filter_ptr->simple_xor == 1) {
 		/* Return to symmetric_toeplitz state. */
 		reg = ICE_READ_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id));
 		reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) |
@@ -531,7 +534,8 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
 	} else {
 		ret = ice_rem_rss_cfg(hw, vsi->idx,
-			filter_ptr->hashed_flds, filter_ptr->packet_hdr);
+				filter_ptr->rss_cfg.hashed_flds,
+				filter_ptr->rss_cfg.packet_hdr);
 		if (ret) {
 			rte_flow_error_set(error, EINVAL,
 					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH v2] net/ice: fix flow destroy issue for RSS
  2019-11-13  2:03 ` [dpdk-dev] [PATCH v2] net/ice: fix flow destroy issue " Simei Su
@ 2019-11-14  4:52   ` Zhang, Qi Z
  2019-11-14  6:25   ` Ye Xiaolong
  1 sibling, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2019-11-14  4:52 UTC (permalink / raw)
  To: Su, Simei, Yang, Qiming; +Cc: dev, Ye, Xiaolong



> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Wednesday, November 13, 2019 10:03 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Su, Simei
> <simei.su@intel.com>
> Subject: [PATCH v2] net/ice: fix flow destroy issue for RSS
> 
> In ice_hash_create(), whatever the hash_function is, the filter_ptr->symm is
> always 0 and when we destroy the flow, the ice_rem_rss_cfg() is never carried
> out. So the destroy function never works well. The patch fixes this issue and at
> the same time distinguishes semanteme between simple_xor and
> symmetric_toeplitz.
> 
> To fix this issue, the patch adds a new structure to include a flag to indicate if it
> is a simple_xor flow so that it's easier to remove the config when destroying
> the flow. The patch also simplifies code implementation logic in
> ice_hash_create().
> 
> Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")
> 
> Signed-off-by: Simei Su <simei.su@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: fix flow destroy issue for RSS
  2019-11-13  2:03 ` [dpdk-dev] [PATCH v2] net/ice: fix flow destroy issue " Simei Su
  2019-11-14  4:52   ` Zhang, Qi Z
@ 2019-11-14  6:25   ` Ye Xiaolong
  1 sibling, 0 replies; 6+ messages in thread
From: Ye Xiaolong @ 2019-11-14  6:25 UTC (permalink / raw)
  To: Simei Su; +Cc: qi.z.zhang, qiming.yang, dev

On 11/13, Simei Su wrote:
>In ice_hash_create(), whatever the hash_function is, the filter_ptr->symm
>is always 0 and when we destroy the flow, the ice_rem_rss_cfg() is never
>carried out. So the destroy function never works well. The patch fixes
>this issue and at the same time distinguishes semanteme between simple_xor
>and symmetric_toeplitz.
>
>To fix this issue, the patch adds a new structure to include a flag to
>indicate if it is a simple_xor flow so that it's easier to remove the
>config when destroying the flow. The patch also simplifies code
>implementation logic in ice_hash_create().
>
>Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")
>
>Signed-off-by: Simei Su <simei.su@intel.com>
>---
> drivers/net/ice/ice_hash.c | 42 +++++++++++++++++++++++-------------------
> 1 file changed, 23 insertions(+), 19 deletions(-)
>
>diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
>index 57e7d55..d884343 100644
>--- a/drivers/net/ice/ice_hash.c
>+++ b/drivers/net/ice/ice_hash.c
>@@ -41,6 +41,11 @@ struct rss_meta {
> 	uint8_t hash_function;
> };
> 
>+struct ice_hash_flow_cfg {
>+	bool simple_xor;
>+	struct ice_rss_cfg rss_cfg;
>+};
>+
> static int
> ice_hash_init(struct ice_adapter *ad);
> 
>@@ -452,14 +457,14 @@ struct ice_hash_match_type ice_hash_type_list[] = {
> 	struct ice_vsi *vsi = pf->main_vsi;
> 	int ret;
> 	uint32_t reg;
>-	struct ice_rss_cfg *filter_ptr;
>+	struct ice_hash_flow_cfg *filter_ptr;
> 
> 	uint32_t headermask = ((struct rss_meta *)meta)->pkt_hdr;
> 	uint64_t hash_field = ((struct rss_meta *)meta)->hash_flds;
> 	uint8_t hash_function = ((struct rss_meta *)meta)->hash_function;
> 
> 	filter_ptr = rte_zmalloc("ice_rss_filter",
>-				sizeof(struct ice_rss_cfg), 0);
>+				sizeof(struct ice_hash_flow_cfg), 0);
> 	if (!filter_ptr) {
> 		rte_flow_error_set(error, EINVAL,
> 				RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
>@@ -474,19 +479,20 @@ struct ice_hash_match_type ice_hash_type_list[] = {
> 			(2 << VSIQF_HASH_CTL_HASH_SCHEME_S);
> 		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
> 
>-		filter_ptr->symm = 0;
>+		filter_ptr->simple_xor = 1;
> 
> 		goto out;
>-	} else if (hash_function == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
>-		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 1);
>-		if (ret) {
>-			rte_flow_error_set(error, EINVAL,
>-					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
>-					"rss flow create fail");
>-			goto error;
>-		}
> 	} else {
>-		ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 0);
>+		filter_ptr->rss_cfg.packet_hdr = headermask;
>+		filter_ptr->rss_cfg.hashed_flds = hash_field;
>+		filter_ptr->rss_cfg.symm =
>+			(hash_function ==
>+				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ);
>+
>+		ret = ice_add_rss_cfg(hw, vsi->idx,
>+				filter_ptr->rss_cfg.hashed_flds,
>+				filter_ptr->rss_cfg.packet_hdr,
>+				filter_ptr->rss_cfg.symm);
> 		if (ret) {
> 			rte_flow_error_set(error, EINVAL,
> 					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
>@@ -495,9 +501,6 @@ struct ice_hash_match_type ice_hash_type_list[] = {
> 		}
> 	}
> 
>-	filter_ptr->packet_hdr = headermask;
>-	filter_ptr->hashed_flds = hash_field;
>-
> out:
> 	flow->rule = filter_ptr;
> 	rte_free(meta);
>@@ -519,11 +522,11 @@ struct ice_hash_match_type ice_hash_type_list[] = {
> 	struct ice_vsi *vsi = pf->main_vsi;
> 	int ret;
> 	uint32_t reg;
>-	struct ice_rss_cfg *filter_ptr;
>+	struct ice_hash_flow_cfg *filter_ptr;
> 
>-	filter_ptr = (struct ice_rss_cfg *)flow->rule;
>+	filter_ptr = (struct ice_hash_flow_cfg *)flow->rule;
> 
>-	if (filter_ptr->symm == 0) {
>+	if (filter_ptr->simple_xor == 1) {
> 		/* Return to symmetric_toeplitz state. */
> 		reg = ICE_READ_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id));
> 		reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) |
>@@ -531,7 +534,8 @@ struct ice_hash_match_type ice_hash_type_list[] = {
> 		ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
> 	} else {
> 		ret = ice_rem_rss_cfg(hw, vsi->idx,
>-			filter_ptr->hashed_flds, filter_ptr->packet_hdr);
>+				filter_ptr->rss_cfg.hashed_flds,
>+				filter_ptr->rss_cfg.packet_hdr);
> 		if (ret) {
> 			rte_flow_error_set(error, EINVAL,
> 					RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
>-- 
>1.8.3.1
>

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

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

end of thread, other threads:[~2019-11-14  6:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12  8:12 [dpdk-dev] [PATCH] net/ice: add a structure for RSS Simei Su
2019-11-12 13:37 ` Zhang, Qi Z
2019-11-13  1:12   ` Su, Simei
2019-11-13  2:03 ` [dpdk-dev] [PATCH v2] net/ice: fix flow destroy issue " Simei Su
2019-11-14  4:52   ` Zhang, Qi Z
2019-11-14  6:25   ` Ye Xiaolong

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