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 *------------------------------------------------------------------
18 #include <vlib/vlib.h>
19 #include <vnet/vnet.h>
20 #include <rdma/rdma.h>
23 format_rdma_device_name (u8 * s, va_list * args)
25 u32 i = va_arg (*args, u32);
26 rdma_main_t *rm = &rdma_main;
27 rdma_device_t *rd = vec_elt_at_index (rm->devices, i);
30 return format (s, "%v", rd->name);
32 s = format (s, "rdma-%u", rd->dev_instance);
37 format_rdma_device_flags (u8 * s, va_list * args)
39 rdma_device_t *rd = va_arg (*args, rdma_device_t *);
42 #define _(a, b, c) if (rd->flags & (1 << a)) \
43 t = format (t, "%s%s", t ? " ":"", c);
44 foreach_rdma_device_flags
46 s = format (s, "%v", t);
52 format_rdma_device (u8 * s, va_list * args)
54 u32 i = va_arg (*args, u32);
55 rdma_main_t *rm = &rdma_main;
56 rdma_device_t *rd = vec_elt_at_index (rm->devices, i);
57 u32 indent = format_get_indent (s);
59 s = format (s, "netdev: %v\n", rd->linux_ifname);
60 s = format (s, "%Uflags: %U", format_white_space, indent,
61 format_rdma_device_flags, rd);
63 s = format (s, "\n%Uerror %U", format_white_space, indent,
64 format_clib_error, rd->error);
70 format_rdma_input_trace (u8 * s, va_list * args)
72 vlib_main_t *vm = va_arg (*args, vlib_main_t *);
73 vlib_node_t *node = va_arg (*args, vlib_node_t *);
74 rdma_input_trace_t *t = va_arg (*args, rdma_input_trace_t *);
75 vnet_main_t *vnm = vnet_get_main ();
76 vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, t->hw_if_index);
78 s = format (s, "rdma: %v (%d) next-node %U",
79 hi->name, t->hw_if_index, format_vlib_next_node_name, vm,
80 node->index, t->next_index);
86 * fd.io coding-style-patch-verification: ON
89 * eval: (c-set-style "gnu")