patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 10/52] net/ice/base: fix variable type for ACL
       [not found] <20200603024016.30636-1-qi.z.zhang@intel.com>
@ 2020-06-03  2:39 ` Qi Zhang
  2020-06-03  2:40 ` [dpdk-stable] [PATCH 37/52] net/ice/base: fix for memory leak Qi Zhang
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-03  2:39 UTC (permalink / raw)
  To: qiming.yang; +Cc: dev, xiaolong.ye, Qi Zhang, stable, Paul M Stillwell Jr

The commit ef92cee94cdb ("ice-shared: Fix remaining minor casting
issues") changed the idx variable within ice_acl_add_entry() from
a u16 to a u8. This causes the code to truncate the values greater
than 255 to 255 or less when calling ice_aq_program_acl_entry()
resulting in the wrong TCAM index being programmed for the specified
rule. The result is that the rule action doesn't work correctly
(packets don't get routed to the correct queue or dropped if that
is the action). Fix the issue by changing the variable to be a u16
again.

Fixes: f3202a097f12 ("net/ice/base: add ACL module")
Cc: stable@dpdk.org

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_acl_ctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_acl_ctrl.c b/drivers/net/ice/base/ice_acl_ctrl.c
index e67605141..39b399dd4 100644
--- a/drivers/net/ice/base/ice_acl_ctrl.c
+++ b/drivers/net/ice/base/ice_acl_ctrl.c
@@ -934,9 +934,10 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
 		  enum ice_acl_entry_prior prior, u8 *keys, u8 *inverts,
 		  struct ice_acl_act_entry *acts, u8 acts_cnt, u16 *entry_idx)
 {
-	u8 i, entry_tcam, num_cscd, idx, offset;
+	u8 i, entry_tcam, num_cscd, offset;
 	struct ice_aqc_acl_data buf;
 	enum ice_status status = ICE_SUCCESS;
+	u16 idx;
 
 	if (!scen)
 		return ICE_ERR_DOES_NOT_EXIST;
-- 
2.13.6


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

* [dpdk-stable] [PATCH 37/52] net/ice/base: fix for memory leak
       [not found] <20200603024016.30636-1-qi.z.zhang@intel.com>
  2020-06-03  2:39 ` [dpdk-stable] [PATCH 10/52] net/ice/base: fix variable type for ACL Qi Zhang
@ 2020-06-03  2:40 ` Qi Zhang
  2020-06-03  2:40 ` [dpdk-stable] [PATCH 47/52] net/ice/base: fix reference count when update VSI list Qi Zhang
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-03  2:40 UTC (permalink / raw)
  To: qiming.yang
  Cc: dev, xiaolong.ye, Qi Zhang, stable, Surabhi Boob, Paul M . Stillwell Jr

Handles memory leaks during control queue initialization and
buffer allocation failures. The MACRO - ICE_FREE_CQ_BUFS is modified to
re-use for this fix.

Fixes: 6c1f26be50a2 ("net/ice/base: add control queue information")
Cc: stable@dpdk.org

Signed-off-by: Surabhi Boob <surabhi.boob@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_controlq.c | 39 +++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c
index 3ef86fa03..f278ef636 100644
--- a/drivers/net/ice/base/ice_controlq.c
+++ b/drivers/net/ice/base/ice_controlq.c
@@ -182,7 +182,9 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	i--;
 	for (; i >= 0; i--)
 		ice_free_dma_mem(hw, &cq->rq.r.rq_bi[i]);
+	cq->rq.r.rq_bi = NULL;
 	ice_free(hw, cq->rq.dma_head);
+	cq->rq.dma_head = NULL;
 
 	return ICE_ERR_NO_MEMORY;
 }
@@ -220,7 +222,9 @@ ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	i--;
 	for (; i >= 0; i--)
 		ice_free_dma_mem(hw, &cq->sq.r.sq_bi[i]);
+	cq->sq.r.sq_bi = NULL;
 	ice_free(hw, cq->sq.dma_head);
+	cq->sq.dma_head = NULL;
 
 	return ICE_ERR_NO_MEMORY;
 }
@@ -279,6 +283,24 @@ ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	return ICE_SUCCESS;
 }
 
+#define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
+do {									\
+	/* free descriptors */						\
+	if ((qi)->ring.r.ring##_bi) {					\
+		int i;							\
+									\
+		for (i = 0; i < (qi)->num_##ring##_entries; i++)	\
+			if ((qi)->ring.r.ring##_bi[i].pa)		\
+				ice_free_dma_mem((hw),			\
+					&(qi)->ring.r.ring##_bi[i]);	\
+	}								\
+	/* free the buffer info list */					\
+	if ((qi)->ring.cmd_buf)						\
+		ice_free(hw, (qi)->ring.cmd_buf);			\
+	/* free DMA head */						\
+	ice_free(hw, (qi)->ring.dma_head);				\
+} while (0)
+
 /**
  * ice_init_sq - main initialization routine for Control ATQ
  * @hw: pointer to the hardware structure
@@ -334,6 +356,7 @@ static enum ice_status ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	goto init_ctrlq_exit;
 
 init_ctrlq_free_rings:
+	ICE_FREE_CQ_BUFS(hw, cq, sq);
 	ice_free_cq_ring(hw, &cq->sq);
 
 init_ctrlq_exit:
@@ -395,27 +418,13 @@ static enum ice_status ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	goto init_ctrlq_exit;
 
 init_ctrlq_free_rings:
+	ICE_FREE_CQ_BUFS(hw, cq, rq);
 	ice_free_cq_ring(hw, &cq->rq);
 
 init_ctrlq_exit:
 	return ret_code;
 }
 
-#define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
-do {									\
-	int i;								\
-	/* free descriptors */						\
-	for (i = 0; i < (qi)->num_##ring##_entries; i++)		\
-		if ((qi)->ring.r.ring##_bi[i].pa)			\
-			ice_free_dma_mem((hw),				\
-					 &(qi)->ring.r.ring##_bi[i]);	\
-	/* free the buffer info list */					\
-	if ((qi)->ring.cmd_buf)						\
-		ice_free(hw, (qi)->ring.cmd_buf);			\
-	/* free DMA head */						\
-	ice_free(hw, (qi)->ring.dma_head);				\
-} while (0)
-
 /**
  * ice_shutdown_sq - shutdown the Control ATQ
  * @hw: pointer to the hardware structure
-- 
2.13.6


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

* [dpdk-stable] [PATCH 47/52] net/ice/base: fix reference count when update VSI list
       [not found] <20200603024016.30636-1-qi.z.zhang@intel.com>
  2020-06-03  2:39 ` [dpdk-stable] [PATCH 10/52] net/ice/base: fix variable type for ACL Qi Zhang
  2020-06-03  2:40 ` [dpdk-stable] [PATCH 37/52] net/ice/base: fix for memory leak Qi Zhang
@ 2020-06-03  2:40 ` Qi Zhang
  2020-06-03  2:40 ` [dpdk-stable] [PATCH 49/52] net/ice/base: fix uninitialized flag Qi Zhang
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-03  2:40 UTC (permalink / raw)
  To: qiming.yang
  Cc: dev, xiaolong.ye, Qi Zhang, stable, Wei Zhao, Paul M . Stillwell Jr

The parameter ref_cnt is used for tracking how many
rules are reusing this VSI list, so it can only be
updated when a rule which using this list be deleted.

Fixes: f89aa3affa9e ("net/ice/base: support removing advanced rule")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@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_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 84102368b..9c7e55ff9 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -7488,6 +7488,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,
 				  tmp_fltr.fwd_id.hw_vsi_id, status);
 			return status;
 		}
+		fm_list->vsi_list_info->ref_cnt--;
 
 		/* Remove the VSI list since it is no longer used */
 		status = ice_remove_vsi_list_rule(hw, vsi_list_id, lkup_type);
@@ -7566,7 +7567,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	if (list_elem->rule_info.sw_act.fltr_act != ICE_FWD_TO_VSI_LIST) {
 		remove_rule = true;
 	} else if (list_elem->vsi_count > 1) {
-		list_elem->vsi_list_info->ref_cnt--;
 		remove_rule = false;
 		vsi_handle = rinfo->sw_act.vsi_handle;
 		status = ice_adv_rem_update_vsi_list(hw, vsi_handle, list_elem);
-- 
2.13.6


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

* [dpdk-stable] [PATCH 49/52] net/ice/base: fix uninitialized flag
       [not found] <20200603024016.30636-1-qi.z.zhang@intel.com>
                   ` (2 preceding siblings ...)
  2020-06-03  2:40 ` [dpdk-stable] [PATCH 47/52] net/ice/base: fix reference count when update VSI list Qi Zhang
@ 2020-06-03  2:40 ` Qi Zhang
  2020-06-08  2:51   ` Yang, Qiming
       [not found] ` <20200609120001.35110-1-qi.z.zhang@intel.com>
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Qi Zhang @ 2020-06-03  2:40 UTC (permalink / raw)
  To: qiming.yang
  Cc: dev, xiaolong.ye, Qi Zhang, stable, Wei Zhao, Paul M . Stillwell Jr

This patch add initialization for prof_res_bm_init flag
to zero in order that the possible resource for fv in the
files can be initialized.

Fixes: 453d087ccaff ("net/ice/base: add common functions")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@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_common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 54112e8f2..baaeee321 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -536,6 +536,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 		return ICE_ERR_NO_MEMORY;
 
 	INIT_LIST_HEAD(&sw->vsi_list_map_head);
+	sw->prof_res_bm_init = 0;
 
 	status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
 	if (status) {
-- 
2.13.6


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

* Re: [dpdk-stable] [PATCH 49/52] net/ice/base: fix uninitialized flag
  2020-06-03  2:40 ` [dpdk-stable] [PATCH 49/52] net/ice/base: fix uninitialized flag Qi Zhang
@ 2020-06-08  2:51   ` Yang, Qiming
  0 siblings, 0 replies; 21+ messages in thread
From: Yang, Qiming @ 2020-06-08  2:51 UTC (permalink / raw)
  To: Zhang, Qi Z; +Cc: dev, Ye, Xiaolong, stable, Zhao1, Wei, Stillwell Jr, Paul M

Hi, Qi

> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, June 3, 2020 10:40
> To: Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; stable@dpdk.org; Zhao1, Wei
> <wei.zhao1@intel.com>; Stillwell Jr, Paul M <paul.m.stillwell.jr@intel.com>
> Subject: [PATCH 49/52] net/ice/base: fix uninitialized flag
> 
> This patch add initialization for prof_res_bm_init flag to zero in order that the
> possible resource for fv in the files can be initialized.

What's the 'fv' means?
 
> 
> Fixes: 453d087ccaff ("net/ice/base: add common functions")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Zhao <wei.zhao1@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_common.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ice/base/ice_common.c
> b/drivers/net/ice/base/ice_common.c
> index 54112e8f2..baaeee321 100644
> --- a/drivers/net/ice/base/ice_common.c
> +++ b/drivers/net/ice/base/ice_common.c
> @@ -536,6 +536,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct
> ice_hw *hw)
>  		return ICE_ERR_NO_MEMORY;
> 
>  	INIT_LIST_HEAD(&sw->vsi_list_map_head);
> +	sw->prof_res_bm_init = 0;
> 
>  	status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
>  	if (status) {
> --
> 2.13.6


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

* [dpdk-stable] [PATCH v2 10/52] net/ice/base: fix variable type for ACL
       [not found] ` <20200609120001.35110-1-qi.z.zhang@intel.com>
@ 2020-06-09 11:59   ` Qi Zhang
  2020-06-11 18:35     ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 37/52] net/ice/base: fix for memory leak Qi Zhang
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 21+ messages in thread
From: Qi Zhang @ 2020-06-09 11:59 UTC (permalink / raw)
  To: qiming.yang; +Cc: xiaolong.ye, dev, Qi Zhang, stable, Paul M Stillwell Jr

The commit ef92cee94cdb ("ice-shared: Fix remaining minor casting
issues") changed the idx variable within ice_acl_add_entry() from
a u16 to a u8. This causes the code to truncate the values greater
than 255 to 255 or less when calling ice_aq_program_acl_entry()
resulting in the wrong TCAM index being programmed for the specified
rule. The result is that the rule action doesn't work correctly
(packets don't get routed to the correct queue or dropped if that
is the action). Fix the issue by changing the variable to be a u16
again.

Fixes: f3202a097f12 ("net/ice/base: add ACL module")
Cc: stable@dpdk.org

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_acl_ctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_acl_ctrl.c b/drivers/net/ice/base/ice_acl_ctrl.c
index e67605141..39b399dd4 100644
--- a/drivers/net/ice/base/ice_acl_ctrl.c
+++ b/drivers/net/ice/base/ice_acl_ctrl.c
@@ -934,9 +934,10 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
 		  enum ice_acl_entry_prior prior, u8 *keys, u8 *inverts,
 		  struct ice_acl_act_entry *acts, u8 acts_cnt, u16 *entry_idx)
 {
-	u8 i, entry_tcam, num_cscd, idx, offset;
+	u8 i, entry_tcam, num_cscd, offset;
 	struct ice_aqc_acl_data buf;
 	enum ice_status status = ICE_SUCCESS;
+	u16 idx;
 
 	if (!scen)
 		return ICE_ERR_DOES_NOT_EXIST;
-- 
2.13.6


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

* [dpdk-stable] [PATCH v2 37/52] net/ice/base: fix for memory leak
       [not found] ` <20200609120001.35110-1-qi.z.zhang@intel.com>
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 10/52] net/ice/base: fix variable type for ACL Qi Zhang
@ 2020-06-09 11:59   ` Qi Zhang
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 47/52] net/ice/base: fix reference count when update VSI list Qi Zhang
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 49/52] net/ice/base: fix uninitialized flag Qi Zhang
  3 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-09 11:59 UTC (permalink / raw)
  To: qiming.yang
  Cc: xiaolong.ye, dev, Qi Zhang, stable, Surabhi Boob, Paul M . Stillwell Jr

