Skip to content

Commit cd7ca62

Browse files
committed
libzrdma: Add support for query interface and some other optimization
Thia patch add the following verbs: query_device_ex query_port attach_mcast detach_mcast This patch also add the following function: add support for new vendor id and device id add support for private verbs interface use ZXDH_DEBUG_MASK to control debug level log use ZXDH_WRITE_IMM_SPILIT_RNABLE to fix write with immediate bug on-behalf-of: @ZTE [email protected] Signed-off-by: zte_lifuyan <[email protected]>
1 parent 5f0aba2 commit cd7ca62

File tree

9 files changed

+159
-320
lines changed

9 files changed

+159
-320
lines changed

kernel-headers/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ publish_internal_headers(rdma
2727
rdma/siw-abi.h
2828
rdma/vmw_pvrdma-abi.h
2929
rdma/zxdh-abi.h
30+
rdma/zxdh_user_ioctl_cmds.h
3031
rdma/zxdh_user_ioctl_verbs.h
3132
)
3233

providers/zrdma/libzrdma.map

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
/* Export symbols should be added below according to
22
Documentation/versioning.md document. */
33
ZRDMA_1.0 {
4+
global:
5+
zxdh_get_log_trace_switch;
46
local: *;
57
};
8+
9+
ZRDMA_1.1 {
10+
global:
11+
zxdh_set_log_trace_switch;
12+
zxdh_modify_qp_udp_sport;
13+
zxdh_query_qpc;
14+
zxdh_modify_qpc;
15+
zxdh_reset_qp;
16+
} ZRDMA_1.0;

providers/zrdma/private_verbs_cmd.c

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,92 @@ static int _zxdh_query_qpc(struct ibv_qp *qp, struct zxdh_rdma_qpc *qpc)
7676
return 0;
7777
}
7878

79+
static void copy_modify_qpc_fields(struct zxdh_modify_qpc_req *req_cmd,
80+
uint64_t attr_mask,
81+
struct zxdh_rdma_qpc *qpc)
82+
{
83+
if (attr_mask & ZXDH_TX_READ_RETRY_FLAG_SET) {
84+
req_cmd->retry_flag = qpc->retry_flag;
85+
req_cmd->rnr_retry_flag = qpc->rnr_retry_flag;
86+
req_cmd->read_retry_flag = qpc->read_retry_flag;
87+
req_cmd->cur_retry_count = qpc->cur_retry_count;
88+
}
89+
if (attr_mask & ZXDH_RETRY_CQE_SQ_OPCODE)
90+
req_cmd->retry_cqe_sq_opcode = qpc->retry_cqe_sq_opcode;
91+
92+
if (attr_mask & ZXDH_ERR_FLAG_SET) {
93+
req_cmd->err_flag = qpc->err_flag;
94+
req_cmd->ack_err_flag = qpc->ack_err_flag;
95+
}
96+
if (attr_mask & ZXDH_PACKAGE_ERR_FLAG)
97+
req_cmd->package_err_flag = qpc->package_err_flag;
98+
}
99+
100+
static int _zxdh_reset_qp(struct ibv_qp *qp, uint64_t opcode)
101+
{
102+
DECLARE_COMMAND_BUFFER(cmd, ZXDH_IB_OBJECT_QP_OBJ,
103+
ZXDH_IB_METHOD_QP_RESET_QP, 2);
104+
fill_attr_in_obj(cmd, ZXDH_IB_ATTR_QP_RESET_QP_HANDLE, qp->handle);
105+
fill_attr_in_uint64(cmd, ZXDH_IB_ATTR_QP_RESET_OP_CODE, opcode);
106+
return execute_ioctl(qp->context, cmd);
107+
}
108+
109+
static int _zxdh_modify_qpc(struct ibv_qp *qp, struct zxdh_rdma_qpc *qpc,
110+
uint64_t qpc_mask)
111+
{
112+
DECLARE_COMMAND_BUFFER(cmd, ZXDH_IB_OBJECT_QP_OBJ,
113+
ZXDH_IB_METHOD_QP_MODIFY_QPC, 3);
114+
struct zxdh_modify_qpc_req req = { 0 };
115+
116+
copy_modify_qpc_fields(&req, qpc_mask, qpc);
117+
fill_attr_in_obj(cmd, ZXDH_IB_ATTR_QP_QUERY_HANDLE, qp->handle);
118+
fill_attr_in_uint64(cmd, ZXDH_IB_ATTR_QP_MODIFY_QPC_MASK, qpc_mask);
119+
fill_attr_in_ptr(cmd, ZXDH_IB_ATTR_QP_MODIFY_QPC_REQ, &req);
120+
return execute_ioctl(qp->context, cmd);
121+
}
122+
123+
static int _zxdh_modify_qp_udp_sport(struct ibv_context *ibctx,
124+
uint16_t udp_sport, uint32_t qpn)
125+
{
126+
if (udp_sport <= MIN_UDP_SPORT || qpn <= MIN_QP_QPN)
127+
return -EINVAL;
128+
129+
DECLARE_COMMAND_BUFFER(cmd, ZXDH_IB_OBJECT_QP_OBJ,
130+
ZXDH_IB_METHOD_QP_MODIFY_UDP_SPORT, 2);
131+
fill_attr_in(cmd, ZXDH_IB_ATTR_QP_UDP_PORT, &udp_sport,
132+
sizeof(udp_sport));
133+
fill_attr_in_uint32(cmd, ZXDH_IB_ATTR_QP_QPN, qpn);
134+
return execute_ioctl(ibctx, cmd);
135+
}
136+
137+
static int _zxdh_get_log_trace_switch(struct ibv_context *ibctx,
138+
uint8_t *switch_status)
139+
{
140+
DECLARE_COMMAND_BUFFER(cmd, ZXDH_IB_OBJECT_DEV,
141+
ZXDH_IB_METHOD_DEV_GET_LOG_TRACE, 1);
142+
143+
fill_attr_out_ptr(cmd, ZXDH_IB_ATTR_DEV_GET_LOG_TARCE_SWITCH,
144+
switch_status);
145+
return execute_ioctl(ibctx, cmd);
146+
}
147+
148+
static int _zxdh_set_log_trace_switch(struct ibv_context *ibctx,
149+
uint8_t switch_status)
150+
{
151+
DECLARE_COMMAND_BUFFER(cmd, ZXDH_IB_OBJECT_DEV,
152+
ZXDH_IB_METHOD_DEV_SET_LOG_TRACE, 1);
153+
fill_attr_in(cmd, ZXDH_IB_ATTR_DEV_SET_LOG_TARCE_SWITCH, &switch_status,
154+
sizeof(switch_status));
155+
return execute_ioctl(ibctx, cmd);
156+
}
157+
79158
static struct zxdh_uvcontext_ops zxdh_ctx_ops = {
159+
.modify_qp_udp_sport = _zxdh_modify_qp_udp_sport,
160+
.get_log_trace_switch = _zxdh_get_log_trace_switch,
161+
.set_log_trace_switch = _zxdh_set_log_trace_switch,
80162
.query_qpc = _zxdh_query_qpc,
163+
.modify_qpc = _zxdh_modify_qpc,
164+
.reset_qp = _zxdh_reset_qp,
81165
};
82166

83167
static inline struct zxdh_uvcontext *to_zxdhtx(struct ibv_context *ibctx)

providers/zrdma/private_verbs_cmd.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@
3535
#include "zxdh_zrdma.h"
3636
#include "zxdh_dv.h"
3737

38-
enum zxdh_rdma_tool_flags {
39-
ZXDH_QP_EXTEND_OP = 1 << 0,
40-
ZXDH_CAPTURE = 1 << 1,
41-
ZXDH_GET_HW_DATA = 1 << 2,
42-
ZXDH_GET_HW_OBJECT_DATA = 1 << 3,
43-
ZXDH_CHECK_HW_HEALTH = 1 << 4,
44-
ZXDH_RDMA_TOOL_CFG_DEV_PARAM = 1 << 5,
45-
ZXDH_RDMA_TOOL_SHOW_RES_MAP = 1 << 5,
46-
};
47-
4838
struct zxdh_uvcontext_ops {
4939
int (*modify_qp_udp_sport)(struct ibv_context *ibctx,
5040
uint16_t udp_sport, uint32_t qpn);

providers/zrdma/zxdh_devids.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@
3535
/* ZXDH VENDOR ID */
3636
#define PCI_VENDOR_ID_ZXDH_EVB 0x16c3
3737
#define PCI_VENDOR_ID_ZXDH_E312 0x1cf2
38+
#define PCI_VENDOR_ID_ZXDH_E312S_D 0x1cf2
3839
#define PCI_VENDOR_ID_ZXDH_E310 0x1cf2
3940
#define PCI_VENDOR_ID_ZXDH_E310_RDMA 0x1cf2
4041
#define PCI_VENDOR_ID_ZXDH_E316 0x1cf2
4142
#define PCI_VENDOR_ID_ZXDH_X512 0x1cf2
43+
#define PCI_VENDOR_ID_ZXDH_E312_TY_CLOUD 0x1b18
44+
#define PCI_VENDOR_ID_ZXDH_E310_TY_CLOUD 0x1b18
4245
/* ZXDH Devices ID */
4346
#define ZXDH_DEV_ID_ADAPTIVE_EVB_PF 0x8040 /* ZXDH EVB PF DEVICE ID*/
4447
#define ZXDH_DEV_ID_ADAPTIVE_EVB_VF 0x8041 /* ZXDH EVB VF DEVICE ID*/
@@ -52,4 +55,10 @@
5255
#define ZXDH_DEV_ID_ADAPTIVE_E316_VF 0x807f /* ZXDH E316 VF DEVICE ID*/
5356
#define ZXDH_DEV_ID_ADAPTIVE_X512_PF 0x806B /* ZXDH X512 PF DEVICE ID*/
5457
#define ZXDH_DEV_ID_ADAPTIVE_X512_VF 0x806C /* ZXDH X512 VF DEVICE ID*/
55-
#endif /* __ZXDH_DEVIDS_H__ */
58+
#define ZXDH_DEV_ID_ADAPTIVE_E312_TY_CLOUD_PF 0x1110 /* ZXDH E312 TY CLOUD PF DEVICE ID*/
59+
#define ZXDH_DEV_ID_ADAPTIVE_E312_TY_CLOUD_VF 0x1111 /* ZXDH E312 TY CLOUD VF DEVICE ID*/
60+
#define ZXDH_DEV_ID_ADAPTIVE_E310_TY_CLOUD_PF 0x1100 /* ZXDH E310 TY CLOUD PF DEVICE ID*/
61+
#define ZXDH_DEV_ID_ADAPTIVE_E310_TY_CLOUD_VF 0x1101 /* ZXDH E310 TY CLOUD VF DEVICE ID*/
62+
#define ZXDH_DEV_ID_ADAPTIVE_E312S_D_PF 0x80a2 /* ZXDH E310 TY CLOUD PF DEVICE ID*/
63+
#define ZXDH_DEV_ID_ADAPTIVE_E312S_D_VF 0x80a3 /* ZXDH E310 TY CLOUD VF DEVICE ID*/
64+
#endif /* ZXDH_DEVIDS_H */

0 commit comments

Comments
 (0)