FD.io VPP  v19.08.1-401-g8e4ed521a
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);
40  struct ibv_cq *cq;
41  struct ibv_wq *wq;
46 } rdma_rxq_t;
47 
48 typedef struct
49 {
50  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
52  struct ibv_cq *cq;
53  struct ibv_qp *qp;
58 } rdma_txq_t;
59 
60 typedef struct
61 {
62  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
63 
64  /* following fields are accessed in datapath */
71  u32 lkey; /* cache of mr->lkey */
72  u8 pool; /* buffer pool index */
73 
74  /* fields below are not accessed in datapath */
76  u8 *name;
81 
82  struct ibv_context *ctx;
83  struct ibv_pd *pd;
84  struct ibv_mr *mr;
85  struct ibv_qp *rx_qp;
86  struct ibv_rwq_ind_table *rx_rwq_ind_tbl;
87  struct ibv_flow *flow_ucast;
88  struct ibv_flow *flow_mcast;
89 
92 
93 typedef struct
94 {
97 } rdma_main_t;
98 
99 extern rdma_main_t rdma_main;
100 
101 typedef struct
102 {
108 
109  /* return */
110  int rv;
114 
117 
120 
121 /* format.c */
125 
126 typedef struct
127 {
131 
132 #define foreach_rdma_tx_func_error \
133 _(NO_FREE_SLOTS, "no free tx slots")
134 
135 typedef enum
136 {
137 #define _(f,s) RDMA_TX_ERROR_##f,
139 #undef _
142 
143 #endif /* AVF_H */
144 
145 /*
146  * fd.io coding-style-patch-verification: ON
147  *
148  * Local Variables:
149  * eval: (c-set-style "gnu")
150  * End:
151  */
struct ibv_mr * mr
Definition: rdma.h:84
#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:717
u8 * linux_ifname
Definition: rdma.h:77
format_function_t format_rdma_device
Definition: rdma.h:122
void rdma_create_if(vlib_main_t *vm, rdma_create_if_args_t *args)
Definition: device.c:580
u32 size
Definition: rdma.h:43
vlib_pci_device_info_t * pci
Definition: rdma.h:75
u32 dev_instance
Definition: rdma.h:80
struct ibv_wq * wq
Definition: rdma.h:41
u32 size
Definition: rdma.h:55
u32 per_interface_next_index
Definition: rdma.h:68
format_function_t format_rdma_input_trace
Definition: rdma.h:124
rdma_main_t rdma_main
Definition: device.c:46
struct _vnet_device_class vnet_device_class_t
u32 tail
Definition: rdma.h:45
mac_address_t hwaddr
Definition: rdma.h:78
unsigned char u8
Definition: types.h:56
clib_spinlock_t lock
Definition: rdma.h:51
vlib_log_class_t log_class
Definition: rdma.h:96
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
u32 vlib_log_class_t
Definition: vlib.h:51
struct ibv_pd * pd
Definition: rdma.h:83
rdma_device_t * devices
Definition: rdma.h:95
struct ibv_cq * cq
Definition: rdma.h:52
u32 tail
Definition: rdma.h:57
unsigned int u32
Definition: types.h:88
u32 flags
Definition: rdma.h:67
u32 * bufs
Definition: rdma.h:42
u32 head
Definition: rdma.h:56
u8 pool
Definition: rdma.h:72
struct ibv_cq * cq
Definition: rdma.h:40
struct ibv_qp * qp
Definition: rdma.h:53
u32 hw_if_index
Definition: rdma.h:70
struct ibv_rwq_ind_table * rx_rwq_ind_tbl
Definition: rdma.h:86
clib_error_t * error
Definition: rdma.h:90
vlib_main_t * vm
Definition: buffer.c:323
clib_error_t * error
Definition: rdma.h:112
u32 lkey
Definition: rdma.h:71
vlib_node_registration_t rdma_input_node
(constructor) VLIB_REGISTER_NODE (rdma_input_node)
Definition: input.c:361
u32 sw_if_index
Definition: rdma.h:69
u32 head
Definition: rdma.h:44
format_function_t format_rdma_device_name
Definition: rdma.h:123
u8 * name
Definition: rdma.h:76
rdma_txq_t * txqs
Definition: rdma.h:66
rdma_rxq_t * rxqs
Definition: rdma.h:65
vnet_device_class_t rdma_device_class
rdma_tx_func_error_t
Definition: rdma.h:135
struct _vlib_node_registration vlib_node_registration_t
u32 async_event_clib_file_index
Definition: rdma.h:79
u32 * bufs
Definition: rdma.h:54
#define foreach_rdma_tx_func_error
Definition: rdma.h:132
#define foreach_rdma_device_flags
Definition: rdma.h:24
struct ibv_flow * flow_ucast
Definition: rdma.h:87
struct ibv_flow * flow_mcast
Definition: rdma.h:88
struct ibv_context * ctx
Definition: rdma.h:82
struct ibv_qp * rx_qp
Definition: rdma.h:85