Damjan Marion | 38c6191 | 2023-10-17 16:06:26 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright (c) 2023 Cisco Systems, Inc. |
| 3 | */ |
| 4 | |
| 5 | #include <vnet/vnet.h> |
| 6 | #include <vnet/ethernet/ethernet.h> |
| 7 | #include <vnet/dev/dev.h> |
| 8 | #include <vnet/dev/counters.h> |
| 9 | |
| 10 | clib_error_t * |
| 11 | vnet_dev_port_err (vlib_main_t *vm, vnet_dev_port_t *port, vnet_dev_rv_t rv, |
| 12 | char *fmt, ...) |
| 13 | { |
| 14 | clib_error_t *err; |
| 15 | va_list va; |
| 16 | u8 *s; |
| 17 | |
| 18 | if (rv == VNET_DEV_OK) |
| 19 | return 0; |
| 20 | |
| 21 | va_start (va, fmt); |
| 22 | s = va_format (0, fmt, &va); |
| 23 | va_end (va); |
| 24 | |
| 25 | err = clib_error_return (0, "%s port %u: %U (%v)", port->dev->device_id, |
| 26 | port->port_id, format_vnet_dev_rv, rv, s); |
| 27 | vec_free (s); |
| 28 | return err; |
| 29 | } |