@@ -2445,13 +2445,6 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
2445
2445
lkup_exts -> n_val_words = fv_word_idx ;
2446
2446
recps [rid ].big_recp = (num_recps > 1 );
2447
2447
recps [rid ].n_grp_count = (u8 )num_recps ;
2448
- recps [rid ].root_buf = devm_kmemdup (ice_hw_to_dev (hw ), tmp ,
2449
- recps [rid ].n_grp_count * sizeof (* recps [rid ].root_buf ),
2450
- GFP_KERNEL );
2451
- if (!recps [rid ].root_buf ) {
2452
- status = - ENOMEM ;
2453
- goto err_unroll ;
2454
- }
2455
2448
2456
2449
/* Copy result indexes */
2457
2450
bitmap_copy (recps [rid ].res_idxs , result_bm , ICE_MAX_FV_WORDS );
@@ -4768,11 +4761,6 @@ ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
4768
4761
continue ;
4769
4762
}
4770
4763
4771
- /* Skip inverse action recipes */
4772
- if (recp [i ].root_buf && recp [i ].root_buf -> content .act_ctrl &
4773
- ICE_AQ_RECIPE_ACT_INV_ACT )
4774
- continue ;
4775
-
4776
4764
/* if number of words we are looking for match */
4777
4765
if (lkup_exts -> n_val_words == recp [i ].lkup_exts .n_val_words ) {
4778
4766
struct ice_fv_word * ar = recp [i ].lkup_exts .fv_words ;
@@ -5081,9 +5069,9 @@ static int
5081
5069
ice_add_sw_recipe (struct ice_hw * hw , struct ice_sw_recipe * rm ,
5082
5070
unsigned long * profiles )
5083
5071
{
5072
+ struct ice_aqc_recipe_data_elem * buf __free (kfree ) = NULL ;
5084
5073
DECLARE_BITMAP (result_idx_bm , ICE_MAX_FV_WORDS );
5085
5074
struct ice_aqc_recipe_content * content ;
5086
- struct ice_aqc_recipe_data_elem * buf ;
5087
5075
struct ice_recp_grp_entry * entry ;
5088
5076
u16 free_res_idx ;
5089
5077
u8 chain_idx ;
@@ -5112,12 +5100,9 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
5112
5100
if (rm -> n_grp_count > ICE_MAX_CHAIN_RECIPE )
5113
5101
return - ENOSPC ;
5114
5102
5115
- buf = devm_kcalloc (ice_hw_to_dev (hw ), rm -> n_grp_count , sizeof (* buf ),
5116
- GFP_KERNEL );
5117
- if (!buf ) {
5118
- status = - ENOMEM ;
5119
- goto err_mem ;
5120
- }
5103
+ buf = kcalloc (rm -> n_grp_count , sizeof (* buf ), GFP_KERNEL );
5104
+ if (!buf )
5105
+ return - ENOMEM ;
5121
5106
5122
5107
bitmap_zero (rm -> r_bitmap , ICE_MAX_NUM_RECIPES );
5123
5108
@@ -5130,7 +5115,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
5130
5115
5131
5116
status = ice_alloc_recipe (hw , & entry -> rid );
5132
5117
if (status )
5133
- goto err_unroll ;
5118
+ return status ;
5134
5119
5135
5120
content = & buf [recps ].content ;
5136
5121
@@ -5160,8 +5145,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
5160
5145
*/
5161
5146
if (chain_idx >= ICE_MAX_FV_WORDS ) {
5162
5147
ice_debug (hw , ICE_DBG_SW , "No chain index available\n" );
5163
- status = - ENOSPC ;
5164
- goto err_unroll ;
5148
+ return - ENOSPC ;
5165
5149
}
5166
5150
5167
5151
entry -> chain_idx = chain_idx ;
@@ -5215,7 +5199,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
5215
5199
*/
5216
5200
status = ice_alloc_recipe (hw , & rid );
5217
5201
if (status )
5218
- goto err_unroll ;
5202
+ return status ;
5219
5203
5220
5204
content = & buf [recps ].content ;
5221
5205
@@ -5228,10 +5212,9 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
5228
5212
last_chain_entry = devm_kzalloc (ice_hw_to_dev (hw ),
5229
5213
sizeof (* last_chain_entry ),
5230
5214
GFP_KERNEL );
5231
- if (!last_chain_entry ) {
5232
- status = - ENOMEM ;
5233
- goto err_unroll ;
5234
- }
5215
+ if (!last_chain_entry )
5216
+ return - ENOMEM ;
5217
+
5235
5218
last_chain_entry -> rid = rid ;
5236
5219
memset (& content -> lkup_indx , 0 , sizeof (content -> lkup_indx ));
5237
5220
/* All recipes use look-up index 0 to match switch ID. */
@@ -5265,12 +5248,12 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
5265
5248
}
5266
5249
status = ice_acquire_change_lock (hw , ICE_RES_WRITE );
5267
5250
if (status )
5268
- goto err_unroll ;
5251
+ return status ;
5269
5252
5270
5253
status = ice_aq_add_recipe (hw , buf , rm -> n_grp_count , NULL );
5271
5254
ice_release_change_lock (hw );
5272
5255
if (status )
5273
- goto err_unroll ;
5256
+ return status ;
5274
5257
5275
5258
/* Every recipe that just got created add it to the recipe
5276
5259
* book keeping list
@@ -5288,10 +5271,8 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
5288
5271
idx_found = true;
5289
5272
}
5290
5273
5291
- if (!idx_found ) {
5292
- status = - EIO ;
5293
- goto err_unroll ;
5294
- }
5274
+ if (!idx_found )
5275
+ return - EIO ;
5295
5276
5296
5277
recp = & sw -> recp_list [entry -> rid ];
5297
5278
is_root = (rm -> root_rid == entry -> rid );
@@ -5327,13 +5308,8 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
5327
5308
recp -> allow_pass_l2 = rm -> allow_pass_l2 ;
5328
5309
recp -> recp_created = true;
5329
5310
}
5330
- rm -> root_buf = buf ;
5331
- return status ;
5332
5311
5333
- err_unroll :
5334
- err_mem :
5335
- devm_kfree (ice_hw_to_dev (hw ), buf );
5336
- return status ;
5312
+ return 0 ;
5337
5313
}
5338
5314
5339
5315
/**
@@ -5632,7 +5608,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
5632
5608
devm_kfree (ice_hw_to_dev (hw ), fvit );
5633
5609
}
5634
5610
5635
- devm_kfree (ice_hw_to_dev (hw ), rm -> root_buf );
5636
5611
kfree (rm );
5637
5612
5638
5613
err_free_lkup_exts :
0 commit comments