@@ -228,61 +228,34 @@ void ice_get_qos_params(struct ice_pf *pf, struct iidc_qos_params *qos)
228228}
229229EXPORT_SYMBOL_GPL (ice_get_qos_params );
230230
231- /**
232- * ice_alloc_rdma_qvectors - Allocate vector resources for RDMA driver
233- * @pf: board private structure to initialize
234- */
235- static int ice_alloc_rdma_qvectors (struct ice_pf * pf )
231+ int ice_alloc_rdma_qvector (struct ice_pf * pf , struct msix_entry * entry )
236232{
237- if (ice_is_rdma_ena (pf )) {
238- int i ;
239-
240- pf -> msix_entries = kcalloc (pf -> num_rdma_msix ,
241- sizeof (* pf -> msix_entries ),
242- GFP_KERNEL );
243- if (!pf -> msix_entries )
244- return - ENOMEM ;
233+ struct msi_map map = ice_alloc_irq (pf , true);
245234
246- /* RDMA is the only user of pf->msix_entries array */
247- pf -> rdma_base_vector = 0 ;
248-
249- for (i = 0 ; i < pf -> num_rdma_msix ; i ++ ) {
250- struct msix_entry * entry = & pf -> msix_entries [i ];
251- struct msi_map map ;
235+ if (map .index < 0 )
236+ return - ENOMEM ;
252237
253- map = ice_alloc_irq (pf , false);
254- if (map .index < 0 )
255- break ;
238+ entry -> entry = map .index ;
239+ entry -> vector = map .virq ;
256240
257- entry -> entry = map .index ;
258- entry -> vector = map .virq ;
259- }
260- }
261241 return 0 ;
262242}
243+ EXPORT_SYMBOL_GPL (ice_alloc_rdma_qvector );
263244
264245/**
265246 * ice_free_rdma_qvector - free vector resources reserved for RDMA driver
266247 * @pf: board private structure to initialize
248+ * @entry: MSI-X entry to be removed
267249 */
268- static void ice_free_rdma_qvector (struct ice_pf * pf )
250+ void ice_free_rdma_qvector (struct ice_pf * pf , struct msix_entry * entry )
269251{
270- int i ;
271-
272- if (!pf -> msix_entries )
273- return ;
274-
275- for (i = 0 ; i < pf -> num_rdma_msix ; i ++ ) {
276- struct msi_map map ;
252+ struct msi_map map ;
277253
278- map .index = pf -> msix_entries [i ].entry ;
279- map .virq = pf -> msix_entries [i ].vector ;
280- ice_free_irq (pf , map );
281- }
282-
283- kfree (pf -> msix_entries );
284- pf -> msix_entries = NULL ;
254+ map .index = entry -> entry ;
255+ map .virq = entry -> vector ;
256+ ice_free_irq (pf , map );
285257}
258+ EXPORT_SYMBOL_GPL (ice_free_rdma_qvector );
286259
287260/**
288261 * ice_adev_release - function to be mapped to AUX dev's release op
@@ -382,21 +355,13 @@ int ice_init_rdma(struct ice_pf *pf)
382355 return - ENOMEM ;
383356 }
384357
385- /* Reserve vector resources */
386- ret = ice_alloc_rdma_qvectors (pf );
387- if (ret < 0 ) {
388- dev_err (dev , "failed to reserve vectors for RDMA\n" );
389- goto err_reserve_rdma_qvector ;
390- }
391358 pf -> rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2 ;
392359 ret = ice_plug_aux_dev (pf );
393360 if (ret )
394361 goto err_plug_aux_dev ;
395362 return 0 ;
396363
397364err_plug_aux_dev :
398- ice_free_rdma_qvector (pf );
399- err_reserve_rdma_qvector :
400365 pf -> adev = NULL ;
401366 xa_erase (& ice_aux_id , pf -> aux_idx );
402367 return ret ;
@@ -412,6 +377,5 @@ void ice_deinit_rdma(struct ice_pf *pf)
412377 return ;
413378
414379 ice_unplug_aux_dev (pf );
415- ice_free_rdma_qvector (pf );
416380 xa_erase (& ice_aux_id , pf -> aux_idx );
417381}
0 commit comments