Skip to content

Commit

Permalink
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/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/20240711181312.2019606-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jul 14, 2024
2 parents 852e42c + e10989e commit 861f34e
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 496 deletions.
11 changes: 3 additions & 8 deletions drivers/net/ethernet/intel/ice/ice_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,9 @@ static int ice_init_fltr_mgmt_struct(struct ice_hw *hw)
INIT_LIST_HEAD(&sw->vsi_list_map_head);
sw->prof_res_bm_init = 0;

/* Initialize recipe count with default recipes read from NVM */
sw->recp_cnt = ICE_SW_LKUP_LAST;

status = ice_init_def_sw_recp(hw);
if (status) {
devm_kfree(ice_hw_to_dev(hw), hw->switch_info);
Expand Down Expand Up @@ -961,14 +964,7 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
}
recps = sw->recp_list;
for (i = 0; i < ICE_MAX_NUM_RECIPES; i++) {
struct ice_recp_grp_entry *rg_entry, *tmprg_entry;

recps[i].root_rid = i;
list_for_each_entry_safe(rg_entry, tmprg_entry,
&recps[i].rg_list, l_entry) {
list_del(&rg_entry->l_entry);
devm_kfree(ice_hw_to_dev(hw), rg_entry);
}

if (recps[i].adv_rule) {
struct ice_adv_fltr_mgmt_list_entry *tmp_entry;
Expand All @@ -993,7 +989,6 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
devm_kfree(ice_hw_to_dev(hw), lst_itr);
}
}
devm_kfree(ice_hw_to_dev(hw), recps[i].root_buf);
}
ice_rm_all_sw_replay_rule_info(hw);
devm_kfree(ice_hw_to_dev(hw), sw->recp_list);
Expand Down
43 changes: 14 additions & 29 deletions drivers/net/ethernet/intel/ice/ice_protocol_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@

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

/* Max recipes that can be chained */
/* Max recipes that can be chained, not including the last one, which combines
* intermediate results.
*/
#define ICE_MAX_CHAIN_RECIPE 5

/* 1 word reserved for switch ID from allowed 5 words.
* So a recipe can have max 4 words. And you can chain 5 such recipes
* together. So maximum words that can be programmed for look up is 5 * 4.
/* Total max recipes in chain recipe (including intermediate results) */
#define ICE_MAX_CHAIN_RECIPE_RES (ICE_MAX_CHAIN_RECIPE + 1)

/* A recipe can have max 5 words, and 5 recipes can be chained together (using
* the 6th one, which would contain only result indexes). So maximum words that
* can be programmed for lookup is 5 * 5 (not including intermediate results).
*/
#define ICE_MAX_CHAIN_WORDS (ICE_NUM_WORDS_RECIPE * ICE_MAX_CHAIN_RECIPE)

Expand Down Expand Up @@ -449,32 +455,11 @@ struct ice_prot_ext_tbl_entry {

/* Extractions to be looked up for a given recipe */
struct ice_prot_lkup_ext {
u16 prot_type;
u8 n_val_words;
/* create a buffer to hold max words per recipe */
u16 field_off[ICE_MAX_CHAIN_WORDS];
u16 field_mask[ICE_MAX_CHAIN_WORDS];

struct ice_fv_word fv_words[ICE_MAX_CHAIN_WORDS];

/* Indicate field offsets that have field vector indices assigned */
DECLARE_BITMAP(done, ICE_MAX_CHAIN_WORDS);
};

struct ice_pref_recipe_group {
u8 n_val_pairs; /* Number of valid pairs */
struct ice_fv_word pairs[ICE_NUM_WORDS_RECIPE];
u16 mask[ICE_NUM_WORDS_RECIPE];
};

struct ice_recp_grp_entry {
struct list_head l_entry;

#define ICE_INVAL_CHAIN_IND 0xFF
u16 rid;
u8 chain_idx;
u16 fv_idx[ICE_NUM_WORDS_RECIPE];
u16 fv_mask[ICE_NUM_WORDS_RECIPE];
struct ice_pref_recipe_group r_group;
};
#endif /* _ICE_PROTOCOL_TYPE_H_ */
Loading

0 comments on commit 861f34e

Please sign in to comment.