From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9871B45AA8; Fri, 4 Oct 2024 07:14:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76BAD40B9A; Fri, 4 Oct 2024 07:14:40 +0200 (CEST) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by mails.dpdk.org (Postfix) with ESMTP id DC2A840268 for ; Fri, 4 Oct 2024 07:14:38 +0200 (CEST) Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-4581f44b9b4so11646771cf.1 for ; Thu, 03 Oct 2024 22:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728018878; x=1728623678; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=znib4W3zKDEE8y8oTL+Q7QnhKx188URVM6kg83ditqE=; b=Bgpc1ttQ2v6x50w1EK7SSgJizYYMtFEhPwO5LA8ZztKne10RAmEdaoKLjFBufGYXQS aHB0QVuS0ZxwrprnrsJCHTI0AMLf0bZwnH5tkRThbW57eCzyxiRm7G21B2LwocbgbK/d Yf+mN+V2rWajaxNKewniG9UHGukuPSgRynFwD7Up8AuVFQOBCn8+f6goBpMV9U5VcCig nGy5dJtQyQEVvMnC5nx8ZA1JzF63VKB4/t3tyVFYX62eGmqtA71FSfdLE7ql4YW9ScYI +qtK8IVaeBkCgvxzPxxYbuwJjKCferqenVz48UKX1xn1nMkRHsl0d5kpdnqoxlHNtOEv M3rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728018878; x=1728623678; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=znib4W3zKDEE8y8oTL+Q7QnhKx188URVM6kg83ditqE=; b=CIiDL02pijvWzEZ5VNlU0CgR43Q2fLrM6wg9oDBkXXywI+/wTrLend3ziKy1hRi2p2 zoLU5bLUXdh7u6QRkI2DcJX6IwdYGosA1dx7T7OJ1KLasFBVnetzhRUTbkJsylilnOIW TgAAv0nxQmk1bRzjbnMSzphbC2sqJRRLiHp2cJ36Sp9U+pBZOwnmSRpVzs1bTf8VWFjh xeoj/hwjqhjkGGL1i6fFvuUaEnwaTuPD+fav8FSM3NMTrfM1coaxwdPFIymCKWGWk02f Kv75pRhmBiUTkvV2HDqN3aLzO9qpYc+Kpt75t7FRihwemRn8p4FmLkgntULnBATXeCVW TYRw== X-Forwarded-Encrypted: i=1; AJvYcCW3CMPYLFYyOgH9iS3fbfGfdDH1yNBnNna8XnoZqbqhuT7Lwes3UaccCRWHbo+0wD4M6m4=@dpdk.org X-Gm-Message-State: AOJu0YxUY07wT/b6eySmHDe2kAf+XHI0Yz5725+rmc020m4UMID4GsGQ wFAvBQcmm8KiLatHorl6mNrURu/dGcH8GNj5q8hnGMdYo8sijni9L6tSXrE9XoML4E2/lrLfNrc va2iBLaai6KJZ7Tpfz6ntXvVM4Ec= X-Google-Smtp-Source: AGHT+IHOu0n2D4kcCkMOxw9aRr37k6xJmRXADwhRrJVNTZtIju9vxQLpxG5YSEKdT7/UYXQM4+yu160LIxCFZAkfhdg= X-Received: by 2002:a05:622a:1815:b0:453:4b39:c740 with SMTP id d75a77b69052e-45d9ba79e68mr25785061cf.5.1728018878000; Thu, 03 Oct 2024 22:14:38 -0700 (PDT) MIME-Version: 1.0 References: <20241001061411.2537-1-pbhagavatula@marvell.com> <20241001131901.7920-1-pbhagavatula@marvell.com> <20241001131901.7920-4-pbhagavatula@marvell.com> In-Reply-To: <20241001131901.7920-4-pbhagavatula@marvell.com> From: Jerin Jacob Date: Fri, 4 Oct 2024 10:44:11 +0530 Message-ID: Subject: Re: [PATCH v4 3/6] eventdev: add SW event preschedule hint To: pbhagavatula@marvell.com Cc: jerinj@marvell.com, sthotton@marvell.com, abdullah.sevincer@intel.com, hemant.agrawal@nxp.com, sachin.saxena@oss.nxp.com, harry.van.haaren@intel.com, mattias.ronnblom@ericsson.com, liangma@liangbit.com, peter.mccarthy@intel.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, Oct 2, 2024 at 2:19=E2=80=AFAM wrote: > > From: Pavan Nikhilesh > > Add a new eventdev API to provide a hint to the eventdev PMD to > pre-schedule the next event into the event port, without releasing > the current flow context. > Event device that support this feature advertises the capability > using the RTE_EVENT_DEV_CAP_SW_PRESCHEDULE capability flag. Change to RTE_EVENT_DEV_CAP_PRESCHEDULE_* prefix like other capas. > > Application can invoke `rte_event_port_preschedule` to hint the PMD. > > Signed-off-by: Pavan Nikhilesh > --- > doc/guides/prog_guide/eventdev/eventdev.rst | 8 ++++ > doc/guides/rel_notes/release_24_11.rst | 3 +- > lib/eventdev/eventdev_pmd.h | 2 + > lib/eventdev/eventdev_private.c | 21 ++++++++- > lib/eventdev/eventdev_trace_points.c | 3 ++ > lib/eventdev/rte_eventdev.h | 49 +++++++++++++++++++++ > lib/eventdev/rte_eventdev_core.h | 5 +++ > lib/eventdev/rte_eventdev_trace_fp.h | 8 ++++ > lib/eventdev/version.map | 2 + > 9 files changed, 98 insertions(+), 3 deletions(-) > > diff --git a/doc/guides/prog_guide/eventdev/eventdev.rst b/doc/guides/pro= g_guide/eventdev/eventdev.rst > index 2deab0333e..1d8b86ab66 100644 > --- a/doc/guides/prog_guide/eventdev/eventdev.rst > +++ b/doc/guides/prog_guide/eventdev/eventdev.rst > @@ -390,6 +390,14 @@ To enable or disable event pre-scheduling at a given= event port, the application > // Disable pre-scheduling if thread is about to be scheduled out and = issue dequeue() to drain > // pending events. > > +Event Pre-schedule Hint can be used to provide a hint to the eventdev PM= D to pre-schedule the next pre-schedule Hint -> hint Application may provide pre-schedule hint to eventdev PMD to pre-schedule .= ... > +event without releasing the current flow context. Event device that supp= ort this feature advertises > +the capability using the ``RTE_EVENT_DEV_CAP_SW_PRESCHEDULE`` capability= flag. SW is a very overloaded term, How about RTE_EVENT_DEV_CAP_PRESCHEDULE_EXPLI= CT? Tell it is HINT. No need to check the capability in fast path. > +If pre-scheduling is already enabled at a event device or event port lev= el then the hint is ignored. > + > +.. code-block:: c > + > + rte_event_port_preschedule(dev_id, port_id, RTE_EVENT_DEV_PRESCHEDULE= ); Since it is used at port level. Remove _DEV_. > > Starting the EventDev > ~~~~~~~~~~~~~~~~~~~~~ > diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_note= s/release_24_11.rst > index 6e36ac7b7e..3ada21c084 100644 > --- a/doc/guides/rel_notes/release_24_11.rst > +++ b/doc/guides/rel_notes/release_24_11.rst > @@ -64,7 +64,8 @@ New Features > level pre-scheduling type. > * Added ``rte_event_port_preschedule_modify`` to modify pre-scheduling= type > on a given event port. > - > + * Added ``rte_event_port_preschedule`` to allow applications to decide= when > + to pre-schedule events on an event port. As an explicit request or so. > > Removed Items > ------------- > diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h > index 9ea23aa6cd..0bee2347ef 100644 > --- a/lib/eventdev/eventdev_pmd.h > +++ b/lib/eventdev/eventdev_pmd.h > @@ -186,6 +186,8 @@ struct __rte_cache_aligned rte_eventdev { > /**< Pointer to PMD Event switch profile function. */ > event_preschedule_modify_t preschedule_modify; > /**< Pointer to PMD Event port pre-schedule type modify function.= */ > + event_preschedule_t preschedule; > + /**< Pointer to PMD Event port pre-schedule function. */ > > uint64_t reserved_64s[3]; /**< Reserved for future fields */ > void *reserved_ptrs[3]; /**< Reserved for future fields */ > diff --git a/lib/eventdev/eventdev_private.c b/lib/eventdev/eventdev_priv= ate.c > index dc37f736f8..6aed1cba9a 100644 > --- a/lib/eventdev/eventdev_private.c > +++ b/lib/eventdev/eventdev_private.c > @@ -111,6 +111,19 @@ dummy_event_port_preschedule_modify_hint(__rte_unuse= d void *port, > return -ENOTSUP; > } > > +static void > +dummy_event_port_preschedule(__rte_unused void *port, > + __rte_unused rte_event_dev_preschedule_type_= t preschedule) > +{ > + RTE_EDEV_LOG_ERR("pre-schedule requested for unconfigured event d= evice"); > +} > + > +static void > +dummy_event_port_preschedule_hint(__rte_unused void *port, > + __rte_unused rte_event_dev_preschedule_type_= t preschedule) > +{ > +} > + > void > event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op) > { > @@ -124,12 +137,12 @@ event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_= op) > .dequeue_burst =3D dummy_event_dequeue_burst, > .maintain =3D dummy_event_maintain, > .txa_enqueue =3D dummy_event_tx_adapter_enqueue, > - .txa_enqueue_same_dest =3D > - dummy_event_tx_adapter_enqueue_same_dest, > + .txa_enqueue_same_dest =3D dummy_event_tx_adapter_enqueue= _same_dest, > .ca_enqueue =3D dummy_event_crypto_adapter_enqueue, > .dma_enqueue =3D dummy_event_dma_adapter_enqueue, > .profile_switch =3D dummy_event_port_profile_switch, > .preschedule_modify =3D dummy_event_port_preschedule_modi= fy, > + .preschedule =3D dummy_event_port_preschedule, > .data =3D dummy_data, > }; > > @@ -153,8 +166,12 @@ event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op, > fp_op->dma_enqueue =3D dev->dma_enqueue; > fp_op->profile_switch =3D dev->profile_switch; > fp_op->preschedule_modify =3D dev->preschedule_modify; > + fp_op->preschedule =3D dev->preschedule; > fp_op->data =3D dev->data->ports; > > if (fp_op->preschedule_modify =3D=3D NULL) > fp_op->preschedule_modify =3D dummy_event_port_preschedul= e_modify_hint; > + > + if (fp_op->preschedule =3D=3D NULL) > + fp_op->preschedule =3D dummy_event_port_preschedule_hint; > } > diff --git a/lib/eventdev/eventdev_trace_points.c b/lib/eventdev/eventdev= _trace_points.c > index e41674123c..e7af1591f7 100644 > --- a/lib/eventdev/eventdev_trace_points.c > +++ b/lib/eventdev/eventdev_trace_points.c > @@ -52,6 +52,9 @@ RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_port_profil= e_switch, > RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_port_preschedule_modify, > lib.eventdev.port.preschedule.modify) > > +RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_port_preschedule, > + lib.eventdev.port.preschedule) > + > /* Eventdev Rx adapter trace points */ > RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_eth_rx_adapter_create, > lib.eventdev.rx.adapter.create) > diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h > index 0add0093ac..8df6a8bee1 100644 > --- a/lib/eventdev/rte_eventdev.h > +++ b/lib/eventdev/rte_eventdev.h > @@ -480,6 +480,15 @@ struct rte_event; > * @see rte_event_port_preschedule_modify() > */ > > +#define RTE_EVENT_DEV_CAP_SW_PRESCHEDULE (1ULL << 19) > +/**< Event device supports software prescheduling. > + * > + * When this flag is set, the application can issue preschedule request = on > + * a event port. > + * > + * @see rte_event_port_preschedule() > + */ > + > /* Event device priority levels */ > #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0 > /**< Highest priority level for events and queues. > @@ -2977,6 +2986,46 @@ rte_event_port_preschedule_modify(uint8_t dev_id, = uint8_t port_id, > return fp_ops->preschedule_modify(port, type); > } > > +/** > + * Provide a hint to the event device to pre-schedule events to event po= rt . > + * > + * Hint the event device to pre-schedule events to the event port. > + * The call doesn't not guarantee that the events will be pre-scheduleed= . > + * The call doesn't release the flow context currently held by the event= port. > + * The event device should support RTE_EVENT_DEV_CAP_SW_PRESCHEDULE capa= bility. Reword the comments. > + * > + * When pre-scheduling is enabled at an event device or event port level= , the > + * hint is ignored. > + * > + * Subsequent calls to rte_event_dequeue_burst() will dequeue the pre-sc= hedule > + * events but pre-schedule operation is not issued again. > + * > + * @param dev_id > + * The identifier of the device. > + * @param port_id > + * The identifier of the event port. > + * @param type > + * The pre-schedule type to use on the event port. > + */ > +static inline void > +rte_event_port_preschedule(uint8_t dev_id, uint8_t port_id, rte_event_de= v_preschedule_type_t type) > +{ > + const struct rte_event_fp_ops *fp_ops; > + void *port; > + > + fp_ops =3D &rte_event_fp_ops[dev_id]; > + port =3D fp_ops->data[port_id]; > + > +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG > + if (dev_id >=3D RTE_EVENT_MAX_DEVS || port_id >=3D RTE_EVENT_MAX_= PORTS_PER_DEV) > + return; > + if (port =3D=3D NULL) > + return; > +#endif > + rte_eventdev_trace_port_preschedule(dev_id, port_id, type); > + > + fp_ops->preschedule(port, type); > +} > #ifdef __cplusplus > } > #endif > diff --git a/lib/eventdev/rte_eventdev_core.h b/lib/eventdev/rte_eventdev= _core.h > index 2275888a6b..21988abb4f 100644 > --- a/lib/eventdev/rte_eventdev_core.h > +++ b/lib/eventdev/rte_eventdev_core.h > @@ -53,6 +53,9 @@ typedef int (*event_preschedule_modify_t)(void *port, > rte_event_dev_preschedule_type_= t preschedule_type); > /**< @internal Modify pre-schedule type on the event port. */ > > +typedef void (*event_preschedule_t)(void *port, rte_event_dev_preschedul= e_type_t preschedule_type); > +/**< @internal Issue pre-schedule on an event port. */ > + > struct __rte_cache_aligned rte_event_fp_ops { > void **data; > /**< points to array of internal port data pointers */ > @@ -82,6 +85,8 @@ struct __rte_cache_aligned rte_event_fp_ops { > /**< PMD Event switch profile function. */ > event_preschedule_modify_t preschedule_modify; > /**< PMD Event port pre-schedule switch. */ > + event_preschedule_t preschedule; > + /**< PMD Event port pre-schedule. */ Use reserved not to break ABI > uintptr_t reserved[4]; > };