Handles memory leaks during control queue initialization and
buffer allocation failures. The MACRO - ICE_FREE_CQ_BUFS is modified to
re-use for this fix.

Fixes: 6c1f26be50a2 ("net/ice/base: add control queue information")
Cc: stable@dpdk.org

Signed-off-by: Surabhi Boob <surabhi.boob@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_controlq.c | 39 +++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c
index 3ef86fa03..f278ef636 100644
--- a/drivers/net/ice/base/ice_controlq.c
+++ b/drivers/net/ice/base/ice_controlq.c
@@ -182,7 +182,9 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	i--;
 	for (; i >= 0; i--)
 		ice_free_dma_mem(hw, &cq->rq.r.rq_bi[i]);
+	cq->rq.r.rq_bi = NULL;
 	ice_free(hw, cq->rq.dma_head);
+	cq->rq.dma_head = NULL;
 
 	return ICE_ERR_NO_MEMORY;
 }
@@ -220,7 +222,9 @@ ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	i--;
 	for (; i >= 0; i--)
 		ice_free_dma_mem(hw, &cq->sq.r.sq_bi[i]);
+	cq->sq.r.sq_bi = NULL;
 	ice_free(hw, cq->sq.dma_head);
+	cq->sq.dma_head = NULL;
 
 	return ICE_ERR_NO_MEMORY;
 }
