diff options
author | Damjan Marion <damarion@cisco.com> | 2023-10-17 16:06:26 +0000 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2023-11-02 13:41:32 +0000 |
commit | 38c619115b0399bae8b0dcf66e57e623cc50809c (patch) | |
tree | 2d40af83187c2dce0e971328ab7add4d9940ac57 /src/vnet/dev/error.c | |
parent | d3ef00098cd27e01bb24db15e3440fabbc025aa8 (diff) |
dev: new device driver infra
Type: feature
Change-Id: I20c56e0d3103624407f18365c2bc1273dea5c199
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/dev/error.c')
-rw-r--r-- | src/vnet/dev/error.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/vnet/dev/error.c b/src/vnet/dev/error.c new file mode 100644 index 00000000000..df9c6d364e7 --- /dev/null +++ b/src/vnet/dev/error.c @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: Apache-2.0 + * Copyright (c) 2023 Cisco Systems, Inc. + */ + +#include <vnet/vnet.h> +#include <vnet/ethernet/ethernet.h> +#include <vnet/dev/dev.h> +#include <vnet/dev/counters.h> + +clib_error_t * +vnet_dev_port_err (vlib_main_t *vm, vnet_dev_port_t *port, vnet_dev_rv_t rv, + char *fmt, ...) +{ + clib_error_t *err; + va_list va; + u8 *s; + + if (rv == VNET_DEV_OK) + return 0; + + va_start (va, fmt); + s = va_format (0, fmt, &va); + va_end (va); + + err = clib_error_return (0, "%s port %u: %U (%v)", port->dev->device_id, + port->port_id, format_vnet_dev_rv, rv, s); + vec_free (s); + return err; +} |