From: Alexandre Cassen <acassen@corp.free.fr>
To: Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Moshe Shemesh <moshe@nvidia.com>,
Yevgeny Kliteynik <kliteyn@nvidia.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: [PATCH net-next 1/2] net/mlx5e: TC, free NIC flow parse attributes after offload
Date: Fri, 9 Oct 2026 07:21:00 +0200 [thread overview]
Message-ID: <20261009052103.3621855-2-acassen@corp.free.fr> (raw)
In-Reply-To: <20261009052103.3621855-1-acassen@corp.free.fr>
A NIC flow holds a 4 KB allocation for its parse attributes until
deletion although nothing reads them after offload. Free them once the
rule is in.
Signed-off-by: Alexandre Cassen <acassen@corp.free.fr>
---
.../net/ethernet/mellanox/mlx5/core/en_tc.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index c99e824b4c6d..708b7987ea4c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1414,6 +1414,16 @@ void mlx5e_del_offloaded_nic_rule(struct mlx5e_priv *priv,
MLX5E_TC_FT_LEVEL);
}
+static void mlx5e_tc_free_parse_attr(struct mlx5_flow_attr *attr)
+{
+ if (!attr->parse_attr)
+ return;
+
+ mlx5e_mod_hdr_dealloc(&attr->parse_attr->mod_hdr_acts);
+ kvfree(attr->parse_attr);
+ attr->parse_attr = NULL;
+}
+
static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow)
{
@@ -1436,10 +1446,8 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
}
mutex_unlock(&tc->t_lock);
- if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
- mlx5e_mod_hdr_dealloc(&attr->parse_attr->mod_hdr_acts);
+ if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
mlx5e_tc_detach_mod_hdr(priv, flow, attr);
- }
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_COUNT)
mlx5_fc_destroy(priv->mdev, attr->counter);
@@ -1450,7 +1458,7 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
free_flow_post_acts(flow);
mlx5_tc_ct_delete_flow(get_ct_priv(flow->priv), attr);
- kvfree(attr->parse_attr);
+ mlx5e_tc_free_parse_attr(attr);
kfree(flow->attr);
}
@@ -4759,6 +4767,7 @@ mlx5e_add_nic_flow(struct mlx5e_priv *priv,
if (err)
goto err_free;
+ mlx5e_tc_free_parse_attr(flow->attr);
flow_flag_set(flow, OFFLOADED);
*__flow = flow;
@@ -4766,7 +4775,6 @@ mlx5e_add_nic_flow(struct mlx5e_priv *priv,
err_free:
flow_flag_set(flow, FAILED);
- mlx5e_mod_hdr_dealloc(&parse_attr->mod_hdr_acts);
mlx5e_flow_put(priv, flow);
out:
return err;
--
2.43.0
next prev parent reply other threads:[~2026-10-09 5:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 5:20 [PATCH net-next 0/2] net/mlx5: less memory per offloaded tc rule Alexandre Cassen
2026-10-09 5:21 ` Alexandre Cassen [this message]
2026-10-10 15:42 ` [PATCH net-next 1/2] net/mlx5e: TC, free NIC flow parse attributes after offload Simon Horman
2026-10-09 5:21 ` [PATCH net-next 2/2] net/mlx5: HWS, shrink FTE action array to fit Alexandre Cassen
2026-10-10 15:42 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261009052103.3621855-2-acassen@corp.free.fr \
--to=acassen@corp.free.fr \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kliteyn@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox