Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: mustafa.ismail@intel.com, benjamin.mikailenko@intel.com,
	jesse.brandeburg@intel.com, leszek.kaliszczuk@intel.com,
	przemyslaw.kitszel@intel.com, shiraz.saleem@intel.com
Subject: [Intel-wired-lan] [PATCH net-next v3 02/10] ice: alloc id for RDMA using xa_array
Date: Wed, 21 Dec 2022 12:38:14 +0100	[thread overview]
Message-ID: <20221221113822.12858-3-michal.swiatkowski@linux.intel.com> (raw)
In-Reply-To: <20221221113822.12858-1-michal.swiatkowski@linux.intel.com>

Use xa_array instead of deprecated ida to alloc id for RDMA aux driver.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
 drivers/net/ethernet/intel/ice/ice_idc.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_idc.c b/drivers/net/ethernet/intel/ice/ice_idc.c
index 579d2a433ea1..e6bc2285071e 100644
--- a/drivers/net/ethernet/intel/ice/ice_idc.c
+++ b/drivers/net/ethernet/intel/ice/ice_idc.c
@@ -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
@@ -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;
 	}
@@ -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;
 }
 
@@ -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);
 }
-- 
2.36.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  parent reply	other threads:[~2022-12-21 11:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 11:38 [Intel-wired-lan] [PATCH net-next v3 00/10] implement devlink reload in ice Michal Swiatkowski
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 01/10] ice: move RDMA init to ice_idc.c Michal Swiatkowski
2022-12-21 11:38 ` Michal Swiatkowski [this message]
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 03/10] ice: cleanup in VSI config/deconfig code Michal Swiatkowski
2023-01-06  6:31   ` G, GurucharanX
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 04/10] ice: split ice_vsi_setup into smaller functions Michal Swiatkowski
2023-01-06  6:32   ` G, GurucharanX
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 05/10] ice: stop hard coding the ICE_VSI_CTRL location Michal Swiatkowski
2023-01-06  6:33   ` G, GurucharanX
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 06/10] ice: split probe into smaller functions Michal Swiatkowski
2023-01-06  6:34   ` G, GurucharanX
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 07/10] ice: sync netdev filters after clearing VSI Michal Swiatkowski
2023-01-06  6:35   ` G, GurucharanX
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 08/10] ice: move VSI delete outside deconfig Michal Swiatkowski
2023-01-06  6:36   ` G, GurucharanX
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 09/10] ice: update VSI instead of init in some case Michal Swiatkowski
2023-01-06  6:36   ` G, GurucharanX
2022-12-21 11:38 ` [Intel-wired-lan] [PATCH net-next v3 10/10] ice: implement devlink reinit action Michal Swiatkowski
2023-01-06  6:37   ` G, GurucharanX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221221113822.12858-3-michal.swiatkowski@linux.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=benjamin.mikailenko@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=leszek.kaliszczuk@intel.com \
    --cc=mustafa.ismail@intel.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=shiraz.saleem@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox