2 *------------------------------------------------------------------
3 * Copyright (c) 2023 Intel 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 <idpf/idpf.h>
21 format_idpf_device_name (u8 *s, va_list *args)
23 vlib_main_t *vm = vlib_get_main ();
24 u32 i = va_arg (*args, u32);
25 idpf_device_t *id = idpf_get_device (i);
26 vlib_pci_addr_t *addr = vlib_pci_get_addr (vm, id->pci_dev_handle);
29 return format (s, "%s", id->name);
31 s = format (s, "idpf-%x/%x/%x/%x", addr->domain, addr->bus, addr->slot,
37 format_idpf_device_flags (u8 *s, va_list *args)
39 idpf_device_t *id = va_arg (*args, idpf_device_t *);
43 if (id->flags & (1 << a)) \
44 t = format (t, "%s%s", t ? " " : "", c);
45 foreach_idpf_device_flags
47 s = format (s, "%v", t);
53 format_idpf_checksum_cap_flags (u8 *s, va_list *args)
55 u32 flags = va_arg (*args, u32);
59 #define _(a, b, c) [a] = c,
60 foreach_idpf_checksum_cap_flag
64 for (int i = 0; i < 32; i++)
66 if ((flags & (1 << i)) == 0)
71 s = format (s, "%s", strs[i]);
73 s = format (s, "unknown(%u)", i);