[v4,26/30] net/ice/base: use bitmap copy where appropriate
Checks
Commit Message
ice_cp_bitmap() already exists and should be used instead of
using ice_memcpy(). Note, there are a couple comments that sugges
t using a bitmap-specific copy function, but those are not correct
since the source block of memory is not a bitmap.
Signed-off-by: Bruce Allan <bruce.w.allan@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 | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
Comments
> -----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>; Allan, Bruce W <bruce.w.allan@intel.com>; Stillwell
> Jr, Paul M <paul.m.stillwell.jr@intel.com>
> Subject: [PATCH v4 26/30] net/ice/base: use bitmap copy where appropriate
>
> ice_cp_bitmap() already exists and should be used instead of using
> ice_memcpy(). Note, there are a couple comments that sugges t using a
More than one space before 'Note'
Sugges t/suggest?
> bitmap-specific copy function, but those are not correct since the source
> block of memory is not a bitmap.
>
> Signed-off-by: Bruce Allan <bruce.w.allan@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 | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ice/base/ice_switch.c
> b/drivers/net/ice/base/ice_switch.c
> index 7681ba38b..10dfc720a 100644
> --- a/drivers/net/ice/base/ice_switch.c
> +++ b/drivers/net/ice/base/ice_switch.c
> @@ -615,8 +615,7 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct
> ice_sw_recipe *recps, u8 rid,
> goto err_unroll;
>
> /* Copy result indexes */
> - ice_memcpy(recps[rid].res_idxs, result_bm, sizeof(recps[rid].res_idxs),
> - ICE_NONDMA_TO_NONDMA);
> + ice_cp_bitmap(recps[rid].res_idxs, result_bm, ICE_MAX_FV_WORDS);
> recps[rid].recp_created = true;
>
> err_unroll:
> @@ -645,8 +644,8 @@ ice_get_recp_to_prof_map(struct ice_hw *hw)
> ice_zero_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
> if (ice_aq_get_recipe_to_profile(hw, i, (u8 *)r_bitmap, NULL))
> continue;
> - ice_memcpy(profile_to_recipe[i], r_bitmap,
> - sizeof(profile_to_recipe[i]),
> ICE_NONDMA_TO_NONDMA);
> + ice_cp_bitmap(profile_to_recipe[i], r_bitmap,
> + ICE_MAX_NUM_RECIPES);
> for (j = 0; j < ICE_MAX_NUM_RECIPES; j++)
> if (ice_is_bit_set(r_bitmap, j))
> ice_set_bit(i, recipe_to_profile[j]); @@ -
> 5586,8 +5585,8 @@ ice_add_adv_recipe(struct ice_hw *hw, struct
> ice_adv_lkup_elem *lkups,
> goto err_unroll;
>
> /* Update profile to recipe bitmap array */
> - ice_memcpy(profile_to_recipe[fvit->profile_id], r_bitmap,
> - sizeof(r_bitmap), ICE_NONDMA_TO_NONDMA);
> + ice_cp_bitmap(profile_to_recipe[fvit->profile_id], r_bitmap,
> + ICE_MAX_NUM_RECIPES);
>
> /* Update recipe to profile bitmap array */
> for (j = 0; j < ICE_MAX_NUM_RECIPES; j++)
> --
> 2.13.6
@@ -615,8 +615,7 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
goto err_unroll;
/* Copy result indexes */
- ice_memcpy(recps[rid].res_idxs, result_bm, sizeof(recps[rid].res_idxs),
- ICE_NONDMA_TO_NONDMA);
+ ice_cp_bitmap(recps[rid].res_idxs, result_bm, ICE_MAX_FV_WORDS);
recps[rid].recp_created = true;
err_unroll:
@@ -645,8 +644,8 @@ ice_get_recp_to_prof_map(struct ice_hw *hw)
ice_zero_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
if (ice_aq_get_recipe_to_profile(hw, i, (u8 *)r_bitmap, NULL))
continue;
- ice_memcpy(profile_to_recipe[i], r_bitmap,
- sizeof(profile_to_recipe[i]), ICE_NONDMA_TO_NONDMA);
+ ice_cp_bitmap(profile_to_recipe[i], r_bitmap,
+ ICE_MAX_NUM_RECIPES);
for (j = 0; j < ICE_MAX_NUM_RECIPES; j++)
if (ice_is_bit_set(r_bitmap, j))
ice_set_bit(i, recipe_to_profile[j]);
@@ -5586,8 +5585,8 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
goto err_unroll;
/* Update profile to recipe bitmap array */
- ice_memcpy(profile_to_recipe[fvit->profile_id], r_bitmap,
- sizeof(r_bitmap), ICE_NONDMA_TO_NONDMA);
+ ice_cp_bitmap(profile_to_recipe[fvit->profile_id], r_bitmap,
+ ICE_MAX_NUM_RECIPES);
/* Update recipe to profile bitmap array */
for (j = 0; j < ICE_MAX_NUM_RECIPES; j++)