> -----Original Message-----
> From: pbhagavat...@marvell.com <pbhagavat...@marvell.com>
> Sent: Saturday, October 16, 2021 12:32 AM
> To: Jerin Jacob Kollanukkaran <jer...@marvell.com>; Timothy McDaniel
> <timothy.mcdan...@intel.com>; Mattias Rönnblom
> <mattias.ronnb...@ericsson.com>; Pavan Nikhilesh Bhagavatula
> <pbhagavat...@marvell.com>; Harman Kalra <hka...@marvell.com>; Ray
> Kinsella <m...@ashroe.eu>
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 07/14] eventdev: hide event device related
> structures
>
> From: Pavan Nikhilesh <pbhagavat...@marvell.com>
>
> Move rte_eventdev, rte_eventdev_data structures to eventdev_pmd.h.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
LGTM from octeontx POV
Acked-by: Harman Kalra <hka...@marvell.com>
Thanks
Harman
> ---
> drivers/event/dlb2/dlb2_inline_fns.h | 2 +
> drivers/event/dsw/dsw_evdev.h | 2 +
> drivers/event/octeontx/timvf_worker.h | 2 +
> drivers/net/octeontx/octeontx_ethdev.c | 3 +-
> lib/eventdev/eventdev_pmd.h | 92 +++++++++++++++++++++++++
> lib/eventdev/rte_eventdev.c | 22 ------
> lib/eventdev/rte_eventdev_core.h | 93 --------------------------
> lib/eventdev/version.map | 2 +-
> 8 files changed, 101 insertions(+), 117 deletions(-)
>
> diff --git a/drivers/event/dlb2/dlb2_inline_fns.h
> b/drivers/event/dlb2/dlb2_inline_fns.h
> index ac8d01aa98..1429281cfd 100644
> --- a/drivers/event/dlb2/dlb2_inline_fns.h
> +++ b/drivers/event/dlb2/dlb2_inline_fns.h
> @@ -5,6 +5,8 @@
> #ifndef _DLB2_INLINE_FNS_H_
> #define _DLB2_INLINE_FNS_H_
>
> +#include <eventdev_pmd.h>
> +
> /* Inline functions required in more than one source file. */
>
> static inline struct dlb2_eventdev *
> diff --git a/drivers/event/dsw/dsw_evdev.h
> b/drivers/event/dsw/dsw_evdev.h index 08889a0990..631daea55c 100644
> --- a/drivers/event/dsw/dsw_evdev.h
> +++ b/drivers/event/dsw/dsw_evdev.h
> @@ -5,6 +5,8 @@
> #ifndef _DSW_EVDEV_H_
> #define _DSW_EVDEV_H_
>
> +#include <eventdev_pmd.h>
> +
> #include <rte_event_ring.h>
> #include <rte_eventdev.h>
>
> diff --git a/drivers/event/octeontx/timvf_worker.h
> b/drivers/event/octeontx/timvf_worker.h
> index dede1a4a4f..3f1e77f1d1 100644
> --- a/drivers/event/octeontx/timvf_worker.h
> +++ b/drivers/event/octeontx/timvf_worker.h
> @@ -2,6 +2,8 @@
> * Copyright(c) 2017 Cavium, Inc
> */
>
> +#include <eventdev_pmd.h>
> +
> #include <rte_common.h>
> #include <rte_branch_prediction.h>
>
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c
> b/drivers/net/octeontx/octeontx_ethdev.c
> index 7c91494f0e..ddfce57394 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -9,13 +9,14 @@
> #include <string.h>
> #include <unistd.h>
>
> +#include <eventdev_pmd.h>
> #include <rte_alarm.h>
> #include <rte_branch_prediction.h>
> #include <rte_bus_vdev.h>
> #include <rte_cycles.h>
> #include <rte_debug.h>
> -#include <rte_devargs.h>
> #include <rte_dev.h>
> +#include <rte_devargs.h>
> #include <rte_kvargs.h>
> #include <rte_malloc.h>
> #include <rte_mbuf_pool_ops.h>
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index 0532b542d4..9aa9943fa5 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -80,6 +80,9 @@
> #define RTE_EVENTDEV_DETACHED (0)
> #define RTE_EVENTDEV_ATTACHED (1)
>
> +#define RTE_EVENTDEV_NAME_MAX_LEN (64)
> +/**< @internal Max length of name of event PMD */
> +
> struct rte_eth_dev;
>
> /** Global structure used for maintaining state of allocated event devices */
> @@ -87,6 +90,95 @@ struct rte_eventdev_global {
> uint8_t nb_devs; /**< Number of devices found */
> };
>
> +/**
> + * @internal
> + * The data part, with no function pointers, associated with each device.
> + *
> + * This structure is safe to place in shared memory to be common among
> + * different processes in a multi-process configuration.
> + */
> +struct rte_eventdev_data {
> + int socket_id;
> + /**< Socket ID where memory is allocated */
> + uint8_t dev_id;
> + /**< Device ID for this instance */
> + uint8_t nb_queues;
> + /**< Number of event queues. */
> + uint8_t nb_ports;
> + /**< Number of event ports. */
> + void *ports[RTE_EVENT_MAX_PORTS_PER_DEV];
> + /**< Array of pointers to ports. */
> + struct rte_event_port_conf
> ports_cfg[RTE_EVENT_MAX_PORTS_PER_DEV];
> + /**< Array of port configuration structures. */
> + struct rte_event_queue_conf
> queues_cfg[RTE_EVENT_MAX_QUEUES_PER_DEV];
> + /**< Array of queue configuration structures. */
> + uint16_t links_map[RTE_EVENT_MAX_PORTS_PER_DEV *
> + RTE_EVENT_MAX_QUEUES_PER_DEV];
> + /**< Memory to store queues to port connections. */
> + void *dev_private;
> + /**< PMD-specific private data */
> + uint32_t event_dev_cap;
> + /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
> + struct rte_event_dev_config dev_conf;
> + /**< Configuration applied to device. */
> + uint8_t service_inited;
> + /* Service initialization state */
> + uint32_t service_id;
> + /* Service ID*/
> + void *dev_stop_flush_arg;
> + /**< User-provided argument for event flush function */
> +
> + RTE_STD_C11
> + uint8_t dev_started : 1;
> + /**< Device state: STARTED(1)/STOPPED(0) */
> +
> + char name[RTE_EVENTDEV_NAME_MAX_LEN];
> + /**< Unique identifier name */
> +
> + uint64_t reserved_64s[4]; /**< Reserved for future fields */
> + void *reserved_ptrs[4]; /**< Reserved for future fields */
> +} __rte_cache_aligned;
> +
> +/** @internal The data structure associated with each event device. */
> +struct rte_eventdev {
> + struct rte_eventdev_data *data;
> + /**< Pointer to device data */
> + struct eventdev_ops *dev_ops;
> + /**< Functions exported by PMD */
> + struct rte_device *dev;
> + /**< Device info. supplied by probing */
> +
> + RTE_STD_C11
> + uint8_t attached : 1;
> + /**< Flag indicating the device is attached */
> +
> + event_enqueue_t enqueue;
> + /**< Pointer to PMD enqueue function. */
> + event_enqueue_burst_t enqueue_burst;
> + /**< Pointer to PMD enqueue burst function. */
> + event_enqueue_burst_t enqueue_new_burst;
> + /**< Pointer to PMD enqueue burst function(op new variant) */
> + event_enqueue_burst_t enqueue_forward_burst;
> + /**< Pointer to PMD enqueue burst function(op forward variant) */
> + event_dequeue_t dequeue;
> + /**< Pointer to PMD dequeue function. */
> + event_dequeue_burst_t dequeue_burst;
> + /**< Pointer to PMD dequeue burst function. */
> + event_tx_adapter_enqueue_t txa_enqueue_same_dest;
> + /**< Pointer to PMD eth Tx adapter burst enqueue function with
> + * events destined to same Eth port & Tx queue.
> + */
> + event_tx_adapter_enqueue_t txa_enqueue;
> + /**< Pointer to PMD eth Tx adapter enqueue function. */
> + event_crypto_adapter_enqueue_t ca_enqueue;
> +
> + uint64_t reserved_64s[4]; /**< Reserved for future fields */
> + void *reserved_ptrs[3]; /**< Reserved for future fields */
> +} __rte_cache_aligned;
> +
> +extern struct rte_eventdev *rte_eventdevs;
> +/** @internal The pool of rte_eventdev structures. */
> +
> /**
> * Get the rte_eventdev structure device pointer for the named device.
> *
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index
> 4c30a37831..e55241defd 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -1365,24 +1365,6 @@ eventdev_find_free_device_index(void)
> return RTE_EVENT_MAX_DEVS;
> }
>
> -static uint16_t
> -rte_event_tx_adapter_enqueue(__rte_unused void *port,
> - __rte_unused struct rte_event ev[],
> - __rte_unused uint16_t nb_events)
> -{
> - rte_errno = ENOTSUP;
> - return 0;
> -}
> -
> -static uint16_t
> -rte_event_crypto_adapter_enqueue(__rte_unused void *port,
> - __rte_unused struct rte_event ev[],
> - __rte_unused uint16_t nb_events)
> -{
> - rte_errno = ENOTSUP;
> - return 0;
> -}
> -
> struct rte_eventdev *
> rte_event_pmd_allocate(const char *name, int socket_id) { @@ -1403,10
> +1385,6 @@ rte_event_pmd_allocate(const char *name, int socket_id)
>
> eventdev = &rte_eventdevs[dev_id];
>
> - eventdev->txa_enqueue = rte_event_tx_adapter_enqueue;
> - eventdev->txa_enqueue_same_dest =
> rte_event_tx_adapter_enqueue;
> - eventdev->ca_enqueue = rte_event_crypto_adapter_enqueue;
> -
> if (eventdev->data == NULL) {
> struct rte_eventdev_data *eventdev_data = NULL;
>
> diff --git a/lib/eventdev/rte_eventdev_core.h
> b/lib/eventdev/rte_eventdev_core.h
> index 916023f71f..61d5ebdc44 100644
> --- a/lib/eventdev/rte_eventdev_core.h
> +++ b/lib/eventdev/rte_eventdev_core.h
> @@ -65,99 +65,6 @@ struct rte_event_fp_ops {
>
> extern struct rte_event_fp_ops rte_event_fp_ops[RTE_EVENT_MAX_DEVS];
>
> -#define RTE_EVENTDEV_NAME_MAX_LEN (64)
> -/**< @internal Max length of name of event PMD */
> -
> -/**
> - * @internal
> - * The data part, with no function pointers, associated with each device.
> - *
> - * This structure is safe to place in shared memory to be common among
> - * different processes in a multi-process configuration.
> - */
> -struct rte_eventdev_data {
> - int socket_id;
> - /**< Socket ID where memory is allocated */
> - uint8_t dev_id;
> - /**< Device ID for this instance */
> - uint8_t nb_queues;
> - /**< Number of event queues. */
> - uint8_t nb_ports;
> - /**< Number of event ports. */
> - void *ports[RTE_EVENT_MAX_PORTS_PER_DEV];
> - /**< Array of pointers to ports. */
> - struct rte_event_port_conf
> ports_cfg[RTE_EVENT_MAX_PORTS_PER_DEV];
> - /**< Array of port configuration structures. */
> - struct rte_event_queue_conf
> queues_cfg[RTE_EVENT_MAX_QUEUES_PER_DEV];
> - /**< Array of queue configuration structures. */
> - uint16_t links_map[RTE_EVENT_MAX_PORTS_PER_DEV *
> - RTE_EVENT_MAX_QUEUES_PER_DEV];
> - /**< Memory to store queues to port connections. */
> - void *dev_private;
> - /**< PMD-specific private data */
> - uint32_t event_dev_cap;
> - /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
> - struct rte_event_dev_config dev_conf;
> - /**< Configuration applied to device. */
> - uint8_t service_inited;
> - /* Service initialization state */
> - uint32_t service_id;
> - /* Service ID*/
> - void *dev_stop_flush_arg;
> - /**< User-provided argument for event flush function */
> -
> - RTE_STD_C11
> - uint8_t dev_started : 1;
> - /**< Device state: STARTED(1)/STOPPED(0) */
> -
> - char name[RTE_EVENTDEV_NAME_MAX_LEN];
> - /**< Unique identifier name */
> -
> - uint64_t reserved_64s[4]; /**< Reserved for future fields */
> - void *reserved_ptrs[4]; /**< Reserved for future fields */
> -} __rte_cache_aligned;
> -
> -/** @internal The data structure associated with each event device. */ -
> struct rte_eventdev {
> - event_enqueue_t enqueue;
> - /**< Pointer to PMD enqueue function. */
> - event_enqueue_burst_t enqueue_burst;
> - /**< Pointer to PMD enqueue burst function. */
> - event_enqueue_burst_t enqueue_new_burst;
> - /**< Pointer to PMD enqueue burst function(op new variant) */
> - event_enqueue_burst_t enqueue_forward_burst;
> - /**< Pointer to PMD enqueue burst function(op forward variant) */
> - event_dequeue_t dequeue;
> - /**< Pointer to PMD dequeue function. */
> - event_dequeue_burst_t dequeue_burst;
> - /**< Pointer to PMD dequeue burst function. */
> - event_tx_adapter_enqueue_t txa_enqueue_same_dest;
> - /**< Pointer to PMD eth Tx adapter burst enqueue function with
> - * events destined to same Eth port & Tx queue.
> - */
> - event_tx_adapter_enqueue_t txa_enqueue;
> - /**< Pointer to PMD eth Tx adapter enqueue function. */
> - struct rte_eventdev_data *data;
> - /**< Pointer to device data */
> - struct eventdev_ops *dev_ops;
> - /**< Functions exported by PMD */
> - struct rte_device *dev;
> - /**< Device info. supplied by probing */
> -
> - RTE_STD_C11
> - uint8_t attached : 1;
> - /**< Flag indicating the device is attached */
> -
> - event_crypto_adapter_enqueue_t ca_enqueue;
> - /**< Pointer to PMD crypto adapter enqueue function. */
> -
> - uint64_t reserved_64s[4]; /**< Reserved for future fields */
> - void *reserved_ptrs[3]; /**< Reserved for future fields */
> -} __rte_cache_aligned;
> -
> -extern struct rte_eventdev *rte_eventdevs;
> -/** @internal The pool of rte_eventdev structures. */
> -
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index
> e684154bf9..9f6eb4ba3c 100644
> --- a/lib/eventdev/version.map
> +++ b/lib/eventdev/version.map
> @@ -83,7 +83,6 @@ DPDK_22 {
> rte_event_timer_arm_burst;
> rte_event_timer_arm_tmo_tick_burst;
> rte_event_timer_cancel_burst;
> - rte_eventdevs;
>
> #added in 21.11
> rte_event_fp_ops;
> @@ -159,4 +158,5 @@ INTERNAL {
> rte_event_pmd_release;
> rte_event_pmd_vdev_init;
> rte_event_pmd_vdev_uninit;
> + rte_eventdevs;
> };
> --
> 2.17.1