From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Igor Romanov <Igor.Romanov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 9/9] net/sfc: support Rx descriptor status on EF10 datapath
Date: Wed, 3 Oct 2018 10:03:56 +0100 [thread overview]
Message-ID: <1538557436-16163-10-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1538557436-16163-1-git-send-email-arybchenko@solarflare.com>
From: Igor Romanov <Igor.Romanov@oktetlabs.ru>
Signed-off-by: Igor Romanov <Igor.Romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
---
doc/guides/rel_notes/release_18_11.rst | 1 +
drivers/net/sfc/sfc_ef10_rx.c | 46 ++++++++++++++++++++++----
2 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst
index 9d604d144..e7d8d1fc7 100644
--- a/doc/guides/rel_notes/release_18_11.rst
+++ b/doc/guides/rel_notes/release_18_11.rst
@@ -86,6 +86,7 @@ New Features
Updated the sfc_efx driver including the following changes:
* Added support for Rx scatter in EF10 datapath implementation.
+ * Added support for Rx descriptor status API in EF10 datapath implementation.
* **Added Event Ethernet Tx Adapter.**
diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c
index ff52a024b..77ca580b5 100644
--- a/drivers/net/sfc/sfc_ef10_rx.c
+++ b/drivers/net/sfc/sfc_ef10_rx.c
@@ -500,21 +500,53 @@ sfc_ef10_supported_ptypes_get(uint32_t tunnel_encaps)
static sfc_dp_rx_qdesc_npending_t sfc_ef10_rx_qdesc_npending;
static unsigned int
-sfc_ef10_rx_qdesc_npending(__rte_unused struct sfc_dp_rxq *dp_rxq)
+sfc_ef10_rx_qdesc_npending(struct sfc_dp_rxq *dp_rxq)
{
+ struct sfc_ef10_rxq *rxq = sfc_ef10_rxq_by_dp_rxq(dp_rxq);
+ efx_qword_t rx_ev;
+ const unsigned int evq_old_read_ptr = rxq->evq_read_ptr;
+ unsigned int pending = rxq->pending;
+ unsigned int ready;
+
+ if (unlikely(rxq->flags &
+ (SFC_EF10_RXQ_NOT_RUNNING | SFC_EF10_RXQ_EXCEPTION)))
+ goto done;
+
+ while (sfc_ef10_rx_get_event(rxq, &rx_ev)) {
+ ready = (EFX_QWORD_FIELD(rx_ev, ESF_DZ_RX_DSC_PTR_LBITS) -
+ pending) &
+ EFX_MASK32(ESF_DZ_RX_DSC_PTR_LBITS);
+ pending += ready;
+ }
+
/*
- * Correct implementation requires EvQ polling and events
- * processing (keeping all ready mbufs in prepared).
+ * The function does not process events, so return event queue read
+ * pointer to the original position to allow the events that were
+ * read to be processed later
*/
- return -ENOTSUP;
+ rxq->evq_read_ptr = evq_old_read_ptr;
+
+done:
+ return pending - rxq->completed;
}
static sfc_dp_rx_qdesc_status_t sfc_ef10_rx_qdesc_status;
static int
-sfc_ef10_rx_qdesc_status(__rte_unused struct sfc_dp_rxq *dp_rxq,
- __rte_unused uint16_t offset)
+sfc_ef10_rx_qdesc_status(struct sfc_dp_rxq *dp_rxq, uint16_t offset)
{
- return -ENOTSUP;
+ struct sfc_ef10_rxq *rxq = sfc_ef10_rxq_by_dp_rxq(dp_rxq);
+ unsigned int npending = sfc_ef10_rx_qdesc_npending(dp_rxq);
+
+ if (unlikely(offset > rxq->ptr_mask))
+ return -EINVAL;
+
+ if (offset < npending)
+ return RTE_ETH_RX_DESC_DONE;
+
+ if (offset < (rxq->added - rxq->completed))
+ return RTE_ETH_RX_DESC_AVAIL;
+
+ return RTE_ETH_RX_DESC_UNAVAIL;
}
--
2.17.1
next prev parent reply other threads:[~2018-10-03 9:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 9:03 [dpdk-dev] [PATCH 0/9] net/sfc: support more features in EF10 Rx Andrew Rybchenko
2018-10-03 9:03 ` [dpdk-dev] [PATCH 1/9] net/sfc: receive prepared packets even in Rx exception case Andrew Rybchenko
2018-10-03 9:03 ` [dpdk-dev] [PATCH 2/9] net/sfc: use mbuf raw free instead of mempool put directly Andrew Rybchenko
2018-10-03 9:03 ` [dpdk-dev] [PATCH 3/9] net/sfc: check mbufs allocated using mempool API for Rx Andrew Rybchenko
2018-10-03 9:03 ` [dpdk-dev] [PATCH 4/9] net/sfc: avoid dummy writes to Rx queue state structure Andrew Rybchenko
2018-10-03 9:03 ` [dpdk-dev] [PATCH 5/9] net/sfc: decrease number of variables maintained on EF10 Rx Andrew Rybchenko
2018-10-03 9:03 ` [dpdk-dev] [PATCH 6/9] net/sfc: avoid usage of prepared packets number in " Andrew Rybchenko
2018-10-03 9:03 ` [dpdk-dev] [PATCH 7/9] net/sfc: rename variable to prepare for scatter support Andrew Rybchenko
2018-10-03 9:03 ` [dpdk-dev] [PATCH 8/9] net/sfc: support Rx scatter in EF10 Rx datapath Andrew Rybchenko
2018-10-03 9:03 ` Andrew Rybchenko [this message]
2018-10-04 7:55 ` [dpdk-dev] [PATCH 0/9] net/sfc: support more features in EF10 Rx Ferruh Yigit
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=1538557436-16163-10-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=Igor.Romanov@oktetlabs.ru \
--cc=dev@dpdk.org \
/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).