netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/3] mlxsw: Various fixes
@ 2019-09-26 11:43 Ido Schimmel
  2019-09-26 11:43 ` [PATCH net 1/3] mlxsw: spectrum: Clear VLAN filters during port initialization Ido Schimmel
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ido Schimmel @ 2019-09-26 11:43 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, alexanderk, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

This patchset includes two small fixes for the mlxsw driver and one
patch which clarifies recently introduced devlink-trap documentation.

Patch #1 clears the port's VLAN filters during port initialization. This
ensures that the drop reason reported to the user is consistent. The
problem is explained in detail in the commit message.

Patch #2 clarifies the description of one of the traps exposed via
devlink-trap.

Patch #3 from Danielle forbids the installation of a tc filter with
multiple mirror actions since this is not supported by the device. The
failure is communicated to the user via extack.

Danielle Ratson (1):
  mlxsw: spectrum_flower: Fail in case user specifies multiple mirror
    actions

Ido Schimmel (2):
  mlxsw: spectrum: Clear VLAN filters during port initialization
  Documentation: Clarify trap's description

 Documentation/networking/devlink-trap.rst                | 3 ++-
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c           | 9 +++++++++
 drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c    | 6 ++++++
 .../selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh | 7 -------
 4 files changed, 17 insertions(+), 8 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/3] mlxsw: spectrum: Clear VLAN filters during port initialization
  2019-09-26 11:43 [PATCH net 0/3] mlxsw: Various fixes Ido Schimmel
@ 2019-09-26 11:43 ` Ido Schimmel
  2019-09-26 11:43 ` [PATCH net 2/3] Documentation: Clarify trap's description Ido Schimmel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2019-09-26 11:43 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, alexanderk, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

When a port is created, its VLAN filters are not cleared by the
firmware. This causes tagged packets to be later dropped by the ingress
STP filters, which default to DISCARD state.

The above did not matter much until commit b5ce611fd96e ("mlxsw:
spectrum: Add devlink-trap support") where we exposed the drop reason to
users.

Without this patch, the drop reason users will see is not consistent. If
a port is enslaved to a VLAN-aware bridge and a packet with an invalid
VLAN tries to ingress the bridge, it will be dropped due to ingress STP
filter. If the VLAN is later enabled and then disabled, the packet will
be dropped by the ingress VLAN filter despite the above being a
seemingly NOP operation.

Fix this by clearing all the VLAN filters during port initialization.
Adjust the test accordingly.

Fixes: b5ce611fd96e ("mlxsw: spectrum: Add devlink-trap support")
Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
Tested-by: Alex Kushnarov <alexanderk@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c           | 9 +++++++++
 .../selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh | 7 -------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index dd234cf7b39d..dcf9562bce8a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -3771,6 +3771,14 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
 		goto err_port_qdiscs_init;
 	}
 
+	err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, 0, VLAN_N_VID - 1, false,
+				     false);
+	if (err) {
+		dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to clear VLAN filter\n",
+			mlxsw_sp_port->local_port);
+		goto err_port_vlan_clear;
+	}
+
 	err = mlxsw_sp_port_nve_init(mlxsw_sp_port);
 	if (err) {
 		dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize NVE\n",
@@ -3818,6 +3826,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
 err_port_pvid_set:
 	mlxsw_sp_port_nve_fini(mlxsw_sp_port);
 err_port_nve_init:
+err_port_vlan_clear:
 	mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port);
 err_port_qdiscs_init:
 	mlxsw_sp_port_fids_fini(mlxsw_sp_port);
diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh
index 5dcdfa20fc6c..126caf28b529 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh
@@ -224,13 +224,6 @@ ingress_vlan_filter_test()
 	local vid=10
 
 	bridge vlan add vid $vid dev $swp2 master
-	# During initialization the firmware enables all the VLAN filters and
-	# the driver does not turn them off since the traffic will be discarded
-	# by the STP filter whose default is DISCARD state. Add the VID on the
-	# ingress bridge port and then remove it to make sure it is not member
-	# in the VLAN.
-	bridge vlan add vid $vid dev $swp1 master
-	bridge vlan del vid $vid dev $swp1 master
 
 	RET=0
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/3] Documentation: Clarify trap's description
  2019-09-26 11:43 [PATCH net 0/3] mlxsw: Various fixes Ido Schimmel
  2019-09-26 11:43 ` [PATCH net 1/3] mlxsw: spectrum: Clear VLAN filters during port initialization Ido Schimmel
