Commit 027e00dc authored by Scott Feldman's avatar Scott Feldman Committed by David S. Miller

rocker: install/remove router MAC for untagged VLAN when joining/leaving bridge

When the port joins a bridge, the port's internal VLAN ID needs to change
to the bridge's internal VLAN ID.  Likewise, when leaving the bridge, the
internal VLAN ID reverts back the port's original internal VLAN ID.  (The
internal VLAN ID is used by device to internally mark untagged pkts with
some VLAN, which will eventually be removed on egress...think PVID).  When
the internal VLAN ID changes, we need to update the VLAN table entries and
the router MAC entries for IP/IPv6 to reflect the new internal VLAN ID.

This patch makes use of the common rocker_port_vlan_add/del functions to
make sure the tables are updated for the current internal VLAN ID.
Signed-off-by: default avatarScott Feldman <sfeldma@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bcfd7801
...@@ -5153,41 +5153,49 @@ static bool rocker_port_dev_check(const struct net_device *dev) ...@@ -5153,41 +5153,49 @@ static bool rocker_port_dev_check(const struct net_device *dev)
static int rocker_port_bridge_join(struct rocker_port *rocker_port, static int rocker_port_bridge_join(struct rocker_port *rocker_port,
struct net_device *bridge) struct net_device *bridge)
{ {
u16 untagged_vid = 0;
int err; int err;
rocker_port_internal_vlan_id_put(rocker_port, /* Port is joining bridge, so the internal VLAN for the
rocker_port->dev->ifindex); * port is going to change to the bridge internal VLAN.
* Let's remove untagged VLAN (vid=0) from port and
rocker_port->bridge_dev = bridge; * re-add once internal VLAN has changed.
*/
/* Use bridge internal VLAN ID for untagged pkts */ err = rocker_port_vlan_del(rocker_port, untagged_vid, 0);
err = rocker_port_vlan(rocker_port, SWITCHDEV_TRANS_NONE,
ROCKER_OP_FLAG_REMOVE, 0);
if (err) if (err)
return err; return err;
rocker_port_internal_vlan_id_put(rocker_port,
rocker_port->dev->ifindex);
rocker_port->internal_vlan_id = rocker_port->internal_vlan_id =
rocker_port_internal_vlan_id_get(rocker_port, bridge->ifindex); rocker_port_internal_vlan_id_get(rocker_port, bridge->ifindex);
return rocker_port_vlan(rocker_port, SWITCHDEV_TRANS_NONE, 0, 0);
rocker_port->bridge_dev = bridge;
return rocker_port_vlan_add(rocker_port, SWITCHDEV_TRANS_NONE,
untagged_vid, 0);
} }
static int rocker_port_bridge_leave(struct rocker_port *rocker_port) static int rocker_port_bridge_leave(struct rocker_port *rocker_port)
{ {
u16 untagged_vid = 0;
int err; int err;
rocker_port_internal_vlan_id_put(rocker_port, err = rocker_port_vlan_del(rocker_port, untagged_vid, 0);
rocker_port->bridge_dev->ifindex);
rocker_port->bridge_dev = NULL;
/* Use port internal VLAN ID for untagged pkts */
err = rocker_port_vlan(rocker_port, SWITCHDEV_TRANS_NONE,
ROCKER_OP_FLAG_REMOVE, 0);
if (err) if (err)
return err; return err;
rocker_port_internal_vlan_id_put(rocker_port,
rocker_port->bridge_dev->ifindex);
rocker_port->internal_vlan_id = rocker_port->internal_vlan_id =
rocker_port_internal_vlan_id_get(rocker_port, rocker_port_internal_vlan_id_get(rocker_port,
rocker_port->dev->ifindex); rocker_port->dev->ifindex);
err = rocker_port_vlan(rocker_port, SWITCHDEV_TRANS_NONE, 0, 0);
rocker_port->bridge_dev = NULL;
err = rocker_port_vlan_add(rocker_port, SWITCHDEV_TRANS_NONE,
untagged_vid, 0);
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment