Skip to content

Add ZTE zrdma provider #1611

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

Open
wants to merge 6 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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ add_subdirectory(providers/mthca)
add_subdirectory(providers/ocrdma)
add_subdirectory(providers/qedr)
add_subdirectory(providers/vmw_pvrdma)
add_subdirectory(providers/zrdma)
endif()

add_subdirectory(providers/hfi1verbs)
Expand Down
1 change: 1 addition & 0 deletions debian/ibverbs-providers.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ usr/lib/*/libibverbs/lib*-rdmav*.so
usr/lib/*/libmana.so.*
usr/lib/*/libmlx4.so.*
usr/lib/*/libmlx5.so.*
usr/lib/*/libzrdma.so.*
10 changes: 10 additions & 0 deletions debian/ibverbs-providers.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,13 @@ libmana.so.1 ibverbs-providers #MINVER#
MANA_1.0@MANA_1.0 41
manadv_init_obj@MANA_1.0 41
manadv_set_context_attr@MANA_1.0 41
* Build-Depends-Package: libibverbs-dev
ZRDMA_1.0@ZRDMA_1.0 57
zxdh_get_log_trace_switch@ZRDMA_1.0 57
ZRDMA_1.1@ZRDMA_1.1 57
zxdh_set_log_trace_switch@ZRDMA_1.1 57
zxdh_modify_qp_udp_sport@ZRDMA_1.1 57
zxdh_query_qpc@ZRDMA_1.1 57
zxdh_modify_qpc@ZRDMA_1.1 57
zxdh_reset_qp@ZRDMA_1.1 57

5 changes: 5 additions & 0 deletions debian/libibverbs-dev.install
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ usr/include/infiniband/sa.h
usr/include/infiniband/tm_types.h
usr/include/infiniband/verbs.h
usr/include/infiniband/verbs_api.h
usr/include/infiniband/zxdh_devids.h
usr/include/infiniband/zxdh_dv.h
usr/lib/*/lib*-rdmav*.a
usr/lib/*/libefa.a
usr/lib/*/libefa.so
Expand All @@ -26,12 +28,15 @@ usr/lib/*/libmlx4.a
usr/lib/*/libmlx4.so
usr/lib/*/libmlx5.a
usr/lib/*/libmlx5.so
usr/lib/*/libzrdma.a
usr/lib/*/libzrdma.so
usr/lib/*/pkgconfig/libefa.pc
usr/lib/*/pkgconfig/libhns.pc
usr/lib/*/pkgconfig/libibverbs.pc
usr/lib/*/pkgconfig/libmana.pc
usr/lib/*/pkgconfig/libmlx4.pc
usr/lib/*/pkgconfig/libmlx5.pc
usr/lib/*//pkgconfig/libzrdma.pc
usr/share/man/man3/efadv_*.3
usr/share/man/man3/hnsdv_*.3
usr/share/man/man3/ibv_*
Expand Down
2 changes: 2 additions & 0 deletions debian/libibverbs1.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
usr/lib/*/libibverbs*.so.*
usr/lib/*/libzrdma.so.*
usr/lib/*/libzrdma.a
usr/share/doc/rdma-core/libibverbs.md usr/share/doc/libibverbs1/
4 changes: 4 additions & 0 deletions kernel-headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ publish_internal_headers(rdma
rdma/rvt-abi.h
rdma/siw-abi.h
rdma/vmw_pvrdma-abi.h
rdma/zxdh-abi.h
rdma/zxdh_user_ioctl_cmds.h
rdma/zxdh_user_ioctl_verbs.h
)

