DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Mattias Rönnblom" <hofors@lysator.liu.se>
To: "Jerin Jacob" <jerinjacobk@gmail.com>,
	"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
Cc: dev@dpdk.org, "Jerin Jacob" <jerinj@marvell.com>,
	techboard@dpdk.org, harry.van.haaren@intel.com,
	"Peter Nilsson" <peter.j.nilsson@ericsson.com>,
	"Heng Wang" <heng.wang@ericsson.com>,
	"Naga Harish K S V" <s.v.naga.harish.k@intel.com>,
	"Pavan Nikhilesh" <pbhagavatula@marvell.com>,
	"Gujjar Abhinandan S" <abhinandan.gujjar@intel.com>,
	"Erik Gabriel Carrillo" <erik.g.carrillo@intel.com>,
	"Shijith Thotton" <sthotton@marvell.com>,
	"Hemant Agrawal" <hemant.agrawal@nxp.com>,
	"Sachin Saxena" <sachin.saxena@oss.nxp.com>,
	"Liang Ma" <liangma@liangbit.com>,
	"Peter Mccarthy" <peter.mccarthy@intel.com>,
	"Zhirun Yan" <zhirun.yan@intel.com>,
	"Morten Brørup" <mb@smartsharesystems.com>
Subject: Re: [PATCH v3 1/3] lib: introduce dispatcher library
Date: Thu, 21 Sep 2023 18:47:02 +0200	[thread overview]
Message-ID: <b09b6778-fab9-3086-ab56-9440dfc6bee7@lysator.liu.se> (raw)
In-Reply-To: <CALBAE1N+NXZxJvYLaYkj+rmvR0WORmMGfptUAVbYVNNsk4N8aA@mail.gmail.com>

On 2023-09-19 12:58, Jerin Jacob wrote:
> On Mon, Sep 4, 2023 at 6:39 PM Mattias Rönnblom
> <mattias.ronnblom@ericsson.com> wrote:
>>
>> The purpose of the dispatcher library is to help reduce coupling in an
>> Eventdev-based DPDK application.
>>
>> In addition, the dispatcher also provides a convenient and flexible
>> way for the application to use service cores for application-level
>> processing.
>>
>> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
>> Tested-by: Peter Nilsson <peter.j.nilsson@ericsson.com>
> 
> High level architecture comment
> --------------------------------
> 
> 1) I think, we don't need tie this library ONLY to event dev
> application. It can be used with poll mode as well,
> that way traditiona pipeline application with ethdev as source could
> use this library dispatch the packets.
> 

They could potentially use a library *like this*, but I'm not sure it 
should be this library, or at least I think it should be a different API 
(better type checking, plus no obvious benefit of being more generic).

Another option for a traditional app calling rte_eth_rx_burst() directly 
is to start using eventdev. :)

> We dont need to implement that first version but API can make room for
> such abstractions.
> 
> Based on my understanding in fast-path it has means to
> a)Pull out the events using rte_event_dequeue()
> b)Compare with registered match functions and call process upon match.
> 
> if we abstract (a) as rte_dispatcher_source, We could pull from ethdev
> via rte_eth_rx_burst() or
> from ring via dequeue_burst API or so based on rte_dispatcher_source
> selected for dispatch configuration
> and we can use different sevice function pointers to have different service core
> implementation without effecting performance each sources.
> 

It could be generalized, for sure. I don't think it should be, at this 
point at least.

Non-event dev events could - and at this point I'm leaning toward 
*should* - be consumed as a different DPDK service, but potentially on 
the same lcore.

If you would want to prepare for a future with several different event 
sources, one could consider reintroducing the word "event" somewhere in 
the dispatcher's name. So you would have
rte_event_dispatcher.h
rte_eth_dispatcher.h

or

rte_dispatcher_event.h
rte_dispatcher_eth.h

> High level cosmetic comment
> ----------------------------------------------------
> 1)Missing doxygen connection- See doc/api/doxy-api-index.md
> 

rte_dispatcher.h is listed under **classification**, but this change is 
in the programming guide patch. I'll move it to the patch containing the 
header file.


> Process related comment
> ------------------------------------
> 1) Documentation does not need need separate patch. All recent library
> changes documentation in same file.
> You could have doc and API header file as first patch and
> implementation as subsequent patches.
> 
> 

I'm not sure how this is an improvement. Can you elaborate? For me, it 
just seems like a change.

Are there some guidelines on how to split a larger change into a patch 
set? A section on this matter in the contribution guide would be great.

