Commit af41b185 authored by Michal Swiatkowski's avatar Michal Swiatkowski Committed by Tony Nguyen

ice: track port representors in xarray

Instead of assuming that each VF has pointer to port representor save it
in xarray. It will allow adding port representor for other device types.

Drop reference to VF where it is use only to get port representor. Get
it from xarray instead.

The functions will no longer by specific for VF, rename them.

Track id assigned by xarray in port representor structure. The id can't
be used as ::q_id, because it is fixed during port representor lifetime.
::q_id can change after adding / removing other port representors.

Side effect of removing VF pointer is that we are losing VF MAC
information used in unrolling. Store it in port representor as parent
MAC.
Reviewed-by: default avatarPiotr Raczynski <piotr.raczynski@intel.com>
Reviewed-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 5c53c122
......@@ -526,6 +526,7 @@ struct ice_eswitch {
struct ice_vsi *control_vsi;
struct ice_vsi *uplink_vsi;
struct ice_esw_br_offloads *br_offloads;
struct xarray reprs;
bool is_running;
};
......
......@@ -4702,6 +4702,8 @@ static void ice_deinit_features(struct ice_pf *pf)
ice_ptp_release(pf);
if (test_bit(ICE_FLAG_DPLL, pf->flags))
ice_dpll_deinit(pf);
if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV)
xa_destroy(&pf->eswitch.reprs);
}
static void ice_init_wakeup(struct ice_pf *pf)
......
......@@ -318,6 +318,11 @@ static int ice_repr_add(struct ice_vf *vf)
}
repr->q_vector = q_vector;
err = xa_alloc(&vf->pf->eswitch.reprs, &repr->id, repr,
xa_limit_32b, GFP_KERNEL);
if (err)
goto err_xa_alloc;
err = ice_devlink_create_vf_port(vf);
if (err)
goto err_devlink;
......@@ -338,6 +343,8 @@ static int ice_repr_add(struct ice_vf *vf)
err_netdev:
ice_devlink_destroy_vf_port(vf);
err_devlink:
xa_erase(&vf->pf->eswitch.reprs, repr->id);
err_xa_alloc:
kfree(repr->q_vector);
vf->repr->q_vector = NULL;
err_alloc_q_vector:
......@@ -363,6 +370,7 @@ static void ice_repr_rem(struct ice_vf *vf)
kfree(repr->q_vector);
unregister_netdev(repr->netdev);
ice_devlink_destroy_vf_port(vf);
xa_erase(&vf->pf->eswitch.reprs, repr->id);
free_netdev(repr->netdev);
kfree(repr);
vf->repr = NULL;
......
......@@ -14,6 +14,8 @@ struct ice_repr {
struct metadata_dst *dst;
struct ice_esw_br_port *br_port;
int q_id;
u32 id;
u8 parent_mac[ETH_ALEN];
#ifdef CONFIG_ICE_SWITCHDEV
/* info about slow path rule */
struct ice_rule_query_data sp_rule;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment