* [dpdk-dev] [PATCH] bb/turbo_sw: fix exported dynamic log type
@ 2018-02-05 23:33 Amr Mokhtar
0 siblings, 0 replies; only message in thread
From: Amr Mokhtar @ 2018-02-05 23:33 UTC (permalink / raw)
To: dev; +Cc: thomas, ferruh.yigit, Amr Mokhtar
This patch fixes shared library compilation due to undefined
reference to an exported variable 'bbdev_logtype'.
In this fix, the logtype is converted to static in the bbdev lib,
in bbdev null pmd and turbo sw pmd.
Fixes: b8cfe2c9aed2 ("bb/turbo_sw: add software turbo driver")
Cc: thomas@monjalon.net
Signed-off-by: Amr Mokhtar <amr.mokhtar@intel.com>
---
drivers/bbdev/null/bbdev_null.c | 30 +++--
drivers/bbdev/turbo_sw/bbdev_turbo_software.c | 95 +++++++++-------
lib/librte_bbdev/rte_bbdev.c | 154 +++++++++++++-------------
lib/librte_bbdev/rte_bbdev.h | 28 +----
lib/librte_bbdev/rte_bbdev_op.h | 68 +-----------
lib/librte_bbdev/rte_bbdev_version.map | 1 -
6 files changed, 156 insertions(+), 220 deletions(-)
diff --git a/drivers/bbdev/null/bbdev_null.c b/drivers/bbdev/null/bbdev_null.c
index b23d766..3b5482a 100644
--- a/drivers/bbdev/null/bbdev_null.c
+++ b/drivers/bbdev/null/bbdev_null.c
@@ -15,6 +15,13 @@
#define DRIVER_NAME bbdev_null
+/* NULL BBDev logging ID */
+static int bbdev_null_logtype;
+
+/* Helper macro for logging */
+#define BBDEV_NULL_LOG(level, fmt, ...) \
+ rte_log(RTE_LOG_ ## level, bbdev_null_logtype, fmt "\n", ##__VA_ARGS__)
+
/* Initialisation params structure that can be used by null BBDEV driver */
struct bbdev_null_params {
int socket_id; /*< Null BBDEV socket */
@@ -66,7 +73,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
dev_info->cpu_flag_reqs = NULL;
dev_info->min_alignment = 0;
- rte_bbdev_log_debug("got device info from %u", dev->data->dev_id);
+ BBDEV_NULL_LOG(DEBUG, "got device info from %u", dev->data->dev_id);
}
/* Release queue */
@@ -81,7 +88,7 @@ q_release(struct rte_bbdev *dev, uint16_t q_id)
dev->data->queues[q_id].queue_private = NULL;
}
- rte_bbdev_log_debug("released device queue %u:%u",
+ BBDEV_NULL_LOG(DEBUG, "released device queue %u:%u",
dev->data->dev_id, q_id);
return 0;
}
@@ -100,19 +107,19 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
q = rte_zmalloc_socket(RTE_STR(DRIVER_NAME), sizeof(*q),
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q == NULL) {
- rte_bbdev_log(ERR, "Failed to allocate queue memory");
+ BBDEV_NULL_LOG(ERR, "Failed to allocate queue memory");
return -ENOMEM;
}
q->processed_pkts = rte_ring_create(ring_name, queue_conf->queue_size,
queue_conf->socket, RING_F_SP_ENQ | RING_F_SC_DEQ);
if (q->processed_pkts == NULL) {
- rte_bbdev_log(ERR, "Failed to create ring");
+ BBDEV_NULL_LOG(ERR, "Failed to create ring");
goto free_q;
}
dev->data->queues[q_id].queue_private = q;
- rte_bbdev_log_debug("setup device queue %s", ring_name);
+ BBDEV_NULL_LOG(DEBUG, "setup device queue %s", ring_name);
return 0;
free_q:
@@ -194,7 +201,7 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
errno = 0;
result = strtoul(value, NULL, 0);
if ((result >= (1 << 16)) || (errno != 0)) {
- rte_bbdev_log(ERR, "Invalid value %lu for %s", result, key);
+ BBDEV_NULL_LOG(ERR, "Invalid value %lu for %s", result, key);
return -ERANGE;
}
*u16 = (uint16_t)result;
@@ -227,7 +234,7 @@ parse_bbdev_null_params(struct bbdev_null_params *params,
goto exit;
if (params->socket_id >= RTE_MAX_NUMA_NODES) {
- rte_bbdev_log(ERR, "Invalid socket, must be < %u",
+ BBDEV_NULL_LOG(ERR, "Invalid socket, must be < %u",
RTE_MAX_NUMA_NODES);
goto exit;
}
@@ -296,7 +303,7 @@ null_bbdev_probe(struct rte_vdev_device *vdev)
input_args = rte_vdev_device_args(vdev);
parse_bbdev_null_params(&init_params, input_args);
- rte_bbdev_log_debug("Init %s on NUMA node %d with max queues: %d",
+ BBDEV_NULL_LOG(DEBUG, "Init %s on NUMA node %d with max queues: %d",
name, init_params.socket_id, init_params.queues_num);
return null_bbdev_create(vdev, &init_params);
@@ -335,12 +342,11 @@ RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
BBDEV_NULL_MAX_NB_QUEUES_ARG"=<int> "
BBDEV_NULL_SOCKET_ID_ARG"=<int>");
-int bbdev_logtype;
RTE_INIT(null_bbdev_init_log);
static void
null_bbdev_init_log(void)
{
- bbdev_logtype = rte_log_register("pmd.bbdev.null");
- if (bbdev_logtype >= 0)
- rte_log_set_level(bbdev_logtype, RTE_LOG_NOTICE);
+ bbdev_null_logtype = rte_log_register("pmd.bbdev.null");
+ if (bbdev_null_logtype >= 0)
+ rte_log_set_level(bbdev_null_logtype, RTE_LOG_NOTICE);
}
diff --git a/drivers/bbdev/turbo_sw/bbdev_turbo_software.c b/drivers/bbdev/turbo_sw/bbdev_turbo_software.c
index 981da6e..4b5a611 100644
--- a/drivers/bbdev/turbo_sw/bbdev_turbo_software.c
+++ b/drivers/bbdev/turbo_sw/bbdev_turbo_software.c
@@ -46,6 +46,14 @@ static const char * const turbo_sw_valid_params[] = {
TURBO_SW_SOCKET_ID_ARG
};
+/* Turbo SW PMD logging ID */
+static int bbdev_turbo_sw_logtype;
+
+/* Helper macro for logging */
+#define BBDEV_TURBO_SW_LOG(level, fmt, ...) \
+ rte_log(RTE_LOG_ ## level, bbdev_turbo_sw_logtype, fmt "\n", \
+ ##__VA_ARGS__)
+
/* queue */
struct turbo_sw_queue {
/* Ring for processed (encoded/decoded) operations which are ready to
@@ -168,7 +176,8 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
dev_info->cpu_flag_reqs = &cpu_flag;
dev_info->min_alignment = 64;
- rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id);
+ BBDEV_TURBO_SW_LOG(DEBUG, "got device info from %u\n",
+ dev->data->dev_id);
}
/* Release queue */
@@ -190,7 +199,7 @@ q_release(struct rte_bbdev *dev, uint16_t q_id)
dev->data->queues[q_id].queue_private = NULL;
}
- rte_bbdev_log_debug("released device queue %u:%u",
+ BBDEV_TURBO_SW_LOG(DEBUG, "released device queue %u:%u",
dev->data->dev_id, q_id);
return 0;
}
@@ -208,7 +217,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
q = rte_zmalloc_socket(RTE_STR(DRIVER_NAME), sizeof(*q),
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q == NULL) {
- rte_bbdev_log(ERR, "Failed to allocate queue memory");
+ BBDEV_TURBO_SW_LOG(ERR, "Failed to allocate queue memory");
return -ENOMEM;
}
@@ -216,7 +225,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
ret = snprintf(name, RTE_RING_NAMESIZE, RTE_STR(DRIVER_NAME)"_enc_out%u:%u",
dev->data->dev_id, q_id);
if ((ret < 0) || (ret >= (int)RTE_RING_NAMESIZE)) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Creating queue name for device %u queue %u failed",
dev->data->dev_id, q_id);
return -ENAMETOOLONG;
@@ -225,7 +234,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
((MAX_TB_SIZE >> 3) + 3) * sizeof(*q->enc_out) * 3,
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q->enc_out == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Failed to allocate queue memory for %s", name);
goto free_q;
}
@@ -235,7 +244,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
RTE_STR(DRIVER_NAME)"_enc_in%u:%u", dev->data->dev_id,
q_id);
if ((ret < 0) || (ret >= (int)RTE_RING_NAMESIZE)) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Creating queue name for device %u queue %u failed",
dev->data->dev_id, q_id);
return -ENAMETOOLONG;
@@ -244,7 +253,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
(MAX_CB_SIZE >> 3) * sizeof(*q->enc_in),
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q->enc_in == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Failed to allocate queue memory for %s", name);
goto free_q;
}
@@ -253,7 +262,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
ret = snprintf(name, RTE_RING_NAMESIZE, RTE_STR(DRIVER_NAME)"_ag%u:%u",
dev->data->dev_id, q_id);
if ((ret < 0) || (ret >= (int)RTE_RING_NAMESIZE)) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Creating queue name for device %u queue %u failed",
dev->data->dev_id, q_id);
return -ENAMETOOLONG;
@@ -262,7 +271,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
MAX_CB_SIZE * 10 * sizeof(*q->ag),
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q->ag == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Failed to allocate queue memory for %s", name);
goto free_q;
}
@@ -271,7 +280,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
ret = snprintf(name, RTE_RING_NAMESIZE, RTE_STR(DRIVER_NAME)"_cb%u:%u",
dev->data->dev_id, q_id);
if ((ret < 0) || (ret >= (int)RTE_RING_NAMESIZE)) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Creating queue name for device %u queue %u failed",
dev->data->dev_id, q_id);
return -ENAMETOOLONG;
@@ -280,7 +289,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
(6144 >> 3) * sizeof(*q->code_block),
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q->code_block == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Failed to allocate queue memory for %s", name);
goto free_q;
}
@@ -290,7 +299,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
RTE_STR(DRIVER_NAME)"_deint_input%u:%u",
dev->data->dev_id, q_id);
if ((ret < 0) || (ret >= (int)RTE_RING_NAMESIZE)) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Creating queue name for device %u queue %u failed",
dev->data->dev_id, q_id);
return -ENAMETOOLONG;
@@ -299,7 +308,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
MAX_KW * sizeof(*q->deint_input),
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q->deint_input == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Failed to allocate queue memory for %s", name);
goto free_q;
}
@@ -309,7 +318,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
RTE_STR(DRIVER_NAME)"_deint_output%u:%u",
dev->data->dev_id, q_id);
if ((ret < 0) || (ret >= (int)RTE_RING_NAMESIZE)) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Creating queue name for device %u queue %u failed",
dev->data->dev_id, q_id);
return -ENAMETOOLONG;
@@ -318,7 +327,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
MAX_KW * sizeof(*q->deint_output),
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q->deint_output == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Failed to allocate queue memory for %s", name);
goto free_q;
}
@@ -328,7 +337,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
RTE_STR(DRIVER_NAME)"_adapter_output%u:%u",
dev->data->dev_id, q_id);
if ((ret < 0) || (ret >= (int)RTE_RING_NAMESIZE)) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Creating queue name for device %u queue %u failed",
dev->data->dev_id, q_id);
return -ENAMETOOLONG;
@@ -337,7 +346,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
MAX_CB_SIZE * 6 * sizeof(*q->adapter_output),
RTE_CACHE_LINE_SIZE, queue_conf->socket);
if (q->adapter_output == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Failed to allocate queue memory for %s", name);
goto free_q;
}
@@ -346,7 +355,7 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
ret = snprintf(name, RTE_RING_NAMESIZE, RTE_STR(DRIVER_NAME)"%u:%u",
dev->data->dev_id, q_id);
if ((ret < 0) || (ret >= (int)RTE_RING_NAMESIZE)) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Creating queue name for device %u queue %u failed",
dev->data->dev_id, q_id);
return -ENAMETOOLONG;
@@ -354,14 +363,14 @@ q_setup(struct rte_bbdev *dev, uint16_t q_id,
q->processed_pkts = rte_ring_create(name, queue_conf->queue_size,
queue_conf->socket, RING_F_SP_ENQ | RING_F_SC_DEQ);
if (q->processed_pkts == NULL) {
- rte_bbdev_log(ERR, "Failed to create ring for %s", name);
+ BBDEV_TURBO_SW_LOG(ERR, "Failed to create ring for %s", name);
goto free_q;
}
q->type = queue_conf->op_type;
dev->data->queues[q_id].queue_private = q;
- rte_bbdev_log_debug("setup device queue %s", name);
+ BBDEV_TURBO_SW_LOG(DEBUG, "setup device queue %s", name);
return 0;
free_q:
@@ -391,19 +400,19 @@ is_enc_input_valid(const uint16_t k, const int32_t k_idx,
const uint16_t in_length)
{
if (k_idx < 0) {
- rte_bbdev_log(ERR, "K Index is invalid");
+ BBDEV_TURBO_SW_LOG(ERR, "K Index is invalid");
return -1;
}
if (in_length - (k >> 3) < 0) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Mismatch between input length (%u bytes) and K (%u bits)",
in_length, k);
return -1;
}
if (k > MAX_CB_SIZE) {
- rte_bbdev_log(ERR, "CB size (%u) is too big, max: %d",
+ BBDEV_TURBO_SW_LOG(ERR, "CB size (%u) is too big, max: %d",
k, MAX_CB_SIZE);
return -1;
}
@@ -418,19 +427,19 @@ static inline int
is_dec_input_valid(int32_t k_idx, int16_t kw, int16_t in_length)
{
if (k_idx < 0) {
- rte_bbdev_log(ERR, "K index is invalid");
+ BBDEV_TURBO_SW_LOG(ERR, "K index is invalid");
return -1;
}
if (in_length - kw < 0) {
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Mismatch between input length (%u) and kw (%u)",
in_length, kw);
return -1;
}
if (kw > MAX_KW) {
- rte_bbdev_log(ERR, "Input length (%u) is too big, max: %d",
+ BBDEV_TURBO_SW_LOG(ERR, "Input length (%u) is too big, max: %d",
kw, MAX_KW);
return -1;
}
@@ -523,7 +532,7 @@ process_enc_cb(struct turbo_sw_queue *q, struct rte_bbdev_enc_op *op,
turbo_resp.output_win_2 = out2;
if (bblib_turbo_encoder(&turbo_req, &turbo_resp) != 0) {
op->status |= 1 << RTE_BBDEV_DRV_ERROR;
- rte_bbdev_log(ERR, "Turbo Encoder failed");
+ BBDEV_TURBO_SW_LOG(ERR, "Turbo Encoder failed");
return;
}
@@ -578,7 +587,7 @@ process_enc_cb(struct turbo_sw_queue *q, struct rte_bbdev_enc_op *op,
if (bblib_rate_match_dl(&rm_req, &rm_resp) != 0) {
op->status |= 1 << RTE_BBDEV_DRV_ERROR;
- rte_bbdev_log(ERR, "Rate matching failed");
+ BBDEV_TURBO_SW_LOG(ERR, "Rate matching failed");
return;
}
enc->output.length += rm_resp.OutputLen;
@@ -641,14 +650,14 @@ enqueue_enc_one_op(struct turbo_sw_queue *q, struct rte_bbdev_enc_op *op)
op->status = 0;
if (total_left > MAX_TB_SIZE >> 3) {
- rte_bbdev_log(ERR, "TB size (%u) is too big, max: %d",
+ BBDEV_TURBO_SW_LOG(ERR, "TB size (%u) is too big, max: %d",
total_left, MAX_TB_SIZE);
op->status = 1 << RTE_BBDEV_DATA_ERROR;
return;
}
if (m_in == NULL || m_out == NULL) {
- rte_bbdev_log(ERR, "Invalid mbuf pointer");
+ BBDEV_TURBO_SW_LOG(ERR, "Invalid mbuf pointer");
op->status = 1 << RTE_BBDEV_DATA_ERROR;
return;
}
@@ -695,7 +704,7 @@ enqueue_enc_one_op(struct turbo_sw_queue *q, struct rte_bbdev_enc_op *op)
/* check if all input data was processed */
if (total_left != 0) {
op->status |= 1 << RTE_BBDEV_DATA_ERROR;
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Mismatch between mbuf length and included CBs sizes");
}
}
@@ -859,7 +868,7 @@ process_dec_cb(struct turbo_sw_queue *q, struct rte_bbdev_dec_op *op,
adapter_req.isinverted = 0;
else {
op->status |= 1 << RTE_BBDEV_DRV_ERROR;
- rte_bbdev_log(ERR, "LLR format wasn't specified");
+ BBDEV_TURBO_SW_LOG(ERR, "LLR format wasn't specified");
return;
}
@@ -871,7 +880,7 @@ process_dec_cb(struct turbo_sw_queue *q, struct rte_bbdev_dec_op *op,
out = (uint8_t *)rte_pktmbuf_append(m_out, (k >> 3));
if (out == NULL) {
op->status |= 1 << RTE_BBDEV_DATA_ERROR;
- rte_bbdev_log(ERR, "Too little space in output mbuf");
+ BBDEV_TURBO_SW_LOG(ERR, "Too little space in output mbuf");
return;
}
/* rte_bbdev_op_data.offset can be different than the offset of the
@@ -898,7 +907,7 @@ process_dec_cb(struct turbo_sw_queue *q, struct rte_bbdev_dec_op *op,
dec->iter_count = RTE_MAX(iter_cnt, dec->iter_count);
} else {
op->status |= 1 << RTE_BBDEV_DATA_ERROR;
- rte_bbdev_log(ERR, "Turbo Decoder failed");
+ BBDEV_TURBO_SW_LOG(ERR, "Turbo Decoder failed");
return;
}
}
@@ -919,7 +928,7 @@ enqueue_dec_one_op(struct turbo_sw_queue *q, struct rte_bbdev_dec_op *op)
op->status = 0;
if (m_in == NULL || m_out == NULL) {
- rte_bbdev_log(ERR, "Invalid mbuf pointer");
+ BBDEV_TURBO_SW_LOG(ERR, "Invalid mbuf pointer");
op->status = 1 << RTE_BBDEV_DATA_ERROR;
return;
}
@@ -965,7 +974,7 @@ enqueue_dec_one_op(struct turbo_sw_queue *q, struct rte_bbdev_dec_op *op)
}
if (total_left != 0) {
op->status |= 1 << RTE_BBDEV_DATA_ERROR;
- rte_bbdev_log(ERR,
+ BBDEV_TURBO_SW_LOG(ERR,
"Mismatch between mbuf length and included Circular buffer sizes");
}
}
@@ -1055,7 +1064,8 @@ parse_u16_arg(const char *key, const char *value, void *extra_args)
errno = 0;
result = strtoul(value, NULL, 0);
if ((result >= (1 << 16)) || (errno != 0)) {
- rte_bbdev_log(ERR, "Invalid value %lu for %s", result, key);
+ BBDEV_TURBO_SW_LOG(ERR, "Invalid value %lu for %s",
+ result, key);
return -ERANGE;
}
*u16 = (uint16_t)result;
@@ -1087,7 +1097,7 @@ parse_turbo_sw_params(struct turbo_sw_params *params, const char *input_args)
goto exit;
if (params->socket_id >= RTE_MAX_NUMA_NODES) {
- rte_bbdev_log(ERR, "Invalid socket, must be < %u",
+ BBDEV_TURBO_SW_LOG(ERR, "Invalid socket, must be < %u",
RTE_MAX_NUMA_NODES);
goto exit;
}
@@ -1155,7 +1165,7 @@ turbo_sw_bbdev_probe(struct rte_vdev_device *vdev)
input_args = rte_vdev_device_args(vdev);
parse_turbo_sw_params(&init_params, input_args);
- rte_bbdev_log_debug(
+ BBDEV_TURBO_SW_LOG(DEBUG,
"Initialising %s on NUMA node %d with max queues: %d\n",
name, init_params.socket_id, init_params.queues_num);
@@ -1195,12 +1205,11 @@ RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME,
TURBO_SW_MAX_NB_QUEUES_ARG"=<int> "
TURBO_SW_SOCKET_ID_ARG"=<int>");
-int bbdev_logtype;
RTE_INIT(null_bbdev_init_log);
static void
null_bbdev_init_log(void)
{
- bbdev_logtype = rte_log_register("pmd.bbdev.turbo_sw");
- if (bbdev_logtype >= 0)
- rte_log_set_level(bbdev_logtype, RTE_LOG_NOTICE);
+ bbdev_turbo_sw_logtype = rte_log_register("pmd.bbdev.turbo_sw");
+ if (bbdev_turbo_sw_logtype >= 0)
+ rte_log_set_level(bbdev_turbo_sw_logtype, RTE_LOG_NOTICE);
}
diff --git a/lib/librte_bbdev/rte_bbdev.c b/lib/librte_bbdev/rte_bbdev.c
index 8a053e3..17a00d0 100644
--- a/lib/librte_bbdev/rte_bbdev.c
+++ b/lib/librte_bbdev/rte_bbdev.c
@@ -27,10 +27,17 @@
#define DEV_NAME "BBDEV"
+/* BBDev library logging ID */
+static int bbdev_logtype;
+
+/* Helper macro for logging */
+#define BBDEV_LOG(level, fmt, ...) \
+ rte_log(RTE_LOG_ ## level, bbdev_logtype, fmt "\n", ##__VA_ARGS__)
+
/* Helper macro to check dev_id is valid */
#define VALID_DEV_OR_RET_ERR(dev, dev_id) do { \
if (dev == NULL) { \
- rte_bbdev_log(ERR, "device %u is invalid", dev_id); \
+ BBDEV_LOG(ERR, "device %u is invalid", dev_id); \
return -ENODEV; \
} \
} while (0)
@@ -38,7 +45,7 @@
/* Helper macro to check dev_ops is valid */
#define VALID_DEV_OPS_OR_RET_ERR(dev, dev_id) do { \
if (dev->dev_ops == NULL) { \
- rte_bbdev_log(ERR, "NULL dev_ops structure in device %u", \
+ BBDEV_LOG(ERR, "NULL dev_ops structure in device %u", \
dev_id); \
return -ENODEV; \
} \
@@ -47,7 +54,7 @@
/* Helper macro to check that driver implements required function pointer */
#define VALID_FUNC_OR_RET_ERR(func, dev_id) do { \
if (func == NULL) { \
- rte_bbdev_log(ERR, "device %u does not support %s", \
+ BBDEV_LOG(ERR, "device %u does not support %s", \
dev_id, #func); \
return -ENOTSUP; \
} \
@@ -56,7 +63,7 @@
/* Helper macro to check that queue is valid */
#define VALID_QUEUE_OR_RET_ERR(queue_id, dev) do { \
if (queue_id >= dev->data->num_queues) { \
- rte_bbdev_log(ERR, "Invalid queue_id %u for device %u", \
+ BBDEV_LOG(ERR, "Invalid queue_id %u for device %u", \
queue_id, dev->data->dev_id); \
return -ERANGE; \
} \
@@ -113,7 +120,7 @@ rte_bbdev_data_alloc(void)
} else
mz = rte_memzone_lookup(MZ_RTE_BBDEV_DATA);
if (mz == NULL) {
- rte_bbdev_log(CRIT,
+ BBDEV_LOG(CRIT,
"Cannot allocate memzone for bbdev port data");
return -ENOMEM;
}
@@ -168,18 +175,18 @@ rte_bbdev_allocate(const char *name)
uint16_t dev_id;
if (name == NULL) {
- rte_bbdev_log(ERR, "Invalid null device name");
+ BBDEV_LOG(ERR, "Invalid null device name");
return NULL;
}
if (rte_bbdev_get_named_dev(name) != NULL) {
- rte_bbdev_log(ERR, "Device \"%s\" is already allocated", name);
+ BBDEV_LOG(ERR, "Device \"%s\" is already allocated", name);
return NULL;
}
dev_id = find_free_dev_id();
if (dev_id == RTE_BBDEV_MAX_DEVS) {
- rte_bbdev_log(ERR, "Reached maximum number of devices");
+ BBDEV_LOG(ERR, "Reached maximum number of devices");
return NULL;
}
@@ -193,7 +200,7 @@ rte_bbdev_allocate(const char *name)
bbdev->data = find_bbdev_data(name);
if (bbdev->data == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Max BBDevs already allocated in multi-process environment!");
return NULL;
}
@@ -204,7 +211,7 @@ rte_bbdev_allocate(const char *name)
ret = snprintf(bbdev->data->name, RTE_BBDEV_NAME_MAX_LEN, "%s", name);
if ((ret < 0) || (ret >= RTE_BBDEV_NAME_MAX_LEN)) {
- rte_bbdev_log(ERR, "Copying device name \"%s\" failed", name);
+ BBDEV_LOG(ERR, "Copying device name \"%s\" failed", name);
return NULL;
}
@@ -213,7 +220,8 @@ rte_bbdev_allocate(const char *name)
num_devs++;
- rte_bbdev_log_debug("Initialised device %s (id = %u). Num devices = %u",
+ BBDEV_LOG(DEBUG,
+ "Initialised device %s (id = %u). Num devices = %u",
name, dev_id, num_devs);
return bbdev;
@@ -226,7 +234,7 @@ rte_bbdev_release(struct rte_bbdev *bbdev)
struct rte_bbdev_callback *cb, *next;
if (bbdev == NULL) {
- rte_bbdev_log(ERR, "NULL bbdev");
+ BBDEV_LOG(ERR, "NULL bbdev");
return -ENODEV;
}
dev_id = bbdev->data->dev_id;
@@ -247,7 +255,7 @@ rte_bbdev_release(struct rte_bbdev *bbdev)
num_devs--;
bbdev->state = RTE_BBDEV_UNUSED;
- rte_bbdev_log_debug(
+ BBDEV_LOG(DEBUG,
"Un-initialised device id = %u. Num devices = %u",
dev_id, num_devs);
return 0;
@@ -259,7 +267,7 @@ rte_bbdev_get_named_dev(const char *name)
unsigned int i;
if (name == NULL) {
- rte_bbdev_log(ERR, "NULL driver name");
+ BBDEV_LOG(ERR, "NULL driver name");
return NULL;
}
@@ -310,7 +318,7 @@ rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
if (dev->data->started) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Device %u cannot be configured when started",
dev_id);
return -EBUSY;
@@ -322,7 +330,7 @@ rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
dev->dev_ops->info_get(dev, &dev_info);
if ((num_queues == 0) || (num_queues > dev_info.max_num_queues)) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Device %u supports 0 < N <= %u queues, not %u",
dev_id, dev_info.max_num_queues, num_queues);
return -EINVAL;
@@ -334,7 +342,7 @@ rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
for (i = 0; i < dev->data->num_queues; i++) {
int ret = dev->dev_ops->queue_release(dev, i);
if (ret < 0) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Device %u queue %u release failed",
dev_id, i);
return ret;
@@ -344,7 +352,7 @@ rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
if (dev->dev_ops->close) {
ret = dev->dev_ops->close(dev);
if (ret < 0) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Device %u couldn't be closed",
dev_id);
return ret;
@@ -358,7 +366,7 @@ rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
sizeof(dev->data->queues[0]), RTE_CACHE_LINE_SIZE,
dev->data->socket_id);
if (dev->data->queues == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"calloc of %u queues for device %u on socket %i failed",
num_queues, dev_id, dev->data->socket_id);
return -ENOMEM;
@@ -370,14 +378,14 @@ rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
if (dev->dev_ops->setup_queues) {
ret = dev->dev_ops->setup_queues(dev, num_queues, socket_id);
if (ret < 0) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Device %u memory configuration failed",
dev_id);
goto error;
}
}
- rte_bbdev_log_debug("Device %u set up with %u queues", dev_id,
+ BBDEV_LOG(DEBUG, "Device %u set up with %u queues", dev_id,
num_queues);
return 0;
@@ -398,7 +406,7 @@ rte_bbdev_intr_enable(uint16_t dev_id)
VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
if (dev->data->started) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Device %u cannot be configured when started",
dev_id);
return -EBUSY;
@@ -407,16 +415,16 @@ rte_bbdev_intr_enable(uint16_t dev_id)
if (dev->dev_ops->intr_enable) {
ret = dev->dev_ops->intr_enable(dev);
if (ret < 0) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Device %u interrupts configuration failed",
dev_id);
return ret;
}
- rte_bbdev_log_debug("Enabled interrupts for dev %u", dev_id);
+ BBDEV_LOG(DEBUG, "Enabled interrupts for dev %u", dev_id);
return 0;
}
- rte_bbdev_log(ERR, "Device %u doesn't support interrupts", dev_id);
+ BBDEV_LOG(ERR, "Device %u doesn't support interrupts", dev_id);
return -ENOTSUP;
}
@@ -437,7 +445,7 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
VALID_QUEUE_OR_RET_ERR(queue_id, dev);
if (dev->data->queues[queue_id].started || dev->data->started) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Queue %u of device %u cannot be configured when started",
queue_id, dev_id);
return -EBUSY;
@@ -467,24 +475,24 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
}
}
if (ret == 0) {
- rte_bbdev_log(ERR, "Invalid operation type");
+ BBDEV_LOG(ERR, "Invalid operation type");
return -EINVAL;
}
if (conf->queue_size > dev_info.queue_size_lim) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Size (%u) of queue %u of device %u must be: <= %u",
conf->queue_size, queue_id, dev_id,
dev_info.queue_size_lim);
return -EINVAL;
}
if (!rte_is_power_of_2(conf->queue_size)) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Size (%u) of queue %u of device %u must be a power of 2",
conf->queue_size, queue_id, dev_id);
return -EINVAL;
}
if (conf->priority > dev_info.max_queue_priority) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Priority (%u) of queue %u of bdev %u must be <= %u",
conf->priority, queue_id, dev_id,
dev_info.max_queue_priority);
@@ -496,7 +504,7 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
if (dev->data->queues[queue_id].queue_private != NULL) {
ret = dev->dev_ops->queue_release(dev, queue_id);
if (ret < 0) {
- rte_bbdev_log(ERR, "Device %u queue %u release failed",
+ BBDEV_LOG(ERR, "Device %u queue %u release failed",
dev_id, queue_id);
return ret;
}
@@ -506,7 +514,7 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
ret = dev->dev_ops->queue_setup(dev, queue_id, (conf != NULL) ?
conf : &dev_info.default_queue_conf);
if (ret < 0) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Device %u queue %u setup failed", dev_id,
queue_id);
return ret;
@@ -522,7 +530,7 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
if (op_type_str == NULL)
return -EINVAL;
- rte_bbdev_log_debug("Configured dev%uq%u (size=%u, type=%s, prio=%u)",
+ BBDEV_LOG(DEBUG, "Configured dev%uq%u (size=%u, type=%s, prio=%u)",
dev_id, queue_id, stored_conf->queue_size, op_type_str,
stored_conf->priority);
@@ -539,14 +547,14 @@ rte_bbdev_start(uint16_t dev_id)
VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
if (dev->data->started) {
- rte_bbdev_log_debug("Device %u is already started", dev_id);
+ BBDEV_LOG(DEBUG, "Device %u is already started", dev_id);
return 0;
}
if (dev->dev_ops->start) {
int ret = dev->dev_ops->start(dev);
if (ret < 0) {
- rte_bbdev_log(ERR, "Device %u start failed", dev_id);
+ BBDEV_LOG(ERR, "Device %u start failed", dev_id);
return ret;
}
}
@@ -557,7 +565,7 @@ rte_bbdev_start(uint16_t dev_id)
dev->data->queues[i].started = true;
dev->data->started = true;
- rte_bbdev_log_debug("Started device %u", dev_id);
+ BBDEV_LOG(DEBUG, "Started device %u", dev_id);
return 0;
}
@@ -570,7 +578,7 @@ rte_bbdev_stop(uint16_t dev_id)
VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
if (!dev->data->started) {
- rte_bbdev_log_debug("Device %u is already stopped", dev_id);
+ BBDEV_LOG(DEBUG, "Device %u is already stopped", dev_id);
return 0;
}
@@ -578,7 +586,7 @@ rte_bbdev_stop(uint16_t dev_id)
dev->dev_ops->stop(dev);
dev->data->started = false;
- rte_bbdev_log_debug("Stopped device %u", dev_id);
+ BBDEV_LOG(DEBUG, "Stopped device %u", dev_id);
return 0;
}
@@ -595,7 +603,7 @@ rte_bbdev_close(uint16_t dev_id)
if (dev->data->started) {
ret = rte_bbdev_stop(dev_id);
if (ret < 0) {
- rte_bbdev_log(ERR, "Device %u stop failed", dev_id);
+ BBDEV_LOG(ERR, "Device %u stop failed", dev_id);
return ret;
}
}
@@ -604,7 +612,7 @@ rte_bbdev_close(uint16_t dev_id)
for (i = 0; i < dev->data->num_queues; i++) {
ret = dev->dev_ops->queue_release(dev, i);
if (ret < 0) {
- rte_bbdev_log(ERR, "Device %u queue %u release failed",
+ BBDEV_LOG(ERR, "Device %u queue %u release failed",
dev_id, i);
return ret;
}
@@ -614,7 +622,7 @@ rte_bbdev_close(uint16_t dev_id)
if (dev->dev_ops->close) {
ret = dev->dev_ops->close(dev);
if (ret < 0) {
- rte_bbdev_log(ERR, "Device %u close failed", dev_id);
+ BBDEV_LOG(ERR, "Device %u close failed", dev_id);
return ret;
}
}
@@ -623,7 +631,7 @@ rte_bbdev_close(uint16_t dev_id)
dev->data->queues = NULL;
dev->data->num_queues = 0;
- rte_bbdev_log_debug("Closed device %u", dev_id);
+ BBDEV_LOG(DEBUG, "Closed device %u", dev_id);
return 0;
}
@@ -638,7 +646,7 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id)
VALID_QUEUE_OR_RET_ERR(queue_id, dev);
if (dev->data->queues[queue_id].started) {
- rte_bbdev_log_debug("Queue %u of device %u already started",
+ BBDEV_LOG(DEBUG, "Queue %u of device %u already started",
queue_id, dev_id);
return 0;
}
@@ -646,14 +654,14 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id)
if (dev->dev_ops->queue_start) {
int ret = dev->dev_ops->queue_start(dev, queue_id);
if (ret < 0) {
- rte_bbdev_log(ERR, "Device %u queue %u start failed",
+ BBDEV_LOG(ERR, "Device %u queue %u start failed",
dev_id, queue_id);
return ret;
}
}
dev->data->queues[queue_id].started = true;
- rte_bbdev_log_debug("Started queue %u of device %u", queue_id, dev_id);
+ BBDEV_LOG(DEBUG, "Started queue %u of device %u", queue_id, dev_id);
return 0;
}
@@ -668,7 +676,7 @@ rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id)
VALID_QUEUE_OR_RET_ERR(queue_id, dev);
if (!dev->data->queues[queue_id].started) {
- rte_bbdev_log_debug("Queue %u of device %u already stopped",
+ BBDEV_LOG(DEBUG, "Queue %u of device %u already stopped",
queue_id, dev_id);
return 0;
}
@@ -676,14 +684,14 @@ rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id)
if (dev->dev_ops->queue_stop) {
int ret = dev->dev_ops->queue_stop(dev, queue_id);
if (ret < 0) {
- rte_bbdev_log(ERR, "Device %u queue %u stop failed",
+ BBDEV_LOG(ERR, "Device %u queue %u stop failed",
dev_id, queue_id);
return ret;
}
}
dev->data->queues[queue_id].started = false;
- rte_bbdev_log_debug("Stopped queue %u of device %u", queue_id, dev_id);
+ BBDEV_LOG(DEBUG, "Stopped queue %u of device %u", queue_id, dev_id);
return 0;
}
@@ -701,7 +709,7 @@ get_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats)
stats->enqueue_err_count += q_stats->enqueue_err_count;
stats->dequeue_err_count += q_stats->dequeue_err_count;
}
- rte_bbdev_log_debug("Got stats on %u", dev->data->dev_id);
+ BBDEV_LOG(DEBUG, "Got stats on %u", dev->data->dev_id);
}
static void
@@ -714,7 +722,7 @@ reset_stats_in_queues(struct rte_bbdev *dev)
memset(q_stats, 0, sizeof(*q_stats));
}
- rte_bbdev_log_debug("Reset stats on %u", dev->data->dev_id);
+ BBDEV_LOG(DEBUG, "Reset stats on %u", dev->data->dev_id);
}
int
@@ -726,7 +734,7 @@ rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats)
VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
if (stats == NULL) {
- rte_bbdev_log(ERR, "NULL stats structure");
+ BBDEV_LOG(ERR, "NULL stats structure");
return -EINVAL;
}
@@ -736,7 +744,7 @@ rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats)
else
get_stats_from_queues(dev, stats);
- rte_bbdev_log_debug("Retrieved stats of device %u", dev_id);
+ BBDEV_LOG(DEBUG, "Retrieved stats of device %u", dev_id);
return 0;
}
@@ -753,7 +761,7 @@ rte_bbdev_stats_reset(uint16_t dev_id)
else
reset_stats_in_queues(dev);
- rte_bbdev_log_debug("Reset stats of device %u", dev_id);
+ BBDEV_LOG(DEBUG, "Reset stats of device %u", dev_id);
return 0;
}
@@ -766,7 +774,7 @@ rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info)
VALID_FUNC_OR_RET_ERR(dev->dev_ops->info_get, dev_id);
if (dev_info == NULL) {
- rte_bbdev_log(ERR, "NULL dev info structure");
+ BBDEV_LOG(ERR, "NULL dev info structure");
return -EINVAL;
}
@@ -781,7 +789,7 @@ rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info)
/* Copy data maintained by device driver layer */
dev->dev_ops->info_get(dev, &dev_info->drv);
- rte_bbdev_log_debug("Retrieved info of device %u", dev_id);
+ BBDEV_LOG(DEBUG, "Retrieved info of device %u", dev_id);
return 0;
}
@@ -795,7 +803,7 @@ rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id,
VALID_QUEUE_OR_RET_ERR(queue_id, dev);
if (queue_info == NULL) {
- rte_bbdev_log(ERR, "NULL queue info structure");
+ BBDEV_LOG(ERR, "NULL queue info structure");
return -EINVAL;
}
@@ -804,7 +812,7 @@ rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id,
queue_info->conf = dev->data->queues[queue_id].conf;
queue_info->started = dev->data->queues[queue_id].started;
- rte_bbdev_log_debug("Retrieved info of queue %u of device %u",
+ BBDEV_LOG(DEBUG, "Retrieved info of queue %u of device %u",
queue_id, dev_id);
return 0;
}
@@ -860,12 +868,12 @@ rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
const char *op_type_str;
if (name == NULL) {
- rte_bbdev_log(ERR, "NULL name for op pool");
+ BBDEV_LOG(ERR, "NULL name for op pool");
return NULL;
}
if (type >= RTE_BBDEV_OP_TYPE_COUNT) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Invalid op type (%u), should be less than %u",
type, RTE_BBDEV_OP_TYPE_COUNT);
return NULL;
@@ -875,7 +883,7 @@ rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
cache_size, sizeof(struct rte_bbdev_op_pool_private),
NULL, NULL, bbdev_op_init, &type, socket_id, 0);
if (mp == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Failed to create op pool %s (num ops=%u, op size=%u) with error: %s",
name, num_elements, get_bbdev_op_size(type),
rte_strerror(rte_errno));
@@ -886,7 +894,7 @@ rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
if (op_type_str == NULL)
return NULL;
- rte_bbdev_log_debug(
+ BBDEV_LOG(DEBUG,
"Op pool %s created for %u ops (type=%s, cache=%u, socket=%u, size=%u)",
name, num_elements, op_type_str, cache_size, socket_id,
get_bbdev_op_size(type));
@@ -906,14 +914,14 @@ rte_bbdev_callback_register(uint16_t dev_id, enum rte_bbdev_event_type event,
VALID_DEV_OR_RET_ERR(dev, dev_id);
if (event >= RTE_BBDEV_EVENT_MAX) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Invalid event type (%u), should be less than %u",
event, RTE_BBDEV_EVENT_MAX);
return -EINVAL;
}
if (cb_fn == NULL) {
- rte_bbdev_log(ERR, "NULL callback function");
+ BBDEV_LOG(ERR, "NULL callback function");
return -EINVAL;
}
@@ -952,14 +960,14 @@ rte_bbdev_callback_unregister(uint16_t dev_id, enum rte_bbdev_event_type event,
VALID_DEV_OR_RET_ERR(dev, dev_id);
if (event >= RTE_BBDEV_EVENT_MAX) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Invalid event type (%u), should be less than %u",
event, RTE_BBDEV_EVENT_MAX);
return -EINVAL;
}
if (cb_fn == NULL) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"NULL callback function cannot be unregistered");
return -EINVAL;
}
@@ -995,17 +1003,17 @@ rte_bbdev_pmd_callback_process(struct rte_bbdev *dev,
struct rte_bbdev_callback dev_cb;
if (dev == NULL) {
- rte_bbdev_log(ERR, "NULL device");
+ BBDEV_LOG(ERR, "NULL device");
return;
}
if (dev->data == NULL) {
- rte_bbdev_log(ERR, "NULL data structure");
+ BBDEV_LOG(ERR, "NULL data structure");
return;
}
if (event >= RTE_BBDEV_EVENT_MAX) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"Invalid event type (%u), should be less than %u",
event, RTE_BBDEV_EVENT_MAX);
return;
@@ -1065,12 +1073,12 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
intr_handle = dev->intr_handle;
if (!intr_handle || !intr_handle->intr_vec) {
- rte_bbdev_log(ERR, "Device %u intr handle unset\n", dev_id);
+ BBDEV_LOG(ERR, "Device %u intr handle unset\n", dev_id);
return -ENOTSUP;
}
if (queue_id >= RTE_MAX_RXTX_INTR_VEC_ID) {
- rte_bbdev_log(ERR, "Device %u queue_id %u is too big\n",
+ BBDEV_LOG(ERR, "Device %u queue_id %u is too big\n",
dev_id, queue_id);
return -ENOTSUP;
}
@@ -1078,7 +1086,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
vec = intr_handle->intr_vec[queue_id];
ret = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
if (ret && (ret != -EEXIST)) {
- rte_bbdev_log(ERR,
+ BBDEV_LOG(ERR,
"dev %u q %u int ctl error op %d epfd %d vec %u\n",
dev_id, queue_id, op, epfd, vec);
return ret;
@@ -1100,13 +1108,11 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
if (op_type < RTE_BBDEV_OP_TYPE_COUNT)
return op_types[op_type];
- rte_bbdev_log(ERR, "Invalid operation type");
+ BBDEV_LOG(ERR, "Invalid operation type");
return NULL;
}
-int bbdev_logtype;
-
RTE_INIT(rte_bbdev_init_log);
static void
rte_bbdev_init_log(void)
diff --git a/lib/librte_bbdev/rte_bbdev.h b/lib/librte_bbdev/rte_bbdev.h
index 37a0d05..3a8f97f 100644
--- a/lib/librte_bbdev/rte_bbdev.h
+++ b/lib/librte_bbdev/rte_bbdev.h
@@ -462,12 +462,7 @@ rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id,
{
struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
- uint16_t n = dev->enqueue_enc_ops(q_data, ops, num_ops);
-
- rte_bbdev_log_verbose("%u encode ops enqueued to dev%u,q%u.\n",
- num_ops, dev_id, queue_id);
-
- return n;
+ return dev->enqueue_enc_ops(q_data, ops, num_ops);
}
/**
@@ -497,12 +492,7 @@ rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
{
struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
- uint16_t n = dev->enqueue_dec_ops(q_data, ops, num_ops);
-
- rte_bbdev_log_verbose("%u decode ops enqueued to dev%u,q%u.\n",
- num_ops, dev_id, queue_id);
-
- return n;
+ return dev->enqueue_dec_ops(q_data, ops, num_ops);
}
/**
@@ -532,12 +522,7 @@ rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id,
{
struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
- uint16_t n = dev->dequeue_enc_ops(q_data, ops, num_ops);
-
- rte_bbdev_log_verbose("%u encode ops dequeued to dev%u,q%u\n",
- n, dev_id, queue_id);
-
- return n;
+ return dev->dequeue_enc_ops(q_data, ops, num_ops);
}
/**
@@ -568,12 +553,7 @@ rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id,
{
struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
- uint16_t n = dev->dequeue_dec_ops(q_data, ops, num_ops);
-
- rte_bbdev_log_verbose("%u decode ops dequeued to dev%u,q%u\n",
- n, dev_id, queue_id);
-
- return n;
+ return dev->dequeue_dec_ops(q_data, ops, num_ops);
}
/** Definitions of device event types */
diff --git a/lib/librte_bbdev/rte_bbdev_op.h b/lib/librte_bbdev/rte_bbdev_op.h
index c0c7d73..9a80c64 100644
--- a/lib/librte_bbdev/rte_bbdev_op.h
+++ b/lib/librte_bbdev/rte_bbdev_op.h
@@ -27,58 +27,6 @@ extern "C" {
#define RTE_BBDEV_MAX_CODE_BLOCKS 64
-extern int bbdev_logtype;
-
-/**
- * Helper macro for logging
- *
- * @param level
- * Log level: EMERG, ALERT, CRIT, ERR, WARNING, NOTICE, INFO, or DEBUG
- * @param fmt
- * The format string, as in printf(3).
- * @param ...
- * The variable arguments required by the format string.
- *
- * @return
- * - 0 on success
- * - Negative on error
- */
-#define rte_bbdev_log(level, fmt, ...) \
- rte_log(RTE_LOG_ ## level, bbdev_logtype, fmt "\n", ##__VA_ARGS__)
-
-/**
- * Helper macro for debug logging with extra source info
- *
- * @param fmt
- * The format string, as in printf(3).
- * @param ...
- * The variable arguments required by the format string.
- *
- * @return
- * - 0 on success
- * - Negative on error
- */
-#define rte_bbdev_log_debug(fmt, ...) \
- rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \
- ##__VA_ARGS__)
-
-/**
- * Helper macro for extra conditional logging from datapath
- *
- * @param fmt
- * The format string, as in printf(3).
- * @param ...
- * The variable arguments required by the format string.
- *
- * @return
- * - 0 on success
- * - Negative on error
- */
-#define rte_bbdev_log_verbose(fmt, ...) \
- (void)((RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL) ? \
- rte_log(RTE_LOG_DEBUG, \
- bbdev_logtype, ": " fmt "\n", ##__VA_ARGS__) : 0)
-
/** Flags for turbo decoder operation and capability structure */
enum rte_bbdev_op_td_flag_bitmasks {
/**< If sub block de-interleaving is to be performed. */
@@ -547,9 +495,6 @@ rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool,
if (unlikely(ret < 0))
return ret;
- rte_bbdev_log_verbose("%u encode ops allocated from %s\n",
- num_ops, mempool->name);
-
return 0;
}
@@ -585,9 +530,6 @@ rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool,
if (unlikely(ret < 0))
return ret;
- rte_bbdev_log_verbose("%u encode ops allocated from %s\n",
- num_ops, mempool->name);
-
return 0;
}
@@ -604,11 +546,8 @@ rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool,
static inline void
rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
{
- if (num_ops > 0) {
+ if (num_ops > 0)
rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
- rte_bbdev_log_verbose("%u decode ops freed to %s\n", num_ops,
- ops[0]->mempool->name);
- }
}
/**
@@ -624,11 +563,8 @@ rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
static inline void
rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
{
- if (num_ops > 0) {
+ if (num_ops > 0)
rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
- rte_bbdev_log_verbose("%u encode ops freed to %s\n", num_ops,
- ops[0]->mempool->name);
- }
}
#ifdef __cplusplus
diff --git a/lib/librte_bbdev/rte_bbdev_version.map b/lib/librte_bbdev/rte_bbdev_version.map
index 737c339..d3b81ea 100644
--- a/lib/librte_bbdev/rte_bbdev_version.map
+++ b/lib/librte_bbdev/rte_bbdev_version.map
@@ -1,7 +1,6 @@
EXPERIMENTAL {
global:
- bbdev_logtype;
rte_bbdev_allocate;
rte_bbdev_callback_register;
rte_bbdev_callback_unregister;
--
2.7.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-05 23:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 23:33 [dpdk-dev] [PATCH] bb/turbo_sw: fix exported dynamic log type Amr Mokhtar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).