Skip to content

Commit 1d2ac12

Browse files
Marcin Szycikanguy11
authored andcommitted
ice: Remove unused members from switch API
Remove several members of struct ice_sw_recipe and struct ice_prot_lkup_ext. Remove struct ice_recp_grp_entry and struct ice_pref_recipe_group, since they are now unused as well. All of the deleted members were only written to and never read, so it's pointless to keep them. Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Marcin Szycik <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 2ecdd4b commit 1d2ac12

File tree

4 files changed

+10
-81
lines changed

4 files changed

+10
-81
lines changed

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -961,14 +961,7 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
961961
}
962962
recps = sw->recp_list;
963963
for (i = 0; i < ICE_MAX_NUM_RECIPES; i++) {
964-
struct ice_recp_grp_entry *rg_entry, *tmprg_entry;
965-
966964
recps[i].root_rid = i;
967-
list_for_each_entry_safe(rg_entry, tmprg_entry,
968-
&recps[i].rg_list, l_entry) {
969-
list_del(&rg_entry->l_entry);
970-
devm_kfree(ice_hw_to_dev(hw), rg_entry);
971-
}
972965

973966
if (recps[i].adv_rule) {
974967
struct ice_adv_fltr_mgmt_list_entry *tmp_entry;

drivers/net/ethernet/intel/ice/ice_protocol_type.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -455,28 +455,11 @@ struct ice_prot_ext_tbl_entry {
455455

456456
/* Extractions to be looked up for a given recipe */
457457
struct ice_prot_lkup_ext {
458-
u16 prot_type;
459458
u8 n_val_words;
460459
/* create a buffer to hold max words per recipe */
461460
u16 field_mask[ICE_MAX_CHAIN_WORDS];
462461

463462
struct ice_fv_word fv_words[ICE_MAX_CHAIN_WORDS];
464463
};
465464

466-
struct ice_pref_recipe_group {
467-
u8 n_val_pairs; /* Number of valid pairs */
468-
struct ice_fv_word pairs[ICE_NUM_WORDS_RECIPE];
469-
u16 mask[ICE_NUM_WORDS_RECIPE];
470-
};
471-
472-
struct ice_recp_grp_entry {
473-
struct list_head l_entry;
474-
475-
#define ICE_INVAL_CHAIN_IND 0xFF
476-
u16 rid;
477-
u8 chain_idx;
478-
u16 fv_idx[ICE_NUM_WORDS_RECIPE];
479-
u16 fv_mask[ICE_NUM_WORDS_RECIPE];
480-
struct ice_pref_recipe_group r_group;
481-
};
482465
#endif /* _ICE_PROTOCOL_TYPE_H_ */

drivers/net/ethernet/intel/ice/ice_switch.c

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,6 @@ int ice_init_def_sw_recp(struct ice_hw *hw)
14711471
recps[i].root_rid = i;
14721472
INIT_LIST_HEAD(&recps[i].filt_rules);
14731473
INIT_LIST_HEAD(&recps[i].filt_replay_rules);
1474-
INIT_LIST_HEAD(&recps[i].rg_list);
14751474
mutex_init(&recps[i].filt_rule_lock);
14761475
}
14771476

@@ -2339,18 +2338,10 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
23392338

23402339
for (sub_recps = 0; sub_recps < num_recps; sub_recps++) {
23412340
struct ice_aqc_recipe_data_elem root_bufs = tmp[sub_recps];
2342-
struct ice_recp_grp_entry *rg_entry;
23432341
u8 i, prof, idx, prot = 0;
23442342
bool is_root;
23452343
u16 off = 0;
23462344

2347-
rg_entry = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*rg_entry),
2348-
GFP_KERNEL);
2349-
if (!rg_entry) {
2350-
status = -ENOMEM;
2351-
goto err_unroll;
2352-
}
2353-
23542345
idx = root_bufs.recipe_indx;
23552346
is_root = root_bufs.content.rid & ICE_AQ_RECIPE_ID_IS_ROOT;
23562347

@@ -2364,10 +2355,7 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
23642355
ICE_MAX_NUM_PROFILES);
23652356
for (i = 0; i < ICE_NUM_WORDS_RECIPE; i++) {
23662357
u8 lkup_indx = root_bufs.content.lkup_indx[i];
2367-
2368-
rg_entry->fv_idx[i] = lkup_indx;
2369-
rg_entry->fv_mask[i] =
2370-
le16_to_cpu(root_bufs.content.mask[i]);
2358+
u16 lkup_mask = le16_to_cpu(root_bufs.content.mask[i]);
23712359

23722360
/* If the recipe is a chained recipe then all its
23732361
* child recipe's result will have a result index.
@@ -2378,38 +2366,30 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
23782366
* has ICE_AQ_RECIPE_LKUP_IGNORE or 0 since it isn't a
23792367
* valid offset value.
23802368
*/
2381-
if (test_bit(rg_entry->fv_idx[i], hw->switch_info->prof_res_bm[prof]) ||
2382-
rg_entry->fv_idx[i] & ICE_AQ_RECIPE_LKUP_IGNORE ||
2383-
rg_entry->fv_idx[i] == 0)
2369+
if (!lkup_indx ||
2370+
(lkup_indx & ICE_AQ_RECIPE_LKUP_IGNORE) ||
2371+
test_bit(lkup_indx,
2372+
hw->switch_info->prof_res_bm[prof]))
23842373
continue;
23852374

2386-
ice_find_prot_off(hw, ICE_BLK_SW, prof,
2387-
rg_entry->fv_idx[i], &prot, &off);
2375+
ice_find_prot_off(hw, ICE_BLK_SW, prof, lkup_indx,
2376+
&prot, &off);
23882377
lkup_exts->fv_words[fv_word_idx].prot_id = prot;
23892378
lkup_exts->fv_words[fv_word_idx].off = off;
2390-
lkup_exts->field_mask[fv_word_idx] =
2391-
rg_entry->fv_mask[i];
2379+
lkup_exts->field_mask[fv_word_idx] = lkup_mask;
23922380
fv_word_idx++;
23932381
}
2394-
/* populate rg_list with the data from the child entry of this
2395-
* recipe
2396-
*/
2397-
list_add(&rg_entry->l_entry, &recps[rid].rg_list);
23982382

