25 #ifndef __MOTR_NET_LIBFAB_LIBFAB_INTERNAL_H__ 26 #define __MOTR_NET_LIBFAB_LIBFAB_INTERNAL_H__ 30 #include <netinet/in.h> 32 #include "rdma/fabric.h" 33 #include "rdma/fi_cm.h" 34 #include "rdma/fi_domain.h" 35 #include "rdma/fi_eq.h" 36 #include "rdma/fi_endpoint.h" 37 #include "rdma/fi_rma.h" 47 #define LIBFAB_VERSION FI_VERSION(1,11) 49 #define LIBFAB_ADDR_LEN_MAX INET6_ADDRSTRLEN 50 #define LIBFAB_PORT_LEN_MAX 6 55 enum m0_fab__libfab_params {
57 FAB_MR_ACCESS = (FI_READ | FI_WRITE | FI_RECV |
58 FI_SEND | FI_REMOTE_READ |
67 FAB_VERBS_IOV_MAX = 16,
69 FAB_VERBS_MAX_BULK_SEG_SIZE = 131072,
71 FAB_VERBS_MAX_QUEUE_SIZE = 224,
75 FAB_TCP_SOCK_IOV_MAX = 256,
78 FAB_TCP_SOCK_MAX_BULK_SEG_SIZE = 4096,
80 FAB_TCP_SOCK_MAX_QUEUE_SIZE = 1024,
83 FAB_MAX_RPC_SEG_SIZE = (1 << 20),
85 FAB_MAX_RPC_SEG_NR = 1,
87 FAB_MAX_RPC_RECV_MSG_NR = 1,
89 FAB_DUMMY_DATA = 0xFABC0DE,
91 FAB_MAX_COMP_READ = 256,
93 FAB_WAIT_FD_TMOUT = 1000,
95 FAB_MAX_AEP_EQ_EV = 8,
97 FAB_MAX_PEP_EQ_EV = 256,
99 FAB_MAX_TX_CQ_EV = 1024,
101 FAB_MAX_RX_CQ_EV = 256,
103 FAB_MAX_SRX_SIZE = 4096,
105 FAB_NUM_BUCKETS_PER_QTYPE = 128,
107 FAB_BUF_TMOUT_CHK_INTERVAL = 1,
109 FAB_CONNECTING_TMOUT = 5,
111 FAB_TM_FID_MALLOC_STEP = 1024
118 enum m0_fab__prov_type {
119 FAB_FABRIC_PROV_VERBS,
121 FAB_FABRIC_PROV_SOCK,
129 enum m0_fab__conn_status {
138 enum m0_fab__tm_state {
147 enum m0_fab__buf_state {
159 enum m0_fab__event_type {
167 enum m0_fab__connlink_status {
168 FAB_CONNLINK_DOWN = 0x00,
169 FAB_CONNLINK_TXEP_RDY = 0x01,
170 FAB_CONNLINK_RXEP_RDY = 0x02,
171 FAB_CONNLINK_RDY_TO_SEND = 0x03,
172 FAB_CONNLINK_PENDING_SEND_DONE = 0x07
178 enum m0_fab__ep_iface {
189 uint32_t tf_queue_id : 4;
191 uint32_t tf_queue_num : 8;
193 uint32_t tf_tag : 20;
200 struct m0_fab__ev_ctx {
202 enum m0_fab__event_type evctx_type;
217 struct m0_fab__bufht {
228 struct m0_fab__ndom {
237 struct m0_tl fnd_fabrics;
240 char fnd_loc_ip[INET_ADDRSTRLEN];
246 uint32_t fnd_seg_size;
257 struct fi_info *fab_fi;
260 struct fid_fabric *fab_fab;
263 struct fid_domain *fab_dom;
269 enum m0_fab__prov_type fab_prov;
272 uint32_t fab_max_iov;
278 struct m0_fab__pep_res{
280 struct fid_eq *fpr_eq;
283 struct m0_fab__ev_ctx fpr_ctx;
289 struct m0_fab__tx_res{
291 struct fid_eq *ftr_eq;
294 struct m0_fab__ev_ctx ftr_ctx;
300 struct m0_fab__rx_res{
302 struct fid_eq *frr_eq;
305 struct fid_cq *frr_cq;
308 struct m0_fab__ev_ctx frr_cq_ctx;
311 struct m0_fab__ev_ctx frr_eq_ctx;
317 struct m0_fab__active_ep {
319 struct fid_ep *aep_txep;
322 struct fid_ep *aep_rxep;
325 struct m0_fab__tx_res aep_tx_res;
328 struct m0_fab__rx_res aep_rx_res;
331 enum m0_fab__conn_status aep_tx_state;
334 enum m0_fab__conn_status aep_rx_state;
337 volatile uint32_t aep_bulk_cnt;
352 struct m0_fab__passive_ep {
354 struct fid_pep *pep_pep;
357 struct m0_fab__active_ep *pep_aep;
360 struct m0_fab__pep_res pep_res;
377 struct m0_fab__active_ep *fep_aep;
380 struct m0_fab__passive_ep *fep_listen;
383 struct m0_tl fep_sndbuf;
386 uint8_t fep_connlink;
393 struct m0_fab__tm_fids {
395 struct fid **ftf_head;
398 struct m0_fab__ev_ctx **ftf_ctx;
401 uint32_t ftf_arr_size;
404 volatile uint32_t ftf_cnt;
432 struct m0_fab__tm_fids ftm_fids;
435 struct m0_fab__fab *ftm_fab;
438 struct m0_fab__ep *ftm_pep;
441 struct fid_ep *ftm_rctx;
444 struct fid_cq *ftm_tx_cq;
447 struct m0_fab__ev_ctx ftm_txcq_ctx;
450 volatile enum m0_fab__tm_state ftm_state;
453 struct m0_tl ftm_done;
462 struct m0_tl ftm_bulk;
465 struct fi_rma_iov *ftm_rem_iov;
468 struct iovec *ftm_loc_iov;
474 struct m0_fab__bufht ftm_bufhash;
477 uint64_t ftm_mr_key_idx;
489 struct m0_fab__buf_mr {
494 struct fid_mr **bm_mr;
501 struct m0_fab__bdesc {
506 uint32_t fbd_iov_cnt;
509 uint32_t fbd_buftoken;
515 struct m0_fab__buf_xfer_params {
517 uint32_t bxp_loc_sidx;
520 uint32_t bxp_rem_sidx;
523 uint32_t bxp_xfer_len;
526 uint32_t bxp_rem_soff;
529 uint32_t bxp_loc_soff;
540 uint64_t fb_sndmagic;
546 uint32_t fb_dummy[2];
549 struct m0_fab__bdesc *fb_rbd;
552 struct fi_rma_iov *fb_riov;
555 struct m0_fab__buf_mr fb_mr;
558 struct fid_domain *fb_dp;
564 struct m0_fab__ep *fb_ev_ep;
567 struct m0_fab__ep *fb_txctx;
585 volatile uint32_t fb_wr_cnt;
588 struct m0_fab__buf_xfer_params fb_xfer_params;
595 volatile enum m0_fab__buf_state fb_state;
604 struct m0_fab__conn_data {
613 struct m0_fab__bulk_op {
618 struct m0_fab__buf *fbl_buf;
621 struct m0_fab__active_ep *fbl_aep;