From: Nikhil Rao <nikhil.rao@intel.com>
To: jerinj@marvell.com
Cc: dev@dpdk.org, Nikhil Rao <nikhil.rao@intel.com>
Subject: [dpdk-dev] [PATCH 1/2] eventdev: replace mbufs with events in Rx callback
Date: Thu, 30 May 2019 06:49:43 +0530 [thread overview]
Message-ID: <1559179184-2052-1-git-send-email-nikhil.rao@intel.com> (raw)
In-Reply-To: <1557359847-6374-1-git-send-email-nikhil.rao@intel.com>
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 <nikhil.rao@intel.com>
---
lib/librte_eventdev/rte_event_eth_rx_adapter.h | 57 +++++++++++++++-----------
lib/librte_eventdev/rte_event_eth_rx_adapter.c | 32 ++++++++-------
2 files changed, 52 insertions(+), 37 deletions(-)
This patch depends on
http://patchwork.dpdk.org/patch/53614/
Resending - the previous attempt only sent the first patch.
v1:
* add implementation to RFC
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
diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
index a201668..ab4e3cf 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
@@ -767,8 +767,8 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
uint32_t rss;
int do_rss;
uint64_t ts;
- struct rte_mbuf *cb_mbufs[BATCH_SIZE];
uint16_t nb_cb;
+ uint16_t dropped;
/* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
@@ -784,19 +784,6 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
}
}
-
- nb_cb = dev_info->cb_fn ? dev_info->cb_fn(eth_dev_id, rx_queue_id,
- ETH_EVENT_BUFFER_SIZE,
- buf->count, mbufs,
- num,
- dev_info->cb_arg,
- cb_mbufs) :
- num;
- if (nb_cb < num) {
- mbufs = cb_mbufs;
- num = nb_cb;
- }
-
for (i = 0; i < num; i++) {
m = mbufs[i];
@@ -818,6 +805,23 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
ev++;
}
+ if (dev_info->cb_fn) {
+
+ nb_cb = dev_info->cb_fn(eth_dev_id,
+ rx_queue_id,
+ ETH_EVENT_BUFFER_SIZE,
+ buf->count,
+ ev,
+ num,
+ dev_info->cb_arg,
+ &dropped);
+ if (unlikely(nb_cb > num))
+ RTE_EDEV_LOG_ERR("Rx CB returned %d (> %d) events",
+ nb_cb, num);
+ else
+ num = nb_cb;
+ }
+
buf->count += num;
}
--
1.8.3.1
next prev parent reply other threads:[~2019-05-30 13:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-08 23:57 [dpdk-dev] [RFC] " Nikhil Rao
2019-05-08 23:57 ` Nikhil Rao
2019-05-30 1:07 ` [dpdk-dev] [PATCH 1/2] " Nikhil Rao
2019-05-30 1:19 ` Nikhil Rao [this message]
2019-05-30 1:19 ` [dpdk-dev] [PATCH 2/2] eventdev: add dropped count to Rx adapter stats Nikhil Rao
2019-06-13 23:28 ` [dpdk-dev] [PATCH v2] eventdev: change Rx adapter callback and stats structure Nikhil Rao
2019-06-24 23:16 ` [dpdk-dev] [PATCH v3] " Nikhil Rao
2019-06-10 4:33 [dpdk-dev] [PATCH 1/2] eventdev: replace mbufs with events in Rx callback Jerin Jacob Kollanukkaran
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=1559179184-2052-1-git-send-email-nikhil.rao@intel.com \
--to=nikhil.rao@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.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).