ConnectX-3 RSS Implementation
Subsystems (2)
cover ConnectX-3 RSS Implementation
Hi Doug,
This patch set adds to ConnectX-3 devices the ability to use RSS feature, which was initially implemented in mlx5-based devices [1].
The backport of RSS feature to ConnectX-3 hardware was a challenge task due to differences in architectures between mlx4 and mlx5 based devices.
It caused to a limited number of usage limitations, mentioned in the relevant commit messages where it applies.
This series supports all RSS related verbs.
Thanks.
Changelog:v0->v1:
* Removed limitation of number of WQs per context which was 128.
* Added unlimited number of ranges of WQs according to provided user data.
[1] https://www.spinics.net/lists/linux-rdma/msg36526.html
---
We based this series on our previous mlx4 submissions to reduce merge conflicts. For your convenience, I prepared the branch with the following merge sequence:
"topic/no-io" -> "topic/mlx4-resource-utilization" -> "topic/mlx4-receive-inline"
Available in the "topic/mlx4-rss-v1" topic branch of this git repo:git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/mlx4-rss-v1
Thanks
Guy Levi (4):
IB/mlx4: Add support for WQ related verbs IB/mlx4: Add support for WQ indirection table related verbs IB/mlx4: Add support for RSS QP
IB/mlx4: Expose RSS capabilities
drivers/infiniband/hw/mlx4/main.c | 35 ++ drivers/infiniband/hw/mlx4/mlx4_ib.h | 39 +- drivers/infiniband/hw/mlx4/qp.c | 994 ++++++++++++++++++++++++++++++++--- include/uapi/rdma/mlx4-abi.h | 51 ++ 4 files changed, 1057 insertions(+), 62 deletions(-)
--
2.13.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170704132427.25937-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
PATCH 1/4 IB/mlx4: Add support for WQ related verbs
From: Guy Levi <guyle-VPRAkNaXOzVWk0Htik3J/[email protected]>
Support create/modify/destroy WQ related verbs.
The base IB object to enable RSS functionality is a WQ (i.e. ib_wq). This patch implements the related WQ verbs as of create, modify and destroy.
In downstream patches the WQ will be used as part of an indirection table (i.e. ib_rwq_ind_table) to enable RSS QP creation.
Notes:
ConnectX-3 hardware requires consecutive WQNs list as receive descriptor queues for the RSS QP. Hence, the driver manages consecutive ranges lists per context which the user must respect.
Destroying the WQ does not return its WQN back to its range for reusing. However, destroying all WQs from the same range releases the range and in turn releases its WQNs for reusing.
Since the WQ object is not a natural object in the hardware, the driver implements the WQ by the hardware QP.
As such, the WQ inherits its port from its RSS QP parent upon its RST->INIT transition and by that time its state is applied to the hardware.
--- drivers/infiniband/hw/mlx4/main.c | 24 ++ drivers/infiniband/hw/mlx4/mlx4_ib.h | 25 +- drivers/infiniband/hw/mlx4/qp.c | 506 +++++++++++++++++++++++++++++++---- include/uapi/rdma/mlx4-abi.h | 14 + 4 files changed, 512 insertions(+), 57 deletions(-)
drivers/infiniband/hw/mlx4/main.c +24 -0
@@ -81,6 +81,8 @@ static const char mlx4_ib_version[] =DRV_VERSION "\n" ;static void do_slave_init (struct mlx4_ib_dev *ibdev,int slave,int do_init); +static enum rdma_link_layer mlx4_ib_port_link_layer (struct ib_device *device, +u8 port_num);static struct workqueue_struct *wq;
@@ -552,6 +554,11 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, props->timestamp_mask =0xFFFFFFFFFFFFULL ; props->max_ah =INT_MAX ; +if ((dev->dev->caps.flags2 &MLX4_DEV_CAP_FLAG2_RSS ) && + (mlx4_ib_port_link_layer (ibdev,1 ) ==IB_LINK_LAYER_ETHERNET || +mlx4_ib_port_link_layer (ibdev,2 ) ==IB_LINK_LAYER_ETHERNET )) + props->max_wq_type_rq = props->max_qp; +if (!mlx4_is_slave (dev->dev)) err =mlx4_get_internal_clock_params (dev->dev, &clock_params);
@@ -1076,6 +1083,9 @@ static struct ib_ucontext *mlx4_ib_alloc_ucontext(struct ib_device *ibdev,INIT_LIST_HEAD (&context->db_page_list);mutex_init (&context->db_page_mutex); +INIT_LIST_HEAD (&context->wqn_ranges_list); +mutex_init (&context->wqn_ranges_mutex); +if (ibdev->uverbs_abi_ver ==MLX4_IB_UVERBS_NO_DEV_CAPS_ABI_VERSION ) err =ib_copy_to_udata (udata, &resp_v3,sizeof (resp_v3));else
@@ -2720,6 +2730,20 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) ibdev->ib_dev.get_dev_fw_str = get_fw_ver_str; ibdev->ib_dev.disassociate_ucontext = mlx4_ib_disassociate_ucontext; +if ((dev->caps.flags2 &MLX4_DEV_CAP_FLAG2_RSS ) && + ((mlx4_ib_port_link_layer (&ibdev->ib_dev,1 ) == +IB_LINK_LAYER_ETHERNET ) || + (mlx4_ib_port_link_layer (&ibdev->ib_dev,2 ) == +IB_LINK_LAYER_ETHERNET ))) { + ibdev->ib_dev.create_wq = mlx4_ib_create_wq; + ibdev->ib_dev.modify_wq = mlx4_ib_modify_wq; + ibdev->ib_dev.destroy_wq = mlx4_ib_destroy_wq; + ibdev->ib_dev.uverbs_ex_cmd_mask |= + (1ull <<IB_USER_VERBS_EX_CMD_CREATE_WQ ) | + (1ull <<IB_USER_VERBS_EX_CMD_MODIFY_WQ ) | + (1ull <<IB_USER_VERBS_EX_CMD_DESTROY_WQ ); + } +if (!mlx4_is_slave (ibdev->dev)) { ibdev->ib_dev.alloc_fmr = mlx4_ib_fmr_alloc; ibdev->ib_dev.map_phys_fmr = mlx4_ib_map_phys_fmr;
drivers/infiniband/hw/mlx4/mlx4_ib.h +24 -1
@@ -88,6 +88,8 @@ struct mlx4_ib_ucontext {struct list_head db_page_list;struct mutex db_page_mutex;struct mlx4_ib_vma_private_data hw_bar_info[HW_BAR_COUNT ]; +struct list_head wqn_ranges_list; +struct mutex wqn_ranges_mutex;/* protect wqn_ranges_list */ };struct mlx4_ib_pd {
@@ -289,8 +291,19 @@ struct mlx4_roce_smac_vlan_info {int update_vid; }; +struct mlx4_wqn_range { +int base_wqn; +int size; +int refcount; +bool dirty; +struct list_head list; +}; +struct mlx4_ib_qp { -struct ib_qp ibqp; +union { +struct ib_qp ibqp; +struct ib_wq ibwq; + };struct mlx4_qp mqp;struct mlx4_buf buf;
@@ -329,6 +342,9 @@ struct mlx4_ib_qp {struct list_head cq_recv_list;struct list_head cq_send_list;struct counter_index *counter_index; +struct mlx4_wqn_range *wqn_range; +/* Number of RSS QP parents that uses this WQ */ +u32 rss_usecnt; };struct mlx4_ib_srq {
@@ -893,4 +909,11 @@ void mlx4_sched_ib_sl2vl_update_work(struct mlx4_ib_dev *ibdev,void mlx4_ib_sl2vl_update (struct mlx4_ib_dev *mdev,int port); +struct ib_wq *mlx4_ib_create_wq (struct ib_pd *pd, +struct ib_wq_init_attr *init_attr, +struct ib_udata *udata); +int mlx4_ib_destroy_wq (struct ib_wq *wq); +int mlx4_ib_modify_wq (struct ib_wq *wq,struct ib_wq_attr *wq_attr, +u32 wq_attr_mask,struct ib_udata *udata); +#endif /* MLX4_IB_H */
drivers/infiniband/hw/mlx4/qp.c +450 -56
751 lines not on this page · raw message
include/uapi/rdma/mlx4-abi.h +14 -0
@@ -105,4 +105,18 @@ struct mlx4_ib_create_qp { __u8 reserved; }; +struct mlx4_ib_create_wq { +__u64 buf_addr; +__u64 db_addr; +__u8 log_range_size; +__u8 reserved[3 ]; +__u32 comp_mask; +__u32 reserved1; +}; + +struct mlx4_ib_modify_wq { +__u32 comp_mask; +__u32 reserved; +}; +#endif /* MLX4_ABI_USER_H */
Signature · 6 lines
2.13.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/4 IB/mlx4: Add support for WQ indirection table related verbs
In reply to a message not in the archiveFrom: Guy Levi <guyle-VPRAkNaXOzVWk0Htik3J/[email protected]>
To enable RSS functionality the IB indirection table object (i.e. ib_rwq_ind_table) should be used.
This patch implements the related verbs as of create and destroy an indirection table.
In downstream patches the indirection table will be used as part of RSS QP creation.
--- drivers/infiniband/hw/mlx4/main.c | 12 +++++-- drivers/infiniband/hw/mlx4/mlx4_ib.h | 6 ++++ drivers/infiniband/hw/mlx4/qp.c | 69 ++++++++++++++++++++++++++++++++++++ include/uapi/rdma/mlx4-abi.h | 4 +++ 4 files changed, 88 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx4/main.c +9 -3
@@ -2738,10 +2738,16 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) ibdev->ib_dev.create_wq = mlx4_ib_create_wq; ibdev->ib_dev.modify_wq = mlx4_ib_modify_wq; ibdev->ib_dev.destroy_wq = mlx4_ib_destroy_wq; + ibdev->ib_dev.create_rwq_ind_table = + mlx4_ib_create_rwq_ind_table; + ibdev->ib_dev.destroy_rwq_ind_table = + mlx4_ib_destroy_rwq_ind_table; ibdev->ib_dev.uverbs_ex_cmd_mask |= - (1ull <<IB_USER_VERBS_EX_CMD_CREATE_WQ ) | - (1ull <<IB_USER_VERBS_EX_CMD_MODIFY_WQ ) | - (1ull <<IB_USER_VERBS_EX_CMD_DESTROY_WQ ); + (1ull <<IB_USER_VERBS_EX_CMD_CREATE_WQ ) | + (1ull <<IB_USER_VERBS_EX_CMD_MODIFY_WQ ) | + (1ull <<IB_USER_VERBS_EX_CMD_DESTROY_WQ ) | + (1ull <<IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL ) | + (1ull <<IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL ); }if (!mlx4_is_slave (ibdev->dev)) {
drivers/infiniband/hw/mlx4/mlx4_ib.h +6 -0
@@ -916,4 +916,10 @@ int mlx4_ib_destroy_wq(struct ib_wq *wq);int mlx4_ib_modify_wq (struct ib_wq *wq,struct ib_wq_attr *wq_attr,u32 wq_attr_mask,struct ib_udata *udata); +struct ib_rwq_ind_table +*mlx4_ib_create_rwq_ind_table (struct ib_device *device, +struct ib_rwq_ind_table_init_attr *init_attr, +struct ib_udata *udata); +int mlx4_ib_destroy_rwq_ind_table (struct ib_rwq_ind_table *wq_ind_table); +#endif /* MLX4_IB_H */
drivers/infiniband/hw/mlx4/qp.c +69 -0
72 lines not on this page · raw message
include/uapi/rdma/mlx4-abi.h +4 -0
@@ -119,4 +119,8 @@ struct mlx4_ib_modify_wq { __u32 reserved; }; +struct mlx4_ib_create_rwq_ind_tbl_resp { +__u32 response_length; +__u32 reserved; +};#endif /* MLX4_ABI_USER_H */
Signature · 6 lines
2.13.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/4 IB/mlx4: Add support for RSS QP
In reply to a message not in the archiveFrom: Guy Levi <guyle-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add support to work with a RSS QP by using an indirection table object upon QP creation. Other related QP verbs (e.g. modify/destroy/query) were updated as well for that QP mode.
Notes:
- The RX hash properties are supplied as driver private data.
- The RSS QP port is used on the associated WQs in its indirection table. Applying different ports during WQ life time is not allowed.
- The expected RSS QP flow is: create, modify(RST->INIT), modify(RST->RTR), destroy.
--- drivers/infiniband/hw/mlx4/mlx4_ib.h | 8 + drivers/infiniband/hw/mlx4/qp.c | 453 +++++++++++++++++++++++++++++++++-- include/uapi/rdma/mlx4-abi.h | 33 +++ 3 files changed, 472 insertions(+), 22 deletions(-)
drivers/infiniband/hw/mlx4/mlx4_ib.h +8 -0
@@ -46,6 +46,7 @@#include <linux/mlx4/device.h> #include <linux/mlx4/doorbell.h> +#include <linux/mlx4/qp.h> #define MLX4_IB_DRV_NAME "mlx4_ib"
@@ -299,6 +300,12 @@ struct mlx4_wqn_range {struct list_head list; }; +struct mlx4_ib_rss { +unsigned int base_qpn_tbl_sz; +u8 flags; +u8 rss_key[MLX4_EN_RSS_KEY_SIZE ]; +}; + struct mlx4_ib_qp { union { struct ib_qp ibqp;
@@ -345,6 +352,7 @@ struct mlx4_ib_qp {struct mlx4_wqn_range *wqn_range;/* Number of RSS QP parents that uses this WQ */ u32 rss_usecnt; +struct mlx4_ib_rss *rss_ctx; };struct mlx4_ib_srq {
drivers/infiniband/hw/mlx4/qp.c +431 -22
567 lines not on this page · raw message
include/uapi/rdma/mlx4-abi.h +33 -0
@@ -95,6 +95,16 @@ struct mlx4_ib_create_srq_resp {__u32 reserved; }; +struct mlx4_ib_create_qp_rss { +__u64 rx_hash_fields_mask; +__u8 rx_hash_function; +__u8 rx_key_len; +__u8 reserved[6 ]; +__u8 rx_hash_key[40 ]; +__u32 comp_mask; +__u32 reserved1; +}; +struct mlx4_ib_create_qp {__u64 buf_addr;__u64 db_addr;
@@ -123,4 +133,27 @@ struct mlx4_ib_create_rwq_ind_tbl_resp {__u32 response_length; __u32 reserved; }; + +/* RX Hash function flags */ +enum mlx4_ib_rx_hash_function_flags { +MLX4_IB_RX_HASH_FUNC_TOEPLITZ =1 <<0 , +}; + +/* +* RX Hash flags, these flags allows to set which incoming packet's field should +* participates in RX Hash. Each flag represent certain packet's field, +* when the flag is set the field that is represented by the flag will +* participate in RX Hash calculation. +*/ +enum mlx4_ib_rx_hash_fields { +MLX4_IB_RX_HASH_SRC_IPV4 =1 <<0 , +MLX4_IB_RX_HASH_DST_IPV4 =1 <<1 , +MLX4_IB_RX_HASH_SRC_IPV6 =1 <<2 , +MLX4_IB_RX_HASH_DST_IPV6 =1 <<3 , +MLX4_IB_RX_HASH_SRC_PORT_TCP =1 <<4 , +MLX4_IB_RX_HASH_DST_PORT_TCP =1 <<5 , +MLX4_IB_RX_HASH_SRC_PORT_UDP =1 <<6 , +MLX4_IB_RX_HASH_DST_PORT_UDP =1 <<7 +}; +#endif /* MLX4_ABI_USER_H */
Signature · 6 lines
2.13.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/4 IB/mlx4: Expose RSS capabilities
In reply to a message not in the archiveFrom: Guy Levi <guyle-VPRAkNaXOzVWk0Htik3J/[email protected]>
As a final step to support RSS feature, expose the RSS capabilities in query device verb.
It includes:
- Max rwq indirection tables.
- Max rwq indirection table size.
- Supported qp types.
--- drivers/infiniband/hw/mlx4/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/main.c +6 -1
@@ -556,8 +556,13 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,if ((dev->dev->caps.flags2 &MLX4_DEV_CAP_FLAG2_RSS ) && (mlx4_ib_port_link_layer (ibdev,1 ) ==IB_LINK_LAYER_ETHERNET || -mlx4_ib_port_link_layer (ibdev,2 ) ==IB_LINK_LAYER_ETHERNET )) +mlx4_ib_port_link_layer (ibdev,2 ) ==IB_LINK_LAYER_ETHERNET )) { + props->rss_caps.max_rwq_indirection_tables = props->max_qp; + props->rss_caps.max_rwq_indirection_table_size = + dev->dev->caps.max_rss_tbl_sz; + props->rss_caps.supported_qpts =1 <<IB_QPT_RAW_PACKET ; props->max_wq_type_rq = props->max_qp; + }if (!mlx4_is_slave (dev->dev)) err =mlx4_get_internal_clock_params (dev->dev, &clock_params);
Signature · 6 lines
2.13.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Leon Romanovsky
Hi Doug,
This patch set adds to ConnectX-3 devices the ability to use RSS feature, which was initially implemented in mlx5-based devices [1].
The backport of RSS feature to ConnectX-3 hardware was a challenge task due to differences in architectures between mlx4 and mlx5 based devices.
Quoted 7 lines
It caused to a limited number of usage limitations, mentioned in the relevant
commit messages where it applies.This series supports all RSS related verbs.
Thanks.
Thanks, series applied.
Signature · 8 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html