Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 005bcea9 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'dsa-finers-bridging-control'



Vivien Didelot says:

====================
net: dsa: finer bridging control

This patchset renames the bridging routines of the DSA layer, make the
unbridging routine return void, and rework the DSA netdev notifier handler,
similar to what the Mellanox Spectrum driver does.

Changes RFC -> v1:
  - drop unused NETDEV_PRECHANGEUPPER case
  - add Andrew's Tested-by tag
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1e1589ad 6debb68a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -521,12 +521,12 @@ See Documentation/hwmon/sysfs-interface for details.
Bridge layer
------------

- port_join_bridge: bridge layer function invoked when a given switch port is
- port_bridge_join: bridge layer function invoked when a given switch port is
  added to a bridge, this function should be doing the necessary at the switch
  level to permit the joining port from being added to the relevant logical
  domain for it to ingress/egress traffic with other members of the bridge.

- port_leave_bridge: bridge layer function invoked when a given switch port is
- port_bridge_leave: bridge layer function invoked when a given switch port is
  removed from a bridge, this function should be doing the necessary at the
  switch level to deny the leaving port from ingress/egress traffic from the
  remaining bridge members. When the port leaves the bridge, it should be aged
+3 −5
Original line number Diff line number Diff line
@@ -516,7 +516,7 @@ static int bcm_sf2_sw_br_join(struct dsa_switch *ds, int port,
	return 0;
}

static int bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port)
static void bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port)
{
	struct bcm_sf2_priv *priv = ds_to_priv(ds);
	struct net_device *bridge = priv->port_sts[port].bridge_dev;
@@ -543,8 +543,6 @@ static int bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port)
	core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port));
	priv->port_sts[port].vlan_ctl_mask = p_ctl;
	priv->port_sts[port].bridge_dev = NULL;

	return 0;
}

static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
@@ -1387,8 +1385,8 @@ static struct dsa_switch_driver bcm_sf2_switch_driver = {
	.port_disable		= bcm_sf2_port_disable,
	.get_eee		= bcm_sf2_sw_get_eee,
	.set_eee		= bcm_sf2_sw_set_eee,
	.port_join_bridge	= bcm_sf2_sw_br_join,
	.port_leave_bridge	= bcm_sf2_sw_br_leave,
	.port_bridge_join	= bcm_sf2_sw_br_join,
	.port_bridge_leave	= bcm_sf2_sw_br_leave,
	.port_stp_update	= bcm_sf2_sw_br_set_stp_state,
	.port_fdb_prepare	= bcm_sf2_sw_fdb_prepare,
	.port_fdb_add		= bcm_sf2_sw_fdb_add,
+2 −2
Original line number Diff line number Diff line
@@ -103,8 +103,8 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
#endif
	.get_regs_len		= mv88e6xxx_get_regs_len,
	.get_regs		= mv88e6xxx_get_regs,
	.port_join_bridge	= mv88e6xxx_port_bridge_join,
	.port_leave_bridge	= mv88e6xxx_port_bridge_leave,
	.port_bridge_join	= mv88e6xxx_port_bridge_join,
	.port_bridge_leave	= mv88e6xxx_port_bridge_leave,
	.port_stp_update        = mv88e6xxx_port_stp_update,
	.port_vlan_filtering	= mv88e6xxx_port_vlan_filtering,
	.port_vlan_prepare	= mv88e6xxx_port_vlan_prepare,
+2 −2
Original line number Diff line number Diff line
@@ -324,8 +324,8 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
	.set_eeprom		= mv88e6352_set_eeprom,
	.get_regs_len		= mv88e6xxx_get_regs_len,
	.get_regs		= mv88e6xxx_get_regs,
	.port_join_bridge	= mv88e6xxx_port_bridge_join,
	.port_leave_bridge	= mv88e6xxx_port_bridge_leave,
	.port_bridge_join	= mv88e6xxx_port_bridge_join,
	.port_bridge_leave	= mv88e6xxx_port_bridge_leave,
	.port_stp_update	= mv88e6xxx_port_stp_update,
	.port_vlan_filtering	= mv88e6xxx_port_vlan_filtering,
	.port_vlan_prepare	= mv88e6xxx_port_vlan_prepare,
+9 −19
Original line number Diff line number Diff line
@@ -2219,39 +2219,29 @@ int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
	return err;
}

int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
{
	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
	struct net_device *bridge = ps->ports[port].bridge_dev;
	u16 fid;
	int i, err;
	int i;

	mutex_lock(&ps->smi_mutex);

	/* Give the port a fresh Filtering Information Database */
	err = _mv88e6xxx_fid_new(ds, &fid);
	if (err)
		goto unlock;

	err = _mv88e6xxx_port_fid_set(ds, port, fid);
	if (err)
		goto unlock;
	if (_mv88e6xxx_fid_new(ds, &fid) ||
	    _mv88e6xxx_port_fid_set(ds, port, fid))
		netdev_warn(ds->ports[port], "failed to assign a new FID\n");

	/* Unassign the bridge and remap each port's VLANTable */
	ps->ports[port].bridge_dev = NULL;

	for (i = 0; i < ps->num_ports; ++i) {
		if (i == port || ps->ports[i].bridge_dev == bridge) {
			err = _mv88e6xxx_port_based_vlan_map(ds, i);
			if (err)
				break;
		}
	}
	for (i = 0; i < ps->num_ports; ++i)
		if (i == port || ps->ports[i].bridge_dev == bridge)
			if (_mv88e6xxx_port_based_vlan_map(ds, i))
				netdev_warn(ds->ports[i], "failed to remap\n");

unlock:
	mutex_unlock(&ps->smi_mutex);

	return err;
}

static void mv88e6xxx_bridge_work(struct work_struct *work)
Loading