Skip to content

Commit 2be2928

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: alloc id for RDMA using xa_array
Use xa_array instead of deprecated ida to alloc id for RDMA aux driver. Signed-off-by: Michal Swiatkowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 2b8db6a commit 2be2928

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/net/ethernet/intel/ice/ice_idc.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "ice_lib.h"
77
#include "ice_dcb_lib.h"
88

9-
static DEFINE_IDA(ice_aux_ida);
9+
static DEFINE_XARRAY_ALLOC1(ice_aux_id);
1010

1111
/**
1212
* ice_get_auxiliary_drv - retrieve iidc_auxiliary_drv struct
@@ -349,8 +349,9 @@ int ice_init_rdma(struct ice_pf *pf)
349349
return 0;
350350
}
351351

352-
pf->aux_idx = ida_alloc(&ice_aux_ida, GFP_KERNEL);
353-
if (pf->aux_idx < 0) {
352+
ret = xa_alloc(&ice_aux_id, &pf->aux_idx, NULL, XA_LIMIT(1, INT_MAX),
353+
GFP_KERNEL);
354+
if (ret) {
354355
dev_err(dev, "Failed to allocate device ID for AUX driver\n");
355356
return -ENOMEM;
356357
}
@@ -371,7 +372,7 @@ int ice_init_rdma(struct ice_pf *pf)
371372
ice_free_rdma_qvector(pf);
372373
err_reserve_rdma_qvector:
373374
pf->adev = NULL;
374-
ida_free(&ice_aux_ida, pf->aux_idx);
375+
xa_erase(&ice_aux_id, pf->aux_idx);
375376
return ret;
376377
}
377378

@@ -386,5 +387,5 @@ void ice_deinit_rdma(struct ice_pf *pf)
386387

387388
ice_unplug_aux_dev(pf);
388389
ice_free_rdma_qvector(pf);
389-
ida_free(&ice_aux_ida, pf->aux_idx);
390+
xa_erase(&ice_aux_id, pf->aux_idx);
390391
}

0 commit comments

Comments
 (0)