| 1 |
// SPDX-License-Identifier: GPL-2.0-only |
| 2 |
/* Copyright (C) 2025 Intel Corporation */ |
| 3 |
|
| 4 |
#include <linux/module.h> |
| 5 |
#include <linux/net/intel/libie/adminq.h> |
| 6 |
|
| 7 |
static const char * const libie_aq_str_arr[] = { |
| 8 |
#define LIBIE_AQ_STR(x) \ |
| 9 |
[LIBIE_AQ_RC_##x] = "LIBIE_AQ_RC_" #x |
| 10 |
LIBIE_AQ_STR(OK), |
| 11 |
LIBIE_AQ_STR(EPERM), |
| 12 |
LIBIE_AQ_STR(ENOENT), |
| 13 |
LIBIE_AQ_STR(ESRCH), |
| 14 |
LIBIE_AQ_STR(EIO), |
| 15 |
LIBIE_AQ_STR(EAGAIN), |
| 16 |
LIBIE_AQ_STR(ENOMEM), |
| 17 |
LIBIE_AQ_STR(EACCES), |
| 18 |
LIBIE_AQ_STR(EBUSY), |
| 19 |
LIBIE_AQ_STR(EEXIST), |
| 20 |
LIBIE_AQ_STR(EINVAL), |
| 21 |
LIBIE_AQ_STR(ENOSPC), |
| 22 |
LIBIE_AQ_STR(ENOSYS), |
| 23 |
LIBIE_AQ_STR(EMODE), |
| 24 |
LIBIE_AQ_STR(ENOSEC), |
| 25 |
LIBIE_AQ_STR(EBADSIG), |
| 26 |
LIBIE_AQ_STR(ESVN), |
| 27 |
LIBIE_AQ_STR(EBADMAN), |
| 28 |
LIBIE_AQ_STR(EBADBUF), |
| 29 |
#undef LIBIE_AQ_STR |
| 30 |
"LIBIE_AQ_RC_UNKNOWN", |
| 31 |
}; |
| 32 |
|
| 33 |
#define __LIBIE_AQ_STR_NUM (ARRAY_SIZE(libie_aq_str_arr) - 1) |
| 34 |
|
| 35 |
/** |
| 36 |
* libie_aq_str - get error string based on aq error |
| 37 |
* @err: admin queue error type |
| 38 |
* |
| 39 |
* Return: error string for passed error code |
| 40 |
*/ |
| 41 |
const char *libie_aq_str(enum libie_aq_err err) |
| 42 |
{ |
| 43 |
if (err >= ARRAY_SIZE(libie_aq_str_arr) || |
| 44 |
!libie_aq_str_arr[err]) |
| 45 |
err = __LIBIE_AQ_STR_NUM; |
| 46 |
|
| 47 |
return libie_aq_str_arr[err]; |
| 48 |
} |
| 49 |
EXPORT_SYMBOL_NS_GPL(libie_aq_str, "LIBIE_ADMINQ"); |
| 50 |
|
| 51 |
MODULE_DESCRIPTION("Intel(R) Ethernet common library - adminq helpers"); |
| 52 |
MODULE_LICENSE("GPL"); |