Skip to content

Commit

Permalink
mlxsw: spectrum: Don't report VLAN for 802.1D FDB entries
Browse files Browse the repository at this point in the history
When dumping the hardware FDB we should report entries pointing to VLAN
devices with VLAN 0, as packets coming into the bridge are untagged.
Likewise, pass FDB_{ADD,DEL} notifications with VLAN 0 for these
devices.

Fixes: 54a7320 ("mlxsw: spectrum: Adjust switchdev ops for VLAN devices")
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>
  • Loading branch information
Ido Schimmel authored and David S. Miller committed Jan 28, 2016
1 parent 45827d7 commit 004f85e
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ static int mlxsw_sp_port_fdb_dump(struct mlxsw_sp_port *mlxsw_sp_port,
switchdev_obj_dump_cb_t *cb)
{
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
u16 vport_vid = 0, vport_fid = 0;
u16 vport_fid = 0;
char *sfd_pl;
char mac[ETH_ALEN];
u16 fid;
Expand All @@ -1072,7 +1072,6 @@ static int mlxsw_sp_port_fdb_dump(struct mlxsw_sp_port *mlxsw_sp_port,

tmp = mlxsw_sp_vport_vfid_get(mlxsw_sp_port);
vport_fid = mlxsw_sp_vfid_to_fid(tmp);
vport_vid = mlxsw_sp_vport_vid_get(mlxsw_sp_port);
}

mlxsw_reg_sfd_pack(sfd_pl, MLXSW_REG_SFD_OP_QUERY_DUMP, 0);
Expand All @@ -1096,12 +1095,13 @@ static int mlxsw_sp_port_fdb_dump(struct mlxsw_sp_port *mlxsw_sp_port,
mlxsw_reg_sfd_uc_unpack(sfd_pl, i, mac, &fid,
&local_port);
if (local_port == mlxsw_sp_port->local_port) {
if (vport_fid && vport_fid != fid)
continue;
else if (vport_fid)
fdb->vid = vport_vid;
else
if (vport_fid && vport_fid == fid)
fdb->vid = 0;
else if (!vport_fid &&
!mlxsw_sp_fid_is_vfid(fid))
fdb->vid = fid;
else
continue;
ether_addr_copy(fdb->addr, mac);
fdb->ndm_state = NUD_REACHABLE;
err = cb(&fdb->obj);
Expand All @@ -1114,12 +1114,13 @@ static int mlxsw_sp_port_fdb_dump(struct mlxsw_sp_port *mlxsw_sp_port,
mac, &fid, &lag_id);
if (mlxsw_sp_port ==
mlxsw_sp_lag_rep_port(mlxsw_sp, lag_id)) {
if (vport_fid && vport_fid != fid)
continue;
else if (vport_fid)
fdb->vid = vport_vid;
else
if (vport_fid && vport_fid == fid)
fdb->vid = 0;
else if (!vport_fid &&
!mlxsw_sp_fid_is_vfid(fid))
fdb->vid = fid;
else
continue;
ether_addr_copy(fdb->addr, mac);
fdb->ndm_state = NUD_REACHABLE;
err = cb(&fdb->obj);
Expand Down Expand Up @@ -1245,7 +1246,7 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp,
netdev_err(mlxsw_sp_port->dev, "Failed to find a matching vPort following FDB notification\n");
goto just_remove;
}
vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport);
vid = 0;
/* Override the physical port with the vPort. */
mlxsw_sp_port = mlxsw_sp_vport;
} else {
Expand Down Expand Up @@ -1305,8 +1306,8 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp,
goto just_remove;
}

vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport);
lag_vid = vid;
lag_vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport);
vid = 0;
/* Override the physical port with the vPort. */
mlxsw_sp_port = mlxsw_sp_vport;
} else {
Expand Down

0 comments on commit 004f85e

Please sign in to comment.