From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7FC6BA0096 for ; Thu, 9 May 2019 08:28:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 89E1649E0; Thu, 9 May 2019 08:28:27 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id D91C9239 for ; Thu, 9 May 2019 08:28:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2019 23:28:24 -0700 X-ExtLoop1: 1 Received: from unknown (HELO broadwell-dev-4.localdomain) ([10.224.122.193]) by fmsmga004.fm.intel.com with ESMTP; 08 May 2019 23:28:22 -0700 From: Nikhil Rao To: jerinj@marvell.com Cc: dev@dpdk.org, Nikhil Rao Date: Thu, 9 May 2019 05:27:27 +0530 Message-Id: <1557359847-6374-1-git-send-email-nikhil.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [RFC] eventdev: replace mbufs with events in Rx callback X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190508235727.UG4HOpJ2QxlO6eOYABPS-bIKthrEJnM2CU--YGMDpcY@z> Replace the mbuf pointer array in the event eth Rx adapter callback with an event array instead of an mbuf array. Using an event array allows the application to change attributes of the events enqueued by the SW adapter. Signed-off-by: Nikhil Rao --- Hi All, Please review the new interface proposed below. lib/librte_eventdev/rte_event_eth_rx_adapter.h | 57 +++++++++++++++----------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.h b/lib/librte_eventdev/rte_event_eth_rx_adapter.h index 2314b93..a64eed0 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.h +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.h @@ -66,16 +66,17 @@ * For SW based packet transfers, i.e., when the * RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT is not set in the adapter's * capabilities flags for a particular ethernet device, the service function - * temporarily enqueues mbufs to an event buffer before batch enqueueing these + * temporarily enqueues events 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 + * selectively buffer events. 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. + * the event buffer fill level is low or may want to enqueue packets to an + * internal event port. The rte_event_eth_rx_adapter_cb_register() function + * allows the application to register a callback that selects which packets are + * enqueued to the event device by the SW adapter. The callback interface is + * event based so the callback can also modify the event data if it needs to. */ #ifdef __cplusplus @@ -217,12 +218,23 @@ struct rte_event_eth_rx_adapter_stats { * @b EXPERIMENTAL: this API may change without prior notice * * Callback function invoked by the SW adapter before it continues - * to process packets. The callback is passed the size of the enqueue + * to process events. The callback is passed the size of the enqueue * buffer in the SW adapter and the occupancy of the buffer. The - * callback can use these values to decide which mbufs should be - * enqueued to the event device. If the return value of the callback - * is less than nb_mbuf then the SW adapter uses the return value to - * enqueue enq_mbuf[] to the event device. + * callback can use these values to decide which events are + * enqueued to the event device by the SW adapter. The callback may + * also enqueue events internally using its own event port. The SW + * adapter populates the event information based on the Rx queue + * configuration in the adapter. The callback can modify the this event + * information for the events to be enqueued by the SW adapter. + * + * The callback return value is the number of events from the + * beginning of the event array that are to be enqueued by + * the SW adapter. It is the callback's responsibility to arrange + * these events at the beginning of the array, if these events are + * not contiguous in the original array. The *nb_dropped* parameter is + * a pointer to the number of events dropped by the callback, this + * number is used by the adapter to indicate the number of dropped packets + * as part of its statistics. * * @param eth_dev_id * Port identifier of the Ethernet device. @@ -231,27 +243,26 @@ struct rte_event_eth_rx_adapter_stats { * @param enqueue_buf_size * Total enqueue buffer size. * @param enqueue_buf_count - * mbuf count in enqueue buffer. - * @param mbuf - * mbuf array. - * @param nb_mbuf - * mbuf count. + * Event count in enqueue buffer. + * @param[in, out] ev + * Event array. + * @param nb_event + * Event array length. * @param cb_arg * Callback argument. - * @param[out] enq_mbuf - * The adapter enqueues enq_mbuf[] if the return value of the - * callback is less than nb_mbuf + * @param[out] nb_dropped + * Packets dropped by callback. * @return - * Returns the number of mbufs should be enqueued to eventdev + * - The number of events to be enqueued by the SW adapter. */ typedef uint16_t (*rte_event_eth_rx_adapter_cb_fn)(uint16_t eth_dev_id, uint16_t queue_id, uint32_t enqueue_buf_size, uint32_t enqueue_buf_count, - struct rte_mbuf **mbuf, - uint16_t nb_mbuf, + struct rte_event *ev, + uint16_t nb_event, void *cb_arg, - struct rte_mbuf **enq_buf); + uint16_t *nb_dropped); /** * @warning -- 1.8.3.1