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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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 *------------------------------------------------------------------
21 #include <infiniband/verbs.h>
23 #include <vlib/pci/pci.h>
24 #include <vnet/interface.h>
25 #include <vnet/ethernet/mac_address.h>
26 #include <rdma/rdma_mlx5dv.h>
28 #define foreach_rdma_device_flags \
29 _(0, ERROR, "error") \
30 _(1, ADMIN_UP, "admin-up") \
31 _(2, LINK_UP, "link-up") \
32 _(3, PROMISC, "promiscuous") \
33 _(4, MLX5DV, "mlx5dv")
37 #define _(a, b, c) RDMA_DEVICE_F_##b = (1 << a),
38 foreach_rdma_device_flags
44 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
67 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
79 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
81 /* following fields are accessed in datapath */
85 u32 per_interface_next_index;
88 u32 lkey; /* cache of mr->lkey */
89 u8 pool; /* buffer pool index */
91 /* fields below are not accessed in datapath */
92 vlib_pci_device_info_t *pci;
96 u32 async_event_clib_file_index;
99 struct ibv_context *ctx;
102 struct ibv_qp *rx_qp;
103 struct ibv_rwq_ind_table *rx_rwq_ind_tbl;
104 struct ibv_flow *flow_ucast;
105 struct ibv_flow *flow_mcast;
112 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
115 u16 cqe_flags[VLIB_FRAME_SIZE];
116 u16x8 cqe_flags8[VLIB_FRAME_SIZE / 8];
117 u16x16 cqe_flags16[VLIB_FRAME_SIZE / 16];
119 vlib_buffer_t buffer_template;
120 } rdma_per_thread_data_t;
124 rdma_per_thread_data_t *per_thread_data;
125 rdma_device_t *devices;
126 vlib_log_class_t log_class;
130 extern rdma_main_t rdma_main;
152 } rdma_create_if_args_t;
154 void rdma_create_if (vlib_main_t * vm, rdma_create_if_args_t * args);
155 void rdma_delete_if (vlib_main_t * vm, rdma_device_t * rd);
157 extern vlib_node_registration_t rdma_input_node;
158 extern vnet_device_class_t rdma_device_class;
160 format_function_t format_rdma_device;
161 format_function_t format_rdma_device_name;
162 format_function_t format_rdma_input_trace;
163 format_function_t format_rdma_rxq;
164 unformat_function_t unformat_rdma_create_if_args;
171 } rdma_input_trace_t;
173 #define foreach_rdma_tx_func_error \
174 _(NO_FREE_SLOTS, "no free tx slots")
178 #define _(f,s) RDMA_TX_ERROR_##f,
179 foreach_rdma_tx_func_error
182 } rdma_tx_func_error_t;
187 * fd.io coding-style-patch-verification: ON
190 * eval: (c-set-style "gnu")