DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice/base: remove unnecessary code
@ 2020-04-07  0:25 Qi Zhang
  2020-04-08  7:02 ` Ye Xiaolong
  0 siblings, 1 reply; 6+ messages in thread
From: Qi Zhang @ 2020-04-07  0:25 UTC (permalink / raw)
  To: qiming.yang; +Cc: xiaolong.ye, dev, Qi Zhang, stable

Update a switch rule' action from "to VSI" to "to VSI List"
should only happen when the same rule has been programmed with
a different fwd destination. This is already handled by below
code block:

m_entry = ice_find_adv_rule_entry(...)
if (m_entry) {
	...
	ice_adv_add_update_vsi_list(...)
}

The following ice_update_pkt_fwd_rule is unnecessary and should be
removed due to:
1) If a switch rule's action is still to VSI, which means, it is
   the first time be issued,  we don't need to update it "to VSI
   List."
2) Actually the implementation does not match the comment, it still
   update the rule with "to VSI" action.

Fixes: fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index b5aa5abd9..07f8efd65 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -6695,24 +6695,8 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	sw->recp_list[rid].adv_rule = true;
 	rule_head = &sw->recp_list[rid].filt_rules;
 
-	if (rinfo->sw_act.fltr_act == ICE_FWD_TO_VSI) {
-		struct ice_fltr_info tmp_fltr;
-
-		ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM);
-		tmp_fltr.fltr_rule_id =
-			LE16_TO_CPU(s_rule->pdata.lkup_tx_rx.index);
-		tmp_fltr.fltr_act = ICE_FWD_TO_VSI;
-		tmp_fltr.fwd_id.hw_vsi_id =
-			ice_get_hw_vsi_num(hw, vsi_handle);
-		tmp_fltr.vsi_handle = vsi_handle;
-		/* Update the previous switch rule of "forward to VSI" to
-		 * "fwd to VSI list"
-		 */
-		status = ice_update_pkt_fwd_rule(hw, &tmp_fltr);
-		if (status)
-			goto err_ice_add_adv_rule;
+	if (rinfo->sw_act.fltr_act == ICE_FWD_TO_VSI)
 		adv_fltr->vsi_count = 1;
-	}
 
 	/* Add rule entry to book keeping list */
 	LIST_ADD(&adv_fltr->list_entry, rule_head);
-- 
2.13.6


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

* Re: [dpdk-dev] [PATCH] net/ice/base: remove unnecessary code
  2020-04-07  0:25 [dpdk-dev] [PATCH] net/ice/base: remove unnecessary code Qi Zhang
@ 2020-04-08  7:02 ` Ye Xiaolong
  0 siblings, 0 replies; 6+ messages in thread
From: Ye Xiaolong @ 2020-04-08  7:02 UTC (permalink / raw)
  To: Qi Zhang; +Cc: qiming.yang, dev, stable

