mlx5 misc fixes 2025-03-10
Subsystems (5)
Tariq Toukan
maintainercover mlx5 misc fixes 2025-03-10
Hi,
This patchset provides misc bug fixes from the team to the mlx5 core and Eth drivers.
Thanks,
Tariq.
Carolina Jubran (1):
net/mlx5e: Prevent bridge link show failure for non-eswitch-allowed
devices
Jianbo Liu (1):
net/mlx5: Bridge, fix the crash caused by LAG state check
Shay Drory (2):
net/mlx5: Fix incorrect IRQ pool usage when releasing IRQs net/mlx5: Lag, Check shared fdb before creating MultiPort E-Switch
Vlad Dogaru (1):
net/mlx5: HWS, Rightsize bwc matcher priority
Yevgeny Kliteynik (1):
net/mlx5: DR, use the right action structs for STEv3
.../mellanox/mlx5/core/en/rep/bridge.c | 12 ++--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 6 +-- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 +- .../mellanox/mlx5/core/irq_affinity.c | 2 +- .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 4 +- .../net/ethernet/mellanox/mlx5/core/lag/lag.h | 1 + .../ethernet/mellanox/mlx5/core/lag/mpesw.c | 3 +- .../ethernet/mellanox/mlx5/core/mlx5_irq.h | 4 +- .../net/ethernet/mellanox/mlx5/core/pci_irq.c | 13 +++-- .../net/ethernet/mellanox/mlx5/core/pci_irq.h | 2 +- .../mellanox/mlx5/core/steering/hws/bwc.h | 2 +- .../mellanox/mlx5/core/steering/sws/dr_ste.h | 4 ++ .../mlx5/core/steering/sws/dr_ste_v1.c | 52 ++++++++++--------- .../mlx5/core/steering/sws/dr_ste_v1.h | 4 ++ .../mlx5/core/steering/sws/dr_ste_v2.c | 2 + .../mlx5/core/steering/sws/dr_ste_v3.c | 42 +++++++++++++++ 16 files changed, 108 insertions(+), 47 deletions(-)
base-commit: 505ead7ab77f289f12d8a68ac83da068e4d4408b
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 1/6 net/mlx5: DR, use the right action structs for STEv3
From: Yevgeny Kliteynik <[email protected]>
Some actions in ConnectX-8 (STEv3) have different structure, and they are handled separately in ste_ctx_v3. This separate handling was missing two actions: INSERT_HDR and REMOVE_HDR, which broke SWS for Linux Bridge. This patch resolves the issue by introducing dedicated callbacks for the insert and remove header functions, with version-specific implementations for each STE variant.
--- .../mellanox/mlx5/core/steering/sws/dr_ste.h | 4 ++ .../mlx5/core/steering/sws/dr_ste_v1.c | 52 ++++++++++--------- .../mlx5/core/steering/sws/dr_ste_v1.h | 4 ++ .../mlx5/core/steering/sws/dr_ste_v2.c | 2 + .../mlx5/core/steering/sws/dr_ste_v3.c | 42 +++++++++++++++ 5 files changed, 79 insertions(+), 25 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste.h +4 -0
@@ -210,6 +210,10 @@ struct mlx5dr_ste_ctx {void (*set_encap_l3)(u8 *hw_ste_p,u8 *frst_s_action,u8 *scnd_d_action,u32 reformat_id,int size); +void (*set_insert_hdr)(u8 *hw_ste_p,u8 *d_action,u32 reformat_id, +u8 anchor,u8 offset,int size); +void (*set_remove_hdr)(u8 *hw_ste_p,u8 *s_action,u8 anchor, +u8 offset,int size);/* Send */ void (*prepare_for_postsend)(u8 *hw_ste_p,u32 ste_size); };
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.c +27 -25
94 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.h +4 -0
@@ -156,6 +156,10 @@ void dr_ste_v1_set_pop_vlan(u8 *hw_ste_p, u8 *s_action, u8 vlans_num);void dr_ste_v1_set_encap_l3 (u8 *hw_ste_p,u8 *frst_s_action,u8 *scnd_d_action,u32 reformat_id,int size);void dr_ste_v1_set_rx_decap (u8 *hw_ste_p,u8 *s_action); +void dr_ste_v1_set_insert_hdr (u8 *hw_ste_p,u8 *d_action,u32 reformat_id, +u8 anchor,u8 offset,int size); +void dr_ste_v1_set_remove_hdr (u8 *hw_ste_p,u8 *s_action,u8 anchor, +u8 offset,int size);void dr_ste_v1_set_actions_tx (struct mlx5dr_ste_ctx *ste_ctx,struct mlx5dr_domain *dmn,u8 *action_type_set,u32 actions_caps,u8 *last_ste,struct mlx5dr_ste_actions_attr *attr,u32 *added_stes);
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v2.c +2 -0
@@ -69,6 +69,8 @@ static struct mlx5dr_ste_ctx ste_ctx_v2 = { .set_pop_vlan = &dr_ste_v1_set_pop_vlan, .set_rx_decap = &dr_ste_v1_set_rx_decap, .set_encap_l3 = &dr_ste_v1_set_encap_l3, + .set_insert_hdr = &dr_ste_v1_set_insert_hdr, + .set_remove_hdr = &dr_ste_v1_set_remove_hdr, /* Send */ .prepare_for_postsend = &dr_ste_v1_prepare_for_postsend, };
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v3.c +42 -0
54 lines not on this page · raw message
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 2/6 net/mlx5: HWS, Rightsize bwc matcher priority
In reply to Tariq ToukanFrom: Vlad Dogaru <[email protected]>
The bwc layer was clamping the matcher priority from 32 bits to 16 bits. This didn't show up until a matcher was resized, since the initial native matcher was created using the correct 32 bit value.
The fix also reorders fields to avoid some padding.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.h +1 -1
@@ -24,8 +24,8 @@ struct mlx5hws_bwc_matcher {struct mlx5hws_matcher *matcher;struct mlx5hws_match_template *mt;struct mlx5hws_action_template *at[MLX5HWS_BWC_MATCHER_ATTACH_AT_NUM ]; +u32 priority;u8 num_of_at; -u16 priority;u8 size_log;atomic_t num_of_rules;struct list_head *rules;
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 3/6 net/mlx5: Fix incorrect IRQ pool usage when releasing IRQs
In reply to Tariq ToukanFrom: Shay Drory <[email protected]>
mlx5_irq_pool_get() is a getter for completion IRQ pool only. However, after the cited commit, mlx5_irq_pool_get() is called during ctrl IRQ release flow to retrieve the pool, resulting in the use of an incorrect IRQ pool.
Hence, use the newly introduced mlx5_irq_get_pool() getter to retrieve the correct IRQ pool based on the IRQ itself. While at it, rename mlx5_irq_pool_get() to mlx5_irq_table_get_comp_irq_pool() which accurately reflects its purpose and improves code readability.
--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 +- .../net/ethernet/mellanox/mlx5/core/irq_affinity.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/mlx5_irq.h | 4 +++- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 13 ++++++++++--- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.h | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 -1
@@ -871,8 +871,8 @@ static void comp_irq_release_sf(struct mlx5_core_dev *dev, u16 vecidx)static int comp_irq_request_sf (struct mlx5_core_dev *dev,u16 vecidx) { +struct mlx5_irq_pool *pool =mlx5_irq_table_get_comp_irq_pool (dev);struct mlx5_eq_table *table = dev->priv.eq_table; -struct mlx5_irq_pool *pool =mlx5_irq_pool_get (dev);struct irq_affinity_desc af_desc = {};struct mlx5_irq *irq;
drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c +1 -1
@@ -175,7 +175,7 @@ mlx5_irq_affinity_request(struct mlx5_core_dev *dev, struct mlx5_irq_pool *pool,void mlx5_irq_affinity_irq_release (struct mlx5_core_dev *dev,struct mlx5_irq *irq) { -struct mlx5_irq_pool *pool =mlx5_irq_pool_get (dev); +struct mlx5_irq_pool *pool =mlx5_irq_get_pool (irq);int cpu; cpu =cpumask_first (mlx5_irq_get_affinity_mask (irq));
drivers/net/ethernet/mellanox/mlx5/core/mlx5_irq.h +3 -1
@@ -10,12 +10,15 @@struct mlx5_irq ;struct cpu_rmap ; +struct mlx5_irq_pool ;int mlx5_irq_table_init (struct mlx5_core_dev *dev);void mlx5_irq_table_cleanup (struct mlx5_core_dev *dev);int mlx5_irq_table_create (struct mlx5_core_dev *dev);void mlx5_irq_table_destroy (struct mlx5_core_dev *dev);void mlx5_irq_table_free_irqs (struct mlx5_core_dev *dev); +struct mlx5_irq_pool * +mlx5_irq_table_get_comp_irq_pool (struct mlx5_core_dev *dev);int mlx5_irq_table_get_num_comp (struct mlx5_irq_table *table);int mlx5_irq_table_get_sfs_vec (struct mlx5_irq_table *table);struct mlx5_irq_table *mlx5_irq_table_get (struct mlx5_core_dev *dev);
@@ -38,7 +41,6 @@ struct cpumask *mlx5_irq_get_affinity_mask(struct mlx5_irq *irq);int mlx5_irq_get_index (struct mlx5_irq *irq);int mlx5_irq_get_irq (const struct mlx5_irq *irq); -struct mlx5_irq_pool ;#ifdef CONFIG_MLX5_SF struct mlx5_irq *mlx5_irq_affinity_irq_request_auto (struct mlx5_core_dev *dev,struct cpumask *used_cpus,u16 vecidx);
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +10 -3
@@ -378,6 +378,11 @@ int mlx5_irq_get_index(struct mlx5_irq *irq)return irq->map.index; } +struct mlx5_irq_pool *mlx5_irq_get_pool (struct mlx5_irq *irq) +{ +return irq->pool; +} +/* irq_pool API */ /* requesting an irq from a given pool according to given index */
@@ -405,18 +410,20 @@ static struct mlx5_irq_pool *sf_ctrl_irq_pool_get(struct mlx5_irq_table *irq_tabreturn irq_table->sf_ctrl_pool; } -static struct mlx5_irq_pool *sf_irq_pool_get (struct mlx5_irq_table *irq_table) +static struct mlx5_irq_pool * +sf_comp_irq_pool_get (struct mlx5_irq_table *irq_table) {return irq_table->sf_comp_pool; } -struct mlx5_irq_pool *mlx5_irq_pool_get (struct mlx5_core_dev *dev) +struct mlx5_irq_pool * +mlx5_irq_table_get_comp_irq_pool (struct mlx5_core_dev *dev) {struct mlx5_irq_table *irq_table =mlx5_irq_table_get (dev);struct mlx5_irq_pool *pool =NULL ;if (mlx5_core_is_sf (dev)) - pool =sf_irq_pool_get (irq_table); + pool =sf_comp_irq_pool_get (irq_table);/* In some configs, there won't be a pool of SFs IRQs. Hence, returning * the PF IRQs pool in case the SF pool doesn't exist.
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.h +1 -1
@@ -28,7 +28,6 @@ struct mlx5_irq_pool {struct mlx5_core_dev *dev; }; -struct mlx5_irq_pool *mlx5_irq_pool_get (struct mlx5_core_dev *dev);static inline bool mlx5_irq_pool_is_sf_pool (struct mlx5_irq_pool *pool) {return !strncmp ("mlx5_sf" , pool->name,strlen ("mlx5_sf" ));
@@ -40,5 +39,6 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,int mlx5_irq_get_locked (struct mlx5_irq *irq);int mlx5_irq_read_locked (struct mlx5_irq *irq);int mlx5_irq_put (struct mlx5_irq *irq); +struct mlx5_irq_pool *mlx5_irq_get_pool (struct mlx5_irq *irq);#endif /* __PCI_IRQ_H__ */
Signature · 1 line
2.31.1
Re: [PATCH net 3/6] net/mlx5: Fix incorrect IRQ pool usage when releasing IRQs
Quoted 24 lines · Tariq Toukan
From: Shay Drory <[email protected]>
mlx5_irq_pool_get()is a getter for completion IRQ pool only. However, after the cited commit,mlx5_irq_pool_get()is called during ctrl IRQ release flow to retrieve the pool, resulting in the use of an incorrect IRQ pool.Hence, use the newly introduced
mlx5_irq_get_pool()getter to retrieve the correct IRQ pool based on the IRQ itself. While at it, renamemlx5_irq_pool_get()tomlx5_irq_table_get_comp_irq_pool()which accurately reflects its purpose and improves code readability.Fixes 0477d5168bbb ("net/mlx5: Expose SFs IRQs")Signed-off-by Shay Drory <[email protected]>Reviewed-by Maher Sanalla <[email protected]>Signed-off-by Tariq Toukan <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 +- .../net/ethernet/mellanox/mlx5/core/irq_affinity.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/mlx5_irq.h | 4 +++- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 13 ++++++++++--- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.h | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-)
[...]
Quoted 2 lines
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 4/6 net/mlx5: Lag, Check shared fdb before creating MultiPort E-Switch
In reply to Tariq ToukanFrom: Shay Drory <[email protected]>
Currently, MultiPort E-Switch is requesting to create a LAG with shared FDB without checking the LAG is supporting shared FDB.
Add the check.
--- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +2 -2
@@ -951,7 +951,7 @@ void mlx5_disable_lag(struct mlx5_lag *ldev)mlx5_eswitch_reload_ib_reps (ldev->pf[i].dev->priv.eswitch); } -static bool mlx5_shared_fdb_supported (struct mlx5_lag *ldev) +bool mlx5_lag_shared_fdb_supported (struct mlx5_lag *ldev) {int idx =mlx5_lag_get_dev_index_by_seq (ldev,MLX5_LAG_P1 );struct mlx5_core_dev *dev;
@@ -1038,7 +1038,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev) }if (do_bond && !__mlx5_lag_is_active (ldev)) { -bool shared_fdb =mlx5_shared_fdb_supported (ldev); +bool shared_fdb =mlx5_lag_shared_fdb_supported (ldev); roce_lag =mlx5_lag_is_roce_lag (ldev);
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h +1 -0
@@ -92,6 +92,7 @@ mlx5_lag_is_ready(struct mlx5_lag *ldev)return test_bit (MLX5_LAG_FLAG_NDEVS_READY , &ldev->state_flags); } +bool mlx5_lag_shared_fdb_supported (struct mlx5_lag *ldev);bool mlx5_lag_check_prereq (struct mlx5_lag *ldev);void mlx5_modify_lag (struct mlx5_lag *ldev,struct lag_tracker *tracker);
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c +2 -1
@@ -83,7 +83,8 @@ static int enable_mpesw(struct mlx5_lag *ldev)if (mlx5_eswitch_mode (dev0) !=MLX5_ESWITCH_OFFLOADS || !MLX5_CAP_PORT_SELECTION (dev0, port_select_flow_table) || !MLX5_CAP_GEN (dev0, create_lag_when_not_master_up) || - !mlx5_lag_check_prereq (ldev)) + !mlx5_lag_check_prereq (ldev) || + !mlx5_lag_shared_fdb_supported (ldev))return -EOPNOTSUPP ; err =mlx5_mpesw_metadata_set (ldev);
Signature · 1 line
2.31.1
Re: [PATCH net 4/6] net/mlx5: Lag, Check shared fdb before creating MultiPort E-Switch
Quoted 55 lines · Tariq Toukan
From: Shay Drory <[email protected]>
Currently, MultiPort E-Switch is requesting to create a LAG with shared FDB without checking the LAG is supporting shared FDB.
Add the check.Fixes a32327a3a02c ("net/mlx5: Lag, Control MultiPort E-Switch single FDB mode")Signed-off-by Shay Drory <[email protected]>Reviewed-by Mark Bloch <[email protected]>Signed-off-by Tariq Toukan <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +2
-2@@ -951,7 +951,7 @@ void mlx5_disable_lag(struct mlx5_lag *ldev)mlx5_eswitch_reload_ib_reps (ldev->pf[i].dev->priv.eswitch); } -static bool mlx5_shared_fdb_supported (struct mlx5_lag *ldev) +bool mlx5_lag_shared_fdb_supported (struct mlx5_lag *ldev) {int idx =mlx5_lag_get_dev_index_by_seq (ldev,MLX5_LAG_P1 );struct mlx5_core_dev *dev;@@ -1038,7 +1038,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev) }if (do_bond && !__mlx5_lag_is_active (ldev)) { -bool shared_fdb =mlx5_shared_fdb_supported (ldev); +bool shared_fdb =mlx5_lag_shared_fdb_supported (ldev); roce_lag =mlx5_lag_is_roce_lag (ldev);drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h +1
-0@@ -92,6 +92,7 @@ mlx5_lag_is_ready(struct mlx5_lag *ldev)return test_bit (MLX5_LAG_FLAG_NDEVS_READY , &ldev->state_flags); } +bool mlx5_lag_shared_fdb_supported (struct mlx5_lag *ldev);bool mlx5_lag_check_prereq (struct mlx5_lag *ldev);void mlx5_modify_lag (struct mlx5_lag *ldev,struct lag_tracker *tracker);drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c +0
-0
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c static int enable_mpesw(struct mlx5_lag *ldev) · line 90
Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c +2
-1@@ -83,7 +83,8 @@ static int enable_mpesw(struct mlx5_lag *ldev)if (mlx5_eswitch_mode (dev0) !=MLX5_ESWITCH_OFFLOADS || !MLX5_CAP_PORT_SELECTION (dev0, port_select_flow_table) || !MLX5_CAP_GEN (dev0, create_lag_when_not_master_up) || - !mlx5_lag_check_prereq (ldev)) + !mlx5_lag_check_prereq (ldev) || + !mlx5_lag_shared_fdb_supported (ldev))return -EOPNOTSUPP ; err =mlx5_mpesw_metadata_set (ldev);
Quoted 2 lines
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 5/6 net/mlx5: Bridge, fix the crash caused by LAG state check
In reply to Tariq ToukanFrom: Jianbo Liu <[email protected]>
When removing LAG device from bridge, NETDEV_CHANGEUPPER event is triggered. Driver finds the lower devices (PFs) to flush all the offloaded entries. And mlx5_lag_is_shared_fdb is checked, it returns false if one of PF is unloaded. In such case, mlx5_esw_bridge_lag_rep_get() and its caller return NULL, instead of the alive PF, and the flush is skipped.
Besides, the bridge fdb entry's lastuse is updated in mlx5 bridge event handler. But this SWITCHDEV_FDB_ADD_TO_BRIDGE event can be ignored in this case because the upper interface for bond is deleted, and the entry will never be aged because lastuse is never updated.
To make things worse, as the entry is alive, mlx5 bridge workqueue keeps sending that event, which is then handled by kernel bridge notifier. It causes the following crash when accessing the passed bond netdev which is already destroyed.
To fix this issue, remove such checks. LAG state is already checked in commit 15f8f168952f ("net/mlx5: Bridge, verify LAG state when adding bond to bridge"), driver still need to skip offload if LAG becomes invalid state after initialization.
Oops: stack segment: 0000 [#1] SMP CPU: 3 UID: 0 PID: 23695 Comm: kworker/u40:3 Tainted: G OE 6.11.0_mlnx #1 Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 Workqueue: mlx5_bridge_wq mlx5_esw_bridge_update_work [mlx5_core] RIP: 0010:br_switchdev_event+0x2c/0x110 [bridge] Code: 44 00 00 48 8b 02 48 f7 00 00 02 00 00 74 69 41 54 55 53 48 83 ec 08 48 8b a8 08 01 00 00 48 85 ed 74 4a 48 83 fe 02 48 89 d3 <4c> 8b 65 00 74 23 76 49 48 83 fe 05 74 7e 48 83 fe 06 75 2f 0f b7 RSP: 0018:ffffc900092cfda0 EFLAGS: 00010297 RAX: ffff888123bfe000 RBX: ffffc900092cfe08 RCX: 00000000ffffffff RDX: ffffc900092cfe08 RSI: 0000000000000001 RDI: ffffffffa0c585f0 RBP: 6669746f6e690a30 R08: 0000000000000000 R09: ffff888123ae92c8 R10: 0000000000000000 R11: fefefefefefefeff R12: ffff888123ae9c60 R13: 0000000000000001 R14: ffffc900092cfe08 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88852c980000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f15914c8734 CR3: 0000000002830005 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? __die_body+0x1a/0x60 ? die+0x38/0x60 ? do_trap+0x10b/0x120 ? do_error_trap+0x64/0xa0 ? exc_stack_segment+0x33/0x50 ? asm_exc_stack_segment+0x22/0x30 ? br_switchdev_event+0x2c/0x110 [bridge] ? sched_balance_newidle.isra.149+0x248/0x390 notifier_call_chain+0x4b/0xa0 atomic_notifier_call_chain+0x16/0x20 mlx5_esw_bridge_update+0xec/0x170 [mlx5_core] mlx5_esw_bridge_update_work+0x19/0x40 [mlx5_core] process_scheduled_works+0x81/0x390 worker_thread+0x106/0x250 ? bh_worker+0x110/0x110 kthread+0xb7/0xe0 ? kthread_park+0x80/0x80 ret_from_fork+0x2d/0x50 ? kthread_park+0x80/0x80 ret_from_fork_asm+0x11/0x20 </TASK>
--- .../net/ethernet/mellanox/mlx5/core/en/rep/bridge.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c +5 -7
@@ -48,15 +48,10 @@ mlx5_esw_bridge_lag_rep_get(struct net_device *dev, struct mlx5_eswitch *esw)struct list_head *iter;netdev_for_each_lower_dev (dev, lower, iter) { -struct mlx5_core_dev *mdev; -struct mlx5e_priv *priv; -if (!mlx5e_eswitch_rep (lower))continue ; - priv =netdev_priv (lower); - mdev = priv->mdev; -if (mlx5_lag_is_shared_fdb (mdev) &&mlx5_esw_bridge_dev_same_esw (lower, esw)) +if (mlx5_esw_bridge_dev_same_esw (lower, esw))return lower; }
@@ -125,7 +120,7 @@ static bool mlx5_esw_bridge_is_local(struct net_device *dev, struct net_device * priv =netdev_priv (rep); mdev = priv->mdev;if (netif_is_lag_master (dev)) -return mlx5_lag_is_shared_fdb (mdev) &&mlx5_lag_is_master (mdev); +return mlx5_lag_is_master (mdev);return true; }
@@ -455,6 +450,9 @@ static int mlx5_esw_bridge_switchdev_event(struct notifier_block *nb,if (!rep)return NOTIFY_DONE ; +if (netif_is_lag_master (dev) && !mlx5_lag_is_shared_fdb (esw->dev)) +return NOTIFY_DONE ; +switch (event) {case SWITCHDEV_FDB_ADD_TO_BRIDGE : fdb_info = container_of(info,
Signature · 1 line
2.31.1
Re: [PATCH net 5/6] net/mlx5: Bridge, fix the crash caused by LAG state check
Quoted 106 lines · Tariq Toukan
From: Jianbo Liu <[email protected]>
When removing LAG device from bridge,
NETDEV_CHANGEUPPERevent is triggered. Driver finds the lower devices (PFs) to flush all the offloaded entries. Andmlx5_lag_is_shared_fdbis checked, it returns false if one of PF is unloaded. In such case,mlx5_esw_bridge_lag_rep_get()and its caller return NULL, instead of the alive PF, and the flush is skipped.Besides, the bridge fdb entry's lastuse is updated in mlx5 bridge event handler. But this
SWITCHDEV_FDB_ADD_TO_BRIDGEevent can be ignored in this case because the upper interface for bond is deleted, and the entry will never be aged because lastuse is never updated.To make things worse, as the entry is alive, mlx5 bridge workqueue keeps sending that event, which is then handled by kernel bridge notifier. It causes the following crash when accessing the passed bond netdev which is already destroyed.
To fix this issue, remove such checks. LAG state is already checked in commit
15f8f168952f("net/mlx5: Bridge, verify LAG state when adding bond to bridge"), driver still need to skip offload if LAG becomes invalid state after initialization.Oops: stack segment: 0000 [#1] SMP CPU: 3 UID: 0 PID: 23695 Comm: kworker/u40:3 Tainted: G OE 6.11.0_mlnx #1 Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 Workqueue: mlx5_bridge_wq mlx5_esw_bridge_update_work [mlx5_core] RIP: 0010:br_switchdev_event+0x2c/0x110 [bridge] Code: 44 00 00 48 8b 02 48 f7 00 00 02 00 00 74 69 41 54 55 53 48 83 ec 08 48 8b a8 08 01 00 00 48 85 ed 74 4a 48 83 fe 02 48 89 d3 <4c> 8b 65 00 74 23 76 49 48 83 fe 05 74 7e 48 83 fe 06 75 2f 0f b7 RSP: 0018:ffffc900092cfda0 EFLAGS: 00010297 RAX: ffff888123bfe000 RBX: ffffc900092cfe08 RCX: 00000000ffffffff RDX: ffffc900092cfe08 RSI: 0000000000000001 RDI: ffffffffa0c585f0 RBP: 6669746f6e690a30 R08: 0000000000000000 R09: ffff888123ae92c8 R10: 0000000000000000 R11: fefefefefefefeff R12: ffff888123ae9c60 R13: 0000000000000001 R14: ffffc900092cfe08 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88852c980000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f15914c8734 CR3: 0000000002830005 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? __die_body+0x1a/0x60 ? die+0x38/0x60 ? do_trap+0x10b/0x120 ? do_error_trap+0x64/0xa0 ? exc_stack_segment+0x33/0x50 ? asm_exc_stack_segment+0x22/0x30 ? br_switchdev_event+0x2c/0x110 [bridge] ? sched_balance_newidle.isra.149+0x248/0x390 notifier_call_chain+0x4b/0xa0 atomic_notifier_call_chain+0x16/0x20 mlx5_esw_bridge_update+0xec/0x170 [mlx5_core] mlx5_esw_bridge_update_work+0x19/0x40 [mlx5_core] process_scheduled_works+0x81/0x390 worker_thread+0x106/0x250 ? bh_worker+0x110/0x110 kthread+0xb7/0xe0 ? kthread_park+0x80/0x80 ret_from_fork+0x2d/0x50 ? kthread_park+0x80/0x80 ret_from_fork_asm+0x11/0x20 </TASK>Fixes ff9b7521468b ("net/mlx5: Bridge, support LAG")Signed-off-by Jianbo Liu <[email protected]>Reviewed-by Vlad Buslov <[email protected]>Signed-off-by Tariq Toukan <[email protected]>--- .../net/ethernet/mellanox/mlx5/core/en/rep/bridge.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c +2
-7@@ -48,15 +48,10 @@ mlx5_esw_bridge_lag_rep_get(struct net_device *dev, struct mlx5_eswitch *esw)struct list_head *iter;netdev_for_each_lower_dev (dev, lower, iter) { -struct mlx5_core_dev *mdev; -struct mlx5e_priv *priv; -if (!mlx5e_eswitch_rep (lower))continue ; - priv =netdev_priv (lower); - mdev = priv->mdev; -if (mlx5_lag_is_shared_fdb (mdev) &&mlx5_esw_bridge_dev_same_esw (lower, esw)) +if (mlx5_esw_bridge_dev_same_esw (lower, esw))return lower; }@@ -125,7 +120,7 @@ static bool mlx5_esw_bridge_is_local(struct net_device *dev, struct net_device * priv =netdev_priv (rep); mdev = priv->mdev;if (netif_is_lag_master (dev)) -return mlx5_lag_is_shared_fdb (mdev) &&mlx5_lag_is_master (mdev); +return mlx5_lag_is_master (mdev);return true; }
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c static int mlx5_esw_bridge_switchdev_event(struct notifier_block *nb, · line 458
Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c +3
-0@@ -455,6 +450,9 @@ static int mlx5_esw_bridge_switchdev_event(struct notifier_block *nb,if (!rep)return NOTIFY_DONE ; +if (netif_is_lag_master (dev) && !mlx5_lag_is_shared_fdb (esw->dev)) +return NOTIFY_DONE ; +switch (event) {case SWITCHDEV_FDB_ADD_TO_BRIDGE : fdb_info = container_of(info,
Quoted 2 lines
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 6/6 net/mlx5e: Prevent bridge link show failure for non-eswitch-allowed devices
In reply to Tariq ToukanFrom: Carolina Jubran <[email protected]>
mlx5_eswitch_get_vepa returns -EPERM if the device lacks eswitch_manager capability, blocking mlx5e_bridge_getlink from retrieving VEPA mode. Since mlx5e_bridge_getlink implements ndo_bridge_getlink, returning -EPERM causes bridge link show to fail instead of skipping devices without this capability.
To avoid this, return -EOPNOTSUPP from mlx5e_bridge_getlink when mlx5_eswitch_get_vepa fails, ensuring the command continues processing other devices while ignoring those without the necessary capability.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -4
@@ -5132,11 +5132,9 @@ static int mlx5e_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,struct mlx5e_priv *priv =netdev_priv (dev);struct mlx5_core_dev *mdev = priv->mdev;u8 mode, setting; -int err; - err =mlx5_eswitch_get_vepa (mdev->priv.eswitch, &setting); -if (err) -return err; +if (mlx5_eswitch_get_vepa (mdev->priv.eswitch, &setting)) +return -EOPNOTSUPP ; mode = setting ?BRIDGE_MODE_VEPA :BRIDGE_MODE_VEB ; return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
Signature · 1 line
2.31.1
Re: [PATCH net 6/6] net/mlx5e: Prevent bridge link show failure for non-eswitch-allowed devices
Quoted 28 lines · Tariq Toukan
From: Carolina Jubran <[email protected]>
mlx5_eswitch_get_vepareturns-EPERMif the device lackseswitch_managercapability, blockingmlx5e_bridge_getlinkfrom retrieving VEPA mode. Sincemlx5e_bridge_getlinkimplementsndo_bridge_getlink, returning-EPERMcauses bridge link show to fail instead of skipping devices without this capability.To avoid this, return
-EOPNOTSUPPfrommlx5e_bridge_getlinkwhenmlx5_eswitch_get_vepafails, ensuring the command continues processing other devices while ignoring those without the necessary capability.Fixes 4b89251de024 ("net/mlx5: Support ndo bridge_setlink and getlink")Signed-off-by Carolina Jubran <[email protected]>Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Tariq Toukan <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0
-0@@ -5132,11 +5132,9 @@ static int mlx5e_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,struct mlx5e_priv *priv =netdev_priv (dev);struct mlx5_core_dev *mdev = priv->mdev;u8 mode, setting;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c static int mlx5e_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, · line 5140
Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2
-4-int err; - err =mlx5_eswitch_get_vepa (mdev->priv.eswitch, &setting); -if (err) -return err; +if (mlx5_eswitch_get_vepa (mdev->priv.eswitch, &setting)) +return -EOPNOTSUPP ; mode = setting ?BRIDGE_MODE_VEPA :BRIDGE_MODE_VEB ; return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
Quoted 2 lines
Signature · 1 line
2.31.1
This series was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 9 lines · On Tue, 11 Mar 2025 00:01:38 +0200 you wrote:
Hi,
This patchset provides misc bug fixes from the team to the mlx5 core and Eth drivers.
Thanks,
Tariq.[...]
Here is the summary with links:
- [net,1/6] net/mlx5: DR, use the right action structs for STEv3
https://git.kernel.org/netdev/net/c/03ebae199255 - [net,2/6] net/mlx5: HWS, Rightsize bwc matcher priority https://git.kernel.org/netdev/net/c/521992337f67 - [net,3/6] net/mlx5: Fix incorrect IRQ pool usage when releasing IRQs https://git.kernel.org/netdev/net/c/32d2724db5b2 - [net,4/6] net/mlx5: Lag, Check shared fdb before creating MultiPort E-Switch https://git.kernel.org/netdev/net/c/32966984bee1 - [net,5/6] net/mlx5: Bridge, fix the crash caused by LAG state check https://git.kernel.org/netdev/net/c/4b8eeed4fb10 - [net,6/6] net/mlx5e: Prevent bridge link show failure for non-eswitch-allowed devices https://git.kernel.org/netdev/net/c/e92df790d07a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html