Skip to content

Commit

Permalink
ice: alloc id for RDMA using xa_array
Browse files Browse the repository at this point in the history
Use xa_array instead of deprecated ida to alloc id for RDMA aux driver.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Michal Swiatkowski authored and Tony Nguyen committed Feb 3, 2023
1 parent 2b8db6a commit 2be2928
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/net/ethernet/intel/ice/ice_idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "ice_lib.h"
#include "ice_dcb_lib.h"

static DEFINE_IDA(ice_aux_ida);
static DEFINE_XARRAY_ALLOC1(ice_aux_id);

/**
* ice_get_auxiliary_drv - retrieve iidc_auxiliary_drv struct
Expand Down Expand Up @@ -349,8 +349,9 @@ int ice_init_rdma(struct ice_pf *pf)
return 0;
}

pf->aux_idx = ida_alloc(&ice_aux_ida, GFP_KERNEL);
if (pf->aux_idx < 0) {
ret = xa_alloc(&ice_aux_id, &pf->aux_idx, NULL, XA_LIMIT(1, INT_MAX),
GFP_KERNEL);
if (ret) {
dev_err(dev, "Failed to allocate device ID for AUX driver\n");
return -ENOMEM;
}
Expand All @@ -371,7 +372,7 @@ int ice_init_rdma(struct ice_pf *pf)
ice_free_rdma_qvector(pf);
err_reserve_rdma_qvector:
pf->adev = NULL;
ida_free(&ice_aux_ida, pf->aux_idx);
xa_erase(&ice_aux_id, pf->aux_idx);
return ret;
}

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

ice_unplug_aux_dev(pf);
ice_free_rdma_qvector(pf);
ida_free(&ice_aux_ida, pf->aux_idx);
xa_erase(&ice_aux_id, pf->aux_idx);
}

0 comments on commit 2be2928

Please sign in to comment.