summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2020-02-20 09:07:58 +0200
committerDavid S. Miller <davem@davemloft.net>2020-02-20 10:04:34 -0800
commit5e9a664da877dcc66e2182dc9d56375c99ab98eb (patch)
tree63918b825d32fcb60153474129c7ae5920f0ef9b /drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
parent1c6d6b514518cb83fd0570c42aaa7d1bd0b8efb4 (diff)
mlxsw: spectrum: Prevent RIF access outside of routing code
There are currently 5 users of mlxsw_sp_rif_find_by_dev() outside of the routing code. Only one call site actually needs to dereference the router interface (RIF). The rest merely need to know if a RIF exists for the provided netdev. Convert this call site to query the needed information directly from the routing code instead of dereferencing the RIF. This will later allow us to replace mlxsw_sp_rif_find_by_dev() with a function that checks if a RIF exist. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index d70865f29105..339c69da83b2 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -1173,16 +1173,12 @@ mlxsw_sp_br_ban_rif_pvid_change(struct mlxsw_sp *mlxsw_sp,
const struct net_device *br_dev,
const struct switchdev_obj_port_vlan *vlan)
{
- struct mlxsw_sp_rif *rif;
- struct mlxsw_sp_fid *fid;
u16 pvid;
u16 vid;
- rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, br_dev);
- if (!rif)
+ pvid = mlxsw_sp_rif_vid(mlxsw_sp, br_dev);
+ if (!pvid)
return 0;
- fid = mlxsw_sp_rif_fid(rif);
- pvid = mlxsw_sp_fid_8021q_vid(fid);
for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) {
if (vlan->flags & BRIDGE_VLAN_INFO_PVID) {