All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/7] mlxsw: Various fixes
@ 2019-04-10  6:58 Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 1/7] mlxsw: spectrum_switchdev: Add MDB entries in prepare phase Ido Schimmel
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Ido Schimmel @ 2019-04-10  6:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Ido Schimmel

This patchset contains various small fixes for mlxsw.

Patch #1 fixes a warning generated by switchdev core when the driver
fails to insert an MDB entry in the commit phase.

Patches #2-#4 fix a warning in check_flush_dependency() that can be
triggered when a work item in a WQ_MEM_RECLAIM workqueue tries to flush
a non-WQ_MEM_RECLAIM workqueue.

It seems that the semantics of the WQ_MEM_RECLAIM flag are not very
clear [1] and that various patches have been sent to remove it from
various workqueues throughout the kernel [2][3][4] in order to silence
the warning.

These patches do the same for the workqueues created by mlxsw that
probably should not have been created with this flag in the first place.

Patch #5 fixes a regression where an IP address cannot be assigned to a
VRF upper due to erroneous MAC validation check. Patch #6 adds a test
case.

Patch #7 adjusts Spectrum-2 shared buffer configuration to be compatible
with Spectrum-1. The problem and fix are described in detail in the
commit message.

Please consider patches #1-#5 for 5.0.y. I verified they apply cleanly.

[1] https://patchwork.kernel.org/patch/10791315/
[2] Commit ce162bfbc0b6 ("mac80211_hwsim: don't use WQ_MEM_RECLAIM")
[3] Commit 39baf10310e6 ("IB/core: Fix use workqueue without WQ_MEM_RECLAIM")
[4] Commit 75215e5bb22c ("iwcm: Don't allocate iwcm workqueue with WQ_MEM_RECLAIM")

Ido Schimmel (7):
  mlxsw: spectrum_switchdev: Add MDB entries in prepare phase
  mlxsw: core: Do not use WQ_MEM_RECLAIM for EMAD workqueue
  mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw ordered workqueue
  mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw workqueue
  mlxsw: spectrum_router: Do not check VRF MAC address
  selftests: mlxsw: Test VRF MAC vetoing
  mlxsw: spectrum_buffers: Add a multicast pool for Spectrum-2

 drivers/net/ethernet/mellanox/mlxsw/core.c    |  6 +++---
 .../mellanox/mlxsw/spectrum_buffers.c         | 19 ++++++++++--------
 .../ethernet/mellanox/mlxsw/spectrum_router.c |  2 +-
 .../mellanox/mlxsw/spectrum_switchdev.c       |  2 +-
 .../selftests/drivers/net/mlxsw/rtnetlink.sh  | 20 +++++++++++++++++++
 5 files changed, 36 insertions(+), 13 deletions(-)

-- 
2.20.1


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

* [PATCH net 1/7] mlxsw: spectrum_switchdev: Add MDB entries in prepare phase
  2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