> 
>> diff --git a/lib/dispatcher/rte_dispatcher.h b/lib/dispatcher/rte_dispatcher.h
>> new file mode 100644
>> index 0000000000..6712687a08
>> --- /dev/null
>> +++ b/lib/dispatcher/rte_dispatcher.h
>> @@ -0,0 +1,480 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2023 Ericsson AB
>> + */
>> +
>> +#ifndef __RTE_DISPATCHER_H__
>> +#define __RTE_DISPATCHER_H__
>> +
> 
> 
> All new API should be experimental. See
> https://elixir.bootlin.com/dpdk/latest/source/lib/graph/rte_graph.h#L12
> example.
> 

Noted.

> 
>> +/**
>> + * @file
>> + *
>> + * RTE Dispatcher
>> + *
>> + * The purpose of the dispatcher is to help decouple different parts
>> + * of an application (e.g., modules), sharing the same underlying
>> + * event device.
>> +
>> +/**
>> + * Function prototype for match callbacks.
>> + *
>> + * Match callbacks are used by an application to decide how the
>> + * dispatcher distributes events to different parts of the
>> + * application.
>> + *
>> + * The application is not expected to process the event at the point
>> + * of the match call. Such matters should be deferred to the process
>> + * callback invocation.
>> + *
>> + * The match callback may be used as an opportunity to prefetch data.
>> + *
>> + * @param event
>> + *  Pointer to event
>> + *
>> + * @param cb_data
>> + *  The pointer supplied by the application in
>> + *  rte_dispatcher_register().
>> + *
>> + * @return
>> + *   Returns true in case this events should be delivered (via
>> + *   the process callback), and false otherwise.
>> + */
>> +typedef bool
>> +(*rte_dispatcher_match_t)(const struct rte_event *event, void *cb_data);
> 
> 
> a) Can we use void* event, so that it can be used with mbuf or other
> type by casting in the call back implementer.
> 
> b) I was thinking, How we can avoid this function pointer and enable
> more have better performance at architecture level.
> 
> Both x86, ARM has vector instructions[1] to form a vector from various
> offset from memory and compare N events
> in one shot. That is, if express match data like offset = X has value
> is Y and offset = X has value = A.
> I know, it may not good existing application using this APIs. But I
> believe, it will be more performance
> effective. If make sense, you can adapt to this.(Something to think about)
> 

There may be a future development where you try to shave off a few of 
the circa 10 clock cycles per event of overhead that the current 
implementation incur. 10 cc is not a lot though. Your eventdev will need 
something like 10x that.

With link-time optimizations, the matching function call will go away. 
I'm not sure how much auto-vectorization will happen. (The number quoted 
above is without LTO.)

The event dispatcher as a separate library will result in an extra 
function call across a shared object boundary, which is not exactly for 
free. (The 10 cc are for static linking.)

> 
> [1]
> https://developer.arm.com/documentation/den0018/a/NEON-and-VFP-Instruction-Summary/NEON-general-data-processing-instructions/VTBL
> 
>> +
>> +/**
>> + * Function prototype for process callbacks.
>> + *
>> + * The process callbacks are used by the dispatcher to deliver
>> + * events for processing.
>> + *
>> + * @param event_dev_id
>> + *  The originating event device id.
>> + *
>> + * @param event_port_id
>> + *  The originating event port.
>> + *
>> + * @param events
>> + *  Pointer to an array of events.
>> + *
>> + * @param num
>> + *  The number of events in the @p events array.
>> + *
>> + * @param cb_data
>> + *  The pointer supplied by the application in
>> + *  rte_dispatcher_register().
>> + */
>> +
>> +typedef void
>> +(*rte_dispatcher_process_t)(uint8_t event_dev_id, uint8_t event_port_id,
>> +                                 struct rte_event *events, uint16_t num,
>> +                                 void *cb_data);
> 
> Same as above comment, can event_port_id can be change to source_id?
> 
> 
>> +/**
>> + * Create a dispatcher with the specified id.
>> + *
>> + * @param id
>> + *  An application-specified, unique (across all dispatcher
>> + *  instances) identifier.
>> + *
>> + * @param event_dev_id
>> + *  The identifier of the event device from which this dispatcher
>> + *  will dequeue events.
>> + *
>> + * @return
>> + *   - 0: Success
>> + *   - <0: Error code on failure
>> + */
>> +__rte_experimental
>> +int
>> +rte_dispatcher_create(uint8_t id, uint8_t event_dev_id);
> 
> Following could be used to abstract more dispatcher sources, like
> 
> enum rte_dispatcher_source {
>           RTE_DISPATCHER_SOURCE_EVENTDEV, // Use rte_event_dequeue() to
> pull the packet
>           RTE_DISPATCHER_SOURCE_ETHDEV, // Use rte_ethdev_rx_burst() to
> pull the packet
> };
> 
> struct rte_dispatcher_params {
>              enum rte_dispatcher_source source;
>              union {
>                     /* Valid when source == RTE_DISPATCHER_SOURCE_EVENTDEV */
>                      struct event_source {
>                               uint8_t event_dev_id;
>                               uin8_t event_port_id;
>                      };
>                     /* Valid when source == RTE_DISPATCHER_SOURCE_ETHDEV*/
>                      struct ethdev_source {
>                               uint16_t ethdev__dev_id;
>                               uin16_t ethdev_rx_queue_id;
>                      };
>               }
> };
> 
> rte_dispatcher_create(uint8_t id,  struct rte_dispatcher_params *parms);
> 
> I will stop reviewing at this point. Will review based on direction agree on.

