X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Frdma%2Frdma.h;h=1e2f3d9ea0eb7daf94456acfca0d2934eb916d48;hb=refs%2Fchanges%2F72%2F25572%2F13;hp=860ddaba2b101994fae0bf94ab799b7a4a09bbf1;hpb=fe750c248be58b76479836639fbd0c4617210aa5;p=vpp.git diff --git a/src/plugins/rdma/rdma.h b/src/plugins/rdma/rdma.h index 860ddaba2b1..1e2f3d9ea0e 100644 --- a/src/plugins/rdma/rdma.h +++ b/src/plugins/rdma/rdma.h @@ -20,15 +20,17 @@ #include #include +#include +#include +#include +#include #define foreach_rdma_device_flags \ - _(0, INITIALIZED, "initialized") \ - _(1, ERROR, "error") \ - _(2, ADMIN_UP, "admin-up") \ - _(3, VA_DMA, "vaddr-dma") \ - _(4, LINK_UP, "link-up") \ - _(5, SHARED_TXQ_LOCK, "shared-txq-lock") \ - _(6, ELOG, "elog") \ + _(0, ERROR, "error") \ + _(1, ADMIN_UP, "admin-up") \ + _(2, LINK_UP, "link-up") \ + _(3, PROMISC, "promiscuous") \ + _(4, MLX5DV, "mlx5dv") enum { @@ -40,61 +42,108 @@ enum typedef struct { CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); - u32 size; - u32 n_enq; struct ibv_cq *cq; - struct ibv_qp *qp; + struct ibv_wq *wq; + u32 *bufs; + u32 size; + u32 head; + u32 tail; + u32 cq_ci; + u16 log2_cq_size; + u16 n_mini_cqes; + u16 n_mini_cqes_left; + u16 last_cqe_flags; + mlx5dv_cqe_t *cqes; + mlx5dv_rwq_t *wqes; + volatile u32 *wq_db; + volatile u32 *cq_db; + u32 cqn; + u32 wqe_cnt; + u32 wq_stride; } rdma_rxq_t; typedef struct { CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); - u32 size; - u32 n_enq; + clib_spinlock_t lock; struct ibv_cq *cq; struct ibv_qp *qp; - clib_spinlock_t lock; + u32 *bufs; + u32 size; + u32 head; + u32 tail; } rdma_txq_t; typedef struct { CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); + + /* following fields are accessed in datapath */ + rdma_rxq_t *rxqs; + rdma_txq_t *txqs; u32 flags; u32 per_interface_next_index; - - u32 dev_instance; u32 sw_if_index; u32 hw_if_index; - + u32 lkey; /* cache of mr->lkey */ + u8 pool; /* buffer pool index */ + + /* fields below are not accessed in datapath */ + vlib_pci_device_info_t *pci; + u8 *name; + u8 *linux_ifname; + mac_address_t hwaddr; u32 async_event_clib_file_index; - - rdma_rxq_t *rxqs; - rdma_txq_t *txqs; - - u8 hwaddr[6]; - vlib_pci_addr_t pci_addr; + u32 dev_instance; struct ibv_context *ctx; struct ibv_pd *pd; struct ibv_mr *mr; + struct ibv_qp *rx_qp; + struct ibv_rwq_ind_table *rx_rwq_ind_tbl; struct ibv_flow *flow_ucast; struct ibv_flow *flow_mcast; - /* error */ clib_error_t *error; } rdma_device_t; typedef struct { + CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); + union + { + u16 cqe_flags[VLIB_FRAME_SIZE]; + u16x8 cqe_flags8[VLIB_FRAME_SIZE / 8]; + u16x16 cqe_flags16[VLIB_FRAME_SIZE / 16]; + }; + vlib_buffer_t buffer_template; +} rdma_per_thread_data_t; + +typedef struct +{ + rdma_per_thread_data_t *per_thread_data; rdma_device_t *devices; vlib_log_class_t log_class; + u16 msg_id_base; } rdma_main_t; extern rdma_main_t rdma_main; +typedef enum +{ + RDMA_MODE_AUTO = 0, + RDMA_MODE_IBV, + RDMA_MODE_DV, +} rdma_mode_t; + typedef struct { u8 *ifname; + u8 *name; + u32 rxq_size; + u32 txq_size; + u32 rxq_num; + rdma_mode_t mode; /* return */ int rv; @@ -108,15 +157,17 @@ void rdma_delete_if (vlib_main_t * vm, rdma_device_t * rd); extern vlib_node_registration_t rdma_input_node; extern vnet_device_class_t rdma_device_class; -/* format.c */ format_function_t format_rdma_device; format_function_t format_rdma_device_name; format_function_t format_rdma_input_trace; +format_function_t format_rdma_rxq; +unformat_function_t unformat_rdma_create_if_args; typedef struct { u32 next_index; u32 hw_if_index; + u16 cqe_flags; } rdma_input_trace_t; #define foreach_rdma_tx_func_error \