@ 2019-04-10  6:58 ` Ido Schimmel
  2019-04-10 13:39   ` Jiri Pirko
  2019-04-10  6:58 ` [PATCH net 2/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for EMAD workqueue Ido Schimmel
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Ido Schimmel @ 2019-04-10  6:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Ido Schimmel

The driver cannot guarantee in the prepare phase that it will be able to
write an MDB entry to the device. In case the driver returned success
during the prepare phase, but then failed to add the entry in the commit
phase, a WARNING [1] will be generated by the switchdev core.

Fix this by doing the work in the prepare phase instead.

[1]
[  358.544486] swp12s0: Commit of object (id=2) failed.
[  358.550061] WARNING: CPU: 0 PID: 30 at net/switchdev/switchdev.c:281 switchdev_port_obj_add_now+0x9b/0xe0
[  358.560754] CPU: 0 PID: 30 Comm: kworker/0:1 Not tainted 5.0.0-custom-13382-gf2449babf221 #1350
[  358.570472] Hardware name: Mellanox Technologies Ltd. MSN2100-CB2FO/SA001017, BIOS 5.6.5 06/07/2016
[  358.580582] Workqueue: events switchdev_deferred_process_work
[  358.587001] RIP: 0010:switchdev_port_obj_add_now+0x9b/0xe0
...
[  358.614109] RSP: 0018:ffffa6b900d6fe18 EFLAGS: 00010286
[  358.619943] RAX: 0000000000000000 RBX: ffff8b00797ff000 RCX: 0000000000000000
[  358.627912] RDX: ffff8b00b7a1d4c0 RSI: ffff8b00b7a152e8 RDI: ffff8b00b7a152e8
[  358.635881] RBP: ffff8b005c3f5bc0 R08: 000000000000022b R09: 0000000000000000
[  358.643850] R10: 0000000000000000 R11: ffffa6b900d6fcc8 R12: 0000000000000000
[  358.651819] R13: dead000000000100 R14: ffff8b00b65a23c0 R15: 0ffff8b00b7a2200
[  358.659790] FS:  0000000000000000(0000) GS:ffff8b00b7a00000(0000) knlGS:0000000000000000
[  358.668820] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  358.675228] CR2: 00007f00aad90de0 CR3: 00000001ca80d000 CR4: 00000000001006f0
[  358.683188] Call Trace:
[  358.685918]  switchdev_port_obj_add_deferred+0x13/0x60
[  358.691655]  switchdev_deferred_process+0x6b/0xf0
[  358.696907]  switchdev_deferred_process_work+0xa/0x10
[  358.702548]  process_one_work+0x1f5/0x3f0
[  358.707022]  worker_thread+0x28/0x3c0
[  358.711099]  ? process_one_work+0x3f0/0x3f0
[  358.715768]  kthread+0x10d/0x130
[  358.719369]  ? __kthread_create_on_node+0x180/0x180
[  358.724815]  ret_from_fork+0x35/0x40

Fixes: 3a49b4fde2a1 ("mlxsw: Adding layer 2 multicast support")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
Tested-by: Alex Kushnarov <alexanderk@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index f6ce386c3036..50111f228d77 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -1630,7 +1630,7 @@ static int mlxsw_sp_port_mdb_add(struct mlxsw_sp_port *mlxsw_sp_port,
 	u16 fid_index;
 	int err = 0;
 
-	if (switchdev_trans_ph_prepare(trans))
+	if (switchdev_trans_ph_commit(trans))
 		return 0;
 
 	bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev);
-- 
2.20.1


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

* [PATCH net 2/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for EMAD workqueue
  2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 1/7] mlxsw: spectrum_switchdev: Add MDB entries in prepare phase Ido Schimmel
@ 2019-04-10  6:58 ` Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 3/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw ordered workqueue Ido Schimmel
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ido Schimmel @ 2019-04-10  6:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Ido Schimmel

The EMAD workqueue is used to handle retransmission of EMAD packets that
contain configuration data for the device's firmware.

Given the workers need to allocate these packets and that the code is
not called as part of memory reclaim path, remove the WQ_MEM_RECLAIM
flag.

Fixes: d965465b60ba ("mlxsw: core: Fix possible deadlock")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index d23d53c0e284..91cd6fa42e9a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -568,7 +568,7 @@ static int mlxsw_emad_init(struct mlxsw_core *mlxsw_core)
 	if (!(mlxsw_core->bus->features & MLXSW_BUS_F_TXRX))
 		return 0;
 
-	emad_wq = alloc_workqueue("mlxsw_core_emad", WQ_MEM_RECLAIM, 0);
+	emad_wq = alloc_workqueue("mlxsw_core_emad", 0, 0);
 	if (!emad_wq)
 		return -ENOMEM;
 	mlxsw_core->emad_wq = emad_wq;
-- 
2.20.1


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

* [PATCH net 3/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw ordered workqueue
  2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 1/7] mlxsw: spectrum_switchdev: Add MDB entries in prepare phase Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 2/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for EMAD workqueue Ido Schimmel