Thanks!

  reply	other threads:[~2023-09-21 16:47 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 18:30 [dpdk-dev] [RFC] eventdev: introduce event dispatcher Mattias Rönnblom
2021-02-22 15:28 ` Luca Boccassi
2021-02-26  7:48   ` Mattias Rönnblom
2021-02-25 12:32 ` Jerin Jacob
2021-02-26  8:01   ` Mattias Rönnblom
2021-03-07 13:04     ` Jerin Jacob
2021-03-15 14:44       ` Mattias Rönnblom
2021-03-15 15:00         ` Van Haaren, Harry
2021-03-22  9:50           ` Mattias Rönnblom
2021-04-09 11:32             ` [dpdk-dev] [RFC v2] " Mattias Rönnblom
2023-05-22  9:16               ` [RFC v3 0/3] Add " Mattias Rönnblom
2023-05-22  9:16                 ` [RFC v3 1/3] eventdev: introduce " Mattias Rönnblom
2023-06-09  7:08                   ` [RFC v4 0/3] Add " Mattias Rönnblom
2023-06-09  7:08                     ` [RFC v4 1/3] eventdev: introduce " Mattias Rönnblom
2023-06-09 14:34                       ` Stephen Hemminger
2023-06-09 17:51                         ` Mattias Rönnblom
2023-06-14 17:25                       ` [PATCH 0/3] Add " Mattias Rönnblom
2023-06-14 17:25                         ` [PATCH 1/3] eventdev: introduce " Mattias Rönnblom
2023-06-14 18:13                           ` Stephen Hemminger
2023-06-15  6:07                             ` Mattias Rönnblom
2023-06-16  7:40                           ` [PATCH v2 0/3] Add " Mattias Rönnblom
2023-06-16  7:40                             ` [PATCH v2 1/3] eventdev: introduce " Mattias Rönnblom
2023-08-18  6:09                               ` Jerin Jacob
2023-08-22  8:42                                 ` Mattias Rönnblom
2023-08-22 12:32                                   ` Jerin Jacob
2023-08-24 11:17                                     ` Mattias Rönnblom
2023-08-25  7:27                                       ` Jerin Jacob
2023-09-01 10:53                                 ` Mattias Rönnblom
2023-09-01 10:56                                   ` Jerin Jacob
2023-09-04 13:03                               ` [PATCH v3 0/3] Add dispatcher library Mattias Rönnblom
2023-09-04 13:03                                 ` [PATCH v3 1/3] lib: introduce " Mattias Rönnblom
2023-09-17 16:46                                   ` Naga Harish K, S V
2023-09-19  9:20                                     ` Mattias Rönnblom
2023-09-20  9:11                                       ` Naga Harish K, S V
2023-09-20  9:32                                     ` Jerin Jacob
2023-09-21  5:59                                       ` Naga Harish K, S V
2023-09-21  7:23                                         ` Jerin Jacob
2023-09-19 10:58                                   ` Jerin Jacob
2023-09-21 16:47                                     ` Mattias Rönnblom [this message]
2023-09-21 17:47                                       ` Jerin Jacob
2023-09-21 18:36                                   ` Jerin Jacob
2023-09-22  6:32                                     ` Mattias Rönnblom
2023-09-22  7:38                                   ` [PATCH v4 0/3] Add " Mattias Rönnblom
2023-09-22  7:38                                     ` [PATCH v4 1/3] lib: introduce " Mattias Rönnblom
2023-09-25  7:11                                       ` Mattias Rönnblom
2023-09-25  7:59                                         ` Bruce Richardson
2023-09-26 18:28                                         ` Jerin Jacob
2023-09-27  8:13                                           ` Bruce Richardson
2023-09-28  7:44                                             ` Mattias Rönnblom
2023-10-03 17:31                                             ` Jerin Jacob
2023-09-28  7:30                                       ` [PATCH v5 0/3] Add " Mattias Rönnblom
2023-09-28  7:30                                         ` [PATCH v5 1/3] lib: introduce " Mattias Rönnblom
2023-10-05  8:36                                           ` David Marchand
2023-10-05 10:08                                             ` Mattias Rönnblom
2023-10-06  8:46                                               ` David Marchand
2023-10-06  9:03                                                 ` Thomas Monjalon
2023-10-09 17:40                                                   ` Mattias Rönnblom
2023-10-09 16:49                                                 ` Mattias Rönnblom
2023-10-11 14:57                                                   ` David Marchand
2023-10-11 20:51                                                     ` Mattias Rönnblom
2023-10-09 18:17                                           ` [PATCH v6 0/3] Add " Mattias Rönnblom
2023-10-09 18:17                                             ` [PATCH v6 1/3] lib: introduce " Mattias Rönnblom
2023-10-11  7:16                                               ` [PATCH v7 0/3] Add " Mattias Rönnblom
2023-10-11  7:16                                                 ` [PATCH v7 1/3] lib: introduce " Mattias Rönnblom
2023-10-12  8:50                                                   ` [PATCH v8 0/3] Add " Mattias Rönnblom
2023-10-12  8:50                                                     ` [PATCH v8 1/3] lib: introduce " Mattias Rönnblom
2023-10-12  8:50                                                     ` [PATCH v8 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-10-12  8:50                                                     ` [PATCH v8 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-10-12 12:48                                                     ` [PATCH v8 0/3] Add dispatcher library David Marchand
2023-10-11  7:16                                                 ` [PATCH v7 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-10-11  7:17                                                 ` [PATCH v7 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-10-09 18:17                                             ` [PATCH v6 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-10-10 11:56                                               ` David Marchand
2023-10-11  6:28                                                 ` Mattias Rönnblom
2023-10-11  7:26                                                   ` David Marchand
2023-10-10 14:02                                               ` David Marchand
2023-10-11  6:45                                                 ` Mattias Rönnblom
2023-10-09 18:17                                             ` [PATCH v6 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-10-10 13:31                                               ` David Marchand
2023-10-11  6:38                                                 ` Mattias Rönnblom
2023-09-28  7:30                                         ` [PATCH v5 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-10-05  8:36                                           ` David Marchand
2023-10-05 11:25                                             ` Mattias Rönnblom
2023-10-06  8:52                                               ` David Marchand
2023-10-09 17:16                                                 ` Mattias Rönnblom
2023-09-28  7:30                                         ` [PATCH v5 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-10-05  8:36                                           ` David Marchand
2023-10-05 11:33                                             ` Mattias Rönnblom
2023-09-22  7:38                                     ` [PATCH v4 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-09-22  7:38                                     ` [PATCH v4 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-09-04 13:03                                 ` [PATCH v3 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-09-04 13:03                                 ` [PATCH v3 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-09-06 19:32                                 ` [PATCH v3 0/3] Add dispatcher library Stephen Hemminger
2023-09-06 20:28                                   ` Mattias Rönnblom
2023-06-16  7:40                             ` [PATCH v2 2/3] test: add event dispatcher test suite Mattias Rönnblom
2023-06-16  7:40                             ` [PATCH v2 3/3] doc: add event dispatcher programming guide Mattias Rönnblom
2023-06-14 17:25                         ` [PATCH 2/3] test: add event dispatcher test suite Mattias Rönnblom
2023-06-14 17:25                         ` [PATCH 3/3] doc: add event dispatcher programming guide Mattias Rönnblom
2023-06-09  7:08                     ` [RFC v4 2/3] test: add event dispatcher test suite Mattias Rönnblom
2023-06-09  7:08                     ` [RFC v4 3/3] doc: add event dispatcher programming guide Mattias Rönnblom
2023-05-22  9:16                 ` [RFC v3 2/3] test: add event dispatcher test suite Mattias Rönnblom
2023-05-22  9:16                 ` [RFC v3 3/3] doc: add event dispatcher programming guide Mattias Rönnblom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b09b6778-fab9-3086-ab56-9440dfc6bee7@lysator.liu.se \
    --to=hofors@lysator.liu.se \
    --cc=abhinandan.gujjar@intel.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=heng.wang@ericsson.com \
    --cc=jerinj@marvell.com \
    --cc=jerinjacobk@gmail.com \
    --cc=liangma@liangbit.com \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=mb@smartsharesystems.com \
    --cc=pbhagavatula@marvell.com \
    --cc=peter.j.nilsson@ericsson.com \
    --cc=peter.mccarthy@intel.com \
    --cc=s.v.naga.harish.k@intel.com \
    --cc=sachin.saxena@oss.nxp.com \
    --cc=sthotton@marvell.com \
    --cc=techboard@dpdk.org \
    --cc=zhirun.yan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).