FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
rdma.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2018 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 
18 #ifndef _RDMA_H_
19 #define _RDMA_H_
20 
21 #include <infiniband/verbs.h>
22 #include <vlib/log.h>
23 
24 #define foreach_rdma_device_flags \
25  _(0, INITIALIZED, "initialized") \
26  _(1, ERROR, "error") \
27  _(2, ADMIN_UP, "admin-up") \
28  _(3, VA_DMA, "vaddr-dma") \
29  _(4, LINK_UP, "link-up") \
30  _(5, SHARED_TXQ_LOCK, "shared-txq-lock") \
31  _(6, ELOG, "elog") \
32 
33 enum
34 {
35 #define _(a, b, c) RDMA_DEVICE_F_##b = (1 << a),
37 #undef _
38 };
39 
40 typedef struct
41 {
42  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
45  struct ibv_cq *cq;
46  struct ibv_wq *wq;
47 } rdma_rxq_t;
48 
49 typedef struct
50 {
51  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
54  struct ibv_cq *cq;
55  struct ibv_qp *qp;
57 } rdma_txq_t;
58 
59 typedef struct
60 {
61  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
64 
68 
70 
73 
74  u8 *name;
76  vlib_pci_addr_t pci_addr;
77 
78  struct ibv_context *ctx;
79  struct ibv_pd *pd;
80  struct ibv_mr *mr;
81  struct ibv_qp *rx_qp;
82  struct ibv_rwq_ind_table *rx_rwq_ind_tbl;
83  struct ibv_flow *flow_ucast;
84  struct ibv_flow *flow_mcast;
85 
86  /* error */
89 
90 typedef struct
91 {
94 } rdma_main_t;
95 
96 extern rdma_main_t rdma_main;
97 
98 typedef struct
99 {
105 
106  /* return */
107  int rv;
111 
114 
117 
118 /* format.c */
122 
123 typedef struct
124 {
128 
129 #define foreach_rdma_tx_func_error \
130 _(NO_FREE_SLOTS, "no free tx slots")
131 
132 typedef enum
133 {
134 #define _(f,s) RDMA_TX_ERROR_##f,
136 #undef _
139 
140 #endif /* AVF_H */
141 
142 /*
143  * fd.io coding-style-patch-verification: ON
144  *
145  * Local Variables:
146  * eval: (c-set-style "gnu")
147  * End:
148  */
struct ibv_mr * mr
Definition: rdma.h:80
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition: cache.h:60
void rdma_delete_if(vlib_main_t *vm, rdma_device_t *rd)
Definition: device.c:603
format_function_t format_rdma_device
Definition: rdma.h:119
void rdma_create_if(vlib_main_t *vm, rdma_create_if_args_t *args)
Definition: device.c:481
u32 size
Definition: rdma.h:43
u32 dev_instance
Definition: rdma.h:65
struct ibv_wq * wq
Definition: rdma.h:46
u32 size
Definition: rdma.h:52
u32 per_interface_next_index
Definition: rdma.h:63
format_function_t format_rdma_input_trace
Definition: rdma.h:121
rdma_main_t rdma_main
Definition: device.c:46
struct _vnet_device_class vnet_device_class_t
mac_address_t hwaddr
Definition: rdma.h:75
unsigned char u8
Definition: types.h:56
clib_spinlock_t lock
Definition: rdma.h:56
vlib_pci_addr_t pci_addr
Definition: rdma.h:76
vlib_log_class_t log_class
Definition: rdma.h:93
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
u32 vlib_log_class_t
Definition: vlib.h:50
struct ibv_pd * pd
Definition: rdma.h:79
rdma_device_t * devices
Definition: rdma.h:92
struct ibv_cq * cq
Definition: rdma.h:54
unsigned int u32
Definition: types.h:88
u32 flags
Definition: rdma.h:62
u32 n_enq
Definition: rdma.h:53
struct ibv_cq * cq
Definition: rdma.h:45
struct ibv_qp * qp
Definition: rdma.h:55
u32 hw_if_index
Definition: rdma.h:67
struct ibv_rwq_ind_table * rx_rwq_ind_tbl
Definition: rdma.h:82
clib_error_t * error
Definition: rdma.h:87
vlib_main_t * vm
Definition: buffer.c:312
clib_error_t * error
Definition: rdma.h:109
vlib_node_registration_t rdma_input_node
(constructor) VLIB_REGISTER_NODE (rdma_input_node)
Definition: input.c:358
u32 sw_if_index
Definition: rdma.h:66
format_function_t format_rdma_device_name
Definition: rdma.h:120
u8 * name
Definition: rdma.h:74
rdma_txq_t * txqs
Definition: rdma.h:72
rdma_rxq_t * rxqs
Definition: rdma.h:71
vnet_device_class_t rdma_device_class
rdma_tx_func_error_t
Definition: rdma.h:132
struct _vlib_node_registration vlib_node_registration_t
u32 async_event_clib_file_index
Definition: rdma.h:69
#define foreach_rdma_tx_func_error
Definition: rdma.h:129
#define foreach_rdma_device_flags
Definition: rdma.h:24
struct ibv_flow * flow_ucast
Definition: rdma.h:83
struct ibv_flow * flow_mcast
Definition: rdma.h:84
struct ibv_context * ctx
Definition: rdma.h:78
struct ibv_qp * rx_qp
Definition: rdma.h:81
u32 n_enq
Definition: rdma.h:44