diff options
Diffstat (limited to 'lib/librte_rawdev')
-rw-r--r-- | lib/librte_rawdev/Makefile | 1 | ||||
-rw-r--r-- | lib/librte_rawdev/meson.build | 5 | ||||
-rw-r--r-- | lib/librte_rawdev/rte_rawdev.c | 76 | ||||
-rw-r--r-- | lib/librte_rawdev/rte_rawdev.h | 55 | ||||
-rw-r--r-- | lib/librte_rawdev/rte_rawdev_pmd.h | 28 | ||||
-rw-r--r-- | lib/librte_rawdev/rte_rawdev_version.map | 3 |
6 files changed, 100 insertions, 68 deletions
diff --git a/lib/librte_rawdev/Makefile b/lib/librte_rawdev/Makefile index b9105b06..addb288d 100644 --- a/lib/librte_rawdev/Makefile +++ b/lib/librte_rawdev/Makefile @@ -10,7 +10,6 @@ LIB = librte_rawdev.a LIBABIVER := 1 # build flags -CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) LDLIBS += -lrte_eal diff --git a/lib/librte_rawdev/meson.build b/lib/librte_rawdev/meson.build new file mode 100644 index 00000000..a20fbdc0 --- /dev/null +++ b/lib/librte_rawdev/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Intel Corporation + +sources = files('rte_rawdev.c') +headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h') diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c index d314ef96..62b6b97e 100644 --- a/lib/librte_rawdev/rte_rawdev.c +++ b/lib/librte_rawdev/rte_rawdev.c @@ -46,13 +46,13 @@ static struct rte_rawdev_global rawdev_globals = { struct rte_rawdev_global *rte_rawdev_globals = &rawdev_globals; /* Raw device, northbound API implementation */ -uint8_t __rte_experimental +uint8_t rte_rawdev_count(void) { return rte_rawdev_globals->nb_devs; } -uint16_t __rte_experimental +uint16_t rte_rawdev_get_dev_id(const char *name) { uint16_t i; @@ -69,7 +69,7 @@ rte_rawdev_get_dev_id(const char *name) return -ENODEV; } -int __rte_experimental +int rte_rawdev_socket_id(uint16_t dev_id) { struct rte_rawdev *dev; @@ -80,7 +80,7 @@ rte_rawdev_socket_id(uint16_t dev_id) return dev->socket_id; } -int __rte_experimental +int rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info) { struct rte_rawdev *rawdev; @@ -88,9 +88,6 @@ rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info) RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); RTE_FUNC_PTR_OR_ERR_RET(dev_info, -EINVAL); - if (dev_info == NULL) - return -EINVAL; - rawdev = &rte_rawdevs[dev_id]; RTE_FUNC_PTR_OR_ERR_RET(*rawdev->dev_ops->dev_info_get, -ENOTSUP); @@ -105,7 +102,7 @@ rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info) return 0; } -int __rte_experimental +int rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf) { struct rte_rawdev *dev; @@ -134,7 +131,7 @@ rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf) return diag; } -int __rte_experimental +int rte_rawdev_queue_conf_get(uint16_t dev_id, uint16_t queue_id, rte_rawdev_obj_t queue_conf) @@ -149,7 +146,7 @@ rte_rawdev_queue_conf_get(uint16_t dev_id, return 0; } -int __rte_experimental +int rte_rawdev_queue_setup(uint16_t dev_id, uint16_t queue_id, rte_rawdev_obj_t queue_conf) @@ -163,7 +160,7 @@ rte_rawdev_queue_setup(uint16_t dev_id, return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf); } -int __rte_experimental +int rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id) { struct rte_rawdev *dev; @@ -175,7 +172,19 @@ rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id) return (*dev->dev_ops->queue_release)(dev, queue_id); } -int __rte_experimental +uint16_t +rte_rawdev_queue_count(uint16_t dev_id) +{ + struct rte_rawdev *dev; + + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_count, -ENOTSUP); + return (*dev->dev_ops->queue_count)(dev); +} + +int rte_rawdev_get_attr(uint16_t dev_id, const char *attr_name, uint64_t *attr_value) @@ -189,7 +198,7 @@ rte_rawdev_get_attr(uint16_t dev_id, return (*dev->dev_ops->attr_get)(dev, attr_name, attr_value); } -int __rte_experimental +int rte_rawdev_set_attr(uint16_t dev_id, const char *attr_name, const uint64_t attr_value) @@ -203,7 +212,7 @@ rte_rawdev_set_attr(uint16_t dev_id, return (*dev->dev_ops->attr_set)(dev, attr_name, attr_value); } -int __rte_experimental +int rte_rawdev_enqueue_buffers(uint16_t dev_id, struct rte_rawdev_buf **buffers, unsigned int count, @@ -218,7 +227,7 @@ rte_rawdev_enqueue_buffers(uint16_t dev_id, return (*dev->dev_ops->enqueue_bufs)(dev, buffers, count, context); } -int __rte_experimental +int rte_rawdev_dequeue_buffers(uint16_t dev_id, struct rte_rawdev_buf **buffers, unsigned int count, @@ -233,7 +242,7 @@ rte_rawdev_dequeue_buffers(uint16_t dev_id, return (*dev->dev_ops->dequeue_bufs)(dev, buffers, count, context); } -int __rte_experimental +int rte_rawdev_dump(uint16_t dev_id, FILE *f) { struct rte_rawdev *dev; @@ -254,7 +263,7 @@ xstats_get_count(uint16_t dev_id) return (*dev->dev_ops->xstats_get_names)(dev, NULL, 0); } -int __rte_experimental +int rte_rawdev_xstats_names_get(uint16_t dev_id, struct rte_rawdev_xstats_name *xstats_names, unsigned int size) @@ -277,7 +286,7 @@ rte_rawdev_xstats_names_get(uint16_t dev_id, } /* retrieve rawdev extended statistics */ -int __rte_experimental +int rte_rawdev_xstats_get(uint16_t dev_id, const unsigned int ids[], uint64_t values[], @@ -290,7 +299,7 @@ rte_rawdev_xstats_get(uint16_t dev_id, return (*dev->dev_ops->xstats_get)(dev, ids, values, n); } -uint64_t __rte_experimental +uint64_t rte_rawdev_xstats_by_name_get(uint16_t dev_id, const char *name, unsigned int *id) @@ -309,7 +318,7 @@ rte_rawdev_xstats_by_name_get(uint16_t dev_id, return (*dev->dev_ops->xstats_get_by_name)(dev, name, id); } -int __rte_experimental +int rte_rawdev_xstats_reset(uint16_t dev_id, const uint32_t ids[], uint32_t nb_ids) { @@ -320,7 +329,7 @@ rte_rawdev_xstats_reset(uint16_t dev_id, return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids); } -int __rte_experimental +int rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info) { RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); @@ -330,7 +339,7 @@ rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info) return (*dev->dev_ops->firmware_status_get)(dev, status_info); } -int __rte_experimental +int rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info) { RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); @@ -340,7 +349,7 @@ rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info) return (*dev->dev_ops->firmware_version_get)(dev, version_info); } -int __rte_experimental +int rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image) { RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); @@ -353,7 +362,7 @@ rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image) return (*dev->dev_ops->firmware_load)(dev, firmware_image); } -int __rte_experimental +int rte_rawdev_firmware_unload(uint16_t dev_id) { RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); @@ -363,7 +372,7 @@ rte_rawdev_firmware_unload(uint16_t dev_id) return (*dev->dev_ops->firmware_unload)(dev); } -int __rte_experimental +int rte_rawdev_selftest(uint16_t dev_id) { RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); @@ -373,7 +382,7 @@ rte_rawdev_selftest(uint16_t dev_id) return (*dev->dev_ops->dev_selftest)(); } -int __rte_experimental +int rte_rawdev_start(uint16_t dev_id) { struct rte_rawdev *dev; @@ -400,7 +409,7 @@ rte_rawdev_start(uint16_t dev_id) return 0; } -void __rte_experimental +void rte_rawdev_stop(uint16_t dev_id) { struct rte_rawdev *dev; @@ -422,7 +431,7 @@ rte_rawdev_stop(uint16_t dev_id) dev->started = 0; } -int __rte_experimental +int rte_rawdev_close(uint16_t dev_id) { struct rte_rawdev *dev; @@ -441,7 +450,7 @@ rte_rawdev_close(uint16_t dev_id) return (*dev->dev_ops->dev_close)(dev); } -int __rte_experimental +int rte_rawdev_reset(uint16_t dev_id) { struct rte_rawdev *dev; @@ -468,7 +477,7 @@ rte_rawdev_find_free_device_index(void) return RTE_RAWDEV_MAX_DEVS; } -struct rte_rawdev * __rte_experimental +struct rte_rawdev * rte_rawdev_pmd_allocate(const char *name, size_t dev_priv_size, int socket_id) { struct rte_rawdev *rawdev; @@ -509,7 +518,7 @@ rte_rawdev_pmd_allocate(const char *name, size_t dev_priv_size, int socket_id) return rawdev; } -int __rte_experimental +int rte_rawdev_pmd_release(struct rte_rawdev *rawdev) { int ret; @@ -535,10 +544,7 @@ rte_rawdev_pmd_release(struct rte_rawdev *rawdev) return 0; } -RTE_INIT(librawdev_init_log); - -static void -librawdev_init_log(void) +RTE_INIT(librawdev_init_log) { librawdev_logtype = rte_log_register("lib.rawdev"); if (librawdev_logtype >= 0) diff --git a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h index 2e14919b..684bfdb8 100644 --- a/lib/librte_rawdev/rte_rawdev.h +++ b/lib/librte_rawdev/rte_rawdev.h @@ -35,7 +35,7 @@ typedef void *rte_rawdev_obj_t; * @return * The total number of usable raw devices. */ -uint8_t __rte_experimental +uint8_t rte_rawdev_count(void); /** @@ -48,7 +48,7 @@ rte_rawdev_count(void); * Returns raw device identifier on success. * - <0: Failure to find named raw device. */ -uint16_t __rte_experimental +uint16_t rte_rawdev_get_dev_id(const char *name); /** @@ -61,7 +61,7 @@ rte_rawdev_get_dev_id(const char *name); * a default of zero if the socket could not be determined. * -(-EINVAL) dev_id value is out of range. */ -int __rte_experimental +int rte_rawdev_socket_id(uint16_t dev_id); /** @@ -84,7 +84,7 @@ struct rte_rawdev_info; * - <0: Error code returned by the driver info get function. * */ -int __rte_experimental +int rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info); /** @@ -111,7 +111,7 @@ rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info); * - 0: Success, device configured. * - <0: Error code returned by the driver configuration function. */ -int __rte_experimental +int rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf); @@ -137,7 +137,7 @@ rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf); * @see rte_raw_queue_setup() * */ -int __rte_experimental +int rte_rawdev_queue_conf_get(uint16_t dev_id, uint16_t queue_id, rte_rawdev_obj_t queue_conf); @@ -160,7 +160,7 @@ rte_rawdev_queue_conf_get(uint16_t dev_id, * - 0: Success, raw queue correctly set up. * - <0: raw queue configuration failed */ -int __rte_experimental +int rte_rawdev_queue_setup(uint16_t dev_id, uint16_t queue_id, rte_rawdev_obj_t queue_conf); @@ -180,8 +180,9 @@ rte_rawdev_queue_setup(uint16_t dev_id, * - 0: Success, raw queue released. * - <0: raw queue configuration failed */ -int __rte_experimental +int rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id); + /** * Get the number of raw queues on a specific raw device * @@ -190,7 +191,7 @@ rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id); * @return * - The number of configured raw queues */ -uint16_t __rte_experimental +uint16_t rte_rawdev_queue_count(uint16_t dev_id); /** @@ -208,7 +209,7 @@ rte_rawdev_queue_count(uint16_t dev_id); * - 0: Success, device started. * < 0: Failure */ -int __rte_experimental +int rte_rawdev_start(uint16_t dev_id); /** @@ -218,7 +219,7 @@ rte_rawdev_start(uint16_t dev_id); * @param dev_id * Raw device identifier. */ -void __rte_experimental +void rte_rawdev_stop(uint16_t dev_id); /** @@ -232,7 +233,7 @@ rte_rawdev_stop(uint16_t dev_id); * - <0 on failure to close device * - (-EAGAIN) if device is busy */ -int __rte_experimental +int rte_rawdev_close(uint16_t dev_id); /** @@ -246,7 +247,7 @@ rte_rawdev_close(uint16_t dev_id); * 0 for sucessful reset, * !0 for failure in resetting */ -int __rte_experimental +int rte_rawdev_reset(uint16_t dev_id); #define RTE_RAWDEV_NAME_MAX_LEN (64) @@ -316,7 +317,7 @@ struct rte_rawdev_buf { * - 0: on success * - <0: on failure. */ -int __rte_experimental +int rte_rawdev_dump(uint16_t dev_id, FILE *f); /** @@ -338,7 +339,7 @@ rte_rawdev_dump(uint16_t dev_id, FILE *f); * 0 for success * !0 Error; attr_value remains untouched in case of error. */ -int __rte_experimental +int rte_rawdev_get_attr(uint16_t dev_id, const char *attr_name, uint64_t *attr_value); @@ -357,7 +358,7 @@ rte_rawdev_get_attr(uint16_t dev_id, * 0 for success * !0 Error */ -int __rte_experimental +int rte_rawdev_set_attr(uint16_t dev_id, const char *attr_name, const uint64_t attr_value); @@ -383,7 +384,7 @@ rte_rawdev_set_attr(uint16_t dev_id, * Whether partial enqueue is failure or success is defined between app * and driver implementation. */ -int __rte_experimental +int rte_rawdev_enqueue_buffers(uint16_t dev_id, struct rte_rawdev_buf **buffers, unsigned int count, @@ -414,7 +415,7 @@ rte_rawdev_enqueue_buffers(uint16_t dev_id, * Whether partial enqueue is failure or success is defined between app * and driver implementation. */ -int __rte_experimental +int rte_rawdev_dequeue_buffers(uint16_t dev_id, struct rte_rawdev_buf **buffers, unsigned int count, @@ -454,7 +455,7 @@ struct rte_rawdev_xstats_name { * -ENODEV for invalid *dev_id* * -ENOTSUP if the device doesn't support this function. */ -int __rte_experimental +int rte_rawdev_xstats_names_get(uint16_t dev_id, struct rte_rawdev_xstats_name *xstats_names, unsigned int size); @@ -478,7 +479,7 @@ rte_rawdev_xstats_names_get(uint16_t dev_id, * -ENODEV for invalid *dev_id* * -ENOTSUP if the device doesn't support this function. */ -int __rte_experimental +int rte_rawdev_xstats_get(uint16_t dev_id, const unsigned int ids[], uint64_t values[], @@ -500,7 +501,7 @@ rte_rawdev_xstats_get(uint16_t dev_id, * - positive value or zero: the stat value * - negative value: -EINVAL if stat not found, -ENOTSUP if not supported. */ -uint64_t __rte_experimental +uint64_t rte_rawdev_xstats_by_name_get(uint16_t dev_id, const char *name, unsigned int *id); @@ -520,7 +521,7 @@ rte_rawdev_xstats_by_name_get(uint16_t dev_id, * - zero: successfully reset the statistics to zero * - negative value: -EINVAL invalid parameters, -ENOTSUP if not supported. */ -int __rte_experimental +int rte_rawdev_xstats_reset(uint16_t dev_id, const uint32_t ids[], uint32_t nb_ids); @@ -539,7 +540,7 @@ rte_rawdev_xstats_reset(uint16_t dev_id, * 0 for success, * !0 for failure, `status_info` argument state is undefined */ -int __rte_experimental +int rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info); @@ -557,7 +558,7 @@ rte_rawdev_firmware_status_get(uint16_t dev_id, * 0 for success, * !0 for failure, `version_info` argument state is undefined */ -int __rte_experimental +int rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info); @@ -574,7 +575,7 @@ rte_rawdev_firmware_version_get(uint16_t dev_id, * 0 for successful load * !0 for failure to load the provided image, or image incorrect. */ -int __rte_experimental +int rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image); /** @@ -586,7 +587,7 @@ rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image); * 0 for successful Unload * !0 for failure in unloading */ -int __rte_experimental +int rte_rawdev_firmware_unload(uint16_t dev_id); /** @@ -599,7 +600,7 @@ rte_rawdev_firmware_unload(uint16_t dev_id); * - -ENOTSUP if the device doesn't support selftest * - other values < 0 on failure. */ -int __rte_experimental +int rte_rawdev_selftest(uint16_t dev_id); #ifdef __cplusplus diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index 408adf0f..bb9bbc35 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -251,6 +251,24 @@ typedef int (*rawdev_queue_release_t)(struct rte_rawdev *dev, uint16_t queue_id); /** + * Get the count of number of queues configured on this device. + * + * Another way to fetch this information is to fetch the device configuration. + * But, that assumes that the device configuration managed by the driver has + * that kind of information. + * + * This function helps in getting queue count supported, independently. It + * can help in cases where iterator needs to be implemented. + * + * @param + * Raw device pointer + * @return + * Number of queues; 0 is assumed to be a valid response. + * + */ +typedef uint16_t (*rawdev_queue_count_t)(struct rte_rawdev *dev); + +/** * Enqueue an array of raw buffers to the device. * * Buffer being used is opaque - it can be obtained from mempool or from @@ -506,6 +524,8 @@ struct rte_rawdev_ops { rawdev_queue_setup_t queue_setup; /**< Release an raw queue. */ rawdev_queue_release_t queue_release; + /**< Get the number of queues attached to the device */ + rawdev_queue_count_t queue_count; /**< Enqueue an array of raw buffers to device. */ rawdev_enqueue_bufs_t enqueue_bufs; @@ -556,7 +576,7 @@ struct rte_rawdev_ops { * @return * - Slot in the rte_dev_devices array for a new device; */ -struct rte_rawdev * __rte_experimental +struct rte_rawdev * rte_rawdev_pmd_allocate(const char *name, size_t dev_private_size, int socket_id); @@ -568,7 +588,7 @@ rte_rawdev_pmd_allocate(const char *name, size_t dev_private_size, * @return * - 0 on success, negative on error */ -int __rte_experimental +int rte_rawdev_pmd_release(struct rte_rawdev *rawdev); /** @@ -585,7 +605,7 @@ rte_rawdev_pmd_release(struct rte_rawdev *rawdev); * - Raw device pointer if device is successfully created. * - NULL if device cannot be created. */ -struct rte_rawdev * __rte_experimental +struct rte_rawdev * rte_rawdev_pmd_init(const char *name, size_t dev_private_size, int socket_id); @@ -597,7 +617,7 @@ rte_rawdev_pmd_init(const char *name, size_t dev_private_size, * @return * - 0 on success, negative on error */ -int __rte_experimental +int rte_rawdev_pmd_uninit(const char *name); #ifdef __cplusplus diff --git a/lib/librte_rawdev/rte_rawdev_version.map b/lib/librte_rawdev/rte_rawdev_version.map index af4465e2..b61dbff1 100644 --- a/lib/librte_rawdev/rte_rawdev_version.map +++ b/lib/librte_rawdev/rte_rawdev_version.map @@ -1,4 +1,4 @@ -EXPERIMENTAL { +DPDK_18.08 { global: rte_rawdev_close; @@ -16,6 +16,7 @@ EXPERIMENTAL { rte_rawdev_pmd_allocate; rte_rawdev_pmd_release; rte_rawdev_queue_conf_get; + rte_rawdev_queue_count; rte_rawdev_queue_setup; rte_rawdev_queue_release; rte_rawdev_reset; |