FD.io VPP
v19.08.3-2-gbabecb413
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),
33
foreach_rdma_device_flags
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
;
42
u32
*
bufs
;
43
u32
size
;
44
u32
head
;
45
u32
tail
;
46
}
rdma_rxq_t
;
47
48
typedef
struct
49
{
50
CLIB_CACHE_LINE_ALIGN_MARK
(cacheline0);
51
clib_spinlock_t
lock
;
52
struct
ibv_cq *
cq
;
53
struct
ibv_qp *
qp
;
54
u32
*
bufs
;
55
u32
size
;
56
u32
head
;
57
u32
tail
;
58
}
rdma_txq_t
;
59
60
typedef
struct
61
{
62
CLIB_CACHE_LINE_ALIGN_MARK
(cacheline0);
63
64
/* following fields are accessed in datapath */
65
rdma_rxq_t
*
rxqs
;
66
rdma_txq_t
*
txqs
;
67
u32
flags
;
68
u32
per_interface_next_index
;
69
u32
sw_if_index
;
70
u32
hw_if_index
;
71
u32
lkey
;
/* cache of mr->lkey */
72
u8
pool
;
/* buffer pool index */
73
74
/* fields below are not accessed in datapath */
75
vlib_pci_device_info_t
*
pci
;
76
u8
*
name
;
77
u8
*
linux_ifname
;
78
mac_address_t
hwaddr
;
79
u32
async_event_clib_file_index
;
80
u32
dev_instance
;
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
90
clib_error_t
*
error
;
91
}
rdma_device_t
;
92
93
typedef
struct
94
{
95
rdma_device_t
*
devices
;
96
vlib_log_class_t
log_class
;
97
}
rdma_main_t
;
98
99
extern
rdma_main_t
rdma_main
;
100
101
typedef
struct
102
{
103
u8
*
ifname
;
104
u8
*
name
;
105
u32
rxq_size
;
106
u32
txq_size
;
107
u32
rxq_num
;
108
109
/* return */
110
int
rv
;
111
u32
sw_if_index
;
112
clib_error_t
*
error
;
113
}
rdma_create_if_args_t
;
114
115
void
rdma_create_if
(
vlib_main_t
*
vm
,
rdma_create_if_args_t
* args);
116
void
rdma_delete_if
(
vlib_main_t
*
vm
,
rdma_device_t
* rd);
117
118
extern
vlib_node_registration_t
rdma_input_node
;
119
extern
vnet_device_class_t
rdma_device_class
;
120
121
/* format.c */
122
format_function_t
format_rdma_device
;
123
format_function_t
format_rdma_device_name
;
124
format_function_t
format_rdma_input_trace
;
125
126
typedef
struct
127
{
128
u32
next_index
;
129
u32
hw_if_index
;
130
}
rdma_input_trace_t
;
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,
138
foreach_rdma_tx_func_error
139
#undef _
140
RDMA_TX_N_ERROR
,
141
}
rdma_tx_func_error_t
;
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
*/
rdma_device_t::mr
struct ibv_mr * mr
Definition:
rdma.h:84
CLIB_CACHE_LINE_ALIGN_MARK
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition:
cache.h:60
rdma_delete_if
void rdma_delete_if(vlib_main_t *vm, rdma_device_t *rd)
Definition:
device.c:717
rdma_device_t::linux_ifname
u8 * linux_ifname
Definition:
rdma.h:77
format_rdma_device
format_function_t format_rdma_device
Definition:
rdma.h:122
rdma_create_if
void rdma_create_if(vlib_main_t *vm, rdma_create_if_args_t *args)
Definition:
device.c:580
rdma_rxq_t::size
u32 size
Definition:
rdma.h:43
rdma_device_t::pci
vlib_pci_device_info_t * pci
Definition:
rdma.h:75
rdma_device_t::dev_instance
u32 dev_instance
Definition:
rdma.h:80
rdma_rxq_t::wq
struct ibv_wq * wq
Definition:
rdma.h:41
rdma_txq_t::size
u32 size
Definition:
rdma.h:55
rdma_input_trace_t::hw_if_index
u32 hw_if_index
Definition:
rdma.h:129
rdma_device_t::per_interface_next_index
u32 per_interface_next_index
Definition:
rdma.h:68
format_rdma_input_trace
format_function_t format_rdma_input_trace
Definition:
rdma.h:124
rdma_create_if_args_t::sw_if_index
u32 sw_if_index
Definition:
rdma.h:111
rdma_main
rdma_main_t rdma_main
Definition:
device.c:46
rdma_device_t
Definition:
rdma.h:60
rdma_input_trace_t::next_index
u32 next_index
Definition:
rdma.h:128
vnet_device_class_t
struct _vnet_device_class vnet_device_class_t
rdma_rxq_t::tail
u32 tail
Definition:
rdma.h:45
rdma_device_t::hwaddr
mac_address_t hwaddr
Definition:
rdma.h:78
u8
unsigned char u8
Definition:
types.h:56
rdma_txq_t::lock
clib_spinlock_t lock
Definition:
rdma.h:51
rdma_main_t::log_class
vlib_log_class_t log_class
Definition:
rdma.h:96
format_function_t
u8 *() format_function_t(u8 *s, va_list *args)
Definition:
format.h:48
rdma_create_if_args_t::rxq_num
u32 rxq_num
Definition:
rdma.h:107
vlib_log_class_t
u32 vlib_log_class_t
Definition:
vlib.h:51
rdma_device_t::pd
struct ibv_pd * pd
Definition:
rdma.h:83
rdma_main_t::devices
rdma_device_t * devices
Definition:
rdma.h:95
rdma_txq_t::cq
struct ibv_cq * cq
Definition:
rdma.h:52
RDMA_TX_N_ERROR
Definition:
rdma.h:140
rdma_create_if_args_t::rxq_size
u32 rxq_size
Definition:
rdma.h:105
rdma_txq_t::tail
u32 tail
Definition:
rdma.h:57
u32
unsigned int u32
Definition:
types.h:88
rdma_device_t::flags
u32 flags
Definition:
rdma.h:67
rdma_rxq_t::bufs
u32 * bufs
Definition:
rdma.h:42
rdma_txq_t::head
u32 head
Definition:
rdma.h:56
rdma_create_if_args_t::txq_size
u32 txq_size
Definition:
rdma.h:106
rdma_device_t::pool
u8 pool
Definition:
rdma.h:72
rdma_rxq_t::cq
struct ibv_cq * cq
Definition:
rdma.h:40
rdma_main_t
Definition:
rdma.h:93
rdma_txq_t::qp
struct ibv_qp * qp
Definition:
rdma.h:53
mac_address_t_
Definition:
mac_address.h:21
rdma_input_trace_t
Definition:
rdma.h:126
rdma_device_t::hw_if_index
u32 hw_if_index
Definition:
rdma.h:70
rdma_device_t::rx_rwq_ind_tbl
struct ibv_rwq_ind_table * rx_rwq_ind_tbl
Definition:
rdma.h:86
rdma_device_t::error
clib_error_t * error
Definition:
rdma.h:90
vm
vlib_main_t * vm
Definition:
buffer.c:323
rdma_create_if_args_t::error
clib_error_t * error
Definition:
rdma.h:112
rdma_create_if_args_t::ifname
u8 * ifname
Definition:
rdma.h:103
rdma_device_t::lkey
u32 lkey
Definition:
rdma.h:71
rdma_create_if_args_t
Definition:
rdma.h:101
clib_spinlock_t
Definition:
lock.h:51
rdma_input_node
vlib_node_registration_t rdma_input_node
(constructor) VLIB_REGISTER_NODE (rdma_input_node)
Definition:
input.c:361
rdma_device_t::sw_if_index
u32 sw_if_index
Definition:
rdma.h:69
rdma_rxq_t::head
u32 head
Definition:
rdma.h:44
format_rdma_device_name
format_function_t format_rdma_device_name
Definition:
rdma.h:123
rdma_txq_t
Definition:
rdma.h:48
rdma_device_t::name
u8 * name
Definition:
rdma.h:76
rdma_device_t::txqs
rdma_txq_t * txqs
Definition:
rdma.h:66
rdma_create_if_args_t::name
u8 * name
Definition:
rdma.h:104
rdma_device_t::rxqs
rdma_rxq_t * rxqs
Definition:
rdma.h:65
rdma_device_class
vnet_device_class_t rdma_device_class
rdma_tx_func_error_t
rdma_tx_func_error_t
Definition:
rdma.h:135
clib_error_t
Definition:
clib_error.h:21
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
rdma_rxq_t
Definition:
rdma.h:37
rdma_device_t::async_event_clib_file_index
u32 async_event_clib_file_index
Definition:
rdma.h:79
vlib_main_t
Definition:
main.h:83
rdma_create_if_args_t::rv
int rv
Definition:
rdma.h:110
rdma_txq_t::bufs
u32 * bufs
Definition:
rdma.h:54
foreach_rdma_tx_func_error
#define foreach_rdma_tx_func_error
Definition:
rdma.h:132
foreach_rdma_device_flags
#define foreach_rdma_device_flags
Definition:
rdma.h:24
rdma_device_t::flow_ucast
struct ibv_flow * flow_ucast
Definition:
rdma.h:87
log.h
rdma_device_t::flow_mcast
struct ibv_flow * flow_mcast
Definition:
rdma.h:88
vlib_pci_device_info
Definition:
pci.h:60
rdma_device_t::ctx
struct ibv_context * ctx
Definition:
rdma.h:82
rdma_device_t::rx_qp
struct ibv_qp * rx_qp
Definition:
rdma.h:85
src
plugins
rdma
rdma.h
Generated on Mon Oct 19 2020 14:03:37 for FD.io VPP by
1.8.13