On 04/07, Qi Zhang wrote:
>Update a switch rule' action from "to VSI" to "to VSI List"
>should only happen when the same rule has been programmed with
>a different fwd destination. This is already handled by below
>code block:
>
>m_entry = ice_find_adv_rule_entry(...)
>if (m_entry) {
>	...
>	ice_adv_add_update_vsi_list(...)
>}
>
>The following ice_update_pkt_fwd_rule is unnecessary and should be
>removed due to:
>1) If a switch rule's action is still to VSI, which means, it is
>   the first time be issued,  we don't need to update it "to VSI
>   List."
>2) Actually the implementation does not match the comment, it still
>   update the rule with "to VSI" action.
>
>Fixes: fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe")
>Cc: stable@dpdk.org
>
>Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
>---
> drivers/net/ice/base/ice_switch.c | 18 +-----------------
> 1 file changed, 1 insertion(+), 17 deletions(-)
>
>diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
>index b5aa5abd9..07f8efd65 100644
>--- a/drivers/net/ice/base/ice_switch.c
>+++ b/drivers/net/ice/base/ice_switch.c
>@@ -6695,24 +6695,8 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
> 	sw->recp_list[rid].adv_rule = true;
> 	rule_head = &sw->recp_list[rid].filt_rules;
> 
>-	if (rinfo->sw_act.fltr_act == ICE_FWD_TO_VSI) {
>-		struct ice_fltr_info tmp_fltr;
>-
>-		ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM);
>-		tmp_fltr.fltr_rule_id =
>-			LE16_TO_CPU(s_rule->pdata.lkup_tx_rx.index);
>-		tmp_fltr.fltr_act = ICE_FWD_TO_VSI;
>-		tmp_fltr.fwd_id.hw_vsi_id =
>-			ice_get_hw_vsi_num(hw, vsi_handle);
>-		tmp_fltr.vsi_handle = vsi_handle;
>-		/* Update the previous switch rule of "forward to VSI" to
>-		 * "fwd to VSI list"
>-		 */
>-		status = ice_update_pkt_fwd_rule(hw, &tmp_fltr);
>-		if (status)
>-			goto err_ice_add_adv_rule;
>+	if (rinfo->sw_act.fltr_act == ICE_FWD_TO_VSI)
> 		adv_fltr->vsi_count = 1;
>-	}
> 
> 	/* Add rule entry to book keeping list */
> 	LIST_ADD(&adv_fltr->list_entry, rule_head);
>-- 
>2.13.6
>

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

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

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

* Re: [dpdk-dev] [PATCH] net/ice/base: remove unnecessary code
  2021-05-10  5:02 ` Yang, Qiming
@ 2021-05-10  5:44   ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2021-05-10  5:44 UTC (permalink / raw)
  To: Yang, Qiming; +Cc: dev



> -----Original Message-----
> From: Yang, Qiming <qiming.yang@intel.com>
> Sent: Monday, May 10, 2021 1:02 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] net/ice/base: remove unnecessary code
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Monday, May 10, 2021 11:23
> > To: Yang, Qiming <qiming.yang@intel.com>
> > Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Subject: [PATCH] net/ice/base: remove unnecessary code
> >
> > Coverty issue: 370613
> > Execution cannot reach this statement: "break;".
> > Remove the unnecessary if branch.
> >
> > Fixes: 2913bc4155d2 ("net/ice/base: sign external device package
> > programming")
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> >  drivers/net/ice/base/ice_common.c | 3 ---
> >  1 file changed, 3 deletions(-)
> >
> > diff --git a/drivers/net/ice/base/ice_common.c
> > b/drivers/net/ice/base/ice_common.c
> > index ac412a1aa7..cf0a7d4e7f 100644
> > --- a/drivers/net/ice/base/ice_common.c
> > +++ b/drivers/net/ice/base/ice_common.c
> > @@ -2009,9 +2009,6 @@ ice_parse_common_caps(struct ice_hw *hw,
> struct
> > ice_hw_common_caps *caps,
> >  	{
> >  		u8 index = cap - ICE_AQC_CAPS_EXT_TOPO_DEV_IMG0;
> >
> > -		if (index >= ICE_EXT_TOPO_DEV_IMG_COUNT)
> > -			break;
> > -
> >  		caps->ext_topo_dev_img_ver_high[index] = number;
> >  		caps->ext_topo_dev_img_ver_low[index] = logical_id;
> >  		caps->ext_topo_dev_img_part_num[index] =
> > --
> > 2.26.2
> 
> Acked-by: Qiming Yang <qiming.yang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


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

* Re: [dpdk-dev] [PATCH] net/ice/base: remove unnecessary code
  2021-05-10  3:23 Qi Zhang
@ 2021-05-10  5:02 ` Yang, Qiming
  2021-05-10  5:44   ` Zhang, Qi Z
  0 siblings, 1 reply; 6+ messages in thread
From: Yang, Qiming @ 2021-05-10  5:02 UTC (permalink / raw)
  To: Zhang, Qi Z; +Cc: dev


> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Monday, May 10, 2021 11:23
> To: Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] net/ice/base: remove unnecessary code
> 
> Coverty issue: 370613
> Execution cannot reach this statement: "break;".
> Remove the unnecessary if branch.
> 
> Fixes: 2913bc4155d2 ("net/ice/base: sign external device package
> programming")
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>  drivers/net/ice/base/ice_common.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/net/ice/base/ice_common.c
> b/drivers/net/ice/base/ice_common.c
> index ac412a1aa7..cf0a7d4e7f 100644
> --- a/drivers/net/ice/base/ice_common.c
> +++ b/drivers/net/ice/base/ice_common.c
> @@ -2009,9 +2009,6 @@ ice_parse_common_caps(struct ice_hw *hw, struct
> ice_hw_common_caps *caps,
>  	{
>  		u8 index = cap - ICE_AQC_CAPS_EXT_TOPO_DEV_IMG0;
> 
> -		if (index >= ICE_EXT_TOPO_DEV_IMG_COUNT)
> -			break;
> -
>  		caps->ext_topo_dev_img_ver_high[index] = number;
>  		caps->ext_topo_dev_img_ver_low[index] = logical_id;
>  		caps->ext_topo_dev_img_part_num[index] =
> --
> 2.26.2

Acked-by: Qiming Yang <qiming.yang@intel.com>

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

* [dpdk-dev] [PATCH] net/ice/base: remove unnecessary code
@ 2021-05-10  3:23 Qi Zhang
  2021-05-10  5:02 ` Yang, Qiming
  0 siblings, 1 reply; 6+ messages in thread
