mlx5 fixes 2021-12-28
From: Saeed Mahameed <[email protected]>
Hi Dave, Hi Jakub,
This series provides bug fixes to mlx5 driver.
Please pull and let me know if there is any problem. There will be a very small trivial conflict when net merged with net-next,
++<<<<<<< HEAD
++ goto err_out;
++||||||| 391e5975c020
++ return err;
++=======
goto err_out;
+
+ attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
++>>>>>>> this pr
To solve just take the hunk from net (this pr)
Thanks,
Saeed.
The following changes since commit 9665e03a8de5df719904611e03f908cd5b9f52f6:
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue (2021-12-28 16:19:10 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2021-12-28
for you to fetch changes up to 992d8a4e38f0527f24e273ce3a9cd6dea1a6a436:
net/mlx5e: Fix wrong features assignment in case of error (2021-12-28 22:42:50 -0800)
----------------------------------------------------------------
mlx5-fixes-2021-12-28
----------------------------------------------------------------
Gal Pressman (1):
net/mlx5e: Fix wrong features assignment in case of error
Roi Dayan (1):
net/mlx5e: TC, Fix memory leak with rules with internal port
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 11 +++++------ drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-)
PATCH 1/2 net/mlx5e: TC, Fix memory leak with rules with internal port
From: Roi Dayan <[email protected]>
Fix a memory leak with decap rule with internal port as destination device. The driver allocates a modify hdr action but doesn't set the flow attr modify hdr action which results in skipping releasing the modify hdr action when releasing the flow.
backtrace:
[<000000005f8c651c>] krealloc+0x83/0xd0
[<000000009f59b143>] alloc_mod_hdr_actions+0x156/0x310 [mlx5_core]
[<000000002257f342>] mlx5e_tc_match_to_reg_set_and_get_id+0x12a/0x360 [mlx5_core]
[<00000000b44ea75a>] mlx5e_tc_add_fdb_flow+0x962/0x1470 [mlx5_core]
[<0000000003e384a0>] __mlx5e_add_fdb_flow+0x54c/0xb90 [mlx5_core]
[<00000000ed8b22b6>] mlx5e_configure_flower+0xe45/0x4af0 [mlx5_core]
[<00000000024f4ab5>] mlx5e_rep_indr_offload.isra.0+0xfe/0x1b0 [mlx5_core]
[<000000006c3bb494>] mlx5e_rep_indr_setup_tc_cb+0x90/0x130 [mlx5_core]
[<00000000d3dac2ea>] tc_setup_cb_add+0x1d2/0x420--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +2 -0
@@ -1441,6 +1441,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, metadata);if (err) goto err_out; + + attr->action |=MLX5_FLOW_CONTEXT_ACTION_MOD_HDR ; } }
Signature · 1 line
2.33.1
PATCH 2/2 net/mlx5e: Fix wrong features assignment in case of error
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
In case of an error in mlx5e_set_features(), 'netdev->features' must be updated with the correct state of the device to indicate which features were updated successfully.
To do that we maintain a copy of 'netdev->features' and update it after successful feature changes, so we can assign it to back to 'netdev->features' if needed.
However, since not all netdev features are handled by the driver (e.g. GRO/TSO/etc), some features may not be updated correctly in case of an error updating another feature.
For example, while requesting to disable TSO (feature which is not handled by the driver) and enable HW-GRO, if an error occurs during HW-GRO enable, 'oper_features' will be assigned with 'netdev->features' and HW-GRO turned off. TSO will remain enabled in such case, which is a bug.
To solve that, instead of using 'netdev->features' as the baseline of 'oper_features' and changing it on set feature success, use 'features' instead and update it in case of errors.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +5 -6
@@ -3741,12 +3741,11 @@ static int set_feature_arfs(struct net_device *netdev, bool enable)static int mlx5e_handle_feature (struct net_device *netdev,netdev_features_t *features, -netdev_features_t wanted_features,netdev_features_t feature,mlx5e_feature_handler feature_handler) { -netdev_features_t changes = wanted_features ^ netdev->features; -bool enable = !!(wanted_features & feature); +netdev_features_t changes = *features ^ netdev->features; +bool enable = !!(*features & feature);int err;if (!(changes & feature))
@@ -3754,22 +3753,22 @@ static int mlx5e_handle_feature(struct net_device *netdev, err =feature_handler (netdev, enable);if (err) { +MLX5E_SET_FEATURE (features, feature, !enable);netdev_err (netdev,"%s feature %pNF failed, err %d\n" , enable ?"Enable" :"Disable" , &feature, err);return err; } -MLX5E_SET_FEATURE (features, feature, enable);return 0 ; }int mlx5e_set_features (struct net_device *netdev,netdev_features_t features) { -netdev_features_t oper_features = netdev->features; +netdev_features_t oper_features = features;int err =0 ;#define MLX5E_HANDLE_FEATURE (feature, handler) \ - mlx5e_handle_feature(netdev, &oper_features, features, feature, handler) + mlx5e_handle_feature(netdev, &oper_features, feature, handler) err |=MLX5E_HANDLE_FEATURE (NETIF_F_LRO , set_feature_lro); err |=MLX5E_HANDLE_FEATURE (NETIF_F_GRO_HW , set_feature_hw_gro);
Signature · 1 line
2.33.1
Re: [net 1/2] net/mlx5e: TC, Fix memory leak with rules with internal port
In reply to Saeed MahameedThis series was applied to netdev/net.git (master) by Saeed Mahameed <[email protected]>:
Hello:
This series was applied to netdev/net.git (master) by Saeed Mahameed <[email protected]>:
Quoted 8 lines · On Tue, 28 Dec 2021 22:53:51 -0800 you wrote:
From: Roi Dayan <[email protected]>
Fix a memory leak with decap rule with internal port as destination device. The driver allocates a modify hdr action but doesn't set the flow attr modify hdr action which results in skipping releasing the modify hdr action when releasing the flow.
[...]
Here is the summary with links:
- [net,1/2] net/mlx5e: TC, Fix memory leak with rules with internal port
https://git.kernel.org/netdev/net/c/077cdda764c7 - [net,2/2] net/mlx5e: Fix wrong features assignment in case of error https://git.kernel.org/netdev/net/c/992d8a4e38f0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html