add IPv6 extension push remove
cover add IPv6 extension push remove
Add new rte actions to push or remove specific IPv6 extension header from the network packets.
Rongwei Liu (8):
ethdev: add IPv6 extension push remove action app/testpmd: add IPv6 extension push remove cli net/mlx5/hws: add no reparse support
net/mlx5: sample the srv6 last segment
net/mlx5: generate srv6 modify header resource net/mlx5/hws: add IPv6 routing extension push pop actions net/mlx5/hws: add setter for IPv6 routing push pop net/mlx5: implement IPv6 routing push pop
app/test-pmd/cmdline_flow.c | 443 +++++++++++++++++++++- doc/guides/nics/mlx5.rst | 9 +- doc/guides/prog_guide/rte_flow.rst | 21 ++ drivers/common/mlx5/mlx5_prm.h | 1 + drivers/net/mlx5/hws/mlx5dr.h | 41 ++ drivers/net/mlx5/hws/mlx5dr_action.c | 524 +++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 5 + drivers/net/mlx5/hws/mlx5dr_cmd.c | 5 +- drivers/net/mlx5/hws/mlx5dr_cmd.h | 1 + drivers/net/mlx5/hws/mlx5dr_debug.c | 10 +- drivers/net/mlx5/hws/mlx5dr_matcher.c | 80 ++-- drivers/net/mlx5/hws/mlx5dr_matcher.h | 12 +- drivers/net/mlx5/hws/mlx5dr_rule.c | 65 +++- drivers/net/mlx5/mlx5.c | 42 ++- drivers/net/mlx5/mlx5.h | 31 ++ drivers/net/mlx5/mlx5_flow.h | 40 +- drivers/net/mlx5/mlx5_flow_dv.c | 386 +++++++++++++++++++ drivers/net/mlx5/mlx5_flow_hw.c | 268 ++++++++++++- lib/ethdev/rte_flow.c | 2 + lib/ethdev/rte_flow.h | 52 +++ 20 files changed, 1958 insertions(+), 80 deletions(-)
Signature · 1 line
2.27.0
PATCH 1/8 ethdev: add IPv6 extension push remove action
Add new rte_actions to push and remove the specific type of IPv6 extension to and from original packets.
A new extension to be pushed should be the last extension due to the next header awareness.
Remove can support the IPv6 extension in any position.
--- doc/guides/prog_guide/rte_flow.rst | 21 ++++++++++++ lib/ethdev/rte_flow.c | 2 ++ lib/ethdev/rte_flow.h | 52 ++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+)
doc/guides/prog_guide/rte_flow.rst +21 -0
@@ -3300,6 +3300,27 @@ The ``quota`` value is reduced according to ``mode`` setting. | ``RTE_FLOW_QUOTA_MODE_L3`` | Count packet bytes starting from L3 | +------------------+----------------------------------------------------+ +Action: ``IPV6_EXT_PUSH`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Add an IPv6 extension into IPv6 header and its template is provided in +its data buffer with the specific type as defined in the +``rte_flow_action_ipv6_ext_push`` definition. + +This action modifies the payload of matched flows. The data supplied must +be a valid extension in the specified type, it should be added the last one +if preceding extension existed. When applied to the original packet the +resulting packet must be a valid packet. + +Action: ``IPV6_EXT_REMOVE`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Remove an IPv6 extension whose type is provided in its type as defined in +the ``rte_flow_action_ipv6_ext_remove``. + +This action modifies the payload of matched flow and the packet should be +valid after removing. + Negative types ~~~~~~~~~~~~~~
lib/ethdev/rte_flow.c +2 -0
@@ -259,6 +259,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {MK_FLOW_ACTION (METER_MARK ,sizeof (struct rte_flow_action_meter_mark )),MK_FLOW_ACTION (SEND_TO_KERNEL ,0 ),MK_FLOW_ACTION (QUOTA ,sizeof (struct rte_flow_action_quota )), +MK_FLOW_ACTION (IPV6_EXT_PUSH ,sizeof (struct rte_flow_action_ipv6_ext_push )), + MK_FLOW_ACTION(IPV6_EXT_REMOVE, sizeof(struct rte_flow_action_ipv6_ext_remove)), };int
lib/ethdev/rte_flow.h +52 -0
64 lines not on this page · raw message
Signature · 1 line
2.27.0
RE: [PATCH v1 1/8] ethdev: add IPv6 extension push remove action
Hi Rongwei,
Quoted 144 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Monday, April 17, 2023 12:26 PMAdd new
rte_actionsto push and remove the specific type of IPv6 extension to and from original packets.A new extension to be pushed should be the last extension due to the next header awareness.
Remove can support the IPv6 extension in any position.
Signed-off-by Rongwei Liu <[email protected]>--- doc/guides/prog_guide/rte_flow.rst | 21 ++++++++++++ lib/ethdev/rte_flow.c | 2 ++ lib/ethdev/rte_flow.h | 52 ++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+)doc/guides/prog_guide/rte_flow.rst +0
-0@@ -3300,6 +3300,27 @@ The ``quota`` value is reduced according to``mode`` setting.
| ``RTE_FLOW_QUOTA_MODE_L3`` | Count packet bytes starting from L3 | +------------------+----------------------------------------------------+doc/guides/prog_guide/rte_flow.rst +21
-0+Action: ``IPV6_EXT_PUSH`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Add an IPv6 extension into IPv6 header and its template is provided in +its data buffer with the specific type as defined in the +``rte_flow_action_ipv6_ext_push`` definition. + +This action modifies the payload of matched flows. The data supplied must +be a valid extension in the specified type, it should be added the last one +if preceding extension existed. When applied to the original packet the +resulting packet must be a valid packet. + +Action: ``IPV6_EXT_REMOVE`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Remove an IPv6 extension whose type is provided in its type as defined in +the ``rte_flow_action_ipv6_ext_remove``. + +This action modifies the payload of matched flow and the packet should be +valid after removing. + Negative types ~~~~~~~~~~~~~~lib/ethdev/rte_flow.c +2
-0@@ -259,6 +259,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {MK_FLOW_ACTION (METER_MARK ,sizeof (struct rte_flow_action_meter_mark )),MK_FLOW_ACTION (SEND_TO_KERNEL ,0 ),MK_FLOW_ACTION (QUOTA ,sizeof (struct rte_flow_action_quota )), +MK_FLOW_ACTION (IPV6_EXT_PUSH ,sizeof (struct rte_flow_action_ipv6_ext_push )), + MK_FLOW_ACTION(IPV6_EXT_REMOVE, sizeof(struct
rte_flow_action_ipv6_ext_remove)),
};int
lib/ethdev/rte_flow.h +26
-0@@ -2912,6 +2912,25 @@ enum rte_flow_action_type {* applied to the given ethdev Rx queue. */ RTE_FLOW_ACTION_TYPE_SKIP_CMAN , + +/** +* RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH +* +* Push IPv6 extension into IPv6 packet. +* +* @see struct rte_flow_action_ipv6_ext_push. +*/ +RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH , + +/** +* RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE +* +* Remove IPv6 extension from IPv6 packet whose type +* is provided in its configuration buffer. +* +* @see struct rte_flow_action_ipv6_ext_remove. +*/ + RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE, };/** @@ -3352,6 +3371,39 @@ struct rte_flow_action_vxlan_encap {struct rte_flow_item *definition; }; +/** +* @warning +* @b EXPERIMENTAL: this structure may change without prior notice +* +* RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH +* +* Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH include:
+ *
+ * -IPV6_EXTTYPE /IPV6_EXT_HEADER_IN_TYPE/ END
+ *
+ * size holds the number of bytes in @p data.
+ * The data must be added as the last IPv6 extension.
+ */lib/ethdev/rte_flow.h +13
-0+struct rte_flow_action_ipv6_ext_push { +uint8_t *data;/**< IPv6 extension header data. */ +size_t size;/**< Size of @p data. */ +uint8_t type;/**< Type of IPv6 extension. */ +}; + +/** +* @warning +* @b EXPERIMENTAL: this structure may change without prior notice +* +* RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE +* +* Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE include:
+ *
+ * -IPV6_EXTTYPE / END
+ */lib/ethdev/rte_flow.h +4
-1+struct rte_flow_action_ipv6_ext_remove { +uint8_t type;/**< Type of IPv6 extension. */ +}; +/** * @warning * @b EXPERIMENTAL: this structure may change without prior notice --
Quoted 1 line
2.27.0
You need to add the new action to release notes.
cover add IPv6 extension push remove
Add new rte_actions to push and remove the specific type of IPv6 extension to and from original packets.
v1: Split the PMD implementation, add a description into release notes.
Rongwei Liu (2):
ethdev: add IPv6 extension push remove action
app/testpmd: add IPv6 extension push remove cli
app/test-pmd/cmdline_flow.c | 443 ++++++++++++++++++++++++- doc/guides/prog_guide/rte_flow.rst | 21 ++ doc/guides/rel_notes/release_23_07.rst | 6 + lib/ethdev/rte_flow.c | 2 + lib/ethdev/rte_flow.h | 52 +++ 5 files changed, 523 insertions(+), 1 deletion(-)
Signature · 1 line
2.27.0
PATCH 1/2 ethdev: add IPv6 extension push remove action
Add new rte_actions to push and remove the specific type of IPv6 extension to and from original packets.
A new extension to be pushed should be the last extension due to the next header awareness.
Remove can support the IPv6 extension in any position.
--- doc/guides/prog_guide/rte_flow.rst | 21 +++++++++++ doc/guides/rel_notes/release_23_07.rst | 6 +++ lib/ethdev/rte_flow.c | 2 + lib/ethdev/rte_flow.h | 52 ++++++++++++++++++++++++++ 4 files changed, 81 insertions(+)
doc/guides/prog_guide/rte_flow.rst +21 -0
@@ -3300,6 +3300,27 @@ The ``quota`` value is reduced according to ``mode`` setting. | ``RTE_FLOW_QUOTA_MODE_L3`` | Count packet bytes starting from L3 | +------------------+----------------------------------------------------+ +Action: ``IPV6_EXT_PUSH`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Add an IPv6 extension into IPv6 header and its template is provided in +its data buffer with the specific type as defined in the +``rte_flow_action_ipv6_ext_push`` definition. + +This action modifies the payload of matched flows. The data supplied must +be a valid extension in the specified type, it should be added the last one +if preceding extension existed. When applied to the original packet the +resulting packet must be a valid packet. + +Action: ``IPV6_EXT_REMOVE`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Remove an IPv6 extension whose type is provided in its type as defined in +the ``rte_flow_action_ipv6_ext_remove``. + +This action modifies the payload of matched flow and the packet should be +valid after removing. + Negative types ~~~~~~~~~~~~~~
doc/guides/rel_notes/release_23_07.rst +6 -0
@@ -27,6 +27,12 @@ New Features .. This section should contain new features added in this release. Sample format: + * **Added actions to push or remove the specific type of IPv6 extension.** + + Added ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH`` and ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH`` + to push or remove the specific IPv6 extension into or from the packets. + Push always put the new extension as the last one due to the next header awareness. + * **Add a title in the past tense with a full stop.** Add a short 1-2 sentence description in the past tense.
lib/ethdev/rte_flow.c +2 -0
@@ -259,6 +259,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {MK_FLOW_ACTION (METER_MARK ,sizeof (struct rte_flow_action_meter_mark )),MK_FLOW_ACTION (SEND_TO_KERNEL ,0 ),MK_FLOW_ACTION (QUOTA ,sizeof (struct rte_flow_action_quota )), +MK_FLOW_ACTION (IPV6_EXT_PUSH ,sizeof (struct rte_flow_action_ipv6_ext_push )), + MK_FLOW_ACTION(IPV6_EXT_REMOVE, sizeof(struct rte_flow_action_ipv6_ext_remove)), };int
lib/ethdev/rte_flow.h +52 -0
64 lines not on this page · raw message
Signature · 1 line
2.27.0
RE: [PATCH v1 1/2] ethdev: add IPv6 extension push remove action
Hi,
Quoted 7 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Wednesday, May 24, 2023 10:39 AMAdd new
rte_actionsto push and remove the specific type of IPv6 extension to and from original packets.
Quoted 7 lines
A new extension to be pushed should be the last extension due to the next header awareness.
Remove can support the IPv6 extension in any position.
Signed-off-by Rongwei Liu <[email protected]>---
Best,
Ori
PATCH 2/2 app/testpmd: add IPv6 extension push remove cli
In reply to Rongwei LiuAdd command lines to generate IPv6 routing extension push and remove patterns and follow the raw_encap/decap style.
Add the new actions to the action template parsing.
Generating the action patterns
1. IPv6 routing extension push
set ipv6_ext_push 1 ipv6_ext type is 43 / ipv6_routing_ext ext_type is 4 ext_next_hdr is 17 ext_seg_left is 2 / end_set
2. IPv6 routing extension remove
set ipv6_ext_remove 1 ipv6_ext type is 43 / end_set
Specifying the action in the template
1. actions_template_id 1 template ipv6_ext_push index 1
2. actions_template_id 1 template ipv6_ext_remove index 1
--- app/test-pmd/cmdline_flow.c | 443 +++++++++++++++++++++++++++++++++++- 1 file changed, 442 insertions(+), 1 deletion(-)
app/test-pmd/cmdline_flow.c +442 -1
@@ -74,6 +74,9 @@ enum index {SET_RAW_INDEX ,SET_SAMPLE_ACTIONS ,SET_SAMPLE_INDEX , +SET_IPV6_EXT_REMOVE , +SET_IPV6_EXT_PUSH , +SET_IPV6_EXT_INDEX ,/* Top-level command. */ FLOW,
@@ -496,6 +499,8 @@ enum index {ITEM_QUOTA_STATE_NAME ,ITEM_AGGR_AFFINITY ,ITEM_AGGR_AFFINITY_VALUE , +ITEM_IPV6_PUSH_REMOVE_EXT , +ITEM_IPV6_PUSH_REMOVE_EXT_TYPE ,/* Validate/create actions. */ ACTIONS,
@@ -665,6 +670,12 @@ enum index {ACTION_QUOTA_QU_LIMIT ,ACTION_QUOTA_QU_UPDATE_OP ,ACTION_QUOTA_QU_UPDATE_OP_NAME , +ACTION_IPV6_EXT_REMOVE , +ACTION_IPV6_EXT_REMOVE_INDEX , +ACTION_IPV6_EXT_REMOVE_INDEX_VALUE , +ACTION_IPV6_EXT_PUSH , +ACTION_IPV6_EXT_PUSH_INDEX , + ACTION_IPV6_EXT_PUSH_INDEX_VALUE, };/** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -731,6 +742,42 @@ struct action_raw_decap_data {uint16_t idx; }; +/** Maximum data size in struct rte_flow_action_ipv6_ext_push. */ +#define ACTION_IPV6_EXT_PUSH_MAX_DATA 512 +#define IPV6_EXT_PUSH_CONFS_MAX_NUM 8 + +/** Storage for struct rte_flow_action_ipv6_ext_push. */ +struct ipv6_ext_push_conf { +uint8_t data[ACTION_IPV6_EXT_PUSH_MAX_DATA ]; +size_t size; +uint8_t type; +}; + +struct ipv6_ext_push_conf ipv6_ext_push_confs[IPV6_EXT_PUSH_CONFS_MAX_NUM ]; + +/** Storage for struct rte_flow_action_ipv6_ext_push including external data. */ +struct action_ipv6_ext_push_data { +struct rte_flow_action_ipv6_ext_push conf; +uint8_t data[ACTION_IPV6_EXT_PUSH_MAX_DATA ]; +uint8_t type; +uint16_t idx; +}; + +/** Storage for struct rte_flow_action_ipv6_ext_remove. */ +struct ipv6_ext_remove_conf { +struct rte_flow_action_ipv6_ext_remove conf; +uint8_t type; +}; + +struct ipv6_ext_remove_conf ipv6_ext_remove_confs[IPV6_EXT_PUSH_CONFS_MAX_NUM ]; + +/** Storage for struct rte_flow_action_ipv6_ext_remove including external data. */ +struct action_ipv6_ext_remove_data { +struct rte_flow_action_ipv6_ext_remove conf; +uint8_t type; +uint16_t idx; +}; +struct vxlan_encap_conf vxlan_encap_conf = { .select_ipv4 =1 , .select_vlan =0 ,
@@ -2022,6 +2069,8 @@ static const enum index next_action[] = {ACTION_SEND_TO_KERNEL ,ACTION_QUOTA_CREATE ,ACTION_QUOTA_QU , +ACTION_IPV6_EXT_REMOVE , +ACTION_IPV6_EXT_PUSH , ZERO, };
@@ -2230,6 +2279,18 @@ static const enum index action_raw_decap[] = { ZERO, }; +static const enum index action_ipv6_ext_remove[] = { +ACTION_IPV6_EXT_REMOVE_INDEX , +ACTION_NEXT , +ZERO , +}; + +static const enum index action_ipv6_ext_push[] = { +ACTION_IPV6_EXT_PUSH_INDEX , +ACTION_NEXT , +ZERO , +}; +static const enum index action_set_tag[] = {ACTION_SET_TAG_DATA ,ACTION_SET_TAG_INDEX ,
@@ -2293,6 +2354,22 @@ static const enum index next_action_sample[] = { ZERO, }; +static const enum index item_ipv6_push_ext[] = { +ITEM_IPV6_PUSH_REMOVE_EXT , +ZERO , +}; + +static const enum index item_ipv6_push_ext_type[] = { +ITEM_IPV6_PUSH_REMOVE_EXT_TYPE , +ZERO , +}; + +static const enum index item_ipv6_push_ext_header[] = { +ITEM_IPV6_ROUTING_EXT , +ITEM_NEXT , +ZERO , +}; +static const enum index action_modify_field_dst[] = {ACTION_MODIFY_FIELD_DST_LEVEL ,ACTION_MODIFY_FIELD_DST_OFFSET ,
@@ -2334,6 +2411,9 @@ static int parse_set_raw_encap_decap(struct context *, const struct token *,static int parse_set_sample_action (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int ); +static int parse_set_ipv6_ext_action (struct context *,const struct token *, +const char *,unsigned int , +void *,unsigned int );static int parse_set_init (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int );
@@ -2411,6 +2491,22 @@ static int parse_vc_action_raw_encap_index(struct context *,static int parse_vc_action_raw_decap_index (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int ); +static int parse_vc_action_ipv6_ext_remove (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size); +static int parse_vc_action_ipv6_ext_remove_index (struct context *ctx, +const struct token *token, +const char *str,unsigned int len, +void *buf, +unsigned int size); +static int parse_vc_action_ipv6_ext_push (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size); +static int parse_vc_action_ipv6_ext_push_index (struct context *ctx, +const struct token *token, +const char *str,unsigned int len, +void *buf, +unsigned int size); static int parse_vc_action_set_meta(struct context *ctx, const struct token *token, const char *str, unsigned int len, void *buf,
@@ -2596,6 +2692,8 @@ static int comp_set_raw_index(struct context *, const struct token *, unsigned int, char *, unsigned int);static int comp_set_sample_index (struct context *,const struct token *,unsigned int ,char *,unsigned int ); +static int comp_set_ipv6_ext_index (struct context *ctx,const struct token *token, +unsigned int ent,char *buf,unsigned int size);static int comp_set_modify_field_op (struct context *,const struct token *,unsigned int ,char *,unsigned int ); static int comp_set_modify_field_id(struct context *, const struct token *,
@@ -6472,6 +6570,48 @@ static const struct token token_list[] = { .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), .call = parse_vc, }, + [ACTION_IPV6_EXT_REMOVE] = { + .name = "ipv6_ext_remove", + .help = "IPv6 extension type, defined by set ipv6_ext_remove", + .priv =PRIV_ACTION (IPV6_EXT_REMOVE , + sizeof(struct action_ipv6_ext_remove_data)), + .next = NEXT(action_ipv6_ext_remove), + .call = parse_vc_action_ipv6_ext_remove, + }, + [ACTION_IPV6_EXT_REMOVE_INDEX] = { + .name = "index", + .help = "the index of ipv6_ext_remove", + .next = NEXT(NEXT_ENTRY(ACTION_IPV6_EXT_REMOVE_INDEX_VALUE)), + }, + [ACTION_IPV6_EXT_REMOVE_INDEX_VALUE] = { + .name = "{index}", + .type = "UNSIGNED", + .help = "unsigned integer value", + .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), + .call = parse_vc_action_ipv6_ext_remove_index, + .comp = comp_set_ipv6_ext_index, + }, + [ACTION_IPV6_EXT_PUSH] = { + .name = "ipv6_ext_push", + .help = "IPv6 extension data, defined by set ipv6_ext_push", + .priv =PRIV_ACTION (IPV6_EXT_PUSH , + sizeof(struct action_ipv6_ext_push_data)), + .next = NEXT(action_ipv6_ext_push), + .call = parse_vc_action_ipv6_ext_push, + }, + [ACTION_IPV6_EXT_PUSH_INDEX] = { + .name = "index", + .help = "the index of ipv6_ext_push", + .next = NEXT(NEXT_ENTRY(ACTION_IPV6_EXT_PUSH_INDEX_VALUE)), + }, + [ACTION_IPV6_EXT_PUSH_INDEX_VALUE] = { + .name = "{index}", + .type = "UNSIGNED", + .help = "unsigned integer value", + .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), + .call = parse_vc_action_ipv6_ext_push_index, + .comp = comp_set_ipv6_ext_index, + },/* Top level command. */ [SET] = { .name = "set",
@@ -6481,7 +6621,9 @@ static const struct token token_list[] = { .next = NEXT(NEXT_ENTRY (SET_RAW_ENCAP ,SET_RAW_DECAP , - SET_SAMPLE_ACTIONS)), +SET_SAMPLE_ACTIONS , +SET_IPV6_EXT_REMOVE , + SET_IPV6_EXT_PUSH)), .call = parse_set_init, },/* Sub-level commands. */
@@ -6529,6 +6671,49 @@ static const struct token token_list[] = { 0, RAW_SAMPLE_CONFS_MAX_NUM - 1)), .call = parse_set_sample_action, }, + [SET_IPV6_EXT_PUSH] = { + .name = "ipv6_ext_push", + .help = "set IPv6 extension header", + .next = NEXT(NEXT_ENTRY(SET_IPV6_EXT_INDEX)), + .args =ARGS (ARGS_ENTRY_ARB_BOUNDED + (offsetof(struct buffer , port), +sizeof (((struct buffer *)0 )->port), + 0, IPV6_EXT_PUSH_CONFS_MAX_NUM - 1)), + .call = parse_set_ipv6_ext_action, + }, + [SET_IPV6_EXT_REMOVE] = { + .name = "ipv6_ext_remove", + .help = "set IPv6 extension header", + .next = NEXT(NEXT_ENTRY(SET_IPV6_EXT_INDEX)), + .args =ARGS (ARGS_ENTRY_ARB_BOUNDED + (offsetof(struct buffer , port), +sizeof (((struct buffer *)0 )->port), + 0, IPV6_EXT_PUSH_CONFS_MAX_NUM - 1)), + .call = parse_set_ipv6_ext_action, + }, + [SET_IPV6_EXT_INDEX] = { + .name = "{index}", + .type = "UNSIGNED", + .help = "index of ipv6 extension push/remove actions", + .next = NEXT(item_ipv6_push_ext), + .call = parse_port, + }, + [ITEM_IPV6_PUSH_REMOVE_EXT] = { + .name = "ipv6_ext", + .help = "set IPv6 extension header", + .priv =PRIV_ITEM (IPV6_EXT , + sizeof(struct rte_flow_item_ipv6_ext)), + .next = NEXT(item_ipv6_push_ext_type), + .call = parse_vc, + }, + [ITEM_IPV6_PUSH_REMOVE_EXT_TYPE] = { + .name = "type", + .help = "set IPv6 extension type", + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext, + next_hdr)), + .next =NEXT (item_ipv6_push_ext_header,NEXT_ENTRY (COMMON_UNSIGNED ), + item_param), + }, [ACTION_SET_TAG] = { .name = "set_tag", .help = "set tag",
@@ -8843,6 +9028,140 @@ parse_vc_action_raw_decap(struct context *ctx, const struct token *token,return ret; } +static int +parse_vc_action_ipv6_ext_remove (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size) +{ +struct buffer *out = buf; +struct rte_flow_action *action; +struct action_ipv6_ext_remove_data *ipv6_ext_remove_data =NULL ; +int ret; + + ret =parse_vc (ctx, token, str, len, buf, size); +if (ret <0 ) +return ret; +/* Nothing else to do if there is no buffer. */ +if (!out) +return ret; +if (!out->args.vc.actions_n) +return -1 ; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; +/* Point to selected object. */ + ctx->object = out->args.vc.data; + ctx->objmask =NULL ; +/* Copy the headers to the buffer. */ + ipv6_ext_remove_data = ctx->object; + ipv6_ext_remove_data->conf.type = ipv6_ext_remove_confs[0 ].type; + action->conf = &ipv6_ext_remove_data->conf; +return ret; +} + +static int +parse_vc_action_ipv6_ext_remove_index (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size) +{ +struct action_ipv6_ext_remove_data *action_ipv6_ext_remove_data; +struct rte_flow_action *action; +const struct arg *arg; +struct buffer *out = buf; +int ret; +uint16_t idx; + +RTE_SET_USED (token); +RTE_SET_USED (buf); +RTE_SET_USED (size); + arg =ARGS_ENTRY_ARB_BOUNDED + (offsetof(struct action_ipv6_ext_remove_data , idx), +sizeof (((struct action_ipv6_ext_remove_data *)0 )->idx), +0 ,IPV6_EXT_PUSH_CONFS_MAX_NUM -1 ); +if (push_args (ctx, arg)) +return -1 ; + ret =parse_int (ctx, token, str, len,NULL ,0 ); +if (ret <0 ) { +pop_args (ctx); +return -1 ; + } +if (!ctx->object) +return len; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; + action_ipv6_ext_remove_data = ctx->object; + idx = action_ipv6_ext_remove_data->idx; + action_ipv6_ext_remove_data->conf.type = ipv6_ext_remove_confs[idx].type; + action->conf = &action_ipv6_ext_remove_data->conf; +return len; +} + +static int +parse_vc_action_ipv6_ext_push (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size) +{ +struct buffer *out = buf; +struct rte_flow_action *action; +struct action_ipv6_ext_push_data *ipv6_ext_push_data =NULL ; +int ret; + + ret =parse_vc (ctx, token, str, len, buf, size); +if (ret <0 ) +return ret; +/* Nothing else to do if there is no buffer. */ +if (!out) +return ret; +if (!out->args.vc.actions_n) +return -1 ; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; +/* Point to selected object. */ + ctx->object = out->args.vc.data; + ctx->objmask =NULL ; +/* Copy the headers to the buffer. */ + ipv6_ext_push_data = ctx->object; + ipv6_ext_push_data->conf.type = ipv6_ext_push_confs[0 ].type; + ipv6_ext_push_data->conf.data = ipv6_ext_push_confs[0 ].data; + ipv6_ext_push_data->conf.size = ipv6_ext_push_confs[0 ].size; + action->conf = &ipv6_ext_push_data->conf; +return ret; +} + +static int +parse_vc_action_ipv6_ext_push_index (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size) +{ +struct action_ipv6_ext_push_data *action_ipv6_ext_push_data; +struct rte_flow_action *action; +const struct arg *arg; +struct buffer *out = buf; +int ret; +uint16_t idx; + +RTE_SET_USED (token); +RTE_SET_USED (buf); +RTE_SET_USED (size); + arg =ARGS_ENTRY_ARB_BOUNDED + (offsetof(struct action_ipv6_ext_push_data , idx), +sizeof (((struct action_ipv6_ext_push_data *)0 )->idx), +0 ,IPV6_EXT_PUSH_CONFS_MAX_NUM -1 ); +if (push_args (ctx, arg)) +return -1 ; + ret =parse_int (ctx, token, str, len,NULL ,0 ); +if (ret <0 ) { +pop_args (ctx); +return -1 ; + } +if (!ctx->object) +return len; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; + action_ipv6_ext_push_data = ctx->object; + idx = action_ipv6_ext_push_data->idx; + action_ipv6_ext_push_data->conf.type = ipv6_ext_push_confs[idx].type; + action_ipv6_ext_push_data->conf.size = ipv6_ext_push_confs[idx].size; + action_ipv6_ext_push_data->conf.data = ipv6_ext_push_confs[idx].data; + action->conf = &action_ipv6_ext_push_data->conf; +return len; +} + static int parse_vc_action_set_meta(struct context *ctx, const struct token *token, const char *str, unsigned int len, void *buf,
@@ -10532,6 +10851,35 @@ parse_set_sample_action(struct context *ctx, const struct token *token,return len; } +/** Parse set command, initialize output buffer for subsequent tokens. */ +static int +parse_set_ipv6_ext_action (struct context *ctx,const struct token *token, +const char *str,unsigned int len, +void *buf,unsigned int size) +{ +struct buffer *out = buf; + +/* Token name must match. */ +if (parse_default (ctx, token, str, len,NULL ,0 ) <0 ) +return -1 ; +/* Nothing else to do if there is no buffer. */ +if (!out) +return len; +/* Make sure buffer is large enough. */ +if (size <sizeof (*out)) +return -1 ; + ctx->objdata =0 ; + ctx->objmask =NULL ; + ctx->object = out; +if (!out->command) +return -1 ; + out->command = ctx->curr; +/* For ipv6_ext_push/remove we need is pattern */ + out->args.vc.pattern = (void *)RTE_ALIGN_CEIL ((uintptr_t )(out +1 ), +sizeof (double )); +return len; +} +/** * Parse set raw_encap/raw_decap command, * initialize output buffer for subsequent tokens.
@@ -10961,6 +11309,24 @@ comp_set_raw_index(struct context *ctx, const struct token *token,return nb; } +/** Complete index number for set raw_ipv6_ext_push/ipv6_ext_remove commands. */ +static int +comp_set_ipv6_ext_index (struct context *ctx,const struct token *token, +unsigned int ent,char *buf,unsigned int size) +{ +uint16_t idx =0 ; +uint16_t nb =0 ; + +RTE_SET_USED (ctx); +RTE_SET_USED (token); +for (idx =0 ; idx <IPV6_EXT_PUSH_CONFS_MAX_NUM ; ++idx) { +if (buf && idx == ent) +return snprintf (buf, size,"%u" , idx); + ++nb; + } +return nb; +} +/** Complete index number for set raw_encap/raw_decap commands. */ static int comp_set_sample_index(struct context *ctx, const struct token *token,
@@ -11855,6 +12221,78 @@ flow_item_default_mask(const struct rte_flow_item *item)return mask; } +/** Dispatch parsed buffer to function calls. */ +static void +cmd_set_ipv6_ext_parsed (const struct buffer *in) +{ +uint32_t n = in->args.vc.pattern_n; +int i =0 ; +struct rte_flow_item *item =NULL ; +size_t size =0 ; +uint8_t *data =NULL ; +uint8_t *type =NULL ; +size_t *total_size =NULL ; +uint16_t idx = in->port;/* We borrow port field as index */ +struct rte_flow_item_ipv6_routing_ext *ext; +const struct rte_flow_item_ipv6_ext *ipv6_ext; + +RTE_ASSERT (in->command ==SET_IPV6_EXT_PUSH || + in->command ==SET_IPV6_EXT_REMOVE ); + +if (in->command ==SET_IPV6_EXT_REMOVE ) { +if (n !=1 || in->args.vc.pattern->type != +RTE_FLOW_ITEM_TYPE_IPV6_EXT ) { +fprintf (stderr,"Error - Not supported item\n" ); +return ; + } + type = (uint8_t *)&ipv6_ext_remove_confs[idx].type; + item = in->args.vc.pattern; + ipv6_ext = item->spec; + *type = ipv6_ext->next_hdr; +return ; + } + + total_size = &ipv6_ext_push_confs[idx].size; + data = (uint8_t *)&ipv6_ext_push_confs[idx].data; + type = (uint8_t *)&ipv6_ext_push_confs[idx].type; + + *total_size =0 ; +memset (data,0x00 ,ACTION_RAW_ENCAP_MAX_DATA ); +for (i = n -1 ; i >=0 ; --i) { + item = in->args.vc.pattern + i; +switch (item->type) { +case RTE_FLOW_ITEM_TYPE_IPV6_EXT : + ipv6_ext = item->spec; + *type = ipv6_ext->next_hdr; +break ; +case RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT : + ext = (struct rte_flow_item_ipv6_routing_ext *)(uintptr_t )item->spec; +if (!ext->hdr.hdr_len) { + size =sizeof (struct rte_ipv6_routing_ext ) + + (ext->hdr.segments_left <<4 ); + ext->hdr.hdr_len = ext->hdr.segments_left <<1 ; +/* Indicate no TLV once SRH. */ +if (ext->hdr.type ==4 ) + ext->hdr.last_entry = ext->hdr.segments_left -1 ; + }else { + size =sizeof (struct rte_ipv6_routing_ext ) + + (ext->hdr.hdr_len <<3 ); + } + *total_size += size; +memcpy (data, ext, size); +break ; +default : +fprintf (stderr,"Error - Not supported item\n" ); + goto error; + } + } +RTE_ASSERT ((*total_size) <=ACTION_IPV6_EXT_PUSH_MAX_DATA ); +return ; +error: + *total_size =0 ; +memset (data,0x00 ,ACTION_IPV6_EXT_PUSH_MAX_DATA ); +} +/** Dispatch parsed buffer to function calls. */ static void cmd_set_raw_parsed_sample (const struct buffer *in)
@@ -11988,6 +12426,9 @@ cmd_set_raw_parsed(const struct buffer *in)if (in->command ==SET_SAMPLE_ACTIONS )return cmd_set_raw_parsed_sample (in); +else if (in->command ==SET_IPV6_EXT_PUSH || + in->command ==SET_IPV6_EXT_REMOVE ) +return cmd_set_ipv6_ext_parsed (in);RTE_ASSERT (in->command ==SET_RAW_ENCAP || in->command ==SET_RAW_DECAP );if (in->command ==SET_RAW_ENCAP ) {
Signature · 1 line
2.27.0
Quoted 9 lines · Rongwei Liu
Add new
rte_actionsto push and remove the specific type of IPv6 extension to and from original packets.v1: Split the PMD implementation, add a description into release notes.
Rongwei Liu (2):
ethdev: add IPv6 extension push remove action
app/testpmd: add IPv6 extension push remove cli
Series applied to dpdk-next-net/main, thanks.
Hi Ferruh & Andrew & Ori & Thomas:
Sorry, we can't commit the PMD implementation for "IPv6 extension push remove" feature in time for this release. There are some dis-agreements which need to be addressed internally.
We will continue to work on this and plan to push it in the next release.
RFC link: https://patchwork.dpdk.org/project/dpdk/cover/[email protected]/
V1 patch with full PMD implementation: https://patchwork.dpdk.org/project/dpdk/cover/[email protected]/
BR
Rongwei
Quoted 25 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 2, 2023 22:39
To: Rongwei Liu <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1 0/2] add IPv6 extension push removeExternal email: Use caution opening links or attachments
Quoted 9 lines · Rongwei Liu
Add new
rte_actionsto push and remove the specific type of IPv6 extension to and from original packets.v1: Split the PMD implementation, add a description into release notes.
Rongwei Liu (2):
ethdev: add IPv6 extension push remove action
app/testpmd: add IPv6 extension push remove cliSeries applied to dpdk-next-net/main, thanks.
Quoted 8 lines · Rongwei Liu
Hi Ferruh & Andrew & Ori & Thomas:
Sorry, we can't commit the PMD implementation for "IPv6 extension push remove" feature in time for this release. There are some dis-agreements which need to be addressed internally.
We will continue to work on this and plan to push it in the next release.RFC link: https://patchwork.dpdk.org/project/dpdk/cover/[email protected]/
V1 patch with full PMD implementation: https://patchwork.dpdk.org/project/dpdk/cover/[email protected]/
Hi Rongwei,
Thanks for the heads up.
As long as there is a plan to upstream driver implementation, I think it is OK to keep ethdev change and wait for driver implementation for better design instead of rushing it for this release with lower quality (although target should be to have driver changes with same release with API changes for future features).
Quoted 26 lines
Quoted 25 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 2, 2023 22:39
To: Rongwei Liu <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1 0/2] add IPv6 extension push removeExternal email: Use caution opening links or attachments
Quoted 9 lines · Rongwei Liu
Add new
rte_actionsto push and remove the specific type of IPv6 extension to and from original packets.v1: Split the PMD implementation, add a description into release notes.
Rongwei Liu (2):
ethdev: add IPv6 extension push remove action
app/testpmd: add IPv6 extension push remove cliSeries applied to dpdk-next-net/main, thanks.
Quoted 10 lines · On Mon, 10 Jul 2023 09:55:59 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 8 lines · Rongwei Liu
Hi Ferruh & Andrew & Ori & Thomas:
Sorry, we can't commit the PMD implementation for "IPv6 extension push remove" feature in time for this release. There are some dis-agreements which need to be addressed internally.
We will continue to work on this and plan to push it in the next release.RFC link: https://patchwork.dpdk.org/project/dpdk/cover/[email protected]/
V1 patch with full PMD implementation: https://patchwork.dpdk.org/project/dpdk/cover/[email protected]/
Quoted 8 lines
Hi Rongwei,
Thanks for the heads up.
As long as there is a plan to upstream driver implementation, I think it is OK to keep ethdev change and wait for driver implementation for better design instead of rushing it for this release with lower quality (although target should be to have driver changes with same release with API changes for future features).
Please wait the change until driver is ready.
Don't want to deal with API/ABI changes when driver is upstream. Also, no unused code please.
10/07/2023 16:41, Stephen Hemminger:
Quoted 22 lines
Quoted 10 lines · On Mon, 10 Jul 2023 09:55:59 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 8 lines · Rongwei Liu
Hi Ferruh & Andrew & Ori & Thomas:
Sorry, we can't commit the PMD implementation for "IPv6 extension push remove" feature in time for this release. There are some dis-agreements which need to be addressed internally.
We will continue to work on this and plan to push it in the next release.RFC link: https://patchwork.dpdk.org/project/dpdk/cover/[email protected]/
V1 patch with full PMD implementation: https://patchwork.dpdk.org/project/dpdk/cover/[email protected]/Quoted 8 lines
Hi Rongwei,
Thanks for the heads up.
As long as there is a plan to upstream driver implementation, I think it is OK to keep ethdev change and wait for driver implementation for better design instead of rushing it for this release with lower quality (although target should be to have driver changes with same release with API changes for future features).
Quoted 3 lines
Please wait the change until driver is ready.
Don't want to deal with API/ABI changes when driver is upstream. Also, no unused code please.
There was a driver patch sent in April.
It was impossible to imagine it was not good enough to be merged.
PATCH v3 1/1 net/mlx5: add test for live migration
This patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set flow_engine <active|standby> [<flag>]
Flag is optional.
v3: Add missing --in-reply-to option.
v2: Change the command prompt from integer to string.
--- doc/guides/nics/mlx5.rst | 14 ++++ drivers/net/mlx5/mlx5_testpmd.c | 124 ++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+)
doc/guides/nics/mlx5.rst +14 -0
@@ -2179,3 +2179,17 @@ where: * ``sw_queue_id``: queue index in range [64536, 65535]. This range is the highest 1000 numbers. * ``hw_queue_id``: queue index given by HW in queue creation. + +Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active(0) or standby(1) mode with specific flags:: + +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>] + +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.
drivers/net/mlx5/mlx5_testpmd.c +124 -0
142 lines not on this page · raw message
Signature · 1 line
2.27.0
Re: [PATCH v3] net/mlx5: add test for live migration
19/09/2023 10:12, Rongwei Liu:
Quoted 9 lines
This patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set
flow_engine<active|standby> [<flag>]
Flag is optional.Signed-off-by Rongwei Liu <[email protected]>Acked-by Ori Kam <[email protected]>
[...]
doc/guides/nics/mlx5.rst where: · line 2186
Quoted 4 lines
doc/guides/nics/mlx5.rst +4
-0+Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active(0) or standby(1) mode with specific flags::
Need space before brackets.
doc/guides/nics/mlx5.rst where: · line 2190
Quoted 4 lines
doc/guides/nics/mlx5.rst +4
-0+ +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>]
What are the flags?
doc/guides/nics/mlx5.rst where: · line 2195
Quoted 5 lines
doc/guides/nics/mlx5.rst +5
-0+ +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.
Looks OK.
RE: [PATCH v3] net/mlx5: add test for live migration
HI
BR
Rongwei
Quoted 22 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, October 16, 2023 16:20
To: Rongwei Liu <[email protected]>
Cc: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [PATCH v3] net/mlx5: add test for live migrationExternal email: Use caution opening links or attachments
19/09/2023 10:12, Rongwei Liu:
Quoted 9 lines
This patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set
flow_engine<active|standby> [<flag>] Flag is
optional.Signed-off-by Rongwei Liu <[email protected]>Acked-by Ori Kam <[email protected]>
Quoted 8 lines
[...]
doc/guides/nics/mlx5.rst where: · line 2186
Quoted 4 lines
doc/guides/nics/mlx5.rst +4
-0+Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active(0) or standby(1) mode with specific flags::Need space before brackets.
Sure.
Quoted 7 lines
doc/guides/nics/mlx5.rst where: · line 2190
Quoted 4 lines
doc/guides/nics/mlx5.rst +4
-0+ +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>]What are the flags?
The flag is optional and defined a as bitmap.
For now, only one value is accepted: BIT(0).
I don't have any idea to propagate the value definition list here. Any suggestions?
Quoted 8 lines
doc/guides/nics/mlx5.rst where: · line 2195
Quoted 5 lines
doc/guides/nics/mlx5.rst +5
-0+ +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.Looks OK.
RE: [PATCH v3] net/mlx5: add test for live migration
BR
Rongwei
Quoted 52 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Monday, October 16, 2023 16:26
To: Thomas Monjalon <[email protected]>
Cc: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: RE: [PATCH v3] net/mlx5: add test for live migrationHI
BR
RongweiQuoted 22 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, October 16, 2023 16:20
To: Rongwei Liu <[email protected]>
Cc: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [PATCH v3] net/mlx5: add test for live migrationExternal email: Use caution opening links or attachments
19/09/2023 10:12, Rongwei Liu:
Quoted 9 lines
This patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set
flow_engine<active|standby> [<flag>] Flag is
optional.Signed-off-by Rongwei Liu <[email protected]>Acked-by Ori Kam <[email protected]>Quoted 8 lines
[...]
doc/guides/nics/mlx5.rst where: · line 2186
Quoted 4 lines
doc/guides/nics/mlx5.rst +4
-0+Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active(0) or standby(1) mode with specific flags::Need space before brackets.
Sure.
Quoted 7 lines
doc/guides/nics/mlx5.rst where: · line 2190
Quoted 4 lines
doc/guides/nics/mlx5.rst +4
-0+ +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>]What are the flags?
Quoted 4 lines
The flag is optional and defined a as bitmap.
For now, only one value is accepted: BIT(0).
I don't have any idea to propagate the value definition list here. Any suggestions?
Add one more description to mention it in bitmap style.
Quoted 8 lines
Quoted 8 lines
doc/guides/nics/mlx5.rst where: · line 2195
Quoted 5 lines
doc/guides/nics/mlx5.rst +5
-0+ +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.Looks OK.
Re: [PATCH v3] net/mlx5: add test for live migration
In reply to Rongwei Liu16/10/2023 10:25, Rongwei Liu:
Quoted 9 lines
From: Thomas Monjalon <[email protected]>
Quoted 5 lines
19/09/2023 10:12, Rongwei Liu:
Quoted 1 line
+ testpmd> mlx5 set
flow_engine<active|standby> [<flags>]What are the flags?
The flag is optional and defined a as bitmap.
For now, only one value is accepted: BIT(0).
I don't have any idea to propagate the value definition list here. Any suggestions?
Just add it and give the usage of the flag or refer to another part of the doc for explanation.
RE: [PATCH v3] net/mlx5: add test for live migration
Hi
BR
Rongwei
Quoted 19 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, October 16, 2023 17:27
To: Rongwei Liu <[email protected]>
Cc: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [PATCH v3] net/mlx5: add test for live migrationExternal email: Use caution opening links or attachments
16/10/2023 10:25, Rongwei Liu:
Quoted 6 lines
From: Thomas Monjalon <[email protected]>
Quoted 5 lines
19/09/2023 10:12, Rongwei Liu:
Quoted 1 line
+ testpmd> mlx5 set
flow_engine<active|standby> [<flags>]What are the flags?
Quoted 7 lines
Quoted 3 lines
The flag is optional and defined a as bitmap.
For now, only one value is accepted: BIT(0).
I don't have any idea to propagate the value definition list here. Anysuggestions?
Just add it and give the usage of the flag or refer to another part of the doc for explanation.
Change it as: " Set the flow engine to active or standby mode with specific flags (bitmap style)::" Sound good?
Quoted 1 line
RE: [PATCH v3] net/mlx5: add test for live migration
BR
Rongwei
Quoted 40 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Monday, October 16, 2023 17:30
To: NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Cc: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: RE: [PATCH v3] net/mlx5: add test for live migrationExternal email: Use caution opening links or attachments
Hi
BR
RongweiQuoted 23 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, October 16, 2023 17:27
To: Rongwei Liu <[email protected]>
Cc: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [PATCH v3] net/mlx5: add test for live migrationExternal email: Use caution opening links or attachments
16/10/2023 10:25, Rongwei Liu:
Quoted 10 lines
From: Thomas Monjalon <[email protected]>
Quoted 5 lines
19/09/2023 10:12, Rongwei Liu:
Quoted 1 line
+ testpmd> mlx5 set
flow_engine<active|standby> [<flags>]What are the flags?
The flag is optional and defined a as bitmap.
For now, only one value is accepted: BIT(0).
I don't have any idea to propagate the value definition list here. Any
Quoted 8 lines
Quoted 4 lines
suggestions?
Just add it and give the usage of the flag or refer to another part of the doc for explanation.
Change it as: " Set the flow engine to active or standby mode with specific flags (bitmap style)::"
Sound good?Quoted 1 line
@NBU-Contact-Thomas Monjalon (EXTERNAL) are we good to move forward? Thanks
PATCH v4 1/1 net/mlx5: add test for live migration
In reply to Thomas MonjalonThis patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set flow_engine <active|standby> [<flag>]
Flag is optional and in bitmap style.
--- doc/guides/nics/mlx5.rst | 14 ++++ drivers/net/mlx5/mlx5_testpmd.c | 124 ++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+)
doc/guides/nics/mlx5.rst +14 -0
@@ -2179,3 +2179,17 @@ where: * ``sw_queue_id``: queue index in range [64536, 65535]. This range is the highest 1000 numbers. * ``hw_queue_id``: queue index given by HW in queue creation. + +Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active or standby mode with specific flags (bitmap style):: + +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>] + +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.
drivers/net/mlx5/mlx5_testpmd.c +124 -0
142 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v5 1/1 net/mlx5: add test for live migration
This patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set flow_engine <active|standby> [<flag>]
Flag is optional.
--- doc/guides/nics/mlx5.rst | 15 ++++ drivers/net/mlx5/mlx5_testpmd.c | 124 ++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+)
doc/guides/nics/mlx5.rst +15 -0
@@ -2187,3 +2187,18 @@ where: * ``sw_queue_id``: queue index in range [64536, 65535]. This range is the highest 1000 numbers. * ``hw_queue_id``: queue index given by HW in queue creation. + +Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active or standby mode with specific flags (bitmap style):: +See MLX5_FLOW_ENGINE_FLAG_* for the detailed flags definitions. + +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>] + +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.
drivers/net/mlx5/mlx5_testpmd.c +124 -0
142 lines not on this page · raw message
Signature · 1 line
2.27.0
Re: [PATCH v5] net/mlx5: add test for live migration
25/10/2023 11:36, Rongwei Liu:
doc/guides/nics/mlx5.rst where: · line 2194
Quoted 4 lines
doc/guides/nics/mlx5.rst +4
-0+Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active or standby mode with specific flags (bitmap style)::
This sentence should end with a dot.
Quoted 1 line
+See MLX5_FLOW_ENGINE_FLAG_* for the detailed flags definitions.
MLX5_FLOW_ENGINE_FLAG_* should be between backquotes:
``MLX5_FLOW_ENGINE_FLAG_*``
No need "s" to "flags".
You can also remove "detailed": "flag definitions".
Quoted 9 lines
doc/guides/nics/mlx5.rst +9
-0+ +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>] + +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.
PATCH v6 1/1 net/mlx5: add test for live migration
This patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set flow_engine <active|standby> [<flag>]
Flag is optional.
--- doc/guides/nics/mlx5.rst | 15 ++++ drivers/net/mlx5/mlx5_testpmd.c | 124 ++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+)
doc/guides/nics/mlx5.rst +15 -0
@@ -2187,3 +2187,18 @@ where: * ``sw_queue_id``: queue index in range [64536, 65535]. This range is the highest 1000 numbers. * ``hw_queue_id``: queue index given by HW in queue creation. + +Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active or standby mode with specific flags (bitmap style):: +See MLX5_FLOW_ENGINE_FLAG_* for the flag definitions. + +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>] + +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.
drivers/net/mlx5/mlx5_testpmd.c +124 -0
142 lines not on this page · raw message
Signature · 1 line
2.27.0
RE: [PATCH v5] net/mlx5: add test for live migration
In reply to Thomas MonjalonBR
Rongwei
Quoted 12 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, October 25, 2023 17:42
To: Rongwei Liu <[email protected]>
Cc: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>
Subject: Re: [PATCH v5] net/mlx5: add test for live migrationExternal email: Use caution opening links or attachments
Quoted 9 lines
25/10/2023 11:36, Rongwei Liu:
doc/guides/nics/mlx5.rst where:
Quoted 4 lines
doc/guides/nics/mlx5.rst +4
-0+Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active or standby mode with specific flags (bitmapstyle)::
This sentence should end with a dot.
Sure.
Quoted 5 lines
Quoted 1 line
+See MLX5_FLOW_ENGINE_FLAG_* for the detailed flags definitions.
MLX5_FLOW_ENGINE_FLAG_* should be between backquotes:
``MLX5_FLOW_ENGINE_FLAG_*``
Sure.
Quoted 3 lines
No need "s" to "flags".
You can also remove "detailed": "flag definitions".
Sure.
Quoted 11 lines
Quoted 9 lines
doc/guides/nics/mlx5.rst +9
-0+ +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>] + +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.
PATCH v7 1/1 net/mlx5: add test for live migration
In reply to Thomas MonjalonThis patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set flow_engine <active|standby> [<flag>]
Flag is optional.
--- doc/guides/nics/mlx5.rst | 15 ++++ drivers/net/mlx5/mlx5_testpmd.c | 124 ++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+)
doc/guides/nics/mlx5.rst +15 -0
@@ -2187,3 +2187,18 @@ where: * ``sw_queue_id``: queue index in range [64536, 65535]. This range is the highest 1000 numbers. * ``hw_queue_id``: queue index given by HW in queue creation. + +Set Flow Engine Mode +~~~~~~~~~~~~~~~~~~~~ + +Set the flow engine to active or standby mode with specific flags (bitmap style). +See ``MLX5_FLOW_ENGINE_FLAG_*`` for the flag definitions. + +.. code-block:: console + + testpmd> mlx5 set flow_engine <active|standby> [<flags>] + +This command is used for testing live migration and works for +software steering only. +Default FDB jump should be disabled if switchdev is enabled. +The mode will propagate to all the probed ports.
drivers/net/mlx5/mlx5_testpmd.c +124 -0
142 lines not on this page · raw message
Signature · 1 line
2.27.0
Re: [PATCH v7] net/mlx5: add test for live migration
25/10/2023 11:50, Rongwei Liu:
Quoted 9 lines
This patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set
flow_engine<active|standby> [<flag>]
Flag is optional.Signed-off-by Rongwei Liu <[email protected]>Acked-by Ori Kam <[email protected]>
RE: [PATCH v7] net/mlx5: add test for live migration
In reply to Rongwei LiuHi,
Quoted 9 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Wednesday, October 25, 2023 12:50 PM
To: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Subject: [PATCH v7] net/mlx5: add test for live migration
Quoted 7 lines
This patch adds testpmd app a runtime function to test the live migration API.
testpmd> mlx5 set
flow_engine<active|standby> [<flag>] Flag is optional.Signed-off-by Rongwei Liu <[email protected]>Acked-by Ori Kam <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
PATCH 2/8 app/testpmd: add IPv6 extension push remove cli
In reply to Rongwei LiuAdd command lines to generate IPv6 routing extension push and remove patterns and follow the raw_encap/decap style.
Add the new actions to the action template parsing.
Generating the action patterns
1. IPv6 routing extension push
set ipv6_ext_push 1 ipv6_ext type is 43 / ipv6_routing_ext ext_type is 4 ext_next_hdr is 17 ext_seg_left is 2 / end_set
2. IPv6 routing extension remove
set ipv6_ext_remove 1 ipv6_ext type is 43 / end_set
Specifying the action in the template
1. actions_template_id 1 template ipv6_ext_push index 1
2. actions_template_id 1 template ipv6_ext_remove index 1
--- app/test-pmd/cmdline_flow.c | 443 +++++++++++++++++++++++++++++++++++- 1 file changed, 442 insertions(+), 1 deletion(-)
app/test-pmd/cmdline_flow.c +442 -1
@@ -74,6 +74,9 @@ enum index {SET_RAW_INDEX ,SET_SAMPLE_ACTIONS ,SET_SAMPLE_INDEX , +SET_IPV6_EXT_REMOVE , +SET_IPV6_EXT_PUSH , +SET_IPV6_EXT_INDEX ,/* Top-level command. */ FLOW,
@@ -496,6 +499,8 @@ enum index {ITEM_QUOTA_STATE_NAME ,ITEM_AGGR_AFFINITY ,ITEM_AGGR_AFFINITY_VALUE , +ITEM_IPV6_PUSH_REMOVE_EXT , +ITEM_IPV6_PUSH_REMOVE_EXT_TYPE ,/* Validate/create actions. */ ACTIONS,
@@ -665,6 +670,12 @@ enum index {ACTION_QUOTA_QU_LIMIT ,ACTION_QUOTA_QU_UPDATE_OP ,ACTION_QUOTA_QU_UPDATE_OP_NAME , +ACTION_IPV6_EXT_REMOVE , +ACTION_IPV6_EXT_REMOVE_INDEX , +ACTION_IPV6_EXT_REMOVE_INDEX_VALUE , +ACTION_IPV6_EXT_PUSH , +ACTION_IPV6_EXT_PUSH_INDEX , + ACTION_IPV6_EXT_PUSH_INDEX_VALUE, };/** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -731,6 +742,42 @@ struct action_raw_decap_data {uint16_t idx; }; +/** Maximum data size in struct rte_flow_action_ipv6_ext_push. */ +#define ACTION_IPV6_EXT_PUSH_MAX_DATA 512 +#define IPV6_EXT_PUSH_CONFS_MAX_NUM 8 + +/** Storage for struct rte_flow_action_ipv6_ext_push. */ +struct ipv6_ext_push_conf { +uint8_t data[ACTION_IPV6_EXT_PUSH_MAX_DATA ]; +size_t size; +uint8_t type; +}; + +struct ipv6_ext_push_conf ipv6_ext_push_confs[IPV6_EXT_PUSH_CONFS_MAX_NUM ]; + +/** Storage for struct rte_flow_action_ipv6_ext_push including external data. */ +struct action_ipv6_ext_push_data { +struct rte_flow_action_ipv6_ext_push conf; +uint8_t data[ACTION_IPV6_EXT_PUSH_MAX_DATA ]; +uint8_t type; +uint16_t idx; +}; + +/** Storage for struct rte_flow_action_ipv6_ext_remove. */ +struct ipv6_ext_remove_conf { +struct rte_flow_action_ipv6_ext_remove conf; +uint8_t type; +}; + +struct ipv6_ext_remove_conf ipv6_ext_remove_confs[IPV6_EXT_PUSH_CONFS_MAX_NUM ]; + +/** Storage for struct rte_flow_action_ipv6_ext_remove including external data. */ +struct action_ipv6_ext_remove_data { +struct rte_flow_action_ipv6_ext_remove conf; +uint8_t type; +uint16_t idx; +}; +struct vxlan_encap_conf vxlan_encap_conf = { .select_ipv4 =1 , .select_vlan =0 ,
@@ -2022,6 +2069,8 @@ static const enum index next_action[] = {ACTION_SEND_TO_KERNEL ,ACTION_QUOTA_CREATE ,ACTION_QUOTA_QU , +ACTION_IPV6_EXT_REMOVE , +ACTION_IPV6_EXT_PUSH , ZERO, };
@@ -2230,6 +2279,18 @@ static const enum index action_raw_decap[] = { ZERO, }; +static const enum index action_ipv6_ext_remove[] = { +ACTION_IPV6_EXT_REMOVE_INDEX , +ACTION_NEXT , +ZERO , +}; + +static const enum index action_ipv6_ext_push[] = { +ACTION_IPV6_EXT_PUSH_INDEX , +ACTION_NEXT , +ZERO , +}; +static const enum index action_set_tag[] = {ACTION_SET_TAG_DATA ,ACTION_SET_TAG_INDEX ,
@@ -2293,6 +2354,22 @@ static const enum index next_action_sample[] = { ZERO, }; +static const enum index item_ipv6_push_ext[] = { +ITEM_IPV6_PUSH_REMOVE_EXT , +ZERO , +}; + +static const enum index item_ipv6_push_ext_type[] = { +ITEM_IPV6_PUSH_REMOVE_EXT_TYPE , +ZERO , +}; + +static const enum index item_ipv6_push_ext_header[] = { +ITEM_IPV6_ROUTING_EXT , +ITEM_NEXT , +ZERO , +}; +static const enum index action_modify_field_dst[] = {ACTION_MODIFY_FIELD_DST_LEVEL ,ACTION_MODIFY_FIELD_DST_OFFSET ,
@@ -2334,6 +2411,9 @@ static int parse_set_raw_encap_decap(struct context *, const struct token *,static int parse_set_sample_action (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int ); +static int parse_set_ipv6_ext_action (struct context *,const struct token *, +const char *,unsigned int , +void *,unsigned int );static int parse_set_init (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int );
@@ -2411,6 +2491,22 @@ static int parse_vc_action_raw_encap_index(struct context *,static int parse_vc_action_raw_decap_index (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int ); +static int parse_vc_action_ipv6_ext_remove (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size); +static int parse_vc_action_ipv6_ext_remove_index (struct context *ctx, +const struct token *token, +const char *str,unsigned int len, +void *buf, +unsigned int size); +static int parse_vc_action_ipv6_ext_push (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size); +static int parse_vc_action_ipv6_ext_push_index (struct context *ctx, +const struct token *token, +const char *str,unsigned int len, +void *buf, +unsigned int size); static int parse_vc_action_set_meta(struct context *ctx, const struct token *token, const char *str, unsigned int len, void *buf,
@@ -2596,6 +2692,8 @@ static int comp_set_raw_index(struct context *, const struct token *, unsigned int, char *, unsigned int);static int comp_set_sample_index (struct context *,const struct token *,unsigned int ,char *,unsigned int ); +static int comp_set_ipv6_ext_index (struct context *ctx,const struct token *token, +unsigned int ent,char *buf,unsigned int size);static int comp_set_modify_field_op (struct context *,const struct token *,unsigned int ,char *,unsigned int ); static int comp_set_modify_field_id(struct context *, const struct token *,
@@ -6472,6 +6570,48 @@ static const struct token token_list[] = { .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), .call = parse_vc, }, + [ACTION_IPV6_EXT_REMOVE] = { + .name = "ipv6_ext_remove", + .help = "IPv6 extension type, defined by set ipv6_ext_remove", + .priv =PRIV_ACTION (IPV6_EXT_REMOVE , + sizeof(struct action_ipv6_ext_remove_data)), + .next = NEXT(action_ipv6_ext_remove), + .call = parse_vc_action_ipv6_ext_remove, + }, + [ACTION_IPV6_EXT_REMOVE_INDEX] = { + .name = "index", + .help = "the index of ipv6_ext_remove", + .next = NEXT(NEXT_ENTRY(ACTION_IPV6_EXT_REMOVE_INDEX_VALUE)), + }, + [ACTION_IPV6_EXT_REMOVE_INDEX_VALUE] = { + .name = "{index}", + .type = "UNSIGNED", + .help = "unsigned integer value", + .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), + .call = parse_vc_action_ipv6_ext_remove_index, + .comp = comp_set_ipv6_ext_index, + }, + [ACTION_IPV6_EXT_PUSH] = { + .name = "ipv6_ext_push", + .help = "IPv6 extension data, defined by set ipv6_ext_push", + .priv =PRIV_ACTION (IPV6_EXT_PUSH , + sizeof(struct action_ipv6_ext_push_data)), + .next = NEXT(action_ipv6_ext_push), + .call = parse_vc_action_ipv6_ext_push, + }, + [ACTION_IPV6_EXT_PUSH_INDEX] = { + .name = "index", + .help = "the index of ipv6_ext_push", + .next = NEXT(NEXT_ENTRY(ACTION_IPV6_EXT_PUSH_INDEX_VALUE)), + }, + [ACTION_IPV6_EXT_PUSH_INDEX_VALUE] = { + .name = "{index}", + .type = "UNSIGNED", + .help = "unsigned integer value", + .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), + .call = parse_vc_action_ipv6_ext_push_index, + .comp = comp_set_ipv6_ext_index, + },/* Top level command. */ [SET] = { .name = "set",
@@ -6481,7 +6621,9 @@ static const struct token token_list[] = { .next = NEXT(NEXT_ENTRY (SET_RAW_ENCAP ,SET_RAW_DECAP , - SET_SAMPLE_ACTIONS)), +SET_SAMPLE_ACTIONS , +SET_IPV6_EXT_REMOVE , + SET_IPV6_EXT_PUSH)), .call = parse_set_init, },/* Sub-level commands. */
@@ -6529,6 +6671,49 @@ static const struct token token_list[] = { 0, RAW_SAMPLE_CONFS_MAX_NUM - 1)), .call = parse_set_sample_action, }, + [SET_IPV6_EXT_PUSH] = { + .name = "ipv6_ext_push", + .help = "set IPv6 extension header", + .next = NEXT(NEXT_ENTRY(SET_IPV6_EXT_INDEX)), + .args =ARGS (ARGS_ENTRY_ARB_BOUNDED + (offsetof(struct buffer , port), +sizeof (((struct buffer *)0 )->port), + 0, IPV6_EXT_PUSH_CONFS_MAX_NUM - 1)), + .call = parse_set_ipv6_ext_action, + }, + [SET_IPV6_EXT_REMOVE] = { + .name = "ipv6_ext_remove", + .help = "set IPv6 extension header", + .next = NEXT(NEXT_ENTRY(SET_IPV6_EXT_INDEX)), + .args =ARGS (ARGS_ENTRY_ARB_BOUNDED + (offsetof(struct buffer , port), +sizeof (((struct buffer *)0 )->port), + 0, IPV6_EXT_PUSH_CONFS_MAX_NUM - 1)), + .call = parse_set_ipv6_ext_action, + }, + [SET_IPV6_EXT_INDEX] = { + .name = "{index}", + .type = "UNSIGNED", + .help = "index of ipv6 extension push/remove actions", + .next = NEXT(item_ipv6_push_ext), + .call = parse_port, + }, + [ITEM_IPV6_PUSH_REMOVE_EXT] = { + .name = "ipv6_ext", + .help = "set IPv6 extension header", + .priv =PRIV_ITEM (IPV6_EXT , + sizeof(struct rte_flow_item_ipv6_ext)), + .next = NEXT(item_ipv6_push_ext_type), + .call = parse_vc, + }, + [ITEM_IPV6_PUSH_REMOVE_EXT_TYPE] = { + .name = "type", + .help = "set IPv6 extension type", + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext, + next_hdr)), + .next =NEXT (item_ipv6_push_ext_header,NEXT_ENTRY (COMMON_UNSIGNED ), + item_param), + }, [ACTION_SET_TAG] = { .name = "set_tag", .help = "set tag",
@@ -8843,6 +9028,140 @@ parse_vc_action_raw_decap(struct context *ctx, const struct token *token,return ret; } +static int +parse_vc_action_ipv6_ext_remove (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size) +{ +struct buffer *out = buf; +struct rte_flow_action *action; +struct action_ipv6_ext_remove_data *ipv6_ext_remove_data =NULL ; +int ret; + + ret =parse_vc (ctx, token, str, len, buf, size); +if (ret <0 ) +return ret; +/* Nothing else to do if there is no buffer. */ +if (!out) +return ret; +if (!out->args.vc.actions_n) +return -1 ; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; +/* Point to selected object. */ + ctx->object = out->args.vc.data; + ctx->objmask =NULL ; +/* Copy the headers to the buffer. */ + ipv6_ext_remove_data = ctx->object; + ipv6_ext_remove_data->conf.type = ipv6_ext_remove_confs[0 ].type; + action->conf = &ipv6_ext_remove_data->conf; +return ret; +} + +static int +parse_vc_action_ipv6_ext_remove_index (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size) +{ +struct action_ipv6_ext_remove_data *action_ipv6_ext_remove_data; +struct rte_flow_action *action; +const struct arg *arg; +struct buffer *out = buf; +int ret; +uint16_t idx; + +RTE_SET_USED (token); +RTE_SET_USED (buf); +RTE_SET_USED (size); + arg =ARGS_ENTRY_ARB_BOUNDED + (offsetof(struct action_ipv6_ext_remove_data , idx), +sizeof (((struct action_ipv6_ext_remove_data *)0 )->idx), +0 ,IPV6_EXT_PUSH_CONFS_MAX_NUM -1 ); +if (push_args (ctx, arg)) +return -1 ; + ret =parse_int (ctx, token, str, len,NULL ,0 ); +if (ret <0 ) { +pop_args (ctx); +return -1 ; + } +if (!ctx->object) +return len; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; + action_ipv6_ext_remove_data = ctx->object; + idx = action_ipv6_ext_remove_data->idx; + action_ipv6_ext_remove_data->conf.type = ipv6_ext_remove_confs[idx].type; + action->conf = &action_ipv6_ext_remove_data->conf; +return len; +} + +static int +parse_vc_action_ipv6_ext_push (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size) +{ +struct buffer *out = buf; +struct rte_flow_action *action; +struct action_ipv6_ext_push_data *ipv6_ext_push_data =NULL ; +int ret; + + ret =parse_vc (ctx, token, str, len, buf, size); +if (ret <0 ) +return ret; +/* Nothing else to do if there is no buffer. */ +if (!out) +return ret; +if (!out->args.vc.actions_n) +return -1 ; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; +/* Point to selected object. */ + ctx->object = out->args.vc.data; + ctx->objmask =NULL ; +/* Copy the headers to the buffer. */ + ipv6_ext_push_data = ctx->object; + ipv6_ext_push_data->conf.type = ipv6_ext_push_confs[0 ].type; + ipv6_ext_push_data->conf.data = ipv6_ext_push_confs[0 ].data; + ipv6_ext_push_data->conf.size = ipv6_ext_push_confs[0 ].size; + action->conf = &ipv6_ext_push_data->conf; +return ret; +} + +static int +parse_vc_action_ipv6_ext_push_index (struct context *ctx,const struct token *token, +const char *str,unsigned int len,void *buf, +unsigned int size) +{ +struct action_ipv6_ext_push_data *action_ipv6_ext_push_data; +struct rte_flow_action *action; +const struct arg *arg; +struct buffer *out = buf; +int ret; +uint16_t idx; + +RTE_SET_USED (token); +RTE_SET_USED (buf); +RTE_SET_USED (size); + arg =ARGS_ENTRY_ARB_BOUNDED + (offsetof(struct action_ipv6_ext_push_data , idx), +sizeof (((struct action_ipv6_ext_push_data *)0 )->idx), +0 ,IPV6_EXT_PUSH_CONFS_MAX_NUM -1 ); +if (push_args (ctx, arg)) +return -1 ; + ret =parse_int (ctx, token, str, len,NULL ,0 ); +if (ret <0 ) { +pop_args (ctx); +return -1 ; + } +if (!ctx->object) +return len; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; + action_ipv6_ext_push_data = ctx->object; + idx = action_ipv6_ext_push_data->idx; + action_ipv6_ext_push_data->conf.type = ipv6_ext_push_confs[idx].type; + action_ipv6_ext_push_data->conf.size = ipv6_ext_push_confs[idx].size; + action_ipv6_ext_push_data->conf.data = ipv6_ext_push_confs[idx].data; + action->conf = &action_ipv6_ext_push_data->conf; +return len; +} + static int parse_vc_action_set_meta(struct context *ctx, const struct token *token, const char *str, unsigned int len, void *buf,
@@ -10532,6 +10851,35 @@ parse_set_sample_action(struct context *ctx, const struct token *token,return len; } +/** Parse set command, initialize output buffer for subsequent tokens. */ +static int +parse_set_ipv6_ext_action (struct context *ctx,const struct token *token, +const char *str,unsigned int len, +void *buf,unsigned int size) +{ +struct buffer *out = buf; + +/* Token name must match. */ +if (parse_default (ctx, token, str, len,NULL ,0 ) <0 ) +return -1 ; +/* Nothing else to do if there is no buffer. */ +if (!out) +return len; +/* Make sure buffer is large enough. */ +if (size <sizeof (*out)) +return -1 ; + ctx->objdata =0 ; + ctx->objmask =NULL ; + ctx->object = out; +if (!out->command) +return -1 ; + out->command = ctx->curr; +/* For ipv6_ext_push/remove we need is pattern */ + out->args.vc.pattern = (void *)RTE_ALIGN_CEIL ((uintptr_t )(out +1 ), +sizeof (double )); +return len; +} +/** * Parse set raw_encap/raw_decap command, * initialize output buffer for subsequent tokens.
@@ -10961,6 +11309,24 @@ comp_set_raw_index(struct context *ctx, const struct token *token,return nb; } +/** Complete index number for set raw_ipv6_ext_push/ipv6_ext_remove commands. */ +static int +comp_set_ipv6_ext_index (struct context *ctx,const struct token *token, +unsigned int ent,char *buf,unsigned int size) +{ +uint16_t idx =0 ; +uint16_t nb =0 ; + +RTE_SET_USED (ctx); +RTE_SET_USED (token); +for (idx =0 ; idx <IPV6_EXT_PUSH_CONFS_MAX_NUM ; ++idx) { +if (buf && idx == ent) +return snprintf (buf, size,"%u" , idx); + ++nb; + } +return nb; +} +/** Complete index number for set raw_encap/raw_decap commands. */ static int comp_set_sample_index(struct context *ctx, const struct token *token,
@@ -11855,6 +12221,78 @@ flow_item_default_mask(const struct rte_flow_item *item)return mask; } +/** Dispatch parsed buffer to function calls. */ +static void +cmd_set_ipv6_ext_parsed (const struct buffer *in) +{ +uint32_t n = in->args.vc.pattern_n; +int i =0 ; +struct rte_flow_item *item =NULL ; +size_t size =0 ; +uint8_t *data =NULL ; +uint8_t *type =NULL ; +size_t *total_size =NULL ; +uint16_t idx = in->port;/* We borrow port field as index */ +struct rte_flow_item_ipv6_routing_ext *ext; +const struct rte_flow_item_ipv6_ext *ipv6_ext; + +RTE_ASSERT (in->command ==SET_IPV6_EXT_PUSH || + in->command ==SET_IPV6_EXT_REMOVE ); + +if (in->command ==SET_IPV6_EXT_REMOVE ) { +if (n !=1 || in->args.vc.pattern->type != +RTE_FLOW_ITEM_TYPE_IPV6_EXT ) { +fprintf (stderr,"Error - Not supported item\n" ); +return ; + } + type = (uint8_t *)&ipv6_ext_remove_confs[idx].type; + item = in->args.vc.pattern; + ipv6_ext = item->spec; + *type = ipv6_ext->next_hdr; +return ; + } + + total_size = &ipv6_ext_push_confs[idx].size; + data = (uint8_t *)&ipv6_ext_push_confs[idx].data; + type = (uint8_t *)&ipv6_ext_push_confs[idx].type; + + *total_size =0 ; +memset (data,0x00 ,ACTION_RAW_ENCAP_MAX_DATA ); +for (i = n -1 ; i >=0 ; --i) { + item = in->args.vc.pattern + i; +switch (item->type) { +case RTE_FLOW_ITEM_TYPE_IPV6_EXT : + ipv6_ext = item->spec; + *type = ipv6_ext->next_hdr; +break ; +case RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT : + ext = (struct rte_flow_item_ipv6_routing_ext *)(uintptr_t )item->spec; +if (!ext->hdr.hdr_len) { + size =sizeof (struct rte_ipv6_routing_ext ) + + (ext->hdr.segments_left <<4 ); + ext->hdr.hdr_len = ext->hdr.segments_left <<1 ; +/* Indicate no TLV once SRH. */ +if (ext->hdr.type ==4 ) + ext->hdr.last_entry = ext->hdr.segments_left -1 ; + }else { + size =sizeof (struct rte_ipv6_routing_ext ) + + (ext->hdr.hdr_len <<3 ); + } + *total_size += size; +memcpy (data, ext, size); +break ; +default : +fprintf (stderr,"Error - Not supported item\n" ); + goto error; + } + } +RTE_ASSERT ((*total_size) <=ACTION_IPV6_EXT_PUSH_MAX_DATA ); +return ; +error: + *total_size =0 ; +memset (data,0x00 ,ACTION_IPV6_EXT_PUSH_MAX_DATA ); +} +/** Dispatch parsed buffer to function calls. */ static void cmd_set_raw_parsed_sample (const struct buffer *in)
@@ -11988,6 +12426,9 @@ cmd_set_raw_parsed(const struct buffer *in)if (in->command ==SET_SAMPLE_ACTIONS )return cmd_set_raw_parsed_sample (in); +else if (in->command ==SET_IPV6_EXT_PUSH || + in->command ==SET_IPV6_EXT_REMOVE ) +return cmd_set_ipv6_ext_parsed (in);RTE_ASSERT (in->command ==SET_RAW_ENCAP || in->command ==SET_RAW_DECAP );if (in->command ==SET_RAW_ENCAP ) {
Signature · 1 line
2.27.0
RE: [PATCH v1 2/8] app/testpmd: add IPv6 extension push remove cli
Hi Rongwei,
Quoted 17 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Monday, April 17, 2023 12:26 PMAdd command lines to generate IPv6 routing extension push and remove patterns and follow the raw_encap/decap style.
Add the new actions to the action template parsing.
Generating the action patterns
1. IPv6 routing extension push
setipv6_ext_push1ipv6_exttype is 43 /ipv6_routing_extext_typeis 4ext_next_hdris 17ext_seg_leftis 2 /end_set
2. IPv6 routing extension remove
setipv6_ext_remove1ipv6_exttype is 43 /end_set
Quoted 6 lines
Specifying the action in the template
1.actions_template_id1 templateipv6_ext_pushindex 1
2.actions_template_id1 templateipv6_ext_removeindex 1Signed-off-by Rongwei Liu <[email protected]>---
Best,
Ori
PATCH 3/8 net/mlx5/hws: add no reparse support
In reply to Rongwei LiuAllocate two groups of RTC to control hardware reparsing when flow is updated.
1. Group 1 always reparse the traffic after packet is modified by any hardware module. This is the default behavior which is the same as before.
2. Group 2 doesn't perform any packets reparsing. This will help the complex flow rules.
--- drivers/net/mlx5/hws/mlx5dr_cmd.c | 5 +- drivers/net/mlx5/hws/mlx5dr_cmd.h | 1 + drivers/net/mlx5/hws/mlx5dr_debug.c | 8 +-- drivers/net/mlx5/hws/mlx5dr_matcher.c | 80 +++++++++++++++++---------- drivers/net/mlx5/hws/mlx5dr_matcher.h | 12 ++-- drivers/net/mlx5/hws/mlx5dr_rule.c | 65 ++++++++++++++++------ 6 files changed, 117 insertions(+), 54 deletions(-)
drivers/net/mlx5/hws/mlx5dr_cmd.c +4 -1
@@ -283,7 +283,10 @@ mlx5dr_cmd_rtc_create(struct ibv_context *ctx,MLX5_SET (rtc, attr, ste_table_base_id, rtc_attr->ste_base);MLX5_SET (rtc, attr, ste_table_offset, rtc_attr->ste_offset);MLX5_SET (rtc, attr, miss_flow_table_id, rtc_attr->miss_ft_id); -MLX5_SET (rtc, attr, reparse_mode,MLX5_IFC_RTC_REPARSE_ALWAYS ); +if (rtc_attr->is_reparse) +MLX5_SET (rtc, attr, reparse_mode,MLX5_IFC_RTC_REPARSE_ALWAYS ); +else +MLX5_SET (rtc, attr, reparse_mode,MLX5_IFC_RTC_REPARSE_NEVER ); devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));if (!devx_obj->obj) {
drivers/net/mlx5/hws/mlx5dr_cmd.h +1 -0
@@ -51,6 +51,7 @@ struct mlx5dr_cmd_rtc_create_attr {uint8_t match_definer_1;bool is_frst_jumbo;bool is_scnd_range; +uint8_t is_reparse; };struct mlx5dr_cmd_alias_obj_create_attr {
drivers/net/mlx5/hws/mlx5dr_debug.c +4 -4
@@ -224,9 +224,9 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher) } ret =fprintf (f,",%d,%d,%d,%d" , - matcher->match_ste.rtc_0 ? matcher->match_ste.rtc_0->id :0 , + matcher->match_ste.rtc_0_reparse ? matcher->match_ste.rtc_0_reparse->id :0 , ste_0 ? (int )ste_0->id :-1 , - matcher->match_ste.rtc_1 ? matcher->match_ste.rtc_1->id :0 , + matcher->match_ste.rtc_1_reparse ? matcher->match_ste.rtc_1_reparse->id :0 , ste_1 ? (int )ste_1->id :-1 );if (ret <0 ) goto out_err;
@@ -243,9 +243,9 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher) } ret =fprintf (f,",%d,%d,%d,%d,%d\n" , - matcher->action_ste.rtc_0 ? matcher->action_ste.rtc_0->id :0 , + matcher->action_ste.rtc_0_reparse ? matcher->action_ste.rtc_0_reparse->id :0 , ste_0 ? (int )ste_0->id :-1 , - matcher->action_ste.rtc_1 ? matcher->action_ste.rtc_1->id :0 , + matcher->action_ste.rtc_1_reparse ? matcher->action_ste.rtc_1_reparse->id :0 , ste_1 ? (int )ste_1->id :-1 , is_shared && !is_root ? matcher->match_ste.aliased_rtc_0->id :0 );
drivers/net/mlx5/hws/mlx5dr_matcher.c +52 -28
171 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_matcher.h +8 -4
@@ -43,8 +43,10 @@ struct mlx5dr_match_template {struct mlx5dr_matcher_match_ste {struct mlx5dr_pool_chunk ste; -struct mlx5dr_devx_obj *rtc_0; -struct mlx5dr_devx_obj *rtc_1; +struct mlx5dr_devx_obj *rtc_0_reparse; +struct mlx5dr_devx_obj *rtc_1_reparse; +struct mlx5dr_devx_obj *rtc_0_no_reparse; +struct mlx5dr_devx_obj *rtc_1_no_reparse;struct mlx5dr_pool *pool;/* Currently not support FDB aliased */ struct mlx5dr_devx_obj *aliased_rtc_0;
@@ -53,8 +55,10 @@ struct mlx5dr_matcher_match_ste {struct mlx5dr_matcher_action_ste {struct mlx5dr_pool_chunk ste;struct mlx5dr_pool_chunk stc; -struct mlx5dr_devx_obj *rtc_0; -struct mlx5dr_devx_obj *rtc_1; +struct mlx5dr_devx_obj *rtc_0_reparse; +struct mlx5dr_devx_obj *rtc_1_reparse; +struct mlx5dr_devx_obj *rtc_0_no_reparse; +struct mlx5dr_devx_obj *rtc_1_no_reparse;struct mlx5dr_pool *pool;uint8_t max_stes; };
drivers/net/mlx5/hws/mlx5dr_rule.c +48 -17
132 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH 4/8 net/mlx5: sample the srv6 last segment
In reply to Rongwei LiuWhen removing the IPv6 routing extension header from the packets, the destination address should be updated to the last one in the segment list.
Enlarge the hardware sample scope to cover the last segment.
--- drivers/net/mlx5/mlx5.c | 42 +++++++++++++++++++++++++----------- drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.h | 15 +++++++++++++ 3 files changed, 46 insertions(+), 12 deletions(-)
drivers/net/mlx5/mlx5.c +30 -12
@@ -1054,7 +1054,7 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev)struct mlx5_devx_graph_node_attr node = { .modify_field_select =0 , }; -uint32_t ids[MLX5_GRAPH_NODE_SAMPLE_NUM ]; +uint32_t i, ids[MLX5_GRAPH_NODE_SAMPLE_NUM ];struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_common_dev_config *config = &priv->sh->cdev->config;void *fp =NULL , *ibv_ctx = priv->sh->cdev->ctx;
@@ -1084,10 +1084,18 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) node.next_header_field_size =0x8 ; node.in[0 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_IP ; node.in[0 ].compare_condition_value =IPPROTO_ROUTING ; - node.sample[0 ].flow_match_sample_en =1 ; -/* First come first serve no matter inner or outer. */ - node.sample[0 ].flow_match_sample_tunnel_mode =MLX5_GRAPH_SAMPLE_TUNNEL_FIRST ; - node.sample[0 ].flow_match_sample_offset_mode =MLX5_GRAPH_SAMPLE_OFFSET_FIXED ; +/* Final IPv6 address. */ +for (i =0 ; i <=4 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + node.sample[i].flow_match_sample_en =1 ; + node.sample[i].flow_match_sample_offset_mode = +MLX5_GRAPH_SAMPLE_OFFSET_FIXED ; +/* First come first serve no matter inner or outer. */ + node.sample[i].flow_match_sample_tunnel_mode = +MLX5_GRAPH_SAMPLE_TUNNEL_FIRST ; + node.sample[i].flow_match_sample_field_base_offset = + (i +1 ) *sizeof (uint32_t );/* in bytes */ + } + node.sample[0 ].flow_match_sample_field_base_offset =0 ; node.out[0 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_TCP ; node.out[0 ].compare_condition_value =IPPROTO_TCP ; node.out[1 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_UDP ;
@@ -1100,8 +1108,8 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) goto error; } priv->sh->srh_flex_parser.flex.devx_fp->devx_obj = fp; - priv->sh->srh_flex_parser.flex.mapnum =1 ; - priv->sh->srh_flex_parser.flex.devx_fp->num_samples =1 ; + priv->sh->srh_flex_parser.flex.mapnum =5 ; + priv->sh->srh_flex_parser.flex.devx_fp->num_samples =5 ; ret =mlx5_devx_cmd_query_parse_samples (fp, ids, priv->sh->srh_flex_parser.flex.mapnum, &priv->sh->srh_flex_parser.flex.devx_fp->anchor_id);
@@ -1109,12 +1117,22 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev)DRV_LOG (ERR ,"Failed to query sample IDs." ); goto error; } - ret =mlx5_devx_cmd_match_sample_info_query (ibv_ctx, ids[0 ], - &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[0 ]); -if (ret) { -DRV_LOG (ERR ,"Failed to query sample id information." ); - goto error; +for (i =0 ; i <=4 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + ret =mlx5_devx_cmd_match_sample_info_query (ibv_ctx, ids[i], + &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[i]); +if (ret) { +DRV_LOG (ERR ,"Failed to query sample id %u information." , ids[i]); + goto error; + } + } +for (i =0 ; i <=4 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + priv->sh->srh_flex_parser.flex.devx_fp->sample_ids[i] = ids[i]; + priv->sh->srh_flex_parser.flex.map[i].width =sizeof (uint32_t ) *CHAR_BIT ; + priv->sh->srh_flex_parser.flex.map[i].reg_id = i; + priv->sh->srh_flex_parser.flex.map[i].shift = + (i +1 ) *sizeof (uint32_t ) *CHAR_BIT ; } + priv->sh->srh_flex_parser.flex.map[0 ].shift =0 ;return 0 ; error:if (fp)
drivers/net/mlx5/mlx5.h +1 -0
@@ -1323,6 +1323,7 @@ struct mlx5_flex_pattern_field { uint16_t shift:5; uint16_t reg_id:5; }; +#define MLX5_INVALID_SAMPLE_REG_ID 0x1F/* Port flex item context. */
drivers/net/mlx5/mlx5_flow.h +15 -0
@@ -2666,4 +2666,19 @@ flow_hw_get_srh_flex_parser_byte_off_from_ctx(void *dr_ctx __rte_unused)#endif return UINT32_MAX ; } + +static __rte_always_inline void * +flow_hw_get_dev_from_ctx (void *dr_ctx) +{ +uint16_t port; +struct mlx5_priv *priv; + + MLX5_ETH_FOREACH_DEV(port, NULL) { + priv = rte_eth_devices[port].data->dev_private; +if (priv->dr_ctx == dr_ctx) +return &rte_eth_devices[port]; + } +return NULL ; +} +#endif /* RTE_PMD_MLX5_FLOW_H_ */
Signature · 1 line
2.27.0
v2 cover support IPv6 extension push remove
Support IPv6 extension push/remove in MLX5 PMD.
Routing extension is the only supported type.
v2: add reparse control and rebase.
Rongwei Liu (6):
net/mlx5: sample the srv6 last segment net/mlx5/hws: fix potential wrong errno value net/mlx5/hws: add IPv6 routing extension push remove actions net/mlx5/hws: add setter for IPv6 routing push remove net/mlx5: implement IPv6 routing push remove net/mlx5/hws: add stc reparse support for srv6 push pop
doc/guides/nics/features/mlx5.ini | 2 + doc/guides/nics/mlx5.rst | 11 +- doc/guides/rel_notes/release_23_11.rst | 2 + drivers/common/mlx5/mlx5_prm.h | 1 + drivers/net/mlx5/hws/mlx5dr.h | 29 ++ drivers/net/mlx5/hws/mlx5dr_action.c | 621 ++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 17 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 2 + drivers/net/mlx5/mlx5.c | 41 +- drivers/net/mlx5/mlx5.h | 7 + drivers/net/mlx5/mlx5_flow.h | 65 ++- drivers/net/mlx5/mlx5_flow_hw.c | 282 ++++++++++- 12 files changed, 1033 insertions(+), 47 deletions(-)
Signature · 1 line
2.27.0
PATCH v2 1/6 net/mlx5: sample the srv6 last segment
When removing the IPv6 routing extension header from the packets, the destination address should be updated to the last one in the segment list.
Enlarge the hardware sample scope to cover the last segment.
--- drivers/net/mlx5/mlx5.c | 41 ++++++++++++++++++++++++++++++----------- drivers/net/mlx5/mlx5.h | 6 ++++++ 2 files changed, 36 insertions(+), 11 deletions(-)
drivers/net/mlx5/mlx5.c +30 -11
@@ -1067,6 +1067,7 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev)struct mlx5_devx_graph_node_attr node = { .modify_field_select =0 , }; +uint32_t i;uint32_t ids[MLX5_GRAPH_NODE_SAMPLE_NUM ];struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_common_dev_config *config = &priv->sh->cdev->config;
@@ -1100,10 +1101,18 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) node.next_header_field_size =0x8 ; node.in[0 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_IP ; node.in[0 ].compare_condition_value =IPPROTO_ROUTING ; - node.sample[0 ].flow_match_sample_en =1 ; -/* First come first serve no matter inner or outer. */ - node.sample[0 ].flow_match_sample_tunnel_mode =MLX5_GRAPH_SAMPLE_TUNNEL_FIRST ; - node.sample[0 ].flow_match_sample_offset_mode =MLX5_GRAPH_SAMPLE_OFFSET_FIXED ; +/* Final IPv6 address. */ +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + node.sample[i].flow_match_sample_en =1 ; + node.sample[i].flow_match_sample_offset_mode = +MLX5_GRAPH_SAMPLE_OFFSET_FIXED ; +/* First come first serve no matter inner or outer. */ + node.sample[i].flow_match_sample_tunnel_mode = +MLX5_GRAPH_SAMPLE_TUNNEL_FIRST ; + node.sample[i].flow_match_sample_field_base_offset = + (i +1 ) *sizeof (uint32_t );/* in bytes */ + } + node.sample[0 ].flow_match_sample_field_base_offset =0 ; node.out[0 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_TCP ; node.out[0 ].compare_condition_value =IPPROTO_TCP ; node.out[1 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_UDP ;
@@ -1116,8 +1125,8 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) goto error; } priv->sh->srh_flex_parser.flex.devx_fp->devx_obj = fp; - priv->sh->srh_flex_parser.flex.mapnum =1 ; - priv->sh->srh_flex_parser.flex.devx_fp->num_samples =1 ; + priv->sh->srh_flex_parser.flex.mapnum =MLX5_SRV6_SAMPLE_NUM ; + priv->sh->srh_flex_parser.flex.devx_fp->num_samples =MLX5_SRV6_SAMPLE_NUM ; ret =mlx5_devx_cmd_query_parse_samples (fp, ids, priv->sh->srh_flex_parser.flex.mapnum, &priv->sh->srh_flex_parser.flex.devx_fp->anchor_id);
@@ -1125,12 +1134,22 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev)DRV_LOG (ERR ,"Failed to query sample IDs." ); goto error; } - ret =mlx5_devx_cmd_match_sample_info_query (ibv_ctx, ids[0 ], - &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[0 ]); -if (ret) { -DRV_LOG (ERR ,"Failed to query sample id information." ); - goto error; +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + ret =mlx5_devx_cmd_match_sample_info_query (ibv_ctx, ids[i], + &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[i]); +if (ret) { +DRV_LOG (ERR ,"Failed to query sample id %u information." , ids[i]); + goto error; + } + } +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + priv->sh->srh_flex_parser.flex.devx_fp->sample_ids[i] = ids[i]; + priv->sh->srh_flex_parser.flex.map[i].width =sizeof (uint32_t ) *CHAR_BIT ; + priv->sh->srh_flex_parser.flex.map[i].reg_id = i; + priv->sh->srh_flex_parser.flex.map[i].shift = + (i +1 ) *sizeof (uint32_t ) *CHAR_BIT ; } + priv->sh->srh_flex_parser.flex.map[0 ].shift =0 ;return 0 ; error:if (fp)
drivers/net/mlx5/mlx5.h +6 -0
@@ -1335,6 +1335,7 @@ struct mlx5_flex_pattern_field { uint16_t shift:5; uint16_t reg_id:5; }; +#define MLX5_INVALID_SAMPLE_REG_ID 0x1F/* Port flex item context. */
@@ -1346,6 +1347,11 @@ struct mlx5_flex_item {struct mlx5_flex_pattern_field map[MLX5_FLEX_ITEM_MAPPING_NUM ]; }; +/* +* Sample an IPv6 address and the first dword of SRv6 header. +* Then it is 16 + 4 = 20 bytes which is 5 dwords. +*/ +#define MLX5_SRV6_SAMPLE_NUM 5/* Mlx5 internal flex parser profile structure. */ struct mlx5_internal_flex_parser_profile {uint32_t refcnt;
Signature · 1 line
2.27.0
PATCH v2 2/6 net/mlx5/hws: fix potential wrong errno value
In reply to Rongwei LiuA valid rte_errno is desired when DR layer api returns error and it can't over-write the value set by under-layer.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +1 -1
@@ -2262,6 +2262,7 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,if (!num_of_hdrs) {DR_LOG (ERR ,"Reformat num_of_hdrs cannot be zero" ); + rte_errno =EINVAL ;return NULL ; }
@@ -2309,7 +2310,6 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx, reformat_hdrs, log_bulk_size);if (ret) {DR_LOG (ERR ,"Failed to create HWS reformat action" ); - rte_errno =EINVAL ; goto free_reformat_hdrs; }
Signature · 1 line
2.27.0
PATCH v2 3/6 net/mlx5/hws: add IPv6 routing extension push remove actions
In reply to Rongwei LiuAdd two dr_actions to implement IPv6 routing extension push and remove, the new actions are multiple actions combination instead of new types.
Basically, there are two modify headers plus one reformat action. Action order is the same as encap and decap actions.
--- drivers/common/mlx5/mlx5_prm.h | 1 + drivers/net/mlx5/hws/mlx5dr.h | 29 +++ drivers/net/mlx5/hws/mlx5dr_action.c | 358 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 7 + drivers/net/mlx5/hws/mlx5dr_debug.c | 2 + drivers/net/mlx5/mlx5_flow.h | 44 ++++ 6 files changed, 438 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +1 -0
@@ -3586,6 +3586,7 @@ enum mlx5_ifc_header_anchors {MLX5_HEADER_ANCHOR_PACKET_START =0x0 ,MLX5_HEADER_ANCHOR_FIRST_VLAN_START =0x2 ,MLX5_HEADER_ANCHOR_IPV6_IPV4 =0x07 , +MLX5_HEADER_ANCHOR_TCP_UDP =0x09 ,MLX5_HEADER_ANCHOR_INNER_MAC =0x13 , MLX5_HEADER_ANCHOR_INNER_IPV6_IPV4 = 0x19, };
drivers/net/mlx5/hws/mlx5dr.h +29 -0
@@ -54,6 +54,8 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_REMOVE_HEADER ,MLX5DR_ACTION_TYP_DEST_ROOT ,MLX5DR_ACTION_TYP_DEST_ARRAY , +MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT , +MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT , MLX5DR_ACTION_TYP_MAX, };
@@ -278,6 +280,11 @@ struct mlx5dr_rule_action {uint8_t *data; } reformat; +struct { +uint32_t offset; +uint8_t *header; + } ipv6_ext; +struct {rte_be32_t vlan_hdr; } push_vlan;
@@ -889,6 +896,28 @@ mlx5dr_action_create_remove_header(struct mlx5dr_context *ctx,struct mlx5dr_action_remove_header_attr *attr, uint32_t flags); +/* Create action to push or remove IPv6 extension header. +* +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] type +* Type of direct rule action: MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT or +* MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT. +* @param[in] hdr +* Header for packet reformat. +* @param[in] log_bulk_size +* Number of unique values used with this pattern. +* @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_reformat_ipv6_ext (struct mlx5dr_context *ctx, +enum mlx5dr_action_type type, +struct mlx5dr_action_reformat_header *hdr, +uint32_t log_bulk_size, +uint32_t flags); +/* Destroy direct rule action. * * @param[in] action
drivers/net/mlx5/hws/mlx5dr_action.c +355 -3
406 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +7 -0
@@ -8,6 +8,9 @@/* Max number of STEs needed for a rule (including match) */ #define MLX5DR_ACTION_MAX_STE 10 +/* Max number of internal subactions of ipv6_ext */ +#define MLX5DR_ACTION_IPV6_EXT_MAX_SA 4 +enum mlx5dr_action_stc_idx {MLX5DR_ACTION_STC_IDX_CTRL =0 ,MLX5DR_ACTION_STC_IDX_HIT =1 ,
@@ -143,6 +146,10 @@ struct mlx5dr_action {uint8_t offset;bool encap; } reformat; +struct { +struct mlx5dr_action + *action[MLX5DR_ACTION_IPV6_EXT_MAX_SA ]; + } ipv6_route_ext;struct {struct mlx5dr_devx_obj *devx_obj;uint8_t return_reg_id;
drivers/net/mlx5/hws/mlx5dr_debug.c +2 -0
@@ -31,6 +31,8 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_CRYPTO_DECRYPT] = "CRYPTO_DECRYPT", [MLX5DR_ACTION_TYP_INSERT_HEADER] = "INSERT_HEADER", [MLX5DR_ACTION_TYP_REMOVE_HEADER] = "REMOVE_HEADER", + [MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT] = "POP_IPV6_ROUTE_EXT", + [MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT ] ="PUSH_IPV6_ROUTE_EXT" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/mlx5_flow.h +44 -0
56 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v2 4/6 net/mlx5/hws: add setter for IPv6 routing push remove
In reply to Rongwei LiuThe rte action will be translated to multiple dr_actions which need different setters to program them.
In order to leverage the existing setter logic, there is a new callback introduce which called fetch_opt with unique parameter.
For each setter, it may have different reparsing properties. Setter which requires no reparse can't share the same one with the one has reparse enabled even if there is spare space.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 174 +++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +- 2 files changed, 176 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +174 -0
@@ -3311,6 +3311,121 @@ mlx5dr_action_setter_reformat_trailer(struct mlx5dr_actions_apply_data *apply, apply->wqe_data[MLX5DR_ACTION_OFFSET_DW7 ] =0 ; } +static void +mlx5dr_action_setter_ipv6_route_ext_gen_push_mhdr (uint8_t *data,void *mh_data) +{ +uint8_t *action_ptr = mh_data; +uint32_t *ipv6_dst_addr; +uint8_t seg_left; +uint32_t i; + +/* Fetch the last IPv6 address in the segment list which is the next hop */ + seg_left =MLX5_GET (header_ipv6_routing_ext, data, segments_left) -1 ; + ipv6_dst_addr = (uint32_t *)data +MLX5_ST_SZ_DW (header_ipv6_routing_ext) + + seg_left *MLX5_ST_SZ_DW (definer_hl_ipv6_addr); + +/* Load next hop IPv6 address in reverse order to ipv6.dst_address */ +for (i =0 ; i <MLX5_ST_SZ_DW (definer_hl_ipv6_addr); i++) { +MLX5_SET (set_action_in, action_ptr, data,be32toh (*ipv6_dst_addr++)); + action_ptr +=MLX5DR_MODIFY_ACTION_SIZE ; + } + +/* Set ipv6_route_ext.next_hdr per user input */ +MLX5_SET (set_action_in, action_ptr, data, *data); +} + +static void +mlx5dr_action_setter_ipv6_route_ext_mhdr (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = apply->rule_action; +struct mlx5dr_actions_wqe_setter tmp_setter = {0 }; +struct mlx5dr_rule_action tmp_rule_action; +__be64 cmd[MLX5_SRV6_SAMPLE_NUM ] = {0 }; +struct mlx5dr_action *ipv6_ext_action; +uint8_t *header; + + header = rule_action[setter->idx_double].ipv6_ext.header; + ipv6_ext_action = rule_action[setter->idx_double].action; + tmp_rule_action.action = ipv6_ext_action->ipv6_route_ext.action[setter->extra_data]; + +if (tmp_rule_action.action->flags &MLX5DR_ACTION_FLAG_SHARED ) { + tmp_rule_action.modify_header.offset =0 ; + tmp_rule_action.modify_header.pattern_idx =0 ; + tmp_rule_action.modify_header.data =NULL ; + }else { +/* +* Copy ipv6_dst from ipv6_route_ext.last_seg. +* Set ipv6_route_ext.next_hdr. +*/ +mlx5dr_action_setter_ipv6_route_ext_gen_push_mhdr (header, cmd); + tmp_rule_action.modify_header.data = (uint8_t *)cmd; + tmp_rule_action.modify_header.pattern_idx =0 ; + tmp_rule_action.modify_header.offset = + rule_action[setter->idx_double].ipv6_ext.offset; + } + + apply->rule_action = &tmp_rule_action; + +/* Reuse regular */ +mlx5dr_action_setter_modify_header (apply, &tmp_setter); + +/* Swap rule actions from backup */ + apply->rule_action = rule_action; +} + +static void +mlx5dr_action_setter_ipv6_route_ext_insert_ptr (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = apply->rule_action; +struct mlx5dr_actions_wqe_setter tmp_setter = {0 }; +struct mlx5dr_rule_action tmp_rule_action; +struct mlx5dr_action *ipv6_ext_action; +uint8_t header[MLX5_PUSH_MAX_LEN ]; + + ipv6_ext_action = rule_action[setter->idx_double].action; + tmp_rule_action.action = ipv6_ext_action->ipv6_route_ext.action[setter->extra_data]; + +if (tmp_rule_action.action->flags &MLX5DR_ACTION_FLAG_SHARED ) { + tmp_rule_action.reformat.offset =0 ; + tmp_rule_action.reformat.hdr_idx =0 ; + tmp_rule_action.reformat.data =NULL ; + }else { +memcpy (header, rule_action[setter->idx_double].ipv6_ext.header, + tmp_rule_action.action->reformat.header_size); +/* Clear ipv6_route_ext.next_hdr for right checksum */ +MLX5_SET (header_ipv6_routing_ext, header, next_hdr,0 ); + tmp_rule_action.reformat.data = header; + tmp_rule_action.reformat.hdr_idx =0 ; + tmp_rule_action.reformat.offset = + rule_action[setter->idx_double].ipv6_ext.offset; + } + + apply->rule_action = &tmp_rule_action; + +/* Reuse regular */ +mlx5dr_action_setter_insert_ptr (apply, &tmp_setter); + +/* Swap rule actions from backup */ + apply->rule_action = rule_action; +} + +static void +mlx5dr_action_setter_ipv6_route_ext_pop (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = &apply->rule_action[setter->idx_single]; +uint8_t idx =MLX5DR_ACTION_IPV6_EXT_MAX_SA -1 ; +struct mlx5dr_action *action; + +/* Pop the ipv6_route_ext as set_single logic */ + action = rule_action->action->ipv6_route_ext.action[idx]; + apply->wqe_data[MLX5DR_ACTION_OFFSET_DW5 ] =0 ; + apply->wqe_ctrl->stc_ix[MLX5DR_ACTION_STC_IDX_DW5 ] = +htobe32 (action->stc[apply->tbl_type].offset); +} +int mlx5dr_action_template_process (struct mlx5dr_action_template *at) {struct mlx5dr_actions_wqe_setter *start_setter = at->setters +1 ;
@@ -3374,6 +3489,65 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_double = i;break ; +case MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT : +/* +* Backup ipv6_route_ext.next_hdr to ipv6_route_ext.seg_left. +* Set ipv6_route_ext.next_hdr to 0 for checksum bug. +*/ + setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE ); + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =0 ; + setter++; + +/* +* Restore ipv6_route_ext.next_hdr from ipv6_route_ext.seg_left. +* Load the final destination address from flex parser sample 1->4. +*/ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =1 ; + setter++; + +/* Set the ipv6.protocol per ipv6_route_ext.next_hdr */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =2 ; +/* Pop ipv6_route_ext */ + setter->flags |=ASF_SINGLE1 |ASF_REMOVE ; + setter->set_single = &mlx5dr_action_setter_ipv6_route_ext_pop; + setter->idx_single = i; +break ; + +case MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT : +/* Insert ipv6_route_ext with next_hdr as 0 due to checksum bug */ + setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE ); + setter->flags |=ASF_DOUBLE |ASF_INSERT ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_insert_ptr; + setter->idx_double = i; + setter->extra_data =0 ; + setter++; + +/* Set ipv6.protocol as IPPROTO_ROUTING: 0x2b */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =1 ; + setter++; + +/* +* Load the right ipv6_route_ext.next_hdr per user input buffer. +* Load the next dest_addr from the ipv6_route_ext.seg_list[last]. +*/ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =2 ; +break ; +case MLX5DR_ACTION_TYP_MODIFY_HDR :/* Double modify header list */ setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE );
drivers/net/mlx5/hws/mlx5dr_action.h +2 -1
@@ -6,7 +6,7 @@#define MLX5DR_ACTION_H_ /* Max number of STEs needed for a rule (including match) */ -#define MLX5DR_ACTION_MAX_STE 10 +#define MLX5DR_ACTION_MAX_STE 20/* Max number of internal subactions of ipv6_ext */ #define MLX5DR_ACTION_IPV6_EXT_MAX_SA 4
@@ -109,6 +109,7 @@ struct mlx5dr_actions_wqe_setter {uint8_t idx_ctr;uint8_t idx_hit;uint8_t flags; +uint8_t extra_data; };struct mlx5dr_action_template {
Signature · 1 line
2.27.0
PATCH v2 5/6 net/mlx5: implement IPv6 routing push remove
In reply to Rongwei LiuReserve the push data buffer for each job and the maximum length is set to 128 for now.
Only supports type IPPROTO_ROUTING when translating the rte flow action.
Remove actions must be shared globally and only supports next layer as TCP or UDP.
--- doc/guides/nics/features/mlx5.ini | 2 + doc/guides/nics/mlx5.rst | 11 +- doc/guides/rel_notes/release_23_11.rst | 2 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.h | 21 +- drivers/net/mlx5/mlx5_flow_hw.c | 282 ++++++++++++++++++++++++- 6 files changed, 309 insertions(+), 10 deletions(-)
doc/guides/nics/features/mlx5.ini +2 -0
@@ -108,6 +108,8 @@ flag = Y inc_tcp_ack = Y inc_tcp_seq = Y indirect_list = Y +ipv6_ext_push = Y +ipv6_ext_remove = Y jump = Y mark = Y meter = Y
doc/guides/nics/mlx5.rst +10 -1
@@ -148,7 +148,9 @@ Features - Matching on GTP extension header with raw encap/decap action. - Matching on Geneve TLV option header with raw encap/decap action. - Matching on ESP header SPI field. +- Matching on flex item with specific pattern. - Matching on InfiniBand BTH. +- Modify flex item field. - Modify IPv4/IPv6 ECN field. - RSS support in sample action. - E-Switch mirroring and jump.
@@ -166,7 +168,7 @@ Features - Sub-Function. - Matching on represented port. - Matching on aggregated affinity. - +- Push or remove IPv6 routing extension. Limitations -----------
@@ -759,6 +761,13 @@ Limitations to the representor of the source virtual port (SF/VF), while if it is disabled, the traffic will be routed based on the steering rules in the ingress domain. +- IPv6 routing extension push or remove: + + - Supported only with HW Steering enabled (``dv_flow_en`` = 2). + - Supported in non-zero group (No limits on transfer domain if `fdb_def_rule_en` = 1 which is default). + - Only supports TCP or UDP as next layer. + - IPv6 routing header must be the only present extension. + - Not supported on guest port. Statistics ----------
doc/guides/rel_notes/release_23_11.rst +2 -0
@@ -150,6 +150,8 @@ New Features * Added support for ``RTE_FLOW_ACTION_TYPE_INDIRECT_LIST`` flow action. * Added support for ``RTE_FLOW_ITEM_TYPE_PTYPE`` flow item. * Added support for ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR`` flow action and mirror. + * Added support for ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH`` flow action. + * Added support for ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE`` flow action. * **Updated Solarflare net driver.**
drivers/net/mlx5/mlx5.h +1 -0
@@ -373,6 +373,7 @@ struct mlx5_hw_q_job { };void *user_data;/* Job user data. */ uint8_t *encap_data;/* Encap data. */ +uint8_t *push_data;/* IPv6 routing push data. */ struct mlx5_modification_cmd *mhdr_cmd;struct rte_flow_item *items;union {
drivers/net/mlx5/mlx5_flow.h +20 -1
@@ -363,6 +363,8 @@ enum mlx5_feature_name {#define MLX5_FLOW_ACTION_INDIRECT_AGE (1ull << 44)#define MLX5_FLOW_ACTION_QUOTA (1ull << 46)#define MLX5_FLOW_ACTION_PORT_REPRESENTOR (1ull << 47) +#define MLX5_FLOW_ACTION_IPV6_ROUTING_REMOVE (1ull << 48) +#define MLX5_FLOW_ACTION_IPV6_ROUTING_PUSH (1ull << 49)#define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \ (MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE)
@@ -1269,6 +1271,8 @@ typedef int const struct rte_flow_action *, struct mlx5dr_rule_action *); +#define MLX5_MHDR_MAX_CMD ((MLX5_MAX_MODIFY_NUM) * 2 + 1) +/* rte flow action translate to DR action struct. */ struct mlx5_action_construct_data {LIST_ENTRY (mlx5_action_construct_data) next;
@@ -1315,6 +1319,10 @@ struct mlx5_action_construct_data {struct {cnt_id_t id; } shared_counter; +struct { +/* IPv6 extension push data len. */ +uint16_t len; + } ipv6_ext;struct {uint32_t id;uint32_t conf_masked:1 ;
@@ -1359,6 +1367,7 @@ struct rte_flow_actions_template {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. */ +uint16_t recom_off;/* Offset of DR IPv6 routing push remove action. */ uint32_t refcnt;/* Reference counter. */ uint8_t flex_item;/* flex item index. */ };
@@ -1384,7 +1393,14 @@ struct mlx5_hw_encap_decap_action {uint8_t data[];/* Action data. */ }; -#define MLX5_MHDR_MAX_CMD ((MLX5_MAX_MODIFY_NUM) * 2 + 1) +/* Push remove action struct. */ +struct mlx5_hw_push_remove_action { +struct mlx5dr_action *action;/* Action object. */ +/* Is push_remove action shared across flows in table. */ +uint8_t shared; +size_t data_size;/* Action metadata size. */ +uint8_t data[];/* Action data. */ +};/* Modify field action struct. */ struct mlx5_hw_modify_header_action {
@@ -1415,6 +1431,9 @@ struct mlx5_hw_actions {/* Encap/Decap action. */ struct mlx5_hw_encap_decap_action *encap_decap;uint16_t encap_decap_pos;/* Encap/Decap action position. */ +/* Push/remove action. */ +struct mlx5_hw_push_remove_action *push_remove; +uint16_t push_remove_pos;/* Push/remove action position. */ uint32_t mark:1; /* Indicate the mark action. */cnt_id_t cnt_id;/* Counter id. */ uint32_t mtr_id;/* Meter id. */
drivers/net/mlx5/mlx5_flow_hw.c +274 -8
453 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v2 6/6 net/mlx5/hws: add stc reparse support for srv6 push pop
In reply to Rongwei LiuAfter pushing/popping srv6 into/from IPv6 packets, the checksum needs to be correct.
In order to achieve this, there is a need to control each STE' reparse behavior(CX7 and above). Add two more flags enumeration definitions to allow external control of reparse property in stc.
1. Push
a. 1st STE, insert header action, reparse ignored(default reparse
always)
b. 2nd STE, modify IPv6 protocol, reparse always as default. c. 3rd STE, modify header list, reparse always(default reparse
ignored)
2. Pop
a. 1st STE, modify header list, reparse always(default reparse
ignored)
b. 2nd STE, modify header list, reparse always(default reparse
ignored)
c. 3rd STE, modify IPv6 protocol, reparse ignored(default reparse
always); remove header action, reparse always as default.
For CX6Lx and CX6Dx, the reparse behavior is controlled by RTC as always. Only pop action can work well.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 115 +++++++++++++++++++-------- drivers/net/mlx5/hws/mlx5dr_action.h | 7 ++ 2 files changed, 87 insertions(+), 35 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +80 -35
@@ -640,6 +640,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :case MLX5DR_ACTION_TYP_MODIFY_HDR : attr->action_offset =MLX5DR_ACTION_OFFSET_DW6 ; + attr->reparse_mode =MLX5_IFC_STC_REPARSE_IGNORE ;if (action->modify_header.require_reparse) attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ;
@@ -678,9 +679,12 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2 :case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3 :case MLX5DR_ACTION_TYP_INSERT_HEADER : + attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ; +if (!action->reformat.require_reparse) + attr->reparse_mode =MLX5_IFC_STC_REPARSE_IGNORE ; + attr->action_type =MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT ; attr->action_offset =MLX5DR_ACTION_OFFSET_DW6 ; - attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ; attr->insert_header.encap = action->reformat.encap; attr->insert_header.insert_anchor = action->reformat.anchor; attr->insert_header.arg_id = action->reformat.arg_obj->id;
@@ -1441,7 +1445,7 @@ static int mlx5dr_action_handle_insert_with_ptr(struct mlx5dr_action *action, uint8_t num_of_hdrs, struct mlx5dr_action_reformat_header *hdrs, - uint32_t log_bulk_sz) + uint32_t log_bulk_sz, uint32_t reparse) { struct mlx5dr_devx_obj *arg_obj;size_t max_sz =0 ;
@@ -1478,6 +1482,11 @@ mlx5dr_action_handle_insert_with_ptr(struct mlx5dr_action *action, action[i].reformat.encap =1 ; } +if (likely (reparse ==MLX5DR_ACTION_STC_REPARSE_DEFAULT )) + action[i].reformat.require_reparse = true; +else if (reparse ==MLX5DR_ACTION_STC_REPARSE_ON ) + action[i].reformat.require_reparse = true; + ret =mlx5dr_action_create_stcs (&action[i],NULL );if (ret) {DR_LOG (ERR ,"Failed to create stc for reformat" );
@@ -1514,7 +1523,8 @@ mlx5dr_action_handle_l2_to_tunnel_l3(struct mlx5dr_action *action, ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, - log_bulk_sz); + log_bulk_sz, +MLX5DR_ACTION_STC_REPARSE_DEFAULT );if (ret) goto put_shared_stc;
@@ -1657,7 +1667,8 @@ mlx5dr_action_create_reformat_hws(struct mlx5dr_action *action, ret =mlx5dr_action_create_stcs (action,NULL );break ;case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2 : - ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, bulk_size); + ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, bulk_size, +MLX5DR_ACTION_STC_REPARSE_DEFAULT );break ;case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3 : ret =mlx5dr_action_handle_l2_to_tunnel_l3 (action, num_of_hdrs, hdrs, bulk_size);
@@ -1765,7 +1776,8 @@ static int mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, uint8_t num_of_patterns, struct mlx5dr_action_mh_pattern *pattern, - uint32_t log_bulk_size) + uint32_t log_bulk_size, + uint32_t reparse) { struct mlx5dr_devx_obj *pat_obj, *arg_obj = NULL;struct mlx5dr_context *ctx = action->ctx;
@@ -1799,8 +1811,12 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, action[i].modify_header.num_of_patterns = num_of_patterns; action[i].modify_header.max_num_of_actions = max_mh_actions; action[i].modify_header.num_of_actions = num_actions; - action[i].modify_header.require_reparse = -mlx5dr_pat_require_reparse (pattern[i].data, num_actions); + +if (likely (reparse ==MLX5DR_ACTION_STC_REPARSE_DEFAULT )) + action[i].modify_header.require_reparse = +mlx5dr_pat_require_reparse (pattern[i].data, num_actions); +else if (reparse ==MLX5DR_ACTION_STC_REPARSE_ON ) + action[i].modify_header.require_reparse = true;if (num_actions ==1 ) { pat_obj =NULL ;
@@ -1843,12 +1859,12 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action,return rte_errno; } -struct mlx5dr_action * -mlx5dr_action_create_modify_header (struct mlx5dr_context *ctx, -uint8_t num_of_patterns, -struct mlx5dr_action_mh_pattern *patterns, -uint32_t log_bulk_size, -uint32_t flags) +static struct mlx5dr_action * +mlx5dr_action_create_modify_header_reparse (struct mlx5dr_context *ctx, +uint8_t num_of_patterns, +struct mlx5dr_action_mh_pattern *patterns, +uint32_t log_bulk_size, +uint32_t flags,uint32_t reparse) {struct mlx5dr_action *action;int ret;
@@ -1896,7 +1912,8 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_modify_header_hws (action, num_of_patterns, patterns, - log_bulk_size); + log_bulk_size, + reparse);if (ret) goto free_action;
@@ -1907,6 +1924,17 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,return NULL ; } +struct mlx5dr_action * +mlx5dr_action_create_modify_header (struct mlx5dr_context *ctx, +uint8_t num_of_patterns, +struct mlx5dr_action_mh_pattern *patterns, +uint32_t log_bulk_size, +uint32_t flags) +{ +return mlx5dr_action_create_modify_header_reparse (ctx, num_of_patterns, patterns, + log_bulk_size, flags, +MLX5DR_ACTION_STC_REPARSE_DEFAULT ); +}static struct mlx5dr_devx_obj * mlx5dr_action_dest_array_process_reformat(struct mlx5dr_context *ctx, enum mlx5dr_action_type type,
@@ -2254,12 +2282,12 @@ mlx5dr_action_create_reformat_trailer(struct mlx5dr_context *ctx,return action; } -struct mlx5dr_action * -mlx5dr_action_create_insert_header (struct mlx5dr_context *ctx, -uint8_t num_of_hdrs, -struct mlx5dr_action_insert_header *hdrs, -uint32_t log_bulk_size, -uint32_t flags) +static struct mlx5dr_action * +mlx5dr_action_create_insert_header_reparse (struct mlx5dr_context *ctx, +uint8_t num_of_hdrs, +struct mlx5dr_action_insert_header *hdrs, +uint32_t log_bulk_size, +uint32_t flags,uint32_t reparse) {struct mlx5dr_action_reformat_header *reformat_hdrs;struct mlx5dr_action *action;
@@ -2312,7 +2340,8 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx, } ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, - reformat_hdrs, log_bulk_size); + reformat_hdrs, log_bulk_size, + reparse);if (ret) {DR_LOG (ERR ,"Failed to create HWS reformat action" ); goto free_reformat_hdrs;
@@ -2329,6 +2358,18 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,return NULL ; } +struct mlx5dr_action * +mlx5dr_action_create_insert_header (struct mlx5dr_context *ctx, +uint8_t num_of_hdrs, +struct mlx5dr_action_insert_header *hdrs, +uint32_t log_bulk_size, +uint32_t flags) +{ +return mlx5dr_action_create_insert_header_reparse (ctx, num_of_hdrs, hdrs, + log_bulk_size, flags, +MLX5DR_ACTION_STC_REPARSE_DEFAULT ); +} +struct mlx5dr_action * mlx5dr_action_create_remove_header(struct mlx5dr_context *ctx, struct mlx5dr_action_remove_header_attr *attr,
@@ -2422,8 +2463,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr1(struct mlx5dr_action *action) pattern.data = cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_ON ); } static void *
@@ -2469,8 +2511,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr2(struct mlx5dr_action *action) pattern.data = cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_ON ); } static void *
@@ -2496,8 +2539,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr3(struct mlx5dr_action *action) pattern.data = (__be64 *)cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_OFF ); } static int
@@ -2644,8 +2688,9 @@ mlx5dr_action_create_push_ipv6_route_ext(struct mlx5dr_action *action, insert_hdr.hdr.sz = hdr->sz; insert_hdr.hdr.data = header; action->ipv6_route_ext.action[0 ] = -mlx5dr_action_create_insert_header (action->ctx,1 , &insert_hdr, - bulk_size, action->flags); +mlx5dr_action_create_insert_header_reparse (action->ctx,1 , &insert_hdr, + bulk_size, action->flags, +MLX5DR_ACTION_STC_REPARSE_OFF ); action->ipv6_route_ext.action[1 ] =mlx5dr_action_create_push_ipv6_route_ext_mhdr1 (action); action->ipv6_route_ext.action[2] =
@@ -2678,12 +2723,6 @@ mlx5dr_action_create_reformat_ipv6_ext(struct mlx5dr_context *ctx,struct mlx5dr_action *action;int ret; -if (mlx5dr_context_cap_dynamic_reparse (ctx)) { -DR_LOG (ERR ,"IPv6 extension actions is not supported" ); - rte_errno =ENOTSUP ; -return NULL ; - } -if (!mlx5dr_action_is_hws_flags (flags) || ((flags &MLX5DR_ACTION_FLAG_SHARED ) && log_bulk_size)) {DR_LOG (ERR ,"IPv6 extension flags don't fit HWS (flags: 0x%x)" , flags);
@@ -2708,6 +2747,12 @@ mlx5dr_action_create_reformat_ipv6_ext(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_pop_ipv6_route_ext (action);break ;case MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT : +if (!mlx5dr_context_cap_dynamic_reparse (ctx)) { +DR_LOG (ERR ,"IPv6 routing extension push actions is not supported" ); + rte_errno =ENOTSUP ; + goto free_action; + } + ret =mlx5dr_action_create_push_ipv6_route_ext (action, hdr, log_bulk_size);break ;default :
drivers/net/mlx5/hws/mlx5dr_action.h +7 -0
@@ -65,6 +65,12 @@ enum mlx5dr_action_setter_flag { ASF_HIT = 1 << 7, }; +enum mlx5dr_action_stc_reparse { +MLX5DR_ACTION_STC_REPARSE_DEFAULT , +MLX5DR_ACTION_STC_REPARSE_ON , +MLX5DR_ACTION_STC_REPARSE_OFF , +}; +struct mlx5dr_action_default_stc {struct mlx5dr_pool_chunk nop_ctr;struct mlx5dr_pool_chunk nop_dw5;
@@ -146,6 +152,7 @@ struct mlx5dr_action {uint8_t anchor;uint8_t offset;bool encap; +uint8_t require_reparse; } reformat;struct {struct mlx5dr_action
Signature · 1 line
2.27.0
v3 cover support IPv6 extension push remove
In reply to Rongwei LiuSupport IPv6 extension push/remove actions in MLX5 PMD. Routing extension is the only supported type.
v3: rebase.
v2: add reparse control and rebase.
Rongwei Liu (6):
net/mlx5: sample the srv6 last segment net/mlx5/hws: fix potential wrong errno value net/mlx5/hws: add IPv6 routing extension push remove actions net/mlx5/hws: add setter for IPv6 routing push remove net/mlx5: implement IPv6 routing push remove net/mlx5/hws: add stc reparse support for srv6 push pop
doc/guides/nics/features/mlx5.ini | 2 + doc/guides/nics/mlx5.rst | 11 +- doc/guides/rel_notes/release_23_11.rst | 2 + drivers/common/mlx5/mlx5_prm.h | 1 + drivers/net/mlx5/hws/mlx5dr.h | 29 ++ drivers/net/mlx5/hws/mlx5dr_action.c | 621 ++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 17 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 2 + drivers/net/mlx5/mlx5.c | 41 +- drivers/net/mlx5/mlx5.h | 7 + drivers/net/mlx5/mlx5_flow.h | 65 ++- drivers/net/mlx5/mlx5_flow_hw.c | 282 ++++++++++- 12 files changed, 1033 insertions(+), 47 deletions(-)
Signature · 1 line
2.27.0
PATCH v3 1/6 net/mlx5: sample the srv6 last segment
When removing the IPv6 routing extension header from the packets, the destination address should be updated to the last one in the segment list.
Enlarge the hardware sample scope to cover the last segment.
--- drivers/net/mlx5/mlx5.c | 41 ++++++++++++++++++++++++++++++----------- drivers/net/mlx5/mlx5.h | 6 ++++++ 2 files changed, 36 insertions(+), 11 deletions(-)
drivers/net/mlx5/mlx5.c +30 -11
@@ -1067,6 +1067,7 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev)struct mlx5_devx_graph_node_attr node = { .modify_field_select =0 , }; +uint32_t i;uint32_t ids[MLX5_GRAPH_NODE_SAMPLE_NUM ];struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_common_dev_config *config = &priv->sh->cdev->config;
@@ -1100,10 +1101,18 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) node.next_header_field_size =0x8 ; node.in[0 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_IP ; node.in[0 ].compare_condition_value =IPPROTO_ROUTING ; - node.sample[0 ].flow_match_sample_en =1 ; -/* First come first serve no matter inner or outer. */ - node.sample[0 ].flow_match_sample_tunnel_mode =MLX5_GRAPH_SAMPLE_TUNNEL_FIRST ; - node.sample[0 ].flow_match_sample_offset_mode =MLX5_GRAPH_SAMPLE_OFFSET_FIXED ; +/* Final IPv6 address. */ +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + node.sample[i].flow_match_sample_en =1 ; + node.sample[i].flow_match_sample_offset_mode = +MLX5_GRAPH_SAMPLE_OFFSET_FIXED ; +/* First come first serve no matter inner or outer. */ + node.sample[i].flow_match_sample_tunnel_mode = +MLX5_GRAPH_SAMPLE_TUNNEL_FIRST ; + node.sample[i].flow_match_sample_field_base_offset = + (i +1 ) *sizeof (uint32_t );/* in bytes */ + } + node.sample[0 ].flow_match_sample_field_base_offset =0 ; node.out[0 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_TCP ; node.out[0 ].compare_condition_value =IPPROTO_TCP ; node.out[1 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_UDP ;
@@ -1116,8 +1125,8 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) goto error; } priv->sh->srh_flex_parser.flex.devx_fp->devx_obj = fp; - priv->sh->srh_flex_parser.flex.mapnum =1 ; - priv->sh->srh_flex_parser.flex.devx_fp->num_samples =1 ; + priv->sh->srh_flex_parser.flex.mapnum =MLX5_SRV6_SAMPLE_NUM ; + priv->sh->srh_flex_parser.flex.devx_fp->num_samples =MLX5_SRV6_SAMPLE_NUM ; ret =mlx5_devx_cmd_query_parse_samples (fp, ids, priv->sh->srh_flex_parser.flex.mapnum, &priv->sh->srh_flex_parser.flex.devx_fp->anchor_id);
@@ -1125,12 +1134,22 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev)DRV_LOG (ERR ,"Failed to query sample IDs." ); goto error; } - ret =mlx5_devx_cmd_match_sample_info_query (ibv_ctx, ids[0 ], - &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[0 ]); -if (ret) { -DRV_LOG (ERR ,"Failed to query sample id information." ); - goto error; +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + ret =mlx5_devx_cmd_match_sample_info_query (ibv_ctx, ids[i], + &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[i]); +if (ret) { +DRV_LOG (ERR ,"Failed to query sample id %u information." , ids[i]); + goto error; + } + } +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + priv->sh->srh_flex_parser.flex.devx_fp->sample_ids[i] = ids[i]; + priv->sh->srh_flex_parser.flex.map[i].width =sizeof (uint32_t ) *CHAR_BIT ; + priv->sh->srh_flex_parser.flex.map[i].reg_id = i; + priv->sh->srh_flex_parser.flex.map[i].shift = + (i +1 ) *sizeof (uint32_t ) *CHAR_BIT ; } + priv->sh->srh_flex_parser.flex.map[0 ].shift =0 ;return 0 ; error:if (fp)
drivers/net/mlx5/mlx5.h +6 -0
@@ -1335,6 +1335,7 @@ struct mlx5_flex_pattern_field { uint16_t shift:5; uint16_t reg_id:5; }; +#define MLX5_INVALID_SAMPLE_REG_ID 0x1F/* Port flex item context. */
@@ -1346,6 +1347,11 @@ struct mlx5_flex_item {struct mlx5_flex_pattern_field map[MLX5_FLEX_ITEM_MAPPING_NUM ]; }; +/* +* Sample an IPv6 address and the first dword of SRv6 header. +* Then it is 16 + 4 = 20 bytes which is 5 dwords. +*/ +#define MLX5_SRV6_SAMPLE_NUM 5/* Mlx5 internal flex parser profile structure. */ struct mlx5_internal_flex_parser_profile {uint32_t refcnt;
Signature · 1 line
2.27.0
PATCH v3 2/6 net/mlx5/hws: fix potential wrong errno value
In reply to Rongwei LiuA valid rte_errno is desired when DR layer api returns error and it can't over-write the value set by under-layer.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +1 -1
@@ -2262,6 +2262,7 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,if (!num_of_hdrs) {DR_LOG (ERR ,"Reformat num_of_hdrs cannot be zero" ); + rte_errno =EINVAL ;return NULL ; }
@@ -2309,7 +2310,6 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx, reformat_hdrs, log_bulk_size);if (ret) {DR_LOG (ERR ,"Failed to create HWS reformat action" ); - rte_errno =EINVAL ; goto free_reformat_hdrs; }
Signature · 1 line
2.27.0
PATCH v3 3/6 net/mlx5/hws: add IPv6 routing extension push remove actions
In reply to Rongwei LiuAdd two dr_actions to implement IPv6 routing extension push and remove, the new actions are multiple actions combination instead of new types.
Basically, there are two modify headers plus one reformat action. Action order is the same as encap and decap actions.
--- drivers/common/mlx5/mlx5_prm.h | 1 + drivers/net/mlx5/hws/mlx5dr.h | 29 +++ drivers/net/mlx5/hws/mlx5dr_action.c | 358 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 7 + drivers/net/mlx5/hws/mlx5dr_debug.c | 2 + drivers/net/mlx5/mlx5_flow.h | 44 ++++ 6 files changed, 438 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +1 -0
@@ -3586,6 +3586,7 @@ enum mlx5_ifc_header_anchors {MLX5_HEADER_ANCHOR_PACKET_START =0x0 ,MLX5_HEADER_ANCHOR_FIRST_VLAN_START =0x2 ,MLX5_HEADER_ANCHOR_IPV6_IPV4 =0x07 , +MLX5_HEADER_ANCHOR_TCP_UDP =0x09 ,MLX5_HEADER_ANCHOR_INNER_MAC =0x13 , MLX5_HEADER_ANCHOR_INNER_IPV6_IPV4 = 0x19, };
drivers/net/mlx5/hws/mlx5dr.h +29 -0
@@ -54,6 +54,8 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_REMOVE_HEADER ,MLX5DR_ACTION_TYP_DEST_ROOT ,MLX5DR_ACTION_TYP_DEST_ARRAY , +MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT , +MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT , MLX5DR_ACTION_TYP_MAX, };
@@ -278,6 +280,11 @@ struct mlx5dr_rule_action {uint8_t *data; } reformat; +struct { +uint32_t offset; +uint8_t *header; + } ipv6_ext; +struct {rte_be32_t vlan_hdr; } push_vlan;
@@ -889,6 +896,28 @@ mlx5dr_action_create_remove_header(struct mlx5dr_context *ctx,struct mlx5dr_action_remove_header_attr *attr, uint32_t flags); +/* Create action to push or remove IPv6 extension header. +* +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] type +* Type of direct rule action: MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT or +* MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT. +* @param[in] hdr +* Header for packet reformat. +* @param[in] log_bulk_size +* Number of unique values used with this pattern. +* @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_reformat_ipv6_ext (struct mlx5dr_context *ctx, +enum mlx5dr_action_type type, +struct mlx5dr_action_reformat_header *hdr, +uint32_t log_bulk_size, +uint32_t flags); +/* Destroy direct rule action. * * @param[in] action
drivers/net/mlx5/hws/mlx5dr_action.c +355 -3
406 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +7 -0
@@ -8,6 +8,9 @@/* Max number of STEs needed for a rule (including match) */ #define MLX5DR_ACTION_MAX_STE 10 +/* Max number of internal subactions of ipv6_ext */ +#define MLX5DR_ACTION_IPV6_EXT_MAX_SA 4 +enum mlx5dr_action_stc_idx {MLX5DR_ACTION_STC_IDX_CTRL =0 ,MLX5DR_ACTION_STC_IDX_HIT =1 ,
@@ -143,6 +146,10 @@ struct mlx5dr_action {uint8_t offset;bool encap; } reformat; +struct { +struct mlx5dr_action + *action[MLX5DR_ACTION_IPV6_EXT_MAX_SA ]; + } ipv6_route_ext;struct {struct mlx5dr_devx_obj *devx_obj;uint8_t return_reg_id;
drivers/net/mlx5/hws/mlx5dr_debug.c +2 -0
@@ -31,6 +31,8 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_CRYPTO_DECRYPT] = "CRYPTO_DECRYPT", [MLX5DR_ACTION_TYP_INSERT_HEADER] = "INSERT_HEADER", [MLX5DR_ACTION_TYP_REMOVE_HEADER] = "REMOVE_HEADER", + [MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT] = "POP_IPV6_ROUTE_EXT", + [MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT ] ="PUSH_IPV6_ROUTE_EXT" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/mlx5_flow.h +44 -0
56 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v3 4/6 net/mlx5/hws: add setter for IPv6 routing push remove
In reply to Rongwei LiuThe rte action will be translated to multiple dr_actions which need different setters to program them.
In order to leverage the existing setter logic, there is a new callback introduce which called fetch_opt with unique parameter.
For each setter, it may have different reparsing properties. Setter which requires no reparse can't share the same one with the one has reparse enabled even if there is spare space.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 174 +++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +- 2 files changed, 176 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +174 -0
@@ -3311,6 +3311,121 @@ mlx5dr_action_setter_reformat_trailer(struct mlx5dr_actions_apply_data *apply, apply->wqe_data[MLX5DR_ACTION_OFFSET_DW7 ] =0 ; } +static void +mlx5dr_action_setter_ipv6_route_ext_gen_push_mhdr (uint8_t *data,void *mh_data) +{ +uint8_t *action_ptr = mh_data; +uint32_t *ipv6_dst_addr; +uint8_t seg_left; +uint32_t i; + +/* Fetch the last IPv6 address in the segment list which is the next hop */ + seg_left =MLX5_GET (header_ipv6_routing_ext, data, segments_left) -1 ; + ipv6_dst_addr = (uint32_t *)data +MLX5_ST_SZ_DW (header_ipv6_routing_ext) + + seg_left *MLX5_ST_SZ_DW (definer_hl_ipv6_addr); + +/* Load next hop IPv6 address in reverse order to ipv6.dst_address */ +for (i =0 ; i <MLX5_ST_SZ_DW (definer_hl_ipv6_addr); i++) { +MLX5_SET (set_action_in, action_ptr, data,be32toh (*ipv6_dst_addr++)); + action_ptr +=MLX5DR_MODIFY_ACTION_SIZE ; + } + +/* Set ipv6_route_ext.next_hdr per user input */ +MLX5_SET (set_action_in, action_ptr, data, *data); +} + +static void +mlx5dr_action_setter_ipv6_route_ext_mhdr (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = apply->rule_action; +struct mlx5dr_actions_wqe_setter tmp_setter = {0 }; +struct mlx5dr_rule_action tmp_rule_action; +__be64 cmd[MLX5_SRV6_SAMPLE_NUM ] = {0 }; +struct mlx5dr_action *ipv6_ext_action; +uint8_t *header; + + header = rule_action[setter->idx_double].ipv6_ext.header; + ipv6_ext_action = rule_action[setter->idx_double].action; + tmp_rule_action.action = ipv6_ext_action->ipv6_route_ext.action[setter->extra_data]; + +if (tmp_rule_action.action->flags &MLX5DR_ACTION_FLAG_SHARED ) { + tmp_rule_action.modify_header.offset =0 ; + tmp_rule_action.modify_header.pattern_idx =0 ; + tmp_rule_action.modify_header.data =NULL ; + }else { +/* +* Copy ipv6_dst from ipv6_route_ext.last_seg. +* Set ipv6_route_ext.next_hdr. +*/ +mlx5dr_action_setter_ipv6_route_ext_gen_push_mhdr (header, cmd); + tmp_rule_action.modify_header.data = (uint8_t *)cmd; + tmp_rule_action.modify_header.pattern_idx =0 ; + tmp_rule_action.modify_header.offset = + rule_action[setter->idx_double].ipv6_ext.offset; + } + + apply->rule_action = &tmp_rule_action; + +/* Reuse regular */ +mlx5dr_action_setter_modify_header (apply, &tmp_setter); + +/* Swap rule actions from backup */ + apply->rule_action = rule_action; +} + +static void +mlx5dr_action_setter_ipv6_route_ext_insert_ptr (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = apply->rule_action; +struct mlx5dr_actions_wqe_setter tmp_setter = {0 }; +struct mlx5dr_rule_action tmp_rule_action; +struct mlx5dr_action *ipv6_ext_action; +uint8_t header[MLX5_PUSH_MAX_LEN ]; + + ipv6_ext_action = rule_action[setter->idx_double].action; + tmp_rule_action.action = ipv6_ext_action->ipv6_route_ext.action[setter->extra_data]; + +if (tmp_rule_action.action->flags &MLX5DR_ACTION_FLAG_SHARED ) { + tmp_rule_action.reformat.offset =0 ; + tmp_rule_action.reformat.hdr_idx =0 ; + tmp_rule_action.reformat.data =NULL ; + }else { +memcpy (header, rule_action[setter->idx_double].ipv6_ext.header, + tmp_rule_action.action->reformat.header_size); +/* Clear ipv6_route_ext.next_hdr for right checksum */ +MLX5_SET (header_ipv6_routing_ext, header, next_hdr,0 ); + tmp_rule_action.reformat.data = header; + tmp_rule_action.reformat.hdr_idx =0 ; + tmp_rule_action.reformat.offset = + rule_action[setter->idx_double].ipv6_ext.offset; + } + + apply->rule_action = &tmp_rule_action; + +/* Reuse regular */ +mlx5dr_action_setter_insert_ptr (apply, &tmp_setter); + +/* Swap rule actions from backup */ + apply->rule_action = rule_action; +} + +static void +mlx5dr_action_setter_ipv6_route_ext_pop (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = &apply->rule_action[setter->idx_single]; +uint8_t idx =MLX5DR_ACTION_IPV6_EXT_MAX_SA -1 ; +struct mlx5dr_action *action; + +/* Pop the ipv6_route_ext as set_single logic */ + action = rule_action->action->ipv6_route_ext.action[idx]; + apply->wqe_data[MLX5DR_ACTION_OFFSET_DW5 ] =0 ; + apply->wqe_ctrl->stc_ix[MLX5DR_ACTION_STC_IDX_DW5 ] = +htobe32 (action->stc[apply->tbl_type].offset); +} +int mlx5dr_action_template_process (struct mlx5dr_action_template *at) {struct mlx5dr_actions_wqe_setter *start_setter = at->setters +1 ;
@@ -3374,6 +3489,65 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_double = i;break ; +case MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT : +/* +* Backup ipv6_route_ext.next_hdr to ipv6_route_ext.seg_left. +* Set ipv6_route_ext.next_hdr to 0 for checksum bug. +*/ + setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE ); + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =0 ; + setter++; + +/* +* Restore ipv6_route_ext.next_hdr from ipv6_route_ext.seg_left. +* Load the final destination address from flex parser sample 1->4. +*/ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =1 ; + setter++; + +/* Set the ipv6.protocol per ipv6_route_ext.next_hdr */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =2 ; +/* Pop ipv6_route_ext */ + setter->flags |=ASF_SINGLE1 |ASF_REMOVE ; + setter->set_single = &mlx5dr_action_setter_ipv6_route_ext_pop; + setter->idx_single = i; +break ; + +case MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT : +/* Insert ipv6_route_ext with next_hdr as 0 due to checksum bug */ + setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE ); + setter->flags |=ASF_DOUBLE |ASF_INSERT ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_insert_ptr; + setter->idx_double = i; + setter->extra_data =0 ; + setter++; + +/* Set ipv6.protocol as IPPROTO_ROUTING: 0x2b */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =1 ; + setter++; + +/* +* Load the right ipv6_route_ext.next_hdr per user input buffer. +* Load the next dest_addr from the ipv6_route_ext.seg_list[last]. +*/ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =2 ; +break ; +case MLX5DR_ACTION_TYP_MODIFY_HDR :/* Double modify header list */ setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE );
drivers/net/mlx5/hws/mlx5dr_action.h +2 -1
@@ -6,7 +6,7 @@#define MLX5DR_ACTION_H_ /* Max number of STEs needed for a rule (including match) */ -#define MLX5DR_ACTION_MAX_STE 10 +#define MLX5DR_ACTION_MAX_STE 20/* Max number of internal subactions of ipv6_ext */ #define MLX5DR_ACTION_IPV6_EXT_MAX_SA 4
@@ -109,6 +109,7 @@ struct mlx5dr_actions_wqe_setter {uint8_t idx_ctr;uint8_t idx_hit;uint8_t flags; +uint8_t extra_data; };struct mlx5dr_action_template {
Signature · 1 line
2.27.0
PATCH v3 5/6 net/mlx5: implement IPv6 routing push remove
In reply to Rongwei LiuReserve the push data buffer for each job and the maximum length is set to 128 for now.
Only supports type IPPROTO_ROUTING when translating the rte flow action.
Remove actions must be shared globally and only supports next layer as TCP or UDP.
--- doc/guides/nics/features/mlx5.ini | 2 + doc/guides/nics/mlx5.rst | 11 +- doc/guides/rel_notes/release_23_11.rst | 2 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.h | 21 +- drivers/net/mlx5/mlx5_flow_hw.c | 282 ++++++++++++++++++++++++- 6 files changed, 309 insertions(+), 10 deletions(-)
doc/guides/nics/features/mlx5.ini +2 -0
@@ -108,6 +108,8 @@ flag = Y inc_tcp_ack = Y inc_tcp_seq = Y indirect_list = Y +ipv6_ext_push = Y +ipv6_ext_remove = Y jump = Y mark = Y meter = Y
doc/guides/nics/mlx5.rst +10 -1
@@ -148,7 +148,9 @@ Features - Matching on GTP extension header with raw encap/decap action. - Matching on Geneve TLV option header with raw encap/decap action. - Matching on ESP header SPI field. +- Matching on flex item with specific pattern. - Matching on InfiniBand BTH. +- Modify flex item field. - Modify IPv4/IPv6 ECN field. - RSS support in sample action. - E-Switch mirroring and jump.
@@ -166,7 +168,7 @@ Features - Sub-Function. - Matching on represented port. - Matching on aggregated affinity. - +- Push or remove IPv6 routing extension. Limitations -----------
@@ -759,6 +761,13 @@ Limitations to the representor of the source virtual port (SF/VF), while if it is disabled, the traffic will be routed based on the steering rules in the ingress domain. +- IPv6 routing extension push or remove: + + - Supported only with HW Steering enabled (``dv_flow_en`` = 2). + - Supported in non-zero group (No limits on transfer domain if `fdb_def_rule_en` = 1 which is default). + - Only supports TCP or UDP as next layer. + - IPv6 routing header must be the only present extension. + - Not supported on guest port. Statistics ----------
doc/guides/rel_notes/release_23_11.rst +2 -0
@@ -157,6 +157,8 @@ New Features * Added support for ``RTE_FLOW_ACTION_TYPE_INDIRECT_LIST`` flow action. * Added support for ``RTE_FLOW_ITEM_TYPE_PTYPE`` flow item. * Added support for ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR`` flow action and mirror. + * Added support for ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH`` flow action. + * Added support for ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE`` flow action. * **Updated Solarflare net driver.**
drivers/net/mlx5/mlx5.h +1 -0
@@ -373,6 +373,7 @@ struct mlx5_hw_q_job { };void *user_data;/* Job user data. */ uint8_t *encap_data;/* Encap data. */ +uint8_t *push_data;/* IPv6 routing push data. */ struct mlx5_modification_cmd *mhdr_cmd;struct rte_flow_item *items;union {
drivers/net/mlx5/mlx5_flow.h +20 -1
@@ -363,6 +363,8 @@ enum mlx5_feature_name {#define MLX5_FLOW_ACTION_INDIRECT_AGE (1ull << 44)#define MLX5_FLOW_ACTION_QUOTA (1ull << 46)#define MLX5_FLOW_ACTION_PORT_REPRESENTOR (1ull << 47) +#define MLX5_FLOW_ACTION_IPV6_ROUTING_REMOVE (1ull << 48) +#define MLX5_FLOW_ACTION_IPV6_ROUTING_PUSH (1ull << 49)#define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \ (MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE)
@@ -1269,6 +1271,8 @@ typedef int const struct rte_flow_action *, struct mlx5dr_rule_action *); +#define MLX5_MHDR_MAX_CMD ((MLX5_MAX_MODIFY_NUM) * 2 + 1) +/* rte flow action translate to DR action struct. */ struct mlx5_action_construct_data {LIST_ENTRY (mlx5_action_construct_data) next;
@@ -1315,6 +1319,10 @@ struct mlx5_action_construct_data {struct {cnt_id_t id; } shared_counter; +struct { +/* IPv6 extension push data len. */ +uint16_t len; + } ipv6_ext;struct {uint32_t id;uint32_t conf_masked:1 ;
@@ -1359,6 +1367,7 @@ struct rte_flow_actions_template {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. */ +uint16_t recom_off;/* Offset of DR IPv6 routing push remove action. */ uint32_t refcnt;/* Reference counter. */ uint8_t flex_item;/* flex item index. */ };
@@ -1384,7 +1393,14 @@ struct mlx5_hw_encap_decap_action {uint8_t data[];/* Action data. */ }; -#define MLX5_MHDR_MAX_CMD ((MLX5_MAX_MODIFY_NUM) * 2 + 1) +/* Push remove action struct. */ +struct mlx5_hw_push_remove_action { +struct mlx5dr_action *action;/* Action object. */ +/* Is push_remove action shared across flows in table. */ +uint8_t shared; +size_t data_size;/* Action metadata size. */ +uint8_t data[];/* Action data. */ +};/* Modify field action struct. */ struct mlx5_hw_modify_header_action {
@@ -1415,6 +1431,9 @@ struct mlx5_hw_actions {/* Encap/Decap action. */ struct mlx5_hw_encap_decap_action *encap_decap;uint16_t encap_decap_pos;/* Encap/Decap action position. */ +/* Push/remove action. */ +struct mlx5_hw_push_remove_action *push_remove; +uint16_t push_remove_pos;/* Push/remove action position. */ uint32_t mark:1; /* Indicate the mark action. */cnt_id_t cnt_id;/* Counter id. */ uint32_t mtr_id;/* Meter id. */
drivers/net/mlx5/mlx5_flow_hw.c +274 -8
453 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v3 6/6 net/mlx5/hws: add stc reparse support for srv6 push pop
In reply to Rongwei LiuAfter pushing/popping srv6 into/from IPv6 packets, the checksum needs to be correct.
In order to achieve this, there is a need to control each STE' reparse behavior(CX7 and above). Add two more flags enumeration definitions to allow external control of reparse property in stc.
1. Push
a. 1st STE, insert header action, reparse ignored(default reparse
always)
b. 2nd STE, modify IPv6 protocol, reparse always as default. c. 3rd STE, modify header list, reparse always(default reparse
ignored)
2. Pop
a. 1st STE, modify header list, reparse always(default reparse
ignored)
b. 2nd STE, modify header list, reparse always(default reparse
ignored)
c. 3rd STE, modify IPv6 protocol, reparse ignored(default reparse
always); remove header action, reparse always as default.
For CX6Lx and CX6Dx, the reparse behavior is controlled by RTC as always. Only pop action can work well.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 115 +++++++++++++++++++-------- drivers/net/mlx5/hws/mlx5dr_action.h | 7 ++ 2 files changed, 87 insertions(+), 35 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +80 -35
@@ -640,6 +640,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :case MLX5DR_ACTION_TYP_MODIFY_HDR : attr->action_offset =MLX5DR_ACTION_OFFSET_DW6 ; + attr->reparse_mode =MLX5_IFC_STC_REPARSE_IGNORE ;if (action->modify_header.require_reparse) attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ;
@@ -678,9 +679,12 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2 :case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3 :case MLX5DR_ACTION_TYP_INSERT_HEADER : + attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ; +if (!action->reformat.require_reparse) + attr->reparse_mode =MLX5_IFC_STC_REPARSE_IGNORE ; + attr->action_type =MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT ; attr->action_offset =MLX5DR_ACTION_OFFSET_DW6 ; - attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ; attr->insert_header.encap = action->reformat.encap; attr->insert_header.insert_anchor = action->reformat.anchor; attr->insert_header.arg_id = action->reformat.arg_obj->id;
@@ -1441,7 +1445,7 @@ static int mlx5dr_action_handle_insert_with_ptr(struct mlx5dr_action *action, uint8_t num_of_hdrs, struct mlx5dr_action_reformat_header *hdrs, - uint32_t log_bulk_sz) + uint32_t log_bulk_sz, uint32_t reparse) { struct mlx5dr_devx_obj *arg_obj;size_t max_sz =0 ;
@@ -1478,6 +1482,11 @@ mlx5dr_action_handle_insert_with_ptr(struct mlx5dr_action *action, action[i].reformat.encap =1 ; } +if (likely (reparse ==MLX5DR_ACTION_STC_REPARSE_DEFAULT )) + action[i].reformat.require_reparse = true; +else if (reparse ==MLX5DR_ACTION_STC_REPARSE_ON ) + action[i].reformat.require_reparse = true; + ret =mlx5dr_action_create_stcs (&action[i],NULL );if (ret) {DR_LOG (ERR ,"Failed to create stc for reformat" );
@@ -1514,7 +1523,8 @@ mlx5dr_action_handle_l2_to_tunnel_l3(struct mlx5dr_action *action, ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, - log_bulk_sz); + log_bulk_sz, +MLX5DR_ACTION_STC_REPARSE_DEFAULT );if (ret) goto put_shared_stc;
@@ -1657,7 +1667,8 @@ mlx5dr_action_create_reformat_hws(struct mlx5dr_action *action, ret =mlx5dr_action_create_stcs (action,NULL );break ;case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2 : - ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, bulk_size); + ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, bulk_size, +MLX5DR_ACTION_STC_REPARSE_DEFAULT );break ;case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3 : ret =mlx5dr_action_handle_l2_to_tunnel_l3 (action, num_of_hdrs, hdrs, bulk_size);
@@ -1765,7 +1776,8 @@ static int mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, uint8_t num_of_patterns, struct mlx5dr_action_mh_pattern *pattern, - uint32_t log_bulk_size) + uint32_t log_bulk_size, + uint32_t reparse) { struct mlx5dr_devx_obj *pat_obj, *arg_obj = NULL;struct mlx5dr_context *ctx = action->ctx;
@@ -1799,8 +1811,12 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, action[i].modify_header.num_of_patterns = num_of_patterns; action[i].modify_header.max_num_of_actions = max_mh_actions; action[i].modify_header.num_of_actions = num_actions; - action[i].modify_header.require_reparse = -mlx5dr_pat_require_reparse (pattern[i].data, num_actions); + +if (likely (reparse ==MLX5DR_ACTION_STC_REPARSE_DEFAULT )) + action[i].modify_header.require_reparse = +mlx5dr_pat_require_reparse (pattern[i].data, num_actions); +else if (reparse ==MLX5DR_ACTION_STC_REPARSE_ON ) + action[i].modify_header.require_reparse = true;if (num_actions ==1 ) { pat_obj =NULL ;
@@ -1843,12 +1859,12 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action,return rte_errno; } -struct mlx5dr_action * -mlx5dr_action_create_modify_header (struct mlx5dr_context *ctx, -uint8_t num_of_patterns, -struct mlx5dr_action_mh_pattern *patterns, -uint32_t log_bulk_size, -uint32_t flags) +static struct mlx5dr_action * +mlx5dr_action_create_modify_header_reparse (struct mlx5dr_context *ctx, +uint8_t num_of_patterns, +struct mlx5dr_action_mh_pattern *patterns, +uint32_t log_bulk_size, +uint32_t flags,uint32_t reparse) {struct mlx5dr_action *action;int ret;
@@ -1896,7 +1912,8 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_modify_header_hws (action, num_of_patterns, patterns, - log_bulk_size); + log_bulk_size, + reparse);if (ret) goto free_action;
@@ -1907,6 +1924,17 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,return NULL ; } +struct mlx5dr_action * +mlx5dr_action_create_modify_header (struct mlx5dr_context *ctx, +uint8_t num_of_patterns, +struct mlx5dr_action_mh_pattern *patterns, +uint32_t log_bulk_size, +uint32_t flags) +{ +return mlx5dr_action_create_modify_header_reparse (ctx, num_of_patterns, patterns, + log_bulk_size, flags, +MLX5DR_ACTION_STC_REPARSE_DEFAULT ); +}static struct mlx5dr_devx_obj * mlx5dr_action_dest_array_process_reformat(struct mlx5dr_context *ctx, enum mlx5dr_action_type type,
@@ -2254,12 +2282,12 @@ mlx5dr_action_create_reformat_trailer(struct mlx5dr_context *ctx,return action; } -struct mlx5dr_action * -mlx5dr_action_create_insert_header (struct mlx5dr_context *ctx, -uint8_t num_of_hdrs, -struct mlx5dr_action_insert_header *hdrs, -uint32_t log_bulk_size, -uint32_t flags) +static struct mlx5dr_action * +mlx5dr_action_create_insert_header_reparse (struct mlx5dr_context *ctx, +uint8_t num_of_hdrs, +struct mlx5dr_action_insert_header *hdrs, +uint32_t log_bulk_size, +uint32_t flags,uint32_t reparse) {struct mlx5dr_action_reformat_header *reformat_hdrs;struct mlx5dr_action *action;
@@ -2312,7 +2340,8 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx, } ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, - reformat_hdrs, log_bulk_size); + reformat_hdrs, log_bulk_size, + reparse);if (ret) {DR_LOG (ERR ,"Failed to create HWS reformat action" ); goto free_reformat_hdrs;
@@ -2329,6 +2358,18 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,return NULL ; } +struct mlx5dr_action * +mlx5dr_action_create_insert_header (struct mlx5dr_context *ctx, +uint8_t num_of_hdrs, +struct mlx5dr_action_insert_header *hdrs, +uint32_t log_bulk_size, +uint32_t flags) +{ +return mlx5dr_action_create_insert_header_reparse (ctx, num_of_hdrs, hdrs, + log_bulk_size, flags, +MLX5DR_ACTION_STC_REPARSE_DEFAULT ); +} +struct mlx5dr_action * mlx5dr_action_create_remove_header(struct mlx5dr_context *ctx, struct mlx5dr_action_remove_header_attr *attr,
@@ -2422,8 +2463,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr1(struct mlx5dr_action *action) pattern.data = cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_ON ); } static void *
@@ -2469,8 +2511,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr2(struct mlx5dr_action *action) pattern.data = cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_ON ); } static void *
@@ -2496,8 +2539,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr3(struct mlx5dr_action *action) pattern.data = (__be64 *)cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_OFF ); } static int
@@ -2644,8 +2688,9 @@ mlx5dr_action_create_push_ipv6_route_ext(struct mlx5dr_action *action, insert_hdr.hdr.sz = hdr->sz; insert_hdr.hdr.data = header; action->ipv6_route_ext.action[0 ] = -mlx5dr_action_create_insert_header (action->ctx,1 , &insert_hdr, - bulk_size, action->flags); +mlx5dr_action_create_insert_header_reparse (action->ctx,1 , &insert_hdr, + bulk_size, action->flags, +MLX5DR_ACTION_STC_REPARSE_OFF ); action->ipv6_route_ext.action[1 ] =mlx5dr_action_create_push_ipv6_route_ext_mhdr1 (action); action->ipv6_route_ext.action[2] =
@@ -2678,12 +2723,6 @@ mlx5dr_action_create_reformat_ipv6_ext(struct mlx5dr_context *ctx,struct mlx5dr_action *action;int ret; -if (mlx5dr_context_cap_dynamic_reparse (ctx)) { -DR_LOG (ERR ,"IPv6 extension actions is not supported" ); - rte_errno =ENOTSUP ; -return NULL ; - } -if (!mlx5dr_action_is_hws_flags (flags) || ((flags &MLX5DR_ACTION_FLAG_SHARED ) && log_bulk_size)) {DR_LOG (ERR ,"IPv6 extension flags don't fit HWS (flags: 0x%x)" , flags);
@@ -2708,6 +2747,12 @@ mlx5dr_action_create_reformat_ipv6_ext(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_pop_ipv6_route_ext (action);break ;case MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT : +if (!mlx5dr_context_cap_dynamic_reparse (ctx)) { +DR_LOG (ERR ,"IPv6 routing extension push actions is not supported" ); + rte_errno =ENOTSUP ; + goto free_action; + } + ret =mlx5dr_action_create_push_ipv6_route_ext (action, hdr, log_bulk_size);break ;default :
drivers/net/mlx5/hws/mlx5dr_action.h +7 -0
@@ -65,6 +65,12 @@ enum mlx5dr_action_setter_flag { ASF_HIT = 1 << 7, }; +enum mlx5dr_action_stc_reparse { +MLX5DR_ACTION_STC_REPARSE_DEFAULT , +MLX5DR_ACTION_STC_REPARSE_ON , +MLX5DR_ACTION_STC_REPARSE_OFF , +}; +struct mlx5dr_action_default_stc {struct mlx5dr_pool_chunk nop_ctr;struct mlx5dr_pool_chunk nop_dw5;
@@ -146,6 +152,7 @@ struct mlx5dr_action {uint8_t anchor;uint8_t offset;bool encap; +uint8_t require_reparse; } reformat;struct {struct mlx5dr_action
Signature · 1 line
2.27.0
v4 cover support IPv6 push remove action
In reply to Rongwei LiuSupport IPv6 extension push/remove actions in MLX5 PMD. Routing extension is the only supported type.
v4: add more dependancies.
v3: rebase.
v2: add reparse control and rebase.
Alex Vesker (4):
net/mlx5/hws: allow jump to TIR over FDB net/mlx5/hws: support dynamic re-parse net/mlx5/hws: dynamic re-parse for modify header net/mlx5/hws: fix incorrect re-parse on complex rules
Hamdan Igbaria (2):
net/mlx5/hws: support insert header action
net/mlx5/hws: support remove header action
Rongwei Liu (7):
net/mlx5: sample the srv6 last segment net/mlx5/hws: fix potential wrong rte_errno value net/mlx5/hws: add IPv6 routing extension push remove actions net/mlx5/hws: add setter for IPv6 routing push remove net/mlx5: implement IPv6 routing push remove net/mlx5/hws: fix srv6 push compilation failure net/mlx5/hws: add stc reparse support for srv6 push pop
doc/guides/nics/features/mlx5.ini | 2 + doc/guides/nics/mlx5.rst | 11 + doc/guides/rel_notes/release_23_11.rst | 2 + drivers/common/mlx5/mlx5_prm.h | 13 +- drivers/net/mlx5/hws/mlx5dr.h | 105 +++ drivers/net/mlx5/hws/mlx5dr_action.c | 873 +++++++++++++++++++++++-- drivers/net/mlx5/hws/mlx5dr_action.h | 32 +- drivers/net/mlx5/hws/mlx5dr_cmd.c | 11 +- drivers/net/mlx5/hws/mlx5dr_cmd.h | 3 + drivers/net/mlx5/hws/mlx5dr_context.c | 15 + drivers/net/mlx5/hws/mlx5dr_context.h | 9 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 4 + drivers/net/mlx5/hws/mlx5dr_internal.h | 1 + drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 + drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 41 +- drivers/net/mlx5/hws/mlx5dr_pat_arg.h | 2 + drivers/net/mlx5/mlx5.c | 41 +- drivers/net/mlx5/mlx5.h | 7 + drivers/net/mlx5/mlx5_flow.h | 65 +- drivers/net/mlx5/mlx5_flow_hw.c | 283 +++++++- 20 files changed, 1438 insertions(+), 84 deletions(-)
Signature · 1 line
2.27.0
PATCH v4 1/13 net/mlx5/hws: support insert header action
From: Hamdan Igbaria <[email protected]>
Support insert header action, this will allow encap at a specific anchor and offset selected by the user.
--- drivers/net/mlx5/hws/mlx5dr.h | 36 ++++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 112 +++++++++++++++++++++---- drivers/net/mlx5/hws/mlx5dr_action.h | 5 +- drivers/net/mlx5/hws/mlx5dr_cmd.c | 4 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + drivers/net/mlx5/hws/mlx5dr_internal.h | 1 + 6 files changed, 141 insertions(+), 18 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +36 -0
@@ -45,6 +45,7 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_PUSH_VLAN ,MLX5DR_ACTION_TYP_ASO_METER ,MLX5DR_ACTION_TYP_ASO_CT , +MLX5DR_ACTION_TYP_INSERT_HEADER ,MLX5DR_ACTION_TYP_DEST_ROOT ,MLX5DR_ACTION_TYP_DEST_ARRAY , MLX5DR_ACTION_TYP_MAX,
@@ -169,6 +170,20 @@ struct mlx5dr_action_reformat_header {void *data; }; +struct mlx5dr_action_insert_header { +struct mlx5dr_action_reformat_header hdr; +/* PRM start anchor to which header will be inserted */ +uint8_t anchor; +/* Header insertion offset in bytes, from the start +* anchor to the location where new header will be inserted. +*/ +uint8_t offset; +/* Indicates this header insertion adds encapsulation header to the packet, +* requiring device to update offloaded fields (for example IPv4 total length). +*/ +bool encap; +}; +struct mlx5dr_action_mh_pattern {/* Byte size of modify actions provided by "data" */ size_t sz;
@@ -691,6 +706,27 @@ mlx5dr_action_create_dest_root(struct mlx5dr_context *ctx,uint16_t priority, uint32_t flags); +/* Create insert header action. +* +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] num_of_hdrs +* Number of provided headers in "hdrs" array. +* @param[in] hdrs +* Headers array containing header information. +* @param[in] log_bulk_size +* Number of unique values used with this insert header. +* @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_insert_header (struct mlx5dr_context *ctx, +uint8_t num_of_hdrs, +struct mlx5dr_action_insert_header *hdrs, +uint32_t log_bulk_size, +uint32_t flags); +/* Destroy direct rule action. * * @param[in] action
drivers/net/mlx5/hws/mlx5dr_action.c +97 -15
201 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +4 -1
@@ -131,8 +131,11 @@ struct mlx5dr_action {struct {struct mlx5dr_devx_obj *arg_obj;uint32_t header_size; -uint8_t num_of_hdrs;uint16_t max_hdr_sz; +uint8_t num_of_hdrs; +uint8_t anchor; +uint8_t offset; +bool encap; } reformat;struct {struct mlx5dr_devx_obj *devx_obj;
drivers/net/mlx5/hws/mlx5dr_cmd.c +2 -2
@@ -492,9 +492,9 @@ mlx5dr_cmd_stc_modify_set_stc_param(struct mlx5dr_cmd_stc_modify_attr *stc_attr, stc_attr->insert_header.insert_anchor);/* HW gets the next 2 sizes in words */ MLX5_SET (stc_ste_param_insert, stc_parm, insert_size, - stc_attr->insert_header.header_size /2 ); + stc_attr->insert_header.header_size /W_SIZE );MLX5_SET (stc_ste_param_insert, stc_parm, insert_offset, - stc_attr->insert_header.insert_offset /2 ); + stc_attr->insert_header.insert_offset /W_SIZE );MLX5_SET (stc_ste_param_insert, stc_parm, insert_argument, stc_attr->insert_header.arg_id);break ;
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
@@ -24,6 +24,7 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT", [MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT", [MLX5DR_ACTION_TYP_DEST_ARRAY] = "DEST_ARRAY", + [MLX5DR_ACTION_TYP_INSERT_HEADER ] ="INSERT_HEADER" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/hws/mlx5dr_internal.h +1 -0
@@ -40,6 +40,7 @@#include "mlx5dr_pat_arg.h" #include "mlx5dr_crc32.h" +#define W_SIZE 2#define DW_SIZE 4#define BITS_IN_BYTE 8#define BITS_IN_DW (BITS_IN_BYTE * DW_SIZE)
Signature · 1 line
2.27.0
PATCH v4 2/13 net/mlx5/hws: support remove header action
In reply to Rongwei LiuFrom: Hamdan Igbaria <[email protected]>
Support remove header action, this action will allow the user to execute dynamic decaps by choosing to decap by providing a start anchor and number of words to remove, or providing a start anchor and end anchor.
--- drivers/net/mlx5/hws/mlx5dr.h | 40 +++++++++++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 77 ++++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_action.h | 7 +++ drivers/net/mlx5/hws/mlx5dr_debug.c | 1 + 4 files changed, 125 insertions(+)
drivers/net/mlx5/hws/mlx5dr.h +40 -0
@@ -46,6 +46,7 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_ASO_METER ,MLX5DR_ACTION_TYP_ASO_CT ,MLX5DR_ACTION_TYP_INSERT_HEADER , +MLX5DR_ACTION_TYP_REMOVE_HEADER ,MLX5DR_ACTION_TYP_DEST_ROOT ,MLX5DR_ACTION_TYP_DEST_ARRAY , MLX5DR_ACTION_TYP_MAX,
@@ -184,6 +185,29 @@ struct mlx5dr_action_insert_header {bool encap; }; +enum mlx5dr_action_remove_header_type { +MLX5DR_ACTION_REMOVE_HEADER_TYPE_BY_OFFSET , +MLX5DR_ACTION_REMOVE_HEADER_TYPE_BY_HEADER , +}; + +struct mlx5dr_action_remove_header_attr { +enum mlx5dr_action_remove_header_type type; +union { +struct { +/* PRM start anchor from which header will be removed */ +uint8_t start_anchor; +/* PRM end anchor till which header will be removed */ +uint8_t end_anchor; +bool decap; + } by_anchor; +struct { +/* PRM start anchor from which header will be removed */ +uint8_t start_anchor; +uint8_t size; + } by_offset; + }; +}; +struct mlx5dr_action_mh_pattern {/* Byte size of modify actions provided by "data" */ size_t sz;
@@ -727,6 +751,22 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,uint32_t log_bulk_size, uint32_t flags); +/* Create remove header action. +* +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] attr +* attributes: specifies the remove header type, PRM start anchor and +* the PRM end anchor or the PRM start anchor and remove size in bytes. +* @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_remove_header (struct mlx5dr_context *ctx, +struct mlx5dr_action_remove_header_attr *attr, +uint32_t flags); +/* Destroy direct rule action. * * @param[in] action
drivers/net/mlx5/hws/mlx5dr_action.c +77 -0
119 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +7 -0
@@ -159,6 +159,13 @@ struct mlx5dr_action {size_t num_dest;struct mlx5dr_cmd_set_fte_dest *dest_list; } dest_array; +struct { +uint8_t type; +uint8_t start_anchor; +uint8_t end_anchor; +uint8_t num_of_words; +bool decap; + } remove_header; }; };
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
@@ -25,6 +25,7 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT", [MLX5DR_ACTION_TYP_DEST_ARRAY] = "DEST_ARRAY", [MLX5DR_ACTION_TYP_INSERT_HEADER] = "INSERT_HEADER", + [MLX5DR_ACTION_TYP_REMOVE_HEADER ] ="REMOVE_HEADER" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
Signature · 1 line
2.27.0
PATCH v4 3/13 net/mlx5/hws: allow jump to TIR over FDB
In reply to Rongwei LiuFrom: Alex Vesker <[email protected]>
Current TIR action is allowed to be used only for NIC RX, this will allow TIR action over FDB for RX traffic in case of TX traffic packets will be dropped.
--- drivers/common/mlx5/mlx5_prm.h | 2 ++ drivers/net/mlx5/hws/mlx5dr_action.c | 17 ++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_cmd.c | 4 ++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 1 + 4 files changed, 23 insertions(+), 1 deletion(-)
drivers/common/mlx5/mlx5_prm.h +2 -0
@@ -2418,6 +2418,8 @@ struct mlx5_ifc_wqe_based_flow_table_cap_bits {u8 reserved_at_180[0x10 ];u8 ste_format_gen_wqe[0x10 ];u8 linear_match_definer_reg_c3[0x20 ]; +u8 fdb_jump_to_tir_stc[0x1 ]; +u8 reserved_at_1c1[0x1f ]; };union mlx5_ifc_hca_cap_union_bits {
drivers/net/mlx5/hws/mlx5dr_action.c +16 -1
@@ -389,7 +389,15 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx, } use_fixup = true;break ; - +case MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_TIR : +/* TIR is allowed on RX side, requires mask in case of FDB */ +if (fw_tbl_type ==FS_FT_FDB_TX ) { + fixup_stc_attr->action_type =MLX5_IFC_STC_ACTION_TYPE_DROP ; + fixup_stc_attr->action_offset =MLX5DR_ACTION_OFFSET_HIT ; + fixup_stc_attr->stc_offset = stc_attr->stc_offset; + use_fixup = true; + } +break ;default :break ; }
@@ -859,6 +867,13 @@ mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx,return NULL ; } +if ((flags &MLX5DR_ACTION_FLAG_ROOT_FDB ) || + (flags &MLX5DR_ACTION_FLAG_HWS_FDB && !ctx->caps->fdb_tir_stc)) { +DR_LOG (ERR ,"TIR action not support on FDB" ); + rte_errno =ENOTSUP ; +return NULL ; + } +if (!is_local) {DR_LOG (ERR ,"TIR should be created on local ibv_device, flags: 0x%x" , flags);
drivers/net/mlx5/hws/mlx5dr_cmd.c +4 -0
@@ -1259,6 +1259,10 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx, caps->supp_ste_format_gen_wqe =MLX5_GET (query_hca_cap_out, out, capability.wqe_based_flow_table_cap. ste_format_gen_wqe); + + caps->fdb_tir_stc =MLX5_GET (query_hca_cap_out, out, + capability.wqe_based_flow_table_cap. + fdb_jump_to_tir_stc); }if (caps->eswitch_manager) {
drivers/net/mlx5/hws/mlx5dr_cmd.h +1 -0
@@ -236,6 +236,7 @@ struct mlx5dr_cmd_query_caps {uint8_t log_header_modify_argument_granularity;uint8_t log_header_modify_argument_max_alloc;uint8_t sq_ts_format; +uint8_t fdb_tir_stc;uint64_t definer_format_sup;uint32_t trivial_match_definer;uint32_t vhca_id;
Signature · 1 line
2.27.0
PATCH v4 4/13 net/mlx5/hws: support dynamic re-parse
In reply to Rongwei LiuFrom: Alex Vesker <[email protected]>
Each steering entry (STE) has a bit called re-parse used for re-parsing the packet in HW, re-parsing is needed after reformat (e.g. push/pop/encapsulate/...) or when modifying the packet headers requiring structure change (e.g. TCP to UDP). Until now we re-parsed the packet in each STE leading to longer processing per packet. With supported devices we can control re-parse bit to allow better performance.
--- drivers/common/mlx5/mlx5_prm.h | 10 ++++- drivers/net/mlx5/hws/mlx5dr_action.c | 57 +++++++++++++++++---------- drivers/net/mlx5/hws/mlx5dr_action.h | 2 +- drivers/net/mlx5/hws/mlx5dr_cmd.c | 3 +- drivers/net/mlx5/hws/mlx5dr_cmd.h | 2 + drivers/net/mlx5/hws/mlx5dr_context.c | 15 +++++++ drivers/net/mlx5/hws/mlx5dr_context.h | 9 ++++- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 + 8 files changed, 74 insertions(+), 26 deletions(-)
drivers/common/mlx5/mlx5_prm.h +9 -1
@@ -3445,6 +3445,7 @@ enum mlx5_ifc_rtc_ste_format {enum mlx5_ifc_rtc_reparse_mode {MLX5_IFC_RTC_REPARSE_NEVER =0x0 ,MLX5_IFC_RTC_REPARSE_ALWAYS =0x1 , +MLX5_IFC_RTC_REPARSE_BY_STC =0x2 , };#define MLX5_IFC_RTC_LINEAR_LOOKUP_TBL_LOG_MAX 16
@@ -3512,6 +3513,12 @@ enum mlx5_ifc_stc_action_type { MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_UPLINK = 0x86, }; +enum mlx5_ifc_stc_reparse_mode { +MLX5_IFC_STC_REPARSE_IGNORE =0x0 , +MLX5_IFC_STC_REPARSE_NEVER =0x1 , +MLX5_IFC_STC_REPARSE_ALWAYS =0x2 , +}; +struct mlx5_ifc_stc_ste_param_ste_table_bits {u8 ste_obj_id[0x20 ];u8 match_definer_id[0x20 ];
@@ -3623,7 +3630,8 @@ enum {struct mlx5_ifc_stc_bits {u8 modify_field_select[0x40 ]; -u8 reserved_at_40[0x48 ]; +u8 reserved_at_40[0x46 ]; +u8 reparse_mode[0x2 ];u8 table_type[0x8 ];u8 ste_action_offset[0x8 ];u8 action_type[0x8 ];
drivers/net/mlx5/hws/mlx5dr_action.c +36 -21
215 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +1 -1
@@ -52,7 +52,7 @@ enum mlx5dr_action_setter_flag {ASF_SINGLE2 =1 <<1 ,ASF_SINGLE3 =1 <<2 ,ASF_DOUBLE =ASF_SINGLE2 |ASF_SINGLE3 , -ASF_REPARSE =1 <<3 , +ASF_INSERT =1 <<3 ,ASF_REMOVE =1 <<4 ,ASF_MODIFY =1 <<5 , ASF_CTR = 1 << 6,
drivers/net/mlx5/hws/mlx5dr_cmd.c +2 -1
@@ -394,7 +394,7 @@ mlx5dr_cmd_rtc_create(struct ibv_context *ctx,MLX5_SET (rtc, attr, ste_table_base_id, rtc_attr->ste_base);MLX5_SET (rtc, attr, ste_table_offset, rtc_attr->ste_offset);MLX5_SET (rtc, attr, miss_flow_table_id, rtc_attr->miss_ft_id); -MLX5_SET (rtc, attr, reparse_mode,MLX5_IFC_RTC_REPARSE_ALWAYS ); +MLX5_SET (rtc, attr, reparse_mode, rtc_attr->reparse_mode); devx_obj->obj = mlx5_glue->devx_obj_create (ctx, in,sizeof (in), out,sizeof (out));if (!devx_obj->obj) {
@@ -570,6 +570,7 @@ mlx5dr_cmd_stc_modify(struct mlx5dr_devx_obj *devx_obj, attr =MLX5_ADDR_OF (create_stc_in, in, stc);MLX5_SET (stc, attr, ste_action_offset, stc_attr->action_offset);MLX5_SET (stc, attr, action_type, stc_attr->action_type); +MLX5_SET (stc, attr, reparse_mode, stc_attr->reparse_mode);MLX5_SET64 (stc, attr, modify_field_select,MLX5_IFC_MODIFY_STC_FIELD_SELECT_NEW_STC );
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
@@ -79,6 +79,7 @@ struct mlx5dr_cmd_rtc_create_attr {uint8_t table_type;uint8_t match_definer_0;uint8_t match_definer_1; +uint8_t reparse_mode;bool is_frst_jumbo;bool is_scnd_range; };
@@ -98,6 +99,7 @@ struct mlx5dr_cmd_stc_create_attr {struct mlx5dr_cmd_stc_modify_attr {uint32_t stc_offset;uint8_t action_offset; +uint8_t reparse_mode;enum mlx5_ifc_stc_action_type action_type;union {uint32_t id;/* TIRN, TAG, FT ID, STE ID */
drivers/net/mlx5/hws/mlx5dr_context.c +15 -0
@@ -4,6 +4,21 @@#include "mlx5dr_internal.h" +bool mlx5dr_context_cap_dynamic_reparse (struct mlx5dr_context *ctx) +{ +return IS_BIT_SET (ctx->caps->rtc_reparse_mode,MLX5_IFC_RTC_REPARSE_BY_STC ); +} + +uint8_t mlx5dr_context_get_reparse_mode (struct mlx5dr_context *ctx) +{ +/* Prefer to use dynamic reparse, reparse only specific actions */ +if (mlx5dr_context_cap_dynamic_reparse (ctx)) +return MLX5_IFC_RTC_REPARSE_NEVER ; + +/* Otherwise use less efficient static */ +return MLX5_IFC_RTC_REPARSE_ALWAYS ; +} +static int mlx5dr_context_pools_init (struct mlx5dr_context *ctx) {struct mlx5dr_pool_attr pool_attr = {0 };
drivers/net/mlx5/hws/mlx5dr_context.h +7 -2
@@ -11,8 +11,8 @@ enum mlx5dr_context_flags { };enum mlx5dr_context_shared_stc_type { -MLX5DR_CONTEXT_SHARED_STC_DECAP =0 , -MLX5DR_CONTEXT_SHARED_STC_POP =1 , +MLX5DR_CONTEXT_SHARED_STC_DECAP_L3 =0 , +MLX5DR_CONTEXT_SHARED_STC_DOUBLE_POP =1 ,MLX5DR_CONTEXT_SHARED_STC_MAX =2 , };
@@ -60,4 +60,9 @@ mlx5dr_context_get_local_ibv(struct mlx5dr_context *ctx) return ctx->ibv_ctx; } + +bool mlx5dr_context_cap_dynamic_reparse (struct mlx5dr_context *ctx); + +uint8_t mlx5dr_context_get_reparse_mode (struct mlx5dr_context *ctx); +#endif /* MLX5DR_CONTEXT_H_ */
drivers/net/mlx5/hws/mlx5dr_matcher.c +2 -0
@@ -562,6 +562,7 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher, rtc_attr.pd = ctx->pd_num; rtc_attr.ste_base = devx_obj->id; rtc_attr.ste_offset = ste->offset; + rtc_attr.reparse_mode =mlx5dr_context_get_reparse_mode (ctx); rtc_attr.table_type =mlx5dr_table_get_res_fw_ft_type (tbl->type, false);mlx5dr_matcher_set_rtc_attr_sz (matcher, &rtc_attr, rtc_type, false);
@@ -764,6 +765,7 @@ static int mlx5dr_matcher_bind_at(struct mlx5dr_matcher *matcher)/* Allocate STC for jumps to STE */ stc_attr.action_offset =MLX5DR_ACTION_OFFSET_HIT ; stc_attr.action_type =MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_STE_TABLE ; + stc_attr.reparse_mode =MLX5_IFC_STC_REPARSE_NEVER ; stc_attr.ste_table.ste = matcher->action_ste.ste; stc_attr.ste_table.ste_pool = matcher->action_ste.pool; stc_attr.ste_table.match_definer_id = ctx->caps->trivial_match_definer;
Signature · 1 line
2.27.0
PATCH v4 5/13 net/mlx5/hws: dynamic re-parse for modify header
In reply to Rongwei LiuFrom: Alex Vesker <[email protected]>
With dynamic re-parse we would always require re-parse but this is not always necessary. Re-parse is only needed when the packet structure is changed. This support will allow dynamically deciding based on the action pattern if re-parse is required or no.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 15 +++++++--- drivers/net/mlx5/hws/mlx5dr_action.h | 1 + drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 41 +++++++++++++++++++++++++-- drivers/net/mlx5/hws/mlx5dr_pat_arg.h | 2 ++ 4 files changed, 53 insertions(+), 6 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +11 -4
@@ -547,7 +547,9 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :case MLX5DR_ACTION_TYP_MODIFY_HDR : attr->action_offset =MLX5DR_ACTION_OFFSET_DW6 ; - attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ; +if (action->modify_header.require_reparse) + attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ; +if (action->modify_header.num_of_actions ==1 ) { attr->modify_action.data = action->modify_header.single_action; attr->action_type =mlx5dr_action_get_mh_stc_type (attr->modify_action.data);
@@ -1474,6 +1476,8 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action, action[i].modify_header.num_of_actions = num_of_actions; action[i].modify_header.arg_obj = arg_obj; action[i].modify_header.pat_obj = pat_obj; + action[i].modify_header.require_reparse = +mlx5dr_pat_require_reparse ((__be64 *)mh_data, num_of_actions); ret =mlx5dr_action_create_stcs (&action[i],NULL );if (ret) {
@@ -1620,7 +1624,7 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, {struct mlx5dr_devx_obj *pat_obj, *arg_obj =NULL ;struct mlx5dr_context *ctx = action->ctx; -uint16_t max_mh_actions =0 ; +uint16_t num_actions, max_mh_actions =0 ;int i, ret;/* Calculate maximum number of mh actions for shared arg allocation */
@@ -1646,11 +1650,14 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, goto free_stc_and_pat; } + num_actions = pattern[i].sz /MLX5DR_MODIFY_ACTION_SIZE ; action[i].modify_header.num_of_patterns = num_of_patterns; action[i].modify_header.max_num_of_actions = max_mh_actions; - action[i].modify_header.num_of_actions = pattern[i].sz /MLX5DR_MODIFY_ACTION_SIZE ; + action[i].modify_header.num_of_actions = num_actions; + action[i].modify_header.require_reparse = +mlx5dr_pat_require_reparse (pattern[i].data, num_actions); -if (action[i].modify_header.num_of_actions ==1 ) { +if (num_actions ==1 ) { pat_obj =NULL ;/* Optimize single modify action to be used inline */ action[i].modify_header.single_action = pattern[i].data[0 ];
drivers/net/mlx5/hws/mlx5dr_action.h +1 -0
@@ -127,6 +127,7 @@ struct mlx5dr_action {uint8_t single_action_type;uint8_t num_of_actions;uint8_t max_num_of_actions; +uint8_t require_reparse; } modify_header;struct {struct mlx5dr_devx_obj *arg_obj;
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +39 -2
53 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_pat_arg.h +2 -0
@@ -79,6 +79,8 @@ void mlx5dr_pat_put_pattern(struct mlx5dr_context *ctx,bool mlx5dr_arg_is_valid_arg_request_size (struct mlx5dr_context *ctx,uint32_t arg_size); +bool mlx5dr_pat_require_reparse (__be64 *actions,uint16_t num_of_actions); + void mlx5dr_arg_write(struct mlx5dr_send_engine *queue, void *comp_data, uint32_t arg_idx,
Signature · 1 line
2.27.0
PATCH v4 6/13 net/mlx5/hws: fix incorrect re-parse on complex rules
In reply to Rongwei LiuFrom: Alex Vesker <[email protected]>
The re-parse value when jumping to action STEs was set to NEVER leading to cases in which 2 STCs accessed the re-parse bit causing hw_syndrome (0x3d). The solution is to use set re-parse mode to IGNORE in such case.
--- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_matcher.c +1 -1
@@ -765,7 +765,7 @@ static int mlx5dr_matcher_bind_at(struct mlx5dr_matcher *matcher)/* Allocate STC for jumps to STE */ stc_attr.action_offset =MLX5DR_ACTION_OFFSET_HIT ; stc_attr.action_type =MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_STE_TABLE ; - stc_attr.reparse_mode =MLX5_IFC_STC_REPARSE_NEVER ; + stc_attr.reparse_mode =MLX5_IFC_STC_REPARSE_IGNORE ; stc_attr.ste_table.ste = matcher->action_ste.ste; stc_attr.ste_table.ste_pool = matcher->action_ste.pool; stc_attr.ste_table.match_definer_id = ctx->caps->trivial_match_definer;
Signature · 1 line
2.27.0
PATCH v4 7/13 net/mlx5: sample the srv6 last segment
In reply to Rongwei LiuWhen removing the IPv6 routing extension header from the packets, the destination address should be updated to the last one in the segment list.
Enlarge the hardware sample scope to cover the last segment.
--- drivers/net/mlx5/mlx5.c | 41 ++++++++++++++++++++++++++++++----------- drivers/net/mlx5/mlx5.h | 6 ++++++ 2 files changed, 36 insertions(+), 11 deletions(-)
drivers/net/mlx5/mlx5.c +30 -11
@@ -1070,6 +1070,7 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev)struct mlx5_devx_graph_node_attr node = { .modify_field_select =0 , }; +uint32_t i;uint32_t ids[MLX5_GRAPH_NODE_SAMPLE_NUM ];struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_common_dev_config *config = &priv->sh->cdev->config;
@@ -1103,10 +1104,18 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) node.next_header_field_size =0x8 ; node.in[0 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_IP ; node.in[0 ].compare_condition_value =IPPROTO_ROUTING ; - node.sample[0 ].flow_match_sample_en =1 ; -/* First come first serve no matter inner or outer. */ - node.sample[0 ].flow_match_sample_tunnel_mode =MLX5_GRAPH_SAMPLE_TUNNEL_FIRST ; - node.sample[0 ].flow_match_sample_offset_mode =MLX5_GRAPH_SAMPLE_OFFSET_FIXED ; +/* Final IPv6 address. */ +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + node.sample[i].flow_match_sample_en =1 ; + node.sample[i].flow_match_sample_offset_mode = +MLX5_GRAPH_SAMPLE_OFFSET_FIXED ; +/* First come first serve no matter inner or outer. */ + node.sample[i].flow_match_sample_tunnel_mode = +MLX5_GRAPH_SAMPLE_TUNNEL_FIRST ; + node.sample[i].flow_match_sample_field_base_offset = + (i +1 ) *sizeof (uint32_t );/* in bytes */ + } + node.sample[0 ].flow_match_sample_field_base_offset =0 ; node.out[0 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_TCP ; node.out[0 ].compare_condition_value =IPPROTO_TCP ; node.out[1 ].arc_parse_graph_node =MLX5_GRAPH_ARC_NODE_UDP ;
@@ -1119,8 +1128,8 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev) goto error; } priv->sh->srh_flex_parser.flex.devx_fp->devx_obj = fp; - priv->sh->srh_flex_parser.flex.mapnum =1 ; - priv->sh->srh_flex_parser.flex.devx_fp->num_samples =1 ; + priv->sh->srh_flex_parser.flex.mapnum =MLX5_SRV6_SAMPLE_NUM ; + priv->sh->srh_flex_parser.flex.devx_fp->num_samples =MLX5_SRV6_SAMPLE_NUM ; ret =mlx5_devx_cmd_query_parse_samples (fp, ids, priv->sh->srh_flex_parser.flex.mapnum, &priv->sh->srh_flex_parser.flex.devx_fp->anchor_id);
@@ -1128,12 +1137,22 @@ mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev)DRV_LOG (ERR ,"Failed to query sample IDs." ); goto error; } - ret =mlx5_devx_cmd_match_sample_info_query (ibv_ctx, ids[0 ], - &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[0 ]); -if (ret) { -DRV_LOG (ERR ,"Failed to query sample id information." ); - goto error; +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + ret =mlx5_devx_cmd_match_sample_info_query (ibv_ctx, ids[i], + &priv->sh->srh_flex_parser.flex.devx_fp->sample_info[i]); +if (ret) { +DRV_LOG (ERR ,"Failed to query sample id %u information." , ids[i]); + goto error; + } + } +for (i =0 ; i <=MLX5_SRV6_SAMPLE_NUM -1 && i <MLX5_GRAPH_NODE_SAMPLE_NUM ; i++) { + priv->sh->srh_flex_parser.flex.devx_fp->sample_ids[i] = ids[i]; + priv->sh->srh_flex_parser.flex.map[i].width =sizeof (uint32_t ) *CHAR_BIT ; + priv->sh->srh_flex_parser.flex.map[i].reg_id = i; + priv->sh->srh_flex_parser.flex.map[i].shift = + (i +1 ) *sizeof (uint32_t ) *CHAR_BIT ; } + priv->sh->srh_flex_parser.flex.map[0 ].shift =0 ;return 0 ; error:if (fp)
drivers/net/mlx5/mlx5.h +6 -0
@@ -1356,6 +1356,7 @@ struct mlx5_flex_pattern_field { uint16_t shift:5; uint16_t reg_id:5; }; +#define MLX5_INVALID_SAMPLE_REG_ID 0x1F/* Port flex item context. */
@@ -1367,6 +1368,11 @@ struct mlx5_flex_item {struct mlx5_flex_pattern_field map[MLX5_FLEX_ITEM_MAPPING_NUM ]; }; +/* +* Sample an IPv6 address and the first dword of SRv6 header. +* Then it is 16 + 4 = 20 bytes which is 5 dwords. +*/ +#define MLX5_SRV6_SAMPLE_NUM 5/* Mlx5 internal flex parser profile structure. */ struct mlx5_internal_flex_parser_profile {uint32_t refcnt;
Signature · 1 line
2.27.0
PATCH v4 8/13 net/mlx5/hws: fix potential wrong rte_errno value
In reply to Rongwei LiuA valid rte_errno is desired when DR layer api returns error and it can't over-write the value set by under-layer.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +1 -1
@@ -2015,6 +2015,7 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,if (!num_of_hdrs) {DR_LOG (ERR ,"Reformat num_of_hdrs cannot be zero" ); + rte_errno =EINVAL ;return NULL ; }
@@ -2062,7 +2063,6 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx, reformat_hdrs, log_bulk_size);if (ret) {DR_LOG (ERR ,"Failed to create HWS reformat action" ); - rte_errno =EINVAL ; goto free_reformat_hdrs; }
Signature · 1 line
2.27.0
PATCH v4 9/13 net/mlx5/hws: add IPv6 routing extension push remove actions
In reply to Rongwei LiuAdd two dr_actions to implement IPv6 routing extension push and remove, the new actions are multiple actions combination instead of new types.
Basically, there are two modify headers plus one reformat action. Action order is the same as encap and decap actions.
--- drivers/common/mlx5/mlx5_prm.h | 1 + drivers/net/mlx5/hws/mlx5dr.h | 29 +++ drivers/net/mlx5/hws/mlx5dr_action.c | 358 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 7 + drivers/net/mlx5/hws/mlx5dr_debug.c | 2 + drivers/net/mlx5/mlx5_flow.h | 44 ++++ 6 files changed, 438 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +1 -0
@@ -3564,6 +3564,7 @@ enum mlx5_ifc_header_anchors {MLX5_HEADER_ANCHOR_PACKET_START =0x0 ,MLX5_HEADER_ANCHOR_FIRST_VLAN_START =0x2 ,MLX5_HEADER_ANCHOR_IPV6_IPV4 =0x07 , +MLX5_HEADER_ANCHOR_TCP_UDP =0x09 ,MLX5_HEADER_ANCHOR_INNER_MAC =0x13 , MLX5_HEADER_ANCHOR_INNER_IPV6_IPV4 = 0x19, };
drivers/net/mlx5/hws/mlx5dr.h +29 -0
@@ -49,6 +49,8 @@ enum mlx5dr_action_type {MLX5DR_ACTION_TYP_REMOVE_HEADER ,MLX5DR_ACTION_TYP_DEST_ROOT ,MLX5DR_ACTION_TYP_DEST_ARRAY , +MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT , +MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT , MLX5DR_ACTION_TYP_MAX, };
@@ -242,6 +244,11 @@ struct mlx5dr_rule_action {uint8_t *data; } reformat; +struct { +uint32_t offset; +uint8_t *header; + } ipv6_ext; +struct {rte_be32_t vlan_hdr; } push_vlan;
@@ -767,6 +774,28 @@ mlx5dr_action_create_remove_header(struct mlx5dr_context *ctx,struct mlx5dr_action_remove_header_attr *attr, uint32_t flags); +/* Create action to push or remove IPv6 extension header. +* +* @param[in] ctx +* The context in which the new action will be created. +* @param[in] type +* Type of direct rule action: MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT or +* MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT. +* @param[in] hdr +* Header for packet reformat. +* @param[in] log_bulk_size +* Number of unique values used with this pattern. +* @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_reformat_ipv6_ext (struct mlx5dr_context *ctx, +enum mlx5dr_action_type type, +struct mlx5dr_action_reformat_header *hdr, +uint32_t log_bulk_size, +uint32_t flags); +/* Destroy direct rule action. * * @param[in] action
drivers/net/mlx5/hws/mlx5dr_action.c +355 -3
406 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +7 -0
@@ -8,6 +8,9 @@/* Max number of STEs needed for a rule (including match) */ #define MLX5DR_ACTION_MAX_STE 10 +/* Max number of internal subactions of ipv6_ext */ +#define MLX5DR_ACTION_IPV6_EXT_MAX_SA 4 +enum mlx5dr_action_stc_idx {MLX5DR_ACTION_STC_IDX_CTRL =0 ,MLX5DR_ACTION_STC_IDX_HIT =1 ,
@@ -138,6 +141,10 @@ struct mlx5dr_action {uint8_t offset;bool encap; } reformat; +struct { +struct mlx5dr_action + *action[MLX5DR_ACTION_IPV6_EXT_MAX_SA ]; + } ipv6_route_ext;struct {struct mlx5dr_devx_obj *devx_obj;uint8_t return_reg_id;
drivers/net/mlx5/hws/mlx5dr_debug.c +2 -0
@@ -26,6 +26,8 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_DEST_ARRAY] = "DEST_ARRAY", [MLX5DR_ACTION_TYP_INSERT_HEADER] = "INSERT_HEADER", [MLX5DR_ACTION_TYP_REMOVE_HEADER] = "REMOVE_HEADER", + [MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT] = "POP_IPV6_ROUTE_EXT", + [MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT ] ="PUSH_IPV6_ROUTE_EXT" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
drivers/net/mlx5/mlx5_flow.h +44 -0
56 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 10/13 net/mlx5/hws: add setter for IPv6 routing push remove
In reply to Rongwei LiuThe rte action will be translated to multiple dr_actions which need different setters to program them.
In order to leverage the existing setter logic, there is a new callback introduce which called fetch_opt with unique parameter.
For each setter, it may have different reparsing properties. Setter which requires no reparse can't share the same one with the one has reparse enabled even if there is spare space.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 174 +++++++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_action.h | 3 +- 2 files changed, 176 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +174 -0
@@ -3007,6 +3007,121 @@ mlx5dr_action_setter_common_decap(struct mlx5dr_actions_apply_data *apply, MLX5DR_CONTEXT_SHARED_STC_DECAP_L3)); } +static void +mlx5dr_action_setter_ipv6_route_ext_gen_push_mhdr (uint8_t *data,void *mh_data) +{ +uint8_t *action_ptr = mh_data; +uint32_t *ipv6_dst_addr; +uint8_t seg_left; +uint32_t i; + +/* Fetch the last IPv6 address in the segment list which is the next hop */ + seg_left =MLX5_GET (header_ipv6_routing_ext, data, segments_left) -1 ; + ipv6_dst_addr = (uint32_t *)data +MLX5_ST_SZ_DW (header_ipv6_routing_ext) + + seg_left *MLX5_ST_SZ_DW (definer_hl_ipv6_addr); + +/* Load next hop IPv6 address in reverse order to ipv6.dst_address */ +for (i =0 ; i <MLX5_ST_SZ_DW (definer_hl_ipv6_addr); i++) { +MLX5_SET (set_action_in, action_ptr, data,be32toh (*ipv6_dst_addr++)); + action_ptr +=MLX5DR_MODIFY_ACTION_SIZE ; + } + +/* Set ipv6_route_ext.next_hdr per user input */ +MLX5_SET (set_action_in, action_ptr, data, *data); +} + +static void +mlx5dr_action_setter_ipv6_route_ext_mhdr (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = apply->rule_action; +struct mlx5dr_actions_wqe_setter tmp_setter = {0 }; +struct mlx5dr_rule_action tmp_rule_action; +__be64 cmd[MLX5_SRV6_SAMPLE_NUM ] = {0 }; +struct mlx5dr_action *ipv6_ext_action; +uint8_t *header; + + header = rule_action[setter->idx_double].ipv6_ext.header; + ipv6_ext_action = rule_action[setter->idx_double].action; + tmp_rule_action.action = ipv6_ext_action->ipv6_route_ext.action[setter->extra_data]; + +if (tmp_rule_action.action->flags &MLX5DR_ACTION_FLAG_SHARED ) { + tmp_rule_action.modify_header.offset =0 ; + tmp_rule_action.modify_header.pattern_idx =0 ; + tmp_rule_action.modify_header.data =NULL ; + }else { +/* +* Copy ipv6_dst from ipv6_route_ext.last_seg. +* Set ipv6_route_ext.next_hdr. +*/ +mlx5dr_action_setter_ipv6_route_ext_gen_push_mhdr (header, cmd); + tmp_rule_action.modify_header.data = (uint8_t *)cmd; + tmp_rule_action.modify_header.pattern_idx =0 ; + tmp_rule_action.modify_header.offset = + rule_action[setter->idx_double].ipv6_ext.offset; + } + + apply->rule_action = &tmp_rule_action; + +/* Reuse regular */ +mlx5dr_action_setter_modify_header (apply, &tmp_setter); + +/* Swap rule actions from backup */ + apply->rule_action = rule_action; +} + +static void +mlx5dr_action_setter_ipv6_route_ext_insert_ptr (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = apply->rule_action; +struct mlx5dr_actions_wqe_setter tmp_setter = {0 }; +struct mlx5dr_rule_action tmp_rule_action; +struct mlx5dr_action *ipv6_ext_action; +uint8_t header[MLX5_PUSH_MAX_LEN ]; + + ipv6_ext_action = rule_action[setter->idx_double].action; + tmp_rule_action.action = ipv6_ext_action->ipv6_route_ext.action[setter->extra_data]; + +if (tmp_rule_action.action->flags &MLX5DR_ACTION_FLAG_SHARED ) { + tmp_rule_action.reformat.offset =0 ; + tmp_rule_action.reformat.hdr_idx =0 ; + tmp_rule_action.reformat.data =NULL ; + }else { +memcpy (header, rule_action[setter->idx_double].ipv6_ext.header, + tmp_rule_action.action->reformat.header_size); +/* Clear ipv6_route_ext.next_hdr for right checksum */ +MLX5_SET (header_ipv6_routing_ext, header, next_hdr,0 ); + tmp_rule_action.reformat.data = header; + tmp_rule_action.reformat.hdr_idx =0 ; + tmp_rule_action.reformat.offset = + rule_action[setter->idx_double].ipv6_ext.offset; + } + + apply->rule_action = &tmp_rule_action; + +/* Reuse regular */ +mlx5dr_action_setter_insert_ptr (apply, &tmp_setter); + +/* Swap rule actions from backup */ + apply->rule_action = rule_action; +} + +static void +mlx5dr_action_setter_ipv6_route_ext_pop (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action = &apply->rule_action[setter->idx_single]; +uint8_t idx =MLX5DR_ACTION_IPV6_EXT_MAX_SA -1 ; +struct mlx5dr_action *action; + +/* Pop the ipv6_route_ext as set_single logic */ + action = rule_action->action->ipv6_route_ext.action[idx]; + apply->wqe_data[MLX5DR_ACTION_OFFSET_DW5 ] =0 ; + apply->wqe_ctrl->stc_ix[MLX5DR_ACTION_STC_IDX_DW5 ] = +htobe32 (action->stc[apply->tbl_type].offset); +} +int mlx5dr_action_template_process (struct mlx5dr_action_template *at) {struct mlx5dr_actions_wqe_setter *start_setter = at->setters +1 ;
@@ -3070,6 +3185,65 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_double = i;break ; +case MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT : +/* +* Backup ipv6_route_ext.next_hdr to ipv6_route_ext.seg_left. +* Set ipv6_route_ext.next_hdr to 0 for checksum bug. +*/ + setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE ); + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =0 ; + setter++; + +/* +* Restore ipv6_route_ext.next_hdr from ipv6_route_ext.seg_left. +* Load the final destination address from flex parser sample 1->4. +*/ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =1 ; + setter++; + +/* Set the ipv6.protocol per ipv6_route_ext.next_hdr */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =2 ; +/* Pop ipv6_route_ext */ + setter->flags |=ASF_SINGLE1 |ASF_REMOVE ; + setter->set_single = &mlx5dr_action_setter_ipv6_route_ext_pop; + setter->idx_single = i; +break ; + +case MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT : +/* Insert ipv6_route_ext with next_hdr as 0 due to checksum bug */ + setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE ); + setter->flags |=ASF_DOUBLE |ASF_INSERT ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_insert_ptr; + setter->idx_double = i; + setter->extra_data =0 ; + setter++; + +/* Set ipv6.protocol as IPPROTO_ROUTING: 0x2b */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =1 ; + setter++; + +/* +* Load the right ipv6_route_ext.next_hdr per user input buffer. +* Load the next dest_addr from the ipv6_route_ext.seg_list[last]. +*/ + setter->flags |=ASF_DOUBLE |ASF_MODIFY ; + setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; + setter->idx_double = i; + setter->extra_data =2 ; +break ; +case MLX5DR_ACTION_TYP_MODIFY_HDR :/* Double modify header list */ setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE );
drivers/net/mlx5/hws/mlx5dr_action.h +2 -1
@@ -6,7 +6,7 @@#define MLX5DR_ACTION_H_ /* Max number of STEs needed for a rule (including match) */ -#define MLX5DR_ACTION_MAX_STE 10 +#define MLX5DR_ACTION_MAX_STE 20/* Max number of internal subactions of ipv6_ext */ #define MLX5DR_ACTION_IPV6_EXT_MAX_SA 4
@@ -104,6 +104,7 @@ struct mlx5dr_actions_wqe_setter {uint8_t idx_ctr;uint8_t idx_hit;uint8_t flags; +uint8_t extra_data; };struct mlx5dr_action_template {
Signature · 1 line
2.27.0
PATCH v4 11/13 net/mlx5: implement IPv6 routing push remove
In reply to Rongwei LiuReserve the push data buffer for each job and the maximum length is set to 128 for now.
Only supports type IPPROTO_ROUTING when translating the rte flow action.
Remove actions must be shared globally and only supports next layer as TCP or UDP.
--- doc/guides/nics/features/mlx5.ini | 2 + doc/guides/nics/mlx5.rst | 11 + doc/guides/rel_notes/release_23_11.rst | 2 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.h | 21 +- drivers/net/mlx5/mlx5_flow_hw.c | 283 ++++++++++++++++++++++++- 6 files changed, 311 insertions(+), 9 deletions(-)
doc/guides/nics/features/mlx5.ini +2 -0
@@ -108,6 +108,8 @@ flag = Y inc_tcp_ack = Y inc_tcp_seq = Y indirect_list = Y +ipv6_ext_push = Y +ipv6_ext_remove = Y jump = Y mark = Y meter = Y
doc/guides/nics/mlx5.rst +11 -0
@@ -148,6 +148,7 @@ Features - Matching on GTP extension header with raw encap/decap action. - Matching on Geneve TLV option header with raw encap/decap action. - Matching on ESP header SPI field. +- Matching on flex item with specific pattern. - Matching on InfiniBand BTH. - Modify IPv4/IPv6 ECN field. - RSS support in sample action.
@@ -166,6 +167,8 @@ Features - Sub-Function. - Matching on represented port. - Matching on aggregated affinity. +- Modify flex item field. +- Push or remove IPv6 routing extension. Limitations
@@ -759,6 +762,14 @@ Limitations to the representor of the source virtual port (SF/VF), while if it is disabled, the traffic will be routed based on the steering rules in the ingress domain. +- IPv6 routing extension push or remove: + + - Supported only with HW Steering enabled (``dv_flow_en`` = 2). + - Supported in non-zero group (No limits on transfer domain if `fdb_def_rule_en` = 1 which is default). + - Only supports TCP or UDP as next layer. + - IPv6 routing header must be the only present extension. + - Not supported on guest port. + Statistics ----------
doc/guides/rel_notes/release_23_11.rst +2 -0
@@ -158,6 +158,8 @@ New Features * Added support for ``RTE_FLOW_ITEM_TYPE_PTYPE`` flow item. * Added support for ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR`` flow action and mirror. * Added support for Multiport E-Switch. + * Added support for ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH`` flow action. + * Added support for ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE`` flow action. * **Updated Solarflare net driver.**
drivers/net/mlx5/mlx5.h +1 -0
@@ -394,6 +394,7 @@ struct mlx5_hw_q_job { };void *user_data;/* Job user data. */ uint8_t *encap_data;/* Encap data. */ +uint8_t *push_data;/* IPv6 routing push data. */ struct mlx5_modification_cmd *mhdr_cmd;struct rte_flow_item *items;union {
drivers/net/mlx5/mlx5_flow.h +20 -1
@@ -363,6 +363,8 @@ enum mlx5_feature_name {#define MLX5_FLOW_ACTION_INDIRECT_AGE (1ull << 44)#define MLX5_FLOW_ACTION_QUOTA (1ull << 46)#define MLX5_FLOW_ACTION_PORT_REPRESENTOR (1ull << 47) +#define MLX5_FLOW_ACTION_IPV6_ROUTING_REMOVE (1ull << 48) +#define MLX5_FLOW_ACTION_IPV6_ROUTING_PUSH (1ull << 49)#define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \ (MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE)
@@ -1269,6 +1271,8 @@ typedef int const struct rte_flow_action *, struct mlx5dr_rule_action *); +#define MLX5_MHDR_MAX_CMD ((MLX5_MAX_MODIFY_NUM) * 2 + 1) +/* rte flow action translate to DR action struct. */ struct mlx5_action_construct_data {LIST_ENTRY (mlx5_action_construct_data) next;
@@ -1315,6 +1319,10 @@ struct mlx5_action_construct_data {struct {cnt_id_t id; } shared_counter; +struct { +/* IPv6 extension push data len. */ +uint16_t len; + } ipv6_ext;struct {uint32_t id;uint32_t conf_masked:1 ;
@@ -1359,6 +1367,7 @@ struct rte_flow_actions_template {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. */ +uint16_t recom_off;/* Offset of DR IPv6 routing push remove action. */ uint32_t refcnt;/* Reference counter. */ uint8_t flex_item;/* flex item index. */ };
@@ -1384,7 +1393,14 @@ struct mlx5_hw_encap_decap_action {uint8_t data[];/* Action data. */ }; -#define MLX5_MHDR_MAX_CMD ((MLX5_MAX_MODIFY_NUM) * 2 + 1) +/* Push remove action struct. */ +struct mlx5_hw_push_remove_action { +struct mlx5dr_action *action;/* Action object. */ +/* Is push_remove action shared across flows in table. */ +uint8_t shared; +size_t data_size;/* Action metadata size. */ +uint8_t data[];/* Action data. */ +};/* Modify field action struct. */ struct mlx5_hw_modify_header_action {
@@ -1415,6 +1431,9 @@ struct mlx5_hw_actions {/* Encap/Decap action. */ struct mlx5_hw_encap_decap_action *encap_decap;uint16_t encap_decap_pos;/* Encap/Decap action position. */ +/* Push/remove action. */ +struct mlx5_hw_push_remove_action *push_remove; +uint16_t push_remove_pos;/* Push/remove action position. */ uint32_t mark:1; /* Indicate the mark action. */cnt_id_t cnt_id;/* Counter id. */ uint32_t mtr_id;/* Meter id. */
drivers/net/mlx5/mlx5_flow_hw.c +275 -8
460 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 12/13 net/mlx5/hws: fix srv6 push compilation failure
In reply to Rongwei LiuOVS team reports PMD compilation failed under: gcc (Ubuntu 13.2.0-4ubuntu3) 13.2.0
In function ‘mlx5dr_action_create_push_ipv6_route_ext_mhdr2’, ../drivers/net/mlx5/hws/mlx5dr_action.c:2701:64:
‘ipv6_dst_addr’ may be used uninitialized
Only shared action needs to query the IPv6 destination address when creating dr_action. This is a false alert. Initialize it to NULL to fix the warning.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +1 -1
@@ -2326,8 +2326,8 @@ mlx5dr_action_create_push_ipv6_route_ext_mhdr2(struct mlx5dr_action *action, MLX5_MODI_OUT_DIPV6_31_0 };struct mlx5dr_action_mh_pattern pattern; +uint32_t *ipv6_dst_addr =NULL ;uint8_t seg_left, next_hdr; -uint32_t *ipv6_dst_addr;__be64 cmd[5 ] = {0 };uint16_t mod_id;uint32_t i;
Signature · 1 line
2.27.0
PATCH v4 13/13 net/mlx5/hws: add stc reparse support for srv6 push pop
In reply to Rongwei LiuAfter pushing/popping srv6 into/from IPv6 packets, the checksum needs to be correct.
In order to achieve this, there is a need to control each STE' reparse behavior(CX7 and above). Add two more flags enumeration definitions to allow external control of reparse property in stc.
1. Push
a. 1st STE, insert header action, reparse ignored(default reparse
always)
b. 2nd STE, modify IPv6 protocol, reparse always as default. c. 3rd STE, modify header list, reparse always(default reparse
ignored)
2. Pop
a. 1st STE, modify header list, reparse always(default reparse
ignored)
b. 2nd STE, modify header list, reparse always(default reparse
ignored)
c. 3rd STE, modify IPv6 protocol, reparse ignored(default reparse
always); remove header action, reparse always as default.
For CX6Lx and CX6Dx, the reparse behavior is controlled by RTC as always. Only pop action can work well.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 115 +++++++++++++++++++-------- drivers/net/mlx5/hws/mlx5dr_action.h | 7 ++ 2 files changed, 87 insertions(+), 35 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +80 -35
@@ -552,6 +552,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :case MLX5DR_ACTION_TYP_MODIFY_HDR : attr->action_offset =MLX5DR_ACTION_OFFSET_DW6 ; + attr->reparse_mode =MLX5_IFC_STC_REPARSE_IGNORE ;if (action->modify_header.require_reparse) attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ;
@@ -590,9 +591,12 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2 :case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3 :case MLX5DR_ACTION_TYP_INSERT_HEADER : + attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ; +if (!action->reformat.require_reparse) + attr->reparse_mode =MLX5_IFC_STC_REPARSE_IGNORE ; + attr->action_type =MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT ; attr->action_offset =MLX5DR_ACTION_OFFSET_DW6 ; - attr->reparse_mode =MLX5_IFC_STC_REPARSE_ALWAYS ; attr->insert_header.encap = action->reformat.encap; attr->insert_header.insert_anchor = action->reformat.anchor; attr->insert_header.arg_id = action->reformat.arg_obj->id;
@@ -1301,7 +1305,7 @@ static int mlx5dr_action_handle_insert_with_ptr(struct mlx5dr_action *action, uint8_t num_of_hdrs, struct mlx5dr_action_reformat_header *hdrs, - uint32_t log_bulk_sz) + uint32_t log_bulk_sz, uint32_t reparse) { struct mlx5dr_devx_obj *arg_obj;size_t max_sz =0 ;
@@ -1338,6 +1342,11 @@ mlx5dr_action_handle_insert_with_ptr(struct mlx5dr_action *action, action[i].reformat.encap =1 ; } +if (likely (reparse ==MLX5DR_ACTION_STC_REPARSE_DEFAULT )) + action[i].reformat.require_reparse = true; +else if (reparse ==MLX5DR_ACTION_STC_REPARSE_ON ) + action[i].reformat.require_reparse = true; + ret =mlx5dr_action_create_stcs (&action[i],NULL );if (ret) {DR_LOG (ERR ,"Failed to create stc for reformat" );
@@ -1374,7 +1383,8 @@ mlx5dr_action_handle_l2_to_tunnel_l3(struct mlx5dr_action *action, ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, - log_bulk_sz); + log_bulk_sz, +MLX5DR_ACTION_STC_REPARSE_DEFAULT );if (ret) goto put_shared_stc;
@@ -1517,7 +1527,8 @@ mlx5dr_action_create_reformat_hws(struct mlx5dr_action *action, ret =mlx5dr_action_create_stcs (action,NULL );break ;case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2 : - ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, bulk_size); + ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, hdrs, bulk_size, +MLX5DR_ACTION_STC_REPARSE_DEFAULT );break ;case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3 : ret =mlx5dr_action_handle_l2_to_tunnel_l3 (action, num_of_hdrs, hdrs, bulk_size);
@@ -1625,7 +1636,8 @@ static int mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, uint8_t num_of_patterns, struct mlx5dr_action_mh_pattern *pattern, - uint32_t log_bulk_size) + uint32_t log_bulk_size, + uint32_t reparse) { struct mlx5dr_devx_obj *pat_obj, *arg_obj = NULL;struct mlx5dr_context *ctx = action->ctx;
@@ -1659,8 +1671,12 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action, action[i].modify_header.num_of_patterns = num_of_patterns; action[i].modify_header.max_num_of_actions = max_mh_actions; action[i].modify_header.num_of_actions = num_actions; - action[i].modify_header.require_reparse = -mlx5dr_pat_require_reparse (pattern[i].data, num_actions); + +if (likely (reparse ==MLX5DR_ACTION_STC_REPARSE_DEFAULT )) + action[i].modify_header.require_reparse = +mlx5dr_pat_require_reparse (pattern[i].data, num_actions); +else if (reparse ==MLX5DR_ACTION_STC_REPARSE_ON ) + action[i].modify_header.require_reparse = true;if (num_actions ==1 ) { pat_obj =NULL ;
@@ -1703,12 +1719,12 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action,return rte_errno; } -struct mlx5dr_action * -mlx5dr_action_create_modify_header (struct mlx5dr_context *ctx, -uint8_t num_of_patterns, -struct mlx5dr_action_mh_pattern *patterns, -uint32_t log_bulk_size, -uint32_t flags) +static struct mlx5dr_action * +mlx5dr_action_create_modify_header_reparse (struct mlx5dr_context *ctx, +uint8_t num_of_patterns, +struct mlx5dr_action_mh_pattern *patterns, +uint32_t log_bulk_size, +uint32_t flags,uint32_t reparse) {struct mlx5dr_action *action;int ret;
@@ -1756,7 +1772,8 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_modify_header_hws (action, num_of_patterns, patterns, - log_bulk_size); + log_bulk_size, + reparse);if (ret) goto free_action;
@@ -1767,6 +1784,17 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,return NULL ; } +struct mlx5dr_action * +mlx5dr_action_create_modify_header (struct mlx5dr_context *ctx, +uint8_t num_of_patterns, +struct mlx5dr_action_mh_pattern *patterns, +uint32_t log_bulk_size, +uint32_t flags) +{ +return mlx5dr_action_create_modify_header_reparse (ctx, num_of_patterns, patterns, + log_bulk_size, flags, +MLX5DR_ACTION_STC_REPARSE_DEFAULT ); +}static struct mlx5dr_devx_obj * mlx5dr_action_dest_array_process_reformat(struct mlx5dr_context *ctx, enum mlx5dr_action_type type,
@@ -2007,12 +2035,12 @@ mlx5dr_action_create_dest_root(struct mlx5dr_context *ctx,return NULL ; } -struct mlx5dr_action * -mlx5dr_action_create_insert_header (struct mlx5dr_context *ctx, -uint8_t num_of_hdrs, -struct mlx5dr_action_insert_header *hdrs, -uint32_t log_bulk_size, -uint32_t flags) +static struct mlx5dr_action * +mlx5dr_action_create_insert_header_reparse (struct mlx5dr_context *ctx, +uint8_t num_of_hdrs, +struct mlx5dr_action_insert_header *hdrs, +uint32_t log_bulk_size, +uint32_t flags,uint32_t reparse) {struct mlx5dr_action_reformat_header *reformat_hdrs;struct mlx5dr_action *action;
@@ -2065,7 +2093,8 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx, } ret =mlx5dr_action_handle_insert_with_ptr (action, num_of_hdrs, - reformat_hdrs, log_bulk_size); + reformat_hdrs, log_bulk_size, + reparse);if (ret) {DR_LOG (ERR ,"Failed to create HWS reformat action" ); goto free_reformat_hdrs;
@@ -2082,6 +2111,18 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,return NULL ; } +struct mlx5dr_action * +mlx5dr_action_create_insert_header (struct mlx5dr_context *ctx, +uint8_t num_of_hdrs, +struct mlx5dr_action_insert_header *hdrs, +uint32_t log_bulk_size, +uint32_t flags) +{ +return mlx5dr_action_create_insert_header_reparse (ctx, num_of_hdrs, hdrs, + log_bulk_size, flags, +MLX5DR_ACTION_STC_REPARSE_DEFAULT ); +} +struct mlx5dr_action * mlx5dr_action_create_remove_header(struct mlx5dr_context *ctx, struct mlx5dr_action_remove_header_attr *attr,
@@ -2175,8 +2216,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr1(struct mlx5dr_action *action) pattern.data = cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_ON ); } static void *
@@ -2222,8 +2264,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr2(struct mlx5dr_action *action) pattern.data = cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_ON ); } static void *
@@ -2249,8 +2292,9 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr3(struct mlx5dr_action *action) pattern.data = (__be64 *)cmd; pattern.sz =sizeof (cmd); -return mlx5dr_action_create_modify_header (action->ctx,1 , &pattern, -0 , action->flags); +return mlx5dr_action_create_modify_header_reparse (action->ctx,1 , &pattern,0 , + action->flags, +MLX5DR_ACTION_STC_REPARSE_OFF ); } static int
@@ -2397,8 +2441,9 @@ mlx5dr_action_create_push_ipv6_route_ext(struct mlx5dr_action *action, insert_hdr.hdr.sz = hdr->sz; insert_hdr.hdr.data = header; action->ipv6_route_ext.action[0 ] = -mlx5dr_action_create_insert_header (action->ctx,1 , &insert_hdr, - bulk_size, action->flags); +mlx5dr_action_create_insert_header_reparse (action->ctx,1 , &insert_hdr, + bulk_size, action->flags, +MLX5DR_ACTION_STC_REPARSE_OFF ); action->ipv6_route_ext.action[1 ] =mlx5dr_action_create_push_ipv6_route_ext_mhdr1 (action); action->ipv6_route_ext.action[2] =
@@ -2431,12 +2476,6 @@ mlx5dr_action_create_reformat_ipv6_ext(struct mlx5dr_context *ctx,struct mlx5dr_action *action;int ret; -if (mlx5dr_context_cap_dynamic_reparse (ctx)) { -DR_LOG (ERR ,"IPv6 extension actions is not supported" ); - rte_errno =ENOTSUP ; -return NULL ; - } -if (!mlx5dr_action_is_hws_flags (flags) || ((flags &MLX5DR_ACTION_FLAG_SHARED ) && log_bulk_size)) {DR_LOG (ERR ,"IPv6 extension flags don't fit HWS (flags: 0x%x)" , flags);
@@ -2461,6 +2500,12 @@ mlx5dr_action_create_reformat_ipv6_ext(struct mlx5dr_context *ctx, ret =mlx5dr_action_create_pop_ipv6_route_ext (action);break ;case MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT : +if (!mlx5dr_context_cap_dynamic_reparse (ctx)) { +DR_LOG (ERR ,"IPv6 routing extension push actions is not supported" ); + rte_errno =ENOTSUP ; + goto free_action; + } + ret =mlx5dr_action_create_push_ipv6_route_ext (action, hdr, log_bulk_size);break ;default :
drivers/net/mlx5/hws/mlx5dr_action.h +7 -0
@@ -62,6 +62,12 @@ enum mlx5dr_action_setter_flag { ASF_HIT = 1 << 7, }; +enum mlx5dr_action_stc_reparse { +MLX5DR_ACTION_STC_REPARSE_DEFAULT , +MLX5DR_ACTION_STC_REPARSE_ON , +MLX5DR_ACTION_STC_REPARSE_OFF , +}; +struct mlx5dr_action_default_stc {struct mlx5dr_pool_chunk nop_ctr;struct mlx5dr_pool_chunk nop_dw5;
@@ -141,6 +147,7 @@ struct mlx5dr_action {uint8_t anchor;uint8_t offset;bool encap; +uint8_t require_reparse; } reformat;struct {struct mlx5dr_action
Signature · 1 line
2.27.0
RE: [PATCH v4 00/13] support IPv6 push remove action
In reply to Rongwei LiuHi,
Quoted 58 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Wednesday, November 1, 2023 6:44 AM
To: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Subject: [PATCH v4 00/13] support IPv6 push remove actionSupport IPv6 extension push/remove actions in MLX5 PMD. Routing extension is the only supported type.
v4: add more dependancies.
v3: rebase.
v2: add reparse control and rebase.Alex Vesker (4):
net/mlx5/hws: allow jump to TIR over FDBnet/mlx5/hws: support dynamic re-parsenet/mlx5/hws: dynamic re-parse for modify headernet/mlx5/hws: fix incorrect re-parse on complex rulesHamdan Igbaria (2):
net/mlx5/hws: support insert header action
net/mlx5/hws: support remove header actionRongwei Liu (7):
net/mlx5: sample the srv6 last segmentnet/mlx5/hws: fix potential wrongrte_errnovaluenet/mlx5/hws: add IPv6 routing extension push remove actionsnet/mlx5/hws: add setter for IPv6 routing push remove net/mlx5: implement IPv6 routing push removenet/mlx5/hws: fix srv6 push compilation failurenet/mlx5/hws: add stc reparse support for srv6 push popdoc/guides/nics/features/mlx5.ini | 2 + doc/guides/nics/mlx5.rst | 11 + doc/guides/rel_notes/release_23_11.rst | 2 + drivers/common/mlx5/mlx5_prm.h | 13 +- drivers/net/mlx5/hws/mlx5dr.h | 105 +++ drivers/net/mlx5/hws/mlx5dr_action.c | 873 +++++++++++++++++++++++-- drivers/net/mlx5/hws/mlx5dr_action.h | 32 +- drivers/net/mlx5/hws/mlx5dr_cmd.c | 11 +- drivers/net/mlx5/hws/mlx5dr_cmd.h | 3 + drivers/net/mlx5/hws/mlx5dr_context.c | 15 + drivers/net/mlx5/hws/mlx5dr_context.h | 9 +- drivers/net/mlx5/hws/mlx5dr_debug.c | 4 + drivers/net/mlx5/hws/mlx5dr_internal.h | 1 + drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 + drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 41 +- drivers/net/mlx5/hws/mlx5dr_pat_arg.h | 2 + drivers/net/mlx5/mlx5.c | 41 +- drivers/net/mlx5/mlx5.h | 7 + drivers/net/mlx5/mlx5_flow.h | 65 +- drivers/net/mlx5/mlx5_flow_hw.c | 283 +++++++- 20 files changed, 1438 insertions(+), 84 deletions(-)
Quoted 2 lines
--
2.27.0
squashed some commits to their fixes,
removed irrelevant content from commit logs, 1aligned all commits to use push/pop instead of push remove.
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
PATCH 5/8 net/mlx5: generate srv6 modify header resource
In reply to Rongwei LiuBoth checksum and IPv6 next_hdr needs to be updated when adding or removing srv6 header into/from IPv6 packets.
1. Add srv6
ste1 (push buffer with next_hdr 0) --> ste2 (IPv6 next_hdr to 0x2b) --> ste3 (load next hop IPv6 address, and srv6 next_hdr restore)
2. Remove srv6
ste1 (set srv6 next_hdr 0 and save original) --> ste2 (load final IPv6 destination, restore srv6 next_hdr) --> ste3 (remove srv6 and copy srv6 next_hdr to ipv6 next_hdr)
Add helpers to generate the 2 modify header resources for add/remove actions.
Remove srv6 should be shared globally and add srv6 can be shared or unique per each flow rules.
--- drivers/net/mlx5/mlx5.h | 29 +++ drivers/net/mlx5/mlx5_flow_dv.c | 386 ++++++++++++++++++++++++++++++++ 2 files changed, 415 insertions(+)
drivers/net/mlx5/mlx5.h +29 -0
@@ -2314,4 +2314,33 @@ void mlx5_flex_parser_clone_free_cb(void *tool_ctx,int mlx5_alloc_srh_flex_parser (struct rte_eth_dev *dev);void mlx5_free_srh_flex_parser (struct rte_eth_dev *dev); + +int +flow_dv_generate_ipv6_routing_pop_mhdr1 (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +struct mlx5_modification_cmd *cmd, +uint32_t cmd_num); + +int +flow_dv_generate_ipv6_routing_pop_mhdr2 (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +struct mlx5_modification_cmd *cmd, +uint32_t cmd_num); + +int +flow_dv_generate_ipv6_routing_push_mhdr1 (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +struct mlx5_modification_cmd *cmd, +uint32_t cmd_num); + +int +flow_dv_generate_ipv6_routing_push_mhdr2 (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +struct mlx5_modification_cmd *cmd, +uint32_t cmd_num,uint8_t *buf); + +int +flow_dv_ipv6_routing_pop_mhdr_cmd (struct rte_eth_dev *dev,uint8_t *mh_data, +uint8_t *anchor_id); +#endif /* RTE_PMD_MLX5_H_ */
drivers/net/mlx5/mlx5_flow_dv.c +386 -0
392 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH 6/8 net/mlx5/hws: add IPv6 routing extension push pop actions
In reply to Rongwei LiuAdd two dr_actions to implement IPv6 routing extension push and pop, the new actions are multiple actions combination instead of new types.
Basically, there are two modify headers plus one reformat action. Action order is the same as encap and decap actions.
--- drivers/common/mlx5/mlx5_prm.h | 1 + drivers/net/mlx5/hws/mlx5dr.h | 41 +++ drivers/net/mlx5/hws/mlx5dr_action.c | 380 ++++++++++++++++++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 5 + drivers/net/mlx5/hws/mlx5dr_debug.c | 2 + 5 files changed, 428 insertions(+), 1 deletion(-)
drivers/common/mlx5/mlx5_prm.h +1 -0
@@ -3438,6 +3438,7 @@ enum mlx5_ifc_header_anchors {MLX5_HEADER_ANCHOR_PACKET_START =0x0 ,MLX5_HEADER_ANCHOR_FIRST_VLAN_START =0x2 ,MLX5_HEADER_ANCHOR_IPV6_IPV4 =0x07 , +MLX5_HEADER_ANCHOR_TCP_UDP =0x09 ,MLX5_HEADER_ANCHOR_INNER_MAC =0x13 , MLX5_HEADER_ANCHOR_INNER_IPV6_IPV4 = 0x19, };
drivers/net/mlx5/hws/mlx5dr.h +41 -0
57 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.c +379 -1
455 lines not on this page · raw message
drivers/net/mlx5/hws/mlx5dr_action.h +5 -0
@@ -130,6 +130,11 @@ struct mlx5dr_action {struct mlx5dr_devx_obj *arg_obj;uint32_t header_size; } reformat; +struct { +struct mlx5dr_action *action1; +struct mlx5dr_action *action2; +struct mlx5dr_action *action3; + } recom;struct {struct mlx5dr_devx_obj *devx_obj;uint8_t return_reg_id;
drivers/net/mlx5/hws/mlx5dr_debug.c +2 -0
@@ -22,6 +22,8 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_PUSH_VLAN] = "PUSH_VLAN", [MLX5DR_ACTION_TYP_ASO_METER] = "ASO_METER", [MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT", + [MLX5DR_ACTION_TYP_IPV6_ROUTING_POP] = "POP_IPV6_ROUTING", + [MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH ] ="PUSH_IPV6_ROUTING" , }; static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
Signature · 1 line
2.27.0
PATCH 7/8 net/mlx5/hws: add setter for IPv6 routing push pop
In reply to Rongwei LiuThe rte action will be translated to 3 dr_actions which need 3 setters to program them.
For each setter, it may have different reparsing properties. Setter which requires no reparse can't share the same one with the one has reparse enabled even if there is spare space.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 144 +++++++++++++++++++++++++++ 1 file changed, 144 insertions(+)
drivers/net/mlx5/hws/mlx5dr_action.c +144 -0
@@ -2318,6 +2318,57 @@ mlx5dr_action_setter_modify_header(struct mlx5dr_actions_apply_data *apply, } } +static void +mlx5dr_action_setter_ipv6_routing_pop1 (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action; +struct mlx5dr_action *action; + + rule_action = &apply->rule_action[setter->idx_double]; + action = rule_action->action; +MLX5_ASSERT (action->type ==MLX5DR_ACTION_TYP_IPV6_ROUTING_POP ); + rule_action->action = action->recom.action1; +MLX5_ASSERT (rule_action->action->flags &MLX5DR_ACTION_FLAG_SHARED ); +MLX5_ASSERT (rule_action->action->type ==MLX5DR_ACTION_TYP_MODIFY_HDR ); +mlx5dr_action_setter_modify_header (apply, setter); + rule_action->action = action; +} + +static void +mlx5dr_action_setter_ipv6_routing_pop2 (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action; +struct mlx5dr_action *action; + + rule_action = &apply->rule_action[setter->idx_double]; + action = rule_action->action; +MLX5_ASSERT (action->type ==MLX5DR_ACTION_TYP_IPV6_ROUTING_POP ); + rule_action->action = action->recom.action2; +MLX5_ASSERT (rule_action->action->flags &MLX5DR_ACTION_FLAG_SHARED ); +MLX5_ASSERT (rule_action->action->type ==MLX5DR_ACTION_TYP_MODIFY_HDR ); +mlx5dr_action_setter_modify_header (apply, setter); + rule_action->action = action; +} + +static void +mlx5dr_action_setter_ipv6_routing_pop3 (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action; +struct mlx5dr_action *action; + + rule_action = &apply->rule_action[setter->idx_double]; + action = rule_action->action; +MLX5_ASSERT (action->type ==MLX5DR_ACTION_TYP_IPV6_ROUTING_POP ); + rule_action->action = action->recom.action3; +MLX5_ASSERT (rule_action->action->flags &MLX5DR_ACTION_FLAG_SHARED ); +MLX5_ASSERT (rule_action->action->type ==MLX5DR_ACTION_TYP_IPV6_ROUTING_POP ); +mlx5dr_action_setter_modify_header (apply, setter); + rule_action->action = action; +} +static void mlx5dr_action_setter_insert_ptr (struct mlx5dr_actions_apply_data *apply,struct mlx5dr_actions_wqe_setter *setter)
@@ -2346,6 +2397,60 @@ mlx5dr_action_setter_insert_ptr(struct mlx5dr_actions_apply_data *apply, } } +static void +mlx5dr_action_setter_ipv6_routing_push1 (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action; +struct mlx5dr_rule_action tmp; + + rule_action = &apply->rule_action[setter->idx_double]; + tmp = *rule_action; +MLX5_ASSERT (rule_action->action->type ==MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH ); + rule_action->action = tmp.action->recom.action1; +MLX5_ASSERT (rule_action->action->type ==MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH ); + rule_action->reformat.offset = tmp.recom.offset; + rule_action->reformat.data = tmp.recom.data; +mlx5dr_action_setter_insert_ptr (apply, setter); + *rule_action = tmp; +} + +static void +mlx5dr_action_setter_ipv6_routing_push2 (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action; +struct mlx5dr_action *action; + + rule_action = &apply->rule_action[setter->idx_double]; + action = rule_action->action; +MLX5_ASSERT (action->type ==MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH ); + rule_action->action = action->recom.action2; +MLX5_ASSERT (rule_action->action->flags &MLX5DR_ACTION_FLAG_SHARED ); +MLX5_ASSERT (rule_action->action->type ==MLX5DR_ACTION_TYP_MODIFY_HDR ); +mlx5dr_action_setter_modify_header (apply, setter); + rule_action->action = action; +} + +static void +mlx5dr_action_setter_ipv6_routing_push3 (struct mlx5dr_actions_apply_data *apply, +struct mlx5dr_actions_wqe_setter *setter) +{ +struct mlx5dr_rule_action *rule_action; +struct mlx5dr_rule_action tmp; + + rule_action = &apply->rule_action[setter->idx_double]; + tmp = *rule_action; +MLX5_ASSERT (rule_action->action->type ==MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH ); + rule_action->action = tmp.action->recom.action3; +MLX5_ASSERT (rule_action->action->type ==MLX5DR_ACTION_TYP_MODIFY_HDR ); + rule_action->modify_header.offset = tmp.recom.offset; + rule_action->modify_header.data = tmp.recom.mhdr; +MLX5_ASSERT (rule_action->action->modify_header.num_of_actions >1 ); +mlx5dr_action_setter_modify_header (apply, setter); + *rule_action = tmp; +} +static void mlx5dr_action_setter_tnl_l3_to_l2 (struct mlx5dr_actions_apply_data *apply,struct mlx5dr_actions_wqe_setter *setter)
@@ -2553,6 +2658,45 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_double = i;break ; +case MLX5DR_ACTION_TYP_IPV6_ROUTING_POP : +/* Double internal modify header list */ + setter =mlx5dr_action_setter_find_first (last_setter, +ASF_DOUBLE |ASF_REMOVE ); + setter->flags |=ASF_DOUBLE |ASF_MODIFY |ASF_REPARSE ; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop1; + setter->idx_double = i; + setter++; + setter->flags |=ASF_DOUBLE |ASF_MODIFY |ASF_REPARSE ; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop2; + setter->idx_double = i; + setter++; +/* restore IPv6 protocol + pop via modify list. */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY |ASF_REPARSE ; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop3; + setter->idx_double = i; +break ; + +case MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH : +/* Double insert header with pointer */ + setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE ); +/* Can't squeeze with reparsing setter */ +if (setter->flags &ASF_REPARSE ) + setter++; + setter->flags |=ASF_DOUBLE ; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_push1; + setter->idx_double = i; + setter++; +/* Set IPv6 protocol to 0x2b */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY |ASF_REPARSE ; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_push2; + setter->idx_double = i; + setter++; +/* Load next hop IPv6 address and restore srv6.next_hdr */ + setter->flags |=ASF_DOUBLE |ASF_MODIFY |ASF_REPARSE ; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_push3; + setter->idx_double = i; +break ; +case MLX5DR_ACTION_TYP_MODIFY_HDR :/* Double modify header list */ setter =mlx5dr_action_setter_find_first (last_setter,ASF_DOUBLE |ASF_REMOVE );
Signature · 1 line
2.27.0
PATCH 8/8 net/mlx5: implement IPv6 routing push pop
In reply to Rongwei LiuReserve the push data buffer for each job and the maximum length is set to 128 for now.
Only supports type IPPROTO_ROUTING when translating the rte flow action.
Pop actions must be shared globally and only supports next layer as TCP or UDP.
--- doc/guides/nics/mlx5.rst | 9 +- drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.h | 25 ++- drivers/net/mlx5/mlx5_flow_hw.c | 268 ++++++++++++++++++++++++++++++-- 4 files changed, 291 insertions(+), 12 deletions(-)
doc/guides/nics/mlx5.rst +8 -1
@@ -162,7 +162,7 @@ Features - Sub-Function. - Matching on represented port. - Matching on aggregated affinity. - +- Push or remove IPv6 routing extension. Limitations -----------
@@ -694,6 +694,13 @@ Limitations The flow engine of a process cannot move from active to standby mode if preceding active application rules are still present and vice versa. +- IPv6 routing extension push or remove: + + - Supported only with HW Steering enabled (``dv_flow_en`` = 2). + - Supported in non-zero group (No limits on transfer domain if `fdb_def_rule_en` = 1 which is default). + - Only supports TCP or UDP as next layer. + - IPv6 routing header must be the only present extension. + Statistics ----------
drivers/net/mlx5/mlx5.h +1 -0
@@ -364,6 +364,7 @@ struct mlx5_hw_q_job { };void *user_data;/* Job user data. */ uint8_t *encap_data;/* Encap data. */ +uint8_t *push_data;/* IPv6 routing push data. */ struct mlx5_modification_cmd *mhdr_cmd;struct rte_flow_item *items;union {
drivers/net/mlx5/mlx5_flow.h +23 -2
@@ -311,6 +311,8 @@ enum mlx5_feature_name {#define MLX5_FLOW_ACTION_SEND_TO_KERNEL (1ull << 42)#define MLX5_FLOW_ACTION_INDIRECT_COUNT (1ull << 43)#define MLX5_FLOW_ACTION_INDIRECT_AGE (1ull << 44) +#define MLX5_FLOW_ACTION_IPV6_ROUTING_POP (1ull << 45) +#define MLX5_FLOW_ACTION_IPV6_ROUTING_PUSH (1ull << 46)#define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \ (MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE)
@@ -538,6 +540,7 @@ struct mlx5_flow_dv_matcher {struct mlx5_flow_dv_match_params mask;/**< Matcher mask. */ }; +#define MLX5_PUSH_MAX_LEN 128#define MLX5_ENCAP_MAX_LEN 132/* Encap/decap resource structure. */
@@ -1167,6 +1170,8 @@ struct rte_flow_hw {#pragma GCC diagnostic error "-Wpedantic"#endif +#define MLX5_MHDR_MAX_CMD ((MLX5_MAX_MODIFY_NUM) * 2 + 1) +/* rte flow action translate to DR action struct. */ struct mlx5_action_construct_data {LIST_ENTRY (mlx5_action_construct_data) next;
@@ -1211,6 +1216,12 @@ struct mlx5_action_construct_data {struct {cnt_id_t id; } shared_counter; +struct { +/* IPv6 routing push data len. */ +uint16_t len; +/* Modify header actions to keep valid checksum. */ +struct mlx5_modification_cmd cmd[MLX5_MHDR_MAX_CMD ]; + } recom;struct {uint32_t id; } shared_meter;
@@ -1253,6 +1264,7 @@ struct rte_flow_actions_template {uint16_t *actions_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. */ +uint16_t recom_off;/* Offset of DR IPv6 routing push pop 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. */
@@ -1275,7 +1287,14 @@ struct mlx5_hw_encap_decap_action {uint8_t data[];/* Action data. */ }; -#define MLX5_MHDR_MAX_CMD ((MLX5_MAX_MODIFY_NUM) * 2 + 1) +/* Push pop action struct. */ +struct mlx5_hw_push_pop_action { +struct mlx5dr_action *action;/* Action object. */ +/* Is push_pop action shared across flows in table. */ +uint8_t shared; +size_t data_size;/* Action metadata size. */ +uint8_t data[];/* Action data. */ +};/* Modify field action struct. */ struct mlx5_hw_modify_header_action {
@@ -1304,6 +1323,9 @@ struct mlx5_hw_actions {/* Encap/Decap action. */ struct mlx5_hw_encap_decap_action *encap_decap;uint16_t encap_decap_pos;/* Encap/Decap action position. */ +/* Push/Pop action. */ +struct mlx5_hw_push_pop_action *push_pop; +uint16_t push_pop_pos;/* Push/Pop action position. */ uint32_t mark:1; /* Indicate the mark action. */cnt_id_t cnt_id;/* Counter id. */ uint32_t mtr_id;/* Meter id. */
@@ -1329,7 +1351,6 @@ struct mlx5_flow_group {uint32_t idx;/* Group memory index. */ }; -#define MLX5_HW_TBL_MAX_ITEM_TEMPLATE 2#define MLX5_HW_TBL_MAX_ACTION_TEMPLATE 32
drivers/net/mlx5/mlx5_flow_hw.c +259 -9
431 lines not on this page · raw message
Signature · 1 line
2.27.0