-----Original Message----- > Date: Fri, 8 Jun 2018 23:54:16 +0530 > From: Nikhil Rao <nikhil....@intel.com> > To: jerin.ja...@caviumnetworks.com > CC: dev@dpdk.org, Nikhil Rao <nikhil....@intel.com> > Subject: [PATCH] eventdev: add callback for Rx adapter SW transfers > X-Mailer: git-send-email 1.8.3.1 > > Add ability for application to register a callback function > for SW transfers, the callback can decide which packets can > be enqueued to the event device. > > Signed-off-by: Nikhil Rao <nikhil....@intel.com> > --- > lib/librte_eventdev/rte_event_eth_rx_adapter.h | 78 > ++++++++++++++++++++++ > lib/librte_eventdev/rte_event_eth_rx_adapter.c | 69 +++++++++++++++++-- > .../prog_guide/event_ethernet_rx_adapter.rst | 14 ++++ > lib/librte_eventdev/rte_eventdev_version.map | 1 + > 4 files changed, 158 insertions(+), 4 deletions(-) > > diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.h > b/lib/librte_eventdev/rte_event_eth_rx_adapter.h > index 97f25e9..23d2ed5 100644 > --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.h > +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.h > @@ -63,6 +63,17 @@ > * rte_event_eth_rx_adapter_service_id_get() function can be used to retrieve > * the service function ID of the adapter in this case. > * > + * For SW based packet transfers, the service function temporarily enqueues
I think, you can mention this case is valid when !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT > + * mbufs to an event buffer before batch enqueueing these to the event > device. > + * If the buffer fills up, the service function stops dequeueing packets from > + * the ethernet device. The application may want to monitor the buffer fill > + * level and instruct the service function to selectively buffer packets > + * The application may also use some other criteria to decide which packets > + * should enter the event device even when the event buffer fill level is > low. > + * The rte_event_eth_rx_adapter_cb_register() function allows the > + * application to register a callback that selects which packets to enqueue > + * to the event device. > + * > * Note: > * 1) Devices created after an instance of rte_event_eth_rx_adapter_create > * should be added to a new instance of the rx adapter. > @@ -206,6 +217,47 @@ struct rte_event_eth_rx_adapter_stats { > * @warning > * @b EXPERIMENTAL: this API may change without prior notice > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Register callback to process Rx packets, this is supported for > + * SW based packet transfers. > + * @see rte_event_eth_sw_rx_cb_fn > + * > + * @param id > + * Adapter identifier. > + * @param eth_dev_id > + * Port identifier of Ethernet device. > + * @param cb_fn > + * Callback function. > + * @param cb_arg > + * Callback arg. > + * @return > + * - 0: Success > + * - <0: Error code on failure. > + */ > +int __rte_experimental > +rte_event_eth_rx_sw_cb_register(uint8_t id, > + uint16_t eth_dev_id, > + rte_event_eth_rx_sw_cb_fn cb_fn, > + void *cb_arg); The documentation is using rte_event_eth_rx_adapter_cb_register(), I think, it is better to keep that name. Remove *_sw_* from normative DPDK APIs. > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/librte_eventdev/rte_eventdev_version.map > b/lib/librte_eventdev/rte_eventdev_version.map > index c3f18d6..6bc81c6 100644 > --- a/lib/librte_eventdev/rte_eventdev_version.map > +++ b/lib/librte_eventdev/rte_eventdev_version.map > @@ -109,4 +109,5 @@ EXPERIMENTAL { > rte_event_crypto_adapter_stats_get; > rte_event_crypto_adapter_stats_reset; > rte_event_crypto_adapter_stop; > + rte_event_eth_rx_sw_cb_register; Use alphabetical order. With above changes: Acked-by: Jerin Jacob <jerin.ja...@caviumnetworks.com> > }; > -- > 1.8.3.1 >