Skip to content

Commit 861f34e

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== ice: Switch API optimizations Marcin Szycik says: Optimize the process of creating a recipe in the switch block by removing duplicate switch ID words and changing how result indexes are fitted into recipes. In many cases this can decrease the number of recipes required to add a certain set of rules, potentially allowing a more varied set of rules to be created. Total rule count will also increase, since less words will be left unused/wasted. There are only 64 rules available in total, so every one counts. After this modification, many fields and some structs became unused or were simplified, resulting in overall simpler implementation. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue: ice: Add tracepoint for adding and removing switch rules ice: Remove unused members from switch API ice: Optimize switch recipe creation ice: remove unused recipe bookkeeping data ice: Simplify bitmap setting in adding recipe ice: Remove reading all recipes before adding a new one ice: Remove unused struct ice_prot_lkup_ext members ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 852e42c + e10989e commit 861f34e

File tree

6 files changed

+272
-496
lines changed

6 files changed

+272
-496
lines changed

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,9 @@ static int ice_init_fltr_mgmt_struct(struct ice_hw *hw)
934934
INIT_LIST_HEAD(&sw->vsi_list_map_head);
935935
sw->prof_res_bm_init = 0;
936936

937+
/* Initialize recipe count with default recipes read from NVM */
938+
sw->recp_cnt = ICE_SW_LKUP_LAST;
939+
937940
status = ice_init_def_sw_recp(hw);
938941
if (status) {
939942
devm_kfree(ice_hw_to_dev(hw), hw->switch_info);
@@ -961,14 +964,7 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
961964
}
962965
recps = sw->recp_list;
963966
for (i = 0; i < ICE_MAX_NUM_RECIPES; i++) {
964-
struct ice_recp_grp_entry *rg_entry, *tmprg_entry;
965-
966967
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-
}
972968

973969
if (recps[i].adv_rule) {
974970
struct ice_adv_fltr_mgmt_list_entry *tmp_entry;
@@ -993,7 +989,6 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
993989
devm_kfree(ice_hw_to_dev(hw), lst_itr);
994990
}
995991
}
996-
devm_kfree(ice_hw_to_dev(hw), recps[i].root_buf);
997992
}
998993
ice_rm_all_sw_replay_rule_info(hw);
999994
devm_kfree(ice_hw_to_dev(hw), sw->recp_list);

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

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,24 @@
77

88
/* Each recipe can match up to 5 different fields. Fields to match can be meta-
99
* data, values extracted from packet headers, or results from other recipes.
10-
* One of the 5 fields is reserved for matching the switch ID. So, up to 4
11-
* recipes can provide intermediate results to another one through chaining,
12-
* e.g. recipes 0, 1, 2, and 3 can provide intermediate results to recipe 4.
10+
* Therefore, up to 5 recipes can provide intermediate results to another one
11+
* through chaining, e.g. recipes 0, 1, 2, 3 and 4 can provide intermediate
12+
* results to recipe 5. Note that one of the fields in one of the recipes must
13+
* always be reserved for matching the switch ID.
1314
*/
14-
#define ICE_NUM_WORDS_RECIPE 4
15+
#define ICE_NUM_WORDS_RECIPE 5
1516

16-
/* Max recipes that can be chained */
17+
/* Max recipes that can be chained, not including the last one, which combines
18+
* intermediate results.
19+
*/
1720
#define ICE_MAX_CHAIN_RECIPE 5
1821

19-
/* 1 word reserved for switch ID from allowed 5 words.
20-
* So a recipe can have max 4 words. And you can chain 5 such recipes
21-
* together. So maximum words that can be programmed for look up is 5 * 4.
22+
/* Total max recipes in chain recipe (including intermediate results) */
23+
#define ICE_MAX_CHAIN_RECIPE_RES (ICE_MAX_CHAIN_RECIPE + 1)
24+
25+
/* A recipe can have max 5 words, and 5 recipes can be chained together (using
26+
* the 6th one, which would contain only result indexes). So maximum words that
27+
* can be programmed for lookup is 5 * 5 (not including intermediate results).
2228
*/
2329
#define ICE_MAX_CHAIN_WORDS (ICE_NUM_WORDS_RECIPE * ICE_MAX_CHAIN_RECIPE)
2430

@@ -449,32 +455,11 @@ struct ice_prot_ext_tbl_entry {
449455

450456
/* Extractions to be looked up for a given recipe */
451457
struct ice_prot_lkup_ext {
452-
u16 prot_type;
453458
u8 n_val_words;
454459
/* create a buffer to hold max words per recipe */
455-
u16 field_off[ICE_MAX_CHAIN_WORDS];
456460
u16 field_mask[ICE_MAX_CHAIN_WORDS];
457461

458462
struct ice_fv_word fv_words[ICE_MAX_CHAIN_WORDS];
459-
460-
/* Indicate field offsets that have field vector indices assigned */
461-
DECLARE_BITMAP(done, ICE_MAX_CHAIN_WORDS);
462463
};
463464

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

0 commit comments

Comments
 (0)