Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlx5: Add RDMA TRANSPORT steering domain #1537

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kernel-headers/rdma/mlx5_user_ioctl_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ enum mlx5_ib_flow_matcher_create_attrs {
MLX5_IB_ATTR_FLOW_MATCHER_MATCH_CRITERIA,
MLX5_IB_ATTR_FLOW_MATCHER_FLOW_FLAGS,
MLX5_IB_ATTR_FLOW_MATCHER_FT_TYPE,
MLX5_IB_ATTR_FLOW_MATCHER_IB_PORT,
};

enum mlx5_ib_flow_matcher_destroy_attrs {
Expand Down
2 changes: 2 additions & 0 deletions kernel-headers/rdma/mlx5_user_ioctl_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ enum mlx5_ib_uapi_flow_table_type {
MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB = 0x2,
MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX = 0x3,
MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX = 0x4,
MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TRANSPORT_RX = 0x5,
MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TRANSPORT_TX = 0x6,
};

enum mlx5_ib_uapi_flow_action_packet_reformat_type {
Expand Down
2 changes: 2 additions & 0 deletions kernel-headers/rdma/rdma_netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ enum rdma_nl_notify_event_type {
RDMA_UNREGISTER_EVENT,
RDMA_NETDEV_ATTACH_EVENT,
RDMA_NETDEV_DETACH_EVENT,
RDMA_RENAME_EVENT,
RDMA_NETDEV_RENAME_EVENT,
};

#endif /* _UAPI_RDMA_NETLINK_H */
9 changes: 9 additions & 0 deletions providers/mlx5/man/mlx5dv_create_flow_matcher.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct mlx5dv_flow_matcher_attr {
struct mlx5dv_flow_match_parameters *match_mask;
uint64_t comp_mask;
enum mlx5dv_flow_table_type ft_type;
uint32_t ib_port;
};
```

Expand Down Expand Up @@ -80,6 +81,7 @@ struct mlx5dv_flow_match_parameters {

*comp_mask*
: MLX5DV_FLOW_MATCHER_MASK_FT_TYPE for *ft_type*
: MLX5DV_FLOW_MATCHER_MASK_IB_PORT for *ib_port*

## *ft_type*
Specified in which flow table type, the matcher will store the flow rules:
Expand All @@ -88,6 +90,13 @@ Specified in which flow table type, the matcher will store the flow rules:
MLX5DV_FLOW_TABLE_TYPE_FDB : Specified this matcher will store FDB rules.
MLX5DV_FLOW_TABLE_TYPE_RDMA_RX: Specified this matcher will store ingress RDMA flow rules.
MLX5DV_FLOW_TABLE_TYPE_RDMA_TX: Specified this matcher will store egress RDMA flow rules.
MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_RX: Specified this matcher will store RDMA transport domain flow rules.
MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_TX: Specified this matcher will store RDMA transport domain flow rules.

## *ib_port*
Specified to which vport attach the matcher, this is valid and required only when creating the steering RDMA transport domain flow table:
MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_RX
MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_TX

# RETURN VALUE

Expand Down
2 changes: 2 additions & 0 deletions providers/mlx5/mlx5_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#define MLX5DV_FLOW_TABLE_TYPE_FDB MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB
#define MLX5DV_FLOW_TABLE_TYPE_RDMA_RX MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX
#define MLX5DV_FLOW_TABLE_TYPE_RDMA_TX MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX
#define MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_RX MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TRANSPORT_RX
#define MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_TX MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TRANSPORT_TX
#define mlx5dv_flow_action_packet_reformat_type mlx5_ib_uapi_flow_action_packet_reformat_type
#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2
#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL
Expand Down
2 changes: 2 additions & 0 deletions providers/mlx5/mlx5dv.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ struct mlx5dv_flow_match_parameters {

enum mlx5dv_flow_matcher_attr_mask {
MLX5DV_FLOW_MATCHER_MASK_FT_TYPE = 1 << 0,
MLX5DV_FLOW_MATCHER_MASK_IB_PORT = 1 << 1,
};

struct mlx5dv_flow_matcher_attr {
Expand All @@ -746,6 +747,7 @@ struct mlx5dv_flow_matcher_attr {
struct mlx5dv_flow_match_parameters *match_mask;
uint64_t comp_mask; /* use mlx5dv_flow_matcher_attr_mask */
enum mlx5dv_flow_table_type ft_type;
uint32_t ib_port;
};

struct mlx5dv_flow_matcher;
Expand Down
21 changes: 20 additions & 1 deletion providers/mlx5/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -5416,7 +5416,8 @@ _mlx5dv_create_flow_matcher(struct ibv_context *context,
int ret;

if (!check_comp_mask(attr->comp_mask,
MLX5DV_FLOW_MATCHER_MASK_FT_TYPE)) {
MLX5DV_FLOW_MATCHER_MASK_FT_TYPE |
MLX5DV_FLOW_MATCHER_MASK_IB_PORT)) {
errno = EOPNOTSUPP;
return NULL;
}
Expand All @@ -5432,6 +5433,20 @@ _mlx5dv_create_flow_matcher(struct ibv_context *context,
goto err;
}

if ((attr->ft_type == MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_RX ||
attr->ft_type == MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_TX) &&
!(attr->comp_mask & MLX5DV_FLOW_MATCHER_MASK_IB_PORT)) {
errno = EINVAL;
goto err;
}

if (attr->comp_mask & MLX5DV_FLOW_MATCHER_MASK_IB_PORT &&
(attr->ft_type != MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_RX &&
attr->ft_type != MLX5DV_FLOW_TABLE_TYPE_RDMA_TRANSPORT_TX)) {
errno = EOPNOTSUPP;
goto err;
}

handle = fill_attr_out_obj(cmd, MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE);
fill_attr_in(cmd, MLX5_IB_ATTR_FLOW_MATCHER_MATCH_MASK,
attr->match_mask->match_buf,
Expand All @@ -5445,6 +5460,10 @@ _mlx5dv_create_flow_matcher(struct ibv_context *context,
if (attr->comp_mask & MLX5DV_FLOW_MATCHER_MASK_FT_TYPE)
fill_attr_const_in(cmd, MLX5_IB_ATTR_FLOW_MATCHER_FT_TYPE,
attr->ft_type);
if (attr->comp_mask & MLX5DV_FLOW_MATCHER_MASK_IB_PORT)
fill_attr_in_uint32(cmd, MLX5_IB_ATTR_FLOW_MATCHER_IB_PORT,
attr->ib_port);

if (attr->flags)
fill_attr_const_in(cmd, MLX5_IB_ATTR_FLOW_MATCHER_FLOW_FLAGS,
attr->flags);
Expand Down