lkup_exts->n_val_words = fv_word_idx;
recps[rid].big_recp = (num_recps > 1);
recps[rid].n_grp_count = (u8)num_recps;
- recps[rid].root_buf = devm_kmemdup(ice_hw_to_dev(hw), tmp,
- recps[rid].n_grp_count * sizeof(*recps[rid].root_buf),
- GFP_KERNEL);
- if (!recps[rid].root_buf) {
- status = -ENOMEM;
- goto err_unroll;
- }
/* Copy result indexes */
bitmap_copy(recps[rid].res_idxs, result_bm, ICE_MAX_FV_WORDS);
continue;
}
- /* Skip inverse action recipes */
- if (recp[i].root_buf && recp[i].root_buf->content.act_ctrl &
- ICE_AQ_RECIPE_ACT_INV_ACT)
- continue;
-
/* if number of words we are looking for match */
if (lkup_exts->n_val_words == recp[i].lkup_exts.n_val_words) {
struct ice_fv_word *ar = recp[i].lkup_exts.fv_words;
ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
unsigned long *profiles)
{
+ struct ice_aqc_recipe_data_elem *buf __free(kfree) = NULL;
DECLARE_BITMAP(result_idx_bm, ICE_MAX_FV_WORDS);
struct ice_aqc_recipe_content *content;
- struct ice_aqc_recipe_data_elem *buf;
struct ice_recp_grp_entry *entry;
u16 free_res_idx;
u8 chain_idx;
if (rm->n_grp_count > ICE_MAX_CHAIN_RECIPE)
return -ENOSPC;
- buf = devm_kcalloc(ice_hw_to_dev(hw), rm->n_grp_count, sizeof(*buf),
- GFP_KERNEL);
- if (!buf) {
- status = -ENOMEM;
- goto err_mem;
- }
+ buf = kcalloc(rm->n_grp_count, sizeof(*buf), GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
bitmap_zero(rm->r_bitmap, ICE_MAX_NUM_RECIPES);
status = ice_alloc_recipe(hw, &entry->rid);
if (status)
- goto err_unroll;
+ return status;
content = &buf[recps].content;
*/
if (chain_idx >= ICE_MAX_FV_WORDS) {
ice_debug(hw, ICE_DBG_SW, "No chain index available\n");
- status = -ENOSPC;
- goto err_unroll;
+ return -ENOSPC;
}
entry->chain_idx = chain_idx;
*/
status = ice_alloc_recipe(hw, &rid);
if (status)
- goto err_unroll;
+ return status;
content = &buf[recps].content;
last_chain_entry = devm_kzalloc(ice_hw_to_dev(hw),
sizeof(*last_chain_entry),
GFP_KERNEL);
- if (!last_chain_entry) {
- status = -ENOMEM;
- goto err_unroll;
- }
+ if (!last_chain_entry)
+ return -ENOMEM;
+
last_chain_entry->rid = rid;
memset(&content->lkup_indx, 0, sizeof(content->lkup_indx));
/* All recipes use look-up index 0 to match switch ID. */
}
status = ice_acquire_change_lock(hw, ICE_RES_WRITE);
if (status)
- goto err_unroll;
+ return status;
status = ice_aq_add_recipe(hw, buf, rm->n_grp_count, NULL);
ice_release_change_lock(hw);
if (status)
- goto err_unroll;
+ return status;
/* Every recipe that just got created add it to the recipe
* book keeping list
idx_found = true;
}
- if (!idx_found) {
- status = -EIO;
- goto err_unroll;
- }
+ if (!idx_found)
+ return -EIO;
recp = &sw->recp_list[entry->rid];
is_root = (rm->root_rid == entry->rid);
recp->allow_pass_l2 = rm->allow_pass_l2;
recp->recp_created = true;
}
- rm->root_buf = buf;
- return status;
-err_unroll:
-err_mem:
- devm_kfree(ice_hw_to_dev(hw), buf);
- return status;
+ return 0;
}
/**
devm_kfree(ice_hw_to_dev(hw), fvit);
}
- devm_kfree(ice_hw_to_dev(hw), rm->root_buf);
kfree(rm);
err_free_lkup_exts: