Skip to content

Commit

Permalink
mlxsw: spectrum: Extend port_orig_get for bridge devices
Browse files Browse the repository at this point in the history
The function mlxsw_sp_port_orig_get returns the vport from the physical
port if needed, based on the original device.
This patch addresses the case where the original device is a bridge.
If it is vlan unaware bridge, it returns the matching vport. If it is vlan
aware bridge, there is no matching vport, and it returns the original port.

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nogah Frankel authored and David S. Miller committed Feb 10, 2017
1 parent 8ecd459 commit 1e5d943
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,21 @@ mlxsw_sp_port_orig_get(struct net_device *dev,
struct mlxsw_sp_port *mlxsw_sp_port)
{
struct mlxsw_sp_port *mlxsw_sp_vport;
struct mlxsw_sp_fid *fid;
u16 vid;

if (netif_is_bridge_master(dev)) {
fid = mlxsw_sp_vfid_find(mlxsw_sp_port->mlxsw_sp,
dev);
if (fid) {
mlxsw_sp_vport =
mlxsw_sp_port_vport_find_by_fid(mlxsw_sp_port,
fid->fid);
WARN_ON(!mlxsw_sp_vport);
return mlxsw_sp_vport;
}
}

if (!is_vlan_dev(dev))
return mlxsw_sp_port;

Expand Down

0 comments on commit 1e5d943

Please sign in to comment.