net/mlx5: add support for flow table resizing
cover net/mlx5: add support for flow table resizing
Gregory Etelson (3):
net/mlx5: fix parameters verification in HWS table create net/mlx5: move multi-pattern actions management to table level net/mlx5: add support for flow table resizing
Maayan Kashani (1):
net/mlx5: add resize function to ipool
Yevgeny Kliteynik (1):
net/mlx5/hws: add support for resizable matchers
drivers/net/mlx5/hws/mlx5dr.h | 39 ++ drivers/net/mlx5/hws/mlx5dr_definer.c | 5 +- drivers/net/mlx5/hws/mlx5dr_definer.h | 3 + drivers/net/mlx5/hws/mlx5dr_matcher.c | 181 ++++++- drivers/net/mlx5/hws/mlx5dr_matcher.h | 21 + drivers/net/mlx5/hws/mlx5dr_rule.c | 229 +++++++- drivers/net/mlx5/hws/mlx5dr_rule.h | 34 +- drivers/net/mlx5/hws/mlx5dr_send.c | 45 ++ drivers/net/mlx5/mlx5.h | 5 + drivers/net/mlx5/mlx5_flow.c | 51 ++ drivers/net/mlx5/mlx5_flow.h | 103 +++- drivers/net/mlx5/mlx5_flow_hw.c | 748 +++++++++++++++++++------- drivers/net/mlx5/mlx5_host.c | 211 ++++++++ drivers/net/mlx5/mlx5_utils.c | 29 + drivers/net/mlx5/mlx5_utils.h | 16 + 15 files changed, 1498 insertions(+), 222 deletions(-) create mode 100644 drivers/net/mlx5/mlx5_host.c
Depends-on: series-30952 ([v2] ethdev: add template table resize API)
Signature · 1 line
2.39.2
PATCH 1/5 net/mlx5/hws: add support for resizable matchers
From: Yevgeny Kliteynik <[email protected]>
Add support for matcher resize with the following new API calls:
- mlx5dr_matcher_resize_set_target
- mlx5dr_matcher_resize_rule_move
The first function links two matchers and allows moving rules from src matcher to dst matcher. Both matchers should have the same characteristics (e.g. same mt, same at). It is the user's responsibility to make sure that the dst matcher has enough space for the moved rules.
After this function, the user can move rules from src into dst matcher, and he is no longer allowed to insert rules to the src matcher.
The second function is used to move the rule from matcher that is being resized to a bigger matcher. Moving a single rule includes creating a new rule in the destination matcher, and deleting the rule from the source matcher. This operation creates a single completion.
--- drivers/net/mlx5/hws/mlx5dr.h | 39 +++++ drivers/net/mlx5/hws/mlx5dr_definer.c | 5 +- drivers/net/mlx5/hws/mlx5dr_definer.h | 3 + drivers/net/mlx5/hws/mlx5dr_matcher.c | 181 +++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_matcher.h | 21 +++ drivers/net/mlx5/hws/mlx5dr_rule.c | 229 ++++++++++++++++++++++++-- drivers/net/mlx5/hws/mlx5dr_rule.h | 34 +++- drivers/net/mlx5/hws/mlx5dr_send.c | 45 +++++ drivers/net/mlx5/mlx5_flow.h | 2 + 9 files changed, 537 insertions(+), 22 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +39 -0
@@ -139,6 +139,8 @@ struct mlx5dr_matcher_attr {/* Define the insertion and distribution modes for this matcher */ enum mlx5dr_matcher_insert_mode insert_mode;enum mlx5dr_matcher_distribute_mode distribute_mode; +/* Define whether the created matcher supports resizing into a bigger matcher */ +bool resizable; union { struct { uint8_t sz_row_log;
@@ -419,6 +421,43 @@ int mlx5dr_matcher_destroy(struct mlx5dr_matcher *matcher);int mlx5dr_matcher_attach_at (struct mlx5dr_matcher *matcher,struct mlx5dr_action_template *at); +/* Link two matchers and enable moving rules from src matcher to dst matcher. +* Both matchers must be in the same table type, must be created with 'resizable' +* property, and should have the same characteristics (e.g. same mt, same at). +* +* It is the user's responsibility to make sure that the dst matcher +* was allocated with the appropriate size. +* +* Once the function is completed, the user is: +* - allowed to move rules from src into dst matcher +* - no longer allowed to insert rules to the src matcher +* +* The user is always allowed to insert rules to the dst matcher and +* to delete rules from any matcher. +* +* @param[in] src_matcher +* source matcher for moving rules from +* @param[in] dst_matcher +* destination matcher for moving rules to +* @return zero on successful move, non zero otherwise. +*/ +int mlx5dr_matcher_resize_set_target (struct mlx5dr_matcher *src_matcher, +struct mlx5dr_matcher *dst_matcher); + +/* Enqueue moving rule operation: moving rule from src matcher to a dst matcher +* +* @param[in] src_matcher +* matcher that the rule belongs to +* @param[in] rule +* the rule to move +* @param[in] attr +* rule attributes +* @return zero on success, non zero otherwise. +*/ +int mlx5dr_matcher_resize_rule_move (struct mlx5dr_matcher *src_matcher, +struct mlx5dr_rule *rule, +struct mlx5dr_rule_attr *attr); +/* Get the size of the rule handle (mlx5dr_rule) to be used on rule creation. * * @return size in bytes of rule handle struct.
drivers/net/mlx5/hws/mlx5dr_definer.c +2 -3
@@ -2919,9 +2919,8 @@ int mlx5dr_definer_get_id(struct mlx5dr_definer *definer)return definer->obj->id; } -static int -mlx5dr_definer_compare (struct mlx5dr_definer *definer_a, -struct mlx5dr_definer *definer_b) +int mlx5dr_definer_compare (struct mlx5dr_definer *definer_a, +struct mlx5dr_definer *definer_b) {int i;
drivers/net/mlx5/hws/mlx5dr_definer.h +3 -0
@@ -673,4 +673,7 @@ int mlx5dr_definer_init_cache(struct mlx5dr_definer_cache **cache);void mlx5dr_definer_uninit_cache (struct mlx5dr_definer_cache *cache); +int mlx5dr_definer_compare (struct mlx5dr_definer *definer_a, +struct mlx5dr_definer *definer_b); +#endif
drivers/net/mlx5/hws/mlx5dr_matcher.c +180 -1
214 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_matcher.h +21 -0
@@ -26,6 +26,7 @@ enum mlx5dr_matcher_flags {MLX5DR_MATCHER_FLAGS_RANGE_DEFINER =1 <<0 ,MLX5DR_MATCHER_FLAGS_HASH_DEFINER =1 <<1 ,MLX5DR_MATCHER_FLAGS_COLLISION =1 <<2 , + MLX5DR_MATCHER_FLAGS_RESIZABLE = 1 << 3, }; struct mlx5dr_match_template {
@@ -59,6 +60,14 @@ struct mlx5dr_matcher_action_ste {uint8_t max_stes; }; +struct mlx5dr_matcher_resize_data { +struct mlx5dr_pool_chunk stc; +struct mlx5dr_devx_obj *action_ste_rtc_0; +struct mlx5dr_devx_obj *action_ste_rtc_1; +struct mlx5dr_pool *action_ste_pool; +LIST_ENTRY (mlx5dr_matcher_resize_data) next; +}; +struct mlx5dr_matcher {struct mlx5dr_table *tbl;struct mlx5dr_matcher_attr attr;
@@ -71,10 +80,12 @@ struct mlx5dr_matcher {uint8_t flags;struct mlx5dr_devx_obj *end_ft;struct mlx5dr_matcher *col_matcher; +struct mlx5dr_matcher *resize_dst;struct mlx5dr_matcher_match_ste match_ste;struct mlx5dr_matcher_action_ste action_ste;struct mlx5dr_definer *hash_definer;LIST_ENTRY (mlx5dr_matcher) next; + LIST_HEAD(resize_data_head, mlx5dr_matcher_resize_data) resize_data; }; static inline bool
@@ -89,6 +100,16 @@ mlx5dr_matcher_mt_is_range(struct mlx5dr_match_template *mt)return (!!mt->range_definer); } +static inline bool mlx5dr_matcher_is_resizable (struct mlx5dr_matcher *matcher) +{ +return !!(matcher->flags &MLX5DR_MATCHER_FLAGS_RESIZABLE ); +} + +static inline bool mlx5dr_matcher_is_in_resize (struct mlx5dr_matcher *matcher) +{ +return !!matcher->resize_dst; +} +static inline bool mlx5dr_matcher_req_fw_wqe (struct mlx5dr_matcher *matcher) {/* Currently HWS doesn't support hash different from match or range */
drivers/net/mlx5/hws/mlx5dr_rule.c +212 -17
349 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_rule.h +33 -1
@@ -10,7 +10,9 @@ enum {MLX5DR_ACTIONS_SZ =12 ,MLX5DR_MATCH_TAG_SZ =32 ,MLX5DR_JUMBO_TAG_SZ =44 , - MLX5DR_STE_SZ = 64, +MLX5DR_STE_SZ =MLX5DR_STE_CTRL_SZ + +MLX5DR_ACTIONS_SZ + + MLX5DR_MATCH_TAG_SZ, }; enum mlx5dr_rule_status {
@@ -23,6 +25,12 @@ enum mlx5dr_rule_status { MLX5DR_RULE_STATUS_FAILED, }; +enum mlx5dr_rule_move_state { +MLX5DR_RULE_RESIZE_STATE_IDLE , +MLX5DR_RULE_RESIZE_STATE_WRITING , +MLX5DR_RULE_RESIZE_STATE_DELETING , +}; +struct mlx5dr_rule_match_tag {union {uint8_t jumbo[MLX5DR_JUMBO_TAG_SZ ];
@@ -33,6 +41,17 @@ struct mlx5dr_rule_match_tag { }; }; +struct mlx5dr_rule_resize_info { +uint8_t state; +uint32_t rtc_0; +uint32_t rtc_1; +uint32_t rule_idx; +struct mlx5dr_pool *action_ste_pool; +struct mlx5dr_rule_match_tag tag; +uint8_t ctrl_seg[MLX5DR_WQE_SZ_GTA_CTRL ];/* Ctrl segment of STE: 48 bytes */ +uint8_t data_seg[MLX5DR_STE_SZ ];/* Data segment of STE: 64 bytes */ +}; +struct mlx5dr_rule {struct mlx5dr_matcher *matcher;union {
@@ -40,6 +59,7 @@ struct mlx5dr_rule {/* Pointer to tag to store more than one tag */ struct mlx5dr_rule_match_tag *tag_ptr;struct ibv_flow *flow; +struct mlx5dr_rule_resize_info *resize_info; };uint32_t rtc_0;/* The RTC into which the STE was inserted */ uint32_t rtc_1;/* The RTC into which the STE was inserted */
@@ -50,4 +70,16 @@ struct mlx5dr_rule {void mlx5dr_rule_free_action_ste_idx (struct mlx5dr_rule *rule); +int mlx5dr_rule_move_hws_remove (struct mlx5dr_rule *rule, +void *queue,void *user_data); + +int mlx5dr_rule_move_hws_add (struct mlx5dr_rule *rule, +struct mlx5dr_rule_attr *attr); + +static inline bool mlx5dr_rule_move_in_progress (struct mlx5dr_rule *rule) +{ +return rule->resize_info && + rule->resize_info->state !=MLX5DR_RULE_RESIZE_STATE_IDLE ; +} +#endif /* MLX5DR_RULE_H_ */
drivers/net/mlx5/hws/mlx5dr_send.c +45 -0
57 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -17,6 +17,8 @@#include <mlx5_prm.h> #include "mlx5.h" +#include "hws/mlx5dr.h" +#include "rte_flow.h" #include "rte_pmd_mlx5.h" #include "hws/mlx5dr.h"
Signature · 1 line
2.39.2
v2 cover net/mlx5: add support for flow table resizing
Support template table resize API.
Gregory Etelson (3):
net/mlx5: fix parameters verification in HWS table create net/mlx5: move multi-pattern actions management to table level net/mlx5: add support for flow table resizing
Maayan Kashani (1):
net/mlx5: add resize function to ipool
drivers/net/mlx5/mlx5.h | 5 + drivers/net/mlx5/mlx5_flow.c | 51 +++ drivers/net/mlx5/mlx5_flow.h | 101 ++++- drivers/net/mlx5/mlx5_flow_hw.c | 750 +++++++++++++++++++++++--------- drivers/net/mlx5/mlx5_utils.c | 29 ++ drivers/net/mlx5/mlx5_utils.h | 16 + 6 files changed, 752 insertions(+), 200 deletions(-)
--
v2: Update PMD after DPDK API changes.
Signature · 1 line
2.39.2
PATCH v2 1/4 net/mlx5: add resize function to ipool
From: Maayan Kashani <[email protected]>
Before this patch, ipool size could be fixed by
setting max_idx in mlx5_indexed_pool_config upon
ipool creation. Or it can be auto resized to the
maximum limit by setting max_idx to zero upon
ipool creation and the saved value is the maximum
index possible.
This patch adds ipool_resize API that enables to
update the value of max_idx in case it is not set to maximum, meaning not in auto resize mode. It
enables the allocation of new trunk when using malloc/zmalloc up to the max_idx limit. Please
notice the resize number of entries should be divisible by trunk_size.
--- drivers/net/mlx5/mlx5_utils.c | 29 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_utils.h | 16 ++++++++++++++++ 2 files changed, 45 insertions(+)
drivers/net/mlx5/mlx5_utils.c +29 -0
@@ -809,6 +809,35 @@ mlx5_ipool_get_next(struct mlx5_indexed_pool *pool, uint32_t *pos)return NULL ; } +int +mlx5_ipool_resize (struct mlx5_indexed_pool *pool,uint32_t num_entries) +{ +uint32_t cur_max_idx; +uint32_t max_index =mlx5_trunk_idx_offset_get (pool,TRUNK_MAX_IDX +1 ); + +if (num_entries % pool->cfg.trunk_size) { +DRV_LOG (ERR ,"num_entries param should be trunk_size(=%u) multiplication\n" , + pool->cfg.trunk_size); +return -EINVAL ; + } + +mlx5_ipool_lock (pool); + cur_max_idx = pool->cfg.max_idx + num_entries; +/* If the ipool max idx is above maximum or uint overflow occurred. */ +if (cur_max_idx > max_index || cur_max_idx < num_entries) { +DRV_LOG (ERR ,"Ipool resize failed\n" ); +DRV_LOG (ERR ,"Adding %u entries to existing %u entries, will cross max limit(=%u)\n" , + num_entries, cur_max_idx, max_index); +mlx5_ipool_unlock (pool); +return -EINVAL ; + } + +/* Update maximum entries number. */ + pool->cfg.max_idx = cur_max_idx; +mlx5_ipool_unlock (pool); +return 0 ; +} +void mlx5_ipool_dump (struct mlx5_indexed_pool *pool) {
drivers/net/mlx5/mlx5_utils.h +16 -0
@@ -427,6 +427,22 @@ void mlx5_ipool_flush_cache(struct mlx5_indexed_pool *pool);*/ void *mlx5_ipool_get_next (struct mlx5_indexed_pool *pool,uint32_t *pos); +/** +* This function resize the ipool. +* +* @param pool +* Pointer to the index memory pool handler. +* @param num_entries +* Number of entries to be added to the pool. +* This number should be divisible by trunk_size. +* +* @return +* - non-zero value on error. +* - 0 on success. +* +*/ +int mlx5_ipool_resize (struct mlx5_indexed_pool *pool,uint32_t num_entries); +/** * This function allocates new empty Three-level table. *
Signature · 1 line
2.39.2
PATCH v2 2/4 net/mlx5: fix parameters verification in HWS table create
In reply to Gregory EtelsonModified the conditionals in flow_hw_table_create() to use bitwise AND instead of equality checks when assessing table_cfg->attr->specialize bitmask.
This will allow for greater flexibility as the bitmask may encapsulate multiple flags.
The patch maintains the previous behavior with single flag values, while providing support for multiple flags.
--- drivers/net/mlx5/mlx5_flow_hw.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +17 -6
@@ -4390,12 +4390,23 @@ flow_hw_table_create(struct rte_eth_dev *dev, matcher_attr.rule.num_log =rte_log2_u32 (nb_flows);/* Parse hints information. */ if (attr->specialize) { -if (attr->specialize ==RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG ) - matcher_attr.optimize_flow_src =MLX5DR_MATCHER_FLOW_SRC_WIRE ; -else if (attr->specialize ==RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ) - matcher_attr.optimize_flow_src =MLX5DR_MATCHER_FLOW_SRC_VPORT ; -else -DRV_LOG (INFO ,"Unsupported hint value %x" , attr->specialize); +uint32_t val =RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG | +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ; + +if ((attr->specialize & val) == val) { +DRV_LOG (INFO ,"Invalid hint value %x" , + attr->specialize); + rte_errno =EINVAL ; + goto it_error; + } +if (attr->specialize & +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG ) + matcher_attr.optimize_flow_src = +MLX5DR_MATCHER_FLOW_SRC_WIRE ; +else if (attr->specialize & +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ) + matcher_attr.optimize_flow_src = +MLX5DR_MATCHER_FLOW_SRC_VPORT ; }/* Build the item template. */ for (i =0 ; i < nb_item_templates; i++) {
Signature · 1 line
2.39.2
PATCH v2 3/4 net/mlx5: move multi-pattern actions management to table level
In reply to Gregory EtelsonThe multi-pattern actions related structures and management code have been moved to the table level.
That code refactor is required for the upcoming table resize feature.
--- drivers/net/mlx5/mlx5_flow.h | 73 ++++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 225 +++++++++++++++----------------- 2 files changed, 173 insertions(+), 125 deletions(-)
drivers/net/mlx5/mlx5_flow.h +71 -2
@@ -1410,7 +1410,6 @@ struct mlx5_hw_encap_decap_action {/* Is header_reformat action shared across flows in table. */ uint32_t shared:1; uint32_t multi_pattern:1; -volatile uint32_t *multi_pattern_refcnt;size_t data_size;/* Action metadata size. */ uint8_t data[];/* Action data. */ };
@@ -1433,7 +1432,6 @@ struct mlx5_hw_modify_header_action {/* Is MODIFY_HEADER action shared across flows in table. */ uint32_t shared:1; uint32_t multi_pattern:1; -volatile uint32_t *multi_pattern_refcnt;/* Amount of modification commands stored in the precompiled buffer. */ uint32_t mhdr_cmds_num;/* Precompiled modification commands. */
@@ -1487,6 +1485,76 @@ struct mlx5_flow_group {#define MLX5_HW_TBL_MAX_ITEM_TEMPLATE 2#define MLX5_HW_TBL_MAX_ACTION_TEMPLATE 32 +#define MLX5_MULTIPATTERN_ENCAP_NUM 5 +#define MLX5_MAX_TABLE_RESIZE_NUM 64 + +struct mlx5_multi_pattern_segment { +uint32_t capacity; +uint32_t head_index; +struct mlx5dr_action *mhdr_action; +struct mlx5dr_action *reformat_action[MLX5_MULTIPATTERN_ENCAP_NUM ]; +}; + +struct mlx5_tbl_multi_pattern_ctx { +struct { +uint32_t elements_num; +struct mlx5dr_action_reformat_header reformat_hdr[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; +/** +* insert_header structure is larger than reformat_header. +* Enclosing these structures with union will case a gap between +* reformat_hdr array elements. +* mlx5dr_action_create_reformat() expects adjacent array elements. +*/ +struct mlx5dr_action_insert_header insert_hdr[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; + } reformat[MLX5_MULTIPATTERN_ENCAP_NUM ]; + +struct { +uint32_t elements_num; +struct mlx5dr_action_mh_pattern pattern[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; + } mh; +struct mlx5_multi_pattern_segment segments[MLX5_MAX_TABLE_RESIZE_NUM ]; +}; + +static __rte_always_inline void +mlx5_multi_pattern_activate (struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ + mpctx->segments[0 ].head_index =1 ; +} + +static __rte_always_inline bool +mlx5_is_multi_pattern_active (const struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ +return mpctx->segments[0 ].head_index ==1 ; +} + +static __rte_always_inline struct mlx5_multi_pattern_segment * +mlx5_multi_pattern_segment_get_next (struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ +int i; + +for (i =0 ; i <MLX5_MAX_TABLE_RESIZE_NUM ; i++) { +if (!mpctx->segments[i].capacity) +return &mpctx->segments[i]; + } +return NULL ; +} + +static __rte_always_inline struct mlx5_multi_pattern_segment * +mlx5_multi_pattern_segment_find (struct mlx5_tbl_multi_pattern_ctx *mpctx, +uint32_t flow_resource_ix) +{ +int i; + +for (i =0 ; i <MLX5_MAX_TABLE_RESIZE_NUM ; i++) { +uint32_t limit = mpctx->segments[i].head_index + + mpctx->segments[i].capacity; + +if (flow_resource_ix < limit) +return &mpctx->segments[i]; + } +return NULL ; +} +struct mlx5_flow_template_table_cfg {struct rte_flow_template_table_attr attr;/* Table attributes passed through flow API. */ bool external;/* True if created by flow API, false if table is internal to PMD. */
@@ -1507,6 +1575,7 @@ struct rte_flow_template_table {uint8_t nb_item_templates;/* Item template number. */ uint8_t nb_action_templates;/* Action template number. */ uint32_t refcnt;/* Table reference counter. */ + struct mlx5_tbl_multi_pattern_ctx mpctx; };#endif
drivers/net/mlx5/mlx5_flow_hw.c +102 -123
362 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v2 4/4 net/mlx5: add support for flow table resizing
In reply to Gregory EtelsonSupport template table API in PMD.
The patch allows to increase existing table capacity.
--- drivers/net/mlx5/mlx5.h | 5 + drivers/net/mlx5/mlx5_flow.c | 51 ++++ drivers/net/mlx5/mlx5_flow.h | 84 ++++-- drivers/net/mlx5/mlx5_flow_hw.c | 518 +++++++++++++++++++++++++++----- 4 files changed, 553 insertions(+), 105 deletions(-)
drivers/net/mlx5/mlx5.h +5 -0
@@ -380,6 +380,9 @@ enum mlx5_hw_job_type {MLX5_HW_Q_JOB_TYPE_UPDATE ,/* Flow update job type. */ MLX5_HW_Q_JOB_TYPE_QUERY ,/* Flow query job type. */ MLX5_HW_Q_JOB_TYPE_UPDATE_QUERY ,/* Flow update and query job type. */ +MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_CREATE ,/* Non-optimized flow create job type. */ +MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_DESTROY ,/* Non-optimized destroy create job type. */ + MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_MOVE, /* Move flow after table resize. */ }; enum mlx5_hw_indirect_type {
@@ -422,6 +425,8 @@ struct mlx5_hw_q {struct mlx5_hw_q_job **job;/* LIFO header. */ struct rte_ring *indir_cq;/* Indirect action SW completion queue. */ struct rte_ring *indir_iq;/* Indirect action SW in progress queue. */ +struct rte_ring *flow_transfer_pending; +struct rte_ring *flow_transfer_completed; } __rte_cache_aligned;
drivers/net/mlx5/mlx5_flow.c +51 -0
69 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +55 -29
136 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +442 -76
702 lines not on this page · raw message
Signature · 1 line
2.39.2
v3 cover net/mlx5: add support for flow table resizing
In reply to Gregory EtelsonSupport template table resize API.
Gregory Etelson (3):
net/mlx5: fix parameters verification in HWS table create net/mlx5: move multi-pattern actions management to table level net/mlx5: add support for flow table resizing
Maayan Kashani (1):
net/mlx5: add resize function to ipool
drivers/net/mlx5/mlx5.h | 5 + drivers/net/mlx5/mlx5_flow.c | 51 +++ drivers/net/mlx5/mlx5_flow.h | 101 ++++- drivers/net/mlx5/mlx5_flow_hw.c | 761 +++++++++++++++++++++++--------- drivers/net/mlx5/mlx5_utils.c | 29 ++ drivers/net/mlx5/mlx5_utils.h | 16 + 6 files changed, 763 insertions(+), 200 deletions(-)
--
v2: Update PMD after DPDK API changes.
v3: Use RTE atomic API.
Signature · 1 line
2.39.2
PATCH v3 1/4 net/mlx5: add resize function to ipool
From: Maayan Kashani <[email protected]>
Before this patch, ipool size could be fixed by
setting max_idx in mlx5_indexed_pool_config upon
ipool creation. Or it can be auto resized to the
maximum limit by setting max_idx to zero upon
ipool creation and the saved value is the maximum
index possible.
This patch adds ipool_resize API that enables to
update the value of max_idx in case it is not set to maximum, meaning not in auto resize mode. It
enables the allocation of new trunk when using malloc/zmalloc up to the max_idx limit. Please
notice the resize number of entries should be divisible by trunk_size.
--- drivers/net/mlx5/mlx5_utils.c | 29 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_utils.h | 16 ++++++++++++++++ 2 files changed, 45 insertions(+)
drivers/net/mlx5/mlx5_utils.c +29 -0
@@ -809,6 +809,35 @@ mlx5_ipool_get_next(struct mlx5_indexed_pool *pool, uint32_t *pos)return NULL ; } +int +mlx5_ipool_resize (struct mlx5_indexed_pool *pool,uint32_t num_entries) +{ +uint32_t cur_max_idx; +uint32_t max_index =mlx5_trunk_idx_offset_get (pool,TRUNK_MAX_IDX +1 ); + +if (num_entries % pool->cfg.trunk_size) { +DRV_LOG (ERR ,"num_entries param should be trunk_size(=%u) multiplication\n" , + pool->cfg.trunk_size); +return -EINVAL ; + } + +mlx5_ipool_lock (pool); + cur_max_idx = pool->cfg.max_idx + num_entries; +/* If the ipool max idx is above maximum or uint overflow occurred. */ +if (cur_max_idx > max_index || cur_max_idx < num_entries) { +DRV_LOG (ERR ,"Ipool resize failed\n" ); +DRV_LOG (ERR ,"Adding %u entries to existing %u entries, will cross max limit(=%u)\n" , + num_entries, cur_max_idx, max_index); +mlx5_ipool_unlock (pool); +return -EINVAL ; + } + +/* Update maximum entries number. */ + pool->cfg.max_idx = cur_max_idx; +mlx5_ipool_unlock (pool); +return 0 ; +} +void mlx5_ipool_dump (struct mlx5_indexed_pool *pool) {
drivers/net/mlx5/mlx5_utils.h +16 -0
@@ -427,6 +427,22 @@ void mlx5_ipool_flush_cache(struct mlx5_indexed_pool *pool);*/ void *mlx5_ipool_get_next (struct mlx5_indexed_pool *pool,uint32_t *pos); +/** +* This function resize the ipool. +* +* @param pool +* Pointer to the index memory pool handler. +* @param num_entries +* Number of entries to be added to the pool. +* This number should be divisible by trunk_size. +* +* @return +* - non-zero value on error. +* - 0 on success. +* +*/ +int mlx5_ipool_resize (struct mlx5_indexed_pool *pool,uint32_t num_entries); +/** * This function allocates new empty Three-level table. *
Signature · 1 line
2.39.2
PATCH v3 2/4 net/mlx5: fix parameters verification in HWS table create
In reply to Gregory EtelsonModified the conditionals in flow_hw_table_create() to use bitwise AND instead of equality checks when assessing table_cfg->attr->specialize bitmask.
This will allow for greater flexibility as the bitmask may encapsulate multiple flags.
The patch maintains the previous behavior with single flag values, while providing support for multiple flags.
--- drivers/net/mlx5/mlx5_flow_hw.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +17 -6
@@ -4390,12 +4390,23 @@ flow_hw_table_create(struct rte_eth_dev *dev, matcher_attr.rule.num_log =rte_log2_u32 (nb_flows);/* Parse hints information. */ if (attr->specialize) { -if (attr->specialize ==RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG ) - matcher_attr.optimize_flow_src =MLX5DR_MATCHER_FLOW_SRC_WIRE ; -else if (attr->specialize ==RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ) - matcher_attr.optimize_flow_src =MLX5DR_MATCHER_FLOW_SRC_VPORT ; -else -DRV_LOG (INFO ,"Unsupported hint value %x" , attr->specialize); +uint32_t val =RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG | +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ; + +if ((attr->specialize & val) == val) { +DRV_LOG (INFO ,"Invalid hint value %x" , + attr->specialize); + rte_errno =EINVAL ; + goto it_error; + } +if (attr->specialize & +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG ) + matcher_attr.optimize_flow_src = +MLX5DR_MATCHER_FLOW_SRC_WIRE ; +else if (attr->specialize & +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ) + matcher_attr.optimize_flow_src = +MLX5DR_MATCHER_FLOW_SRC_VPORT ; }/* Build the item template. */ for (i =0 ; i < nb_item_templates; i++) {
Signature · 1 line
2.39.2
PATCH v3 3/4 net/mlx5: move multi-pattern actions management to table level
In reply to Gregory EtelsonThe multi-pattern actions related structures and management code have been moved to the table level.
That code refactor is required for the upcoming table resize feature.
--- drivers/net/mlx5/mlx5_flow.h | 73 ++++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 226 +++++++++++++++----------------- 2 files changed, 174 insertions(+), 125 deletions(-)
drivers/net/mlx5/mlx5_flow.h +71 -2
@@ -1410,7 +1410,6 @@ struct mlx5_hw_encap_decap_action {/* Is header_reformat action shared across flows in table. */ uint32_t shared:1; uint32_t multi_pattern:1; -volatile uint32_t *multi_pattern_refcnt;size_t data_size;/* Action metadata size. */ uint8_t data[];/* Action data. */ };
@@ -1433,7 +1432,6 @@ struct mlx5_hw_modify_header_action {/* Is MODIFY_HEADER action shared across flows in table. */ uint32_t shared:1; uint32_t multi_pattern:1; -volatile uint32_t *multi_pattern_refcnt;/* Amount of modification commands stored in the precompiled buffer. */ uint32_t mhdr_cmds_num;/* Precompiled modification commands. */
@@ -1487,6 +1485,76 @@ struct mlx5_flow_group {#define MLX5_HW_TBL_MAX_ITEM_TEMPLATE 2#define MLX5_HW_TBL_MAX_ACTION_TEMPLATE 32 +#define MLX5_MULTIPATTERN_ENCAP_NUM 5 +#define MLX5_MAX_TABLE_RESIZE_NUM 64 + +struct mlx5_multi_pattern_segment { +uint32_t capacity; +uint32_t head_index; +struct mlx5dr_action *mhdr_action; +struct mlx5dr_action *reformat_action[MLX5_MULTIPATTERN_ENCAP_NUM ]; +}; + +struct mlx5_tbl_multi_pattern_ctx { +struct { +uint32_t elements_num; +struct mlx5dr_action_reformat_header reformat_hdr[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; +/** +* insert_header structure is larger than reformat_header. +* Enclosing these structures with union will case a gap between +* reformat_hdr array elements. +* mlx5dr_action_create_reformat() expects adjacent array elements. +*/ +struct mlx5dr_action_insert_header insert_hdr[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; + } reformat[MLX5_MULTIPATTERN_ENCAP_NUM ]; + +struct { +uint32_t elements_num; +struct mlx5dr_action_mh_pattern pattern[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; + } mh; +struct mlx5_multi_pattern_segment segments[MLX5_MAX_TABLE_RESIZE_NUM ]; +}; + +static __rte_always_inline void +mlx5_multi_pattern_activate (struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ + mpctx->segments[0 ].head_index =1 ; +} + +static __rte_always_inline bool +mlx5_is_multi_pattern_active (const struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ +return mpctx->segments[0 ].head_index ==1 ; +} + +static __rte_always_inline struct mlx5_multi_pattern_segment * +mlx5_multi_pattern_segment_get_next (struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ +int i; + +for (i =0 ; i <MLX5_MAX_TABLE_RESIZE_NUM ; i++) { +if (!mpctx->segments[i].capacity) +return &mpctx->segments[i]; + } +return NULL ; +} + +static __rte_always_inline struct mlx5_multi_pattern_segment * +mlx5_multi_pattern_segment_find (struct mlx5_tbl_multi_pattern_ctx *mpctx, +uint32_t flow_resource_ix) +{ +int i; + +for (i =0 ; i <MLX5_MAX_TABLE_RESIZE_NUM ; i++) { +uint32_t limit = mpctx->segments[i].head_index + + mpctx->segments[i].capacity; + +if (flow_resource_ix < limit) +return &mpctx->segments[i]; + } +return NULL ; +} +struct mlx5_flow_template_table_cfg {struct rte_flow_template_table_attr attr;/* Table attributes passed through flow API. */ bool external;/* True if created by flow API, false if table is internal to PMD. */
@@ -1507,6 +1575,7 @@ struct rte_flow_template_table {uint8_t nb_item_templates;/* Item template number. */ uint8_t nb_action_templates;/* Action template number. */ uint32_t refcnt;/* Table reference counter. */ + struct mlx5_tbl_multi_pattern_ctx mpctx; };#endif
drivers/net/mlx5/mlx5_flow_hw.c +103 -123
363 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v3 4/4 net/mlx5: add support for flow table resizing
In reply to Gregory EtelsonSupport template table API in PMD.
The patch allows to increase existing table capacity.
--- drivers/net/mlx5/mlx5.h | 5 + drivers/net/mlx5/mlx5_flow.c | 51 +++ drivers/net/mlx5/mlx5_flow.h | 84 +++-- drivers/net/mlx5/mlx5_flow_hw.c | 530 +++++++++++++++++++++++++++----- 4 files changed, 564 insertions(+), 106 deletions(-)
drivers/net/mlx5/mlx5.h +5 -0
@@ -380,6 +380,9 @@ enum mlx5_hw_job_type {MLX5_HW_Q_JOB_TYPE_UPDATE ,/* Flow update job type. */ MLX5_HW_Q_JOB_TYPE_QUERY ,/* Flow query job type. */ MLX5_HW_Q_JOB_TYPE_UPDATE_QUERY ,/* Flow update and query job type. */ +MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_CREATE ,/* Non-optimized flow create job type. */ +MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_DESTROY ,/* Non-optimized destroy create job type. */ + MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_MOVE, /* Move flow after table resize. */ }; enum mlx5_hw_indirect_type {
@@ -422,6 +425,8 @@ struct mlx5_hw_q {struct mlx5_hw_q_job **job;/* LIFO header. */ struct rte_ring *indir_cq;/* Indirect action SW completion queue. */ struct rte_ring *indir_iq;/* Indirect action SW in progress queue. */ +struct rte_ring *flow_transfer_pending; +struct rte_ring *flow_transfer_completed; } __rte_cache_aligned;
drivers/net/mlx5/mlx5_flow.c +51 -0
69 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +55 -29
136 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +453 -77
720 lines not on this page · raw message
Signature · 1 line
2.39.2
Hi,
Quoted 28 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Wednesday, February 28, 2024 3:33 PM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Maayan Kashani <[email protected]>; Raslan Darawsheh <[email protected]>; Dariusz Sosnowski <[email protected]>
Subject: [PATCH v3 0/4] net/mlx5: add support for flow table resizingSupport template table resize API.
Gregory Etelson (3):
net/mlx5: fix parameters verification in HWS table create net/mlx5: move multi-pattern actions management to table level net/mlx5: add support for flow table resizingMaayan Kashani (1):
net/mlx5: add resize function to ipooldrivers/net/mlx5/mlx5.h | 5 + drivers/net/mlx5/mlx5_flow.c | 51 +++ drivers/net/mlx5/mlx5_flow.h | 101 ++++- drivers/net/mlx5/mlx5_flow_hw.c | 761 +++++++++++++++++++++++------- -- drivers/net/mlx5/mlx5_utils.c | 29 ++ drivers/net/mlx5/mlx5_utils.h | 16 + 6 files changed, 763 insertions(+), 200 deletions(-)
Quoted 7 lines
--
v2: Update PMD after DPDK API changes.
v3: Use RTE atomic API.
--
2.39.2
Series applied to next-net-mlx,
Raslan Darawsheh
PATCH 2/5 net/mlx5: add resize function to ipool
In reply to Gregory EtelsonFrom: Maayan Kashani <[email protected]>
Before this patch, ipool size could be fixed by
setting max_idx in mlx5_indexed_pool_config upon
ipool creation. Or it can be auto resized to the
maximum limit by setting max_idx to zero upon
ipool creation and the saved value is the maximum
index possible.
This patch adds ipool_resize API that enables to
update the value of max_idx in case it is not set to maximum, meaning not in auto resize mode. It
enables the allocation of new trunk when using malloc/zmalloc up to the max_idx limit. Please
notice the resize number of entries should be divisible by trunk_size.
--- drivers/net/mlx5/mlx5_utils.c | 29 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_utils.h | 16 ++++++++++++++++ 2 files changed, 45 insertions(+)
drivers/net/mlx5/mlx5_utils.c +29 -0
@@ -809,6 +809,35 @@ mlx5_ipool_get_next(struct mlx5_indexed_pool *pool, uint32_t *pos)return NULL ; } +int +mlx5_ipool_resize (struct mlx5_indexed_pool *pool,uint32_t num_entries) +{ +uint32_t cur_max_idx; +uint32_t max_index =mlx5_trunk_idx_offset_get (pool,TRUNK_MAX_IDX +1 ); + +if (num_entries % pool->cfg.trunk_size) { +DRV_LOG (ERR ,"num_entries param should be trunk_size(=%u) multiplication\n" , + pool->cfg.trunk_size); +return -EINVAL ; + } + +mlx5_ipool_lock (pool); + cur_max_idx = pool->cfg.max_idx + num_entries; +/* If the ipool max idx is above maximum or uint overflow occurred. */ +if (cur_max_idx > max_index || cur_max_idx < num_entries) { +DRV_LOG (ERR ,"Ipool resize failed\n" ); +DRV_LOG (ERR ,"Adding %u entries to existing %u entries, will cross max limit(=%u)\n" , + num_entries, cur_max_idx, max_index); +mlx5_ipool_unlock (pool); +return -EINVAL ; + } + +/* Update maximum entries number. */ + pool->cfg.max_idx = cur_max_idx; +mlx5_ipool_unlock (pool); +return 0 ; +} +void mlx5_ipool_dump (struct mlx5_indexed_pool *pool) {
drivers/net/mlx5/mlx5_utils.h +16 -0
@@ -427,6 +427,22 @@ void mlx5_ipool_flush_cache(struct mlx5_indexed_pool *pool);*/ void *mlx5_ipool_get_next (struct mlx5_indexed_pool *pool,uint32_t *pos); +/** +* This function resize the ipool. +* +* @param pool +* Pointer to the index memory pool handler. +* @param num_entries +* Number of entries to be added to the pool. +* This number should be divisible by trunk_size. +* +* @return +* - non-zero value on error. +* - 0 on success. +* +*/ +int mlx5_ipool_resize (struct mlx5_indexed_pool *pool,uint32_t num_entries); +/** * This function allocates new empty Three-level table. *
Signature · 1 line
2.39.2
PATCH 3/5 net/mlx5: fix parameters verification in HWS table create
In reply to Gregory EtelsonModified the conditionals in flow_hw_table_create() to use bitwise AND instead of equality checks when assessing table_cfg->attr->specialize bitmask.
This will allow for greater flexibility as the bitmask may encapsulate multiple flags.
The patch maintains the previous behavior with single flag values, while providing support for multiple flags.
--- drivers/net/mlx5/mlx5_flow_hw.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +17 -6
@@ -4368,12 +4368,23 @@ flow_hw_table_create(struct rte_eth_dev *dev, matcher_attr.rule.num_log =rte_log2_u32 (nb_flows);/* Parse hints information. */ if (attr->specialize) { -if (attr->specialize ==RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG ) - matcher_attr.optimize_flow_src =MLX5DR_MATCHER_FLOW_SRC_WIRE ; -else if (attr->specialize ==RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ) - matcher_attr.optimize_flow_src =MLX5DR_MATCHER_FLOW_SRC_VPORT ; -else -DRV_LOG (INFO ,"Unsupported hint value %x" , attr->specialize); +uint32_t val =RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG | +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ; + +if ((attr->specialize & val) == val) { +DRV_LOG (INFO ,"Invalid hint value %x" , + attr->specialize); + rte_errno =EINVAL ; + goto it_error; + } +if (attr->specialize & +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG ) + matcher_attr.optimize_flow_src = +MLX5DR_MATCHER_FLOW_SRC_WIRE ; +else if (attr->specialize & +RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG ) + matcher_attr.optimize_flow_src = +MLX5DR_MATCHER_FLOW_SRC_VPORT ; }/* Build the item template. */ for (i =0 ; i < nb_item_templates; i++) {
Signature · 1 line
2.39.2
PATCH 4/5 net/mlx5: move multi-pattern actions management to table level
In reply to Gregory EtelsonThe multi-pattern actions related structures and management code have been moved to the table level.
That code refactor is required for the upcoming table resize feature.
--- drivers/net/mlx5/mlx5_flow.h | 73 +++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 229 +++++++++++++++----------------- 2 files changed, 177 insertions(+), 125 deletions(-)
drivers/net/mlx5/mlx5_flow.h +71 -2
@@ -1390,7 +1390,6 @@ struct mlx5_hw_encap_decap_action {/* Is header_reformat action shared across flows in table. */ uint32_t shared:1; uint32_t multi_pattern:1; -volatile uint32_t *multi_pattern_refcnt;size_t data_size;/* Action metadata size. */ uint8_t data[];/* Action data. */ };
@@ -1413,7 +1412,6 @@ struct mlx5_hw_modify_header_action {/* Is MODIFY_HEADER action shared across flows in table. */ uint32_t shared:1; uint32_t multi_pattern:1; -volatile uint32_t *multi_pattern_refcnt;/* Amount of modification commands stored in the precompiled buffer. */ uint32_t mhdr_cmds_num;/* Precompiled modification commands. */
@@ -1467,6 +1465,76 @@ struct mlx5_flow_group {#define MLX5_HW_TBL_MAX_ITEM_TEMPLATE 2#define MLX5_HW_TBL_MAX_ACTION_TEMPLATE 32 +#define MLX5_MULTIPATTERN_ENCAP_NUM 5 +#define MLX5_MAX_TABLE_RESIZE_NUM 64 + +struct mlx5_multi_pattern_segment { +uint32_t capacity; +uint32_t head_index; +struct mlx5dr_action *mhdr_action; +struct mlx5dr_action *reformat_action[MLX5_MULTIPATTERN_ENCAP_NUM ]; +}; + +struct mlx5_tbl_multi_pattern_ctx { +struct { +uint32_t elements_num; +struct mlx5dr_action_reformat_header reformat_hdr[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; +/** +* insert_header structure is larger than reformat_header. +* Enclosing these structures with union will case a gap between +* reformat_hdr array elements. +* mlx5dr_action_create_reformat() expects adjacent array elements. +*/ +struct mlx5dr_action_insert_header insert_hdr[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; + } reformat[MLX5_MULTIPATTERN_ENCAP_NUM ]; + +struct { +uint32_t elements_num; +struct mlx5dr_action_mh_pattern pattern[MLX5_HW_TBL_MAX_ACTION_TEMPLATE ]; + } mh; +struct mlx5_multi_pattern_segment segments[MLX5_MAX_TABLE_RESIZE_NUM ]; +}; + +static __rte_always_inline void +mlx5_multi_pattern_activate (struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ + mpctx->segments[0 ].head_index =1 ; +} + +static __rte_always_inline bool +mlx5_is_multi_pattern_active (const struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ +return mpctx->segments[0 ].head_index ==1 ; +} + +static __rte_always_inline struct mlx5_multi_pattern_segment * +mlx5_multi_pattern_segment_get_next (struct mlx5_tbl_multi_pattern_ctx *mpctx) +{ +int i; + +for (i =0 ; i <MLX5_MAX_TABLE_RESIZE_NUM ; i++) { +if (!mpctx->segments[i].capacity) +return &mpctx->segments[i]; + } +return NULL ; +} + +static __rte_always_inline struct mlx5_multi_pattern_segment * +mlx5_multi_pattern_segment_find (struct mlx5_tbl_multi_pattern_ctx *mpctx, +uint32_t flow_resource_ix) +{ +int i; + +for (i =0 ; i <MLX5_MAX_TABLE_RESIZE_NUM ; i++) { +uint32_t limit = mpctx->segments[i].head_index + + mpctx->segments[i].capacity; + +if (flow_resource_ix < limit) +return &mpctx->segments[i]; + } +return NULL ; +} +struct mlx5_flow_template_table_cfg {struct rte_flow_template_table_attr attr;/* Table attributes passed through flow API. */ bool external;/* True if created by flow API, false if table is internal to PMD. */
@@ -1487,6 +1555,7 @@ struct rte_flow_template_table {uint8_t nb_item_templates;/* Item template number. */ uint8_t nb_action_templates;/* Action template number. */ uint32_t refcnt;/* Table reference counter. */ + struct mlx5_tbl_multi_pattern_ctx mpctx; };#endif
drivers/net/mlx5/mlx5_flow_hw.c +106 -123
372 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH 5/5 net/mlx5: add support for flow table resizing
In reply to Gregory EtelsonSupport template table API in PMD.
The patch allows to increase existing table capacity.
--- drivers/net/mlx5/mlx5.h | 5 + drivers/net/mlx5/mlx5_flow.c | 51 ++++ drivers/net/mlx5/mlx5_flow.h | 84 ++++-- drivers/net/mlx5/mlx5_flow_hw.c | 512 +++++++++++++++++++++++++++----- drivers/net/mlx5/mlx5_host.c | 211 +++++++++++++ 5 files changed, 758 insertions(+), 105 deletions(-) create mode 100644 drivers/net/mlx5/mlx5_host.c
drivers/net/mlx5/mlx5.h +5 -0
@@ -380,6 +380,9 @@ enum mlx5_hw_job_type {MLX5_HW_Q_JOB_TYPE_UPDATE ,/* Flow update job type. */ MLX5_HW_Q_JOB_TYPE_QUERY ,/* Flow query job type. */ MLX5_HW_Q_JOB_TYPE_UPDATE_QUERY ,/* Flow update and query job type. */ +MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_CREATE ,/* Non-optimized flow create job type. */ +MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_DESTROY ,/* Non-optimized destroy create job type. */ + MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_MOVE, /* Move flow after table resize. */ }; enum mlx5_hw_indirect_type {
@@ -422,6 +425,8 @@ struct mlx5_hw_q {struct mlx5_hw_q_job **job;/* LIFO header. */ struct rte_ring *indir_cq;/* Indirect action SW completion queue. */ struct rte_ring *indir_iq;/* Indirect action SW in progress queue. */ +struct rte_ring *flow_transfer_pending; +struct rte_ring *flow_transfer_completed; } __rte_cache_aligned;
drivers/net/mlx5/mlx5_flow.c +51 -0
69 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +55 -29
136 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +436 -76
690 lines not on this page · raw message
drivers/net/mlx5/mlx5_host.c new file +211 -0
211 lines not on this page · raw message
Signature · 1 line
2.39.2