X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_bbdev%2Frte_bbdev.c;h=f6fe05acafdb718802349c406f93b0a7d1c9fd7b;hb=0944e1e6801b8231eac0b1de8eac62ab85236f9f;hp=8a053e3d692be945d3063d9be4a07c4742f20f7f;hpb=4935e1e9f76e14e8b3420084d357c34bb397ef53;p=dpdk.git diff --git a/lib/librte_bbdev/rte_bbdev.c b/lib/librte_bbdev/rte_bbdev.c index 8a053e3d69..f6fe05acaf 100644 --- a/lib/librte_bbdev/rte_bbdev.c +++ b/lib/librte_bbdev/rte_bbdev.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -27,6 +28,17 @@ #define DEV_NAME "BBDEV" +/* BBDev library logging ID */ +static int bbdev_logtype; + +/* Helper macro for logging */ +#define rte_bbdev_log(level, fmt, ...) \ + rte_log(RTE_LOG_ ## level, bbdev_logtype, fmt "\n", ##__VA_ARGS__) + +#define rte_bbdev_log_debug(fmt, ...) \ + rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \ + ##__VA_ARGS__) + /* Helper macro to check dev_id is valid */ #define VALID_DEV_OR_RET_ERR(dev, dev_id) do { \ if (dev == NULL) { \ @@ -483,11 +495,20 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id, conf->queue_size, queue_id, dev_id); return -EINVAL; } - if (conf->priority > dev_info.max_queue_priority) { + if (conf->op_type == RTE_BBDEV_OP_TURBO_DEC && + conf->priority > dev_info.max_ul_queue_priority) { + rte_bbdev_log(ERR, + "Priority (%u) of queue %u of bbdev %u must be <= %u", + conf->priority, queue_id, dev_id, + dev_info.max_ul_queue_priority); + return -EINVAL; + } + if (conf->op_type == RTE_BBDEV_OP_TURBO_ENC && + conf->priority > dev_info.max_dl_queue_priority) { rte_bbdev_log(ERR, - "Priority (%u) of queue %u of bdev %u must be <= %u", + "Priority (%u) of queue %u of bbdev %u must be <= %u", conf->priority, queue_id, dev_id, - dev_info.max_queue_priority); + dev_info.max_dl_queue_priority); return -EINVAL; } } @@ -774,7 +795,7 @@ rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info) memset(dev_info, 0, sizeof(*dev_info)); dev_info->dev_name = dev->data->name; dev_info->num_queues = dev->data->num_queues; - dev_info->bus = rte_bus_find_by_device(dev->device); + dev_info->device = dev->device; dev_info->socket_id = dev->data->socket_id; dev_info->started = dev->data->started; @@ -825,6 +846,12 @@ get_bbdev_op_size(enum rte_bbdev_op_type type) case RTE_BBDEV_OP_TURBO_ENC: result = sizeof(struct rte_bbdev_enc_op); break; + case RTE_BBDEV_OP_LDPC_DEC: + result = sizeof(struct rte_bbdev_dec_op); + break; + case RTE_BBDEV_OP_LDPC_ENC: + result = sizeof(struct rte_bbdev_enc_op); + break; default: break; } @@ -839,11 +866,12 @@ bbdev_op_init(struct rte_mempool *mempool, void *arg, void *element, { enum rte_bbdev_op_type type = *(enum rte_bbdev_op_type *)arg; - if (type == RTE_BBDEV_OP_TURBO_DEC) { + if (type == RTE_BBDEV_OP_TURBO_DEC || type == RTE_BBDEV_OP_LDPC_DEC) { struct rte_bbdev_dec_op *op = element; memset(op, 0, mempool->elt_size); op->mempool = mempool; - } else if (type == RTE_BBDEV_OP_TURBO_ENC) { + } else if (type == RTE_BBDEV_OP_TURBO_ENC || + type == RTE_BBDEV_OP_LDPC_ENC) { struct rte_bbdev_enc_op *op = element; memset(op, 0, mempool->elt_size); op->mempool = mempool; @@ -1095,6 +1123,8 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type) "RTE_BBDEV_OP_NONE", "RTE_BBDEV_OP_TURBO_DEC", "RTE_BBDEV_OP_TURBO_ENC", + "RTE_BBDEV_OP_LDPC_DEC", + "RTE_BBDEV_OP_LDPC_ENC", }; if (op_type < RTE_BBDEV_OP_TYPE_COUNT) @@ -1104,12 +1134,7 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type) return NULL; } - -int bbdev_logtype; - -RTE_INIT(rte_bbdev_init_log); -static void -rte_bbdev_init_log(void) +RTE_INIT(rte_bbdev_init_log) { bbdev_logtype = rte_log_register("lib.bbdev"); if (bbdev_logtype >= 0)