* [PATCH] net/mlx5: move auxiliary data inline
@ 2025-11-17 7:27 Bing Zhao
2025-11-17 10:07 ` Dariusz Sosnowski
0 siblings, 1 reply; 2+ messages in thread
From: Bing Zhao @ 2025-11-17 7:27 UTC (permalink / raw)
To: viacheslavo, dev, rasland
Cc: orika, dsosnowski, suanmingm, matan, thomas, mkashani
Since auxiliary structure is associated with per rule, it can be
allocated in the same ipool allocation to save the extra overhead
of the *alloc header and the unneeded CPU cycles.
Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure")
Cc: mkashani@nvidia.com
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 7 ++++---
drivers/net/mlx5/mlx5_flow_hw.c | 9 ++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 099ab65254..21387346b3 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1643,16 +1643,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
/* Read link status in case it is up and there will be no event. */
mlx5_link_update(eth_dev, 0);
/* Watch LSC interrupts between port probe and port start. */
- priv->sh->port[priv->dev_port - 1].nl_ih_port_id =
- eth_dev->data->port_id;
+ priv->sh->port[priv->dev_port - 1].nl_ih_port_id = eth_dev->data->port_id;
mlx5_set_link_up(eth_dev);
for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
icfg[i].release_mem_en = !!sh->config.reclaim_mode;
if (sh->config.reclaim_mode)
icfg[i].per_core_cache = 0;
#ifdef HAVE_MLX5_HWS_SUPPORT
- if (priv->sh->config.dv_flow_en == 2)
+ if (priv->sh->config.dv_flow_en == 2) {
icfg[i].size = sizeof(struct rte_flow_hw) + sizeof(struct rte_flow_nt2hws);
+ icfg[i].size += sizeof(struct rte_flow_hw_aux);
+ }
#endif
priv->flows[i] = mlx5_ipool_create(&icfg[i]);
if (!priv->flows[i])
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index e0f79932a5..51fa3eafda 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -13582,8 +13582,9 @@ static int flow_hw_prepare(struct rte_eth_dev *dev,
(*flow)->nt2hws = (struct rte_flow_nt2hws *)
((uintptr_t)(*flow) + sizeof(struct rte_flow_hw));
(*flow)->idx = idx;
- (*flow)->nt2hws->flow_aux = mlx5_malloc(MLX5_MEM_ZERO, sizeof(struct rte_flow_hw_aux),
- RTE_CACHE_LINE_SIZE, rte_dev_numa_node(dev->device));
+ (*flow)->nt2hws->flow_aux = (struct rte_flow_hw_aux *)
+ ((uintptr_t)((*flow)->nt2hws) + sizeof(struct rte_flow_nt2hws));
+
if (!(*flow)->nt2hws->flow_aux)
return rte_flow_error_set(error, ENOMEM,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
@@ -14234,10 +14235,8 @@ flow_hw_destroy(struct rte_eth_dev *dev, struct rte_flow_hw *flow)
* Notice matcher destroy will take place when matcher's list is destroyed
* , same as for DV.
*/
- if (flow->nt2hws->flow_aux) {
- mlx5_free(flow->nt2hws->flow_aux);
+ if (flow->nt2hws->flow_aux)
flow->nt2hws->flow_aux = NULL;
- }
if (flow->nt2hws->rix_encap_decap) {
flow_encap_decap_resource_release(dev, flow->nt2hws->rix_encap_decap);
flow->nt2hws->rix_encap_decap = 0;
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net/mlx5: move auxiliary data inline
2025-11-17 7:27 [PATCH] net/mlx5: move auxiliary data inline Bing Zhao
@ 2025-11-17 10:07 ` Dariusz Sosnowski
0 siblings, 0 replies; 2+ messages in thread
From: Dariusz Sosnowski @ 2025-11-17 10:07 UTC (permalink / raw)
To: Bing Zhao
Cc: viacheslavo, dev, rasland, orika, suanmingm, matan, thomas, mkashani
On Mon, Nov 17, 2025 at 09:27:52AM +0200, Bing Zhao wrote:
> Since auxiliary structure is associated with per rule, it can be
> allocated in the same ipool allocation to save the extra overhead
> of the *alloc header and the unneeded CPU cycles.
>
> Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure")
> Cc: mkashani@nvidia.com
>
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Best regards,
Dariusz Sosnowski
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-17 10:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-17 7:27 [PATCH] net/mlx5: move auxiliary data inline Bing Zhao
2025-11-17 10:07 ` Dariusz Sosnowski
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).