publish_internal_headers(rdma/hfi
Expand Down Expand Up @@ -80,6 +83,7 @@ rdma_kernel_provider_abi(
rdma/rdma_user_rxe.h
rdma/siw-abi.h
rdma/vmw_pvrdma-abi.h
rdma/zxdh-abi.h
)

publish_headers(infiniband
Expand Down
1 change: 1 addition & 0 deletions kernel-headers/rdma/ib_user_ioctl_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ enum rdma_driver_id {
RDMA_DRIVER_SIW,
RDMA_DRIVER_ERDMA,
RDMA_DRIVER_MANA,
RDMA_DRIVER_ZXDH,
};

enum ib_uverbs_gid_type {
Expand Down
172 changes: 172 additions & 0 deletions kernel-headers/rdma/zxdh-abi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
/*
* Copyright (c) 2024 ZTE Corporation.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#ifndef ZXDH_ABI_H
#define ZXDH_ABI_H

#include <linux/types.h>

/* user-space whose last ABI ver is 5 */
#define ZXDH_ABI_VER 5
#define ZXDH_CONTEXT_VER_V1 5

enum zxdh_memreg_type {
ZXDH_MEMREG_TYPE_MEM = 0,
ZXDH_MEMREG_TYPE_QP = 1,
ZXDH_MEMREG_TYPE_CQ = 2,
ZXDH_MEMREG_TYPE_SRQ = 3,
};

enum zxdh_db_addr_type {
ZXDH_DB_ADDR_PHY = 0,
ZXDH_DB_ADDR_BAR = 1,
};

struct zxdh_alloc_ucontext_req {
__u32 rsvd32;
__u8 userspace_ver;
__u8 rsvd8[3];
};

struct zxdh_alloc_ucontext_resp {
__u32 max_pds;
__u32 max_qps;
__u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */
__u8 kernel_ver;
__u8 db_addr_type;
__u16 rdma_tool_flags;
__aligned_u64 feature_flags;
__aligned_u64 sq_db_mmap_key;
__aligned_u64 cq_db_mmap_key;
__aligned_u64 sq_db_pa;
__aligned_u64 cq_db_pa;
__u32 max_hw_wq_frags;
__u32 max_hw_read_sges;
__u32 max_hw_inline;
__u32 max_hw_rq_quanta;
__u32 max_hw_srq_quanta;
__u32 max_hw_wq_quanta;
__u32 max_hw_srq_wr;
__u32 min_hw_cq_size;
__u32 max_hw_cq_size;
__u16 max_hw_sq_chunk;
__u8 rsvd;
__u8 chip_rev;
};

struct zxdh_alloc_pd_resp {
__u32 pd_id;
__u8 rsvd[4];
};

struct zxdh_resize_cq_req {
__aligned_u64 user_cq_buffer;
};

struct zxdh_create_cq_req {
__aligned_u64 user_cq_buf;
__aligned_u64 user_shadow_area;
};

struct zxdh_create_qp_req {
__aligned_u64 user_wqe_bufs;
__aligned_u64 user_compl_ctx;
};

struct zxdh_create_srq_req {
__aligned_u64 user_wqe_bufs;
__aligned_u64 user_compl_ctx;
__aligned_u64 user_wqe_list;
__aligned_u64 user_wqe_db;
};

struct zxdh_mem_reg_req {
__u32 reg_type; /* enum zxdh_memreg_type */
__u32 cq_pages;
__u32 rq_pages;
__u32 sq_pages;
__u32 srq_pages;
__u16 srq_list_pages;
__u8 rsvd[2];
};

struct zxdh_reg_mr_resp {
__u32 mr_pa_low;
__u32 mr_pa_hig;
__u16 host_page_size;
__u16 leaf_pbl_size;
__u8 rsvd[4];
};

struct zxdh_modify_qp_req {
__u8 sq_flush;
__u8 rq_flush;
__u8 rsvd[6];
};

struct zxdh_create_cq_resp {
__u32 cq_id;
__u32 cq_size;
};

struct zxdh_create_qp_resp {
__u32 qp_id;
__u32 actual_sq_size;
__u32 actual_rq_size;
__u32 zxdh_drv_opt;
__u16 push_idx;
__u8 lsmm;
__u8 rsvd;
__u32 qp_caps;
};

struct zxdh_create_srq_resp {
__u32 srq_id;
__u32 actual_srq_size;
__u32 actual_srq_list_size;
__u8 rsvd[4];
};

struct zxdh_modify_qp_resp {
__aligned_u64 push_wqe_mmap_key;
__aligned_u64 push_db_mmap_key;
__u16 push_offset;
__u8 push_valid;
__u8 rsvd[5];
};

struct zxdh_create_ah_resp {
__u32 ah_id;
__u8 rsvd[4];
};
#endif /* ZXDH_ABI_H */
87 changes: 87 additions & 0 deletions kernel-headers/rdma/zxdh_user_ioctl_cmds.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
/*
* Copyright (c) 2024 ZTE Corporation.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#ifndef ZXDH_USER_IOCTL_CMDS_H
#define ZXDH_USER_IOCTL_CMDS_H

#include <linux/types.h>
#include <rdma/ib_user_ioctl_cmds.h>

enum zxdh_ib_dev_get_log_trace_attrs {
ZXDH_IB_ATTR_DEV_GET_LOG_TARCE_SWITCH = (1U << UVERBS_ID_NS_SHIFT),
};

enum zxdh_ib_dev_set_log_trace_attrs {
ZXDH_IB_ATTR_DEV_SET_LOG_TARCE_SWITCH = (1U << UVERBS_ID_NS_SHIFT),
};

enum zxdh_ib_dev_methods {
ZXDH_IB_METHOD_DEV_GET_LOG_TRACE = (1U << UVERBS_ID_NS_SHIFT),
ZXDH_IB_METHOD_DEV_SET_LOG_TRACE,
};

enum zxdh_ib_qp_modify_udp_sport_attrs {
ZXDH_IB_ATTR_QP_UDP_PORT = (1U << UVERBS_ID_NS_SHIFT),
ZXDH_IB_ATTR_QP_QPN,
};

enum zxdh_ib_qp_query_qpc_attrs {
ZXDH_IB_ATTR_QP_QUERY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
ZXDH_IB_ATTR_QP_QUERY_RESP,
};

enum zxdh_ib_qp_modify_qpc_attrs {
ZXDH_IB_ATTR_QP_MODIFY_QPC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
ZXDH_IB_ATTR_QP_MODIFY_QPC_REQ,
ZXDH_IB_ATTR_QP_MODIFY_QPC_MASK,
};

enum zxdh_ib_qp_reset_qp_attrs {
ZXDH_IB_ATTR_QP_RESET_QP_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
ZXDH_IB_ATTR_QP_RESET_OP_CODE,
};

enum zxdh_ib_qp_methods {
ZXDH_IB_METHOD_QP_MODIFY_UDP_SPORT = (1U << UVERBS_ID_NS_SHIFT),
ZXDH_IB_METHOD_QP_QUERY_QPC,
ZXDH_IB_METHOD_QP_MODIFY_QPC,
ZXDH_IB_METHOD_QP_RESET_QP,
};

enum zxdh_ib_objects {
ZXDH_IB_OBJECT_DEV = (1U << UVERBS_ID_NS_SHIFT),
ZXDH_IB_OBJECT_QP_OBJ,
ZXDH_IB_OBJECT_DEVICE_EX,
};

#endif
Loading