@ 2019-09-26 11:43 ` Ido Schimmel
  2019-09-26 11:43 ` [PATCH net 3/3] mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions Ido Schimmel
  2019-09-27 18:33 ` [PATCH net 0/3] mlxsw: Various fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2019-09-26 11:43 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, alexanderk, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

Alex noted that the below description might not be obvious to all users.
Clarify it by adding an example.

Fixes: f3047ca01f12 ("Documentation: Add devlink-trap documentation")
Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
Reviewed-by: Alex Kushnarov <alexanderk@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 Documentation/networking/devlink-trap.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/networking/devlink-trap.rst b/Documentation/networking/devlink-trap.rst
index c20c7c483664..8e90a85f3bd5 100644
--- a/Documentation/networking/devlink-trap.rst
+++ b/Documentation/networking/devlink-trap.rst
@@ -143,7 +143,8 @@ be added to the following table:
    * - ``port_list_is_empty``
      - ``drop``
      - Traps packets that the device decided to drop in case they need to be
-       flooded and the flood list is empty
+       flooded (e.g., unknown unicast, unregistered multicast) and there are
+       no ports the packets should be flooded to
    * - ``port_loopback_filter``
      - ``drop``
      - Traps packets that the device decided to drop in case after layer 2
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 3/3] mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions
  2019-09-26 11:43 [PATCH net 0/3] mlxsw: Various fixes Ido Schimmel
  2019-09-26 11:43 ` [PATCH net 1/3] mlxsw: spectrum: Clear VLAN filters during port initialization Ido Schimmel
  2019-09-26 11:43 ` [PATCH net 2/3] Documentation: Clarify trap's description Ido Schimmel
@ 2019-09-26 11:43 ` Ido Schimmel
  2019-09-27 18:33 ` [PATCH net 0/3] mlxsw: Various fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2019-09-26 11:43 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, alexanderk, mlxsw, Danielle Ratson, Ido Schimmel

From: Danielle Ratson <danieller@mellanox.com>

The ASIC can only mirror a packet to one port, but when user is trying
to set more than one mirror action, it doesn't fail.

Add a check if more than one mirror action was specified per rule and if so,
fail for not being supported.

Fixes: d0d13c1858a11 ("mlxsw: spectrum_acl: Add support for mirror action")
Signed-off-by: Danielle Ratson <danieller@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
index 0ad1a24abfc6..b607919c8ad0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
@@ -21,6 +21,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
 					 struct netlink_ext_ack *extack)
 {
 	const struct flow_action_entry *act;
+	int mirror_act_count = 0;
 	int err, i;
 
 	if (!flow_action_has_entries(flow_action))
@@ -105,6 +106,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
 		case FLOW_ACTION_MIRRED: {
 			struct net_device *out_dev = act->dev;
 
+			if (mirror_act_count++) {
+				NL_SET_ERR_MSG_MOD(extack, "Multiple mirror actions per rule are not supported");
+				return -EOPNOTSUPP;
+			}
+
 			err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei,
 							    block, out_dev,
 							    extack);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/3] mlxsw: Various fixes
  2019-09-26 11:43 [PATCH net 0/3] mlxsw: Various fixes Ido Schimmel
                   ` (2 preceding siblings ...)
  2019-09-26 11:43 ` [PATCH net 3/3] mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions Ido Schimmel
@ 2019-09-27 18:33 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-09-27 18:33 UTC (permalink / raw)
  To: idosch; +Cc: netdev, jiri, alexanderk, mlxsw, idosch

From: Ido Schimmel <idosch@idosch.org>
Date: Thu, 26 Sep 2019 14:43:37 +0300

> From: Ido Schimmel <idosch@mellanox.com>
> 
> This patchset includes two small fixes for the mlxsw driver and one
> patch which clarifies recently introduced devlink-trap documentation.
> 
> Patch #1 clears the port's VLAN filters during port initialization. This
> ensures that the drop reason reported to the user is consistent. The
> problem is explained in detail in the commit message.
> 
> Patch #2 clarifies the description of one of the traps exposed via
> devlink-trap.
> 
> Patch #3 from Danielle forbids the installation of a tc filter with
> multiple mirror actions since this is not supported by the device. The
> failure is communicated to the user via extack.

Series applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-27 18:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26 11:43 [PATCH net 0/3] mlxsw: Various fixes Ido Schimmel
2019-09-26 11:43 ` [PATCH net 1/3] mlxsw: spectrum: Clear VLAN filters during port initialization Ido Schimmel
2019-09-26 11:43 ` [PATCH net 2/3] Documentation: Clarify trap's description Ido Schimmel
2019-09-26 11:43 ` [PATCH net 3/3] mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions Ido Schimmel
2019-09-27 18:33 ` [PATCH net 0/3] mlxsw: Various 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).