23992383
/* Propagate some data to the recipe database */
2400-
recps[idx].is_root = !!is_root;
24012384
recps[idx].priority = root_bufs.content.act_ctrl_fwd_priority;
24022385
recps[idx].need_pass_l2 = root_bufs.content.act_ctrl &
24032386
ICE_AQ_RECIPE_ACT_NEED_PASS_L2;
24042387
recps[idx].allow_pass_l2 = root_bufs.content.act_ctrl &
24052388
ICE_AQ_RECIPE_ACT_ALLOW_PASS_L2;
24062389
bitmap_zero(recps[idx].res_idxs, ICE_MAX_FV_WORDS);
24072390
if (root_bufs.content.result_indx & ICE_AQ_RECIPE_RESULT_EN) {
2408-
recps[idx].chain_idx = root_bufs.content.result_indx &
2409-
~ICE_AQ_RECIPE_RESULT_EN;
2410-
set_bit(recps[idx].chain_idx, recps[idx].res_idxs);
2411-
} else {
2412-
recps[idx].chain_idx = ICE_INVAL_CHAIN_IND;
2391+
set_bit(root_bufs.content.result_indx &
2392+
~ICE_AQ_RECIPE_RESULT_EN, recps[idx].res_idxs);
24132393
}
24142394

24152395
if (!is_root) {
@@ -2429,8 +2409,6 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
24292409

24302410
/* Complete initialization of the root recipe entry */
24312411
lkup_exts->n_val_words = fv_word_idx;
2432-
recps[rid].big_recp = (num_recps > 1);
2433-
recps[rid].n_grp_count = (u8)num_recps;
24342412

24352413
/* Copy result indexes */
24362414
bitmap_copy(recps[rid].res_idxs, result_bm, ICE_MAX_FV_WORDS);
@@ -5157,7 +5135,6 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
51575135
return status;
51585136

51595137
recipe = &hw->switch_info->recp_list[rid];
5160-
recipe->is_root = true;
51615138
root = &buf[recp_cnt - 1];
51625139
fill_recipe_template(root, rid, rm);
51635140

@@ -5317,9 +5294,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
53175294
DECLARE_BITMAP(fv_bitmap, ICE_MAX_NUM_PROFILES);
53185295
DECLARE_BITMAP(profiles, ICE_MAX_NUM_PROFILES);
53195296
struct ice_prot_lkup_ext *lkup_exts;
5320-
struct ice_recp_grp_entry *r_entry;
53215297
struct ice_sw_fv_list_entry *fvit;
5322-
struct ice_recp_grp_entry *r_tmp;
53235298
struct ice_sw_fv_list_entry *tmp;
53245299
struct ice_sw_recipe *rm;
53255300
int status = 0;
@@ -5361,7 +5336,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
53615336
* headers being programmed.
53625337
*/
53635338
INIT_LIST_HEAD(&rm->fv_list);
5364-
INIT_LIST_HEAD(&rm->rg_list);
53655339

53665340
/* Get bitmap of field vectors (profiles) that are compatible with the
53675341
* rule request; only these will be searched in the subsequent call to
@@ -5465,11 +5439,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
54655439
}
54665440

54675441
err_unroll:
5468-
list_for_each_entry_safe(r_entry, r_tmp, &rm->rg_list, l_entry) {
5469-
list_del(&r_entry->l_entry);
5470-
devm_kfree(ice_hw_to_dev(hw), r_entry);
5471-
}
5472-
54735442
list_for_each_entry_safe(fvit, tmp, &rm->fv_list, list_entry) {
54745443
list_del(&fvit->list_entry);
54755444
devm_kfree(ice_hw_to_dev(hw), fvit);

drivers/net/ethernet/intel/ice/ice_switch.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ struct ice_sw_recipe {
216216
/* For a chained recipe the root recipe is what should be used for
217217
* programming rules
218218
*/
219-
u8 is_root;
220219
u8 root_rid;
221220
u8 recp_created;
222221

@@ -230,19 +229,6 @@ struct ice_sw_recipe {
230229
u8 fv_idx[ICE_MAX_CHAIN_WORDS];
231230
u16 fv_mask[ICE_MAX_CHAIN_WORDS];
232231

233-
/* if this recipe is a collection of other recipe */
234-
u8 big_recp;
235-
236-
/* if this recipe is part of another bigger recipe then chain index
237-
* corresponding to this recipe
238-
*/
239-
u8 chain_idx;
240-
241-
/* if this recipe is a collection of other recipe then count of other
242-
* recipes and recipe IDs of those recipes
243-
*/
244-
u8 n_grp_count;
245-
246232
/* Bit map specifying the IDs associated with this group of recipe */
247233
DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES);
248234

@@ -274,8 +260,6 @@ struct ice_sw_recipe {
274260
u8 need_pass_l2:1;
275261
u8 allow_pass_l2:1;
276262

277-
struct list_head rg_list;
278-
279263
/* This struct saves the fv_words for a given lookup */
280264
struct ice_prot_lkup_ext lkup_exts;
281265
};

0 commit comments

Comments
 (0)