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>
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 6713769..b31b2ce 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -58,7 +58,7 @@
u16 fid = vid;
if (mlxsw_sp_port_is_vport(mlxsw_sp_port))
- fid = mlxsw_sp_vport_fid_get(mlxsw_sp_port);
+ fid = mlxsw_sp_vport_fid_get(mlxsw_sp_port)->fid;
if (!fid)
fid = mlxsw_sp_port->pvid;
@@ -233,9 +233,9 @@
int err;
if (mlxsw_sp_port_is_vport(mlxsw_sp_port)) {
- u16 vfid, fid = mlxsw_sp_vport_fid_get(mlxsw_sp_port);
+ u16 fid = mlxsw_sp_vport_fid_get(mlxsw_sp_port)->fid;
+ u16 vfid = mlxsw_sp_fid_to_vfid(fid);
- vfid = mlxsw_sp_fid_to_vfid(fid);
return __mlxsw_sp_port_flood_set(mlxsw_sp_port, vfid, vfid,
set, true);
}
@@ -1212,7 +1212,7 @@
return -ENOMEM;
if (mlxsw_sp_port_is_vport(mlxsw_sp_port))
- vport_fid = mlxsw_sp_vport_fid_get(mlxsw_sp_port);
+ vport_fid = mlxsw_sp_vport_fid_get(mlxsw_sp_port)->fid;
mlxsw_reg_sfd_pack(sfd_pl, MLXSW_REG_SFD_OP_QUERY_DUMP, 0);
do {