@@ -279,6 +283,24 @@ ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	return ICE_SUCCESS;
 }
 
+#define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
+do {									\
+	/* free descriptors */						\
+	if ((qi)->ring.r.ring##_bi) {					\
+		int i;							\
+									\
+		for (i = 0; i < (qi)->num_##ring##_entries; i++)	\
+			if ((qi)->ring.r.ring##_bi[i].pa)		\
+				ice_free_dma_mem((hw),			\
+					&(qi)->ring.r.ring##_bi[i]);	\
+	}								\
+	/* free the buffer info list */					\
+	if ((qi)->ring.cmd_buf)						\
+		ice_free(hw, (qi)->ring.cmd_buf);			\
+	/* free DMA head */						\
+	ice_free(hw, (qi)->ring.dma_head);				\
+} while (0)
+
 /**
  * ice_init_sq - main initialization routine for Control ATQ
  * @hw: pointer to the hardware structure
@@ -334,6 +356,7 @@ static enum ice_status ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	goto init_ctrlq_exit;
 
 init_ctrlq_free_rings:
+	ICE_FREE_CQ_BUFS(hw, cq, sq);
 	ice_free_cq_ring(hw, &cq->sq);
 
 init_ctrlq_exit:
@@ -395,27 +418,13 @@ static enum ice_status ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	goto init_ctrlq_exit;
 
 init_ctrlq_free_rings:
+	ICE_FREE_CQ_BUFS(hw, cq, rq);
 	ice_free_cq_ring(hw, &cq->rq);
 
 init_ctrlq_exit:
 	return ret_code;
 }
 
-#define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
-do {									\
-	int i;								\
-	/* free descriptors */						\
-	for (i = 0; i < (qi)->num_##ring##_entries; i++)		\
-		if ((qi)->ring.r.ring##_bi[i].pa)			\
-			ice_free_dma_mem((hw),				\
-					 &(qi)->ring.r.ring##_bi[i]);	\
-	/* free the buffer info list */					\
-	if ((qi)->ring.cmd_buf)						\
-		ice_free(hw, (qi)->ring.cmd_buf);			\
-	/* free DMA head */						\
-	ice_free(hw, (qi)->ring.dma_head);				\
-} while (0)
-
 /**
  * ice_shutdown_sq - shutdown the Control ATQ
  * @hw: pointer to the hardware structure
-- 
2.13.6


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

* [dpdk-stable] [PATCH v2 47/52] net/ice/base: fix reference count when update VSI list
       [not found] ` <20200609120001.35110-1-qi.z.zhang@intel.com>
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 10/52] net/ice/base: fix variable type for ACL Qi Zhang
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 37/52] net/ice/base: fix for memory leak Qi Zhang
@ 2020-06-09 11:59   ` Qi Zhang
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 49/52] net/ice/base: fix uninitialized flag Qi Zhang
  3 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-09 11:59 UTC (permalink / raw)
  To: qiming.yang
  Cc: xiaolong.ye, dev, Qi Zhang, stable, Wei Zhao, Paul M . Stillwell Jr

The parameter ref_cnt is used for tracking how many
rules are reusing this VSI list, so it can only be
updated when a rule which using this list be deleted.

Fixes: f89aa3affa9e ("net/ice/base: support removing advanced rule")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@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_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 84102368b..9c7e55ff9 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -7488,6 +7488,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,
 				  tmp_fltr.fwd_id.hw_vsi_id, status);
 			return status;
 		}
+		fm_list->vsi_list_info->ref_cnt--;
 
 		/* Remove the VSI list since it is no longer used */
 		status = ice_remove_vsi_list_rule(hw, vsi_list_id, lkup_type);
@@ -7566,7 +7567,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	if (list_elem->rule_info.sw_act.fltr_act != ICE_FWD_TO_VSI_LIST) {
 		remove_rule = true;
 	} else if (list_elem->vsi_count > 1) {
-		list_elem->vsi_list_info->ref_cnt--;
 		remove_rule = false;
 		vsi_handle = rinfo->sw_act.vsi_handle;
 		status = ice_adv_rem_update_vsi_list(hw, vsi_handle, list_elem);
-- 
2.13.6


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

* [dpdk-stable] [PATCH v2 49/52] net/ice/base: fix uninitialized flag
       [not found] ` <20200609120001.35110-1-qi.z.zhang@intel.com>
                     ` (2 preceding siblings ...)
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 47/52] net/ice/base: fix reference count when update VSI list Qi Zhang
@ 2020-06-09 11:59   ` Qi Zhang
  2020-06-11 18:45     ` Ferruh Yigit
  3 siblings, 1 reply; 21+ messages in thread
From: Qi Zhang @ 2020-06-09 11:59 UTC (permalink / raw)
  To: qiming.yang
  Cc: xiaolong.ye, dev, Qi Zhang, stable, Wei Zhao, Paul M . Stillwell Jr

This patch add initialization for prof_res_bm_init flag
to zero in order that the possible resource for field vector
in the files can be initialized.

Fixes: 453d087ccaff ("net/ice/base: add common functions")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@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_common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 54112e8f2..baaeee321 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -536,6 +536,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 		return ICE_ERR_NO_MEMORY;
 
 	INIT_LIST_HEAD(&sw->vsi_list_map_head);
+	sw->prof_res_bm_init = 0;
 
 	status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
 	if (status) {
-- 
2.13.6


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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v2 10/52] net/ice/base: fix variable type for ACL
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 10/52] net/ice/base: fix variable type for ACL Qi Zhang
@ 2020-06-11 18:35     ` Ferruh Yigit
  0 siblings, 0 replies; 21+ messages in thread
From: Ferruh Yigit @ 2020-06-11 18:35 UTC (permalink / raw)
  To: Qi Zhang, qiming.yang; +Cc: xiaolong.ye, dev, stable, Paul M Stillwell Jr

On 6/9/2020 12:59 PM, Qi Zhang wrote:
> The commit ef92cee94cdb ("ice-shared: Fix remaining minor casting
> issues") changed the idx variable within ice_acl_add_entry() from
> a u16 to a u8. 

Where is this commit, I guess it is not in the DPDK repo, and the DPDK repo one
is already listed in the 'Fixes' line, is there a benefit to have it, what do
you think to remove this reference?

> This causes the code to truncate the values greater
> than 255 to 255 or less when calling ice_aq_program_acl_entry()
> resulting in the wrong TCAM index being programmed for the specified
> rule. The result is that the rule action doesn't work correctly
> (packets don't get routed to the correct queue or dropped if that
> is the action). Fix the issue by changing the variable to be a u16
> again.
> 
> Fixes: f3202a097f12 ("net/ice/base: add ACL module")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>

<...>

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

* Re: [dpdk-stable] [PATCH v2 49/52] net/ice/base: fix uninitialized flag
  2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 49/52] net/ice/base: fix uninitialized flag Qi Zhang
@ 2020-06-11 18:45     ` Ferruh Yigit
  0 siblings, 0 replies; 21+ messages in thread
From: Ferruh Yigit @ 2020-06-11 18:45 UTC (permalink / raw)
  To: Qi Zhang, qiming.yang
  Cc: xiaolong.ye, dev, stable, Wei Zhao, Paul M . Stillwell Jr

On 6/9/2020 12:59 PM, Qi Zhang wrote:
> This patch add initialization for prof_res_bm_init flag
> to zero in order that the possible resource for field vector
> in the files can be initialized.

I guess this is fixing initialization of _something_ (resource for field vector
in package file?), and this is done by zeroing an uninitialized flag. Can you
please update the patch title to document what is fixed (why change is done)?

> 
> Fixes: 453d087ccaff ("net/ice/base: add common functions")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Zhao <wei.zhao1@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_common.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
> index 54112e8f2..baaeee321 100644
> --- a/drivers/net/ice/base/ice_common.c
> +++ b/drivers/net/ice/base/ice_common.c
> @@ -536,6 +536,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
>  		return ICE_ERR_NO_MEMORY;
>  
>  	INIT_LIST_HEAD(&sw->vsi_list_map_head);
> +	sw->prof_res_bm_init = 0;
>  
>  	status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
>  	if (status) {
> 


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

* [dpdk-stable] [PATCH v3 10/53] net/ice/base: fix variable type for ACL
       [not found] ` <20200615015342.1191-1-qi.z.zhang@intel.com>
@ 2020-06-15  1:52   ` Qi Zhang
  2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 35/53] net/ice/base: fix return value Qi Zhang
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  1:52 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, Qi Zhang, stable, Paul M Stillwell Jr

A u8 idx in ice_acl_add_entry  causes the code to truncate the values
greater than 255 to 255 or less when calling ice_aq_program_acl_entry()
resulting in the wrong TCAM index being programmed for the specified
rule. The result is that the rule action doesn't work correctly
(packets don't get routed to the correct queue or dropped if that
is the action). Fix the issue by changing the variable to be a u16
again.

Fixes: f3202a097f12 ("net/ice/base: add ACL module")
Cc: stable@dpdk.org

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_acl_ctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_acl_ctrl.c b/drivers/net/ice/base/ice_acl_ctrl.c
index e67605141..39b399dd4 100644
--- a/drivers/net/ice/base/ice_acl_ctrl.c
+++ b/drivers/net/ice/base/ice_acl_ctrl.c
@@ -934,9 +934,10 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
 		  enum ice_acl_entry_prior prior, u8 *keys, u8 *inverts,
 		  struct ice_acl_act_entry *acts, u8 acts_cnt, u16 *entry_idx)
 {
-	u8 i, entry_tcam, num_cscd, idx, offset;
+	u8 i, entry_tcam, num_cscd, offset;
 	struct ice_aqc_acl_data buf;
 	enum ice_status status = ICE_SUCCESS;
+	u16 idx;
 
 	if (!scen)
 		return ICE_ERR_DOES_NOT_EXIST;
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 35/53] net/ice/base: fix return value
       [not found] ` <20200615015342.1191-1-qi.z.zhang@intel.com>
  2020-06-15  1:52   ` [dpdk-stable] [PATCH v3 10/53] net/ice/base: fix variable type for ACL Qi Zhang
@ 2020-06-15  1:53   ` Qi Zhang
  2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 37/53] net/ice/base: fix for memory leak Qi Zhang
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  1:53 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, Qi Zhang, stable, Kiran Patil,
	Paul M . Stillwell Jr

Function ice_rem_adv_rule_id return incorrect error code (ICE_ERR_PARAM)
whereas it should have returned ICE_ERR_DOES_NOT_EXIST return code
if filter list is empty or unable to find "rule" in list

Fixes: f89aa3affa9e ("net/ice/base: support removing advanced rule")
Cc: stable@dpdk.org

Signed-off-by: Kiran Patil <kiran.patil@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_switch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 01dcace55..5c53b9ec3 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -7661,7 +7661,8 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,
 						list_itr->lkups_cnt, &rinfo);
 		}
 	}
-	return ICE_ERR_PARAM;
+	/* either list is empty or unable to find rule */
+	return ICE_ERR_DOES_NOT_EXIST;
 }
 
 /**
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 37/53] net/ice/base: fix for memory leak
       [not found] ` <20200615015342.1191-1-qi.z.zhang@intel.com>
  2020-06-15  1:52   ` [dpdk-stable] [PATCH v3 10/53] net/ice/base: fix variable type for ACL Qi Zhang
  2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 35/53] net/ice/base: fix return value Qi Zhang
@ 2020-06-15  1:53   ` Qi Zhang
  2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 47/53] net/ice/base: fix reference count when update VSI list Qi Zhang
  2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 49/53] net/ice/base: fix uninitialized flag for result index bitmap Qi Zhang
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  1:53 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, Qi Zhang, stable, Surabhi Boob,
	Paul M . Stillwell Jr

Handles memory leaks during control queue initialization and
buffer allocation failures. The MACRO - ICE_FREE_CQ_BUFS is modified to
re-use for this fix.

Fixes: 6c1f26be50a2 ("net/ice/base: add control queue information")
Cc: stable@dpdk.org

Signed-off-by: Surabhi Boob <surabhi.boob@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_controlq.c | 39 +++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c
index 3ef86fa03..f278ef636 100644
--- a/drivers/net/ice/base/ice_controlq.c
+++ b/drivers/net/ice/base/ice_controlq.c
@@ -182,7 +182,9 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	i--;
 	for (; i >= 0; i--)
 		ice_free_dma_mem(hw, &cq->rq.r.rq_bi[i]);
+	cq->rq.r.rq_bi = NULL;
 	ice_free(hw, cq->rq.dma_head);
+	cq->rq.dma_head = NULL;
 
 	return ICE_ERR_NO_MEMORY;
 }
