FD.io VPP  v19.08-27-gf4dcae4
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, ERROR, "error") \
26  _(1, ADMIN_UP, "admin-up") \
27  _(2, LINK_UP, "link-up") \
28  _(3, PROMISC, "promiscuous")
29 
30 enum
31 {
32 #define _(a, b, c) RDMA_DEVICE_F_##b = (1 << a),
34 #undef _
35 };
36 
37 typedef struct
38 {
39  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
42  struct ibv_cq *cq;
43  struct ibv_wq *wq;
44 } rdma_rxq_t;
45 
46 typedef struct
47 {
48  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
51  struct ibv_cq *cq;
52  struct ibv_qp *qp;
54 } rdma_txq_t;
55 
56 typedef struct
57 {
58  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
61 
65 
67 
70 
71  u8 *name;
73  vlib_pci_addr_t pci_addr;
74 
75  struct ibv_context *ctx;
76  struct ibv_pd *pd;
77  struct ibv_mr *mr;
78  struct ibv_qp *rx_qp;
79  struct ibv_rwq_ind_table *rx_rwq_ind_tbl;
80  struct ibv_flow *flow_ucast;
81  struct ibv_flow *flow_mcast;
82 
83  /* error */
86 
87 typedef struct
88 {
91 } rdma_main_t;
92 
93 extern rdma_main_t rdma_main;
94 
95 typedef struct
96 {
98  u8 *name;
102 
103  /* return */
104  int rv;
108 
111 
114 
115 /* format.c */
119 
120 typedef struct
121 {
125 
126 #define foreach_rdma_tx_func_error \
127 _(NO_FREE_SLOTS, "no free tx slots")
128 
129 typedef enum
130 {
131 #define _(f,s) RDMA_TX_ERROR_##f,
133 #undef _
136 
137 #endif /* AVF_H */
138 
139 /*
140  * fd.io coding-style-patch-verification: ON
141  *
142  * Local Variables:
143  * eval: (c-set-style "gnu")
144  * End:
145  */
struct ibv_mr * mr
Definition: rdma.h:77
#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:680
format_function_t format_rdma_device
Definition: rdma.h:116
void rdma_create_if(vlib_main_t *vm, rdma_create_if_args_t *args)
Definition: device.c:558
u32 size
Definition: rdma.h:40
u32 dev_instance
Definition: rdma.h:62
struct ibv_wq * wq
Definition: rdma.h:43
u32 size
Definition: rdma.h:49
u32 per_interface_next_index
Definition: rdma.h:60
format_function_t format_rdma_input_trace
Definition: rdma.h:118
u8 *( format_function_t)(u8 *s, va_list *args)
Definition: format.h:48
rdma_main_t rdma_main
Definition: device.c:46
struct _vnet_device_class vnet_device_class_t
mac_address_t hwaddr
Definition: rdma.h:72
unsigned char u8
Definition: types.h:56
clib_spinlock_t lock
Definition: rdma.h:53
vlib_pci_addr_t pci_addr
Definition: rdma.h:73
vlib_log_class_t log_class
Definition: rdma.h:90
u32 vlib_log_class_t
Definition: vlib.h:51
struct ibv_pd * pd
Definition: rdma.h:76
rdma_device_t * devices
Definition: rdma.h:89
struct ibv_cq * cq
Definition: rdma.h:51
unsigned int u32
Definition: types.h:88
u32 flags
Definition: rdma.h:59
u32 n_enq
Definition: rdma.h:50
struct ibv_cq * cq
Definition: rdma.h:42
struct ibv_qp * qp
Definition: rdma.h:52
u32 hw_if_index
Definition: rdma.h:64
struct ibv_rwq_ind_table * rx_rwq_ind_tbl
Definition: rdma.h:79
clib_error_t * error
Definition: rdma.h:84
vlib_main_t * vm
Definition: buffer.c:312
clib_error_t * error
Definition: rdma.h:106
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:63
format_function_t format_rdma_device_name
Definition: rdma.h:117
u8 * name
Definition: rdma.h:71
rdma_txq_t * txqs
Definition: rdma.h:69
rdma_rxq_t * rxqs
Definition: rdma.h:68
vnet_device_class_t rdma_device_class
rdma_tx_func_error_t
Definition: rdma.h:129
struct _vlib_node_registration vlib_node_registration_t
u32 async_event_clib_file_index
Definition: rdma.h:66
#define foreach_rdma_tx_func_error
Definition: rdma.h:126
#define foreach_rdma_device_flags
Definition: rdma.h:24
struct ibv_flow * flow_ucast
Definition: rdma.h:80
struct ibv_flow * flow_mcast
Definition: rdma.h:81
struct ibv_context * ctx
Definition: rdma.h:75
struct ibv_qp * rx_qp
Definition: rdma.h:78
u32 n_enq
Definition: rdma.h:41