]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/mlxsw-spectrum_switchdev-add-mdb-entries-in-prepare-.patch
autosel fixes for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / mlxsw-spectrum_switchdev-add-mdb-entries-in-prepare-.patch
1 From 41c13c7eb2c3fed0c82c6bb3750c870a7b00391e Mon Sep 17 00:00:00 2001
2 From: Ido Schimmel <idosch@mellanox.com>
3 Date: Wed, 10 Apr 2019 06:58:12 +0000
4 Subject: mlxsw: spectrum_switchdev: Add MDB entries in prepare phase
5
6 [ Upstream commit d4d0e40977ac450f32f2db5e4d8e23c9d2578899 ]
7
8 The driver cannot guarantee in the prepare phase that it will be able to
9 write an MDB entry to the device. In case the driver returned success
10 during the prepare phase, but then failed to add the entry in the commit
11 phase, a WARNING [1] will be generated by the switchdev core.
12
13 Fix this by doing the work in the prepare phase instead.
14
15 [1]
16 [ 358.544486] swp12s0: Commit of object (id=2) failed.
17 [ 358.550061] WARNING: CPU: 0 PID: 30 at net/switchdev/switchdev.c:281 switchdev_port_obj_add_now+0x9b/0xe0
18 [ 358.560754] CPU: 0 PID: 30 Comm: kworker/0:1 Not tainted 5.0.0-custom-13382-gf2449babf221 #1350
19 [ 358.570472] Hardware name: Mellanox Technologies Ltd. MSN2100-CB2FO/SA001017, BIOS 5.6.5 06/07/2016
20 [ 358.580582] Workqueue: events switchdev_deferred_process_work
21 [ 358.587001] RIP: 0010:switchdev_port_obj_add_now+0x9b/0xe0
22 ...
23 [ 358.614109] RSP: 0018:ffffa6b900d6fe18 EFLAGS: 00010286
24 [ 358.619943] RAX: 0000000000000000 RBX: ffff8b00797ff000 RCX: 0000000000000000
25 [ 358.627912] RDX: ffff8b00b7a1d4c0 RSI: ffff8b00b7a152e8 RDI: ffff8b00b7a152e8
26 [ 358.635881] RBP: ffff8b005c3f5bc0 R08: 000000000000022b R09: 0000000000000000
27 [ 358.643850] R10: 0000000000000000 R11: ffffa6b900d6fcc8 R12: 0000000000000000
28 [ 358.651819] R13: dead000000000100 R14: ffff8b00b65a23c0 R15: 0ffff8b00b7a2200
29 [ 358.659790] FS: 0000000000000000(0000) GS:ffff8b00b7a00000(0000) knlGS:0000000000000000
30 [ 358.668820] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
31 [ 358.675228] CR2: 00007f00aad90de0 CR3: 00000001ca80d000 CR4: 00000000001006f0
32 [ 358.683188] Call Trace:
33 [ 358.685918] switchdev_port_obj_add_deferred+0x13/0x60
34 [ 358.691655] switchdev_deferred_process+0x6b/0xf0
35 [ 358.696907] switchdev_deferred_process_work+0xa/0x10
36 [ 358.702548] process_one_work+0x1f5/0x3f0
37 [ 358.707022] worker_thread+0x28/0x3c0
38 [ 358.711099] ? process_one_work+0x3f0/0x3f0
39 [ 358.715768] kthread+0x10d/0x130
40 [ 358.719369] ? __kthread_create_on_node+0x180/0x180
41 [ 358.724815] ret_from_fork+0x35/0x40
42
43 Fixes: 3a49b4fde2a1 ("mlxsw: Adding layer 2 multicast support")
44 Signed-off-by: Ido Schimmel <idosch@mellanox.com>
45 Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
46 Tested-by: Alex Kushnarov <alexanderk@mellanox.com>
47 Acked-by: Jiri Pirko <jiri@mellanox.com>
48 Signed-off-by: David S. Miller <davem@davemloft.net>
49 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
50 ---
51 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 2 +-
52 1 file changed, 1 insertion(+), 1 deletion(-)
53
54 diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
55 index 3ba9f2c079b2a..8a1788108f52a 100644
56 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
57 +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
58 @@ -1320,7 +1320,7 @@ static int mlxsw_sp_port_mdb_add(struct mlxsw_sp_port *mlxsw_sp_port,
59 u16 fid_index;
60 int err = 0;
61
62 - if (switchdev_trans_ph_prepare(trans))
63 + if (switchdev_trans_ph_commit(trans))
64 return 0;
65
66 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev);
67 --
68 2.20.1
69