[v4,21/30] net/ice/base: fix segment in remove existing RSS rule

Message ID 20190923062702.3836-22-qi.z.zhang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: xiaolong ye
Headers
Series net/ice/base: share code update secend batch. |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Qi Zhang Sept. 23, 2019, 6:26 a.m. UTC
  Before this patch, RSS tunneled rules can not be destroyed at runtime.
This is because it can not find the existing matching profile for tunnels.
segs[0] should always be zero and all matched, segs[1] for inner part.
It only construct one segment.

This patch modifies construct segment in ice_rem_rss_cfg_sync() to
match ice_add_rss_cfg_sync().

Fixes: 75bc2ea04af4 ("net/ice/base: packet encapsulation for RSS")

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_flow.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Qiming Yang Sept. 23, 2019, 7:19 a.m. UTC | #1
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Monday, September 23, 2019 2:27 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Yan, Zhirun <zhirun.yan@intel.com>; Stillwell Jr,
> Paul M <paul.m.stillwell.jr@intel.com>
> Subject: [PATCH v4 21/30] net/ice/base: fix segment in remove existing RSS
> rule
> 
> Before this patch, RSS tunneled rules can not be destroyed at runtime.
> This is because it can not find the existing matching profile for tunnels.
> segs[0] should always be zero and all matched, segs[1] for inner part.
> It only construct one segment.
> 
> This patch modifies construct segment in ice_rem_rss_cfg_sync() to match
> ice_add_rss_cfg_sync().
> 
> Fixes: 75bc2ea04af4 ("net/ice/base: packet encapsulation for RSS")
> 
+CC stable

> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>  drivers/net/ice/base/ice_flow.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
> index 6782dfaa8..f9c65d6a2 100644
> --- a/drivers/net/ice/base/ice_flow.c
> +++ b/drivers/net/ice/base/ice_flow.c
> @@ -2185,12 +2185,14 @@ ice_rem_rss_cfg_sync(struct ice_hw *hw, u16
> vsi_handle, u64 hashed_flds,
>  	struct ice_flow_prof *prof;
>  	enum ice_status status;
> 
> -	segs = (struct ice_flow_seg_info *)ice_malloc(hw, sizeof(*segs));
> +	segs = (struct ice_flow_seg_info *)ice_calloc(hw, segs_cnt,
> +						      sizeof(*segs));
>  	if (!segs)
>  		return ICE_ERR_NO_MEMORY;
> 
>  	/* Construct the packet segment info from the hashed fields */
> -	status = ice_flow_set_rss_seg_info(segs, hashed_flds, addl_hdrs);
> +	status = ice_flow_set_rss_seg_info(&segs[segs_cnt - 1], hashed_flds,
> +					   addl_hdrs);
>  	if (status)
>  		goto out;
> 
> --
> 2.13.6
  

Patch

diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index 6782dfaa8..f9c65d6a2 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -2185,12 +2185,14 @@  ice_rem_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
 	struct ice_flow_prof *prof;
 	enum ice_status status;
 
-	segs = (struct ice_flow_seg_info *)ice_malloc(hw, sizeof(*segs));
+	segs = (struct ice_flow_seg_info *)ice_calloc(hw, segs_cnt,
+						      sizeof(*segs));
 	if (!segs)
 		return ICE_ERR_NO_MEMORY;
 
 	/* Construct the packet segment info from the hashed fields */
-	status = ice_flow_set_rss_seg_info(segs, hashed_flds, addl_hdrs);
+	status = ice_flow_set_rss_seg_info(&segs[segs_cnt - 1], hashed_flds,
+					   addl_hdrs);
 	if (status)
 		goto out;