Skip to content

Commit aff44ad

Browse files
zorrohahaharaslandarawsheh
authored andcommitted
net/mlx5: move auxiliary data inline
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: 27d171b ("net/mlx5: abstract flow action and enable reconfigure") Cc: [email protected] Signed-off-by: Bing Zhao <[email protected]> Acked-by: Dariusz Sosnowski <[email protected]>
1 parent ad7db90 commit aff44ad

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

drivers/net/mlx5/linux/mlx5_os.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,16 +1643,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
16431643
/* Read link status in case it is up and there will be no event. */
16441644
mlx5_link_update(eth_dev, 0);
16451645
/* Watch LSC interrupts between port probe and port start. */
1646-
priv->sh->port[priv->dev_port - 1].nl_ih_port_id =
1647-
eth_dev->data->port_id;
1646+
priv->sh->port[priv->dev_port - 1].nl_ih_port_id = eth_dev->data->port_id;
16481647
mlx5_set_link_up(eth_dev);
16491648
for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
16501649
icfg[i].release_mem_en = !!sh->config.reclaim_mode;
16511650
if (sh->config.reclaim_mode)
16521651
icfg[i].per_core_cache = 0;
16531652
#ifdef HAVE_MLX5_HWS_SUPPORT
1654-
if (priv->sh->config.dv_flow_en == 2)
1653+
if (priv->sh->config.dv_flow_en == 2) {
16551654
icfg[i].size = sizeof(struct rte_flow_hw) + sizeof(struct rte_flow_nt2hws);
1655+
icfg[i].size += sizeof(struct rte_flow_hw_aux);
1656+
}
16561657
#endif
16571658
priv->flows[i] = mlx5_ipool_create(&icfg[i]);
16581659
if (!priv->flows[i])

drivers/net/mlx5/mlx5_flow_hw.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13500,8 +13500,9 @@ static int flow_hw_prepare(struct rte_eth_dev *dev,
1350013500
(*flow)->nt2hws = (struct rte_flow_nt2hws *)
1350113501
((uintptr_t)(*flow) + sizeof(struct rte_flow_hw));
1350213502
(*flow)->idx = idx;
13503-
(*flow)->nt2hws->flow_aux = mlx5_malloc(MLX5_MEM_ZERO, sizeof(struct rte_flow_hw_aux),
13504-
RTE_CACHE_LINE_SIZE, rte_dev_numa_node(dev->device));
13503+
(*flow)->nt2hws->flow_aux = (struct rte_flow_hw_aux *)
13504+
((uintptr_t)((*flow)->nt2hws) + sizeof(struct rte_flow_nt2hws));
13505+
1350513506
if (!(*flow)->nt2hws->flow_aux)
1350613507
return rte_flow_error_set(error, ENOMEM,
1350713508
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
@@ -14152,10 +14153,8 @@ flow_hw_destroy(struct rte_eth_dev *dev, struct rte_flow_hw *flow)
1415214153
* Notice matcher destroy will take place when matcher's list is destroyed
1415314154
* , same as for DV.
1415414155
*/
14155-
if (flow->nt2hws->flow_aux) {
14156-
mlx5_free(flow->nt2hws->flow_aux);
14156+
if (flow->nt2hws->flow_aux)
1415714157
flow->nt2hws->flow_aux = NULL;
14158-
}
1415914158
if (flow->nt2hws->rix_encap_decap) {
1416014159
flow_encap_decap_resource_release(dev, flow->nt2hws->rix_encap_decap);
1416114160
flow->nt2hws->rix_encap_decap = 0;

0 commit comments

Comments
 (0)