* [pull request][net 0/4] mlx5 fixes 2021-02-01
@ 2021-02-02 7:06 Saeed Mahameed
2021-02-02 7:07 ` [net 1/4] net/mlx5: Fix function calculation for page trees Saeed Mahameed
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Saeed Mahameed @ 2021-02-02 7:06 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: David S. Miller, netdev, Saeed Mahameed
From: Saeed Mahameed <saeedm@nvidia.com>
Hi Jakub,
This series introduces some fixes to mlx5 driver.
Please pull and let me know if there is any problem.
Please note the first patch in this series
("Fix function calculation for page trees") is fixing a regression
due to previous fix in net which you didn't include in your previous rc
pr. So I hope this series will make it into your next rc pr,
so mlx5 won't be broken in the next rc.
Thanks,
Saeed.
---
The following changes since commit 188fa104f2ba93887777ded2e600ce16d60bc3d7:
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue (2021-02-01 20:23:44 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2021-02-01
for you to fetch changes up to a34ffec8af8ff1c730697a99e09ec7b74a3423b6:
net/mlx5e: Release skb in case of failure in tc update skb (2021-02-01 23:02:02 -0800)
----------------------------------------------------------------
mlx5-fixes-2021-02-01
----------------------------------------------------------------
Daniel Jurgens (1):
net/mlx5: Fix function calculation for page trees
Maor Dickman (1):
net/mlx5e: Release skb in case of failure in tc update skb
Maor Gottlieb (1):
net/mlx5: Fix leak upon failure of rule creation
Maxim Mikityanskiy (1):
net/mlx5e: Update max_opened_tc also when channels are closed
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++----
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 16 ++++++++++++----
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 +++++
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 2 +-
4 files changed, 20 insertions(+), 9 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [net 1/4] net/mlx5: Fix function calculation for page trees
2021-02-02 7:06 [pull request][net 0/4] mlx5 fixes 2021-02-01 Saeed Mahameed
@ 2021-02-02 7:07 ` Saeed Mahameed
2021-02-02 17:00 ` patchwork-bot+netdevbpf
2021-02-02 7:07 ` [net 2/4] net/mlx5: Fix leak upon failure of rule creation Saeed Mahameed
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Saeed Mahameed @ 2021-02-02 7:07 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, netdev, Daniel Jurgens, Colin Ian King,
Saeed Mahameed
From: Daniel Jurgens <danielj@nvidia.com>
The function calculation always results in a value of 0. This works
generally, but when the release all pages feature is enabled it will
result in crashes.
Fixes: 0aa128475d33 ("net/mlx5: Maintain separate page trees for ECPF and PF functions")
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index eaa8958e24d7..c0656d4782e1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -76,7 +76,7 @@ enum {
static u32 get_function(u16 func_id, bool ec_function)
{
- return func_id & (ec_function << 16);
+ return (u32)func_id | (ec_function << 16);
}
static struct rb_root *page_root_per_function(struct mlx5_core_dev *dev, u32 function)
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [net 2/4] net/mlx5: Fix leak upon failure of rule creation
2021-02-02 7:06 [pull request][net 0/4] mlx5 fixes 2021-02-01 Saeed Mahameed
2021-02-02 7:07 ` [net 1/4] net/mlx5: Fix function calculation for page trees Saeed Mahameed
@ 2021-02-02 7:07 ` Saeed Mahameed
2021-02-02 7:07 ` [net 3/4] net/mlx5e: Update max_opened_tc also when channels are closed Saeed Mahameed
2021-02-02 7:07 ` [net 4/4] net/mlx5e: Release skb in case of failure in tc update skb Saeed Mahameed
3 siblings, 0 replies; 6+ messages in thread
From: Saeed Mahameed @ 2021-02-02 7:07 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, netdev, Maor Gottlieb, Alaa Hleihel, Mark Bloch,
Saeed Mahameed
From: Maor Gottlieb <maorg@nvidia.com>
When creation of a new rule that requires allocation of an FTE fails,
need to call to tree_put_node on the FTE in order to release its'
resource.
Fixes: cefc23554fc2 ("net/mlx5: Fix FTE cleanup")
Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
Reviewed-by: Alaa Hleihel <alaa@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 0fcee702b808..ee4d86c1f436 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1760,6 +1760,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
if (!fte_tmp)
continue;
rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte_tmp);
+ /* No error check needed here, because insert_fte() is not called */
up_write_ref_node(&fte_tmp->node, false);
tree_put_node(&fte_tmp->node, false);
kmem_cache_free(steering->ftes_cache, fte);
@@ -1812,6 +1813,8 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
up_write_ref_node(&g->node, false);
rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
up_write_ref_node(&fte->node, false);
+ if (IS_ERR(rule))
+ tree_put_node(&fte->node, false);
return rule;
}
rule = ERR_PTR(-ENOENT);
@@ -1910,6 +1913,8 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
up_write_ref_node(&g->node, false);
rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
up_write_ref_node(&fte->node, false);
+ if (IS_ERR(rule))
+ tree_put_node(&fte->node, false);
tree_put_node(&g->node, false);
return rule;
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [net 3/4] net/mlx5e: Update max_opened_tc also when channels are closed
2021-02-02 7:06 [pull request][net 0/4] mlx5 fixes 2021-02-01 Saeed Mahameed
2021-02-02 7:07 ` [net 1/4] net/mlx5: Fix function calculation for page trees Saeed Mahameed
2021-02-02 7:07 ` [net 2/4] net/mlx5: Fix leak upon failure of rule creation Saeed Mahameed
@ 2021-02-02 7:07 ` Saeed Mahameed
2021-02-02 7:07 ` [net 4/4] net/mlx5e: Release skb in case of failure in tc update skb Saeed Mahameed
3 siblings, 0 replies; 6+ messages in thread
From: Saeed Mahameed @ 2021-02-02 7:07 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, netdev, Maxim Mikityanskiy, Tariq Toukan,
Saeed Mahameed
From: Maxim Mikityanskiy <maximmi@mellanox.com>
max_opened_tc is used for stats, so that potentially non-zero stats
won't disappear when num_tc decreases. However, mlx5e_setup_tc_mqprio
fails to update it in the flow where channels are closed.
This commit fixes it. The new value of priv->channels.params.num_tc is
always checked on exit. In case of errors it will just be the old value,
and in case of success it will be the updated value.
Fixes: 05909babce53 ("net/mlx5e: Avoid reset netdev stats on configuration changes")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index a9d824a9cb05..3fc7d18ac868 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3627,12 +3627,10 @@ static int mlx5e_setup_tc_mqprio(struct mlx5e_priv *priv,
err = mlx5e_safe_switch_channels(priv, &new_channels,
mlx5e_num_channels_changed_ctx, NULL);
- if (err)
- goto out;
- priv->max_opened_tc = max_t(u8, priv->max_opened_tc,
- new_channels.params.num_tc);
out:
+ priv->max_opened_tc = max_t(u8, priv->max_opened_tc,
+ priv->channels.params.num_tc);
mutex_unlock(&priv->state_lock);
return err;
}
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [net 4/4] net/mlx5e: Release skb in case of failure in tc update skb
2021-02-02 7:06 [pull request][net 0/4] mlx5 fixes 2021-02-01 Saeed Mahameed
` (2 preceding siblings ...)
2021-02-02 7:07 ` [net 3/4] net/mlx5e: Update max_opened_tc also when channels are closed Saeed Mahameed
@ 2021-02-02 7:07 ` Saeed Mahameed
3 siblings, 0 replies; 6+ messages in thread
From: Saeed Mahameed @ 2021-02-02 7:07 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, netdev, Maor Dickman, Roi Dayan, Saeed Mahameed
From: Maor Dickman <maord@nvidia.com>
In case of failure in tc update skb the packet is dropped
without freeing the skb.
Fixed by freeing the skb in case failure in tc update skb.
Fixes: d6d27782864f ("net/mlx5: E-Switch, Restore chain id on miss")
Fixes: c75690972228 ("net/mlx5e: Add tc chains offload support for nic flows")
Signed-off-by: Maor Dickman <maord@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 7f5851c61218..ca4b55839a8a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -1262,8 +1262,10 @@ static void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);
if (mlx5e_cqe_regb_chain(cqe))
- if (!mlx5e_tc_update_skb(cqe, skb))
+ if (!mlx5e_tc_update_skb(cqe, skb)) {
+ dev_kfree_skb_any(skb);
goto free_wqe;
+ }
napi_gro_receive(rq->cq.napi, skb);
@@ -1316,8 +1318,10 @@ static void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
if (rep->vlan && skb_vlan_tag_present(skb))
skb_vlan_pop(skb);
- if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv))
+ if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv)) {
+ dev_kfree_skb_any(skb);
goto free_wqe;
+ }
napi_gro_receive(rq->cq.napi, skb);
@@ -1371,8 +1375,10 @@ static void mlx5e_handle_rx_cqe_mpwrq_rep(struct mlx5e_rq *rq, struct mlx5_cqe64
mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);
- if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv))
+ if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv)) {
+ dev_kfree_skb_any(skb);
goto mpwrq_cqe_out;
+ }
napi_gro_receive(rq->cq.napi, skb);
@@ -1528,8 +1534,10 @@ static void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cq
mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);
if (mlx5e_cqe_regb_chain(cqe))
- if (!mlx5e_tc_update_skb(cqe, skb))
+ if (!mlx5e_tc_update_skb(cqe, skb)) {
+ dev_kfree_skb_any(skb);
goto mpwrq_cqe_out;
+ }
napi_gro_receive(rq->cq.napi, skb);
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [net 1/4] net/mlx5: Fix function calculation for page trees
2021-02-02 7:07 ` [net 1/4] net/mlx5: Fix function calculation for page trees Saeed Mahameed
@ 2021-02-02 17:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-02-02 17:00 UTC (permalink / raw)
To: Saeed Mahameed; +Cc: kuba, davem, netdev, danielj, colin.king, saeedm
Hello:
This series was applied to netdev/net.git (refs/heads/master):
On Mon, 1 Feb 2021 23:07:00 -0800 you wrote:
> From: Daniel Jurgens <danielj@nvidia.com>
>
> The function calculation always results in a value of 0. This works
> generally, but when the release all pages feature is enabled it will
> result in crashes.
>
> Fixes: 0aa128475d33 ("net/mlx5: Maintain separate page trees for ECPF and PF functions")
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>
> [...]
Here is the summary with links:
- [net,1/4] net/mlx5: Fix function calculation for page trees
https://git.kernel.org/netdev/net/c/ed5e83a3c029
- [net,2/4] net/mlx5: Fix leak upon failure of rule creation
https://git.kernel.org/netdev/net/c/a5bfe6b4675e
- [net,3/4] net/mlx5e: Update max_opened_tc also when channels are closed
https://git.kernel.org/netdev/net/c/5a2ba25a55c4
- [net,4/4] net/mlx5e: Release skb in case of failure in tc update skb
https://git.kernel.org/netdev/net/c/a34ffec8af8f
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] 6+ messages in thread
end of thread, other threads:[~2021-02-02 17:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-02 7:06 [pull request][net 0/4] mlx5 fixes 2021-02-01 Saeed Mahameed
2021-02-02 7:07 ` [net 1/4] net/mlx5: Fix function calculation for page trees Saeed Mahameed
2021-02-02 17:00 ` patchwork-bot+netdevbpf
2021-02-02 7:07 ` [net 2/4] net/mlx5: Fix leak upon failure of rule creation Saeed Mahameed
2021-02-02 7:07 ` [net 3/4] net/mlx5e: Update max_opened_tc also when channels are closed Saeed Mahameed
2021-02-02 7:07 ` [net 4/4] net/mlx5e: Release skb in case of failure in tc update skb 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).