@ 2019-04-10  6:58 ` Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 5/7] mlxsw: spectrum_router: Do not check VRF MAC address Ido Schimmel
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ido Schimmel @ 2019-04-10  6:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Ido Schimmel

The ordered workqueue is used to offload various objects such as routes
and neighbours in the order they are notified.

It should not be called as part of memory reclaim path, so remove the
WQ_MEM_RECLAIM flag. This can also result in a warning [1], if a worker
tries to flush a non-WQ_MEM_RECLAIM workqueue.

[1]
[97703.542861] workqueue: WQ_MEM_RECLAIM mlxsw_core_ordered:mlxsw_sp_router_fib6_event_work [mlxsw_spectrum] is flushing !WQ_MEM_RECLAIM events:rht_deferred_worker
[97703.542884] WARNING: CPU: 1 PID: 32492 at kernel/workqueue.c:2605 check_flush_dependency+0xb5/0x130
...
[97703.542988] Hardware name: Mellanox Technologies Ltd. MSN3700C/VMOD0008, BIOS 5.11 10/10/2018
[97703.543049] Workqueue: mlxsw_core_ordered mlxsw_sp_router_fib6_event_work [mlxsw_spectrum]
[97703.543061] RIP: 0010:check_flush_dependency+0xb5/0x130
...
[97703.543071] RSP: 0018:ffffb3f08137bc00 EFLAGS: 00010086
[97703.543076] RAX: 0000000000000000 RBX: ffff96e07740ae00 RCX: 0000000000000000
[97703.543080] RDX: 0000000000000094 RSI: ffffffff82dc1934 RDI: 0000000000000046
[97703.543084] RBP: ffffb3f08137bc20 R08: ffffffff82dc18a0 R09: 00000000000225c0
[97703.543087] R10: 0000000000000000 R11: 0000000000007eec R12: ffffffff816e4ee0
[97703.543091] R13: ffff96e06f6a5c00 R14: ffff96e077ba7700 R15: ffffffff812ab0c0
[97703.543097] FS: 0000000000000000(0000) GS:ffff96e077a80000(0000) knlGS:0000000000000000
[97703.543101] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[97703.543104] CR2: 00007f8cd135b280 CR3: 00000001e860e003 CR4: 00000000003606e0
[97703.543109] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[97703.543112] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[97703.543115] Call Trace:
[97703.543129] __flush_work+0xbd/0x1e0
[97703.543137] ? __cancel_work_timer+0x136/0x1b0
[97703.543145] ? pwq_dec_nr_in_flight+0x49/0xa0
[97703.543154] __cancel_work_timer+0x136/0x1b0
[97703.543175] ? mlxsw_reg_trans_bulk_wait+0x145/0x400 [mlxsw_core]
[97703.543184] cancel_work_sync+0x10/0x20
[97703.543191] rhashtable_free_and_destroy+0x23/0x140
[97703.543198] rhashtable_destroy+0xd/0x10
[97703.543254] mlxsw_sp_fib_destroy+0xb1/0xf0 [mlxsw_spectrum]
[97703.543310] mlxsw_sp_vr_put+0xa8/0xc0 [mlxsw_spectrum]
[97703.543364] mlxsw_sp_fib_node_put+0xbf/0x140 [mlxsw_spectrum]
[97703.543418] ? mlxsw_sp_fib6_entry_destroy+0xe8/0x110 [mlxsw_spectrum]
[97703.543475] mlxsw_sp_router_fib6_event_work+0x6cd/0x7f0 [mlxsw_spectrum]
[97703.543484] process_one_work+0x1fd/0x400
[97703.543493] worker_thread+0x34/0x410
[97703.543500] kthread+0x121/0x140
[97703.543507] ? process_one_work+0x400/0x400
[97703.543512] ? kthread_park+0x90/0x90
[97703.543523] ret_from_fork+0x35/0x40

Fixes: a3832b31898f ("mlxsw: core: Create an ordered workqueue for FIB offload")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Semion Lisyansky <semionl@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 91cd6fa42e9a..2c0e3281bd7a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -1961,7 +1961,7 @@ static int __init mlxsw_core_module_init(void)
 	mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, WQ_MEM_RECLAIM, 0);
 	if (!mlxsw_wq)
 		return -ENOMEM;
-	mlxsw_owq = alloc_ordered_workqueue("%s_ordered", WQ_MEM_RECLAIM,
+	mlxsw_owq = alloc_ordered_workqueue("%s_ordered", 0,
 					    mlxsw_core_driver_name);
 	if (!mlxsw_owq) {
 		err = -ENOMEM;
-- 
2.20.1


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

* [PATCH net 4/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw workqueue
  2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
                   ` (3 preceding siblings ...)
  2019-04-10  6:58 ` [PATCH net 5/7] mlxsw: spectrum_router: Do not check VRF MAC address Ido Schimmel
@ 2019-04-10  6:58 ` Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 6/7] selftests: mlxsw: Test VRF MAC vetoing Ido Schimmel
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ido Schimmel @ 2019-04-10  6:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Ido Schimmel