From: Qi Zhang @ 2021-05-10  3:23 UTC (permalink / raw)
  To: qiming.yang; +Cc: dev, Qi Zhang

Coverty issue: 370613
Execution cannot reach this statement: "break;".
Remove the unnecessary if branch.

Fixes: 2913bc4155d2 ("net/ice/base: sign external device package programming")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_common.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index ac412a1aa7..cf0a7d4e7f 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -2009,9 +2009,6 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,
 	{
 		u8 index = cap - ICE_AQC_CAPS_EXT_TOPO_DEV_IMG0;
 
-		if (index >= ICE_EXT_TOPO_DEV_IMG_COUNT)
-			break;
-
 		caps->ext_topo_dev_img_ver_high[index] = number;
 		caps->ext_topo_dev_img_ver_low[index] = logical_id;
 		caps->ext_topo_dev_img_part_num[index] =
-- 
2.26.2


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

* [dpdk-dev] [PATCH] net/ice/base: remove unnecessary code
@ 2021-05-10  3:21 Qi Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Qi Zhang @ 2021-05-10  3:21 UTC (permalink / raw)
  To: qiming.yang; +Cc: dev, Qi Zhang

Convery issue: 370613
Execution cannot reach this statement: "break;".
Remove the unnecessary if branch.

Fixes: 2913bc4155d2 ("net/ice/base: sign external device package programming")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_common.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index ac412a1aa7..cf0a7d4e7f 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -2009,9 +2009,6 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,
 	{
 		u8 index = cap - ICE_AQC_CAPS_EXT_TOPO_DEV_IMG0;
 
-		if (index >= ICE_EXT_TOPO_DEV_IMG_COUNT)
-			break;
-
 		caps->ext_topo_dev_img_ver_high[index] = number;
 		caps->ext_topo_dev_img_ver_low[index] = logical_id;
 		caps->ext_topo_dev_img_part_num[index] =
-- 
2.26.2


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

end of thread, other threads:[~2021-05-10  5:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07  0:25 [dpdk-dev] [PATCH] net/ice/base: remove unnecessary code Qi Zhang
2020-04-08  7:02 ` Ye Xiaolong
2021-05-10  3:21 Qi Zhang
2021-05-10  3:23 Qi Zhang
2021-05-10  5:02 ` Yang, Qiming
2021-05-10  5:44   ` 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).