]> www.infradead.org Git - nvme.git/commitdiff
ice: store representor ID in bridge port
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Mon, 10 Jun 2024 07:44:31 +0000 (09:44 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 21 Jun 2024 14:44:33 +0000 (07:44 -0700)
It is used to get representor structure during cleaning.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
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_br.c
drivers/net/ethernet/intel/ice/ice_eswitch_br.h
drivers/net/ethernet/intel/ice/ice_repr.c
drivers/net/ethernet/intel/ice/ice_repr.h

index ac5beecd028b53e6796c688184e419cf49d445d5..f5aceb32bf4dd21afa2197fd879fd6932dd3e4be 100644 (file)
@@ -896,7 +896,8 @@ ice_eswitch_br_port_deinit(struct ice_esw_br *bridge,
        if (br_port->type == ICE_ESWITCH_BR_UPLINK_PORT && vsi->back) {
                vsi->back->br_port = NULL;
        } else {
-               struct ice_repr *repr = ice_repr_get_by_vsi(vsi);
+               struct ice_repr *repr =
+                       ice_repr_get(vsi->back, br_port->repr_id);
 
                if (repr)
                        repr->br_port = NULL;
@@ -937,6 +938,7 @@ ice_eswitch_br_vf_repr_port_init(struct ice_esw_br *bridge,
        br_port->vsi = repr->src_vsi;
        br_port->vsi_idx = br_port->vsi->idx;
        br_port->type = ICE_ESWITCH_BR_VF_REPR_PORT;
+       br_port->repr_id = repr->id;
        repr->br_port = br_port;
 
        err = xa_insert(&bridge->ports, br_port->vsi_idx, br_port, GFP_KERNEL);
index 85a8fadb2928e67a6b070bef16d17649bf498864..c15c7344d7f85335cfd45ae6b8b0c1a41404b5af 100644 (file)
@@ -46,6 +46,7 @@ struct ice_esw_br_port {
        enum ice_esw_br_port_type type;
        u16 vsi_idx;
        u16 pvid;
+       u32 repr_id;
        struct xarray vlans;
 };
 
index d367f4c66dcd277b239ab31a8e22694eb9f32238..fe83f305cc7d6814110a4c31b632f7d6cd88ded5 100644 (file)
@@ -415,12 +415,9 @@ err_repr_add:
        return ERR_PTR(err);
 }
 
-struct ice_repr *ice_repr_get_by_vsi(struct ice_vsi *vsi)
+struct ice_repr *ice_repr_get(struct ice_pf *pf, u32 id)
 {
-       if (!vsi->vf)
-               return NULL;
-
-       return xa_load(&vsi->back->eswitch.reprs, vsi->vf->repr_id);
+       return xa_load(&pf->eswitch.reprs, id);
 }
 
 /**
index cff730b15ca0ef8062d0eeb134efff65b5d8c652..488661b2900b0c9a38f50a10d9ea68143dda2734 100644 (file)
@@ -35,9 +35,8 @@ void ice_repr_stop_tx_queues(struct ice_repr *repr);
 struct ice_repr *ice_netdev_to_repr(const struct net_device *netdev);
 bool ice_is_port_repr_netdev(const struct net_device *netdev);
 
-struct ice_repr *ice_repr_get_by_vsi(struct ice_vsi *vsi);
-
 void ice_repr_inc_tx_stats(struct ice_repr *repr, unsigned int len,
                           int xmit_status);
 void ice_repr_inc_rx_stats(struct net_device *netdev, unsigned int len);
+struct ice_repr *ice_repr_get(struct ice_pf *pf, u32 id);
 #endif