* [patch net-next 0/4] mlxsw: couple of fixes
@ 2016-01-04 9:42 Jiri Pirko
2016-01-04 9:42 ` [patch net-next 1/4] mlxsw: spectrum: Initialize PVID only once Jiri Pirko
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Jiri Pirko @ 2016-01-04 9:42 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz
From: Jiri Pirko <jiri@mellanox.com>
Couple of fixes from Ido.
Ido Schimmel (4):
mlxsw: spectrum: Initialize PVID only once
mlxsw: spectrum: Return NOTIFY_BAD on bridge failure
mlxsw: spectrum: Set bridge status in appropriate functions
mlxsw: spectrum: Change bridge port attributes only when bridged
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 37 ++++++++++++----------
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 3 ++
2 files changed, 23 insertions(+), 17 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch net-next 1/4] mlxsw: spectrum: Initialize PVID only once
2016-01-04 9:42 [patch net-next 0/4] mlxsw: couple of fixes Jiri Pirko
@ 2016-01-04 9:42 ` Jiri Pirko
2016-01-04 9:42 ` [patch net-next 2/4] mlxsw: spectrum: Return NOTIFY_BAD on bridge failure Jiri Pirko
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2016-01-04 9:42 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz
From: Ido Schimmel <idosch@mellanox.com>
We set PVID to 1 in mlxsw_sp_port_vlan_init(), so we can remove this
statement.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index c588c65..6cc1125 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1367,7 +1367,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port)
mlxsw_sp_port->learning = 1;
mlxsw_sp_port->learning_sync = 1;
mlxsw_sp_port->uc_flood = 1;
- mlxsw_sp_port->pvid = 1;
bytes = DIV_ROUND_UP(VLAN_N_VID, BITS_PER_BYTE);
mlxsw_sp_port->active_vlans = kzalloc(bytes, GFP_KERNEL);
if (!mlxsw_sp_port->active_vlans) {
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch net-next 2/4] mlxsw: spectrum: Return NOTIFY_BAD on bridge failure
2016-01-04 9:42 [patch net-next 0/4] mlxsw: couple of fixes Jiri Pirko
2016-01-04 9:42 ` [patch net-next 1/4] mlxsw: spectrum: Initialize PVID only once Jiri Pirko
@ 2016-01-04 9:42 ` Jiri Pirko
2016-01-04 9:42 ` [patch net-next 3/4] mlxsw: spectrum: Set bridge status in appropriate functions Jiri Pirko
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2016-01-04 9:42 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz
From: Ido Schimmel <idosch@mellanox.com>
It is possible for us to fail when joining or leaving a bridge, so let
the user know about that by returning NOTIFY_BAD, as already done for
LAG join/leave and 802.1D bridges.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 6cc1125..eb719f3 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -2357,16 +2357,20 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *dev,
} else if (netif_is_bridge_master(upper_dev)) {
if (info->linking) {
err = mlxsw_sp_port_bridge_join(mlxsw_sp_port);
- if (err)
+ if (err) {
netdev_err(dev, "Failed to join bridge\n");
+ return NOTIFY_BAD;
+ }
mlxsw_sp_master_bridge_inc(mlxsw_sp, upper_dev);
mlxsw_sp_port->bridged = 1;
} else {
err = mlxsw_sp_port_bridge_leave(mlxsw_sp_port);
- if (err)
- netdev_err(dev, "Failed to leave bridge\n");
mlxsw_sp_port->bridged = 0;
mlxsw_sp_master_bridge_dec(mlxsw_sp, upper_dev);
+ if (err) {
+ netdev_err(dev, "Failed to leave bridge\n");
+ return NOTIFY_BAD;
+ }
}
} else if (netif_is_lag_master(upper_dev)) {
if (info->linking) {
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch net-next 3/4] mlxsw: spectrum: Set bridge status in appropriate functions
2016-01-04 9:42 [patch net-next 0/4] mlxsw: couple of fixes Jiri Pirko
2016-01-04 9:42 ` [patch net-next 1/4] mlxsw: spectrum: Initialize PVID only once Jiri Pirko
2016-01-04 9:42 ` [patch net-next 2/4] mlxsw: spectrum: Return NOTIFY_BAD on bridge failure Jiri Pirko
@ 2016-01-04 9:42 ` Jiri Pirko
2016-01-04 9:42 ` [patch net-next 4/4] mlxsw: spectrum: Change bridge port attributes only when bridged Jiri Pirko
2016-01-05 3:08 ` [patch net-next 0/4] mlxsw: couple of fixes David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2016-01-04 9:42 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz
From: Ido Schimmel <idosch@mellanox.com>
Set the bridge status of physical ports in the appropriate functions, to
be consistent with LAG join/leave and vPorts joining/leaving bridge.
Also, remove the error messages in these two functions, as we already
emit errors in both the single functions they call.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index eb719f3..ed2eb7b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1989,8 +1989,8 @@ static int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port)
* own VLANs.
*/
err = mlxsw_sp_port_kill_vid(dev, 0, 1);
- if (err)
- netdev_err(dev, "Failed to remove VID 1\n");
+ if (!err)
+ mlxsw_sp_port->bridged = 1;
return err;
}
@@ -1998,16 +1998,13 @@ static int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port)
static int mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port)
{
struct net_device *dev = mlxsw_sp_port->dev;
- int err;
+
+ mlxsw_sp_port->bridged = 0;
/* Add implicit VLAN interface in the device, so that untagged
* packets will be classified to the default vFID.
*/
- err = mlxsw_sp_port_add_vid(dev, 0, 1);
- if (err)
- netdev_err(dev, "Failed to add VID 1\n");
-
- return err;
+ return mlxsw_sp_port_add_vid(dev, 0, 1);
}
static bool mlxsw_sp_master_bridge_check(struct mlxsw_sp *mlxsw_sp,
@@ -2362,10 +2359,8 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *dev,
return NOTIFY_BAD;
}
mlxsw_sp_master_bridge_inc(mlxsw_sp, upper_dev);
- mlxsw_sp_port->bridged = 1;
} else {
err = mlxsw_sp_port_bridge_leave(mlxsw_sp_port);
- mlxsw_sp_port->bridged = 0;
mlxsw_sp_master_bridge_dec(mlxsw_sp, upper_dev);
if (err) {
netdev_err(dev, "Failed to leave bridge\n");
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch net-next 4/4] mlxsw: spectrum: Change bridge port attributes only when bridged
2016-01-04 9:42 [patch net-next 0/4] mlxsw: couple of fixes Jiri Pirko
` (2 preceding siblings ...)
2016-01-04 9:42 ` [patch net-next 3/4] mlxsw: spectrum: Set bridge status in appropriate functions Jiri Pirko
@ 2016-01-04 9:42 ` Jiri Pirko
2016-01-05 3:08 ` [patch net-next 0/4] mlxsw: couple of fixes David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2016-01-04 9:42 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz
From: Ido Schimmel <idosch@mellanox.com>
Bridge port attributes are offloaded to hardware when invoked with SELF
flag set, but it really makes no sense to reflect them when port is not
bridged.
Allow a user to change these attribute only when port is bridged and
initialize them correctly when joining or leaving a bridge.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 17 +++++++++++------
.../net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 3 +++
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index ed2eb7b..74ff011 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1364,9 +1364,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port)
mlxsw_sp_port->dev = dev;
mlxsw_sp_port->mlxsw_sp = mlxsw_sp;
mlxsw_sp_port->local_port = local_port;
- mlxsw_sp_port->learning = 1;
- mlxsw_sp_port->learning_sync = 1;
- mlxsw_sp_port->uc_flood = 1;
bytes = DIV_ROUND_UP(VLAN_N_VID, BITS_PER_BYTE);
mlxsw_sp_port->active_vlans = kzalloc(bytes, GFP_KERNEL);
if (!mlxsw_sp_port->active_vlans) {
@@ -1989,16 +1986,24 @@ static int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port)
* own VLANs.
*/
err = mlxsw_sp_port_kill_vid(dev, 0, 1);
- if (!err)
- mlxsw_sp_port->bridged = 1;
+ if (err)
+ return err;
- return err;
+ mlxsw_sp_port->learning = 1;
+ mlxsw_sp_port->learning_sync = 1;
+ mlxsw_sp_port->uc_flood = 1;
+ mlxsw_sp_port->bridged = 1;
+
+ return 0;
}
static int mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port)
{
struct net_device *dev = mlxsw_sp_port->dev;
+ mlxsw_sp_port->learning = 0;
+ mlxsw_sp_port->learning_sync = 0;
+ mlxsw_sp_port->uc_flood = 0;
mlxsw_sp_port->bridged = 0;
/* Add implicit VLAN interface in the device, so that untagged
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 9476ff9..6215954 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -252,6 +252,9 @@ static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
bool set;
int err;
+ if (!mlxsw_sp_port->bridged)
+ return -EINVAL;
+
if (switchdev_trans_ph_prepare(trans))
return 0;
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch net-next 0/4] mlxsw: couple of fixes
2016-01-04 9:42 [patch net-next 0/4] mlxsw: couple of fixes Jiri Pirko
` (3 preceding siblings ...)
2016-01-04 9:42 ` [patch net-next 4/4] mlxsw: spectrum: Change bridge port attributes only when bridged Jiri Pirko
@ 2016-01-05 3:08 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-01-05 3:08 UTC (permalink / raw)
To: jiri; +Cc: netdev, idosch, eladr, yotamg, ogerlitz
From: Jiri Pirko <jiri@resnulli.us>
Date: Mon, 4 Jan 2016 10:42:22 +0100
> Couple of fixes from Ido.
Series applied, thanks Jiri.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-05 3:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-04 9:42 [patch net-next 0/4] mlxsw: couple of fixes Jiri Pirko
2016-01-04 9:42 ` [patch net-next 1/4] mlxsw: spectrum: Initialize PVID only once Jiri Pirko
2016-01-04 9:42 ` [patch net-next 2/4] mlxsw: spectrum: Return NOTIFY_BAD on bridge failure Jiri Pirko
2016-01-04 9:42 ` [patch net-next 3/4] mlxsw: spectrum: Set bridge status in appropriate functions Jiri Pirko
2016-01-04 9:42 ` [patch net-next 4/4] mlxsw: spectrum: Change bridge port attributes only when bridged Jiri Pirko
2016-01-05 3:08 ` [patch net-next 0/4] mlxsw: couple of fixes David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).