diff options
Diffstat (limited to 'lib/librte_compressdev')
-rw-r--r-- | lib/librte_compressdev/rte_comp.c | 4 | ||||
-rw-r--r-- | lib/librte_compressdev/rte_comp.h | 4 | ||||
-rw-r--r-- | lib/librte_compressdev/rte_compressdev.c | 32 | ||||
-rw-r--r-- | lib/librte_compressdev/rte_compressdev_pmd.c | 23 | ||||
-rw-r--r-- | lib/librte_compressdev/rte_compressdev_pmd.h | 5 |
5 files changed, 27 insertions, 41 deletions
diff --git a/lib/librte_compressdev/rte_comp.c b/lib/librte_compressdev/rte_comp.c index 98ad0cfd..c663be59 100644 --- a/lib/librte_compressdev/rte_comp.c +++ b/lib/librte_compressdev/rte_comp.c @@ -83,8 +83,8 @@ struct rte_comp_op_pool_private { * @param nb_ops * Number of operations to allocate * @return - * - 0: Success - * - -ENOENT: Not enough entries in the mempool; no ops are retrieved. + * - nb_ops: Success, the nb_ops requested was allocated + * - 0: Not enough entries in the mempool; no ops are retrieved. */ static inline int rte_comp_op_raw_bulk_alloc(struct rte_mempool *mempool, diff --git a/lib/librte_compressdev/rte_comp.h b/lib/librte_compressdev/rte_comp.h index ee9056ea..395ce29f 100644 --- a/lib/librte_compressdev/rte_comp.h +++ b/lib/librte_compressdev/rte_comp.h @@ -448,8 +448,8 @@ rte_comp_op_alloc(struct rte_mempool *mempool); * @param nb_ops * Number of operations to allocate * @return - * - 0: Success - * - -ENOENT: Not enough entries in the mempool; no ops are retrieved. + * - nb_ops: Success, the nb_ops requested was allocated + * - 0: Not enough entries in the mempool; no ops are retrieved. */ int __rte_experimental rte_comp_op_bulk_alloc(struct rte_mempool *mempool, diff --git a/lib/librte_compressdev/rte_compressdev.c b/lib/librte_compressdev/rte_compressdev.c index 9091dd6e..10101ebb 100644 --- a/lib/librte_compressdev/rte_compressdev.c +++ b/lib/librte_compressdev/rte_compressdev.c @@ -18,19 +18,15 @@ #define RTE_COMPRESSDEV_DETACHED (0) #define RTE_COMPRESSDEV_ATTACHED (1) -struct rte_compressdev rte_comp_devices[RTE_COMPRESS_MAX_DEVS]; - -struct rte_compressdev *rte_compressdevs = &rte_comp_devices[0]; +static struct rte_compressdev rte_comp_devices[RTE_COMPRESS_MAX_DEVS]; static struct rte_compressdev_global compressdev_globals = { - .devs = &rte_comp_devices[0], + .devs = rte_comp_devices, .data = { NULL }, .nb_devs = 0, .max_devs = RTE_COMPRESS_MAX_DEVS }; -struct rte_compressdev_global *rte_compressdev_globals = &compressdev_globals; - const struct rte_compressdev_capabilities * __rte_experimental rte_compressdev_capability_get(uint8_t dev_id, enum rte_comp_algorithm algo) @@ -78,7 +74,7 @@ rte_compressdev_get_feature_name(uint64_t flag) static struct rte_compressdev * rte_compressdev_get_dev(uint8_t dev_id) { - return &rte_compressdev_globals->devs[dev_id]; + return &compressdev_globals.devs[dev_id]; } struct rte_compressdev * __rte_experimental @@ -90,8 +86,8 @@ rte_compressdev_pmd_get_named_dev(const char *name) if (name == NULL) return NULL; - for (i = 0; i < rte_compressdev_globals->max_devs; i++) { - dev = &rte_compressdev_globals->devs[i]; + for (i = 0; i < compressdev_globals.max_devs; i++) { + dev = &compressdev_globals.devs[i]; if ((dev->attached == RTE_COMPRESSDEV_ATTACHED) && (strcmp(dev->data->name, name) == 0)) @@ -106,7 +102,7 @@ rte_compressdev_is_valid_dev(uint8_t dev_id) { struct rte_compressdev *dev = NULL; - if (dev_id >= rte_compressdev_globals->nb_devs) + if (dev_id >= compressdev_globals.nb_devs) return 0; dev = rte_compressdev_get_dev(dev_id); @@ -125,10 +121,10 @@ rte_compressdev_get_dev_id(const char *name) if (name == NULL) return -1; - for (i = 0; i < rte_compressdev_globals->nb_devs; i++) - if ((strcmp(rte_compressdev_globals->devs[i].data->name, name) + for (i = 0; i < compressdev_globals.nb_devs; i++) + if ((strcmp(compressdev_globals.devs[i].data->name, name) == 0) && - (rte_compressdev_globals->devs[i].attached == + (compressdev_globals.devs[i].attached == RTE_COMPRESSDEV_ATTACHED)) return i; @@ -138,7 +134,7 @@ rte_compressdev_get_dev_id(const char *name) uint8_t __rte_experimental rte_compressdev_count(void) { - return rte_compressdev_globals->nb_devs; + return compressdev_globals.nb_devs; } uint8_t __rte_experimental @@ -146,8 +142,8 @@ rte_compressdev_devices_get(const char *driver_name, uint8_t *devices, uint8_t nb_devices) { uint8_t i, count = 0; - struct rte_compressdev *devs = rte_compressdev_globals->devs; - uint8_t max_devs = rte_compressdev_globals->max_devs; + struct rte_compressdev *devs = compressdev_globals.devs; + uint8_t max_devs = compressdev_globals.max_devs; for (i = 0; i < max_devs && count < nb_devices; i++) { @@ -578,7 +574,7 @@ uint16_t __rte_experimental rte_compressdev_dequeue_burst(uint8_t dev_id, uint16_t qp_id, struct rte_comp_op **ops, uint16_t nb_ops) { - struct rte_compressdev *dev = &rte_compressdevs[dev_id]; + struct rte_compressdev *dev = &rte_comp_devices[dev_id]; nb_ops = (*dev->dequeue_burst) (dev->data->queue_pairs[qp_id], ops, nb_ops); @@ -590,7 +586,7 @@ uint16_t __rte_experimental rte_compressdev_enqueue_burst(uint8_t dev_id, uint16_t qp_id, struct rte_comp_op **ops, uint16_t nb_ops) { - struct rte_compressdev *dev = &rte_compressdevs[dev_id]; + struct rte_compressdev *dev = &rte_comp_devices[dev_id]; return (*dev->enqueue_burst)( dev->data->queue_pairs[qp_id], ops, nb_ops); diff --git a/lib/librte_compressdev/rte_compressdev_pmd.c b/lib/librte_compressdev/rte_compressdev_pmd.c index 7de4f339..95beb26a 100644 --- a/lib/librte_compressdev/rte_compressdev_pmd.c +++ b/lib/librte_compressdev/rte_compressdev_pmd.c @@ -92,24 +92,20 @@ rte_compressdev_pmd_create(const char *name, struct rte_compressdev *compressdev; if (params->name[0] != '\0') { - COMPRESSDEV_LOG(INFO, "[%s] User specified device name = %s\n", - device->driver->name, params->name); + COMPRESSDEV_LOG(INFO, "User specified device name = %s\n", + params->name); name = params->name; } - COMPRESSDEV_LOG(INFO, "[%s] - Creating compressdev %s\n", - device->driver->name, name); + COMPRESSDEV_LOG(INFO, "Creating compressdev %s\n", name); - COMPRESSDEV_LOG(INFO, - "[%s] - Init parameters - name: %s, socket id: %d", - device->driver->name, name, - params->socket_id); + COMPRESSDEV_LOG(INFO, "Init parameters - name: %s, socket id: %d", + name, params->socket_id); /* allocate device structure */ compressdev = rte_compressdev_pmd_allocate(name, params->socket_id); if (compressdev == NULL) { - COMPRESSDEV_LOG(ERR, "[%s] Failed to allocate comp device %s", - device->driver->name, name); + COMPRESSDEV_LOG(ERR, "Failed to allocate comp device %s", name); return NULL; } @@ -123,8 +119,8 @@ rte_compressdev_pmd_create(const char *name, if (compressdev->data->dev_private == NULL) { COMPRESSDEV_LOG(ERR, - "[%s] Cannot allocate memory for compressdev %s private data", - device->driver->name, name); + "Cannot allocate memory for compressdev" + " %s private data", name); rte_compressdev_pmd_release_device(compressdev); return NULL; @@ -141,8 +137,7 @@ rte_compressdev_pmd_destroy(struct rte_compressdev *compressdev) { int retval; - COMPRESSDEV_LOG(INFO, "[%s] Closing comp device %s", - compressdev->device->driver->name, + COMPRESSDEV_LOG(INFO, "Closing comp device %s", compressdev->device->name); /* free comp device */ diff --git a/lib/librte_compressdev/rte_compressdev_pmd.h b/lib/librte_compressdev/rte_compressdev_pmd.h index 38e9ea02..043353c9 100644 --- a/lib/librte_compressdev/rte_compressdev_pmd.h +++ b/lib/librte_compressdev/rte_compressdev_pmd.h @@ -51,11 +51,6 @@ struct rte_compressdev_global { uint8_t max_devs; /**< Max number of devices */ }; -/** Pointer to global array of comp devices */ -extern struct rte_compressdev *rte_compressdevs; -/** Pointer to global comp devices data structure */ -extern struct rte_compressdev_global *rte_compressdev_globals; - /** * Get the rte_compressdev structure device pointer for the named device. * |