From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id E122B5B34 for ; Wed, 3 Oct 2018 11:04:27 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 12F11B4005A; Wed, 3 Oct 2018 09:04:27 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 3 Oct 2018 02:04:23 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Wed, 3 Oct 2018 02:04:23 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w9394LU4032044; Wed, 3 Oct 2018 10:04:21 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id D302D1626D2; Wed, 3 Oct 2018 10:04:21 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov Date: Wed, 3 Oct 2018 10:03:56 +0100 Message-ID: <1538557436-16163-10-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538557436-16163-1-git-send-email-arybchenko@solarflare.com> References: <1538557436-16163-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24132.005 X-TM-AS-Result: No-2.142100-4.000000-10 X-TMASE-MatchedRID: Ln/YJtuWXSUMiTNbd7AZSUf49ONH0RaSSjyMfjCRfaPfUZT83lbkEJxz 8+1dXyV4ifPL5t/+d1WLTYgoYX6PAQM6op3uvrMH4pdq9sdj8LXgHtq54uZTQFfXgfL55inv/KA pvq5xmoXbPmfFYbev8CKpqlhU92AdC2Anznh4fA6eAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8ifEz J5hPndGZmWNFFJYcmdBv+3qXaRTMRJKZdF4kU7pctWXMNM4QfVl1JXgGkzRa49BbRx2naXOkae5 nT6jwwFSWhPzsb0xZvTiIl6obDplpN1JFeUKeMEiOOUXfTkScBZSbxIRLLN37zfneGoTKOTVlxr 1FJij9s= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.142100-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24132.005 X-MDID: 1538557467-TLBgZQBQ3roy Subject: [dpdk-dev] [PATCH 9/9] net/sfc: support Rx descriptor status on EF10 datapath 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: , X-List-Received-Date: Wed, 03 Oct 2018 09:04:28 -0000 From: Igor Romanov Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko Reviewed-by: Ivan Malov --- 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