The workqueue is used to periodically update the networking stack about
activity / statistics of various objects such as neighbours and TC
actions.

It should not be called as part of memory reclaim path, so remove the
WQ_MEM_RECLAIM flag.

Fixes: 3d5479e92087 ("mlxsw: core: Remove deprecated create_workqueue")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 2c0e3281bd7a..f26a4ca29363 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -1958,7 +1958,7 @@ static int __init mlxsw_core_module_init(void)
 {
 	int err;
 
-	mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, WQ_MEM_RECLAIM, 0);
+	mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, 0, 0);
 	if (!mlxsw_wq)
 		return -ENOMEM;
 	mlxsw_owq = alloc_ordered_workqueue("%s_ordered", 0,
-- 
2.20.1


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

* [PATCH net 5/7] mlxsw: spectrum_router: Do not check VRF MAC address
  2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
                   ` (2 preceding siblings ...)
  2019-04-10  6:58 ` [PATCH net 3/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw ordered workqueue Ido Schimmel
@ 2019-04-10  6:58 ` Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 4/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw workqueue Ido Schimmel
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ido Schimmel @ 2019-04-10  6:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Ido Schimmel

Commit 74bc99397438 ("mlxsw: spectrum_router: Veto unsupported RIF MAC
addresses") enabled the driver to veto router interface (RIF) MAC
addresses that it cannot support.

This check should only be performed for interfaces for which the driver
actually configures a RIF. A VRF upper is not one of them, so ignore it.

Without this patch it is not possible to set an IP address on the VRF
device and use it as a loopback.

Fixes: 74bc99397438 ("mlxsw: spectrum_router: Veto unsupported RIF MAC addresses")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Alexander Petrovskiy <alexpe@mellanox.com>
Tested-by: Alexander Petrovskiy <alexpe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 52fed8c7bf1e..902e766a8ed3 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -6781,7 +6781,7 @@ static int mlxsw_sp_router_port_check_rif_addr(struct mlxsw_sp *mlxsw_sp,
 	/* A RIF is not created for macvlan netdevs. Their MAC is used to
 	 * populate the FDB
 	 */
-	if (netif_is_macvlan(dev))
+	if (netif_is_macvlan(dev) || netif_is_l3_master(dev))
 		return 0;
 
 	for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) {
-- 
2.20.1


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

* [PATCH net 6/7] selftests: mlxsw: Test VRF MAC vetoing
  2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
                   ` (4 preceding siblings ...)
  2019-04-10  6:58 ` [PATCH net 4/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw workqueue Ido Schimmel
@ 2019-04-10  6:58 ` Ido Schimmel
  2019-04-10  6:58 ` [PATCH net 7/7] mlxsw: spectrum_buffers: Add a multicast pool for Spectrum-2 Ido Schimmel
  2019-04-10 18:58 ` [PATCH net 0/7] mlxsw: Various fixes David Miller
  7 siblings, 0 replies; 11+ messages in thread
From: Ido Schimmel @ 2019-04-10  6:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Ido Schimmel

Test that it is possible to set an IP address on a VRF and that it is
not vetoed.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 .../selftests/drivers/net/mlxsw/rtnetlink.sh  | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh b/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
index c4cf6e6d800e..a6c196c8534c 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
@@ -11,6 +11,7 @@ lib_dir=$(dirname $0)/../../../net/forwarding
 
 ALL_TESTS="
 	rif_set_addr_test
+	rif_vrf_set_addr_test
 	rif_inherit_bridge_addr_test
 	rif_non_inherit_bridge_addr_test
 	vlan_interface_deletion_test
@@ -98,6 +99,25 @@ rif_set_addr_test()
 	ip link set dev $swp1 addr $swp1_mac
 }
 
+rif_vrf_set_addr_test()
+{
+	# Test that it is possible to set an IP address on a VRF upper despite
+	# its random MAC address.
+	RET=0
+
+	ip link add name vrf-test type vrf table 10
+	ip link set dev $swp1 master vrf-test
+
+	ip -4 address add 192.0.2.1/24 dev vrf-test
+	check_err $? "failed to set IPv4 address on VRF"
+	ip -6 address add 2001:db8:1::1/64 dev vrf-test
+	check_err $? "failed to set IPv6 address on VRF"
+
+	log_test "RIF - setting IP address on VRF"
+
+	ip link del dev vrf-test
+}
+
 rif_inherit_bridge_addr_test()
 {
 	RET=0
-- 
2.20.1


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

* [PATCH net 7/7] mlxsw: spectrum_buffers: Add a multicast pool for Spectrum-2
  2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
                   ` (5 preceding siblings ...)
  2019-04-10  6:58 ` [PATCH net 6/7] selftests: mlxsw: Test VRF MAC vetoing Ido Schimmel
@ 2019-04-10  6:58 ` Ido Schimmel
  2019-04-10 13:40   ` Jiri Pirko
  2019-04-10 18:58 ` [PATCH net 0/7] mlxsw: Various fixes David Miller
  7 siblings, 1 reply; 11+ messages in thread
From: Ido Schimmel @ 2019-04-10  6:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Ido Schimmel

In Spectrum-1, when a multicast packet is admitted to the shared buffer
it increases the quotas of all the ports and {port, TC} to which it is
forwarded to.

The above means that multicast packets are accounted multiple times in
the shared buffer and can therefore cause the associated shared buffer
pool to fill up very quickly.

To work around this issue, commit e83c045e53d7 ("mlxsw:
spectrum_buffers: Configure MC pool") added a dedicated multicast pool
in which multicast packets are accounted.

The issue is not present in Spectrum-2, but in order to be backward
compatible with Spectrum-1, its default behavior is to allow a multicast
packet to increase multiple egress quotas instead of one.

Until the new (non-backward compatible) mode is supported, configure a
dedicated multicast pool as in Spectrum-1.

Fixes: fe099bf682ab ("mlxsw: spectrum_buffers: Add Spectrum-2 shared buffer configuration")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
---
 .../mellanox/mlxsw/spectrum_buffers.c         | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
index 9a79b5e11597..d633bef5f105 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
@@ -70,6 +70,7 @@ static const struct mlxsw_sp_sb_pool_des mlxsw_sp2_sb_pool_dess[] = {
 	{MLXSW_REG_SBXX_DIR_EGRESS, 1},
 	{MLXSW_REG_SBXX_DIR_EGRESS, 2},
 	{MLXSW_REG_SBXX_DIR_EGRESS, 3},
+	{MLXSW_REG_SBXX_DIR_EGRESS, 15},
 };
 
 #define MLXSW_SP_SB_ING_TC_COUNT 8
@@ -428,6 +429,7 @@ static const struct mlxsw_sp_sb_pr mlxsw_sp2_sb_prs[] = {
 	MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0),
 	MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0),
 	MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0),
+	MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, MLXSW_SP_SB_INFI),
 };
 
 static int mlxsw_sp_sb_prs_init(struct mlxsw_sp *mlxsw_sp,
@@ -517,14 +519,14 @@ static const struct mlxsw_sp_sb_cm mlxsw_sp2_sb_cms_egress[] = {
 	MLXSW_SP_SB_CM(0, 7, 4),
 	MLXSW_SP_SB_CM(0, 7, 4),
 	MLXSW_SP_SB_CM(0, 7, 4),
-	MLXSW_SP_SB_CM(0, 7, 4),
-	MLXSW_SP_SB_CM(0, 7, 4),
-	MLXSW_SP_SB_CM(0, 7, 4),
-	MLXSW_SP_SB_CM(0, 7, 4),
-	MLXSW_SP_SB_CM(0, 7, 4),
-	MLXSW_SP_SB_CM(0, 7, 4),
-	MLXSW_SP_SB_CM(0, 7, 4),
-	MLXSW_SP_SB_CM(0, 7, 4),
+	MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
+	MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
+	MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
+	MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
+	MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
+	MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
+	MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
+	MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
 	MLXSW_SP_SB_CM(1, 0xff, 4),
 };
 
@@ -671,6 +673,7 @@ static const struct mlxsw_sp_sb_pm mlxsw_sp2_sb_pms[] = {
 	MLXSW_SP_SB_PM(0, 0),
 	MLXSW_SP_SB_PM(0, 0),
 	MLXSW_SP_SB_PM(0, 0),
+	MLXSW_SP_SB_PM(10000, 90000),
 };
 
 static int mlxsw_sp_port_sb_pms_init(struct mlxsw_sp_port *mlxsw_sp_port)
-- 
2.20.1


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

* Re: [PATCH net 1/7] mlxsw: spectrum_switchdev: Add MDB entries in prepare phase
  2019-04-10  6:58 ` [PATCH net 1/7] mlxsw: spectrum_switchdev: Add MDB entries in prepare phase Ido Schimmel
@ 2019-04-10 13:39   ` Jiri Pirko
  0 siblings, 0 replies; 11+ messages in thread
From: Jiri Pirko @ 2019-04-10 13:39 UTC (permalink / raw)
  To: Ido Schimmel; +Cc: netdev, davem, Jiri Pirko, mlxsw

Wed, Apr 10, 2019 at 08:58:12AM CEST, idosch@mellanox.com wrote:
>The driver cannot guarantee in the prepare phase that it will be able to
>write an MDB entry to the device. In case the driver returned success
>during the prepare phase, but then failed to add the entry in the commit
>phase, a WARNING [1] will be generated by the switchdev core.
>
>Fix this by doing the work in the prepare phase instead.
>
>[1]
>[  358.544486] swp12s0: Commit of object (id=2) failed.
>[  358.550061] WARNING: CPU: 0 PID: 30 at net/switchdev/switchdev.c:281 switchdev_port_obj_add_now+0x9b/0xe0
>[  358.560754] CPU: 0 PID: 30 Comm: kworker/0:1 Not tainted 5.0.0-custom-13382-gf2449babf221 #1350
>[  358.570472] Hardware name: Mellanox Technologies Ltd. MSN2100-CB2FO/SA001017, BIOS 5.6.5 06/07/2016
>[  358.580582] Workqueue: events switchdev_deferred_process_work
>[  358.587001] RIP: 0010:switchdev_port_obj_add_now+0x9b/0xe0
>...
>[  358.614109] RSP: 0018:ffffa6b900d6fe18 EFLAGS: 00010286
>[  358.619943] RAX: 0000000000000000 RBX: ffff8b00797ff000 RCX: 0000000000000000
>[  358.627912] RDX: ffff8b00b7a1d4c0 RSI: ffff8b00b7a152e8 RDI: ffff8b00b7a152e8
>[  358.635881] RBP: ffff8b005c3f5bc0 R08: 000000000000022b R09: 0000000000000000
>[  358.643850] R10: 0000000000000000 R11: ffffa6b900d6fcc8 R12: 0000000000000000
>[  358.651819] R13: dead000000000100 R14: ffff8b00b65a23c0 R15: 0ffff8b00b7a2200
>[  358.659790] FS:  0000000000000000(0000) GS:ffff8b00b7a00000(0000) knlGS:0000000000000000
>[  358.668820] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>[  358.675228] CR2: 00007f00aad90de0 CR3: 00000001ca80d000 CR4: 00000000001006f0
>[  358.683188] Call Trace:
>[  358.685918]  switchdev_port_obj_add_deferred+0x13/0x60
>[  358.691655]  switchdev_deferred_process+0x6b/0xf0
>[  358.696907]  switchdev_deferred_process_work+0xa/0x10
>[  358.702548]  process_one_work+0x1f5/0x3f0
>[  358.707022]  worker_thread+0x28/0x3c0
>[  358.711099]  ? process_one_work+0x3f0/0x3f0
>[  358.715768]  kthread+0x10d/0x130
>[  358.719369]  ? __kthread_create_on_node+0x180/0x180
>[  358.724815]  ret_from_fork+0x35/0x40
>
>Fixes: 3a49b4fde2a1 ("mlxsw: Adding layer 2 multicast support")
>Signed-off-by: Ido Schimmel <idosch@mellanox.com>
>Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
>Tested-by: Alex Kushnarov <alexanderk@mellanox.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

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

* Re: [PATCH net 7/7] mlxsw: spectrum_buffers: Add a multicast pool for Spectrum-2
  2019-04-10  6:58 ` [PATCH net 7/7] mlxsw: spectrum_buffers: Add a multicast pool for Spectrum-2 Ido Schimmel
@ 2019-04-10 13:40   ` Jiri Pirko
  0 siblings, 0 replies; 11+ messages in thread
From: Jiri Pirko @ 2019-04-10 13:40 UTC (permalink / raw)
  To: Ido Schimmel; +Cc: netdev, davem, Jiri Pirko, mlxsw

Wed, Apr 10, 2019 at 08:58:17AM CEST, idosch@mellanox.com wrote:
>In Spectrum-1, when a multicast packet is admitted to the shared buffer
>it increases the quotas of all the ports and {port, TC} to which it is
>forwarded to.
>
>The above means that multicast packets are accounted multiple times in
>the shared buffer and can therefore cause the associated shared buffer
>pool to fill up very quickly.
>
>To work around this issue, commit e83c045e53d7 ("mlxsw:
>spectrum_buffers: Configure MC pool") added a dedicated multicast pool
>in which multicast packets are accounted.
>
>The issue is not present in Spectrum-2, but in order to be backward
>compatible with Spectrum-1, its default behavior is to allow a multicast
>packet to increase multiple egress quotas instead of one.
>
>Until the new (non-backward compatible) mode is supported, configure a
>dedicated multicast pool as in Spectrum-1.
>
>Fixes: fe099bf682ab ("mlxsw: spectrum_buffers: Add Spectrum-2 shared buffer configuration")
>Signed-off-by: Ido Schimmel <idosch@mellanox.com>
>Reviewed-by: Petr Machata <petrm@mellanox.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

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

* Re: [PATCH net 0/7] mlxsw: Various fixes
  2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
                   ` (6 preceding siblings ...)
  2019-04-10  6:58 ` [PATCH net 7/7] mlxsw: spectrum_buffers: Add a multicast pool for Spectrum-2 Ido Schimmel
@ 2019-04-10 18:58 ` David Miller
  7 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2019-04-10 18:58 UTC (permalink / raw)
  To: idosch; +Cc: netdev, jiri, mlxsw

From: Ido Schimmel <idosch@mellanox.com>
Date: Wed, 10 Apr 2019 06:58:10 +0000

> This patchset contains various small fixes for mlxsw.
> 
> Patch #1 fixes a warning generated by switchdev core when the driver
> fails to insert an MDB entry in the commit phase.
> 
> Patches #2-#4 fix a warning in check_flush_dependency() that can be
> triggered when a work item in a WQ_MEM_RECLAIM workqueue tries to flush
> a non-WQ_MEM_RECLAIM workqueue.
> 
> It seems that the semantics of the WQ_MEM_RECLAIM flag are not very
> clear [1] and that various patches have been sent to remove it from
> various workqueues throughout the kernel [2][3][4] in order to silence
> the warning.
> 
> These patches do the same for the workqueues created by mlxsw that
> probably should not have been created with this flag in the first place.
> 
> Patch #5 fixes a regression where an IP address cannot be assigned to a
> VRF upper due to erroneous MAC validation check. Patch #6 adds a test
> case.
> 
> Patch #7 adjusts Spectrum-2 shared buffer configuration to be compatible
> with Spectrum-1. The problem and fix are described in detail in the
> commit message.

Series applied.

> Please consider patches #1-#5 for 5.0.y. I verified they apply cleanly.

Queued up.

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

end of thread, other threads:[~2019-04-10 18:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10  6:58 [PATCH net 0/7] mlxsw: Various fixes Ido Schimmel
2019-04-10  6:58 ` [PATCH net 1/7] mlxsw: spectrum_switchdev: Add MDB entries in prepare phase Ido Schimmel
2019-04-10 13:39   ` Jiri Pirko
2019-04-10  6:58 ` [PATCH net 2/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for EMAD workqueue Ido Schimmel
2019-04-10  6:58 ` [PATCH net 3/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw ordered workqueue Ido Schimmel
2019-04-10  6:58 ` [PATCH net 5/7] mlxsw: spectrum_router: Do not check VRF MAC address Ido Schimmel
2019-04-10  6:58 ` [PATCH net 4/7] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw workqueue Ido Schimmel
2019-04-10  6:58 ` [PATCH net 6/7] selftests: mlxsw: Test VRF MAC vetoing Ido Schimmel
2019-04-10  6:58 ` [PATCH net 7/7] mlxsw: spectrum_buffers: Add a multicast pool for Spectrum-2 Ido Schimmel
2019-04-10 13:40   ` Jiri Pirko
2019-04-10 18:58 ` [PATCH net 0/7] mlxsw: Various fixes David Miller

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.