Skip to content

Commit

Permalink
net/mlx5: support IPv6 routing extension push/remove
Browse files Browse the repository at this point in the history
Reserve 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.

Signed-off-by: Rongwei Liu <[email protected]>
Acked-by: Ori Kam <[email protected]>
  • Loading branch information
lrw514 authored and raslandarawsheh committed Nov 2, 2023
1 parent aa49c8c commit 1be65c3
Show file tree
Hide file tree
Showing 6 changed files with 310 additions and 9 deletions.
2 changes: 2 additions & 0 deletions doc/guides/nics/features/mlx5.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions doc/guides/nics/mlx5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Features
- Matching on ESP header SPI field.
- Matching on InfiniBand BTH.
- Modify IPv4/IPv6 ECN field.
- Push or remove IPv6 routing extension.
- RSS support in sample action.
- E-Switch mirroring and jump.
- E-Switch mirroring and modify.
Expand Down Expand Up @@ -605,6 +606,15 @@ Limitations

Only supports HW steering (``dv_flow_en=2``).

- IPv6 routing extension push/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.

- Hairpin:

- Hairpin between two ports could only manual binding and explicit Tx flow mode. For single port hairpin, all the combinations of auto/manual binding and explicit/implicit Tx flow mode could be supported.
Expand Down
2 changes: 2 additions & 0 deletions doc/guides/rel_notes/release_23_11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ New Features
* Added support for multi-port E-Switch.
* Added support for Network Service Header (NSH) flow matching.
* Added support for ``RTE_FLOW_ITEM_TYPE_PTYPE`` flow item.
* Added support for ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH`` flow action.
* Added support for ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE`` flow action.
* Added support for ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR`` flow action and mirror.
* Added support for ``RTE_FLOW_ACTION_TYPE_INDIRECT_LIST`` flow action.

Expand Down
1 change: 1 addition & 0 deletions drivers/net/mlx5/mlx5.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,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 {
Expand Down
21 changes: 20 additions & 1 deletion drivers/net/mlx5/mlx5_flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
};
Expand All @@ -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 {
Expand Down Expand Up @@ -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. */
Expand Down
Loading

0 comments on commit 1be65c3

Please sign in to comment.