* [pull request][net 0/2] mlx5 fixes 2021-12-28
@ 2021-12-29 6:53 Saeed Mahameed
2021-12-29 6:53 ` [net 1/2] net/mlx5e: TC, Fix memory leak with rules with internal port Saeed Mahameed
2021-12-29 6:53 ` [net 2/2] net/mlx5e: Fix wrong features assignment in case of error Saeed Mahameed
0 siblings, 2 replies; 4+ messages in thread
From: Saeed Mahameed @ 2021-12-29 6:53 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski; +Cc: netdev, Saeed Mahameed
From: Saeed Mahameed <saeedm@nvidia.com>
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(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [net 1/2] net/mlx5e: TC, Fix memory leak with rules with internal port
2021-12-29 6:53 [pull request][net 0/2] mlx5 fixes 2021-12-28 Saeed Mahameed
@ 2021-12-29 6:53 ` Saeed Mahameed
2021-12-30 2:30 ` patchwork-bot+netdevbpf
2021-12-29 6:53 ` [net 2/2] net/mlx5e: Fix wrong features assignment in case of error Saeed Mahameed
1 sibling, 1 reply; 4+ messages in thread
From: Saeed Mahameed @ 2021-12-29 6:53 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski; +Cc: netdev, Roi Dayan, Saeed Mahameed
From: Roi Dayan <roid@nvidia.com>
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
Fixes: b16eb3c81fe2 ("net/mlx5: Support internal port as decap route device")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index a60c7680fd2b..5e454a14428f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -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;
}
}
--
2.33.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [net 2/2] net/mlx5e: Fix wrong features assignment in case of error
2021-12-29 6:53 [pull request][net 0/2] mlx5 fixes 2021-12-28 Saeed Mahameed
2021-12-29 6:53 ` [net 1/2] net/mlx5e: TC, Fix memory leak with rules with internal port Saeed Mahameed
@ 2021-12-29 6:53 ` Saeed Mahameed
1 sibling, 0 replies; 4+ messages in thread
From: Saeed Mahameed @ 2021-12-29 6:53 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski; +Cc: netdev, Gal Pressman, Saeed Mahameed
From: Gal Pressman <gal@nvidia.com>
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.
Fixes: 75b81ce719b7 ("net/mlx5e: Don't override netdev features field unless in error flow")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 3b0f3a831216..41379844eee1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -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);
--
2.33.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [net 1/2] net/mlx5e: TC, Fix memory leak with rules with internal port
2021-12-29 6:53 ` [net 1/2] net/mlx5e: TC, Fix memory leak with rules with internal port Saeed Mahameed
@ 2021-12-30 2:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-30 2:30 UTC (permalink / raw)
To: Saeed Mahameed; +Cc: davem, kuba, netdev, roid, saeedm
Hello:
This series was applied to netdev/net.git (master)
by Saeed Mahameed <saeedm@nvidia.com>:
On Tue, 28 Dec 2021 22:53:51 -0800 you wrote:
> From: Roi Dayan <roid@nvidia.com>
>
> 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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-30 2:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-29 6:53 [pull request][net 0/2] mlx5 fixes 2021-12-28 Saeed Mahameed
2021-12-29 6:53 ` [net 1/2] net/mlx5e: TC, Fix memory leak with rules with internal port Saeed Mahameed
2021-12-30 2:30 ` patchwork-bot+netdevbpf
2021-12-29 6:53 ` [net 2/2] net/mlx5e: Fix wrong features assignment in case of error Saeed Mahameed
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).