From patchwork Fri Oct 5 14:47:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 46178 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1CE091B395; Fri, 5 Oct 2018 16:47:18 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 51CEB1B1C2 for ; Fri, 5 Oct 2018 16:47:12 +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-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 1CBA4B4006A; Fri, 5 Oct 2018 14:47:11 +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; Fri, 5 Oct 2018 07:47:08 -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; Fri, 5 Oct 2018 07:47:08 -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 w95El6v3018900; Fri, 5 Oct 2018 15:47:06 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 7B8D71626D2; Fri, 5 Oct 2018 15:47:06 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov Date: Fri, 5 Oct 2018 15:47:03 +0100 Message-ID: <1538750823-26291-4-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538750823-26291-1-git-send-email-arybchenko@solarflare.com> References: <1538750823-26291-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24136.004 X-TM-AS-Result: No-9.635100-4.000000-10 X-TMASE-MatchedRID: /Sl7yZT/bBL4Q348LKfXOB+WEMjoO9WWTJDl9FKHbrkaK6XhXABo94kL qQzkcVeJ74V+pn5+38p/h7Ip5PWGrWr4uS6vfh2tIDGooRVnK21eu73mFK6GNAZbeEWcL03VCKh uU3rY4TCmmrytTc+9iRNVUbpudJzQxpw//AHNLCeeAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8jHUU +U0ACZwPSJc2KlpeZ2aQTUi9c8HCdYpmE3vnnrDeZVCxZfKxCCnqg/VrSZEiM= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--9.635100-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24136.004 X-MDID: 1538750831-oakfaiksiVHT Subject: [dpdk-dev] [PATCH 3/3] net/sfc: support Tx 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Igor Romanov The implemention is shared by ef10 and ef10_simple datapaths. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- doc/guides/rel_notes/release_18_11.rst | 2 ++ drivers/net/sfc/sfc_ef10_tx.c | 43 ++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst index cbf08a76e..60713b921 100644 --- a/doc/guides/rel_notes/release_18_11.rst +++ b/doc/guides/rel_notes/release_18_11.rst @@ -89,6 +89,8 @@ New Features * Added support for Rx scatter in EF10 datapath implementation. * Added support for Rx descriptor status API in EF10 datapath implementation. * Added support for TSO in EF10 datapath implementation. + * Added support for Tx descriptor status API in EF10 (ef10 and ef10_simple) + datapaths implementation. * **Updated failsafe driver.** diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index c97e3bad0..bcd3153ff 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -936,12 +936,49 @@ sfc_ef10_tx_qreap(struct sfc_dp_txq *dp_txq) txq->flags &= ~SFC_EF10_TXQ_STARTED; } +static unsigned int +sfc_ef10_tx_qdesc_npending(struct sfc_ef10_txq *txq) +{ + const unsigned int curr_done = txq->completed - 1; + unsigned int anew_done = curr_done; + efx_qword_t tx_ev; + const unsigned int evq_old_read_ptr = txq->evq_read_ptr; + + if (unlikely(txq->flags & + (SFC_EF10_TXQ_NOT_RUNNING | SFC_EF10_TXQ_EXCEPTION))) + return 0; + + while (sfc_ef10_tx_get_event(txq, &tx_ev)) + anew_done = EFX_QWORD_FIELD(tx_ev, ESF_DZ_TX_DESCR_INDX); + + /* + * 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 + */ + txq->evq_read_ptr = evq_old_read_ptr; + + return (anew_done - curr_done) & txq->ptr_mask; +} + static sfc_dp_tx_qdesc_status_t sfc_ef10_tx_qdesc_status; static int -sfc_ef10_tx_qdesc_status(__rte_unused struct sfc_dp_txq *dp_txq, - __rte_unused uint16_t offset) +sfc_ef10_tx_qdesc_status(struct sfc_dp_txq *dp_txq, + uint16_t offset) { - return -ENOTSUP; + struct sfc_ef10_txq *txq = sfc_ef10_txq_by_dp_txq(dp_txq); + unsigned int npending = sfc_ef10_tx_qdesc_npending(txq); + + if (unlikely(offset > txq->ptr_mask)) + return -EINVAL; + + if (unlikely(offset >= txq->max_fill_level)) + return RTE_ETH_TX_DESC_UNAVAIL; + + if (unlikely(offset < npending)) + return RTE_ETH_TX_DESC_FULL; + + return RTE_ETH_TX_DESC_DONE; } struct sfc_dp_tx sfc_ef10_tx = {