diff options
author | Ido Schimmel | 2016-06-20 23:04:17 +0200 |
---|---|---|
committer | David S. Miller | 2016-06-21 11:02:50 +0200 |
commit | 41b996cc94c7e7f8567585d05ea1d52a3a181146 (patch) | |
tree | 738ee0580c06efb58778a6995cf8405294889135 /drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |
parent | mlxsw: spectrum: Check if port is vPort using its VID (diff) | |
download | kernel-qcow2-linux-41b996cc94c7e7f8567585d05ea1d52a3a181146.tar.gz kernel-qcow2-linux-41b996cc94c7e7f8567585d05ea1d52a3a181146.tar.xz kernel-qcow2-linux-41b996cc94c7e7f8567585d05ea1d52a3a181146.zip |
mlxsw: spectrum: Add FID get / set functions
As previously explained, not all vPorts will be assigned FIDs, so instead
of returning the FID index of a vPort, return a pointer to its FID
struct. This will allow us to know whether it's legal to access the
vPort's FID parameters such as index and device.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 08f3f51d3efb..ea007f021ec8 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -776,7 +776,7 @@ static int mlxsw_sp_vport_vfid_join(struct mlxsw_sp_port *mlxsw_sp_vport) if (err) goto err_vport_fid_map; - mlxsw_sp_vport->vport.f = f; + mlxsw_sp_vport_fid_set(mlxsw_sp_vport, f); f->ref_count++; return 0; @@ -792,9 +792,9 @@ err_vport_flood_set: static void mlxsw_sp_vport_vfid_leave(struct mlxsw_sp_port *mlxsw_sp_vport) { - struct mlxsw_sp_fid *f = mlxsw_sp_vport->vport.f; + struct mlxsw_sp_fid *f = mlxsw_sp_vport_fid_get(mlxsw_sp_vport); - mlxsw_sp_vport->vport.f = NULL; + mlxsw_sp_vport_fid_set(mlxsw_sp_vport, NULL); mlxsw_sp_vport_fid_map(mlxsw_sp_vport, f->fid, false); @@ -2639,7 +2639,8 @@ static int mlxsw_sp_vport_fdb_flush(struct mlxsw_sp_port *mlxsw_sp_vport, return mlxsw_sp_port_fdb_flush_by_lag_id_fid(mlxsw_sp_vport, fid); else - return mlxsw_sp_port_fdb_flush_by_port_fid(mlxsw_sp_vport, fid); + return mlxsw_sp_port_fdb_flush_by_port_fid(mlxsw_sp_vport, + fid); } static bool mlxsw_sp_port_dev_check(const struct net_device *dev) @@ -3229,7 +3230,7 @@ static int mlxsw_sp_vport_br_vfid_join(struct mlxsw_sp_port *mlxsw_sp_vport, if (err) goto err_vport_fid_map; - mlxsw_sp_vport->vport.f = f; + mlxsw_sp_vport_fid_set(mlxsw_sp_vport, f); f->ref_count++; return 0; @@ -3244,13 +3245,13 @@ err_vport_flood_set: static void mlxsw_sp_vport_br_vfid_leave(struct mlxsw_sp_port *mlxsw_sp_vport) { - struct mlxsw_sp_fid *f = mlxsw_sp_vport->vport.f; + struct mlxsw_sp_fid *f = mlxsw_sp_vport_fid_get(mlxsw_sp_vport); mlxsw_sp_vport_fid_map(mlxsw_sp_vport, f->fid, false); mlxsw_sp_vport_flood_set(mlxsw_sp_vport, f->fid, false); - mlxsw_sp_vport->vport.f = NULL; + mlxsw_sp_vport_fid_set(mlxsw_sp_vport, NULL); if (--f->ref_count == 0) mlxsw_sp_br_vfid_destroy(mlxsw_sp_vport->mlxsw_sp, f); } @@ -3293,8 +3294,8 @@ err_vport_br_vfid_join: static void mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport, bool flush_fdb) { + u16 fid = mlxsw_sp_vport_fid_get(mlxsw_sp_vport)->fid; u16 vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport); - u16 fid = mlxsw_sp_vport_fid_get(mlxsw_sp_vport); mlxsw_sp_port_vid_learning_set(mlxsw_sp_vport, vid, false); |