]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ice: change repr::id values
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Fri, 1 Mar 2024 11:54:12 +0000 (12:54 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 25 Mar 2024 20:08:05 +0000 (13:08 -0700)
Instead of getting repr::id from xa_alloc() value, set it to the
src_vsi::num_vsi value. It is unique for each PR.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_eswitch.c
drivers/net/ethernet/intel/ice/ice_repr.c

index 76fa114f22c901bcc103bcd617cd12fe465d936f..5eba8dec9f9497b688d8efcca751b73ae64eb57e 100644 (file)
@@ -319,7 +319,7 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
 
                dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev",
                         pf->hw.pf_id);
-               xa_init_flags(&pf->eswitch.reprs, XA_FLAGS_ALLOC);
+               xa_init(&pf->eswitch.reprs);
                NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to switchdev");
                break;
        }
@@ -426,8 +426,7 @@ ice_eswitch_attach(struct ice_pf *pf, struct ice_vf *vf)
        if (err)
                goto err_setup_repr;
 
-       err = xa_alloc(&pf->eswitch.reprs, &repr->id, repr,
-                      XA_LIMIT(1, INT_MAX), GFP_KERNEL);
+       err = xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL);
        if (err)
                goto err_xa_alloc;
 
index a5c24da31b887511daa97661c99a5cff5638c970..b4fb7427181159bfde627a232630350b50cc2788 100644 (file)
@@ -345,6 +345,7 @@ ice_repr_add(struct ice_pf *pf, struct ice_vsi *src_vsi, const u8 *parent_mac)
        }
 
        repr->src_vsi = src_vsi;
+       repr->id = src_vsi->vsi_num;
        np = netdev_priv(repr->netdev);
        np->repr = repr;