@@ -275,6 +275,9 @@ is required to support multiple instances co-exist. When two DPDK DCF instances
are probed, the later one will take over the DCF capability from the first one.
This is hinted by devargs "cap=mdcf".
+To accelerate the creation of specific flow, a buildin recipe for custom DDP
+package is added. Enable this by running testpmd with devargs 'br=1'.
+
Sample Application Notes
------------------------
@@ -459,6 +459,28 @@ ice_aq_set_mac_cfg(struct ice_hw *hw, u16 max_frame_size, struct ice_sq_cd *cd)
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
}
+static int ice_buildin_recipe_init(struct ice_hw *hw)
+{
+ struct ice_switch_info *sw = hw->switch_info;
+ struct ice_sw_recipe *recipe;
+
+ sw->buildin_recipes = ice_malloc(hw,
+ sizeof(sw->buildin_recipes[0]) * ICE_MAX_NUM_RECIPES);
+
+ if (!sw->buildin_recipes)
+ return ICE_ERR_NO_MEMORY;
+
+ recipe = &sw->buildin_recipes[10];
+ recipe->is_root = 1;
+
+ recipe->lkup_exts.n_val_words = 1;
+ recipe->lkup_exts.field_mask[0] = 0x00ff;
+ recipe->lkup_exts.fv_words[0].off = 8;
+ recipe->lkup_exts.fv_words[0].prot_id = 32;
+
+ return ICE_SUCCESS;
+}
+
/**
* ice_init_fltr_mgmt_struct - initializes filter management list and locks
* @hw: pointer to the HW struct
@@ -477,6 +499,8 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
INIT_LIST_HEAD(&sw->vsi_list_map_head);
+ ice_buildin_recipe_init(hw);
+
return ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
}
@@ -538,6 +562,7 @@ void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
ice_free(hw, recps[i].root_buf);
}
ice_rm_all_sw_replay_rule_info(hw);
+ ice_free(hw, sw->buildin_recipes);
ice_free(hw, sw->recp_list);
ice_free(hw, sw);
}
@@ -5220,6 +5220,48 @@ static const struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
{ ICE_NAT_T, ICE_UDP_ILOS_HW },
};
+
+static u16 buildin_recipe_get(struct ice_switch_info *sw,
+ struct ice_prot_lkup_ext *lkup_exts)
+{
+ int i;
+
+ if (!sw->buildin_recipes)
+ return ICE_MAX_NUM_RECIPES;
+
+ for (i = 10; i < ICE_MAX_NUM_RECIPES; i++) {
+ struct ice_sw_recipe *recp = &sw->buildin_recipes[i];
+ struct ice_fv_word *a = lkup_exts->fv_words;
+ struct ice_fv_word *b = recp->lkup_exts.fv_words;
+ u16 *c = recp->lkup_exts.field_mask;
+ u16 *d = lkup_exts->field_mask;
+ bool found = true;
+ u8 p, q;
+
+ if (!recp->is_root)
+ continue;
+
+ if (recp->lkup_exts.n_val_words != lkup_exts->n_val_words)
+ continue;
+
+ for (p = 0; p < lkup_exts->n_val_words; p++) {
+ for (q = 0; q < recp->lkup_exts.n_val_words; q++) {
+ if (a[p].off == b[q].off &&
+ a[p].prot_id == b[q].prot_id &&
+ d[p] == c[q])
+ break;
+ }
+ if (q >= recp->lkup_exts.n_val_words) {
+ found = false;
+ break;
+ }
+ }
+ if (found)
+ return i;
+ }
+ return ICE_MAX_NUM_RECIPES;
+}
+
/**
* ice_find_recp - find a recipe
* @hw: pointer to the hardware structure
@@ -5232,8 +5274,15 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
{
bool refresh_required = true;
struct ice_sw_recipe *recp;
+ u16 buildin_rid;
u8 i;
+ if (hw->use_buildin_recipe) {
+ buildin_rid = buildin_recipe_get(hw->switch_info, lkup_exts);
+ if (buildin_rid < ICE_MAX_NUM_RECIPES)
+ return buildin_rid;
+ }
+
/* Walk through existing recipes to find a match */
recp = hw->switch_info->recp_list;
for (i = 0; i < ICE_MAX_NUM_RECIPES; i++) {
@@ -7296,8 +7345,10 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,
struct ice_switch_info *sw;
sw = hw->switch_info;
- if (!sw->recp_list[remove_entry->rid].recp_created)
- return ICE_ERR_PARAM;
+
+ if (!sw->buildin_recipes[remove_entry->rid].is_root)
+ if (!sw->recp_list[remove_entry->rid].recp_created)
+ return ICE_ERR_PARAM;
list_head = &sw->recp_list[remove_entry->rid].filt_rules;
LIST_FOR_EACH_ENTRY(list_itr, list_head, ice_adv_fltr_mgmt_list_entry,
list_entry) {
@@ -769,6 +769,7 @@ struct ice_switch_info {
u16 prof_res_bm_init;
ice_declare_bitmap(prof_res_bm[ICE_MAX_NUM_PROFILES], ICE_MAX_FV_WORDS);
+ struct ice_sw_recipe *buildin_recipes;
};
/* Port hardware description */
@@ -914,6 +915,7 @@ struct ice_hw {
ice_declare_bitmap(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);
struct ice_lock rss_locks; /* protect RSS configuration */
struct LIST_HEAD_TYPE rss_list_head;
+ u8 use_buildin_recipe;
};
/* Statistics collected by each port, VSI, VEB, and S-channel */
@@ -897,12 +897,34 @@ ice_dcf_cap_check_handler(__rte_unused const char *key,
return -1;
}
+static int
+parse_bool(const char *key, const char *value, void *args)
+{
+ int *i = (int *)args;
+ char *end;
+ int num;
+
+ num = strtoul(value, &end, 10);
+
+ if (num != 0 && num != 1) {
+ PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
+ "value must be 0 or 1",
+ value, key);
+ return -1;
+ }
+
+ *i = num;
+ return 0;
+}
+
static int
ice_dcf_cap_selected(struct ice_dcf_adapter *adapter,
struct rte_devargs *devargs)
{
+ struct ice_adapter *ad = &adapter->parent;
struct rte_kvargs *kvlist;
- const char *key = "cap";
+ const char *key_cap = "cap";
+ const char *key_br = "br";
int ret = 0;
if (devargs == NULL)
@@ -912,15 +934,21 @@ ice_dcf_cap_selected(struct ice_dcf_adapter *adapter,
if (kvlist == NULL)
return 0;
- if (!rte_kvargs_count(kvlist, key))
+ if (!rte_kvargs_count(kvlist, key_cap))
goto exit;
/* dcf capability selected when there's a key-value pair: cap=dcf */
- if (rte_kvargs_process(kvlist, key,
+ if (rte_kvargs_process(kvlist, key_cap,
ice_dcf_cap_check_handler,
&adapter->real_hw.multi_inst) < 0)
goto exit;
+ /* dcf capability selected when there's a key-value pair: cap=dcf */
+ if (rte_kvargs_process(kvlist, key_br,
+ &parse_bool,
+ &ad->hw.use_buildin_recipe) < 0)
+ goto exit;
+
ret = 1;
exit:
@@ -997,4 +1025,6 @@ static struct rte_pci_driver rte_ice_dcf_pmd = {
RTE_PMD_REGISTER_PCI(net_ice_dcf, rte_ice_dcf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_ice_dcf, pci_id_ice_dcf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_ice_dcf, "* igb_uio | vfio-pci");
-RTE_PMD_REGISTER_PARAM_STRING(net_ice_dcf, "cap=dcf|mdcf");
+RTE_PMD_REGISTER_PARAM_STRING(net_ice_dcf,
+ "cap=dcf|mdcf "
+ "br=<1|0>");