* [patch net-next 0/3] mlxsw: small driver update
@ 2015-11-19 11:27 Jiri Pirko
2015-11-19 11:27 ` [patch net-next 1/3] mlxsw: spectrum: Use correct PVID value when removing VLANs Jiri Pirko
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Jiri Pirko @ 2015-11-19 11:27 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg
From: Jiri Pirko <jiri@mellanox.com>
Couple of VLAN-related patches.
Ido Schimmel (3):
mlxsw: spectrum: Use correct PVID value when removing VLANs
mlxsw: spectrum: Unify setting of HW VLAN filters
mlxsw: spectrum: Add error paths to __mlxsw_sp_port_vlans_add
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 129 ++++++++++++++-------
1 file changed, 84 insertions(+), 45 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch net-next 1/3] mlxsw: spectrum: Use correct PVID value when removing VLANs
2015-11-19 11:27 [patch net-next 0/3] mlxsw: small driver update Jiri Pirko
@ 2015-11-19 11:27 ` Jiri Pirko
2015-11-19 11:27 ` [patch net-next 2/3] mlxsw: spectrum: Unify setting of HW VLAN filters Jiri Pirko
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2015-11-19 11:27 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg
From: Ido Schimmel <idosch@mellanox.com>
When removing a range of VLANs in which PVID is a member we should use
the correct PVID value instead of some VLAN in the range.
Also, change two print statements to use 'dev' instead of
'mlxsw_sp_port->dev', as it's already used in other print statements in
the function.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
.../net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 617fb22..be63398 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -532,7 +532,7 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port,
u16 vid_begin, u16 vid_end, bool init)
{
struct net_device *dev = mlxsw_sp_port->dev;
- u16 vid, vid_e;
+ u16 vid, vid_e, pvid;
int err;
/* In case this is invoked with BRIDGE_FLAGS_SELF and port is
@@ -549,23 +549,21 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port,
err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid_e, false,
false);
if (err) {
- netdev_err(mlxsw_sp_port->dev, "Unable to del VIDs %d-%d\n",
- vid, vid_e);
+ netdev_err(dev, "Unable to del VIDs %d-%d\n", vid,
+ vid_e);
return err;
}
}
- if ((mlxsw_sp_port->pvid >= vid_begin) &&
- (mlxsw_sp_port->pvid <= vid_end)) {
+ pvid = mlxsw_sp_port->pvid;
+ if (pvid >= vid_begin && pvid <= vid_end && pvid != 1) {
/* Default VLAN is always 1 */
- mlxsw_sp_port->pvid = 1;
- err = mlxsw_sp_port_pvid_set(mlxsw_sp_port,
- mlxsw_sp_port->pvid);
+ err = mlxsw_sp_port_pvid_set(mlxsw_sp_port, 1);
if (err) {
- netdev_err(mlxsw_sp_port->dev, "Unable to del PVID %d\n",
- vid);
+ netdev_err(dev, "Unable to del PVID %d\n", pvid);
return err;
}
+ mlxsw_sp_port->pvid = 1;
}
if (init)
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch net-next 2/3] mlxsw: spectrum: Unify setting of HW VLAN filters
2015-11-19 11:27 [patch net-next 0/3] mlxsw: small driver update Jiri Pirko
2015-11-19 11:27 ` [patch net-next 1/3] mlxsw: spectrum: Use correct PVID value when removing VLANs Jiri Pirko
@ 2015-11-19 11:27 ` Jiri Pirko
2015-11-19 11:27 ` [patch net-next 3/3] mlxsw: spectrum: Add error paths to __mlxsw_sp_port_vlans_add Jiri Pirko
2015-11-20 16:06 ` [patch net-next 0/3] mlxsw: small driver update David Miller
3 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2015-11-19 11:27 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg
From: Ido Schimmel <idosch@mellanox.com>
When adding or deleting VLANs from a bridged port, HW VLAN filters must be
set accordingly. Instead of having the same code in both add and delete
functions, just wrap it in a function and call it with the appropriate
parameters.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 58 +++++++++++++---------
1 file changed, 34 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index be63398..fe88165 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -342,6 +342,27 @@ err_port_add_vid:
return err;
}
+static int __mlxsw_sp_port_vlans_set(struct mlxsw_sp_port *mlxsw_sp_port,
+ u16 vid_begin, u16 vid_end, bool is_member,
+ bool untagged)
+{
+ u16 vid, vid_e;
+ int err;
+
+ for (vid = vid_begin; vid <= vid_end;
+ vid += MLXSW_REG_SPVM_REC_MAX_COUNT) {
+ vid_e = min((u16) (vid + MLXSW_REG_SPVM_REC_MAX_COUNT - 1),
+ vid_end);
+
+ err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid_e,
+ is_member, untagged);
+ if (err)
+ return err;
+ }
+
+ return 0;
+}
+
static int __mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
u16 vid_begin, u16 vid_end,
bool flag_untagged, bool flag_pvid)
@@ -396,18 +417,12 @@ static int __mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
return err;
}
- for (vid = vid_begin; vid <= vid_end;
- vid += MLXSW_REG_SPVM_REC_MAX_COUNT) {
- vid_e = min((u16) (vid + MLXSW_REG_SPVM_REC_MAX_COUNT - 1),
- vid_end);
-
- err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid_e, true,
- flag_untagged);
- if (err) {
- netdev_err(mlxsw_sp_port->dev, "Unable to add VIDs %d-%d\n",
- vid, vid_e);
- return err;
- }
+ err = __mlxsw_sp_port_vlans_set(mlxsw_sp_port, vid_begin, vid_end,
+ true, flag_untagged);
+ if (err) {
+ netdev_err(dev, "Unable to add VIDs %d-%d\n", vid_begin,
+ vid_end);
+ return err;
}
vid = vid_begin;
@@ -532,7 +547,7 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port,
u16 vid_begin, u16 vid_end, bool init)
{
struct net_device *dev = mlxsw_sp_port->dev;
- u16 vid, vid_e, pvid;
+ u16 vid, pvid;
int err;
/* In case this is invoked with BRIDGE_FLAGS_SELF and port is
@@ -542,17 +557,12 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port,
if (!init && !mlxsw_sp_port->bridged)
return mlxsw_sp_port_kill_vids(dev, vid_begin, vid_end);
- for (vid = vid_begin; vid <= vid_end;
- vid += MLXSW_REG_SPVM_REC_MAX_COUNT) {
- vid_e = min((u16) (vid + MLXSW_REG_SPVM_REC_MAX_COUNT - 1),
- vid_end);
- err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid_e, false,
- false);
- if (err) {
- netdev_err(dev, "Unable to del VIDs %d-%d\n", vid,
- vid_e);
- return err;
- }
+ err = __mlxsw_sp_port_vlans_set(mlxsw_sp_port, vid_begin, vid_end,
+ false, false);
+ if (err) {
+ netdev_err(dev, "Unable to del VIDs %d-%d\n", vid_begin,
+ vid_end);
+ return err;
}
pvid = mlxsw_sp_port->pvid;
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch net-next 3/3] mlxsw: spectrum: Add error paths to __mlxsw_sp_port_vlans_add
2015-11-19 11:27 [patch net-next 0/3] mlxsw: small driver update Jiri Pirko
2015-11-19 11:27 ` [patch net-next 1/3] mlxsw: spectrum: Use correct PVID value when removing VLANs Jiri Pirko
2015-11-19 11:27 ` [patch net-next 2/3] mlxsw: spectrum: Unify setting of HW VLAN filters Jiri Pirko
@ 2015-11-19 11:27 ` Jiri Pirko
2015-11-20 16:06 ` [patch net-next 0/3] mlxsw: small driver update David Miller
3 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2015-11-19 11:27 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg
From: Ido Schimmel <idosch@mellanox.com>
The operation of adding VLANs on a port via switchdev ops can fail and
we need to be prepared for it. If we do not rollback hardware operations
following a failure, hardware and software will remain in an
inconsistent state.
Solve that by adding suitable error paths to __mlxsw_sp_port_vlans_add.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 61 ++++++++++++++++------
1 file changed, 46 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index fe88165..f21e239 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -369,8 +369,8 @@ static int __mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
{
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
struct net_device *dev = mlxsw_sp_port->dev;
+ u16 vid, last_visited_vid, old_pvid;
enum mlxsw_reg_svfa_mt mt;
- u16 vid, vid_e;
int err;
/* In case this is invoked with BRIDGE_FLAGS_SELF and port is
@@ -398,15 +398,18 @@ static int __mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
if (err) {
netdev_err(dev, "Failed to create FID=VID=%d mapping\n",
vid);
- return err;
+ goto err_port_vid_to_fid_set;
}
}
+ }
- /* Set FID mapping according to port's mode */
+ /* Set FID mapping according to port's mode */
+ for (vid = vid_begin; vid <= vid_end; vid++) {
err = mlxsw_sp_port_fid_map(mlxsw_sp_port, vid);
if (err) {
netdev_err(dev, "Failed to map FID=%d", vid);
- return err;
+ last_visited_vid = --vid;
+ goto err_port_fid_map;
}
}
@@ -414,7 +417,7 @@ static int __mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
true, false);
if (err) {
netdev_err(dev, "Failed to configure flooding\n");
- return err;
+ goto err_port_flood_set;
}
err = __mlxsw_sp_port_vlans_set(mlxsw_sp_port, vid_begin, vid_end,
@@ -422,26 +425,54 @@ static int __mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
if (err) {
netdev_err(dev, "Unable to add VIDs %d-%d\n", vid_begin,
vid_end);
- return err;
+ goto err_port_vlans_set;
}
- vid = vid_begin;
- if (flag_pvid && mlxsw_sp_port->pvid != vid) {
- err = mlxsw_sp_port_pvid_set(mlxsw_sp_port, vid);
+ old_pvid = mlxsw_sp_port->pvid;
+ if (flag_pvid && old_pvid != vid_begin) {
+ err = mlxsw_sp_port_pvid_set(mlxsw_sp_port, vid_begin);
if (err) {
- netdev_err(mlxsw_sp_port->dev, "Unable to add PVID %d\n",
- vid);
- return err;
+ netdev_err(dev, "Unable to add PVID %d\n", vid_begin);
+ goto err_port_pvid_set;
}
- mlxsw_sp_port->pvid = vid;
+ mlxsw_sp_port->pvid = vid_begin;
}
/* Changing activity bits only if HW operation succeded */
for (vid = vid_begin; vid <= vid_end; vid++)
set_bit(vid, mlxsw_sp_port->active_vlans);
- return mlxsw_sp_port_stp_state_set(mlxsw_sp_port,
- mlxsw_sp_port->stp_state);
+ /* STP state change must be done after we set active VLANs */
+ err = mlxsw_sp_port_stp_state_set(mlxsw_sp_port,
+ mlxsw_sp_port->stp_state);
+ if (err) {
+ netdev_err(dev, "Failed to set STP state\n");
+ goto err_port_stp_state_set;
+ }
+
+ return 0;
+
+err_port_vid_to_fid_set:
+ mlxsw_sp_fid_destroy(mlxsw_sp, vid);
+ return err;
+
+err_port_stp_state_set:
+ for (vid = vid_begin; vid <= vid_end; vid++)
+ clear_bit(vid, mlxsw_sp_port->active_vlans);
+ if (old_pvid != mlxsw_sp_port->pvid)
+ mlxsw_sp_port_pvid_set(mlxsw_sp_port, old_pvid);
+err_port_pvid_set:
+ __mlxsw_sp_port_vlans_set(mlxsw_sp_port, vid_begin, vid_end, false,
+ false);
+err_port_vlans_set:
+ __mlxsw_sp_port_flood_set(mlxsw_sp_port, vid_begin, vid_end, false,
+ false);
+err_port_flood_set:
+ last_visited_vid = vid_end;
+err_port_fid_map:
+ for (vid = last_visited_vid; vid >= vid_begin; vid--)
+ mlxsw_sp_port_fid_unmap(mlxsw_sp_port, vid);
+ return err;
}
static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch net-next 0/3] mlxsw: small driver update
2015-11-19 11:27 [patch net-next 0/3] mlxsw: small driver update Jiri Pirko
` (2 preceding siblings ...)
2015-11-19 11:27 ` [patch net-next 3/3] mlxsw: spectrum: Add error paths to __mlxsw_sp_port_vlans_add Jiri Pirko
@ 2015-11-20 16:06 ` David Miller
3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-11-20 16:06 UTC (permalink / raw)
To: jiri; +Cc: netdev, idosch, eladr, yotamg
From: Jiri Pirko <jiri@resnulli.us>
Date: Thu, 19 Nov 2015 12:27:37 +0100
> Couple of VLAN-related patches.
Series applied.
I'm really pleased with this driver and work you guys are doing
on it.
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch net-next 0/3] mlxsw: small driver update
@ 2015-08-24 14:45 Jiri Pirko
0 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2015-08-24 14:45 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, ogerlitz
From: Jiri Pirko <jiri@mellanox.com>
Ido Schimmel (1):
mlxsw: Remove duplicate included header
Jiri Pirko (2):
mlxsw: expose EMAD transactions statistics via debugfs
mlxsw: adjust log messages level in __mlxsw_emad_transmit
drivers/net/ethernet/mellanox/mlxsw/core.c | 60 ++++++++++++++++++++++++++----
1 file changed, 52 insertions(+), 8 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-20 16:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-19 11:27 [patch net-next 0/3] mlxsw: small driver update Jiri Pirko
2015-11-19 11:27 ` [patch net-next 1/3] mlxsw: spectrum: Use correct PVID value when removing VLANs Jiri Pirko
2015-11-19 11:27 ` [patch net-next 2/3] mlxsw: spectrum: Unify setting of HW VLAN filters Jiri Pirko
2015-11-19 11:27 ` [patch net-next 3/3] mlxsw: spectrum: Add error paths to __mlxsw_sp_port_vlans_add Jiri Pirko
2015-11-20 16:06 ` [patch net-next 0/3] mlxsw: small driver update David Miller
-- strict thread matches above, loose matches on Subject: below --
2015-08-24 14:45 Jiri Pirko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.