@@ -220,7 +222,9 @@ ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	i--;
 	for (; i >= 0; i--)
 		ice_free_dma_mem(hw, &cq->sq.r.sq_bi[i]);
+	cq->sq.r.sq_bi = NULL;
 	ice_free(hw, cq->sq.dma_head);
+	cq->sq.dma_head = NULL;
 
 	return ICE_ERR_NO_MEMORY;
 }
@@ -279,6 +283,24 @@ ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	return ICE_SUCCESS;
 }
 
+#define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
+do {									\
+	/* free descriptors */						\
+	if ((qi)->ring.r.ring##_bi) {					\
+		int i;							\
+									\
+		for (i = 0; i < (qi)->num_##ring##_entries; i++)	\
+			if ((qi)->ring.r.ring##_bi[i].pa)		\
+				ice_free_dma_mem((hw),			\
+					&(qi)->ring.r.ring##_bi[i]);	\
+	}								\
+	/* free the buffer info list */					\
+	if ((qi)->ring.cmd_buf)						\
+		ice_free(hw, (qi)->ring.cmd_buf);			\
+	/* free DMA head */						\
+	ice_free(hw, (qi)->ring.dma_head);				\
+} while (0)
+
 /**
  * ice_init_sq - main initialization routine for Control ATQ
  * @hw: pointer to the hardware structure
@@ -334,6 +356,7 @@ static enum ice_status ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	goto init_ctrlq_exit;
 
 init_ctrlq_free_rings:
+	ICE_FREE_CQ_BUFS(hw, cq, sq);
 	ice_free_cq_ring(hw, &cq->sq);
 
 init_ctrlq_exit:
@@ -395,27 +418,13 @@ static enum ice_status ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	goto init_ctrlq_exit;
 
 init_ctrlq_free_rings:
+	ICE_FREE_CQ_BUFS(hw, cq, rq);
 	ice_free_cq_ring(hw, &cq->rq);
 
 init_ctrlq_exit:
 	return ret_code;
 }
 
-#define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
-do {									\
-	int i;								\
-	/* free descriptors */						\
-	for (i = 0; i < (qi)->num_##ring##_entries; i++)		\
-		if ((qi)->ring.r.ring##_bi[i].pa)			\
-			ice_free_dma_mem((hw),				\
-					 &(qi)->ring.r.ring##_bi[i]);	\
-	/* free the buffer info list */					\
-	if ((qi)->ring.cmd_buf)						\
-		ice_free(hw, (qi)->ring.cmd_buf);			\
-	/* free DMA head */						\
-	ice_free(hw, (qi)->ring.dma_head);				\
-} while (0)
-
 /**
  * ice_shutdown_sq - shutdown the Control ATQ
  * @hw: pointer to the hardware structure
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 47/53] net/ice/base: fix reference count when update VSI list
       [not found] ` <20200615015342.1191-1-qi.z.zhang@intel.com>
                     ` (2 preceding siblings ...)
  2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 37/53] net/ice/base: fix for memory leak Qi Zhang
@ 2020-06-15  1:53   ` Qi Zhang
  2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 49/53] net/ice/base: fix uninitialized flag for result index bitmap Qi Zhang
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  1:53 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, Qi Zhang, stable, Wei Zhao,
	Paul M . Stillwell Jr

The parameter ref_cnt is used for tracking how many
rules are reusing this VSI list, so it can only be
updated when a rule which using this list be deleted.

Fixes: f89aa3affa9e ("net/ice/base: support removing advanced rule")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@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_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 84102368b..9c7e55ff9 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -7488,6 +7488,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,
 				  tmp_fltr.fwd_id.hw_vsi_id, status);
 			return status;
 		}
+		fm_list->vsi_list_info->ref_cnt--;
 
 		/* Remove the VSI list since it is no longer used */
 		status = ice_remove_vsi_list_rule(hw, vsi_list_id, lkup_type);
@@ -7566,7 +7567,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	if (list_elem->rule_info.sw_act.fltr_act != ICE_FWD_TO_VSI_LIST) {
 		remove_rule = true;
 	} else if (list_elem->vsi_count > 1) {
-		list_elem->vsi_list_info->ref_cnt--;
 		remove_rule = false;
 		vsi_handle = rinfo->sw_act.vsi_handle;
 		status = ice_adv_rem_update_vsi_list(hw, vsi_handle, list_elem);
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 49/53] net/ice/base: fix uninitialized flag for result index bitmap
       [not found] ` <20200615015342.1191-1-qi.z.zhang@intel.com>
                     ` (3 preceding siblings ...)
  2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 47/53] net/ice/base: fix reference count when update VSI list Qi Zhang
@ 2020-06-15  1:53   ` Qi Zhang
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  1:53 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, Qi Zhang, stable, Wei Zhao,
	Paul M . Stillwell Jr

This patch add initialization for prof_res_bm_init flag
to zero in order that the possible resource for field vector
in the package file can be initialized.(in ice_init_prof_result_bm)

Fixes: 453d087ccaff ("net/ice/base: add common functions")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@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_common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 54112e8f2..baaeee321 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -536,6 +536,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 		return ICE_ERR_NO_MEMORY;
 
 	INIT_LIST_HEAD(&sw->vsi_list_map_head);
+	sw->prof_res_bm_init = 0;
 
 	status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
 	if (status) {
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 10/53] net/ice/base: fix variable type for ACL
       [not found] ` <20200615020515.1359-1-qi.z.zhang@intel.com>
@ 2020-06-15  2:04   ` Qi Zhang
  2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 35/53] net/ice/base: fix return value Qi Zhang
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  2:04 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, dev, Qi Zhang, stable, Paul M Stillwell Jr

A u8 idx in ice_acl_add_entry  causes the code to truncate the values
greater than 255 to 255 or less when calling ice_aq_program_acl_entry()
resulting in the wrong TCAM index being programmed for the specified
rule. The result is that the rule action doesn't work correctly
(packets don't get routed to the correct queue or dropped if that
is the action). Fix the issue by changing the variable to be a u16
again.

Fixes: f3202a097f12 ("net/ice/base: add ACL module")
Cc: stable@dpdk.org

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_acl_ctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_acl_ctrl.c b/drivers/net/ice/base/ice_acl_ctrl.c
index e67605141..39b399dd4 100644
--- a/drivers/net/ice/base/ice_acl_ctrl.c
+++ b/drivers/net/ice/base/ice_acl_ctrl.c
@@ -934,9 +934,10 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
 		  enum ice_acl_entry_prior prior, u8 *keys, u8 *inverts,
 		  struct ice_acl_act_entry *acts, u8 acts_cnt, u16 *entry_idx)
 {
-	u8 i, entry_tcam, num_cscd, idx, offset;
+	u8 i, entry_tcam, num_cscd, offset;
 	struct ice_aqc_acl_data buf;
 	enum ice_status status = ICE_SUCCESS;
+	u16 idx;
 
 	if (!scen)
 		return ICE_ERR_DOES_NOT_EXIST;
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 35/53] net/ice/base: fix return value
       [not found] ` <20200615020515.1359-1-qi.z.zhang@intel.com>
  2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 10/53] net/ice/base: fix variable type for ACL Qi Zhang
@ 2020-06-15  2:04   ` Qi Zhang
  2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 37/53] net/ice/base: fix for memory leak Qi Zhang
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  2:04 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, dev, Qi Zhang, stable, Kiran Patil,
	Paul M . Stillwell Jr

Function ice_rem_adv_rule_id return incorrect error code (ICE_ERR_PARAM)
whereas it should have returned ICE_ERR_DOES_NOT_EXIST return code
if filter list is empty or unable to find "rule" in list

Fixes: f89aa3affa9e ("net/ice/base: support removing advanced rule")
Cc: stable@dpdk.org

Signed-off-by: Kiran Patil <kiran.patil@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_switch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 01dcace55..5c53b9ec3 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -7661,7 +7661,8 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,
 						list_itr->lkups_cnt, &rinfo);
 		}
 	}
-	return ICE_ERR_PARAM;
+	/* either list is empty or unable to find rule */
+	return ICE_ERR_DOES_NOT_EXIST;
 }
 
 /**
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 37/53] net/ice/base: fix for memory leak
       [not found] ` <20200615020515.1359-1-qi.z.zhang@intel.com>
  2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 10/53] net/ice/base: fix variable type for ACL Qi Zhang
  2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 35/53] net/ice/base: fix return value Qi Zhang
@ 2020-06-15  2:04   ` Qi Zhang
  2020-06-15  2:05   ` [dpdk-stable] [PATCH v3 47/53] net/ice/base: fix reference count when update VSI list Qi Zhang
  2020-06-15  2:05   ` [dpdk-stable] [PATCH v3 49/53] net/ice/base: fix uninitialized flag for result index bitmap Qi Zhang
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  2:04 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, dev, Qi Zhang, stable, Surabhi Boob,
	Paul M . Stillwell Jr

Handles memory leaks during control queue initialization and
buffer allocation failures. The MACRO - ICE_FREE_CQ_BUFS is modified to
re-use for this fix.

Fixes: 6c1f26be50a2 ("net/ice/base: add control queue information")
Cc: stable@dpdk.org

Signed-off-by: Surabhi Boob <surabhi.boob@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_controlq.c | 39 +++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c
index 3ef86fa03..f278ef636 100644
--- a/drivers/net/ice/base/ice_controlq.c
+++ b/drivers/net/ice/base/ice_controlq.c
@@ -182,7 +182,9 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	i--;
 	for (; i >= 0; i--)
 		ice_free_dma_mem(hw, &cq->rq.r.rq_bi[i]);
+	cq->rq.r.rq_bi = NULL;
 	ice_free(hw, cq->rq.dma_head);
+	cq->rq.dma_head = NULL;
 
 	return ICE_ERR_NO_MEMORY;
 }
@@ -220,7 +222,9 @@ ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	i--;
 	for (; i >= 0; i--)
 		ice_free_dma_mem(hw, &cq->sq.r.sq_bi[i]);
+	cq->sq.r.sq_bi = NULL;
 	ice_free(hw, cq->sq.dma_head);
+	cq->sq.dma_head = NULL;
 
 	return ICE_ERR_NO_MEMORY;
 }
@@ -279,6 +283,24 @@ ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	return ICE_SUCCESS;
 }
 
+#define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
+do {									\
+	/* free descriptors */						\
+	if ((qi)->ring.r.ring##_bi) {					\
+		int i;							\
+									\
+		for (i = 0; i < (qi)->num_##ring##_entries; i++)	\
+			if ((qi)->ring.r.ring##_bi[i].pa)		\
+				ice_free_dma_mem((hw),			\
+					&(qi)->ring.r.ring##_bi[i]);	\
+	}								\
+	/* free the buffer info list */					\
+	if ((qi)->ring.cmd_buf)						\
+		ice_free(hw, (qi)->ring.cmd_buf);			\
+	/* free DMA head */						\
+	ice_free(hw, (qi)->ring.dma_head);				\
+} while (0)
+
 /**
  * ice_init_sq - main initialization routine for Control ATQ
  * @hw: pointer to the hardware structure
@@ -334,6 +356,7 @@ static enum ice_status ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	goto init_ctrlq_exit;
 
 init_ctrlq_free_rings:
+	ICE_FREE_CQ_BUFS(hw, cq, sq);
 	ice_free_cq_ring(hw, &cq->sq);
 
 init_ctrlq_exit:
@@ -395,27 +418,13 @@ static enum ice_status ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	goto init_ctrlq_exit;
 
 init_ctrlq_free_rings:
+	ICE_FREE_CQ_BUFS(hw, cq, rq);
 	ice_free_cq_ring(hw, &cq->rq);
 
 init_ctrlq_exit:
 	return ret_code;
 }
 
-#define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
-do {									\
-	int i;								\
-	/* free descriptors */						\
-	for (i = 0; i < (qi)->num_##ring##_entries; i++)		\
-		if ((qi)->ring.r.ring##_bi[i].pa)			\
-			ice_free_dma_mem((hw),				\
-					 &(qi)->ring.r.ring##_bi[i]);	\
-	/* free the buffer info list */					\
-	if ((qi)->ring.cmd_buf)						\
-		ice_free(hw, (qi)->ring.cmd_buf);			\
-	/* free DMA head */						\
-	ice_free(hw, (qi)->ring.dma_head);				\
-} while (0)
-
 /**
  * ice_shutdown_sq - shutdown the Control ATQ
  * @hw: pointer to the hardware structure
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 47/53] net/ice/base: fix reference count when update VSI list
       [not found] ` <20200615020515.1359-1-qi.z.zhang@intel.com>
                     ` (2 preceding siblings ...)
  2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 37/53] net/ice/base: fix for memory leak Qi Zhang
@ 2020-06-15  2:05   ` Qi Zhang
  2020-06-15  2:05   ` [dpdk-stable] [PATCH v3 49/53] net/ice/base: fix uninitialized flag for result index bitmap Qi Zhang
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  2:05 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, dev, Qi Zhang, stable, Wei Zhao,
	Paul M . Stillwell Jr

The parameter ref_cnt is used for tracking how many
rules are reusing this VSI list, so it can only be
updated when a rule which using this list be deleted.

Fixes: f89aa3affa9e ("net/ice/base: support removing advanced rule")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@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_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 84102368b..9c7e55ff9 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -7488,6 +7488,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,
 				  tmp_fltr.fwd_id.hw_vsi_id, status);
 			return status;
 		}
+		fm_list->vsi_list_info->ref_cnt--;
 
 		/* Remove the VSI list since it is no longer used */
 		status = ice_remove_vsi_list_rule(hw, vsi_list_id, lkup_type);
@@ -7566,7 +7567,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	if (list_elem->rule_info.sw_act.fltr_act != ICE_FWD_TO_VSI_LIST) {
 		remove_rule = true;
 	} else if (list_elem->vsi_count > 1) {
-		list_elem->vsi_list_info->ref_cnt--;
 		remove_rule = false;
 		vsi_handle = rinfo->sw_act.vsi_handle;
 		status = ice_adv_rem_update_vsi_list(hw, vsi_handle, list_elem);
-- 
2.13.6


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

* [dpdk-stable] [PATCH v3 49/53] net/ice/base: fix uninitialized flag for result index bitmap
       [not found] ` <20200615020515.1359-1-qi.z.zhang@intel.com>
                     ` (3 preceding siblings ...)
  2020-06-15  2:05   ` [dpdk-stable] [PATCH v3 47/53] net/ice/base: fix reference count when update VSI list Qi Zhang
@ 2020-06-15  2:05   ` Qi Zhang
  4 siblings, 0 replies; 21+ messages in thread
From: Qi Zhang @ 2020-06-15  2:05 UTC (permalink / raw)
  To: ferruh.yigit
  Cc: xiaolong.ye, qiming.yang, dev, Qi Zhang, stable, Wei Zhao,
	Paul M . Stillwell Jr

This patch add initialization for prof_res_bm_init flag
to zero in order that the possible resource for field vector
in the package file can be initialized.(in ice_init_prof_result_bm)

Fixes: 453d087ccaff ("net/ice/base: add common functions")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@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_common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 54112e8f2..baaeee321 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -536,6 +536,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 		return ICE_ERR_NO_MEMORY;
 
 	INIT_LIST_HEAD(&sw->vsi_list_map_head);
+	sw->prof_res_bm_init = 0;
 
 	status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
 	if (status) {
-- 
2.13.6


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

end of thread, other threads:[~2020-06-15  2:03 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200603024016.30636-1-qi.z.zhang@intel.com>
2020-06-03  2:39 ` [dpdk-stable] [PATCH 10/52] net/ice/base: fix variable type for ACL Qi Zhang
2020-06-03  2:40 ` [dpdk-stable] [PATCH 37/52] net/ice/base: fix for memory leak Qi Zhang
2020-06-03  2:40 ` [dpdk-stable] [PATCH 47/52] net/ice/base: fix reference count when update VSI list Qi Zhang
2020-06-03  2:40 ` [dpdk-stable] [PATCH 49/52] net/ice/base: fix uninitialized flag Qi Zhang
2020-06-08  2:51   ` Yang, Qiming
     [not found] ` <20200609120001.35110-1-qi.z.zhang@intel.com>
2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 10/52] net/ice/base: fix variable type for ACL Qi Zhang
2020-06-11 18:35     ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 37/52] net/ice/base: fix for memory leak Qi Zhang
2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 47/52] net/ice/base: fix reference count when update VSI list Qi Zhang
2020-06-09 11:59   ` [dpdk-stable] [PATCH v2 49/52] net/ice/base: fix uninitialized flag Qi Zhang
2020-06-11 18:45     ` Ferruh Yigit
     [not found] ` <20200615015342.1191-1-qi.z.zhang@intel.com>
2020-06-15  1:52   ` [dpdk-stable] [PATCH v3 10/53] net/ice/base: fix variable type for ACL Qi Zhang
2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 35/53] net/ice/base: fix return value Qi Zhang
2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 37/53] net/ice/base: fix for memory leak Qi Zhang
2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 47/53] net/ice/base: fix reference count when update VSI list Qi Zhang
2020-06-15  1:53   ` [dpdk-stable] [PATCH v3 49/53] net/ice/base: fix uninitialized flag for result index bitmap Qi Zhang
     [not found] ` <20200615020515.1359-1-qi.z.zhang@intel.com>
2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 10/53] net/ice/base: fix variable type for ACL Qi Zhang
2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 35/53] net/ice/base: fix return value Qi Zhang
2020-06-15  2:04   ` [dpdk-stable] [PATCH v3 37/53] net/ice/base: fix for memory leak Qi Zhang
2020-06-15  2:05   ` [dpdk-stable] [PATCH v3 47/53] net/ice/base: fix reference count when update VSI list Qi Zhang
2020-06-15  2:05   ` [dpdk-stable] [PATCH v3 49/53] net/ice/base: fix uninitialized flag for result index bitmap Qi Zhang

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git