> -----Original Message-----
> From: Sang-Hoon Choi <[email protected]>
> Sent: Monday, September 21, 2026 8:49 PM
> To: Nguyen, Anthony L <[email protected]>; Kitszel,
> Przemyslaw <[email protected]>
> Cc: [email protected]; [email protected]; Changyul
> Lee <[email protected]>
> Subject: [PATCH net] ice: initialize the SF number XArray for
> allocation
>
> When a devlink port creation request omits the SF number,
> ice_reserve_sf_num() uses xa_alloc() to choose one. However,
> ice_init_pf() initializes sf_nums with xa_init(), so the XArray does
> not track free entries. __xa_alloc() warns and returns -EINVAL,
> preventing automatic SF number allocation.
>
Do you have configuration and reproduction steps?
Can you put it in the description?
Reviewed-by: Aleksandr Loktionov <[email protected]>
> Initialize sf_nums with XA_FLAGS_ALLOC. This also preserves the
> explicit SF number path: xa_insert() with a NULL entry reserves the
> supplied number, and xa_alloc() skips that reservation.
>
> Fixes: eda69d654c7e ("ice: add basic devlink subfunctions support")
> Reported-by: Changyul Lee <[email protected]>
> Assisted-by: LLM
> Signed-off-by: Sang-Hoon Choi <[email protected]>
> ---
> Found during source review at mainline
> 5dd1818b15d98d4a20806cd00b1b40320b06004f. The affected source is
> unchanged at f0100363d8c374bd8e9ea7c9ba02744f0b802ca4.
>
> The ice_main.o and devlink/port.o objects compiled with x86
> allmodconfig and W=1. I have not tested SF creation on ICE hardware.
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index d88835482..f56c2b748 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -3996,7 +3996,7 @@ int ice_init_pf(struct ice_pf *pf)
> ice_mbx_init_snapshot(&pf->hw);
>
> xa_init(&pf->dyn_ports);
> - xa_init(&pf->sf_nums);
> + xa_init_flags(&pf->sf_nums, XA_FLAGS_ALLOC);
>
> pf->avail_txqs = bitmap_zalloc(pf->max_pf_txqs, GFP_KERNEL);
> pf->avail_rxqs = bitmap_zalloc(pf->max_pf_rxqs, GFP_KERNEL);