Skip to content

Commit

Permalink
net/mlx5: reduce flex item flow handle size
Browse files Browse the repository at this point in the history
[ upstream commit cfe337e ]

Reduce flex item flow handle size from 32 bits to 8 bits for each
flow.
The patch will save memory in setups with millions of flows.

Fixes: a23e9b6 ("net/mlx5: handle flex item in flows")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
getelson-at-mellanox authored and kevintraynor committed Mar 8, 2022
1 parent ac14a09 commit 949a09c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/net/mlx5/mlx5_flow.h
Expand Up @@ -698,7 +698,6 @@ struct mlx5_flow_handle {
uint32_t split_flow_id:27; /**< Sub flow unique match flow id. */
uint32_t is_meter_flow_id:1; /**< Indicate if flow_id is for meter. */
uint32_t fate_action:3; /**< Fate action type. */
uint32_t flex_item; /**< referenced Flex Item bitmask. */
union {
uint32_t rix_hrxq; /**< Hash Rx queue object index. */
uint32_t rix_jump; /**< Index to the jump action resource. */
Expand All @@ -714,6 +713,7 @@ struct mlx5_flow_handle {
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
struct mlx5_flow_handle_dv dvh;
#endif
uint8_t flex_item; /**< referenced Flex Item bitmask. */
} __rte_packed;

/*
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/mlx5/mlx5_flow_dv.c
Expand Up @@ -10196,7 +10196,7 @@ flow_dv_translate_item_flex(struct rte_eth_dev *dev, void *matcher, void *key,
/* Don't count both inner and outer flex items in one rule. */
if (mlx5_flex_acquire_index(dev, spec->handle, true) != index)
MLX5_ASSERT(false);
dev_flow->handle->flex_item |= RTE_BIT32(index);
dev_flow->handle->flex_item |= (uint8_t)RTE_BIT32(index);
}
mlx5_flex_flow_translate_item(dev, matcher, key, item, is_inner);
}
Expand Down Expand Up @@ -14535,7 +14535,7 @@ flow_dv_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)
int index = rte_bsf32(dev_handle->flex_item);

mlx5_flex_release_index(dev, index);
dev_handle->flex_item &= ~RTE_BIT32(index);
dev_handle->flex_item &= ~(uint8_t)RTE_BIT32(index);
}
if (dev_handle->dvh.matcher)
flow_dv_matcher_release(dev, dev_handle);
Expand Down

0 comments on commit 949a09c

Please sign in to comment.