net/mlx5: support indirect list actions
cover net/mlx5: support indirect list actions
- Add support for indirect list actions acting as HWS mirror.
- Add support for METER_MARK as indirect list action.
Gregory Etelson (3):
net/mlx5: reformat HWS code
net/mlx5: support HWS mirror action net/mlx5: support indirect list METER_MARK action
Signature · 1 line
2.39.2
PATCH v2 1/16 net/mlx5/hws: add support for reformat DevX object
From: Hamdan Igbaria <[email protected]>
Add support for creation of packet reformat object, via the ALLOC_PACKET_REFORMAT_CONTEXT command.
--- drivers/common/mlx5/mlx5_prm.h | 39 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 60 ++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 +++++ drivers/net/mlx5/hws/mlx5dr_internal.h | 5 +++ drivers/net/mlx5/hws/mlx5dr_send.c | 5 --- 5 files changed, 115 insertions(+), 5 deletions(-)
drivers/common/mlx5/mlx5_prm.h +39 -0
@@ -1218,6 +1218,8 @@ enum {MLX5_CMD_OP_CREATE_FLOW_GROUP =0x933 ,MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY =0x936 ,MLX5_CMD_OP_MODIFY_FLOW_TABLE =0x93c , +MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT =0x93d , +MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT =0x93e ,MLX5_CMD_OP_ALLOC_FLOW_COUNTER =0x939 ,MLX5_CMD_OP_QUERY_FLOW_COUNTER =0x93b , MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00,
@@ -5191,6 +5193,43 @@ struct mlx5_ifc_modify_flow_table_out_bits {u8 reserved_at_40[0x60 ]; }; +struct mlx5_ifc_packet_reformat_context_in_bits { +u8 reformat_type[0x8 ]; +u8 reserved_at_8[0x4 ]; +u8 reformat_param_0[0x4 ]; +u8 reserved_at_16[0x6 ]; +u8 reformat_data_size[0xa ]; + +u8 reformat_param_1[0x8 ]; +u8 reserved_at_40[0x8 ]; +u8 reformat_data[6 ][0x8 ]; + +u8 more_reformat_data[][0x8 ]; +}; + +struct mlx5_ifc_alloc_packet_reformat_context_in_bits { +u8 opcode[0x10 ]; +u8 uid[0x10 ]; + +u8 reserved_at_20[0x10 ]; +u8 op_mod[0x10 ]; + +u8 reserved_at_40[0xa0 ]; + +u8 packet_reformat_context[]; +}; + +struct mlx5_ifc_alloc_packet_reformat_out_bits { +u8 status[0x8 ]; +u8 reserved_at_8[0x18 ]; + +u8 syndrome[0x20 ]; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; +/* CQE format mask. */ #define MLX5E_CQE_FORMAT_MASK 0xc
drivers/net/mlx5/hws/mlx5dr_cmd.c +60 -0
66 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +11 -0
@@ -155,6 +155,13 @@ struct mlx5dr_cmd_allow_other_vhca_access_attr {uint8_t access_key[ACCESS_KEY_LEN ]; }; +struct mlx5dr_cmd_packet_reformat_create_attr { +uint8_t type; +size_t data_sz; +void *data; +uint8_t reformat_param_0; +}; +struct mlx5dr_cmd_query_ft_caps {uint8_t max_level;uint8_t reparse;
@@ -285,6 +292,10 @@ mlx5dr_cmd_forward_tbl_create(struct ibv_context *ctx,void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj * +mlx5dr_cmd_packet_reformat_create (struct ibv_context *ctx, +struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
drivers/net/mlx5/hws/mlx5dr_internal.h +5 -0
@@ -91,4 +91,9 @@ static inline uint64_t roundup_pow_of_two(uint64_t n) return n == 1 ? 1 : 1ULL << log2above(n); } +static inline unsigned long align (unsigned long val,unsigned long align) +{ +return (val + align -1 ) & ~(align -1 ); +} +#endif /* MLX5DR_INTERNAL_H_ */
drivers/net/mlx5/hws/mlx5dr_send.c +0 -5
@@ -668,11 +668,6 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,return err; } -static inline unsigned long align (unsigned long val,unsigned long align) -{ -return (val + align -1 ) & ~(align -1 ); -} - static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx, struct mlx5dr_send_engine *queue, struct mlx5dr_send_ring_sq *sq,
Signature · 1 line
2.39.2
PATCH v2 2/16 net/mlx5/hws: support creating of dynamic forward table and FTE
From: Hamdan Igbaria <[email protected]>
Add the ability to create forward table and FTE.
--- drivers/common/mlx5/mlx5_prm.h | 4 ++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 13 +++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+)
drivers/common/mlx5/mlx5_prm.h +4 -0
@@ -5048,7 +5048,11 @@ enum mlx5_flow_destination_type { };enum mlx5_flow_context_action { +MLX5_FLOW_CONTEXT_ACTION_DROP =1 <<1 ,MLX5_FLOW_CONTEXT_ACTION_FWD_DEST =1 <<2 , +MLX5_FLOW_CONTEXT_ACTION_REFORMAT =1 <<4 , +MLX5_FLOW_CONTEXT_ACTION_DECRYPT =1 <<12 , +MLX5_FLOW_CONTEXT_ACTION_ENCRYPT =1 <<13 , };enum mlx5_flow_context_flow_source {
drivers/net/mlx5/hws/mlx5dr_cmd.c +13 -0
@@ -42,6 +42,7 @@ mlx5dr_cmd_flow_table_create(struct ibv_context *ctx, ft_ctx =MLX5_ADDR_OF (create_flow_table_in, in, flow_table_context);MLX5_SET (flow_table_context, ft_ctx, level, ft_attr->level);MLX5_SET (flow_table_context, ft_ctx, rtc_valid, ft_attr->rtc_valid); +MLX5_SET (flow_table_context, ft_ctx, reformat_en, ft_attr->reformat_en); devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));if (!devx_obj->obj) {
@@ -182,12 +183,24 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, action_flags = fte_attr->action_flags;MLX5_SET (flow_context, in_flow_context, action, action_flags); +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_REFORMAT ) +MLX5_SET (flow_context, in_flow_context, + packet_reformat_id, fte_attr->packet_reformat_id); + +if (action_flags & (MLX5_FLOW_CONTEXT_ACTION_DECRYPT |MLX5_FLOW_CONTEXT_ACTION_ENCRYPT )) { +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_type, fte_attr->encrypt_decrypt_type); +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_obj_id, fte_attr->encrypt_decrypt_obj_id); + } +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ) {/* Only destination_list_size of size 1 is supported */ MLX5_SET (flow_context, in_flow_context, destination_list_size,1 ); in_dests =MLX5_ADDR_OF (flow_context, in_flow_context, destination);MLX5_SET (dest_format, in_dests, destination_type, fte_attr->destination_type);MLX5_SET (dest_format, in_dests, destination_id, fte_attr->destination_id); +MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); } devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));
drivers/net/mlx5/hws/mlx5dr_cmd.h +19 -0
@@ -7,8 +7,12 @@struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t encrypt_decrypt_type; +uint32_t encrypt_decrypt_obj_id; +uint32_t packet_reformat_id;uint8_t destination_type;uint32_t destination_id; +uint8_t ignore_flow_level;uint8_t flow_source; };
@@ -16,6 +20,7 @@ struct mlx5dr_cmd_ft_create_attr {uint8_t type;uint8_t level;bool rtc_valid; +uint8_t reformat_en; };#define ACCESS_KEY_LEN 32
@@ -296,6 +301,20 @@ struct mlx5dr_devx_obj * mlx5dr_cmd_packet_reformat_create(struct ibv_context *ctx, struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj * +mlx5dr_cmd_set_fte (struct ibv_context *ctx, +uint32_t table_type, +uint32_t table_id, +uint32_t group_id, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +struct mlx5dr_cmd_forward_tbl * +mlx5dr_cmd_forward_tbl_create (struct ibv_context *ctx, +struct mlx5dr_cmd_ft_create_attr *ft_attr, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
Signature · 1 line
2.39.2
PATCH v2 3/16 net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add mlx5dr_devx_obj struct to mlx5dr_action, so we could hold the FT obj in dest table action.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 4 ++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +++ drivers/net/mlx5/hws/mlx5dr_table.c | 1 - 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +4 -0
@@ -787,6 +787,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, tbl->ft);if (ret) goto free_action; + + action->devx_dest.devx_obj = tbl->ft; }return action;
@@ -864,6 +866,8 @@ mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, cur_obj);if (ret) goto clean_obj; + + action->devx_dest.devx_obj = cur_obj; }return action;
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -148,6 +148,9 @@ struct mlx5dr_action {struct {struct mlx5dv_steering_anchor *sa; } root_tbl; +struct { +struct mlx5dr_devx_obj *devx_obj; + } devx_dest; }; };
drivers/net/mlx5/hws/mlx5dr_table.c +0 -1
@@ -68,7 +68,6 @@ static void mlx5dr_table_down_default_fdb_miss_tbl(struct mlx5dr_table *tbl)return ;mlx5dr_cmd_forward_tbl_destroy (default_miss); - ctx->common_res[tbl_type].default_miss =NULL ; }
Signature · 1 line
2.39.2
PATCH v2 4/16 net/mlx5/hws: add support for mirroring
In reply to Gregory EtelsonFrom: Shun Hao <[email protected]>
This patch supports mirroring by adding an dest_array action. The action accecpts a list containing multiple destination actions, and can duplicate packet and forward to each destination in the list.
--- drivers/common/mlx5/mlx5_prm.h | 23 ++++- drivers/net/mlx5/hws/mlx5dr.h | 34 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 130 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 64 ++++++++++--- drivers/net/mlx5/hws/mlx5dr_cmd.h | 21 ++++- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_table.c | 7 +- 8 files changed, 262 insertions(+), 21 deletions(-)
drivers/common/mlx5/mlx5_prm.h +20 -3
@@ -2320,7 +2320,11 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { };struct mlx5_ifc_esw_cap_bits { -u8 reserved_at_0[0x60 ]; +u8 reserved_at_0[0x1d ]; +u8 merged_eswitch[0x1 ]; +u8 reserved_at_1e[0x2 ]; + +u8 reserved_at_20[0x40 ];u8 esw_manager_vport_number_valid[0x1 ];u8 reserved_at_61[0xf ];
@@ -5045,6 +5049,7 @@ struct mlx5_ifc_query_flow_table_out_bits {enum mlx5_flow_destination_type {MLX5_FLOW_DESTINATION_TYPE_VPORT =0x0 ,MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE =0x1 , +MLX5_FLOW_DESTINATION_TYPE_TIR =0x2 , };enum mlx5_flow_context_action {
@@ -5088,6 +5093,19 @@ union mlx5_ifc_dest_format_flow_counter_list_auto_bits {u8 reserved_at_0[0x40 ]; }; +struct mlx5_ifc_extended_dest_format_bits { +struct mlx5_ifc_dest_format_bits destination_entry; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; + +#define MLX5_IFC_MULTI_PATH_FT_MAX_LEVEL 64 + +#ifdef PEDANTIC +#pragma GCC diagnostic ignored "-Wpedantic" +#endif struct mlx5_ifc_flow_context_bits {u8 reserved_at_00[0x20 ];u8 group_id[0x20 ];
@@ -5106,8 +5124,7 @@ struct mlx5_ifc_flow_context_bits {u8 reserved_at_e0[0x40 ];u8 encrypt_decrypt_obj_id[0x20 ];u8 reserved_at_140[0x16c0 ]; -/* Currently only one destnation */ -union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[1 ]; +union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0 ]; };struct mlx5_ifc_set_fte_in_bits {
drivers/net/mlx5/hws/mlx5dr.h +34 -0
@@ -46,6 +46,7 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_ASO_METER ,MLX5DR_ACTION_TYP_ASO_CT ,MLX5DR_ACTION_TYP_DEST_ROOT , +MLX5DR_ACTION_TYP_DEST_ARRAY , MLX5DR_ACTION_TYP_MAX, };
@@ -213,6 +214,20 @@ struct mlx5dr_rule_action { }; }; +struct mlx5dr_action_dest_attr { +/* Required action combination */ +enum mlx5dr_action_type *action_type; + +/* Required destination action to forward the packet */ +struct mlx5dr_action *dest; + +/* Optional reformat data */ +struct { +size_t reformat_data_sz; +void *reformat_data; + } reformat; +}; +/* Open a context used for direct rule insertion using hardware steering. * Each context can contain multiple tables of different types. *
@@ -616,6 +631,25 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags);struct mlx5dr_action *mlx5dr_action_create_push_vlan (struct mlx5dr_context *ctx,uint32_t flags); +/* Create a dest array action, this action can duplicate packets and forward to +* multiple destinations in the destination list. +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] num_dest +* The number of dests attributes. +* @param[in] dests +* The destination array. Each contains a destination action and can have +* additional actions. +* @param[in] flags +* Action creation flags. (enum mlx5dr_action_flags) +* @return pointer to mlx5dr_action on success NULL otherwise. +*/ +struct mlx5dr_action * +mlx5dr_action_create_dest_array (struct mlx5dr_context *ctx, +size_t num_dest, +struct mlx5dr_action_dest_attr *dests, +uint32_t flags); +/* Create dest root table, this action will jump to root table according * the given priority. * @param[in] ctx
drivers/net/mlx5/hws/mlx5dr_action.c +128 -2
166 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -151,6 +151,9 @@ struct mlx5dr_action {struct {struct mlx5dr_devx_obj *devx_obj; } devx_dest; +struct { +struct mlx5dr_cmd_forward_tbl *fw_island; + } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +54 -10
109 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +17 -4
@@ -5,15 +5,27 @@#ifndef MLX5DR_CMD_H_ #define MLX5DR_CMD_H_ +enum mlx5dr_cmd_ext_dest_flags { +MLX5DR_CMD_EXT_DEST_REFORMAT =1 <<0 , +MLX5DR_CMD_EXT_DEST_ESW_OWNER_VHCA_ID =1 <<1 , +}; + +struct mlx5dr_cmd_set_fte_dest { +uint8_t destination_type; +uint32_t destination_id; +enum mlx5dr_cmd_ext_dest_flags ext_flags; +uint16_t esw_owner_vhca_id; +}; +struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t ignore_flow_level; +uint8_t flow_source;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id; -uint8_t destination_type; -uint32_t destination_id; -uint8_t ignore_flow_level; -uint8_t flow_source; +uint32_t dests_num; +struct mlx5dr_cmd_set_fte_dest *dests; }; struct mlx5dr_cmd_ft_create_attr {
@@ -216,6 +228,7 @@ struct mlx5dr_cmd_query_caps {struct mlx5dr_cmd_query_ft_caps nic_ft;struct mlx5dr_cmd_query_ft_caps fdb_ft;bool eswitch_manager; +uint8_t merged_eswitch;uint32_t eswitch_manager_vport_number;uint8_t log_header_modify_argument_granularity;uint8_t log_header_modify_argument_max_alloc;
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
@@ -23,6 +23,7 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_ASO_METER] = "ASO_METER", [MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT", [MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT", + [MLX5DR_ACTION_TYP_DEST_ARRAY ] ="DEST_ARRAY" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/hws/mlx5dr_table.c +5 -2
@@ -22,6 +22,7 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)struct mlx5dr_cmd_ft_create_attr ft_attr = {0 };struct mlx5dr_cmd_set_fte_attr fte_attr = {0 };struct mlx5dr_cmd_forward_tbl *default_miss; +struct mlx5dr_cmd_set_fte_dest dest = {0 };struct mlx5dr_context *ctx = tbl->ctx;uint8_t tbl_type = tbl->type;
@@ -37,9 +38,11 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl) ft_attr.level = tbl->ctx->caps->fdb_ft.max_level;/* The last level */ ft_attr.rtc_valid = false; + dest.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest.destination_id = ctx->caps->eswitch_manager_vport_number; fte_attr.action_flags =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; - fte_attr.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; - fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number; + fte_attr.dests_num =1 ; + fte_attr.dests = &dest; default_miss =mlx5dr_cmd_forward_tbl_create (mlx5dr_context_get_local_ibv (ctx), &ft_attr, &fte_attr);
Signature · 1 line
2.39.2
PATCH v2 5/16 net/mlx5/hws: allow destination into default miss FT
In reply to Gregory EtelsonFrom: Erez Shitrit <[email protected]>
In FDB it will direct the packet into the hypervisor vport. That allows the user to mirror packets into the default-miss vport.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/mlx5/hws/mlx5dr_action.c +11 -0
@@ -1769,6 +1769,17 @@ mlx5dr_action_create_dest_array(struct mlx5dr_context *ctx, fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; fte_attr.ignore_flow_level =1 ;break ; +case MLX5DR_ACTION_TYP_MISS : +if (table_type !=MLX5DR_TABLE_TYPE_FDB ) { +DR_LOG (ERR ,"Miss action supported for FDB only" ); + rte_errno =ENOTSUP ; + goto free_dest_list; + } + dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest_list[i].destination_id = + ctx->caps->eswitch_manager_vport_number; + fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; +break ;case MLX5DR_ACTION_TYP_VPORT : dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; dest_list[i].destination_id = dests[i].dest->vport.vport_num;
Signature · 1 line
2.39.2
PATCH v2 6/16 net/mlx5/hws: support reformat for hws mirror
In reply to Gregory EtelsonFrom: Haifei Luo <[email protected]>
In dest_array action, an optional reformat action can be applied to each destination. This patch supports this by using the extended destination entry.
--- drivers/common/mlx5/mlx5_prm.h | 15 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 67 +++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 2 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 10 ++++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 2 + 5 files changed, 94 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_prm.h +15 -0
@@ -5352,6 +5352,21 @@ enum mlx5_parse_graph_arc_node_index { MLX5_GRAPH_ARC_NODE_PROGRAMMABLE = 0x1f, }; +enum mlx5_packet_reformat_context_reformat_type { +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L2_TUNNEL =0x2 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_TUNNEL =0x4 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4 =0x5 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_ESP_TUNNEL =0x6 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV4 =0x7 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT =0x8 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L3_ESP_TUNNEL_TO_L2 =0x9 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT_OVER_UDP =0xA , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6 =0xB , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV6 =0xC , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_NISP_TNL =0xD , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_REMOVE_NISP_TNL =0xE , +}; +#define MLX5_PARSE_GRAPH_FLOW_SAMPLE_MAX 8#define MLX5_PARSE_GRAPH_IN_ARC_MAX 8#define MLX5_PARSE_GRAPH_OUT_ARC_MAX 8
drivers/net/mlx5/hws/mlx5dr_action.c +66 -1
104 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +2 -0
@@ -153,6 +153,8 @@ struct mlx5dr_action { } devx_dest;struct {struct mlx5dr_cmd_forward_tbl *fw_island; +size_t num_dest; +struct mlx5dr_cmd_set_fte_dest *dest_list; } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +9 -1
@@ -169,7 +169,9 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx,uint32_t *in;uint32_t i; - dest_entry_sz =MLX5_ST_SZ_BYTES (dest_format); + dest_entry_sz = fte_attr->extended_dest ? +MLX5_ST_SZ_BYTES (extended_dest_format) : +MLX5_ST_SZ_BYTES (dest_format); total_dest_sz = dest_entry_sz * fte_attr->dests_num; inlen =align ((MLX5_ST_SZ_BYTES (set_fte_in) + total_dest_sz),DW_SIZE ); in =simple_calloc (1 , inlen);
@@ -192,6 +194,7 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, in_flow_context =MLX5_ADDR_OF (set_fte_in, in, flow_context);MLX5_SET (flow_context, in_flow_context, group_id, group_id);MLX5_SET (flow_context, in_flow_context, flow_source, fte_attr->flow_source); +MLX5_SET (flow_context, in_flow_context, extended_destination, fte_attr->extended_dest);MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); action_flags = fte_attr->action_flags;
@@ -230,6 +233,11 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, dest->destination_type);MLX5_SET (dest_format, in_dests, destination_id, dest->destination_id); +if (dest->ext_flags &MLX5DR_CMD_EXT_DEST_REFORMAT ) { +MLX5_SET (dest_format, in_dests, packet_reformat,1 ); +MLX5_SET (extended_dest_format, in_dests, packet_reformat_id, + dest->ext_reformat->id); + }break ;default : rte_errno =EOPNOTSUPP ;
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
@@ -14,6 +14,7 @@ struct mlx5dr_cmd_set_fte_dest {uint8_t destination_type;uint32_t destination_id;enum mlx5dr_cmd_ext_dest_flags ext_flags; +struct mlx5dr_devx_obj *ext_reformat;uint16_t esw_owner_vhca_id; };
@@ -21,6 +22,7 @@ struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags;uint8_t ignore_flow_level;uint8_t flow_source; +uint8_t extended_dest;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id;
Signature · 1 line
2.39.2
PATCH v2 7/16 net/mlx5: reformat HWS code
In reply to Gregory EtelsonReplace if() with switch().
--- drivers/net/mlx5/mlx5_flow_hw.c | 70 ++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 31 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +39 -31
@@ -4548,6 +4548,17 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT, }; +static inline void +action_template_set_type (struct rte_flow_actions_template *at, +enum mlx5dr_action_type *action_types, +unsigned int action_src,uint16_t *curr_off, +enum mlx5dr_action_type type) +{ + at->actions_off[action_src] = *curr_off; + action_types[*curr_off] = type; + *curr_off = *curr_off +1 ; +} + static int flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, unsigned int action_src,
@@ -4565,9 +4576,8 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, type = mask->type;switch (type) {case RTE_FLOW_ACTION_TYPE_RSS : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_TIR ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_TIR );break ;case RTE_FLOW_ACTION_TYPE_AGE :case RTE_FLOW_ACTION_TYPE_COUNT :
@@ -4575,23 +4585,20 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,* Both AGE and COUNT action need counter, the first one fills * the action_types array, and the second only saves the offset. */ -if (*cnt_off ==UINT16_MAX ) { - *cnt_off = *curr_off; - action_types[*cnt_off] =MLX5DR_ACTION_TYP_CTR ; - *curr_off = *curr_off +1 ; - } +if (*cnt_off ==UINT16_MAX ) +action_template_set_type (at, action_types, + action_src, curr_off, +MLX5DR_ACTION_TYP_CTR ); at->actions_off[action_src] = *cnt_off;break ;case RTE_FLOW_ACTION_TYPE_CONNTRACK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_CT ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_CT );break ;case RTE_FLOW_ACTION_TYPE_QUOTA :case RTE_FLOW_ACTION_TYPE_METER_MARK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_METER ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_METER );break ;default :DRV_LOG (WARNING ,"Unsupported shared action type: %d" , type);
@@ -5101,31 +5108,32 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, at->reformat_off =UINT16_MAX ; at->mhdr_off =UINT16_MAX ; at->rx_cpy_pos = pos; -/* -* mlx5 PMD hacks indirect action index directly to the action conf. -* The rte_flow_conv() function copies the content from conf pointer. -* Need to restore the indirect action index from action conf here. -*/ for (i =0 ; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++, masks++, i++) { -if (actions->type ==RTE_FLOW_ACTION_TYPE_INDIRECT ) { +const struct rte_flow_action_modify_field *info; + +switch (actions->type) { +/* +* mlx5 PMD hacks indirect action index directly to the action conf. +* The rte_flow_conv() function copies the content from conf pointer. +* Need to restore the indirect action index from action conf here. +*/ +case RTE_FLOW_ACTION_TYPE_INDIRECT : at->actions[i].conf = actions->conf; at->masks[i].conf = masks->conf; - } -if (actions->type ==RTE_FLOW_ACTION_TYPE_MODIFY_FIELD ) { -const struct rte_flow_action_modify_field *info = actions->conf; - +break ; +case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD : + info = actions->conf;if ((info->dst.field ==RTE_FLOW_FIELD_FLEX_ITEM &&flow_hw_flex_item_acquire (dev, info->dst.flex_handle, &at->flex_item)) || - (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && -flow_hw_flex_item_acquire (dev, info->src.flex_handle, - &at->flex_item))) { -rte_flow_error_set (error, rte_errno, -RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , -"Failed to acquire flex item" ); + (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && +flow_hw_flex_item_acquire (dev, info->src.flex_handle, + &at->flex_item))) goto error; - } +break ; +default : +break ; } } at->tmpl =flow_hw_dr_actions_template_create (at);
Signature · 1 line
2.39.2
PATCH v2 8/16 net/mlx5: support HWS mirror action
In reply to Gregory EtelsonHWS mirror clones original packet to one or two destinations and proceeds with the original packet path.
The mirror has no dedicated RTE flow action type. Mirror object is referenced by INDIRECT_LIST action. INDIRECT_LIST for a mirror built from actions list:
SAMPLE [/ SAMPLE] / <Orig. packet destination> / END
Mirror SAMPLE action defines packet clone. It specifies the clone destination and optional clone reformat action. Destination action for both clone and original packet depends on HCA domain:
- for NIC RX, destination is ether RSS or QUEUE
- for FDB, destination is PORT
HWS mirror was inplemented with the INDIRECT_LIST flow action.
MLX5 PMD defines general struct mlx5_indirect_list type for all. INDIRECT_LIST handler objects:
struct mlx5_indirect_list {
enum mlx5_indirect_list_type type;
LIST_ENTRY(mlx5_indirect_list) chain;
char data[];
};Specific INDIRECT_LIST type must overload mlx5_indirect_list::data and provide unique type value.
PMD returns a pointer to mlx5_indirect_list object.
Existing non-masked actions template API cannot identify flow actions in INDIRECT_LIST handler because INDIRECT_LIST handler can represent several flow actions.
For example:
A: SAMPLE / JUMP
B: SAMPE / SAMPLE / RSS
Actions template command
template indirect_list / end mask indirect_list 0 / end
does not provide any information to differentiate between flow actions in A and B.
MLX5 PMD requires INDIRECT_LIST configuration parameter in the template section:
Non-masked INDIRECT_LIST API:
=============================
template indirect_list X / end mask indirect_list 0 / end
PMD identifies type of X handler and will use the same type in template creation. Actual parameters for actions in the list will be extracted from flow configuration
Masked INDIRECT_LIST API:
=========================
template indirect_list X / end mask indirect_list -lUL / end
PMD creates action template from actions types and configurations referenced by X.
INDIRECT_LIST action without configuration is invalid and will be rejected by PMD.
--- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 134 +++++++ drivers/net/mlx5/mlx5_flow.h | 69 +++- drivers/net/mlx5/mlx5_flow_hw.c | 616 +++++++++++++++++++++++++++++++- 5 files changed, 817 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5.c +1 -0
@@ -2168,6 +2168,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)/* Free the eCPRI flex parser resource. */ mlx5_flex_parser_ecpri_release (dev);mlx5_flex_item_port_cleanup (dev); +mlx5_indirect_list_handles_release (dev);#ifdef HAVE_MLX5_HWS_SUPPORT flow_hw_destroy_vport_action (dev);flow_hw_resource_release (dev);
drivers/net/mlx5/mlx5.h +2 -0
@@ -1791,6 +1791,8 @@ struct mlx5_priv { LIST_HEAD(ind_tables, mlx5_ind_table_obj) ind_tbls;/* Standalone indirect tables. */ LIST_HEAD(stdl_ind_tables, mlx5_ind_table_obj) standalone_ind_tbls; +/* Objects created with indirect list action */ + LIST_HEAD(indirect_list, mlx5_indirect_list) indirect_list_head;/* Pointer to next element. */ rte_rwlock_t ind_tbls_lock;uint32_t refcnt;/**< Reference counter. */
drivers/net/mlx5/mlx5_flow.c +134 -0
164 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +68 -1
121 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +612 -4
694 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v2 9/16 net/mlx5: fix mirror action validation
In reply to Gregory EtelsonHWS mirror flow action validation rejected flows in NIC domain, if PMD FDB mode was active.
The patch allows NIC mirror action in FDB mode.
--- drivers/net/mlx5/mlx5_flow_hw.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +13 -7
@@ -9547,14 +9547,15 @@ mlx5_mirror_terminal_action(const struct rte_flow_action *action)static bool mlx5_mirror_validate_sample_action (struct rte_eth_dev *dev, -const struct rte_flow_action *action) +const struct rte_flow_attr *flow_attr, +const struct rte_flow_action *action) {struct mlx5_priv *priv = dev->data->dev_private;switch (action->type) {case RTE_FLOW_ACTION_TYPE_QUEUE :case RTE_FLOW_ACTION_TYPE_RSS : -if (priv->sh->esw_mode) +if (flow_attr->transfer)return false;break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT :
@@ -9562,7 +9563,7 @@ mlx5_mirror_validate_sample_action(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_RAW_DECAP :case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP : -if (!priv->sh->esw_mode) +if (!priv->sh->esw_mode && !flow_attr->transfer)return false;if (action[0 ].type ==RTE_FLOW_ACTION_TYPE_RAW_DECAP && action[1 ].type !=RTE_FLOW_ACTION_TYPE_RAW_ENCAP )
@@ -9584,19 +9585,22 @@ mlx5_mirror_validate_sample_action(struct rte_eth_dev *dev,*/ static int mlx5_hw_mirror_actions_list_validate (struct rte_eth_dev *dev, +const struct rte_flow_attr *flow_attr,const struct rte_flow_action *actions) {if (actions[0 ].type ==RTE_FLOW_ACTION_TYPE_SAMPLE ) {int i =1 ;bool valid;const struct rte_flow_action_sample *sample = actions[0 ].conf; - valid =mlx5_mirror_validate_sample_action (dev, sample->actions); + valid =mlx5_mirror_validate_sample_action (dev, flow_attr, + sample->actions);if (!valid)return -EINVAL ;if (actions[1 ].type ==RTE_FLOW_ACTION_TYPE_SAMPLE ) { i =2 ; sample = actions[1 ].conf; - valid =mlx5_mirror_validate_sample_action (dev, sample->actions); + valid =mlx5_mirror_validate_sample_action (dev, flow_attr, + sample->actions);if (!valid)return -EINVAL ; }
@@ -9780,15 +9784,17 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,struct mlx5_mirror *mirror;enum mlx5dr_table_type table_type;struct mlx5_priv *priv = dev->data->dev_private; +const struct rte_flow_attr *flow_attr = &table_cfg->attr.flow_attr;struct mlx5dr_action_dest_attr mirror_attr[MLX5_MIRROR_MAX_CLONES_NUM +1 ];enum mlx5dr_action_type array_action_types[MLX5_MIRROR_MAX_CLONES_NUM +1 ] [MLX5_MIRROR_MAX_SAMPLE_ACTIONS_LEN +1 ];memset (mirror_attr,0 ,sizeof (mirror_attr));memset (array_action_types,0 ,sizeof (array_action_types)); - table_type =get_mlx5dr_table_type (&table_cfg->attr.flow_attr); + table_type =get_mlx5dr_table_type (flow_attr); hws_flags = mlx5_hw_act_flag[MLX5_HW_ACTION_FLAG_NONE_ROOT ][table_type]; - clones_num =mlx5_hw_mirror_actions_list_validate (dev, actions); + clones_num =mlx5_hw_mirror_actions_list_validate (dev, flow_attr, + actions);if (clones_num <0 ) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION , actions,"Invalid mirror list format" );
Signature · 1 line
2.39.2
PATCH v2 10/16 net/mlx5: fix in shared counter and age template action create
In reply to Gregory EtelsonCount and age actions in HWS template are translated into the same DR5 action.
PMD maintains dedicated variable - cnt_off, that points action location in DR5 array.
Currnet PMD did not initialize the cnt_off variable during shared counter / age actions initialization.
--- drivers/net/mlx5/mlx5_flow_hw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_hw.c +3 -1
@@ -4680,10 +4680,12 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,* Both AGE and COUNT action need counter, the first one fills * the action_types array, and the second only saves the offset. */ -if (*cnt_off ==UINT16_MAX ) +if (*cnt_off ==UINT16_MAX ) { + *cnt_off = *curr_off;action_template_set_type (at, action_types, action_src, curr_off,MLX5DR_ACTION_TYP_CTR ); + } at->actions_off[action_src] = *cnt_off;break ;case RTE_FLOW_ACTION_TYPE_CONNTRACK :
Signature · 1 line
2.39.2
PATCH v2 11/16 net/mlx5: fix modify field expansion for raw DECAP / ENCAP
In reply to Gregory EtelsonFlow actions in HWS actions template must be arranged according to pre-defined order.
MLX5 PMD handles RAW_DECAP / RAW_ENCAP actions sequence as a single RAW ENCAP or DECAP flow action.
When the PMD scanned flow actions to locate position where MODIFY_FIELD action could be inserted it processed the RAW_DECAP / RAW_ENCAP sequence as 2 separate actions. As the result location selection was wrong.
The patch fixes RAW_DECAP / RAW_ENCAP sequence processing for MODIFY_FIELD expansion.
--- drivers/net/mlx5/mlx5_flow_hw.c | 36 +++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +34 -2
@@ -4283,6 +4283,28 @@ flow_hw_validate_action_raw_encap(struct rte_eth_dev *dev __rte_unused,return 0 ; } +/** +* Process `... / raw_decap / raw_encap / ...` actions sequence. +* The PMD handles the sequence as a single encap or decap reformat action, +* depending on the raw_encap configuration. +* +* The function assumes that the sequence location in actions template list +* complies with relative HWS actions order for the required reformat. +*/ +static uint64_t +mlx5_decap_encap_reformat_type (const struct rte_flow_action *actions, +uint32_t encap_ind,uint64_t flags) +{ +const struct rte_flow_action_raw_encap *encap = actions[encap_ind].conf; + +if ((flags &MLX5_FLOW_ACTION_DECAP ) ==0 ) +return MLX5_FLOW_ACTION_ENCAP ; +if (actions[encap_ind -1 ].type !=RTE_FLOW_ACTION_TYPE_RAW_DECAP ) +return MLX5_FLOW_ACTION_ENCAP ; +return encap->size >=MLX5_ENCAPSULATION_DECISION_SIZE ? +MLX5_FLOW_ACTION_ENCAP :MLX5_FLOW_ACTION_DECAP ; +} + static inline uint16_t flow_hw_template_expand_modify_field(struct rte_flow_action actions[], struct rte_flow_action masks[],
@@ -4320,13 +4342,13 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],*/ for (i = act_num -2 ; (int )i >=0 ; i--) {enum rte_flow_action_type type = actions[i].type; +uint64_t reformat_type;if (type ==RTE_FLOW_ACTION_TYPE_INDIRECT ) type = masks[i].type;switch (type) {case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP : -case RTE_FLOW_ACTION_TYPE_RAW_ENCAP :case RTE_FLOW_ACTION_TYPE_DROP :case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL :case RTE_FLOW_ACTION_TYPE_JUMP :
@@ -4337,10 +4359,20 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],case RTE_FLOW_ACTION_TYPE_VOID :case RTE_FLOW_ACTION_TYPE_END :break ; +case RTE_FLOW_ACTION_TYPE_RAW_ENCAP : + reformat_type = +mlx5_decap_encap_reformat_type (actions, i, + flags); +if (reformat_type ==MLX5_FLOW_ACTION_DECAP ) { + i++; + goto insert; + } +if (flags &MLX5_FLOW_ACTION_DECAP ) + i--; +break ;default : i++;/* new MF inserted AFTER actions[i] */ goto insert; -break ; } } i =0 ;
Signature · 1 line
2.39.2
PATCH v2 12/16 net/mlx5: refactor HWS code
In reply to Gregory Etelson1. In rte_flow_actions_template, rename actions_off into dr_off.
2. Remove duplicated code in template table creation.
--- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_flow_hw.c | 117 ++++++++++++++------------------ 2 files changed, 52 insertions(+), 67 deletions(-)
drivers/net/mlx5/mlx5_flow.h +1 -1
@@ -1331,7 +1331,7 @@ struct rte_flow_actions_template {uint64_t action_flags;/* Bit-map of all valid action in template. */ uint16_t dr_actions_num;/* Amount of DR rules actions. */ uint16_t actions_num;/* Amount of flow actions */ -uint16_t *actions_off;/* DR action offset for given rte action offset. */ +uint16_t *dr_off;/* DR action offset for given rte action offset. */ uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint32_t refcnt;/* Reference counter. */
drivers/net/mlx5/mlx5_flow_hw.c +51 -66
347 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v2 13/16 net/mlx5: fix RTE action location tracking in a template
In reply to Gregory EtelsonPMD can implicitly add flow actions to application actions template. If PMD added actions to a template is must track location of the original application actions in modified template.
The patch adds tracking ability for the orignal acton in a template.
--- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_flow_hw.c | 90 ++++++++++++++++----------------- 2 files changed, 45 insertions(+), 47 deletions(-)
drivers/net/mlx5/mlx5_flow.h +1 -1
@@ -1332,10 +1332,10 @@ struct rte_flow_actions_template {uint16_t dr_actions_num;/* Amount of DR rules actions. */ uint16_t actions_num;/* Amount of flow actions */ uint16_t *dr_off;/* DR action offset for given rte action offset. */ +uint16_t *src_off;/* RTE action displacement from app. template */ uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint32_t refcnt;/* Reference counter. */ -uint16_t rx_cpy_pos;/* Action position of Rx metadata to be copied. */ uint8_t flex_item;/* flex item index. */ };
drivers/net/mlx5/mlx5_flow_hw.c +44 -46
290 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v2 14/16 net/mlx5: fix mirror redirect action
In reply to Gregory EtelsonPMD used a buffer located on expired stack to store mirror reformat data.
The patch moves reformat buffer to the same context as the mirror action creation.
--- drivers/net/mlx5/mlx5_flow_hw.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -8
@@ -9690,11 +9690,11 @@ mirror_format_port(struct rte_eth_dev *dev,static int hw_mirror_clone_reformat (const struct rte_flow_action *actions, -struct mlx5dr_action_dest_attr *dest_attr, -enum mlx5dr_action_type *action_type,bool decap) +struct mlx5dr_action_dest_attr *dest_attr, +enum mlx5dr_action_type *action_type, +uint8_t *reformat_buf,bool decap) {int ret; -uint8_t encap_buf[MLX5_ENCAP_MAX_LEN ];const struct rte_flow_item *encap_item =NULL ;const struct rte_flow_action_raw_encap *encap_conf =NULL ;typeof (dest_attr->reformat) *reformat = &dest_attr->reformat;
@@ -9718,11 +9718,11 @@ hw_mirror_clone_reformat(const struct rte_flow_action *actions, MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3 :MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2 ;if (encap_item) { - ret =flow_dv_convert_encap_data (encap_item, encap_buf, + ret =flow_dv_convert_encap_data (encap_item, reformat_buf, &reformat->reformat_data_sz,NULL );if (ret)return -EINVAL ; - reformat->reformat_data = (void *)(uintptr_t )encap_buf; + reformat->reformat_data = reformat_buf; }else { reformat->reformat_data = (void *)(uintptr_t )encap_conf->data; reformat->reformat_data_sz = encap_conf->size;
@@ -9736,7 +9736,7 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,const struct mlx5_flow_template_table_cfg *table_cfg, const struct rte_flow_action *actions, struct mlx5dr_action_dest_attr *dest_attr, - struct rte_flow_error *error) + uint8_t *reformat_buf, struct rte_flow_error *error) { int ret;uint32_t i;
@@ -9772,7 +9772,7 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP : ret =hw_mirror_clone_reformat (&actions[i], dest_attr, &dest_attr->action_type[i], - decap_seen); + reformat_buf, decap_seen);if (ret <0 ) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
@@ -9802,6 +9802,7 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,enum mlx5dr_table_type table_type;struct mlx5_priv *priv = dev->data->dev_private;const struct rte_flow_attr *flow_attr = &table_cfg->attr.flow_attr; +uint8_t reformat_buf[MLX5_MIRROR_MAX_CLONES_NUM ][MLX5_ENCAP_MAX_LEN ];struct mlx5dr_action_dest_attr mirror_attr[MLX5_MIRROR_MAX_CLONES_NUM +1 ];enum mlx5dr_action_type array_action_types[MLX5_MIRROR_MAX_CLONES_NUM +1 ] [MLX5_MIRROR_MAX_SAMPLE_ACTIONS_LEN +1 ];
@@ -9839,7 +9840,7 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev, } ret =hw_mirror_format_clone (dev, &mirror->clone[i], table_cfg, clone_actions, &mirror_attr[i], - error); + reformat_buf[i], error);if (ret) goto error;
Signature · 1 line
2.39.2
PATCH v2 15/16 net/mlx5: support indirect list METER_MARK action
In reply to Gregory Etelson--- drivers/net/mlx5/mlx5_flow.c | 69 +++++- drivers/net/mlx5/mlx5_flow.h | 67 ++++- drivers/net/mlx5/mlx5_flow_hw.c | 427 +++++++++++++++++++++++++++----- 3 files changed, 482 insertions(+), 81 deletions(-)
drivers/net/mlx5/mlx5_flow.c +67 -2
@@ -75,8 +75,11 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)switch (e->type) {#ifdef HAVE_MLX5_HWS_SUPPORT case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR : -mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e, true); +mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e);break ; +case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY : +mlx5_destroy_legacy_indirect (dev, e); +break ;#endif default :DRV_LOG (ERR ,"invalid indirect list type" );
@@ -1169,7 +1172,24 @@ mlx5_flow_async_action_list_handle_destroyconst struct rte_flow_op_attr *op_attr, struct rte_flow_action_list_handle *action_handle, void *user_data, struct rte_flow_error *error); - +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error); +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const struct rte_flow_op_attr *attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error);static const struct rte_flow_ops mlx5_flow_ops = { .validate = mlx5_flow_validate, .create = mlx5_flow_create,
@@ -1219,6 +1239,10 @@ static const struct rte_flow_ops mlx5_flow_ops = { mlx5_flow_async_action_list_handle_create, .async_action_list_handle_destroy = mlx5_flow_async_action_list_handle_destroy, + .action_list_handle_query_update = + mlx5_flow_action_list_handle_query_update, + .async_action_list_handle_query_update = + mlx5_flow_async_action_list_handle_query_update, };/* Tunnel information. */
@@ -11003,6 +11027,47 @@ mlx5_flow_async_action_list_handle_destroy error); } +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + action_list_handle_query_update,ENOTSUP ); +return fops->action_list_handle_query_update (dev, handle, update, query, + mode, error); +} + +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const +struct rte_flow_op_attr *op_attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum +rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + async_action_list_handle_query_update,ENOTSUP ); +return fops->async_action_list_handle_query_update (dev, queue_id, op_attr, + handle, update, + query, mode, + user_data, error); +} + +/** * Destroy all indirect actions (shared RSS). *
drivers/net/mlx5/mlx5_flow.h +54 -13
113 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +361 -66
597 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v2 16/16 net/mlx5: fix METER_MARK indirection list callback
In reply to Gregory EtelsonIndirect action list METER_MARK handle and configuration parameters can be independently masked or non-masked in actions template. Non-masked configuration state is saved in the mlx5_action_construct_data::shared_meter object.
The patch moves indirect action list callback from mlx5_action_construct_data types union to prevent it's collision with shared_meter.
--- drivers/net/mlx5/mlx5_flow.h | 4 +--- drivers/net/mlx5/mlx5_flow_hw.c | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5_flow.h +1 -3
@@ -1271,6 +1271,7 @@ struct mlx5_action_construct_data {uint32_t idx;/* Data index. */ uint16_t action_src;/* rte_flow_action src offset. */ uint16_t action_dst;/* mlx5dr_rule_action dst offset. */ +indirect_list_callback_t indirect_list_cb; union { struct { /* encap data len. */
@@ -1312,9 +1313,6 @@ struct mlx5_action_construct_data {uint32_t id; uint32_t conf_masked:1; } shared_meter; -struct { -indirect_list_callback_t cb; - } indirect_list; }; };
drivers/net/mlx5/mlx5_flow_hw.c +3 -2
@@ -605,7 +605,7 @@ flow_hw_act_data_indirect_list_append(struct mlx5_priv *priv, act_data =__flow_hw_act_data_alloc (priv, type, action_src, action_dst);if (!act_data)return -1 ; - act_data->indirect_list.cb = cb; + act_data->indirect_list_cb = cb;LIST_INSERT_HEAD (&acts->act_list, act_data, next);return 0 ; }
@@ -2538,7 +2538,8 @@ flow_hw_actions_construct(struct rte_eth_dev *dev, (int)action->type == act_data->type);switch ((int )act_data->type) {case RTE_FLOW_ACTION_TYPE_INDIRECT_LIST : - act_data->indirect_list.cb (dev, act_data, actions, rule_acts); + act_data->indirect_list_cb (dev, act_data, actions, + &rule_acts[act_data->action_dst]);break ;case RTE_FLOW_ACTION_TYPE_INDIRECT : if (flow_hw_shared_action_construct
Signature · 1 line
2.39.2
RE: [PATCH v2 01/16] net/mlx5/hws: add support for reformat DevX object
In reply to Gregory EtelsonHi,
Quoted 11 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, October 17, 2023 2:42 AM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Maayan Kashani <[email protected]>; Raslan Darawsheh <[email protected]>; Hamdan Igbaria <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v2 01/16]net/mlx5/hws: add support for reformat DevX object
Quoted 6 lines
From: Hamdan Igbaria <[email protected]>
Add support for creation of packet reformat object, via the
ALLOC_PACKET_REFORMAT_CONTEXTcommand.Signed-off-by Hamdan Igbaria <[email protected]>
I'm OK for the series, but please update v3 with cover-letter as it is missing.
Thanks.
Quoted 9 lines
--- drivers/common/mlx5/mlx5_prm.h | 39 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 60 ++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 +++++ drivers/net/mlx5/hws/mlx5dr_internal.h | 5 +++ drivers/net/mlx5/hws/mlx5dr_send.c | 5 --- 5 files changed, 115 insertions(+), 5 deletions(-)2.39.2
v2 cover net/mlx5: support indirect actions list
In reply to Gregory EtelsonErez Shitrit (1):
net/mlx5/hws: allow destination into default miss FT
Gregory Etelson (10):
net/mlx5: reformat HWS code
net/mlx5: support HWS mirror action
net/mlx5: fix mirror action validation
net/mlx5: fix in shared counter and age template action create net/mlx5: fix modify field expansion for raw DECAP / ENCAP net/mlx5: refactor HWS code
net/mlx5: fix RTE action location tracking in a template net/mlx5: fix mirror redirect action
net/mlx5: support indirect list METER_MARK action net/mlx5: fix METER_MARK indirection list callback
Haifei Luo (1):
net/mlx5/hws: support reformat for hws mirror
Hamdan Igbaria (3):
net/mlx5/hws: add support for reformat DevX object net/mlx5/hws: support creating of dynamic forward table and FTE net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
Shun Hao (1):
net/mlx5/hws: add support for mirroring
drivers/common/mlx5/mlx5_prm.h | 81 +- drivers/net/mlx5/hws/mlx5dr.h | 34 + drivers/net/mlx5/hws/mlx5dr_action.c | 210 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 8 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 143 ++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 49 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_internal.h | 5 + drivers/net/mlx5/hws/mlx5dr_send.c | 5 - drivers/net/mlx5/hws/mlx5dr_table.c | 8 +- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 199 ++++ drivers/net/mlx5/mlx5_flow.h | 112 ++- drivers/net/mlx5/mlx5_flow_hw.c | 1218 +++++++++++++++++++++--- 15 files changed, 1908 insertions(+), 168 deletions(-)
Signature · 1 line
2.39.2
v3 cover net/mlx5: support indirect actions list
In reply to Gregory EtelsonAdd MLX5 PMD support for indirect actions list.
Erez Shitrit (1):
net/mlx5/hws: allow destination into default miss FT
Gregory Etelson (10):
net/mlx5: reformat HWS code
net/mlx5: support HWS mirror action
net/mlx5: fix mirror action validation
net/mlx5: fix in shared counter and age template action create net/mlx5: fix modify field expansion for raw DECAP / ENCAP net/mlx5: refactor HWS code
net/mlx5: fix RTE action location tracking in a template net/mlx5: fix mirror redirect action
net/mlx5: support indirect list METER_MARK action net/mlx5: fix METER_MARK indirection list callback
Haifei Luo (1):
net/mlx5/hws: support reformat for hws mirror
Hamdan Igbaria (3):
net/mlx5/hws: add support for reformat DevX object net/mlx5/hws: support creating of dynamic forward table and FTE net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
Shun Hao (1):
net/mlx5/hws: add support for mirroring
drivers/common/mlx5/mlx5_prm.h | 81 +- drivers/net/mlx5/hws/mlx5dr.h | 34 + drivers/net/mlx5/hws/mlx5dr_action.c | 210 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 8 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 143 ++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 49 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_internal.h | 5 + drivers/net/mlx5/hws/mlx5dr_send.c | 5 - drivers/net/mlx5/hws/mlx5dr_table.c | 8 +- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 199 ++++ drivers/net/mlx5/mlx5_flow.h | 112 ++- drivers/net/mlx5/mlx5_flow_hw.c | 1218 +++++++++++++++++++++--- 15 files changed, 1908 insertions(+), 168 deletions(-)
--
v3: Add ACK to patches in the series.
Signature · 1 line
2.39.2
PATCH v3 1/16 net/mlx5/hws: add support for reformat DevX object
From: Hamdan Igbaria <[email protected]>
Add support for creation of packet reformat object, via the ALLOC_PACKET_REFORMAT_CONTEXT command.
--- drivers/common/mlx5/mlx5_prm.h | 39 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 60 ++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 +++++ drivers/net/mlx5/hws/mlx5dr_internal.h | 5 +++ drivers/net/mlx5/hws/mlx5dr_send.c | 5 --- 5 files changed, 115 insertions(+), 5 deletions(-)
drivers/common/mlx5/mlx5_prm.h +39 -0
@@ -1218,6 +1218,8 @@ enum {MLX5_CMD_OP_CREATE_FLOW_GROUP =0x933 ,MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY =0x936 ,MLX5_CMD_OP_MODIFY_FLOW_TABLE =0x93c , +MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT =0x93d , +MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT =0x93e ,MLX5_CMD_OP_ALLOC_FLOW_COUNTER =0x939 ,MLX5_CMD_OP_QUERY_FLOW_COUNTER =0x93b , MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00,
@@ -5191,6 +5193,43 @@ struct mlx5_ifc_modify_flow_table_out_bits {u8 reserved_at_40[0x60 ]; }; +struct mlx5_ifc_packet_reformat_context_in_bits { +u8 reformat_type[0x8 ]; +u8 reserved_at_8[0x4 ]; +u8 reformat_param_0[0x4 ]; +u8 reserved_at_16[0x6 ]; +u8 reformat_data_size[0xa ]; + +u8 reformat_param_1[0x8 ]; +u8 reserved_at_40[0x8 ]; +u8 reformat_data[6 ][0x8 ]; + +u8 more_reformat_data[][0x8 ]; +}; + +struct mlx5_ifc_alloc_packet_reformat_context_in_bits { +u8 opcode[0x10 ]; +u8 uid[0x10 ]; + +u8 reserved_at_20[0x10 ]; +u8 op_mod[0x10 ]; + +u8 reserved_at_40[0xa0 ]; + +u8 packet_reformat_context[]; +}; + +struct mlx5_ifc_alloc_packet_reformat_out_bits { +u8 status[0x8 ]; +u8 reserved_at_8[0x18 ]; + +u8 syndrome[0x20 ]; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; +/* CQE format mask. */ #define MLX5E_CQE_FORMAT_MASK 0xc
drivers/net/mlx5/hws/mlx5dr_cmd.c +60 -0
66 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +11 -0
@@ -155,6 +155,13 @@ struct mlx5dr_cmd_allow_other_vhca_access_attr {uint8_t access_key[ACCESS_KEY_LEN ]; }; +struct mlx5dr_cmd_packet_reformat_create_attr { +uint8_t type; +size_t data_sz; +void *data; +uint8_t reformat_param_0; +}; +struct mlx5dr_cmd_query_ft_caps {uint8_t max_level;uint8_t reparse;
@@ -285,6 +292,10 @@ mlx5dr_cmd_forward_tbl_create(struct ibv_context *ctx,void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj * +mlx5dr_cmd_packet_reformat_create (struct ibv_context *ctx, +struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
drivers/net/mlx5/hws/mlx5dr_internal.h +5 -0
@@ -91,4 +91,9 @@ static inline uint64_t roundup_pow_of_two(uint64_t n) return n == 1 ? 1 : 1ULL << log2above(n); } +static inline unsigned long align (unsigned long val,unsigned long align) +{ +return (val + align -1 ) & ~(align -1 ); +} +#endif /* MLX5DR_INTERNAL_H_ */
drivers/net/mlx5/hws/mlx5dr_send.c +0 -5
@@ -668,11 +668,6 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,return err; } -static inline unsigned long align (unsigned long val,unsigned long align) -{ -return (val + align -1 ) & ~(align -1 ); -} - static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx, struct mlx5dr_send_engine *queue, struct mlx5dr_send_ring_sq *sq,
Signature · 1 line
2.39.2
PATCH v3 2/16 net/mlx5/hws: support creating of dynamic forward table and FTE
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add the ability to create forward table and FTE.
--- drivers/common/mlx5/mlx5_prm.h | 4 ++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 13 +++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+)
drivers/common/mlx5/mlx5_prm.h +4 -0
@@ -5048,7 +5048,11 @@ enum mlx5_flow_destination_type { };enum mlx5_flow_context_action { +MLX5_FLOW_CONTEXT_ACTION_DROP =1 <<1 ,MLX5_FLOW_CONTEXT_ACTION_FWD_DEST =1 <<2 , +MLX5_FLOW_CONTEXT_ACTION_REFORMAT =1 <<4 , +MLX5_FLOW_CONTEXT_ACTION_DECRYPT =1 <<12 , +MLX5_FLOW_CONTEXT_ACTION_ENCRYPT =1 <<13 , };enum mlx5_flow_context_flow_source {
drivers/net/mlx5/hws/mlx5dr_cmd.c +13 -0
@@ -42,6 +42,7 @@ mlx5dr_cmd_flow_table_create(struct ibv_context *ctx, ft_ctx =MLX5_ADDR_OF (create_flow_table_in, in, flow_table_context);MLX5_SET (flow_table_context, ft_ctx, level, ft_attr->level);MLX5_SET (flow_table_context, ft_ctx, rtc_valid, ft_attr->rtc_valid); +MLX5_SET (flow_table_context, ft_ctx, reformat_en, ft_attr->reformat_en); devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));if (!devx_obj->obj) {
@@ -182,12 +183,24 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, action_flags = fte_attr->action_flags;MLX5_SET (flow_context, in_flow_context, action, action_flags); +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_REFORMAT ) +MLX5_SET (flow_context, in_flow_context, + packet_reformat_id, fte_attr->packet_reformat_id); + +if (action_flags & (MLX5_FLOW_CONTEXT_ACTION_DECRYPT |MLX5_FLOW_CONTEXT_ACTION_ENCRYPT )) { +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_type, fte_attr->encrypt_decrypt_type); +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_obj_id, fte_attr->encrypt_decrypt_obj_id); + } +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ) {/* Only destination_list_size of size 1 is supported */ MLX5_SET (flow_context, in_flow_context, destination_list_size,1 ); in_dests =MLX5_ADDR_OF (flow_context, in_flow_context, destination);MLX5_SET (dest_format, in_dests, destination_type, fte_attr->destination_type);MLX5_SET (dest_format, in_dests, destination_id, fte_attr->destination_id); +MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); } devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));
drivers/net/mlx5/hws/mlx5dr_cmd.h +19 -0
@@ -7,8 +7,12 @@struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t encrypt_decrypt_type; +uint32_t encrypt_decrypt_obj_id; +uint32_t packet_reformat_id;uint8_t destination_type;uint32_t destination_id; +uint8_t ignore_flow_level;uint8_t flow_source; };
@@ -16,6 +20,7 @@ struct mlx5dr_cmd_ft_create_attr {uint8_t type;uint8_t level;bool rtc_valid; +uint8_t reformat_en; };#define ACCESS_KEY_LEN 32
@@ -296,6 +301,20 @@ struct mlx5dr_devx_obj * mlx5dr_cmd_packet_reformat_create(struct ibv_context *ctx, struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj * +mlx5dr_cmd_set_fte (struct ibv_context *ctx, +uint32_t table_type, +uint32_t table_id, +uint32_t group_id, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +struct mlx5dr_cmd_forward_tbl * +mlx5dr_cmd_forward_tbl_create (struct ibv_context *ctx, +struct mlx5dr_cmd_ft_create_attr *ft_attr, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
Signature · 1 line
2.39.2
PATCH v3 3/16 net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add mlx5dr_devx_obj struct to mlx5dr_action, so we could hold the FT obj in dest table action.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 4 ++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +++ drivers/net/mlx5/hws/mlx5dr_table.c | 1 - 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +4 -0
@@ -787,6 +787,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, tbl->ft);if (ret) goto free_action; + + action->devx_dest.devx_obj = tbl->ft; }return action;
@@ -864,6 +866,8 @@ mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, cur_obj);if (ret) goto clean_obj; + + action->devx_dest.devx_obj = cur_obj; }return action;
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -148,6 +148,9 @@ struct mlx5dr_action {struct {struct mlx5dv_steering_anchor *sa; } root_tbl; +struct { +struct mlx5dr_devx_obj *devx_obj; + } devx_dest; }; };
drivers/net/mlx5/hws/mlx5dr_table.c +0 -1
@@ -68,7 +68,6 @@ static void mlx5dr_table_down_default_fdb_miss_tbl(struct mlx5dr_table *tbl)return ;mlx5dr_cmd_forward_tbl_destroy (default_miss); - ctx->common_res[tbl_type].default_miss =NULL ; }
Signature · 1 line
2.39.2
PATCH v3 4/16 net/mlx5/hws: add support for mirroring
In reply to Gregory EtelsonFrom: Shun Hao <[email protected]>
This patch supports mirroring by adding an dest_array action. The action accecpts a list containing multiple destination actions, and can duplicate packet and forward to each destination in the list.
--- drivers/common/mlx5/mlx5_prm.h | 23 ++++- drivers/net/mlx5/hws/mlx5dr.h | 34 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 130 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 64 ++++++++++--- drivers/net/mlx5/hws/mlx5dr_cmd.h | 21 ++++- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_table.c | 7 +- 8 files changed, 262 insertions(+), 21 deletions(-)
drivers/common/mlx5/mlx5_prm.h +20 -3
@@ -2320,7 +2320,11 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { };struct mlx5_ifc_esw_cap_bits { -u8 reserved_at_0[0x60 ]; +u8 reserved_at_0[0x1d ]; +u8 merged_eswitch[0x1 ]; +u8 reserved_at_1e[0x2 ]; + +u8 reserved_at_20[0x40 ];u8 esw_manager_vport_number_valid[0x1 ];u8 reserved_at_61[0xf ];
@@ -5045,6 +5049,7 @@ struct mlx5_ifc_query_flow_table_out_bits {enum mlx5_flow_destination_type {MLX5_FLOW_DESTINATION_TYPE_VPORT =0x0 ,MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE =0x1 , +MLX5_FLOW_DESTINATION_TYPE_TIR =0x2 , };enum mlx5_flow_context_action {
@@ -5088,6 +5093,19 @@ union mlx5_ifc_dest_format_flow_counter_list_auto_bits {u8 reserved_at_0[0x40 ]; }; +struct mlx5_ifc_extended_dest_format_bits { +struct mlx5_ifc_dest_format_bits destination_entry; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; + +#define MLX5_IFC_MULTI_PATH_FT_MAX_LEVEL 64 + +#ifdef PEDANTIC +#pragma GCC diagnostic ignored "-Wpedantic" +#endif struct mlx5_ifc_flow_context_bits {u8 reserved_at_00[0x20 ];u8 group_id[0x20 ];
@@ -5106,8 +5124,7 @@ struct mlx5_ifc_flow_context_bits {u8 reserved_at_e0[0x40 ];u8 encrypt_decrypt_obj_id[0x20 ];u8 reserved_at_140[0x16c0 ]; -/* Currently only one destnation */ -union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[1 ]; +union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0 ]; };struct mlx5_ifc_set_fte_in_bits {
drivers/net/mlx5/hws/mlx5dr.h +34 -0
@@ -46,6 +46,7 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_ASO_METER ,MLX5DR_ACTION_TYP_ASO_CT ,MLX5DR_ACTION_TYP_DEST_ROOT , +MLX5DR_ACTION_TYP_DEST_ARRAY , MLX5DR_ACTION_TYP_MAX, };
@@ -213,6 +214,20 @@ struct mlx5dr_rule_action { }; }; +struct mlx5dr_action_dest_attr { +/* Required action combination */ +enum mlx5dr_action_type *action_type; + +/* Required destination action to forward the packet */ +struct mlx5dr_action *dest; + +/* Optional reformat data */ +struct { +size_t reformat_data_sz; +void *reformat_data; + } reformat; +}; +/* Open a context used for direct rule insertion using hardware steering. * Each context can contain multiple tables of different types. *
@@ -616,6 +631,25 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags);struct mlx5dr_action *mlx5dr_action_create_push_vlan (struct mlx5dr_context *ctx,uint32_t flags); +/* Create a dest array action, this action can duplicate packets and forward to +* multiple destinations in the destination list. +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] num_dest +* The number of dests attributes. +* @param[in] dests +* The destination array. Each contains a destination action and can have +* additional actions. +* @param[in] flags +* Action creation flags. (enum mlx5dr_action_flags) +* @return pointer to mlx5dr_action on success NULL otherwise. +*/ +struct mlx5dr_action * +mlx5dr_action_create_dest_array (struct mlx5dr_context *ctx, +size_t num_dest, +struct mlx5dr_action_dest_attr *dests, +uint32_t flags); +/* Create dest root table, this action will jump to root table according * the given priority. * @param[in] ctx
drivers/net/mlx5/hws/mlx5dr_action.c +128 -2
166 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -151,6 +151,9 @@ struct mlx5dr_action {struct {struct mlx5dr_devx_obj *devx_obj; } devx_dest; +struct { +struct mlx5dr_cmd_forward_tbl *fw_island; + } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +54 -10
109 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +17 -4
@@ -5,15 +5,27 @@#ifndef MLX5DR_CMD_H_ #define MLX5DR_CMD_H_ +enum mlx5dr_cmd_ext_dest_flags { +MLX5DR_CMD_EXT_DEST_REFORMAT =1 <<0 , +MLX5DR_CMD_EXT_DEST_ESW_OWNER_VHCA_ID =1 <<1 , +}; + +struct mlx5dr_cmd_set_fte_dest { +uint8_t destination_type; +uint32_t destination_id; +enum mlx5dr_cmd_ext_dest_flags ext_flags; +uint16_t esw_owner_vhca_id; +}; +struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t ignore_flow_level; +uint8_t flow_source;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id; -uint8_t destination_type; -uint32_t destination_id; -uint8_t ignore_flow_level; -uint8_t flow_source; +uint32_t dests_num; +struct mlx5dr_cmd_set_fte_dest *dests; }; struct mlx5dr_cmd_ft_create_attr {
@@ -216,6 +228,7 @@ struct mlx5dr_cmd_query_caps {struct mlx5dr_cmd_query_ft_caps nic_ft;struct mlx5dr_cmd_query_ft_caps fdb_ft;bool eswitch_manager; +uint8_t merged_eswitch;uint32_t eswitch_manager_vport_number;uint8_t log_header_modify_argument_granularity;uint8_t log_header_modify_argument_max_alloc;
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
@@ -23,6 +23,7 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_ASO_METER] = "ASO_METER", [MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT", [MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT", + [MLX5DR_ACTION_TYP_DEST_ARRAY ] ="DEST_ARRAY" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/hws/mlx5dr_table.c +5 -2
@@ -22,6 +22,7 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)struct mlx5dr_cmd_ft_create_attr ft_attr = {0 };struct mlx5dr_cmd_set_fte_attr fte_attr = {0 };struct mlx5dr_cmd_forward_tbl *default_miss; +struct mlx5dr_cmd_set_fte_dest dest = {0 };struct mlx5dr_context *ctx = tbl->ctx;uint8_t tbl_type = tbl->type;
@@ -37,9 +38,11 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl) ft_attr.level = tbl->ctx->caps->fdb_ft.max_level;/* The last level */ ft_attr.rtc_valid = false; + dest.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest.destination_id = ctx->caps->eswitch_manager_vport_number; fte_attr.action_flags =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; - fte_attr.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; - fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number; + fte_attr.dests_num =1 ; + fte_attr.dests = &dest; default_miss =mlx5dr_cmd_forward_tbl_create (mlx5dr_context_get_local_ibv (ctx), &ft_attr, &fte_attr);
Signature · 1 line
2.39.2
PATCH v3 5/16 net/mlx5/hws: allow destination into default miss FT
In reply to Gregory EtelsonFrom: Erez Shitrit <[email protected]>
In FDB it will direct the packet into the hypervisor vport. That allows the user to mirror packets into the default-miss vport.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/mlx5/hws/mlx5dr_action.c +11 -0
@@ -1769,6 +1769,17 @@ mlx5dr_action_create_dest_array(struct mlx5dr_context *ctx, fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; fte_attr.ignore_flow_level =1 ;break ; +case MLX5DR_ACTION_TYP_MISS : +if (table_type !=MLX5DR_TABLE_TYPE_FDB ) { +DR_LOG (ERR ,"Miss action supported for FDB only" ); + rte_errno =ENOTSUP ; + goto free_dest_list; + } + dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest_list[i].destination_id = + ctx->caps->eswitch_manager_vport_number; + fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; +break ;case MLX5DR_ACTION_TYP_VPORT : dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; dest_list[i].destination_id = dests[i].dest->vport.vport_num;
Signature · 1 line
2.39.2
PATCH v3 6/16 net/mlx5/hws: support reformat for hws mirror
In reply to Gregory EtelsonFrom: Haifei Luo <[email protected]>
In dest_array action, an optional reformat action can be applied to each destination. This patch supports this by using the extended destination entry.
--- drivers/common/mlx5/mlx5_prm.h | 15 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 67 +++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 2 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 10 ++++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 2 + 5 files changed, 94 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_prm.h +15 -0
@@ -5352,6 +5352,21 @@ enum mlx5_parse_graph_arc_node_index { MLX5_GRAPH_ARC_NODE_PROGRAMMABLE = 0x1f, }; +enum mlx5_packet_reformat_context_reformat_type { +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L2_TUNNEL =0x2 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_TUNNEL =0x4 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4 =0x5 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_ESP_TUNNEL =0x6 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV4 =0x7 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT =0x8 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L3_ESP_TUNNEL_TO_L2 =0x9 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT_OVER_UDP =0xA , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6 =0xB , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV6 =0xC , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_NISP_TNL =0xD , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_REMOVE_NISP_TNL =0xE , +}; +#define MLX5_PARSE_GRAPH_FLOW_SAMPLE_MAX 8#define MLX5_PARSE_GRAPH_IN_ARC_MAX 8#define MLX5_PARSE_GRAPH_OUT_ARC_MAX 8
drivers/net/mlx5/hws/mlx5dr_action.c +66 -1
104 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +2 -0
@@ -153,6 +153,8 @@ struct mlx5dr_action { } devx_dest;struct {struct mlx5dr_cmd_forward_tbl *fw_island; +size_t num_dest; +struct mlx5dr_cmd_set_fte_dest *dest_list; } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +9 -1
@@ -169,7 +169,9 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx,uint32_t *in;uint32_t i; - dest_entry_sz =MLX5_ST_SZ_BYTES (dest_format); + dest_entry_sz = fte_attr->extended_dest ? +MLX5_ST_SZ_BYTES (extended_dest_format) : +MLX5_ST_SZ_BYTES (dest_format); total_dest_sz = dest_entry_sz * fte_attr->dests_num; inlen =align ((MLX5_ST_SZ_BYTES (set_fte_in) + total_dest_sz),DW_SIZE ); in =simple_calloc (1 , inlen);
@@ -192,6 +194,7 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, in_flow_context =MLX5_ADDR_OF (set_fte_in, in, flow_context);MLX5_SET (flow_context, in_flow_context, group_id, group_id);MLX5_SET (flow_context, in_flow_context, flow_source, fte_attr->flow_source); +MLX5_SET (flow_context, in_flow_context, extended_destination, fte_attr->extended_dest);MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); action_flags = fte_attr->action_flags;
@@ -230,6 +233,11 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, dest->destination_type);MLX5_SET (dest_format, in_dests, destination_id, dest->destination_id); +if (dest->ext_flags &MLX5DR_CMD_EXT_DEST_REFORMAT ) { +MLX5_SET (dest_format, in_dests, packet_reformat,1 ); +MLX5_SET (extended_dest_format, in_dests, packet_reformat_id, + dest->ext_reformat->id); + }break ;default : rte_errno =EOPNOTSUPP ;
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
@@ -14,6 +14,7 @@ struct mlx5dr_cmd_set_fte_dest {uint8_t destination_type;uint32_t destination_id;enum mlx5dr_cmd_ext_dest_flags ext_flags; +struct mlx5dr_devx_obj *ext_reformat;uint16_t esw_owner_vhca_id; };
@@ -21,6 +22,7 @@ struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags;uint8_t ignore_flow_level;uint8_t flow_source; +uint8_t extended_dest;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id;
Signature · 1 line
2.39.2
PATCH v3 7/16 net/mlx5: reformat HWS code
In reply to Gregory EtelsonReplace if() with switch().
--- drivers/net/mlx5/mlx5_flow_hw.c | 70 ++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 31 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +39 -31
@@ -4548,6 +4548,17 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT, }; +static inline void +action_template_set_type (struct rte_flow_actions_template *at, +enum mlx5dr_action_type *action_types, +unsigned int action_src,uint16_t *curr_off, +enum mlx5dr_action_type type) +{ + at->actions_off[action_src] = *curr_off; + action_types[*curr_off] = type; + *curr_off = *curr_off +1 ; +} + static int flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, unsigned int action_src,
@@ -4565,9 +4576,8 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, type = mask->type;switch (type) {case RTE_FLOW_ACTION_TYPE_RSS : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_TIR ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_TIR );break ;case RTE_FLOW_ACTION_TYPE_AGE :case RTE_FLOW_ACTION_TYPE_COUNT :
@@ -4575,23 +4585,20 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,* Both AGE and COUNT action need counter, the first one fills * the action_types array, and the second only saves the offset. */ -if (*cnt_off ==UINT16_MAX ) { - *cnt_off = *curr_off; - action_types[*cnt_off] =MLX5DR_ACTION_TYP_CTR ; - *curr_off = *curr_off +1 ; - } +if (*cnt_off ==UINT16_MAX ) +action_template_set_type (at, action_types, + action_src, curr_off, +MLX5DR_ACTION_TYP_CTR ); at->actions_off[action_src] = *cnt_off;break ;case RTE_FLOW_ACTION_TYPE_CONNTRACK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_CT ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_CT );break ;case RTE_FLOW_ACTION_TYPE_QUOTA :case RTE_FLOW_ACTION_TYPE_METER_MARK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_METER ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_METER );break ;default :DRV_LOG (WARNING ,"Unsupported shared action type: %d" , type);
@@ -5101,31 +5108,32 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, at->reformat_off =UINT16_MAX ; at->mhdr_off =UINT16_MAX ; at->rx_cpy_pos = pos; -/* -* mlx5 PMD hacks indirect action index directly to the action conf. -* The rte_flow_conv() function copies the content from conf pointer. -* Need to restore the indirect action index from action conf here. -*/ for (i =0 ; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++, masks++, i++) { -if (actions->type ==RTE_FLOW_ACTION_TYPE_INDIRECT ) { +const struct rte_flow_action_modify_field *info; + +switch (actions->type) { +/* +* mlx5 PMD hacks indirect action index directly to the action conf. +* The rte_flow_conv() function copies the content from conf pointer. +* Need to restore the indirect action index from action conf here. +*/ +case RTE_FLOW_ACTION_TYPE_INDIRECT : at->actions[i].conf = actions->conf; at->masks[i].conf = masks->conf; - } -if (actions->type ==RTE_FLOW_ACTION_TYPE_MODIFY_FIELD ) { -const struct rte_flow_action_modify_field *info = actions->conf; - +break ; +case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD : + info = actions->conf;if ((info->dst.field ==RTE_FLOW_FIELD_FLEX_ITEM &&flow_hw_flex_item_acquire (dev, info->dst.flex_handle, &at->flex_item)) || - (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && -flow_hw_flex_item_acquire (dev, info->src.flex_handle, - &at->flex_item))) { -rte_flow_error_set (error, rte_errno, -RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , -"Failed to acquire flex item" ); + (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && +flow_hw_flex_item_acquire (dev, info->src.flex_handle, + &at->flex_item))) goto error; - } +break ; +default : +break ; } } at->tmpl =flow_hw_dr_actions_template_create (at);
Signature · 1 line
2.39.2
PATCH v3 8/16 net/mlx5: support HWS mirror action
In reply to Gregory EtelsonHWS mirror clones original packet to one or two destinations and proceeds with the original packet path.
The mirror has no dedicated RTE flow action type. Mirror object is referenced by INDIRECT_LIST action. INDIRECT_LIST for a mirror built from actions list:
SAMPLE [/ SAMPLE] / <Orig. packet destination> / END
Mirror SAMPLE action defines packet clone. It specifies the clone destination and optional clone reformat action. Destination action for both clone and original packet depends on HCA domain:
- for NIC RX, destination is ether RSS or QUEUE
- for FDB, destination is PORT
HWS mirror was inplemented with the INDIRECT_LIST flow action.
MLX5 PMD defines general struct mlx5_indirect_list type for all. INDIRECT_LIST handler objects:
struct mlx5_indirect_list {
enum mlx5_indirect_list_type type;
LIST_ENTRY(mlx5_indirect_list) chain;
char data[];
};Specific INDIRECT_LIST type must overload mlx5_indirect_list::data and provide unique type value.
PMD returns a pointer to mlx5_indirect_list object.
Existing non-masked actions template API cannot identify flow actions in INDIRECT_LIST handler because INDIRECT_LIST handler can represent several flow actions.
For example:
A: SAMPLE / JUMP
B: SAMPE / SAMPLE / RSS
Actions template command
template indirect_list / end mask indirect_list 0 / end
does not provide any information to differentiate between flow actions in A and B.
MLX5 PMD requires INDIRECT_LIST configuration parameter in the template section:
Non-masked INDIRECT_LIST API:
=============================
template indirect_list X / end mask indirect_list 0 / end
PMD identifies type of X handler and will use the same type in template creation. Actual parameters for actions in the list will be extracted from flow configuration
Masked INDIRECT_LIST API:
=========================
template indirect_list X / end mask indirect_list -lUL / end
PMD creates action template from actions types and configurations referenced by X.
INDIRECT_LIST action without configuration is invalid and will be rejected by PMD.
--- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 134 +++++++ drivers/net/mlx5/mlx5_flow.h | 69 +++- drivers/net/mlx5/mlx5_flow_hw.c | 616 +++++++++++++++++++++++++++++++- 5 files changed, 817 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5.c +1 -0
@@ -2168,6 +2168,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)/* Free the eCPRI flex parser resource. */ mlx5_flex_parser_ecpri_release (dev);mlx5_flex_item_port_cleanup (dev); +mlx5_indirect_list_handles_release (dev);#ifdef HAVE_MLX5_HWS_SUPPORT flow_hw_destroy_vport_action (dev);flow_hw_resource_release (dev);
drivers/net/mlx5/mlx5.h +2 -0
@@ -1791,6 +1791,8 @@ struct mlx5_priv { LIST_HEAD(ind_tables, mlx5_ind_table_obj) ind_tbls;/* Standalone indirect tables. */ LIST_HEAD(stdl_ind_tables, mlx5_ind_table_obj) standalone_ind_tbls; +/* Objects created with indirect list action */ + LIST_HEAD(indirect_list, mlx5_indirect_list) indirect_list_head;/* Pointer to next element. */ rte_rwlock_t ind_tbls_lock;uint32_t refcnt;/**< Reference counter. */
drivers/net/mlx5/mlx5_flow.c +134 -0
164 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +68 -1
121 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +612 -4
694 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v3 9/16 net/mlx5: fix mirror action validation
In reply to Gregory EtelsonHWS mirror flow action validation rejected flows in NIC domain, if PMD FDB mode was active.
The patch allows NIC mirror action in FDB mode.
--- drivers/net/mlx5/mlx5_flow_hw.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +13 -7
@@ -9547,14 +9547,15 @@ mlx5_mirror_terminal_action(const struct rte_flow_action *action)static bool mlx5_mirror_validate_sample_action (struct rte_eth_dev *dev, -const struct rte_flow_action *action) +const struct rte_flow_attr *flow_attr, +const struct rte_flow_action *action) {struct mlx5_priv *priv = dev->data->dev_private;switch (action->type) {case RTE_FLOW_ACTION_TYPE_QUEUE :case RTE_FLOW_ACTION_TYPE_RSS : -if (priv->sh->esw_mode) +if (flow_attr->transfer)return false;break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT :
@@ -9562,7 +9563,7 @@ mlx5_mirror_validate_sample_action(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_RAW_DECAP :case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP : -if (!priv->sh->esw_mode) +if (!priv->sh->esw_mode && !flow_attr->transfer)return false;if (action[0 ].type ==RTE_FLOW_ACTION_TYPE_RAW_DECAP && action[1 ].type !=RTE_FLOW_ACTION_TYPE_RAW_ENCAP )
@@ -9584,19 +9585,22 @@ mlx5_mirror_validate_sample_action(struct rte_eth_dev *dev,*/ static int mlx5_hw_mirror_actions_list_validate (struct rte_eth_dev *dev, +const struct rte_flow_attr *flow_attr,const struct rte_flow_action *actions) {if (actions[0 ].type ==RTE_FLOW_ACTION_TYPE_SAMPLE ) {int i =1 ;bool valid;const struct rte_flow_action_sample *sample = actions[0 ].conf; - valid =mlx5_mirror_validate_sample_action (dev, sample->actions); + valid =mlx5_mirror_validate_sample_action (dev, flow_attr, + sample->actions);if (!valid)return -EINVAL ;if (actions[1 ].type ==RTE_FLOW_ACTION_TYPE_SAMPLE ) { i =2 ; sample = actions[1 ].conf; - valid =mlx5_mirror_validate_sample_action (dev, sample->actions); + valid =mlx5_mirror_validate_sample_action (dev, flow_attr, + sample->actions);if (!valid)return -EINVAL ; }
@@ -9780,15 +9784,17 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,struct mlx5_mirror *mirror;enum mlx5dr_table_type table_type;struct mlx5_priv *priv = dev->data->dev_private; +const struct rte_flow_attr *flow_attr = &table_cfg->attr.flow_attr;struct mlx5dr_action_dest_attr mirror_attr[MLX5_MIRROR_MAX_CLONES_NUM +1 ];enum mlx5dr_action_type array_action_types[MLX5_MIRROR_MAX_CLONES_NUM +1 ] [MLX5_MIRROR_MAX_SAMPLE_ACTIONS_LEN +1 ];memset (mirror_attr,0 ,sizeof (mirror_attr));memset (array_action_types,0 ,sizeof (array_action_types)); - table_type =get_mlx5dr_table_type (&table_cfg->attr.flow_attr); + table_type =get_mlx5dr_table_type (flow_attr); hws_flags = mlx5_hw_act_flag[MLX5_HW_ACTION_FLAG_NONE_ROOT ][table_type]; - clones_num =mlx5_hw_mirror_actions_list_validate (dev, actions); + clones_num =mlx5_hw_mirror_actions_list_validate (dev, flow_attr, + actions);if (clones_num <0 ) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION , actions,"Invalid mirror list format" );
Signature · 1 line
2.39.2
PATCH v3 10/16 net/mlx5: fix in shared counter and age template action create
In reply to Gregory EtelsonCount and age actions in HWS template are translated into the same DR5 action.
PMD maintains dedicated variable - cnt_off, that points action location in DR5 array.
Currnet PMD did not initialize the cnt_off variable during shared counter / age actions initialization.
--- drivers/net/mlx5/mlx5_flow_hw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_hw.c +3 -1
@@ -4680,10 +4680,12 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,* Both AGE and COUNT action need counter, the first one fills * the action_types array, and the second only saves the offset. */ -if (*cnt_off ==UINT16_MAX ) +if (*cnt_off ==UINT16_MAX ) { + *cnt_off = *curr_off;action_template_set_type (at, action_types, action_src, curr_off,MLX5DR_ACTION_TYP_CTR ); + } at->actions_off[action_src] = *cnt_off;break ;case RTE_FLOW_ACTION_TYPE_CONNTRACK :
Signature · 1 line
2.39.2
PATCH v3 11/16 net/mlx5: fix modify field expansion for raw DECAP / ENCAP
In reply to Gregory EtelsonFlow actions in HWS actions template must be arranged according to pre-defined order.
MLX5 PMD handles RAW_DECAP / RAW_ENCAP actions sequence as a single RAW ENCAP or DECAP flow action.
When the PMD scanned flow actions to locate position where MODIFY_FIELD action could be inserted it processed the RAW_DECAP / RAW_ENCAP sequence as 2 separate actions. As the result location selection was wrong.
The patch fixes RAW_DECAP / RAW_ENCAP sequence processing for MODIFY_FIELD expansion.
--- drivers/net/mlx5/mlx5_flow_hw.c | 36 +++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +34 -2
@@ -4283,6 +4283,28 @@ flow_hw_validate_action_raw_encap(struct rte_eth_dev *dev __rte_unused,return 0 ; } +/** +* Process `... / raw_decap / raw_encap / ...` actions sequence. +* The PMD handles the sequence as a single encap or decap reformat action, +* depending on the raw_encap configuration. +* +* The function assumes that the sequence location in actions template list +* complies with relative HWS actions order for the required reformat. +*/ +static uint64_t +mlx5_decap_encap_reformat_type (const struct rte_flow_action *actions, +uint32_t encap_ind,uint64_t flags) +{ +const struct rte_flow_action_raw_encap *encap = actions[encap_ind].conf; + +if ((flags &MLX5_FLOW_ACTION_DECAP ) ==0 ) +return MLX5_FLOW_ACTION_ENCAP ; +if (actions[encap_ind -1 ].type !=RTE_FLOW_ACTION_TYPE_RAW_DECAP ) +return MLX5_FLOW_ACTION_ENCAP ; +return encap->size >=MLX5_ENCAPSULATION_DECISION_SIZE ? +MLX5_FLOW_ACTION_ENCAP :MLX5_FLOW_ACTION_DECAP ; +} + static inline uint16_t flow_hw_template_expand_modify_field(struct rte_flow_action actions[], struct rte_flow_action masks[],
@@ -4320,13 +4342,13 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],*/ for (i = act_num -2 ; (int )i >=0 ; i--) {enum rte_flow_action_type type = actions[i].type; +uint64_t reformat_type;if (type ==RTE_FLOW_ACTION_TYPE_INDIRECT ) type = masks[i].type;switch (type) {case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP : -case RTE_FLOW_ACTION_TYPE_RAW_ENCAP :case RTE_FLOW_ACTION_TYPE_DROP :case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL :case RTE_FLOW_ACTION_TYPE_JUMP :
@@ -4337,10 +4359,20 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],case RTE_FLOW_ACTION_TYPE_VOID :case RTE_FLOW_ACTION_TYPE_END :break ; +case RTE_FLOW_ACTION_TYPE_RAW_ENCAP : + reformat_type = +mlx5_decap_encap_reformat_type (actions, i, + flags); +if (reformat_type ==MLX5_FLOW_ACTION_DECAP ) { + i++; + goto insert; + } +if (flags &MLX5_FLOW_ACTION_DECAP ) + i--; +break ;default : i++;/* new MF inserted AFTER actions[i] */ goto insert; -break ; } } i =0 ;
Signature · 1 line
2.39.2
PATCH v3 12/16 net/mlx5: refactor HWS code
In reply to Gregory Etelson1. In rte_flow_actions_template, rename actions_off into dr_off.
2. Remove duplicated code in template table creation.
--- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_flow_hw.c | 117 ++++++++++++++------------------ 2 files changed, 52 insertions(+), 67 deletions(-)
drivers/net/mlx5/mlx5_flow.h +1 -1
@@ -1331,7 +1331,7 @@ struct rte_flow_actions_template {uint64_t action_flags;/* Bit-map of all valid action in template. */ uint16_t dr_actions_num;/* Amount of DR rules actions. */ uint16_t actions_num;/* Amount of flow actions */ -uint16_t *actions_off;/* DR action offset for given rte action offset. */ +uint16_t *dr_off;/* DR action offset for given rte action offset. */ uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint32_t refcnt;/* Reference counter. */
drivers/net/mlx5/mlx5_flow_hw.c +51 -66
347 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v3 13/16 net/mlx5: fix RTE action location tracking in a template
In reply to Gregory EtelsonPMD can implicitly add flow actions to application actions template. If PMD added actions to a template is must track location of the original application actions in modified template.
The patch adds tracking ability for the orignal acton in a template.
--- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_flow_hw.c | 90 ++++++++++++++++----------------- 2 files changed, 45 insertions(+), 47 deletions(-)
drivers/net/mlx5/mlx5_flow.h +1 -1
@@ -1332,10 +1332,10 @@ struct rte_flow_actions_template {uint16_t dr_actions_num;/* Amount of DR rules actions. */ uint16_t actions_num;/* Amount of flow actions */ uint16_t *dr_off;/* DR action offset for given rte action offset. */ +uint16_t *src_off;/* RTE action displacement from app. template */ uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint32_t refcnt;/* Reference counter. */ -uint16_t rx_cpy_pos;/* Action position of Rx metadata to be copied. */ uint8_t flex_item;/* flex item index. */ };
drivers/net/mlx5/mlx5_flow_hw.c +44 -46
290 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v3 14/16 net/mlx5: fix mirror redirect action
In reply to Gregory EtelsonPMD used a buffer located on expired stack to store mirror reformat data.
The patch moves reformat buffer to the same context as the mirror action creation.
--- drivers/net/mlx5/mlx5_flow_hw.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -8
@@ -9690,11 +9690,11 @@ mirror_format_port(struct rte_eth_dev *dev,static int hw_mirror_clone_reformat (const struct rte_flow_action *actions, -struct mlx5dr_action_dest_attr *dest_attr, -enum mlx5dr_action_type *action_type,bool decap) +struct mlx5dr_action_dest_attr *dest_attr, +enum mlx5dr_action_type *action_type, +uint8_t *reformat_buf,bool decap) {int ret; -uint8_t encap_buf[MLX5_ENCAP_MAX_LEN ];const struct rte_flow_item *encap_item =NULL ;const struct rte_flow_action_raw_encap *encap_conf =NULL ;typeof (dest_attr->reformat) *reformat = &dest_attr->reformat;
@@ -9718,11 +9718,11 @@ hw_mirror_clone_reformat(const struct rte_flow_action *actions, MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3 :MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2 ;if (encap_item) { - ret =flow_dv_convert_encap_data (encap_item, encap_buf, + ret =flow_dv_convert_encap_data (encap_item, reformat_buf, &reformat->reformat_data_sz,NULL );if (ret)return -EINVAL ; - reformat->reformat_data = (void *)(uintptr_t )encap_buf; + reformat->reformat_data = reformat_buf; }else { reformat->reformat_data = (void *)(uintptr_t )encap_conf->data; reformat->reformat_data_sz = encap_conf->size;
@@ -9736,7 +9736,7 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,const struct mlx5_flow_template_table_cfg *table_cfg, const struct rte_flow_action *actions, struct mlx5dr_action_dest_attr *dest_attr, - struct rte_flow_error *error) + uint8_t *reformat_buf, struct rte_flow_error *error) { int ret;uint32_t i;
@@ -9772,7 +9772,7 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP : ret =hw_mirror_clone_reformat (&actions[i], dest_attr, &dest_attr->action_type[i], - decap_seen); + reformat_buf, decap_seen);if (ret <0 ) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
@@ -9802,6 +9802,7 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,enum mlx5dr_table_type table_type;struct mlx5_priv *priv = dev->data->dev_private;const struct rte_flow_attr *flow_attr = &table_cfg->attr.flow_attr; +uint8_t reformat_buf[MLX5_MIRROR_MAX_CLONES_NUM ][MLX5_ENCAP_MAX_LEN ];struct mlx5dr_action_dest_attr mirror_attr[MLX5_MIRROR_MAX_CLONES_NUM +1 ];enum mlx5dr_action_type array_action_types[MLX5_MIRROR_MAX_CLONES_NUM +1 ] [MLX5_MIRROR_MAX_SAMPLE_ACTIONS_LEN +1 ];
@@ -9839,7 +9840,7 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev, } ret =hw_mirror_format_clone (dev, &mirror->clone[i], table_cfg, clone_actions, &mirror_attr[i], - error); + reformat_buf[i], error);if (ret) goto error;
Signature · 1 line
2.39.2
PATCH v3 15/16 net/mlx5: support indirect list METER_MARK action
In reply to Gregory Etelson--- drivers/net/mlx5/mlx5_flow.c | 69 +++++- drivers/net/mlx5/mlx5_flow.h | 67 ++++- drivers/net/mlx5/mlx5_flow_hw.c | 427 +++++++++++++++++++++++++++----- 3 files changed, 482 insertions(+), 81 deletions(-)
drivers/net/mlx5/mlx5_flow.c +67 -2
@@ -75,8 +75,11 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)switch (e->type) {#ifdef HAVE_MLX5_HWS_SUPPORT case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR : -mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e, true); +mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e);break ; +case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY : +mlx5_destroy_legacy_indirect (dev, e); +break ;#endif default :DRV_LOG (ERR ,"invalid indirect list type" );
@@ -1169,7 +1172,24 @@ mlx5_flow_async_action_list_handle_destroyconst struct rte_flow_op_attr *op_attr, struct rte_flow_action_list_handle *action_handle, void *user_data, struct rte_flow_error *error); - +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error); +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const struct rte_flow_op_attr *attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error);static const struct rte_flow_ops mlx5_flow_ops = { .validate = mlx5_flow_validate, .create = mlx5_flow_create,
@@ -1219,6 +1239,10 @@ static const struct rte_flow_ops mlx5_flow_ops = { mlx5_flow_async_action_list_handle_create, .async_action_list_handle_destroy = mlx5_flow_async_action_list_handle_destroy, + .action_list_handle_query_update = + mlx5_flow_action_list_handle_query_update, + .async_action_list_handle_query_update = + mlx5_flow_async_action_list_handle_query_update, };/* Tunnel information. */
@@ -11003,6 +11027,47 @@ mlx5_flow_async_action_list_handle_destroy error); } +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + action_list_handle_query_update,ENOTSUP ); +return fops->action_list_handle_query_update (dev, handle, update, query, + mode, error); +} + +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const +struct rte_flow_op_attr *op_attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum +rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + async_action_list_handle_query_update,ENOTSUP ); +return fops->async_action_list_handle_query_update (dev, queue_id, op_attr, + handle, update, + query, mode, + user_data, error); +} + +/** * Destroy all indirect actions (shared RSS). *
drivers/net/mlx5/mlx5_flow.h +54 -13
113 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +361 -66
597 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v3 16/16 net/mlx5: fix METER_MARK indirection list callback
In reply to Gregory EtelsonIndirect action list METER_MARK handle and configuration parameters can be independently masked or non-masked in actions template. Non-masked configuration state is saved in the mlx5_action_construct_data::shared_meter object.
The patch moves indirect action list callback from mlx5_action_construct_data types union to prevent it's collision with shared_meter.
--- drivers/net/mlx5/mlx5_flow.h | 4 +--- drivers/net/mlx5/mlx5_flow_hw.c | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5_flow.h +1 -3
@@ -1271,6 +1271,7 @@ struct mlx5_action_construct_data {uint32_t idx;/* Data index. */ uint16_t action_src;/* rte_flow_action src offset. */ uint16_t action_dst;/* mlx5dr_rule_action dst offset. */ +indirect_list_callback_t indirect_list_cb; union { struct { /* encap data len. */
@@ -1312,9 +1313,6 @@ struct mlx5_action_construct_data {uint32_t id; uint32_t conf_masked:1; } shared_meter; -struct { -indirect_list_callback_t cb; - } indirect_list; }; };
drivers/net/mlx5/mlx5_flow_hw.c +3 -2
@@ -605,7 +605,7 @@ flow_hw_act_data_indirect_list_append(struct mlx5_priv *priv, act_data =__flow_hw_act_data_alloc (priv, type, action_src, action_dst);if (!act_data)return -1 ; - act_data->indirect_list.cb = cb; + act_data->indirect_list_cb = cb;LIST_INSERT_HEAD (&acts->act_list, act_data, next);return 0 ; }
@@ -2538,7 +2538,8 @@ flow_hw_actions_construct(struct rte_eth_dev *dev, (int)action->type == act_data->type);switch ((int )act_data->type) {case RTE_FLOW_ACTION_TYPE_INDIRECT_LIST : - act_data->indirect_list.cb (dev, act_data, actions, rule_acts); + act_data->indirect_list_cb (dev, act_data, actions, + &rule_acts[act_data->action_dst]);break ;case RTE_FLOW_ACTION_TYPE_INDIRECT : if (flow_hw_shared_action_construct
Signature · 1 line
2.39.2
v4 cover net/mlx5: support indirect actions list
In reply to Gregory EtelsonAdd MLX5 PMD support for indirect actions list.
Erez Shitrit (1):
net/mlx5/hws: allow destination into default miss FT
Gregory Etelson (4):
net/mlx5: reformat HWS code for HWS mirror action net/mlx5: support HWS mirror action net/mlx5: reformat HWS code for indirect list actions net/mlx5: support indirect list METER_MARK action
Haifei Luo (1):
net/mlx5/hws: support reformat for hws mirror
Hamdan Igbaria (3):
net/mlx5/hws: add support for reformat DevX object net/mlx5/hws: support creating of dynamic forward table and FTE net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
Shun Hao (1):
net/mlx5/hws: add support for mirroring
drivers/common/mlx5/mlx5_prm.h | 81 +- drivers/net/mlx5/hws/mlx5dr.h | 34 + drivers/net/mlx5/hws/mlx5dr_action.c | 210 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 8 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 143 ++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 49 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_internal.h | 5 + drivers/net/mlx5/hws/mlx5dr_send.c | 5 - drivers/net/mlx5/hws/mlx5dr_table.c | 8 +- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 199 ++++ drivers/net/mlx5/mlx5_flow.h | 111 ++- drivers/net/mlx5/mlx5_flow_hw.c | 1218 +++++++++++++++++++++--- 15 files changed, 1907 insertions(+), 168 deletions(-)
--
v3: Add ACK to patches in the series.
v4: Squash reformat patches.
--
2.39.2
PATCH v4 1/10 net/mlx5/hws: add support for reformat DevX object
From: Hamdan Igbaria <[email protected]>
Add support for creation of packet reformat object, via the ALLOC_PACKET_REFORMAT_CONTEXT command.
--- drivers/common/mlx5/mlx5_prm.h | 39 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 60 ++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 +++++ drivers/net/mlx5/hws/mlx5dr_internal.h | 5 +++ drivers/net/mlx5/hws/mlx5dr_send.c | 5 --- 5 files changed, 115 insertions(+), 5 deletions(-)
drivers/common/mlx5/mlx5_prm.h +39 -0
@@ -1218,6 +1218,8 @@ enum {MLX5_CMD_OP_CREATE_FLOW_GROUP =0x933 ,MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY =0x936 ,MLX5_CMD_OP_MODIFY_FLOW_TABLE =0x93c , +MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT =0x93d , +MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT =0x93e ,MLX5_CMD_OP_ALLOC_FLOW_COUNTER =0x939 ,MLX5_CMD_OP_QUERY_FLOW_COUNTER =0x93b , MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00,
@@ -5191,6 +5193,43 @@ struct mlx5_ifc_modify_flow_table_out_bits {u8 reserved_at_40[0x60 ]; }; +struct mlx5_ifc_packet_reformat_context_in_bits { +u8 reformat_type[0x8 ]; +u8 reserved_at_8[0x4 ]; +u8 reformat_param_0[0x4 ]; +u8 reserved_at_16[0x6 ]; +u8 reformat_data_size[0xa ]; + +u8 reformat_param_1[0x8 ]; +u8 reserved_at_40[0x8 ]; +u8 reformat_data[6 ][0x8 ]; + +u8 more_reformat_data[][0x8 ]; +}; + +struct mlx5_ifc_alloc_packet_reformat_context_in_bits { +u8 opcode[0x10 ]; +u8 uid[0x10 ]; + +u8 reserved_at_20[0x10 ]; +u8 op_mod[0x10 ]; + +u8 reserved_at_40[0xa0 ]; + +u8 packet_reformat_context[]; +}; + +struct mlx5_ifc_alloc_packet_reformat_out_bits { +u8 status[0x8 ]; +u8 reserved_at_8[0x18 ]; + +u8 syndrome[0x20 ]; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; +/* CQE format mask. */ #define MLX5E_CQE_FORMAT_MASK 0xc
drivers/net/mlx5/hws/mlx5dr_cmd.c +60 -0
66 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +11 -0
@@ -155,6 +155,13 @@ struct mlx5dr_cmd_allow_other_vhca_access_attr {uint8_t access_key[ACCESS_KEY_LEN ]; }; +struct mlx5dr_cmd_packet_reformat_create_attr { +uint8_t type; +size_t data_sz; +void *data; +uint8_t reformat_param_0; +}; +struct mlx5dr_cmd_query_ft_caps {uint8_t max_level;uint8_t reparse;
@@ -285,6 +292,10 @@ mlx5dr_cmd_forward_tbl_create(struct ibv_context *ctx,void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj * +mlx5dr_cmd_packet_reformat_create (struct ibv_context *ctx, +struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
drivers/net/mlx5/hws/mlx5dr_internal.h +5 -0
@@ -91,4 +91,9 @@ static inline uint64_t roundup_pow_of_two(uint64_t n) return n == 1 ? 1 : 1ULL << log2above(n); } +static inline unsigned long align (unsigned long val,unsigned long align) +{ +return (val + align -1 ) & ~(align -1 ); +} +#endif /* MLX5DR_INTERNAL_H_ */
drivers/net/mlx5/hws/mlx5dr_send.c +0 -5
@@ -668,11 +668,6 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,return err; } -static inline unsigned long align (unsigned long val,unsigned long align) -{ -return (val + align -1 ) & ~(align -1 ); -} - static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx, struct mlx5dr_send_engine *queue, struct mlx5dr_send_ring_sq *sq,
Signature · 1 line
2.39.2
PATCH v4 2/10 net/mlx5/hws: support creating of dynamic forward table and FTE
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add the ability to create forward table and FTE.
--- drivers/common/mlx5/mlx5_prm.h | 4 ++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 13 +++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+)
drivers/common/mlx5/mlx5_prm.h +4 -0
@@ -5048,7 +5048,11 @@ enum mlx5_flow_destination_type { };enum mlx5_flow_context_action { +MLX5_FLOW_CONTEXT_ACTION_DROP =1 <<1 ,MLX5_FLOW_CONTEXT_ACTION_FWD_DEST =1 <<2 , +MLX5_FLOW_CONTEXT_ACTION_REFORMAT =1 <<4 , +MLX5_FLOW_CONTEXT_ACTION_DECRYPT =1 <<12 , +MLX5_FLOW_CONTEXT_ACTION_ENCRYPT =1 <<13 , };enum mlx5_flow_context_flow_source {
drivers/net/mlx5/hws/mlx5dr_cmd.c +13 -0
@@ -42,6 +42,7 @@ mlx5dr_cmd_flow_table_create(struct ibv_context *ctx, ft_ctx =MLX5_ADDR_OF (create_flow_table_in, in, flow_table_context);MLX5_SET (flow_table_context, ft_ctx, level, ft_attr->level);MLX5_SET (flow_table_context, ft_ctx, rtc_valid, ft_attr->rtc_valid); +MLX5_SET (flow_table_context, ft_ctx, reformat_en, ft_attr->reformat_en); devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));if (!devx_obj->obj) {
@@ -182,12 +183,24 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, action_flags = fte_attr->action_flags;MLX5_SET (flow_context, in_flow_context, action, action_flags); +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_REFORMAT ) +MLX5_SET (flow_context, in_flow_context, + packet_reformat_id, fte_attr->packet_reformat_id); + +if (action_flags & (MLX5_FLOW_CONTEXT_ACTION_DECRYPT |MLX5_FLOW_CONTEXT_ACTION_ENCRYPT )) { +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_type, fte_attr->encrypt_decrypt_type); +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_obj_id, fte_attr->encrypt_decrypt_obj_id); + } +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ) {/* Only destination_list_size of size 1 is supported */ MLX5_SET (flow_context, in_flow_context, destination_list_size,1 ); in_dests =MLX5_ADDR_OF (flow_context, in_flow_context, destination);MLX5_SET (dest_format, in_dests, destination_type, fte_attr->destination_type);MLX5_SET (dest_format, in_dests, destination_id, fte_attr->destination_id); +MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); } devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));
drivers/net/mlx5/hws/mlx5dr_cmd.h +19 -0
@@ -7,8 +7,12 @@struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t encrypt_decrypt_type; +uint32_t encrypt_decrypt_obj_id; +uint32_t packet_reformat_id;uint8_t destination_type;uint32_t destination_id; +uint8_t ignore_flow_level;uint8_t flow_source; };
@@ -16,6 +20,7 @@ struct mlx5dr_cmd_ft_create_attr {uint8_t type;uint8_t level;bool rtc_valid; +uint8_t reformat_en; };#define ACCESS_KEY_LEN 32
@@ -296,6 +301,20 @@ struct mlx5dr_devx_obj * mlx5dr_cmd_packet_reformat_create(struct ibv_context *ctx, struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj * +mlx5dr_cmd_set_fte (struct ibv_context *ctx, +uint32_t table_type, +uint32_t table_id, +uint32_t group_id, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +struct mlx5dr_cmd_forward_tbl * +mlx5dr_cmd_forward_tbl_create (struct ibv_context *ctx, +struct mlx5dr_cmd_ft_create_attr *ft_attr, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
Signature · 1 line
2.39.2
PATCH v4 3/10 net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add mlx5dr_devx_obj struct to mlx5dr_action, so we could hold the FT obj in dest table action.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 4 ++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +++ drivers/net/mlx5/hws/mlx5dr_table.c | 1 - 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +4 -0
@@ -787,6 +787,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, tbl->ft);if (ret) goto free_action; + + action->devx_dest.devx_obj = tbl->ft; }return action;
@@ -864,6 +866,8 @@ mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, cur_obj);if (ret) goto clean_obj; + + action->devx_dest.devx_obj = cur_obj; }return action;
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -148,6 +148,9 @@ struct mlx5dr_action {struct {struct mlx5dv_steering_anchor *sa; } root_tbl; +struct { +struct mlx5dr_devx_obj *devx_obj; + } devx_dest; }; };
drivers/net/mlx5/hws/mlx5dr_table.c +0 -1
@@ -68,7 +68,6 @@ static void mlx5dr_table_down_default_fdb_miss_tbl(struct mlx5dr_table *tbl)return ;mlx5dr_cmd_forward_tbl_destroy (default_miss); - ctx->common_res[tbl_type].default_miss =NULL ; }
Signature · 1 line
2.39.2
PATCH v4 4/10 net/mlx5/hws: add support for mirroring
In reply to Gregory EtelsonFrom: Shun Hao <[email protected]>
This patch supports mirroring by adding an dest_array action. The action accecpts a list containing multiple destination actions, and can duplicate packet and forward to each destination in the list.
--- drivers/common/mlx5/mlx5_prm.h | 23 ++++- drivers/net/mlx5/hws/mlx5dr.h | 34 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 130 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 64 ++++++++++--- drivers/net/mlx5/hws/mlx5dr_cmd.h | 21 ++++- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_table.c | 7 +- 8 files changed, 262 insertions(+), 21 deletions(-)
drivers/common/mlx5/mlx5_prm.h +20 -3
@@ -2320,7 +2320,11 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { };struct mlx5_ifc_esw_cap_bits { -u8 reserved_at_0[0x60 ]; +u8 reserved_at_0[0x1d ]; +u8 merged_eswitch[0x1 ]; +u8 reserved_at_1e[0x2 ]; + +u8 reserved_at_20[0x40 ];u8 esw_manager_vport_number_valid[0x1 ];u8 reserved_at_61[0xf ];
@@ -5045,6 +5049,7 @@ struct mlx5_ifc_query_flow_table_out_bits {enum mlx5_flow_destination_type {MLX5_FLOW_DESTINATION_TYPE_VPORT =0x0 ,MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE =0x1 , +MLX5_FLOW_DESTINATION_TYPE_TIR =0x2 , };enum mlx5_flow_context_action {
@@ -5088,6 +5093,19 @@ union mlx5_ifc_dest_format_flow_counter_list_auto_bits {u8 reserved_at_0[0x40 ]; }; +struct mlx5_ifc_extended_dest_format_bits { +struct mlx5_ifc_dest_format_bits destination_entry; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; + +#define MLX5_IFC_MULTI_PATH_FT_MAX_LEVEL 64 + +#ifdef PEDANTIC +#pragma GCC diagnostic ignored "-Wpedantic" +#endif struct mlx5_ifc_flow_context_bits {u8 reserved_at_00[0x20 ];u8 group_id[0x20 ];
@@ -5106,8 +5124,7 @@ struct mlx5_ifc_flow_context_bits {u8 reserved_at_e0[0x40 ];u8 encrypt_decrypt_obj_id[0x20 ];u8 reserved_at_140[0x16c0 ]; -/* Currently only one destnation */ -union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[1 ]; +union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0 ]; };struct mlx5_ifc_set_fte_in_bits {
drivers/net/mlx5/hws/mlx5dr.h +34 -0
@@ -46,6 +46,7 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_ASO_METER ,MLX5DR_ACTION_TYP_ASO_CT ,MLX5DR_ACTION_TYP_DEST_ROOT , +MLX5DR_ACTION_TYP_DEST_ARRAY , MLX5DR_ACTION_TYP_MAX, };
@@ -213,6 +214,20 @@ struct mlx5dr_rule_action { }; }; +struct mlx5dr_action_dest_attr { +/* Required action combination */ +enum mlx5dr_action_type *action_type; + +/* Required destination action to forward the packet */ +struct mlx5dr_action *dest; + +/* Optional reformat data */ +struct { +size_t reformat_data_sz; +void *reformat_data; + } reformat; +}; +/* Open a context used for direct rule insertion using hardware steering. * Each context can contain multiple tables of different types. *
@@ -616,6 +631,25 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags);struct mlx5dr_action *mlx5dr_action_create_push_vlan (struct mlx5dr_context *ctx,uint32_t flags); +/* Create a dest array action, this action can duplicate packets and forward to +* multiple destinations in the destination list. +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] num_dest +* The number of dests attributes. +* @param[in] dests +* The destination array. Each contains a destination action and can have +* additional actions. +* @param[in] flags +* Action creation flags. (enum mlx5dr_action_flags) +* @return pointer to mlx5dr_action on success NULL otherwise. +*/ +struct mlx5dr_action * +mlx5dr_action_create_dest_array (struct mlx5dr_context *ctx, +size_t num_dest, +struct mlx5dr_action_dest_attr *dests, +uint32_t flags); +/* Create dest root table, this action will jump to root table according * the given priority. * @param[in] ctx
drivers/net/mlx5/hws/mlx5dr_action.c +128 -2
166 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -151,6 +151,9 @@ struct mlx5dr_action {struct {struct mlx5dr_devx_obj *devx_obj; } devx_dest; +struct { +struct mlx5dr_cmd_forward_tbl *fw_island; + } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +54 -10
109 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +17 -4
@@ -5,15 +5,27 @@#ifndef MLX5DR_CMD_H_ #define MLX5DR_CMD_H_ +enum mlx5dr_cmd_ext_dest_flags { +MLX5DR_CMD_EXT_DEST_REFORMAT =1 <<0 , +MLX5DR_CMD_EXT_DEST_ESW_OWNER_VHCA_ID =1 <<1 , +}; + +struct mlx5dr_cmd_set_fte_dest { +uint8_t destination_type; +uint32_t destination_id; +enum mlx5dr_cmd_ext_dest_flags ext_flags; +uint16_t esw_owner_vhca_id; +}; +struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t ignore_flow_level; +uint8_t flow_source;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id; -uint8_t destination_type; -uint32_t destination_id; -uint8_t ignore_flow_level; -uint8_t flow_source; +uint32_t dests_num; +struct mlx5dr_cmd_set_fte_dest *dests; }; struct mlx5dr_cmd_ft_create_attr {
@@ -216,6 +228,7 @@ struct mlx5dr_cmd_query_caps {struct mlx5dr_cmd_query_ft_caps nic_ft;struct mlx5dr_cmd_query_ft_caps fdb_ft;bool eswitch_manager; +uint8_t merged_eswitch;uint32_t eswitch_manager_vport_number;uint8_t log_header_modify_argument_granularity;uint8_t log_header_modify_argument_max_alloc;
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
@@ -23,6 +23,7 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_ASO_METER] = "ASO_METER", [MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT", [MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT", + [MLX5DR_ACTION_TYP_DEST_ARRAY ] ="DEST_ARRAY" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/hws/mlx5dr_table.c +5 -2
@@ -22,6 +22,7 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)struct mlx5dr_cmd_ft_create_attr ft_attr = {0 };struct mlx5dr_cmd_set_fte_attr fte_attr = {0 };struct mlx5dr_cmd_forward_tbl *default_miss; +struct mlx5dr_cmd_set_fte_dest dest = {0 };struct mlx5dr_context *ctx = tbl->ctx;uint8_t tbl_type = tbl->type;
@@ -37,9 +38,11 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl) ft_attr.level = tbl->ctx->caps->fdb_ft.max_level;/* The last level */ ft_attr.rtc_valid = false; + dest.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest.destination_id = ctx->caps->eswitch_manager_vport_number; fte_attr.action_flags =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; - fte_attr.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; - fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number; + fte_attr.dests_num =1 ; + fte_attr.dests = &dest; default_miss =mlx5dr_cmd_forward_tbl_create (mlx5dr_context_get_local_ibv (ctx), &ft_attr, &fte_attr);
Signature · 1 line
2.39.2
PATCH v4 5/10 net/mlx5/hws: allow destination into default miss FT
In reply to Gregory EtelsonFrom: Erez Shitrit <[email protected]>
In FDB it will direct the packet into the hypervisor vport. That allows the user to mirror packets into the default-miss vport.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/mlx5/hws/mlx5dr_action.c +11 -0
@@ -1769,6 +1769,17 @@ mlx5dr_action_create_dest_array(struct mlx5dr_context *ctx, fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; fte_attr.ignore_flow_level =1 ;break ; +case MLX5DR_ACTION_TYP_MISS : +if (table_type !=MLX5DR_TABLE_TYPE_FDB ) { +DR_LOG (ERR ,"Miss action supported for FDB only" ); + rte_errno =ENOTSUP ; + goto free_dest_list; + } + dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest_list[i].destination_id = + ctx->caps->eswitch_manager_vport_number; + fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; +break ;case MLX5DR_ACTION_TYP_VPORT : dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; dest_list[i].destination_id = dests[i].dest->vport.vport_num;
Signature · 1 line
2.39.2
PATCH v4 6/10 net/mlx5/hws: support reformat for hws mirror
In reply to Gregory EtelsonFrom: Haifei Luo <[email protected]>
In dest_array action, an optional reformat action can be applied to each destination. This patch supports this by using the extended destination entry.
--- drivers/common/mlx5/mlx5_prm.h | 15 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 67 +++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 2 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 10 ++++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 2 + 5 files changed, 94 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_prm.h +15 -0
@@ -5352,6 +5352,21 @@ enum mlx5_parse_graph_arc_node_index { MLX5_GRAPH_ARC_NODE_PROGRAMMABLE = 0x1f, }; +enum mlx5_packet_reformat_context_reformat_type { +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L2_TUNNEL =0x2 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_TUNNEL =0x4 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4 =0x5 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_ESP_TUNNEL =0x6 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV4 =0x7 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT =0x8 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L3_ESP_TUNNEL_TO_L2 =0x9 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT_OVER_UDP =0xA , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6 =0xB , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV6 =0xC , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_NISP_TNL =0xD , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_REMOVE_NISP_TNL =0xE , +}; +#define MLX5_PARSE_GRAPH_FLOW_SAMPLE_MAX 8#define MLX5_PARSE_GRAPH_IN_ARC_MAX 8#define MLX5_PARSE_GRAPH_OUT_ARC_MAX 8
drivers/net/mlx5/hws/mlx5dr_action.c +66 -1
104 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +2 -0
@@ -153,6 +153,8 @@ struct mlx5dr_action { } devx_dest;struct {struct mlx5dr_cmd_forward_tbl *fw_island; +size_t num_dest; +struct mlx5dr_cmd_set_fte_dest *dest_list; } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +9 -1
@@ -169,7 +169,9 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx,uint32_t *in;uint32_t i; - dest_entry_sz =MLX5_ST_SZ_BYTES (dest_format); + dest_entry_sz = fte_attr->extended_dest ? +MLX5_ST_SZ_BYTES (extended_dest_format) : +MLX5_ST_SZ_BYTES (dest_format); total_dest_sz = dest_entry_sz * fte_attr->dests_num; inlen =align ((MLX5_ST_SZ_BYTES (set_fte_in) + total_dest_sz),DW_SIZE ); in =simple_calloc (1 , inlen);
@@ -192,6 +194,7 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, in_flow_context =MLX5_ADDR_OF (set_fte_in, in, flow_context);MLX5_SET (flow_context, in_flow_context, group_id, group_id);MLX5_SET (flow_context, in_flow_context, flow_source, fte_attr->flow_source); +MLX5_SET (flow_context, in_flow_context, extended_destination, fte_attr->extended_dest);MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); action_flags = fte_attr->action_flags;
@@ -230,6 +233,11 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, dest->destination_type);MLX5_SET (dest_format, in_dests, destination_id, dest->destination_id); +if (dest->ext_flags &MLX5DR_CMD_EXT_DEST_REFORMAT ) { +MLX5_SET (dest_format, in_dests, packet_reformat,1 ); +MLX5_SET (extended_dest_format, in_dests, packet_reformat_id, + dest->ext_reformat->id); + }break ;default : rte_errno =EOPNOTSUPP ;
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
@@ -14,6 +14,7 @@ struct mlx5dr_cmd_set_fte_dest {uint8_t destination_type;uint32_t destination_id;enum mlx5dr_cmd_ext_dest_flags ext_flags; +struct mlx5dr_devx_obj *ext_reformat;uint16_t esw_owner_vhca_id; };
@@ -21,6 +22,7 @@ struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags;uint8_t ignore_flow_level;uint8_t flow_source; +uint8_t extended_dest;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id;
Signature · 1 line
2.39.2
PATCH v4 7/10 net/mlx5: reformat HWS code for HWS mirror action
In reply to Gregory Etelson--- drivers/net/mlx5/mlx5_flow_hw.c | 70 ++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 31 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +39 -31
@@ -4548,6 +4548,17 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT, }; +static inline void +action_template_set_type (struct rte_flow_actions_template *at, +enum mlx5dr_action_type *action_types, +unsigned int action_src,uint16_t *curr_off, +enum mlx5dr_action_type type) +{ + at->actions_off[action_src] = *curr_off; + action_types[*curr_off] = type; + *curr_off = *curr_off +1 ; +} + static int flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, unsigned int action_src,
@@ -4565,9 +4576,8 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, type = mask->type;switch (type) {case RTE_FLOW_ACTION_TYPE_RSS : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_TIR ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_TIR );break ;case RTE_FLOW_ACTION_TYPE_AGE :case RTE_FLOW_ACTION_TYPE_COUNT :
@@ -4575,23 +4585,20 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,* Both AGE and COUNT action need counter, the first one fills * the action_types array, and the second only saves the offset. */ -if (*cnt_off ==UINT16_MAX ) { - *cnt_off = *curr_off; - action_types[*cnt_off] =MLX5DR_ACTION_TYP_CTR ; - *curr_off = *curr_off +1 ; - } +if (*cnt_off ==UINT16_MAX ) +action_template_set_type (at, action_types, + action_src, curr_off, +MLX5DR_ACTION_TYP_CTR ); at->actions_off[action_src] = *cnt_off;break ;case RTE_FLOW_ACTION_TYPE_CONNTRACK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_CT ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_CT );break ;case RTE_FLOW_ACTION_TYPE_QUOTA :case RTE_FLOW_ACTION_TYPE_METER_MARK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_METER ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_METER );break ;default :DRV_LOG (WARNING ,"Unsupported shared action type: %d" , type);
@@ -5101,31 +5108,32 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, at->reformat_off =UINT16_MAX ; at->mhdr_off =UINT16_MAX ; at->rx_cpy_pos = pos; -/* -* mlx5 PMD hacks indirect action index directly to the action conf. -* The rte_flow_conv() function copies the content from conf pointer. -* Need to restore the indirect action index from action conf here. -*/ for (i =0 ; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++, masks++, i++) { -if (actions->type ==RTE_FLOW_ACTION_TYPE_INDIRECT ) { +const struct rte_flow_action_modify_field *info; + +switch (actions->type) { +/* +* mlx5 PMD hacks indirect action index directly to the action conf. +* The rte_flow_conv() function copies the content from conf pointer. +* Need to restore the indirect action index from action conf here. +*/ +case RTE_FLOW_ACTION_TYPE_INDIRECT : at->actions[i].conf = actions->conf; at->masks[i].conf = masks->conf; - } -if (actions->type ==RTE_FLOW_ACTION_TYPE_MODIFY_FIELD ) { -const struct rte_flow_action_modify_field *info = actions->conf; - +break ; +case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD : + info = actions->conf;if ((info->dst.field ==RTE_FLOW_FIELD_FLEX_ITEM &&flow_hw_flex_item_acquire (dev, info->dst.flex_handle, &at->flex_item)) || - (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && -flow_hw_flex_item_acquire (dev, info->src.flex_handle, - &at->flex_item))) { -rte_flow_error_set (error, rte_errno, -RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , -"Failed to acquire flex item" ); + (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && +flow_hw_flex_item_acquire (dev, info->src.flex_handle, + &at->flex_item))) goto error; - } +break ; +default : +break ; } } at->tmpl =flow_hw_dr_actions_template_create (at);
Signature · 1 line
2.39.2
PATCH v4 8/10 net/mlx5: support HWS mirror action
In reply to Gregory EtelsonHWS mirror clones original packet to one or two destinations and proceeds with the original packet path.
The mirror has no dedicated RTE flow action type. Mirror object is referenced by INDIRECT_LIST action. INDIRECT_LIST for a mirror built from actions list:
SAMPLE [/ SAMPLE] / <Orig. packet destination> / END
Mirror SAMPLE action defines packet clone. It specifies the clone destination and optional clone reformat action. Destination action for both clone and original packet depends on HCA domain:
- for NIC RX, destination is ether RSS or QUEUE
- for FDB, destination is PORT
HWS mirror was inplemented with the INDIRECT_LIST flow action.
MLX5 PMD defines general struct mlx5_indirect_list type for all. INDIRECT_LIST handler objects:
struct mlx5_indirect_list {
enum mlx5_indirect_list_type type;
LIST_ENTRY(mlx5_indirect_list) chain;
char data[];
};Specific INDIRECT_LIST type must overload mlx5_indirect_list::data and provide unique type value.
PMD returns a pointer to mlx5_indirect_list object.
Existing non-masked actions template API cannot identify flow actions in INDIRECT_LIST handler because INDIRECT_LIST handler can represent several flow actions.
For example:
A: SAMPLE / JUMP
B: SAMPE / SAMPLE / RSS
Actions template command
template indirect_list / end mask indirect_list 0 / end
does not provide any information to differentiate between flow actions in A and B.
MLX5 PMD requires INDIRECT_LIST configuration parameter in the template section:
Non-masked INDIRECT_LIST API:
=============================
template indirect_list X / end mask indirect_list 0 / end
PMD identifies type of X handler and will use the same type in template creation. Actual parameters for actions in the list will be extracted from flow configuration
Masked INDIRECT_LIST API:
=========================
template indirect_list X / end mask indirect_list -lUL / end
PMD creates action template from actions types and configurations referenced by X.
INDIRECT_LIST action without configuration is invalid and will be rejected by PMD.
--- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 134 +++++++ drivers/net/mlx5/mlx5_flow.h | 69 +++- drivers/net/mlx5/mlx5_flow_hw.c | 616 +++++++++++++++++++++++++++++++- 5 files changed, 817 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5.c +1 -0
@@ -2168,6 +2168,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)/* Free the eCPRI flex parser resource. */ mlx5_flex_parser_ecpri_release (dev);mlx5_flex_item_port_cleanup (dev); +mlx5_indirect_list_handles_release (dev);#ifdef HAVE_MLX5_HWS_SUPPORT flow_hw_destroy_vport_action (dev);flow_hw_resource_release (dev);
drivers/net/mlx5/mlx5.h +2 -0
@@ -1791,6 +1791,8 @@ struct mlx5_priv { LIST_HEAD(ind_tables, mlx5_ind_table_obj) ind_tbls;/* Standalone indirect tables. */ LIST_HEAD(stdl_ind_tables, mlx5_ind_table_obj) standalone_ind_tbls; +/* Objects created with indirect list action */ + LIST_HEAD(indirect_list, mlx5_indirect_list) indirect_list_head;/* Pointer to next element. */ rte_rwlock_t ind_tbls_lock;uint32_t refcnt;/**< Reference counter. */
drivers/net/mlx5/mlx5_flow.c +134 -0
164 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +68 -1
121 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +612 -4
694 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v4 9/10 net/mlx5: reformat HWS code for indirect list actions
In reply to Gregory Etelson--- drivers/net/mlx5/mlx5_flow.h | 4 +- drivers/net/mlx5/mlx5_flow_hw.c | 252 +++++++++++++++++--------------- 2 files changed, 140 insertions(+), 116 deletions(-)
drivers/net/mlx5/mlx5_flow.h +2 -2
@@ -1331,11 +1331,11 @@ struct rte_flow_actions_template {uint64_t action_flags;/* Bit-map of all valid action in template. */ uint16_t dr_actions_num;/* Amount of DR rules actions. */ uint16_t actions_num;/* Amount of flow actions */ -uint16_t *actions_off;/* DR action offset for given rte action offset. */ +uint16_t *dr_off;/* DR action offset for given rte action offset. */ +uint16_t *src_off;/* RTE action displacement from app. template */ uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint32_t refcnt;/* Reference counter. */ -uint16_t rx_cpy_pos;/* Action position of Rx metadata to be copied. */ uint8_t flex_item;/* flex item index. */ };
drivers/net/mlx5/mlx5_flow_hw.c +138 -114
665 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v4 10/10 net/mlx5: support indirect list METER_MARK action
In reply to Gregory Etelson--- drivers/net/mlx5/mlx5_flow.c | 69 ++++- drivers/net/mlx5/mlx5_flow.h | 70 ++++-- drivers/net/mlx5/mlx5_flow_hw.c | 430 +++++++++++++++++++++++++++----- 3 files changed, 484 insertions(+), 85 deletions(-)
drivers/net/mlx5/mlx5_flow.c +67 -2
@@ -75,8 +75,11 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)switch (e->type) {#ifdef HAVE_MLX5_HWS_SUPPORT case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR : -mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e, true); +mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e);break ; +case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY : +mlx5_destroy_legacy_indirect (dev, e); +break ;#endif default :DRV_LOG (ERR ,"invalid indirect list type" );
@@ -1169,7 +1172,24 @@ mlx5_flow_async_action_list_handle_destroyconst struct rte_flow_op_attr *op_attr, struct rte_flow_action_list_handle *action_handle, void *user_data, struct rte_flow_error *error); - +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error); +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const struct rte_flow_op_attr *attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error);static const struct rte_flow_ops mlx5_flow_ops = { .validate = mlx5_flow_validate, .create = mlx5_flow_create,
@@ -1219,6 +1239,10 @@ static const struct rte_flow_ops mlx5_flow_ops = { mlx5_flow_async_action_list_handle_create, .async_action_list_handle_destroy = mlx5_flow_async_action_list_handle_destroy, + .action_list_handle_query_update = + mlx5_flow_action_list_handle_query_update, + .async_action_list_handle_query_update = + mlx5_flow_async_action_list_handle_query_update, };/* Tunnel information. */
@@ -11003,6 +11027,47 @@ mlx5_flow_async_action_list_handle_destroy error); } +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + action_list_handle_query_update,ENOTSUP ); +return fops->action_list_handle_query_update (dev, handle, update, query, + mode, error); +} + +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const +struct rte_flow_op_attr *op_attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum +rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + async_action_list_handle_query_update,ENOTSUP ); +return fops->async_action_list_handle_query_update (dev, queue_id, op_attr, + handle, update, + query, mode, + user_data, error); +} + +/** * Destroy all indirect actions (shared RSS). *
drivers/net/mlx5/mlx5_flow.h +54 -16
123 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +363 -67
606 lines not on this page · raw message
Signature · 1 line
2.39.2
v5 cover net/mlx5: support indirect actions list
In reply to Gregory EtelsonAdd MLX5 PMD support for indirect actions list.
Erez Shitrit (1):
net/mlx5/hws: allow destination into default miss FT
Gregory Etelson (4):
net/mlx5: reformat HWS code for HWS mirror action net/mlx5: support HWS mirror action net/mlx5: reformat HWS code for indirect list actions net/mlx5: support indirect list METER_MARK action
Haifei Luo (1):
net/mlx5/hws: support reformat for hws mirror
Hamdan Igbaria (3):
net/mlx5/hws: add support for reformat DevX object net/mlx5/hws: support creating of dynamic forward table and FTE net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
Shun Hao (1):
net/mlx5/hws: add support for mirroring
doc/guides/nics/features/mlx5.ini | 1 + doc/guides/rel_notes/release_23_11.rst | 1 + drivers/common/mlx5/mlx5_prm.h | 81 +- drivers/net/mlx5/hws/mlx5dr.h | 34 + drivers/net/mlx5/hws/mlx5dr_action.c | 210 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 8 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 143 ++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 49 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_internal.h | 5 + drivers/net/mlx5/hws/mlx5dr_send.c | 5 - drivers/net/mlx5/hws/mlx5dr_table.c | 8 +- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 199 ++++ drivers/net/mlx5/mlx5_flow.h | 111 ++- drivers/net/mlx5/mlx5_flow_hw.c | 1217 +++++++++++++++++++++--- 17 files changed, 1908 insertions(+), 168 deletions(-)
Signature · 6 lines
v3: Add ACK to patches in the series.
v4: Squash reformat patches.
v5: Update release notes.
Fix code style.
--
2.39.2PATCH v5 1/10 net/mlx5/hws: add support for reformat DevX object
From: Hamdan Igbaria <[email protected]>
Add support for creation of packet reformat object, via the ALLOC_PACKET_REFORMAT_CONTEXT command.
--- drivers/common/mlx5/mlx5_prm.h | 39 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 60 ++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 +++++ drivers/net/mlx5/hws/mlx5dr_internal.h | 5 +++ drivers/net/mlx5/hws/mlx5dr_send.c | 5 --- 5 files changed, 115 insertions(+), 5 deletions(-)
drivers/common/mlx5/mlx5_prm.h +39 -0
@@ -1218,6 +1218,8 @@ enum {MLX5_CMD_OP_CREATE_FLOW_GROUP =0x933 ,MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY =0x936 ,MLX5_CMD_OP_MODIFY_FLOW_TABLE =0x93c , +MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT =0x93d , +MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT =0x93e ,MLX5_CMD_OP_ALLOC_FLOW_COUNTER =0x939 ,MLX5_CMD_OP_QUERY_FLOW_COUNTER =0x93b , MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00,
@@ -5191,6 +5193,43 @@ struct mlx5_ifc_modify_flow_table_out_bits {u8 reserved_at_40[0x60 ]; }; +struct mlx5_ifc_packet_reformat_context_in_bits { +u8 reformat_type[0x8 ]; +u8 reserved_at_8[0x4 ]; +u8 reformat_param_0[0x4 ]; +u8 reserved_at_16[0x6 ]; +u8 reformat_data_size[0xa ]; + +u8 reformat_param_1[0x8 ]; +u8 reserved_at_40[0x8 ]; +u8 reformat_data[6 ][0x8 ]; + +u8 more_reformat_data[][0x8 ]; +}; + +struct mlx5_ifc_alloc_packet_reformat_context_in_bits { +u8 opcode[0x10 ]; +u8 uid[0x10 ]; + +u8 reserved_at_20[0x10 ]; +u8 op_mod[0x10 ]; + +u8 reserved_at_40[0xa0 ]; + +u8 packet_reformat_context[]; +}; + +struct mlx5_ifc_alloc_packet_reformat_out_bits { +u8 status[0x8 ]; +u8 reserved_at_8[0x18 ]; + +u8 syndrome[0x20 ]; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; +/* CQE format mask. */ #define MLX5E_CQE_FORMAT_MASK 0xc
drivers/net/mlx5/hws/mlx5dr_cmd.c +60 -0
66 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +11 -0
@@ -155,6 +155,13 @@ struct mlx5dr_cmd_allow_other_vhca_access_attr {uint8_t access_key[ACCESS_KEY_LEN ]; }; +struct mlx5dr_cmd_packet_reformat_create_attr { +uint8_t type; +size_t data_sz; +void *data; +uint8_t reformat_param_0; +}; +struct mlx5dr_cmd_query_ft_caps {uint8_t max_level;uint8_t reparse;
@@ -285,6 +292,10 @@ mlx5dr_cmd_forward_tbl_create(struct ibv_context *ctx,void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj * +mlx5dr_cmd_packet_reformat_create (struct ibv_context *ctx, +struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
drivers/net/mlx5/hws/mlx5dr_internal.h +5 -0
@@ -91,4 +91,9 @@ static inline uint64_t roundup_pow_of_two(uint64_t n) return n == 1 ? 1 : 1ULL << log2above(n); } +static inline unsigned long align (unsigned long val,unsigned long align) +{ +return (val + align -1 ) & ~(align -1 ); +} +#endif /* MLX5DR_INTERNAL_H_ */
drivers/net/mlx5/hws/mlx5dr_send.c +0 -5
@@ -668,11 +668,6 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,return err; } -static inline unsigned long align (unsigned long val,unsigned long align) -{ -return (val + align -1 ) & ~(align -1 ); -} - static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx, struct mlx5dr_send_engine *queue, struct mlx5dr_send_ring_sq *sq,
Signature · 1 line
2.39.2
PATCH v5 2/10 net/mlx5/hws: support creating of dynamic forward table and FTE
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add the ability to create forward table and FTE.
--- drivers/common/mlx5/mlx5_prm.h | 4 ++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 13 +++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+)
drivers/common/mlx5/mlx5_prm.h +4 -0
@@ -5048,7 +5048,11 @@ enum mlx5_flow_destination_type { };enum mlx5_flow_context_action { +MLX5_FLOW_CONTEXT_ACTION_DROP =1 <<1 ,MLX5_FLOW_CONTEXT_ACTION_FWD_DEST =1 <<2 , +MLX5_FLOW_CONTEXT_ACTION_REFORMAT =1 <<4 , +MLX5_FLOW_CONTEXT_ACTION_DECRYPT =1 <<12 , +MLX5_FLOW_CONTEXT_ACTION_ENCRYPT =1 <<13 , };enum mlx5_flow_context_flow_source {
drivers/net/mlx5/hws/mlx5dr_cmd.c +13 -0
@@ -42,6 +42,7 @@ mlx5dr_cmd_flow_table_create(struct ibv_context *ctx, ft_ctx =MLX5_ADDR_OF (create_flow_table_in, in, flow_table_context);MLX5_SET (flow_table_context, ft_ctx, level, ft_attr->level);MLX5_SET (flow_table_context, ft_ctx, rtc_valid, ft_attr->rtc_valid); +MLX5_SET (flow_table_context, ft_ctx, reformat_en, ft_attr->reformat_en); devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));if (!devx_obj->obj) {
@@ -182,12 +183,24 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, action_flags = fte_attr->action_flags;MLX5_SET (flow_context, in_flow_context, action, action_flags); +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_REFORMAT ) +MLX5_SET (flow_context, in_flow_context, + packet_reformat_id, fte_attr->packet_reformat_id); + +if (action_flags & (MLX5_FLOW_CONTEXT_ACTION_DECRYPT |MLX5_FLOW_CONTEXT_ACTION_ENCRYPT )) { +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_type, fte_attr->encrypt_decrypt_type); +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_obj_id, fte_attr->encrypt_decrypt_obj_id); + } +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ) {/* Only destination_list_size of size 1 is supported */ MLX5_SET (flow_context, in_flow_context, destination_list_size,1 ); in_dests =MLX5_ADDR_OF (flow_context, in_flow_context, destination);MLX5_SET (dest_format, in_dests, destination_type, fte_attr->destination_type);MLX5_SET (dest_format, in_dests, destination_id, fte_attr->destination_id); +MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); } devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));
drivers/net/mlx5/hws/mlx5dr_cmd.h +19 -0
@@ -7,8 +7,12 @@struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t encrypt_decrypt_type; +uint32_t encrypt_decrypt_obj_id; +uint32_t packet_reformat_id;uint8_t destination_type;uint32_t destination_id; +uint8_t ignore_flow_level;uint8_t flow_source; };
@@ -16,6 +20,7 @@ struct mlx5dr_cmd_ft_create_attr {uint8_t type;uint8_t level;bool rtc_valid; +uint8_t reformat_en; };#define ACCESS_KEY_LEN 32
@@ -296,6 +301,20 @@ struct mlx5dr_devx_obj * mlx5dr_cmd_packet_reformat_create(struct ibv_context *ctx, struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj * +mlx5dr_cmd_set_fte (struct ibv_context *ctx, +uint32_t table_type, +uint32_t table_id, +uint32_t group_id, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +struct mlx5dr_cmd_forward_tbl * +mlx5dr_cmd_forward_tbl_create (struct ibv_context *ctx, +struct mlx5dr_cmd_ft_create_attr *ft_attr, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
Signature · 1 line
2.39.2
PATCH v5 3/10 net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add mlx5dr_devx_obj struct to mlx5dr_action, so we could hold the FT obj in dest table action.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 4 ++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +++ drivers/net/mlx5/hws/mlx5dr_table.c | 1 - 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +4 -0
@@ -787,6 +787,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, tbl->ft);if (ret) goto free_action; + + action->devx_dest.devx_obj = tbl->ft; }return action;
@@ -864,6 +866,8 @@ mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, cur_obj);if (ret) goto clean_obj; + + action->devx_dest.devx_obj = cur_obj; }return action;
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -148,6 +148,9 @@ struct mlx5dr_action {struct {struct mlx5dv_steering_anchor *sa; } root_tbl; +struct { +struct mlx5dr_devx_obj *devx_obj; + } devx_dest; }; };
drivers/net/mlx5/hws/mlx5dr_table.c +0 -1
@@ -68,7 +68,6 @@ static void mlx5dr_table_down_default_fdb_miss_tbl(struct mlx5dr_table *tbl)return ;mlx5dr_cmd_forward_tbl_destroy (default_miss); - ctx->common_res[tbl_type].default_miss =NULL ; }
Signature · 1 line
2.39.2
PATCH v5 4/10 net/mlx5/hws: add support for mirroring
In reply to Gregory EtelsonFrom: Shun Hao <[email protected]>
This patch supports mirroring by adding an dest_array action. The action accecpts a list containing multiple destination actions, and can duplicate packet and forward to each destination in the list.
--- drivers/common/mlx5/mlx5_prm.h | 23 ++++- drivers/net/mlx5/hws/mlx5dr.h | 34 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 130 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 64 ++++++++++--- drivers/net/mlx5/hws/mlx5dr_cmd.h | 21 ++++- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_table.c | 7 +- 8 files changed, 262 insertions(+), 21 deletions(-)
drivers/common/mlx5/mlx5_prm.h +20 -3
@@ -2320,7 +2320,11 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { };struct mlx5_ifc_esw_cap_bits { -u8 reserved_at_0[0x60 ]; +u8 reserved_at_0[0x1d ]; +u8 merged_eswitch[0x1 ]; +u8 reserved_at_1e[0x2 ]; + +u8 reserved_at_20[0x40 ];u8 esw_manager_vport_number_valid[0x1 ];u8 reserved_at_61[0xf ];
@@ -5045,6 +5049,7 @@ struct mlx5_ifc_query_flow_table_out_bits {enum mlx5_flow_destination_type {MLX5_FLOW_DESTINATION_TYPE_VPORT =0x0 ,MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE =0x1 , +MLX5_FLOW_DESTINATION_TYPE_TIR =0x2 , };enum mlx5_flow_context_action {
@@ -5088,6 +5093,19 @@ union mlx5_ifc_dest_format_flow_counter_list_auto_bits {u8 reserved_at_0[0x40 ]; }; +struct mlx5_ifc_extended_dest_format_bits { +struct mlx5_ifc_dest_format_bits destination_entry; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; + +#define MLX5_IFC_MULTI_PATH_FT_MAX_LEVEL 64 + +#ifdef PEDANTIC +#pragma GCC diagnostic ignored "-Wpedantic" +#endif struct mlx5_ifc_flow_context_bits {u8 reserved_at_00[0x20 ];u8 group_id[0x20 ];
@@ -5106,8 +5124,7 @@ struct mlx5_ifc_flow_context_bits {u8 reserved_at_e0[0x40 ];u8 encrypt_decrypt_obj_id[0x20 ];u8 reserved_at_140[0x16c0 ]; -/* Currently only one destnation */ -union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[1 ]; +union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0 ]; };struct mlx5_ifc_set_fte_in_bits {
drivers/net/mlx5/hws/mlx5dr.h +34 -0
@@ -46,6 +46,7 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_ASO_METER ,MLX5DR_ACTION_TYP_ASO_CT ,MLX5DR_ACTION_TYP_DEST_ROOT , +MLX5DR_ACTION_TYP_DEST_ARRAY , MLX5DR_ACTION_TYP_MAX, };
@@ -213,6 +214,20 @@ struct mlx5dr_rule_action { }; }; +struct mlx5dr_action_dest_attr { +/* Required action combination */ +enum mlx5dr_action_type *action_type; + +/* Required destination action to forward the packet */ +struct mlx5dr_action *dest; + +/* Optional reformat data */ +struct { +size_t reformat_data_sz; +void *reformat_data; + } reformat; +}; +/* Open a context used for direct rule insertion using hardware steering. * Each context can contain multiple tables of different types. *
@@ -616,6 +631,25 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags);struct mlx5dr_action *mlx5dr_action_create_push_vlan (struct mlx5dr_context *ctx,uint32_t flags); +/* Create a dest array action, this action can duplicate packets and forward to +* multiple destinations in the destination list. +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] num_dest +* The number of dests attributes. +* @param[in] dests +* The destination array. Each contains a destination action and can have +* additional actions. +* @param[in] flags +* Action creation flags. (enum mlx5dr_action_flags) +* @return pointer to mlx5dr_action on success NULL otherwise. +*/ +struct mlx5dr_action * +mlx5dr_action_create_dest_array (struct mlx5dr_context *ctx, +size_t num_dest, +struct mlx5dr_action_dest_attr *dests, +uint32_t flags); +/* Create dest root table, this action will jump to root table according * the given priority. * @param[in] ctx
drivers/net/mlx5/hws/mlx5dr_action.c +128 -2
166 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -151,6 +151,9 @@ struct mlx5dr_action {struct {struct mlx5dr_devx_obj *devx_obj; } devx_dest; +struct { +struct mlx5dr_cmd_forward_tbl *fw_island; + } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +54 -10
109 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +17 -4
@@ -5,15 +5,27 @@#ifndef MLX5DR_CMD_H_ #define MLX5DR_CMD_H_ +enum mlx5dr_cmd_ext_dest_flags { +MLX5DR_CMD_EXT_DEST_REFORMAT =1 <<0 , +MLX5DR_CMD_EXT_DEST_ESW_OWNER_VHCA_ID =1 <<1 , +}; + +struct mlx5dr_cmd_set_fte_dest { +uint8_t destination_type; +uint32_t destination_id; +enum mlx5dr_cmd_ext_dest_flags ext_flags; +uint16_t esw_owner_vhca_id; +}; +struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t ignore_flow_level; +uint8_t flow_source;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id; -uint8_t destination_type; -uint32_t destination_id; -uint8_t ignore_flow_level; -uint8_t flow_source; +uint32_t dests_num; +struct mlx5dr_cmd_set_fte_dest *dests; }; struct mlx5dr_cmd_ft_create_attr {
@@ -216,6 +228,7 @@ struct mlx5dr_cmd_query_caps {struct mlx5dr_cmd_query_ft_caps nic_ft;struct mlx5dr_cmd_query_ft_caps fdb_ft;bool eswitch_manager; +uint8_t merged_eswitch;uint32_t eswitch_manager_vport_number;uint8_t log_header_modify_argument_granularity;uint8_t log_header_modify_argument_max_alloc;
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
@@ -23,6 +23,7 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_ASO_METER] = "ASO_METER", [MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT", [MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT", + [MLX5DR_ACTION_TYP_DEST_ARRAY ] ="DEST_ARRAY" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/hws/mlx5dr_table.c +5 -2
@@ -22,6 +22,7 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)struct mlx5dr_cmd_ft_create_attr ft_attr = {0 };struct mlx5dr_cmd_set_fte_attr fte_attr = {0 };struct mlx5dr_cmd_forward_tbl *default_miss; +struct mlx5dr_cmd_set_fte_dest dest = {0 };struct mlx5dr_context *ctx = tbl->ctx;uint8_t tbl_type = tbl->type;
@@ -37,9 +38,11 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl) ft_attr.level = tbl->ctx->caps->fdb_ft.max_level;/* The last level */ ft_attr.rtc_valid = false; + dest.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest.destination_id = ctx->caps->eswitch_manager_vport_number; fte_attr.action_flags =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; - fte_attr.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; - fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number; + fte_attr.dests_num =1 ; + fte_attr.dests = &dest; default_miss =mlx5dr_cmd_forward_tbl_create (mlx5dr_context_get_local_ibv (ctx), &ft_attr, &fte_attr);
Signature · 1 line
2.39.2
PATCH v5 5/10 net/mlx5/hws: allow destination into default miss FT
In reply to Gregory EtelsonFrom: Erez Shitrit <[email protected]>
In FDB it will direct the packet into the hypervisor vport. That allows the user to mirror packets into the default-miss vport.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/mlx5/hws/mlx5dr_action.c +11 -0
@@ -1769,6 +1769,17 @@ mlx5dr_action_create_dest_array(struct mlx5dr_context *ctx, fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; fte_attr.ignore_flow_level =1 ;break ; +case MLX5DR_ACTION_TYP_MISS : +if (table_type !=MLX5DR_TABLE_TYPE_FDB ) { +DR_LOG (ERR ,"Miss action supported for FDB only" ); + rte_errno =ENOTSUP ; + goto free_dest_list; + } + dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest_list[i].destination_id = + ctx->caps->eswitch_manager_vport_number; + fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; +break ;case MLX5DR_ACTION_TYP_VPORT : dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; dest_list[i].destination_id = dests[i].dest->vport.vport_num;
Signature · 1 line
2.39.2
PATCH v5 6/10 net/mlx5/hws: support reformat for hws mirror
In reply to Gregory EtelsonFrom: Haifei Luo <[email protected]>
In dest_array action, an optional reformat action can be applied to each destination. This patch supports this by using the extended destination entry.
--- drivers/common/mlx5/mlx5_prm.h | 15 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 67 +++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 2 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 10 ++++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 2 + 5 files changed, 94 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_prm.h +15 -0
@@ -5352,6 +5352,21 @@ enum mlx5_parse_graph_arc_node_index { MLX5_GRAPH_ARC_NODE_PROGRAMMABLE = 0x1f, }; +enum mlx5_packet_reformat_context_reformat_type { +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L2_TUNNEL =0x2 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_TUNNEL =0x4 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4 =0x5 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_ESP_TUNNEL =0x6 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV4 =0x7 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT =0x8 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L3_ESP_TUNNEL_TO_L2 =0x9 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT_OVER_UDP =0xA , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6 =0xB , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV6 =0xC , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_NISP_TNL =0xD , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_REMOVE_NISP_TNL =0xE , +}; +#define MLX5_PARSE_GRAPH_FLOW_SAMPLE_MAX 8#define MLX5_PARSE_GRAPH_IN_ARC_MAX 8#define MLX5_PARSE_GRAPH_OUT_ARC_MAX 8
drivers/net/mlx5/hws/mlx5dr_action.c +66 -1
104 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +2 -0
@@ -153,6 +153,8 @@ struct mlx5dr_action { } devx_dest;struct {struct mlx5dr_cmd_forward_tbl *fw_island; +size_t num_dest; +struct mlx5dr_cmd_set_fte_dest *dest_list; } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +9 -1
@@ -169,7 +169,9 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx,uint32_t *in;uint32_t i; - dest_entry_sz =MLX5_ST_SZ_BYTES (dest_format); + dest_entry_sz = fte_attr->extended_dest ? +MLX5_ST_SZ_BYTES (extended_dest_format) : +MLX5_ST_SZ_BYTES (dest_format); total_dest_sz = dest_entry_sz * fte_attr->dests_num; inlen =align ((MLX5_ST_SZ_BYTES (set_fte_in) + total_dest_sz),DW_SIZE ); in =simple_calloc (1 , inlen);
@@ -192,6 +194,7 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, in_flow_context =MLX5_ADDR_OF (set_fte_in, in, flow_context);MLX5_SET (flow_context, in_flow_context, group_id, group_id);MLX5_SET (flow_context, in_flow_context, flow_source, fte_attr->flow_source); +MLX5_SET (flow_context, in_flow_context, extended_destination, fte_attr->extended_dest);MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); action_flags = fte_attr->action_flags;
@@ -230,6 +233,11 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, dest->destination_type);MLX5_SET (dest_format, in_dests, destination_id, dest->destination_id); +if (dest->ext_flags &MLX5DR_CMD_EXT_DEST_REFORMAT ) { +MLX5_SET (dest_format, in_dests, packet_reformat,1 ); +MLX5_SET (extended_dest_format, in_dests, packet_reformat_id, + dest->ext_reformat->id); + }break ;default : rte_errno =EOPNOTSUPP ;
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
@@ -14,6 +14,7 @@ struct mlx5dr_cmd_set_fte_dest {uint8_t destination_type;uint32_t destination_id;enum mlx5dr_cmd_ext_dest_flags ext_flags; +struct mlx5dr_devx_obj *ext_reformat;uint16_t esw_owner_vhca_id; };
@@ -21,6 +22,7 @@ struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags;uint8_t ignore_flow_level;uint8_t flow_source; +uint8_t extended_dest;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id;
Signature · 1 line
2.39.2
PATCH v5 7/10 net/mlx5: reformat HWS code for HWS mirror action
In reply to Gregory EtelsonReformat HWS code for HWS mirror action.
--- drivers/net/mlx5/mlx5_flow_hw.c | 70 ++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 31 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +39 -31
@@ -4548,6 +4548,17 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT, }; +static inline void +action_template_set_type (struct rte_flow_actions_template *at, +enum mlx5dr_action_type *action_types, +unsigned int action_src,uint16_t *curr_off, +enum mlx5dr_action_type type) +{ + at->actions_off[action_src] = *curr_off; + action_types[*curr_off] = type; + *curr_off = *curr_off +1 ; +} + static int flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, unsigned int action_src,
@@ -4565,9 +4576,8 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, type = mask->type;switch (type) {case RTE_FLOW_ACTION_TYPE_RSS : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_TIR ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_TIR );break ;case RTE_FLOW_ACTION_TYPE_AGE :case RTE_FLOW_ACTION_TYPE_COUNT :
@@ -4575,23 +4585,20 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,* Both AGE and COUNT action need counter, the first one fills * the action_types array, and the second only saves the offset. */ -if (*cnt_off ==UINT16_MAX ) { - *cnt_off = *curr_off; - action_types[*cnt_off] =MLX5DR_ACTION_TYP_CTR ; - *curr_off = *curr_off +1 ; - } +if (*cnt_off ==UINT16_MAX ) +action_template_set_type (at, action_types, + action_src, curr_off, +MLX5DR_ACTION_TYP_CTR ); at->actions_off[action_src] = *cnt_off;break ;case RTE_FLOW_ACTION_TYPE_CONNTRACK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_CT ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_CT );break ;case RTE_FLOW_ACTION_TYPE_QUOTA :case RTE_FLOW_ACTION_TYPE_METER_MARK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_METER ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_METER );break ;default :DRV_LOG (WARNING ,"Unsupported shared action type: %d" , type);
@@ -5101,31 +5108,32 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, at->reformat_off =UINT16_MAX ; at->mhdr_off =UINT16_MAX ; at->rx_cpy_pos = pos; -/* -* mlx5 PMD hacks indirect action index directly to the action conf. -* The rte_flow_conv() function copies the content from conf pointer. -* Need to restore the indirect action index from action conf here. -*/ for (i =0 ; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++, masks++, i++) { -if (actions->type ==RTE_FLOW_ACTION_TYPE_INDIRECT ) { +const struct rte_flow_action_modify_field *info; + +switch (actions->type) { +/* +* mlx5 PMD hacks indirect action index directly to the action conf. +* The rte_flow_conv() function copies the content from conf pointer. +* Need to restore the indirect action index from action conf here. +*/ +case RTE_FLOW_ACTION_TYPE_INDIRECT : at->actions[i].conf = actions->conf; at->masks[i].conf = masks->conf; - } -if (actions->type ==RTE_FLOW_ACTION_TYPE_MODIFY_FIELD ) { -const struct rte_flow_action_modify_field *info = actions->conf; - +break ; +case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD : + info = actions->conf;if ((info->dst.field ==RTE_FLOW_FIELD_FLEX_ITEM &&flow_hw_flex_item_acquire (dev, info->dst.flex_handle, &at->flex_item)) || - (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && -flow_hw_flex_item_acquire (dev, info->src.flex_handle, - &at->flex_item))) { -rte_flow_error_set (error, rte_errno, -RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , -"Failed to acquire flex item" ); + (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && +flow_hw_flex_item_acquire (dev, info->src.flex_handle, + &at->flex_item))) goto error; - } +break ; +default : +break ; } } at->tmpl =flow_hw_dr_actions_template_create (at);
Signature · 1 line
2.39.2
PATCH v5 8/10 net/mlx5: support HWS mirror action
In reply to Gregory EtelsonHWS mirror clones original packet to one or two destinations and proceeds with the original packet path.
The mirror has no dedicated RTE flow action type. Mirror object is referenced by INDIRECT_LIST action. INDIRECT_LIST for a mirror built from actions list:
SAMPLE [/ SAMPLE] / <Orig. packet destination> / END
Mirror SAMPLE action defines packet clone. It specifies the clone destination and optional clone reformat action. Destination action for both clone and original packet depends on HCA domain:
- for NIC RX, destination is ether RSS or QUEUE
- for FDB, destination is PORT
HWS mirror was inplemented with the INDIRECT_LIST flow action.
MLX5 PMD defines general struct mlx5_indirect_list type for all. INDIRECT_LIST handler objects:
struct mlx5_indirect_list {
enum mlx5_indirect_list_type type;
LIST_ENTRY(mlx5_indirect_list) chain;
char data[];
};Specific INDIRECT_LIST type must overload mlx5_indirect_list::data and provide unique type value.
PMD returns a pointer to mlx5_indirect_list object.
Existing non-masked actions template API cannot identify flow actions in INDIRECT_LIST handler because INDIRECT_LIST handler can represent several flow actions.
For example:
A: SAMPLE / JUMP
B: SAMPE / SAMPLE / RSS
Actions template command
template indirect_list / end mask indirect_list 0 / end
does not provide any information to differentiate between flow actions in A and B.
MLX5 PMD requires INDIRECT_LIST configuration parameter in the template section:
Non-masked INDIRECT_LIST API:
=============================
template indirect_list X / end mask indirect_list 0 / end
PMD identifies type of X handler and will use the same type in template creation. Actual parameters for actions in the list will be extracted from flow configuration
Masked INDIRECT_LIST API:
=========================
template indirect_list X / end mask indirect_list -lUL / end
PMD creates action template from actions types and configurations referenced by X.
INDIRECT_LIST action without configuration is invalid and will be rejected by PMD.
--- doc/guides/nics/features/mlx5.ini | 1 + doc/guides/rel_notes/release_23_11.rst | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 134 ++++++ drivers/net/mlx5/mlx5_flow.h | 69 ++- drivers/net/mlx5/mlx5_flow_hw.c | 615 ++++++++++++++++++++++++- 7 files changed, 818 insertions(+), 5 deletions(-)
doc/guides/nics/features/mlx5.ini +1 -0
@@ -106,6 +106,7 @@ drop = Y flag = Y inc_tcp_ack = Y inc_tcp_seq = Y +indirect_list = Y jump = Y mark = Y meter = Y
doc/guides/rel_notes/release_23_11.rst +1 -0
@@ -143,6 +143,7 @@ New Features * **Updated NVIDIA mlx5 net driver.** * Added support for Network Service Header (NSH) flow matching. + * Added support for ``RTE_FLOW_ACTION_TYPE_INDIRECT_LIST`` flow action. * **Updated Solarflare net driver.**
drivers/net/mlx5/mlx5.c +1 -0
@@ -2168,6 +2168,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)/* Free the eCPRI flex parser resource. */ mlx5_flex_parser_ecpri_release (dev);mlx5_flex_item_port_cleanup (dev); +mlx5_indirect_list_handles_release (dev);#ifdef HAVE_MLX5_HWS_SUPPORT flow_hw_destroy_vport_action (dev);flow_hw_resource_release (dev);
drivers/net/mlx5/mlx5.h +2 -0
@@ -1791,6 +1791,8 @@ struct mlx5_priv { LIST_HEAD(ind_tables, mlx5_ind_table_obj) ind_tbls;/* Standalone indirect tables. */ LIST_HEAD(stdl_ind_tables, mlx5_ind_table_obj) standalone_ind_tbls; +/* Objects created with indirect list action */ + LIST_HEAD(indirect_list, mlx5_indirect_list) indirect_list_head;/* Pointer to next element. */ rte_rwlock_t ind_tbls_lock;uint32_t refcnt;/**< Reference counter. */
drivers/net/mlx5/mlx5_flow.c +134 -0
164 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +68 -1
121 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +611 -4
693 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v5 9/10 net/mlx5: reformat HWS code for indirect list actions
In reply to Gregory EtelsonReformat HWS code for indirect list actions.
--- drivers/net/mlx5/mlx5_flow.h | 4 +- drivers/net/mlx5/mlx5_flow_hw.c | 250 +++++++++++++++++--------------- 2 files changed, 139 insertions(+), 115 deletions(-)
drivers/net/mlx5/mlx5_flow.h +2 -2
@@ -1331,11 +1331,11 @@ struct rte_flow_actions_template {uint64_t action_flags;/* Bit-map of all valid action in template. */ uint16_t dr_actions_num;/* Amount of DR rules actions. */ uint16_t actions_num;/* Amount of flow actions */ -uint16_t *actions_off;/* DR action offset for given rte action offset. */ +uint16_t *dr_off;/* DR action offset for given rte action offset. */ +uint16_t *src_off;/* RTE action displacement from app. template */ uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint32_t refcnt;/* Reference counter. */ -uint16_t rx_cpy_pos;/* Action position of Rx metadata to be copied. */ uint8_t flex_item;/* flex item index. */ };
drivers/net/mlx5/mlx5_flow_hw.c +137 -113
663 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v5 10/10 net/mlx5: support indirect list METER_MARK action
In reply to Gregory Etelson--- drivers/net/mlx5/mlx5_flow.c | 69 ++++- drivers/net/mlx5/mlx5_flow.h | 70 ++++-- drivers/net/mlx5/mlx5_flow_hw.c | 432 +++++++++++++++++++++++++++----- 3 files changed, 485 insertions(+), 86 deletions(-)
drivers/net/mlx5/mlx5_flow.c +67 -2
@@ -75,8 +75,11 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)switch (e->type) {#ifdef HAVE_MLX5_HWS_SUPPORT case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR : -mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e, true); +mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e);break ; +case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY : +mlx5_destroy_legacy_indirect (dev, e); +break ;#endif default :DRV_LOG (ERR ,"invalid indirect list type" );
@@ -1169,7 +1172,24 @@ mlx5_flow_async_action_list_handle_destroyconst struct rte_flow_op_attr *op_attr, struct rte_flow_action_list_handle *action_handle, void *user_data, struct rte_flow_error *error); - +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error); +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const struct rte_flow_op_attr *attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error);static const struct rte_flow_ops mlx5_flow_ops = { .validate = mlx5_flow_validate, .create = mlx5_flow_create,
@@ -1219,6 +1239,10 @@ static const struct rte_flow_ops mlx5_flow_ops = { mlx5_flow_async_action_list_handle_create, .async_action_list_handle_destroy = mlx5_flow_async_action_list_handle_destroy, + .action_list_handle_query_update = + mlx5_flow_action_list_handle_query_update, + .async_action_list_handle_query_update = + mlx5_flow_async_action_list_handle_query_update, };/* Tunnel information. */
@@ -11003,6 +11027,47 @@ mlx5_flow_async_action_list_handle_destroy error); } +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + action_list_handle_query_update,ENOTSUP ); +return fops->action_list_handle_query_update (dev, handle, update, query, + mode, error); +} + +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const +struct rte_flow_op_attr *op_attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum +rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + async_action_list_handle_query_update,ENOTSUP ); +return fops->async_action_list_handle_query_update (dev, queue_id, op_attr, + handle, update, + query, mode, + user_data, error); +} + +/** * Destroy all indirect actions (shared RSS). *
drivers/net/mlx5/mlx5_flow.h +54 -16
123 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +364 -68
607 lines not on this page · raw message
Signature · 1 line
2.39.2
v6 cover net/mlx5: support indirect actions list
In reply to Gregory EtelsonAdd MLX5 PMD support for indirect actions list.
Erez Shitrit (1):
net/mlx5/hws: allow destination into default miss FT
Gregory Etelson (4):
net/mlx5: reformat HWS code for HWS mirror action net/mlx5: support HWS mirror action net/mlx5: reformat HWS code for indirect list actions net/mlx5: support indirect list METER_MARK action
Haifei Luo (1):
net/mlx5/hws: support reformat for hws mirror
Hamdan Igbaria (3):
net/mlx5/hws: add support for reformat DevX object net/mlx5/hws: support creating of dynamic forward table and FTE net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
Shun Hao (1):
net/mlx5/hws: add support for mirroring
doc/guides/nics/features/mlx5.ini | 1 + doc/guides/rel_notes/release_23_11.rst | 1 + drivers/common/mlx5/mlx5_prm.h | 81 +- drivers/net/mlx5/hws/mlx5dr.h | 34 + drivers/net/mlx5/hws/mlx5dr_action.c | 210 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 8 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 143 ++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 49 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_internal.h | 5 + drivers/net/mlx5/hws/mlx5dr_send.c | 5 - drivers/net/mlx5/hws/mlx5dr_table.c | 8 +- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 199 ++++ drivers/net/mlx5/mlx5_flow.h | 111 ++- drivers/net/mlx5/mlx5_flow_hw.c | 1217 +++++++++++++++++++++--- 17 files changed, 1908 insertions(+), 168 deletions(-)
--
v3: Add ACK to patches in the series.
v4: Squash reformat patches.
v5: Update release notes.
Fix code style.
v6: Fix code style.
--
2.39.2
PATCH v6 1/10 net/mlx5/hws: add support for reformat DevX object
From: Hamdan Igbaria <[email protected]>
Add support for creation of packet reformat object, via the ALLOC_PACKET_REFORMAT_CONTEXT command.
--- drivers/common/mlx5/mlx5_prm.h | 39 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 60 ++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 +++++ drivers/net/mlx5/hws/mlx5dr_internal.h | 5 +++ drivers/net/mlx5/hws/mlx5dr_send.c | 5 --- 5 files changed, 115 insertions(+), 5 deletions(-)
drivers/common/mlx5/mlx5_prm.h +39 -0
@@ -1218,6 +1218,8 @@ enum {MLX5_CMD_OP_CREATE_FLOW_GROUP =0x933 ,MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY =0x936 ,MLX5_CMD_OP_MODIFY_FLOW_TABLE =0x93c , +MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT =0x93d , +MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT =0x93e ,MLX5_CMD_OP_ALLOC_FLOW_COUNTER =0x939 ,MLX5_CMD_OP_QUERY_FLOW_COUNTER =0x93b , MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00,
@@ -5191,6 +5193,43 @@ struct mlx5_ifc_modify_flow_table_out_bits {u8 reserved_at_40[0x60 ]; }; +struct mlx5_ifc_packet_reformat_context_in_bits { +u8 reformat_type[0x8 ]; +u8 reserved_at_8[0x4 ]; +u8 reformat_param_0[0x4 ]; +u8 reserved_at_16[0x6 ]; +u8 reformat_data_size[0xa ]; + +u8 reformat_param_1[0x8 ]; +u8 reserved_at_40[0x8 ]; +u8 reformat_data[6 ][0x8 ]; + +u8 more_reformat_data[][0x8 ]; +}; + +struct mlx5_ifc_alloc_packet_reformat_context_in_bits { +u8 opcode[0x10 ]; +u8 uid[0x10 ]; + +u8 reserved_at_20[0x10 ]; +u8 op_mod[0x10 ]; + +u8 reserved_at_40[0xa0 ]; + +u8 packet_reformat_context[]; +}; + +struct mlx5_ifc_alloc_packet_reformat_out_bits { +u8 status[0x8 ]; +u8 reserved_at_8[0x18 ]; + +u8 syndrome[0x20 ]; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; +/* CQE format mask. */ #define MLX5E_CQE_FORMAT_MASK 0xc
drivers/net/mlx5/hws/mlx5dr_cmd.c +60 -0
66 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +11 -0
@@ -155,6 +155,13 @@ struct mlx5dr_cmd_allow_other_vhca_access_attr {uint8_t access_key[ACCESS_KEY_LEN ]; }; +struct mlx5dr_cmd_packet_reformat_create_attr { +uint8_t type; +size_t data_sz; +void *data; +uint8_t reformat_param_0; +}; +struct mlx5dr_cmd_query_ft_caps {uint8_t max_level;uint8_t reparse;
@@ -285,6 +292,10 @@ mlx5dr_cmd_forward_tbl_create(struct ibv_context *ctx,void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj * +mlx5dr_cmd_packet_reformat_create (struct ibv_context *ctx, +struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
drivers/net/mlx5/hws/mlx5dr_internal.h +5 -0
@@ -91,4 +91,9 @@ static inline uint64_t roundup_pow_of_two(uint64_t n) return n == 1 ? 1 : 1ULL << log2above(n); } +static inline unsigned long align (unsigned long val,unsigned long align) +{ +return (val + align -1 ) & ~(align -1 ); +} +#endif /* MLX5DR_INTERNAL_H_ */
drivers/net/mlx5/hws/mlx5dr_send.c +0 -5
@@ -668,11 +668,6 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,return err; } -static inline unsigned long align (unsigned long val,unsigned long align) -{ -return (val + align -1 ) & ~(align -1 ); -} - static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx, struct mlx5dr_send_engine *queue, struct mlx5dr_send_ring_sq *sq,
Signature · 1 line
2.39.2
PATCH v6 2/10 net/mlx5/hws: support creating of dynamic forward table and FTE
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add the ability to create forward table and FTE.
--- drivers/common/mlx5/mlx5_prm.h | 4 ++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 13 +++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+)
drivers/common/mlx5/mlx5_prm.h +4 -0
@@ -5048,7 +5048,11 @@ enum mlx5_flow_destination_type { };enum mlx5_flow_context_action { +MLX5_FLOW_CONTEXT_ACTION_DROP =1 <<1 ,MLX5_FLOW_CONTEXT_ACTION_FWD_DEST =1 <<2 , +MLX5_FLOW_CONTEXT_ACTION_REFORMAT =1 <<4 , +MLX5_FLOW_CONTEXT_ACTION_DECRYPT =1 <<12 , +MLX5_FLOW_CONTEXT_ACTION_ENCRYPT =1 <<13 , };enum mlx5_flow_context_flow_source {
drivers/net/mlx5/hws/mlx5dr_cmd.c +13 -0
@@ -42,6 +42,7 @@ mlx5dr_cmd_flow_table_create(struct ibv_context *ctx, ft_ctx =MLX5_ADDR_OF (create_flow_table_in, in, flow_table_context);MLX5_SET (flow_table_context, ft_ctx, level, ft_attr->level);MLX5_SET (flow_table_context, ft_ctx, rtc_valid, ft_attr->rtc_valid); +MLX5_SET (flow_table_context, ft_ctx, reformat_en, ft_attr->reformat_en); devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));if (!devx_obj->obj) {
@@ -182,12 +183,24 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, action_flags = fte_attr->action_flags;MLX5_SET (flow_context, in_flow_context, action, action_flags); +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_REFORMAT ) +MLX5_SET (flow_context, in_flow_context, + packet_reformat_id, fte_attr->packet_reformat_id); + +if (action_flags & (MLX5_FLOW_CONTEXT_ACTION_DECRYPT |MLX5_FLOW_CONTEXT_ACTION_ENCRYPT )) { +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_type, fte_attr->encrypt_decrypt_type); +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_obj_id, fte_attr->encrypt_decrypt_obj_id); + } +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ) {/* Only destination_list_size of size 1 is supported */ MLX5_SET (flow_context, in_flow_context, destination_list_size,1 ); in_dests =MLX5_ADDR_OF (flow_context, in_flow_context, destination);MLX5_SET (dest_format, in_dests, destination_type, fte_attr->destination_type);MLX5_SET (dest_format, in_dests, destination_id, fte_attr->destination_id); +MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); } devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));
drivers/net/mlx5/hws/mlx5dr_cmd.h +19 -0
@@ -7,8 +7,12 @@struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t encrypt_decrypt_type; +uint32_t encrypt_decrypt_obj_id; +uint32_t packet_reformat_id;uint8_t destination_type;uint32_t destination_id; +uint8_t ignore_flow_level;uint8_t flow_source; };
@@ -16,6 +20,7 @@ struct mlx5dr_cmd_ft_create_attr {uint8_t type;uint8_t level;bool rtc_valid; +uint8_t reformat_en; };#define ACCESS_KEY_LEN 32
@@ -296,6 +301,20 @@ struct mlx5dr_devx_obj * mlx5dr_cmd_packet_reformat_create(struct ibv_context *ctx, struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj * +mlx5dr_cmd_set_fte (struct ibv_context *ctx, +uint32_t table_type, +uint32_t table_id, +uint32_t group_id, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +struct mlx5dr_cmd_forward_tbl * +mlx5dr_cmd_forward_tbl_create (struct ibv_context *ctx, +struct mlx5dr_cmd_ft_create_attr *ft_attr, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
Signature · 1 line
2.39.2
PATCH v6 3/10 net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add mlx5dr_devx_obj struct to mlx5dr_action, so we could hold the FT obj in dest table action.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 4 ++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +++ drivers/net/mlx5/hws/mlx5dr_table.c | 1 - 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +4 -0
@@ -787,6 +787,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, tbl->ft);if (ret) goto free_action; + + action->devx_dest.devx_obj = tbl->ft; }return action;
@@ -864,6 +866,8 @@ mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, cur_obj);if (ret) goto clean_obj; + + action->devx_dest.devx_obj = cur_obj; }return action;
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -148,6 +148,9 @@ struct mlx5dr_action {struct {struct mlx5dv_steering_anchor *sa; } root_tbl; +struct { +struct mlx5dr_devx_obj *devx_obj; + } devx_dest; }; };
drivers/net/mlx5/hws/mlx5dr_table.c +0 -1
@@ -68,7 +68,6 @@ static void mlx5dr_table_down_default_fdb_miss_tbl(struct mlx5dr_table *tbl)return ;mlx5dr_cmd_forward_tbl_destroy (default_miss); - ctx->common_res[tbl_type].default_miss =NULL ; }
Signature · 1 line
2.39.2
PATCH v6 4/10 net/mlx5/hws: add support for mirroring
In reply to Gregory EtelsonFrom: Shun Hao <[email protected]>
This patch supports mirroring by adding an dest_array action. The action accecpts a list containing multiple destination actions, and can duplicate packet and forward to each destination in the list.
--- drivers/common/mlx5/mlx5_prm.h | 23 ++++- drivers/net/mlx5/hws/mlx5dr.h | 34 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 130 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 64 ++++++++++--- drivers/net/mlx5/hws/mlx5dr_cmd.h | 21 ++++- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_table.c | 7 +- 8 files changed, 262 insertions(+), 21 deletions(-)
drivers/common/mlx5/mlx5_prm.h +20 -3
@@ -2320,7 +2320,11 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { };struct mlx5_ifc_esw_cap_bits { -u8 reserved_at_0[0x60 ]; +u8 reserved_at_0[0x1d ]; +u8 merged_eswitch[0x1 ]; +u8 reserved_at_1e[0x2 ]; + +u8 reserved_at_20[0x40 ];u8 esw_manager_vport_number_valid[0x1 ];u8 reserved_at_61[0xf ];
@@ -5045,6 +5049,7 @@ struct mlx5_ifc_query_flow_table_out_bits {enum mlx5_flow_destination_type {MLX5_FLOW_DESTINATION_TYPE_VPORT =0x0 ,MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE =0x1 , +MLX5_FLOW_DESTINATION_TYPE_TIR =0x2 , };enum mlx5_flow_context_action {
@@ -5088,6 +5093,19 @@ union mlx5_ifc_dest_format_flow_counter_list_auto_bits {u8 reserved_at_0[0x40 ]; }; +struct mlx5_ifc_extended_dest_format_bits { +struct mlx5_ifc_dest_format_bits destination_entry; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; + +#define MLX5_IFC_MULTI_PATH_FT_MAX_LEVEL 64 + +#ifdef PEDANTIC +#pragma GCC diagnostic ignored "-Wpedantic" +#endif struct mlx5_ifc_flow_context_bits {u8 reserved_at_00[0x20 ];u8 group_id[0x20 ];
@@ -5106,8 +5124,7 @@ struct mlx5_ifc_flow_context_bits {u8 reserved_at_e0[0x40 ];u8 encrypt_decrypt_obj_id[0x20 ];u8 reserved_at_140[0x16c0 ]; -/* Currently only one destnation */ -union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[1 ]; +union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0 ]; };struct mlx5_ifc_set_fte_in_bits {
drivers/net/mlx5/hws/mlx5dr.h +34 -0
@@ -46,6 +46,7 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_ASO_METER ,MLX5DR_ACTION_TYP_ASO_CT ,MLX5DR_ACTION_TYP_DEST_ROOT , +MLX5DR_ACTION_TYP_DEST_ARRAY , MLX5DR_ACTION_TYP_MAX, };
@@ -213,6 +214,20 @@ struct mlx5dr_rule_action { }; }; +struct mlx5dr_action_dest_attr { +/* Required action combination */ +enum mlx5dr_action_type *action_type; + +/* Required destination action to forward the packet */ +struct mlx5dr_action *dest; + +/* Optional reformat data */ +struct { +size_t reformat_data_sz; +void *reformat_data; + } reformat; +}; +/* Open a context used for direct rule insertion using hardware steering. * Each context can contain multiple tables of different types. *
@@ -616,6 +631,25 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags);struct mlx5dr_action *mlx5dr_action_create_push_vlan (struct mlx5dr_context *ctx,uint32_t flags); +/* Create a dest array action, this action can duplicate packets and forward to +* multiple destinations in the destination list. +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] num_dest +* The number of dests attributes. +* @param[in] dests +* The destination array. Each contains a destination action and can have +* additional actions. +* @param[in] flags +* Action creation flags. (enum mlx5dr_action_flags) +* @return pointer to mlx5dr_action on success NULL otherwise. +*/ +struct mlx5dr_action * +mlx5dr_action_create_dest_array (struct mlx5dr_context *ctx, +size_t num_dest, +struct mlx5dr_action_dest_attr *dests, +uint32_t flags); +/* Create dest root table, this action will jump to root table according * the given priority. * @param[in] ctx
drivers/net/mlx5/hws/mlx5dr_action.c +128 -2
166 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -151,6 +151,9 @@ struct mlx5dr_action {struct {struct mlx5dr_devx_obj *devx_obj; } devx_dest; +struct { +struct mlx5dr_cmd_forward_tbl *fw_island; + } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +54 -10
109 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +17 -4
@@ -5,15 +5,27 @@#ifndef MLX5DR_CMD_H_ #define MLX5DR_CMD_H_ +enum mlx5dr_cmd_ext_dest_flags { +MLX5DR_CMD_EXT_DEST_REFORMAT =1 <<0 , +MLX5DR_CMD_EXT_DEST_ESW_OWNER_VHCA_ID =1 <<1 , +}; + +struct mlx5dr_cmd_set_fte_dest { +uint8_t destination_type; +uint32_t destination_id; +enum mlx5dr_cmd_ext_dest_flags ext_flags; +uint16_t esw_owner_vhca_id; +}; +struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t ignore_flow_level; +uint8_t flow_source;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id; -uint8_t destination_type; -uint32_t destination_id; -uint8_t ignore_flow_level; -uint8_t flow_source; +uint32_t dests_num; +struct mlx5dr_cmd_set_fte_dest *dests; }; struct mlx5dr_cmd_ft_create_attr {
@@ -216,6 +228,7 @@ struct mlx5dr_cmd_query_caps {struct mlx5dr_cmd_query_ft_caps nic_ft;struct mlx5dr_cmd_query_ft_caps fdb_ft;bool eswitch_manager; +uint8_t merged_eswitch;uint32_t eswitch_manager_vport_number;uint8_t log_header_modify_argument_granularity;uint8_t log_header_modify_argument_max_alloc;
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
@@ -23,6 +23,7 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_ASO_METER] = "ASO_METER", [MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT", [MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT", + [MLX5DR_ACTION_TYP_DEST_ARRAY ] ="DEST_ARRAY" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/hws/mlx5dr_table.c +5 -2
@@ -22,6 +22,7 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)struct mlx5dr_cmd_ft_create_attr ft_attr = {0 };struct mlx5dr_cmd_set_fte_attr fte_attr = {0 };struct mlx5dr_cmd_forward_tbl *default_miss; +struct mlx5dr_cmd_set_fte_dest dest = {0 };struct mlx5dr_context *ctx = tbl->ctx;uint8_t tbl_type = tbl->type;
@@ -37,9 +38,11 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl) ft_attr.level = tbl->ctx->caps->fdb_ft.max_level;/* The last level */ ft_attr.rtc_valid = false; + dest.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest.destination_id = ctx->caps->eswitch_manager_vport_number; fte_attr.action_flags =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; - fte_attr.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; - fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number; + fte_attr.dests_num =1 ; + fte_attr.dests = &dest; default_miss =mlx5dr_cmd_forward_tbl_create (mlx5dr_context_get_local_ibv (ctx), &ft_attr, &fte_attr);
Signature · 1 line
2.39.2
PATCH v6 5/10 net/mlx5/hws: allow destination into default miss FT
In reply to Gregory EtelsonFrom: Erez Shitrit <[email protected]>
In FDB it will direct the packet into the hypervisor vport. That allows the user to mirror packets into the default-miss vport.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/mlx5/hws/mlx5dr_action.c +11 -0
@@ -1769,6 +1769,17 @@ mlx5dr_action_create_dest_array(struct mlx5dr_context *ctx, fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; fte_attr.ignore_flow_level =1 ;break ; +case MLX5DR_ACTION_TYP_MISS : +if (table_type !=MLX5DR_TABLE_TYPE_FDB ) { +DR_LOG (ERR ,"Miss action supported for FDB only" ); + rte_errno =ENOTSUP ; + goto free_dest_list; + } + dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest_list[i].destination_id = + ctx->caps->eswitch_manager_vport_number; + fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; +break ;case MLX5DR_ACTION_TYP_VPORT : dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; dest_list[i].destination_id = dests[i].dest->vport.vport_num;
Signature · 1 line
2.39.2
PATCH v6 6/10 net/mlx5/hws: support reformat for hws mirror
In reply to Gregory EtelsonFrom: Haifei Luo <[email protected]>
In dest_array action, an optional reformat action can be applied to each destination. This patch supports this by using the extended destination entry.
--- drivers/common/mlx5/mlx5_prm.h | 15 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 67 +++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 2 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 10 ++++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 2 + 5 files changed, 94 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_prm.h +15 -0
@@ -5352,6 +5352,21 @@ enum mlx5_parse_graph_arc_node_index { MLX5_GRAPH_ARC_NODE_PROGRAMMABLE = 0x1f, }; +enum mlx5_packet_reformat_context_reformat_type { +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L2_TUNNEL =0x2 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_TUNNEL =0x4 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4 =0x5 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_ESP_TUNNEL =0x6 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV4 =0x7 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT =0x8 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L3_ESP_TUNNEL_TO_L2 =0x9 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT_OVER_UDP =0xA , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6 =0xB , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV6 =0xC , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_NISP_TNL =0xD , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_REMOVE_NISP_TNL =0xE , +}; +#define MLX5_PARSE_GRAPH_FLOW_SAMPLE_MAX 8#define MLX5_PARSE_GRAPH_IN_ARC_MAX 8#define MLX5_PARSE_GRAPH_OUT_ARC_MAX 8
drivers/net/mlx5/hws/mlx5dr_action.c +66 -1
104 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +2 -0
@@ -153,6 +153,8 @@ struct mlx5dr_action { } devx_dest;struct {struct mlx5dr_cmd_forward_tbl *fw_island; +size_t num_dest; +struct mlx5dr_cmd_set_fte_dest *dest_list; } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +9 -1
@@ -169,7 +169,9 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx,uint32_t *in;uint32_t i; - dest_entry_sz =MLX5_ST_SZ_BYTES (dest_format); + dest_entry_sz = fte_attr->extended_dest ? +MLX5_ST_SZ_BYTES (extended_dest_format) : +MLX5_ST_SZ_BYTES (dest_format); total_dest_sz = dest_entry_sz * fte_attr->dests_num; inlen =align ((MLX5_ST_SZ_BYTES (set_fte_in) + total_dest_sz),DW_SIZE ); in =simple_calloc (1 , inlen);
@@ -192,6 +194,7 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, in_flow_context =MLX5_ADDR_OF (set_fte_in, in, flow_context);MLX5_SET (flow_context, in_flow_context, group_id, group_id);MLX5_SET (flow_context, in_flow_context, flow_source, fte_attr->flow_source); +MLX5_SET (flow_context, in_flow_context, extended_destination, fte_attr->extended_dest);MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); action_flags = fte_attr->action_flags;
@@ -230,6 +233,11 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, dest->destination_type);MLX5_SET (dest_format, in_dests, destination_id, dest->destination_id); +if (dest->ext_flags &MLX5DR_CMD_EXT_DEST_REFORMAT ) { +MLX5_SET (dest_format, in_dests, packet_reformat,1 ); +MLX5_SET (extended_dest_format, in_dests, packet_reformat_id, + dest->ext_reformat->id); + }break ;default : rte_errno =EOPNOTSUPP ;
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
@@ -14,6 +14,7 @@ struct mlx5dr_cmd_set_fte_dest {uint8_t destination_type;uint32_t destination_id;enum mlx5dr_cmd_ext_dest_flags ext_flags; +struct mlx5dr_devx_obj *ext_reformat;uint16_t esw_owner_vhca_id; };
@@ -21,6 +22,7 @@ struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags;uint8_t ignore_flow_level;uint8_t flow_source; +uint8_t extended_dest;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id;
Signature · 1 line
2.39.2
PATCH v6 7/10 net/mlx5: reformat HWS code for HWS mirror action
In reply to Gregory EtelsonReformat HWS code for HWS mirror action.
--- drivers/net/mlx5/mlx5_flow_hw.c | 70 ++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 31 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +39 -31
@@ -4548,6 +4548,17 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT, }; +static inline void +action_template_set_type (struct rte_flow_actions_template *at, +enum mlx5dr_action_type *action_types, +unsigned int action_src,uint16_t *curr_off, +enum mlx5dr_action_type type) +{ + at->actions_off[action_src] = *curr_off; + action_types[*curr_off] = type; + *curr_off = *curr_off +1 ; +} + static int flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, unsigned int action_src,
@@ -4565,9 +4576,8 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, type = mask->type;switch (type) {case RTE_FLOW_ACTION_TYPE_RSS : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_TIR ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_TIR );break ;case RTE_FLOW_ACTION_TYPE_AGE :case RTE_FLOW_ACTION_TYPE_COUNT :
@@ -4575,23 +4585,20 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,* Both AGE and COUNT action need counter, the first one fills * the action_types array, and the second only saves the offset. */ -if (*cnt_off ==UINT16_MAX ) { - *cnt_off = *curr_off; - action_types[*cnt_off] =MLX5DR_ACTION_TYP_CTR ; - *curr_off = *curr_off +1 ; - } +if (*cnt_off ==UINT16_MAX ) +action_template_set_type (at, action_types, + action_src, curr_off, +MLX5DR_ACTION_TYP_CTR ); at->actions_off[action_src] = *cnt_off;break ;case RTE_FLOW_ACTION_TYPE_CONNTRACK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_CT ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_CT );break ;case RTE_FLOW_ACTION_TYPE_QUOTA :case RTE_FLOW_ACTION_TYPE_METER_MARK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_METER ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_METER );break ;default :DRV_LOG (WARNING ,"Unsupported shared action type: %d" , type);
@@ -5101,31 +5108,32 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, at->reformat_off =UINT16_MAX ; at->mhdr_off =UINT16_MAX ; at->rx_cpy_pos = pos; -/* -* mlx5 PMD hacks indirect action index directly to the action conf. -* The rte_flow_conv() function copies the content from conf pointer. -* Need to restore the indirect action index from action conf here. -*/ for (i =0 ; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++, masks++, i++) { -if (actions->type ==RTE_FLOW_ACTION_TYPE_INDIRECT ) { +const struct rte_flow_action_modify_field *info; + +switch (actions->type) { +/* +* mlx5 PMD hacks indirect action index directly to the action conf. +* The rte_flow_conv() function copies the content from conf pointer. +* Need to restore the indirect action index from action conf here. +*/ +case RTE_FLOW_ACTION_TYPE_INDIRECT : at->actions[i].conf = actions->conf; at->masks[i].conf = masks->conf; - } -if (actions->type ==RTE_FLOW_ACTION_TYPE_MODIFY_FIELD ) { -const struct rte_flow_action_modify_field *info = actions->conf; - +break ; +case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD : + info = actions->conf;if ((info->dst.field ==RTE_FLOW_FIELD_FLEX_ITEM &&flow_hw_flex_item_acquire (dev, info->dst.flex_handle, &at->flex_item)) || - (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && -flow_hw_flex_item_acquire (dev, info->src.flex_handle, - &at->flex_item))) { -rte_flow_error_set (error, rte_errno, -RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , -"Failed to acquire flex item" ); + (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && +flow_hw_flex_item_acquire (dev, info->src.flex_handle, + &at->flex_item))) goto error; - } +break ; +default : +break ; } } at->tmpl =flow_hw_dr_actions_template_create (at);
Signature · 1 line
2.39.2
PATCH v6 8/10 net/mlx5: support HWS mirror action
In reply to Gregory EtelsonHWS mirror clones original packet to one or two destinations and proceeds with the original packet path.
The mirror has no dedicated RTE flow action type. Mirror object is referenced by INDIRECT_LIST action. INDIRECT_LIST for a mirror built from actions list:
SAMPLE [/ SAMPLE] / <Orig. packet destination> / END
Mirror SAMPLE action defines packet clone. It specifies the clone destination and optional clone reformat action. Destination action for both clone and original packet depends on HCA domain:
- for NIC RX, destination is ether RSS or QUEUE
- for FDB, destination is PORT
HWS mirror was implemented with the INDIRECT_LIST flow action.
MLX5 PMD defines general struct mlx5_indirect_list type for all. INDIRECT_LIST handler objects:
struct mlx5_indirect_list {
enum mlx5_indirect_list_type type;
LIST_ENTRY(mlx5_indirect_list) chain;
char data[];
};Specific INDIRECT_LIST type must overload mlx5_indirect_list::data and provide unique type value.
PMD returns a pointer to mlx5_indirect_list object.
Existing non-masked actions template API cannot identify flow actions in INDIRECT_LIST handler because INDIRECT_LIST handler can represent several flow actions.
For example:
A: SAMPLE / JUMP
B: SAMPE / SAMPLE / RSS
Actions template command
template indirect_list / end mask indirect_list 0 / end
does not provide any information to differentiate between flow actions in A and B.
MLX5 PMD requires INDIRECT_LIST configuration parameter in the template section:
Non-masked INDIRECT_LIST API:
=============================
template indirect_list X / end mask indirect_list 0 / end
PMD identifies type of X handler and will use the same type in template creation. Actual parameters for actions in the list will be extracted from flow configuration
Masked INDIRECT_LIST API:
=========================
template indirect_list X / end mask indirect_list -lUL / end
PMD creates action template from actions types and configurations referenced by X.
INDIRECT_LIST action without configuration is invalid and will be rejected by PMD.
--- doc/guides/nics/features/mlx5.ini | 1 + doc/guides/rel_notes/release_23_11.rst | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 134 ++++++ drivers/net/mlx5/mlx5_flow.h | 69 ++- drivers/net/mlx5/mlx5_flow_hw.c | 615 ++++++++++++++++++++++++- 7 files changed, 818 insertions(+), 5 deletions(-)
doc/guides/nics/features/mlx5.ini +1 -0
@@ -106,6 +106,7 @@ drop = Y flag = Y inc_tcp_ack = Y inc_tcp_seq = Y +indirect_list = Y jump = Y mark = Y meter = Y
doc/guides/rel_notes/release_23_11.rst +1 -0
@@ -143,6 +143,7 @@ New Features * **Updated NVIDIA mlx5 net driver.** * Added support for Network Service Header (NSH) flow matching. + * Added support for ``RTE_FLOW_ACTION_TYPE_INDIRECT_LIST`` flow action. * **Updated Solarflare net driver.**
drivers/net/mlx5/mlx5.c +1 -0
@@ -2168,6 +2168,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)/* Free the eCPRI flex parser resource. */ mlx5_flex_parser_ecpri_release (dev);mlx5_flex_item_port_cleanup (dev); +mlx5_indirect_list_handles_release (dev);#ifdef HAVE_MLX5_HWS_SUPPORT flow_hw_destroy_vport_action (dev);flow_hw_resource_release (dev);
drivers/net/mlx5/mlx5.h +2 -0
@@ -1791,6 +1791,8 @@ struct mlx5_priv { LIST_HEAD(ind_tables, mlx5_ind_table_obj) ind_tbls;/* Standalone indirect tables. */ LIST_HEAD(stdl_ind_tables, mlx5_ind_table_obj) standalone_ind_tbls; +/* Objects created with indirect list action */ + LIST_HEAD(indirect_list, mlx5_indirect_list) indirect_list_head;/* Pointer to next element. */ rte_rwlock_t ind_tbls_lock;uint32_t refcnt;/**< Reference counter. */
drivers/net/mlx5/mlx5_flow.c +134 -0
164 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +68 -1
121 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +611 -4
693 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v6 9/10 net/mlx5: reformat HWS code for indirect list actions
In reply to Gregory EtelsonReformat HWS code for indirect list actions.
--- drivers/net/mlx5/mlx5_flow.h | 4 +- drivers/net/mlx5/mlx5_flow_hw.c | 250 +++++++++++++++++--------------- 2 files changed, 139 insertions(+), 115 deletions(-)
drivers/net/mlx5/mlx5_flow.h +2 -2
@@ -1331,11 +1331,11 @@ struct rte_flow_actions_template {uint64_t action_flags;/* Bit-map of all valid action in template. */ uint16_t dr_actions_num;/* Amount of DR rules actions. */ uint16_t actions_num;/* Amount of flow actions */ -uint16_t *actions_off;/* DR action offset for given rte action offset. */ +uint16_t *dr_off;/* DR action offset for given rte action offset. */ +uint16_t *src_off;/* RTE action displacement from app. template */ uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint32_t refcnt;/* Reference counter. */ -uint16_t rx_cpy_pos;/* Action position of Rx metadata to be copied. */ uint8_t flex_item;/* flex item index. */ };
drivers/net/mlx5/mlx5_flow_hw.c +137 -113
663 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v6 10/10 net/mlx5: support indirect list METER_MARK action
In reply to Gregory Etelson--- drivers/net/mlx5/mlx5_flow.c | 69 ++++- drivers/net/mlx5/mlx5_flow.h | 70 ++++-- drivers/net/mlx5/mlx5_flow_hw.c | 430 +++++++++++++++++++++++++++----- 3 files changed, 484 insertions(+), 85 deletions(-)
drivers/net/mlx5/mlx5_flow.c +67 -2
@@ -75,8 +75,11 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)switch (e->type) {#ifdef HAVE_MLX5_HWS_SUPPORT case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR : -mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e, true); +mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e);break ; +case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY : +mlx5_destroy_legacy_indirect (dev, e); +break ;#endif default :DRV_LOG (ERR ,"invalid indirect list type" );
@@ -1169,7 +1172,24 @@ mlx5_flow_async_action_list_handle_destroyconst struct rte_flow_op_attr *op_attr, struct rte_flow_action_list_handle *action_handle, void *user_data, struct rte_flow_error *error); - +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error); +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const struct rte_flow_op_attr *attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error);static const struct rte_flow_ops mlx5_flow_ops = { .validate = mlx5_flow_validate, .create = mlx5_flow_create,
@@ -1219,6 +1239,10 @@ static const struct rte_flow_ops mlx5_flow_ops = { mlx5_flow_async_action_list_handle_create, .async_action_list_handle_destroy = mlx5_flow_async_action_list_handle_destroy, + .action_list_handle_query_update = + mlx5_flow_action_list_handle_query_update, + .async_action_list_handle_query_update = + mlx5_flow_async_action_list_handle_query_update, };/* Tunnel information. */
@@ -11003,6 +11027,47 @@ mlx5_flow_async_action_list_handle_destroy error); } +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + action_list_handle_query_update,ENOTSUP ); +return fops->action_list_handle_query_update (dev, handle, update, query, + mode, error); +} + +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const +struct rte_flow_op_attr *op_attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum +rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + async_action_list_handle_query_update,ENOTSUP ); +return fops->async_action_list_handle_query_update (dev, queue_id, op_attr, + handle, update, + query, mode, + user_data, error); +} + +/** * Destroy all indirect actions (shared RSS). *
drivers/net/mlx5/mlx5_flow.h +54 -16
123 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +363 -67
606 lines not on this page · raw message
Signature · 1 line
2.39.2
v7 cover net/mlx5: support indirect actions list
In reply to Gregory EtelsonAdd MLX5 PMD support for indirect actions list.
Erez Shitrit (1):
net/mlx5/hws: allow destination into default miss FT
Gregory Etelson (4):
net/mlx5: reformat HWS code for HWS mirror action net/mlx5: support HWS mirror action net/mlx5: reformat HWS code for indirect list actions net/mlx5: support indirect list METER_MARK action
Haifei Luo (1):
net/mlx5/hws: support reformat for hws mirror
Hamdan Igbaria (3):
net/mlx5/hws: add support for reformat DevX object net/mlx5/hws: support creating of dynamic forward table and FTE net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
Shun Hao (1):
net/mlx5/hws: add support for mirroring
doc/guides/nics/features/mlx5.ini | 1 + doc/guides/rel_notes/release_23_11.rst | 1 + drivers/common/mlx5/mlx5_prm.h | 81 +- drivers/net/mlx5/hws/mlx5dr.h | 34 + drivers/net/mlx5/hws/mlx5dr_action.c | 210 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 8 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 143 ++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 49 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_internal.h | 5 + drivers/net/mlx5/hws/mlx5dr_send.c | 5 - drivers/net/mlx5/hws/mlx5dr_table.c | 8 +- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 199 ++++ drivers/net/mlx5/mlx5_flow.h | 111 ++- drivers/net/mlx5/mlx5_flow_hw.c | 1217 +++++++++++++++++++++--- 17 files changed, 1908 insertions(+), 168 deletions(-)
Signature · 8 lines
v3: Add ACK to patches in the series.
v4: Squash reformat patches.
v5: Update release notes.
Fix code style.
v6: Fix code style.
v7: Fix incremental compilation failure.
--
2.39.2PATCH v7 1/10 net/mlx5/hws: add support for reformat DevX object
From: Hamdan Igbaria <[email protected]>
Add support for creation of packet reformat object, via the ALLOC_PACKET_REFORMAT_CONTEXT command.
--- drivers/common/mlx5/mlx5_prm.h | 39 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 60 ++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 +++++ drivers/net/mlx5/hws/mlx5dr_internal.h | 5 +++ drivers/net/mlx5/hws/mlx5dr_send.c | 5 --- 5 files changed, 115 insertions(+), 5 deletions(-)
drivers/common/mlx5/mlx5_prm.h +39 -0
@@ -1218,6 +1218,8 @@ enum {MLX5_CMD_OP_CREATE_FLOW_GROUP =0x933 ,MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY =0x936 ,MLX5_CMD_OP_MODIFY_FLOW_TABLE =0x93c , +MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT =0x93d , +MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT =0x93e ,MLX5_CMD_OP_ALLOC_FLOW_COUNTER =0x939 ,MLX5_CMD_OP_QUERY_FLOW_COUNTER =0x93b , MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00,
@@ -5191,6 +5193,43 @@ struct mlx5_ifc_modify_flow_table_out_bits {u8 reserved_at_40[0x60 ]; }; +struct mlx5_ifc_packet_reformat_context_in_bits { +u8 reformat_type[0x8 ]; +u8 reserved_at_8[0x4 ]; +u8 reformat_param_0[0x4 ]; +u8 reserved_at_16[0x6 ]; +u8 reformat_data_size[0xa ]; + +u8 reformat_param_1[0x8 ]; +u8 reserved_at_40[0x8 ]; +u8 reformat_data[6 ][0x8 ]; + +u8 more_reformat_data[][0x8 ]; +}; + +struct mlx5_ifc_alloc_packet_reformat_context_in_bits { +u8 opcode[0x10 ]; +u8 uid[0x10 ]; + +u8 reserved_at_20[0x10 ]; +u8 op_mod[0x10 ]; + +u8 reserved_at_40[0xa0 ]; + +u8 packet_reformat_context[]; +}; + +struct mlx5_ifc_alloc_packet_reformat_out_bits { +u8 status[0x8 ]; +u8 reserved_at_8[0x18 ]; + +u8 syndrome[0x20 ]; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; +/* CQE format mask. */ #define MLX5E_CQE_FORMAT_MASK 0xc
drivers/net/mlx5/hws/mlx5dr_cmd.c +60 -0
66 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +11 -0
@@ -155,6 +155,13 @@ struct mlx5dr_cmd_allow_other_vhca_access_attr {uint8_t access_key[ACCESS_KEY_LEN ]; }; +struct mlx5dr_cmd_packet_reformat_create_attr { +uint8_t type; +size_t data_sz; +void *data; +uint8_t reformat_param_0; +}; +struct mlx5dr_cmd_query_ft_caps {uint8_t max_level;uint8_t reparse;
@@ -285,6 +292,10 @@ mlx5dr_cmd_forward_tbl_create(struct ibv_context *ctx,void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj * +mlx5dr_cmd_packet_reformat_create (struct ibv_context *ctx, +struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
drivers/net/mlx5/hws/mlx5dr_internal.h +5 -0
@@ -91,4 +91,9 @@ static inline uint64_t roundup_pow_of_two(uint64_t n) return n == 1 ? 1 : 1ULL << log2above(n); } +static inline unsigned long align (unsigned long val,unsigned long align) +{ +return (val + align -1 ) & ~(align -1 ); +} +#endif /* MLX5DR_INTERNAL_H_ */
drivers/net/mlx5/hws/mlx5dr_send.c +0 -5
@@ -668,11 +668,6 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,return err; } -static inline unsigned long align (unsigned long val,unsigned long align) -{ -return (val + align -1 ) & ~(align -1 ); -} - static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx, struct mlx5dr_send_engine *queue, struct mlx5dr_send_ring_sq *sq,
Signature · 1 line
2.39.2
PATCH v7 2/10 net/mlx5/hws: support creating of dynamic forward table and FTE
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add the ability to create forward table and FTE.
--- drivers/common/mlx5/mlx5_prm.h | 4 ++++ drivers/net/mlx5/hws/mlx5dr_cmd.c | 13 +++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+)
drivers/common/mlx5/mlx5_prm.h +4 -0
@@ -5048,7 +5048,11 @@ enum mlx5_flow_destination_type { };enum mlx5_flow_context_action { +MLX5_FLOW_CONTEXT_ACTION_DROP =1 <<1 ,MLX5_FLOW_CONTEXT_ACTION_FWD_DEST =1 <<2 , +MLX5_FLOW_CONTEXT_ACTION_REFORMAT =1 <<4 , +MLX5_FLOW_CONTEXT_ACTION_DECRYPT =1 <<12 , +MLX5_FLOW_CONTEXT_ACTION_ENCRYPT =1 <<13 , };enum mlx5_flow_context_flow_source {
drivers/net/mlx5/hws/mlx5dr_cmd.c +13 -0
@@ -42,6 +42,7 @@ mlx5dr_cmd_flow_table_create(struct ibv_context *ctx, ft_ctx =MLX5_ADDR_OF (create_flow_table_in, in, flow_table_context);MLX5_SET (flow_table_context, ft_ctx, level, ft_attr->level);MLX5_SET (flow_table_context, ft_ctx, rtc_valid, ft_attr->rtc_valid); +MLX5_SET (flow_table_context, ft_ctx, reformat_en, ft_attr->reformat_en); devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));if (!devx_obj->obj) {
@@ -182,12 +183,24 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, action_flags = fte_attr->action_flags;MLX5_SET (flow_context, in_flow_context, action, action_flags); +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_REFORMAT ) +MLX5_SET (flow_context, in_flow_context, + packet_reformat_id, fte_attr->packet_reformat_id); + +if (action_flags & (MLX5_FLOW_CONTEXT_ACTION_DECRYPT |MLX5_FLOW_CONTEXT_ACTION_ENCRYPT )) { +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_type, fte_attr->encrypt_decrypt_type); +MLX5_SET (flow_context, in_flow_context, + encrypt_decrypt_obj_id, fte_attr->encrypt_decrypt_obj_id); + } +if (action_flags &MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ) {/* Only destination_list_size of size 1 is supported */ MLX5_SET (flow_context, in_flow_context, destination_list_size,1 ); in_dests =MLX5_ADDR_OF (flow_context, in_flow_context, destination);MLX5_SET (dest_format, in_dests, destination_type, fte_attr->destination_type);MLX5_SET (dest_format, in_dests, destination_id, fte_attr->destination_id); +MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); } devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));
drivers/net/mlx5/hws/mlx5dr_cmd.h +19 -0
@@ -7,8 +7,12 @@struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t encrypt_decrypt_type; +uint32_t encrypt_decrypt_obj_id; +uint32_t packet_reformat_id;uint8_t destination_type;uint32_t destination_id; +uint8_t ignore_flow_level;uint8_t flow_source; };
@@ -16,6 +20,7 @@ struct mlx5dr_cmd_ft_create_attr {uint8_t type;uint8_t level;bool rtc_valid; +uint8_t reformat_en; };#define ACCESS_KEY_LEN 32
@@ -296,6 +301,20 @@ struct mlx5dr_devx_obj * mlx5dr_cmd_packet_reformat_create(struct ibv_context *ctx, struct mlx5dr_cmd_packet_reformat_create_attr *attr); +struct mlx5dr_devx_obj * +mlx5dr_cmd_set_fte (struct ibv_context *ctx, +uint32_t table_type, +uint32_t table_id, +uint32_t group_id, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +struct mlx5dr_cmd_forward_tbl * +mlx5dr_cmd_forward_tbl_create (struct ibv_context *ctx, +struct mlx5dr_cmd_ft_create_attr *ft_attr, +struct mlx5dr_cmd_set_fte_attr *fte_attr); + +void mlx5dr_cmd_forward_tbl_destroy (struct mlx5dr_cmd_forward_tbl *tbl); +struct mlx5dr_devx_obj *mlx5dr_cmd_alias_obj_create (struct ibv_context *ctx,struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
Signature · 1 line
2.39.2
PATCH v7 3/10 net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action
In reply to Gregory EtelsonFrom: Hamdan Igbaria <[email protected]>
Add mlx5dr_devx_obj struct to mlx5dr_action, so we could hold the FT obj in dest table action.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 4 ++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +++ drivers/net/mlx5/hws/mlx5dr_table.c | 1 - 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +4 -0
@@ -787,6 +787,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, tbl->ft);if (ret) goto free_action; + + action->devx_dest.devx_obj = tbl->ft; }return action;
@@ -864,6 +866,8 @@ mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_stcs (action, cur_obj);if (ret) goto clean_obj; + + action->devx_dest.devx_obj = cur_obj; }return action;
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -148,6 +148,9 @@ struct mlx5dr_action {struct {struct mlx5dv_steering_anchor *sa; } root_tbl; +struct { +struct mlx5dr_devx_obj *devx_obj; + } devx_dest; }; };
drivers/net/mlx5/hws/mlx5dr_table.c +0 -1
@@ -68,7 +68,6 @@ static void mlx5dr_table_down_default_fdb_miss_tbl(struct mlx5dr_table *tbl)return ;mlx5dr_cmd_forward_tbl_destroy (default_miss); - ctx->common_res[tbl_type].default_miss =NULL ; }
Signature · 1 line
2.39.2
PATCH v7 4/10 net/mlx5/hws: add support for mirroring
In reply to Gregory EtelsonFrom: Shun Hao <[email protected]>
This patch supports mirroring by adding an dest_array action. The action accecpts a list containing multiple destination actions, and can duplicate packet and forward to each destination in the list.
--- drivers/common/mlx5/mlx5_prm.h | 23 ++++- drivers/net/mlx5/hws/mlx5dr.h | 34 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 130 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 3 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 64 ++++++++++--- drivers/net/mlx5/hws/mlx5dr_cmd.h | 21 ++++- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_table.c | 7 +- 8 files changed, 262 insertions(+), 21 deletions(-)
drivers/common/mlx5/mlx5_prm.h +20 -3
@@ -2320,7 +2320,11 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { };struct mlx5_ifc_esw_cap_bits { -u8 reserved_at_0[0x60 ]; +u8 reserved_at_0[0x1d ]; +u8 merged_eswitch[0x1 ]; +u8 reserved_at_1e[0x2 ]; + +u8 reserved_at_20[0x40 ];u8 esw_manager_vport_number_valid[0x1 ];u8 reserved_at_61[0xf ];
@@ -5045,6 +5049,7 @@ struct mlx5_ifc_query_flow_table_out_bits {enum mlx5_flow_destination_type {MLX5_FLOW_DESTINATION_TYPE_VPORT =0x0 ,MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE =0x1 , +MLX5_FLOW_DESTINATION_TYPE_TIR =0x2 , };enum mlx5_flow_context_action {
@@ -5088,6 +5093,19 @@ union mlx5_ifc_dest_format_flow_counter_list_auto_bits {u8 reserved_at_0[0x40 ]; }; +struct mlx5_ifc_extended_dest_format_bits { +struct mlx5_ifc_dest_format_bits destination_entry; + +u8 packet_reformat_id[0x20 ]; + +u8 reserved_at_60[0x20 ]; +}; + +#define MLX5_IFC_MULTI_PATH_FT_MAX_LEVEL 64 + +#ifdef PEDANTIC +#pragma GCC diagnostic ignored "-Wpedantic" +#endif struct mlx5_ifc_flow_context_bits {u8 reserved_at_00[0x20 ];u8 group_id[0x20 ];
@@ -5106,8 +5124,7 @@ struct mlx5_ifc_flow_context_bits {u8 reserved_at_e0[0x40 ];u8 encrypt_decrypt_obj_id[0x20 ];u8 reserved_at_140[0x16c0 ]; -/* Currently only one destnation */ -union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[1 ]; +union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0 ]; };struct mlx5_ifc_set_fte_in_bits {
drivers/net/mlx5/hws/mlx5dr.h +34 -0
@@ -46,6 +46,7 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_ASO_METER ,MLX5DR_ACTION_TYP_ASO_CT ,MLX5DR_ACTION_TYP_DEST_ROOT , +MLX5DR_ACTION_TYP_DEST_ARRAY , MLX5DR_ACTION_TYP_MAX, };
@@ -213,6 +214,20 @@ struct mlx5dr_rule_action { }; }; +struct mlx5dr_action_dest_attr { +/* Required action combination */ +enum mlx5dr_action_type *action_type; + +/* Required destination action to forward the packet */ +struct mlx5dr_action *dest; + +/* Optional reformat data */ +struct { +size_t reformat_data_sz; +void *reformat_data; + } reformat; +}; +/* Open a context used for direct rule insertion using hardware steering. * Each context can contain multiple tables of different types. *
@@ -616,6 +631,25 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags);struct mlx5dr_action *mlx5dr_action_create_push_vlan (struct mlx5dr_context *ctx,uint32_t flags); +/* Create a dest array action, this action can duplicate packets and forward to +* multiple destinations in the destination list. +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] num_dest +* The number of dests attributes. +* @param[in] dests +* The destination array. Each contains a destination action and can have +* additional actions. +* @param[in] flags +* Action creation flags. (enum mlx5dr_action_flags) +* @return pointer to mlx5dr_action on success NULL otherwise. +*/ +struct mlx5dr_action * +mlx5dr_action_create_dest_array (struct mlx5dr_context *ctx, +size_t num_dest, +struct mlx5dr_action_dest_attr *dests, +uint32_t flags); +/* Create dest root table, this action will jump to root table according * the given priority. * @param[in] ctx
drivers/net/mlx5/hws/mlx5dr_action.c +128 -2
166 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
@@ -151,6 +151,9 @@ struct mlx5dr_action {struct {struct mlx5dr_devx_obj *devx_obj; } devx_dest; +struct { +struct mlx5dr_cmd_forward_tbl *fw_island; + } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +54 -10
109 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_cmd.h +17 -4
@@ -5,15 +5,27 @@#ifndef MLX5DR_CMD_H_ #define MLX5DR_CMD_H_ +enum mlx5dr_cmd_ext_dest_flags { +MLX5DR_CMD_EXT_DEST_REFORMAT =1 <<0 , +MLX5DR_CMD_EXT_DEST_ESW_OWNER_VHCA_ID =1 <<1 , +}; + +struct mlx5dr_cmd_set_fte_dest { +uint8_t destination_type; +uint32_t destination_id; +enum mlx5dr_cmd_ext_dest_flags ext_flags; +uint16_t esw_owner_vhca_id; +}; +struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags; +uint8_t ignore_flow_level; +uint8_t flow_source;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id; -uint8_t destination_type; -uint32_t destination_id; -uint8_t ignore_flow_level; -uint8_t flow_source; +uint32_t dests_num; +struct mlx5dr_cmd_set_fte_dest *dests; }; struct mlx5dr_cmd_ft_create_attr {
@@ -216,6 +228,7 @@ struct mlx5dr_cmd_query_caps {struct mlx5dr_cmd_query_ft_caps nic_ft;struct mlx5dr_cmd_query_ft_caps fdb_ft;bool eswitch_manager; +uint8_t merged_eswitch;uint32_t eswitch_manager_vport_number;uint8_t log_header_modify_argument_granularity;uint8_t log_header_modify_argument_max_alloc;
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
@@ -23,6 +23,7 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_ASO_METER] = "ASO_METER", [MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT", [MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT", + [MLX5DR_ACTION_TYP_DEST_ARRAY ] ="DEST_ARRAY" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/hws/mlx5dr_table.c +5 -2
@@ -22,6 +22,7 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)struct mlx5dr_cmd_ft_create_attr ft_attr = {0 };struct mlx5dr_cmd_set_fte_attr fte_attr = {0 };struct mlx5dr_cmd_forward_tbl *default_miss; +struct mlx5dr_cmd_set_fte_dest dest = {0 };struct mlx5dr_context *ctx = tbl->ctx;uint8_t tbl_type = tbl->type;
@@ -37,9 +38,11 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl) ft_attr.level = tbl->ctx->caps->fdb_ft.max_level;/* The last level */ ft_attr.rtc_valid = false; + dest.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest.destination_id = ctx->caps->eswitch_manager_vport_number; fte_attr.action_flags =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; - fte_attr.destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; - fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number; + fte_attr.dests_num =1 ; + fte_attr.dests = &dest; default_miss =mlx5dr_cmd_forward_tbl_create (mlx5dr_context_get_local_ibv (ctx), &ft_attr, &fte_attr);
Signature · 1 line
2.39.2
PATCH v7 5/10 net/mlx5/hws: allow destination into default miss FT
In reply to Gregory EtelsonFrom: Erez Shitrit <[email protected]>
In FDB it will direct the packet into the hypervisor vport. That allows the user to mirror packets into the default-miss vport.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/mlx5/hws/mlx5dr_action.c +11 -0
@@ -1769,6 +1769,17 @@ mlx5dr_action_create_dest_array(struct mlx5dr_context *ctx, fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; fte_attr.ignore_flow_level =1 ;break ; +case MLX5DR_ACTION_TYP_MISS : +if (table_type !=MLX5DR_TABLE_TYPE_FDB ) { +DR_LOG (ERR ,"Miss action supported for FDB only" ); + rte_errno =ENOTSUP ; + goto free_dest_list; + } + dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; + dest_list[i].destination_id = + ctx->caps->eswitch_manager_vport_number; + fte_attr.action_flags |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; +break ;case MLX5DR_ACTION_TYP_VPORT : dest_list[i].destination_type =MLX5_FLOW_DESTINATION_TYPE_VPORT ; dest_list[i].destination_id = dests[i].dest->vport.vport_num;
Signature · 1 line
2.39.2
PATCH v7 6/10 net/mlx5/hws: support reformat for hws mirror
In reply to Gregory EtelsonFrom: Haifei Luo <[email protected]>
In dest_array action, an optional reformat action can be applied to each destination. This patch supports this by using the extended destination entry.
--- drivers/common/mlx5/mlx5_prm.h | 15 +++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 67 +++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 2 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 10 ++++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 2 + 5 files changed, 94 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_prm.h +15 -0
@@ -5352,6 +5352,21 @@ enum mlx5_parse_graph_arc_node_index { MLX5_GRAPH_ARC_NODE_PROGRAMMABLE = 0x1f, }; +enum mlx5_packet_reformat_context_reformat_type { +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L2_TUNNEL =0x2 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_TUNNEL =0x4 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV4 =0x5 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L2_TO_L3_ESP_TUNNEL =0x6 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV4 =0x7 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT =0x8 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_L3_ESP_TUNNEL_TO_L2 =0x9 , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_DEL_ESP_TRANSPORT_OVER_UDP =0xA , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_IPV6 =0xB , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_ESP_TRANSPORT_OVER_UDPV6 =0xC , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_ADD_NISP_TNL =0xD , +MLX5_PACKET_REFORMAT_CONTEXT_REFORMAT_TYPE_REMOVE_NISP_TNL =0xE , +}; +#define MLX5_PARSE_GRAPH_FLOW_SAMPLE_MAX 8#define MLX5_PARSE_GRAPH_IN_ARC_MAX 8#define MLX5_PARSE_GRAPH_OUT_ARC_MAX 8
drivers/net/mlx5/hws/mlx5dr_action.c +66 -1
104 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +2 -0
@@ -153,6 +153,8 @@ struct mlx5dr_action { } devx_dest;struct {struct mlx5dr_cmd_forward_tbl *fw_island; +size_t num_dest; +struct mlx5dr_cmd_set_fte_dest *dest_list; } dest_array; }; };
drivers/net/mlx5/hws/mlx5dr_cmd.c +9 -1
@@ -169,7 +169,9 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx,uint32_t *in;uint32_t i; - dest_entry_sz =MLX5_ST_SZ_BYTES (dest_format); + dest_entry_sz = fte_attr->extended_dest ? +MLX5_ST_SZ_BYTES (extended_dest_format) : +MLX5_ST_SZ_BYTES (dest_format); total_dest_sz = dest_entry_sz * fte_attr->dests_num; inlen =align ((MLX5_ST_SZ_BYTES (set_fte_in) + total_dest_sz),DW_SIZE ); in =simple_calloc (1 , inlen);
@@ -192,6 +194,7 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, in_flow_context =MLX5_ADDR_OF (set_fte_in, in, flow_context);MLX5_SET (flow_context, in_flow_context, group_id, group_id);MLX5_SET (flow_context, in_flow_context, flow_source, fte_attr->flow_source); +MLX5_SET (flow_context, in_flow_context, extended_destination, fte_attr->extended_dest);MLX5_SET (set_fte_in, in, ignore_flow_level, fte_attr->ignore_flow_level); action_flags = fte_attr->action_flags;
@@ -230,6 +233,11 @@ mlx5dr_cmd_set_fte(struct ibv_context *ctx, dest->destination_type);MLX5_SET (dest_format, in_dests, destination_id, dest->destination_id); +if (dest->ext_flags &MLX5DR_CMD_EXT_DEST_REFORMAT ) { +MLX5_SET (dest_format, in_dests, packet_reformat,1 ); +MLX5_SET (extended_dest_format, in_dests, packet_reformat_id, + dest->ext_reformat->id); + }break ;default : rte_errno =EOPNOTSUPP ;
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
@@ -14,6 +14,7 @@ struct mlx5dr_cmd_set_fte_dest {uint8_t destination_type;uint32_t destination_id;enum mlx5dr_cmd_ext_dest_flags ext_flags; +struct mlx5dr_devx_obj *ext_reformat;uint16_t esw_owner_vhca_id; };
@@ -21,6 +22,7 @@ struct mlx5dr_cmd_set_fte_attr {uint32_t action_flags;uint8_t ignore_flow_level;uint8_t flow_source; +uint8_t extended_dest;uint8_t encrypt_decrypt_type;uint32_t encrypt_decrypt_obj_id;uint32_t packet_reformat_id;
Signature · 1 line
2.39.2
PATCH v7 7/10 net/mlx5: reformat HWS code for HWS mirror action
In reply to Gregory EtelsonReformat HWS code for HWS mirror action.
--- drivers/net/mlx5/mlx5_flow_hw.c | 70 ++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 31 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +39 -31
@@ -4548,6 +4548,17 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT, }; +static inline void +action_template_set_type (struct rte_flow_actions_template *at, +enum mlx5dr_action_type *action_types, +unsigned int action_src,uint16_t *curr_off, +enum mlx5dr_action_type type) +{ + at->actions_off[action_src] = *curr_off; + action_types[*curr_off] = type; + *curr_off = *curr_off +1 ; +} + static int flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, unsigned int action_src,
@@ -4565,9 +4576,8 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask, type = mask->type;switch (type) {case RTE_FLOW_ACTION_TYPE_RSS : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_TIR ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_TIR );break ;case RTE_FLOW_ACTION_TYPE_AGE :case RTE_FLOW_ACTION_TYPE_COUNT :
@@ -4575,23 +4585,20 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,* Both AGE and COUNT action need counter, the first one fills * the action_types array, and the second only saves the offset. */ -if (*cnt_off ==UINT16_MAX ) { - *cnt_off = *curr_off; - action_types[*cnt_off] =MLX5DR_ACTION_TYP_CTR ; - *curr_off = *curr_off +1 ; - } +if (*cnt_off ==UINT16_MAX ) +action_template_set_type (at, action_types, + action_src, curr_off, +MLX5DR_ACTION_TYP_CTR ); at->actions_off[action_src] = *cnt_off;break ;case RTE_FLOW_ACTION_TYPE_CONNTRACK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_CT ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_CT );break ;case RTE_FLOW_ACTION_TYPE_QUOTA :case RTE_FLOW_ACTION_TYPE_METER_MARK : - at->actions_off[action_src] = *curr_off; - action_types[*curr_off] =MLX5DR_ACTION_TYP_ASO_METER ; - *curr_off = *curr_off +1 ; +action_template_set_type (at, action_types, action_src, curr_off, +MLX5DR_ACTION_TYP_ASO_METER );break ;default :DRV_LOG (WARNING ,"Unsupported shared action type: %d" , type);
@@ -5101,31 +5108,32 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, at->reformat_off =UINT16_MAX ; at->mhdr_off =UINT16_MAX ; at->rx_cpy_pos = pos; -/* -* mlx5 PMD hacks indirect action index directly to the action conf. -* The rte_flow_conv() function copies the content from conf pointer. -* Need to restore the indirect action index from action conf here. -*/ for (i =0 ; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++, masks++, i++) { -if (actions->type ==RTE_FLOW_ACTION_TYPE_INDIRECT ) { +const struct rte_flow_action_modify_field *info; + +switch (actions->type) { +/* +* mlx5 PMD hacks indirect action index directly to the action conf. +* The rte_flow_conv() function copies the content from conf pointer. +* Need to restore the indirect action index from action conf here. +*/ +case RTE_FLOW_ACTION_TYPE_INDIRECT : at->actions[i].conf = actions->conf; at->masks[i].conf = masks->conf; - } -if (actions->type ==RTE_FLOW_ACTION_TYPE_MODIFY_FIELD ) { -const struct rte_flow_action_modify_field *info = actions->conf; - +break ; +case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD : + info = actions->conf;if ((info->dst.field ==RTE_FLOW_FIELD_FLEX_ITEM &&flow_hw_flex_item_acquire (dev, info->dst.flex_handle, &at->flex_item)) || - (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && -flow_hw_flex_item_acquire (dev, info->src.flex_handle, - &at->flex_item))) { -rte_flow_error_set (error, rte_errno, -RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , -"Failed to acquire flex item" ); + (info->src.field ==RTE_FLOW_FIELD_FLEX_ITEM && +flow_hw_flex_item_acquire (dev, info->src.flex_handle, + &at->flex_item))) goto error; - } +break ; +default : +break ; } } at->tmpl =flow_hw_dr_actions_template_create (at);
Signature · 1 line
2.39.2
PATCH v7 8/10 net/mlx5: support HWS mirror action
In reply to Gregory EtelsonHWS mirror clones original packet to one or two destinations and proceeds with the original packet path.
The mirror has no dedicated RTE flow action type. Mirror object is referenced by INDIRECT_LIST action. INDIRECT_LIST for a mirror built from actions list:
SAMPLE [/ SAMPLE] / <Orig. packet destination> / END
Mirror SAMPLE action defines packet clone. It specifies the clone destination and optional clone reformat action. Destination action for both clone and original packet depends on HCA domain:
- for NIC RX, destination is ether RSS or QUEUE
- for FDB, destination is PORT
HWS mirror was implemented with the INDIRECT_LIST flow action.
MLX5 PMD defines general struct mlx5_indirect_list type for all. INDIRECT_LIST handler objects:
struct mlx5_indirect_list {
enum mlx5_indirect_list_type type;
LIST_ENTRY(mlx5_indirect_list) chain;
char data[];
};Specific INDIRECT_LIST type must overload mlx5_indirect_list::data and provide unique type value.
PMD returns a pointer to mlx5_indirect_list object.
Existing non-masked actions template API cannot identify flow actions in INDIRECT_LIST handler because INDIRECT_LIST handler can represent several flow actions.
For example:
A: SAMPLE / JUMP
B: SAMPE / SAMPLE / RSS
Actions template command
template indirect_list / end mask indirect_list 0 / end
does not provide any information to differentiate between flow actions in A and B.
MLX5 PMD requires INDIRECT_LIST configuration parameter in the template section:
Non-masked INDIRECT_LIST API:
=============================
template indirect_list X / end mask indirect_list 0 / end
PMD identifies type of X handler and will use the same type in template creation. Actual parameters for actions in the list will be extracted from flow configuration
Masked INDIRECT_LIST API:
=========================
template indirect_list X / end mask indirect_list -lUL / end
PMD creates action template from actions types and configurations referenced by X.
INDIRECT_LIST action without configuration is invalid and will be rejected by PMD.
--- doc/guides/nics/features/mlx5.ini | 1 + doc/guides/rel_notes/release_23_11.rst | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 134 ++++++ drivers/net/mlx5/mlx5_flow.h | 69 ++- drivers/net/mlx5/mlx5_flow_hw.c | 616 ++++++++++++++++++++++++- 7 files changed, 819 insertions(+), 5 deletions(-)
doc/guides/nics/features/mlx5.ini +1 -0
@@ -106,6 +106,7 @@ drop = Y flag = Y inc_tcp_ack = Y inc_tcp_seq = Y +indirect_list = Y jump = Y mark = Y meter = Y
doc/guides/rel_notes/release_23_11.rst +1 -0
@@ -143,6 +143,7 @@ New Features * **Updated NVIDIA mlx5 net driver.** * Added support for Network Service Header (NSH) flow matching. + * Added support for ``RTE_FLOW_ACTION_TYPE_INDIRECT_LIST`` flow action. * **Updated Solarflare net driver.**
drivers/net/mlx5/mlx5.c +1 -0
@@ -2168,6 +2168,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)/* Free the eCPRI flex parser resource. */ mlx5_flex_parser_ecpri_release (dev);mlx5_flex_item_port_cleanup (dev); +mlx5_indirect_list_handles_release (dev);#ifdef HAVE_MLX5_HWS_SUPPORT flow_hw_destroy_vport_action (dev);flow_hw_resource_release (dev);
drivers/net/mlx5/mlx5.h +2 -0
@@ -1791,6 +1791,8 @@ struct mlx5_priv { LIST_HEAD(ind_tables, mlx5_ind_table_obj) ind_tbls;/* Standalone indirect tables. */ LIST_HEAD(stdl_ind_tables, mlx5_ind_table_obj) standalone_ind_tbls; +/* Objects created with indirect list action */ + LIST_HEAD(indirect_list, mlx5_indirect_list) indirect_list_head;/* Pointer to next element. */ rte_rwlock_t ind_tbls_lock;uint32_t refcnt;/**< Reference counter. */
drivers/net/mlx5/mlx5_flow.c +134 -0
164 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +68 -1
121 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +612 -4
694 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v7 9/10 net/mlx5: reformat HWS code for indirect list actions
In reply to Gregory EtelsonReformat HWS code for indirect list actions.
--- drivers/net/mlx5/mlx5_flow.h | 4 +- drivers/net/mlx5/mlx5_flow_hw.c | 235 ++++++++++++++++++-------------- 2 files changed, 131 insertions(+), 108 deletions(-)
drivers/net/mlx5/mlx5_flow.h +2 -2
@@ -1331,11 +1331,11 @@ struct rte_flow_actions_template {uint64_t action_flags;/* Bit-map of all valid action in template. */ uint16_t dr_actions_num;/* Amount of DR rules actions. */ uint16_t actions_num;/* Amount of flow actions */ -uint16_t *actions_off;/* DR action offset for given rte action offset. */ +uint16_t *dr_off;/* DR action offset for given rte action offset. */ +uint16_t *src_off;/* RTE action displacement from app. template */ uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint32_t refcnt;/* Reference counter. */ -uint16_t rx_cpy_pos;/* Action position of Rx metadata to be copied. */ uint8_t flex_item;/* flex item index. */ };
drivers/net/mlx5/mlx5_flow_hw.c +129 -106
613 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v7 10/10 net/mlx5: support indirect list METER_MARK action
In reply to Gregory EtelsonSupport indirect list METER_MARK action.
--- drivers/net/mlx5/mlx5_flow.c | 69 ++++- drivers/net/mlx5/mlx5_flow.h | 70 ++++-- drivers/net/mlx5/mlx5_flow_hw.c | 430 +++++++++++++++++++++++++++----- 3 files changed, 484 insertions(+), 85 deletions(-)
drivers/net/mlx5/mlx5_flow.c +67 -2
@@ -75,8 +75,11 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)switch (e->type) {#ifdef HAVE_MLX5_HWS_SUPPORT case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR : -mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e, true); +mlx5_hw_mirror_destroy (dev, (struct mlx5_mirror *)e);break ; +case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY : +mlx5_destroy_legacy_indirect (dev, e); +break ;#endif default :DRV_LOG (ERR ,"invalid indirect list type" );
@@ -1169,7 +1172,24 @@ mlx5_flow_async_action_list_handle_destroyconst struct rte_flow_op_attr *op_attr, struct rte_flow_action_list_handle *action_handle, void *user_data, struct rte_flow_error *error); - +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error); +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const struct rte_flow_op_attr *attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error);static const struct rte_flow_ops mlx5_flow_ops = { .validate = mlx5_flow_validate, .create = mlx5_flow_create,
@@ -1219,6 +1239,10 @@ static const struct rte_flow_ops mlx5_flow_ops = { mlx5_flow_async_action_list_handle_create, .async_action_list_handle_destroy = mlx5_flow_async_action_list_handle_destroy, + .action_list_handle_query_update = + mlx5_flow_action_list_handle_query_update, + .async_action_list_handle_query_update = + mlx5_flow_async_action_list_handle_query_update, };/* Tunnel information. */
@@ -11003,6 +11027,47 @@ mlx5_flow_async_action_list_handle_destroy error); } +static int +mlx5_flow_action_list_handle_query_update (struct rte_eth_dev *dev, +const +struct rte_flow_action_list_handle *handle, +const void **update,void **query, +enum rte_flow_query_update_mode mode, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + action_list_handle_query_update,ENOTSUP ); +return fops->action_list_handle_query_update (dev, handle, update, query, + mode, error); +} + +static int +mlx5_flow_async_action_list_handle_query_update (struct rte_eth_dev *dev, +uint32_t queue_id, +const +struct rte_flow_op_attr *op_attr, +const struct +rte_flow_action_list_handle *handle, +const void **update, +void **query, +enum +rte_flow_query_update_mode mode, +void *user_data, +struct rte_flow_error *error) +{ +const struct mlx5_flow_driver_ops *fops; + +MLX5_DRV_FOPS_OR_ERR (dev, fops, + async_action_list_handle_query_update,ENOTSUP ); +return fops->async_action_list_handle_query_update (dev, queue_id, op_attr, + handle, update, + query, mode, + user_data, error); +} + +/** * Destroy all indirect actions (shared RSS). *
drivers/net/mlx5/mlx5_flow.h +54 -16
123 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +363 -67
606 lines not on this page · raw message
Signature · 1 line
2.39.2
RE: [PATCH v7 00/10] net/mlx5: support indirect actions list
In reply to Gregory EtelsonHi,
Quoted 49 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Thursday, October 26, 2023 10:12 AM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Maayan Kashani <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: [PATCH v7 00/10] net/mlx5: support indirect actions listAdd MLX5 PMD support for indirect actions list.
Erez Shitrit (1):
net/mlx5/hws: allow destination into default miss FTGregory Etelson (4):
net/mlx5: reformat HWS code for HWS mirror action net/mlx5: support HWS mirror action net/mlx5: reformat HWS code for indirect list actions net/mlx5: support indirect listMETER_MARKactionHaifei Luo (1):
net/mlx5/hws: support reformat for hws mirrorHamdan Igbaria (3):
net/mlx5/hws: add support for reformat DevX objectnet/mlx5/hws: support creating of dynamic forward table and FTEnet/mlx5/hws: add mlx5dr DevX object struct to mlx5dr actionShun Hao (1):
net/mlx5/hws: add support for mirroringdoc/guides/nics/features/mlx5.ini | 1 + doc/guides/rel_notes/release_23_11.rst | 1 + drivers/common/mlx5/mlx5_prm.h | 81 +- drivers/net/mlx5/hws/mlx5dr.h | 34 + drivers/net/mlx5/hws/mlx5dr_action.c | 210 +++- drivers/net/mlx5/hws/mlx5dr_action.h | 8 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 143 ++- drivers/net/mlx5/hws/mlx5dr_cmd.h | 49 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_internal.h | 5 + drivers/net/mlx5/hws/mlx5dr_send.c | 5 - drivers/net/mlx5/hws/mlx5dr_table.c | 8 +- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.c | 199 ++++ drivers/net/mlx5/mlx5_flow.h | 111 ++- drivers/net/mlx5/mlx5_flow_hw.c | 1217 +++++++++++++++++++++--- 17 files changed, 1908 insertions(+), 168 deletions(-)
Quoted 9 lines
--
v3: Add ACK to patches in the series.
v4: Squash reformat patches.
v5: Update release notes.
Fix code style.
v6: Fix code style.
v7: Fix incremental compilation failure.
--
2.39.2
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh