X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_bbdev%2Frte_bbdev.c;h=5ba891c23257d284bfd7ff8ae2983cdbaf39d340;hb=3127f99274b679124658afdbfc49210730c50617;hp=0c354804d1063dacf86c8e4f69f296bb0ae75ce7;hpb=cfe3aeb170b2f6277e6f96173599da51eab0654f;p=dpdk.git diff --git a/lib/librte_bbdev/rte_bbdev.c b/lib/librte_bbdev/rte_bbdev.c index 0c354804d1..5ba891c232 100644 --- a/lib/librte_bbdev/rte_bbdev.c +++ b/lib/librte_bbdev/rte_bbdev.c @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -30,7 +29,7 @@ /* BBDev library logging ID */ -static int bbdev_logtype; +RTE_LOG_REGISTER(bbdev_logtype, lib.bbdev, NOTICE); /* Helper macro for logging */ #define rte_bbdev_log(level, fmt, ...) \ @@ -211,11 +210,11 @@ rte_bbdev_allocate(const char *name) return NULL; } - rte_atomic16_inc(&bbdev->data->process_cnt); + __atomic_add_fetch(&bbdev->data->process_cnt, 1, __ATOMIC_RELAXED); bbdev->data->dev_id = dev_id; bbdev->state = RTE_BBDEV_INITIALIZED; - ret = strlcpy(bbdev->data->name, name, RTE_BBDEV_NAME_MAX_LEN); + 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); return NULL; @@ -253,7 +252,8 @@ rte_bbdev_release(struct rte_bbdev *bbdev) } /* clear shared BBDev Data if no process is using the device anymore */ - if (rte_atomic16_dec_and_test(&bbdev->data->process_cnt)) + if (__atomic_sub_fetch(&bbdev->data->process_cnt, 1, + __ATOMIC_RELAXED) == 0) memset(bbdev->data, 0, sizeof(*bbdev->data)); memset(bbdev, 0, sizeof(*bbdev)); @@ -499,7 +499,7 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id, 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 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_ul_queue_priority); return -EINVAL; @@ -507,7 +507,7 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id, 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_dl_queue_priority); return -EINVAL; @@ -796,7 +796,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; @@ -847,6 +847,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; } @@ -861,11 +867,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; @@ -1117,6 +1124,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) @@ -1125,10 +1134,3 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type) rte_bbdev_log(ERR, "Invalid operation type"); return NULL; } - -RTE_INIT(rte_bbdev_init_log) -{ - bbdev_logtype = rte_log_register("lib.bbdev"); - if (bbdev_logtype >= 0) - rte_log_set_level(bbdev_logtype, RTE_LOG_NOTICE); -}