From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42C79A0C47 for ; Tue, 10 Aug 2021 17:42:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3CF2A4014F; Tue, 10 Aug 2021 17:42:59 +0200 (CEST) Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by mails.dpdk.org (Postfix) with ESMTP id 15BD5411C8 for ; Tue, 10 Aug 2021 17:42:58 +0200 (CEST) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id EAA143F047 for ; Tue, 10 Aug 2021 15:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628610177; bh=Cgm6Dvro9y/RLevD5DjnZT/M95vntDEsHLJXgRH5WSU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=STZ/Ob22NENK+is8soZ3wp8OlaI45/ewpCpzRh8DMMS8mv/7iDa8Xv7BD2JxKRwXw 5LbKAPfPRDhWMxnJsa9oBowigpN1tOriRyNM3x1GgHn/hO/s8FJlWekAhN/jyqQ3fg IE6q1hvSiLVOdEDr7pHiYo6EQLCCfYHBc11dYJGtwEWu21AEsD0H8GDseRL9fhnskZ ZX80JVAJnErDq84lLrL6/AL7F2K+UVLcY+j38YHTCZrhliMET1bbOTlcfZYOKp28uF ptR39C/xiGX6Osy7lV6Iof8jUAA56OMulh75e+i8LVpcIXa8eIuOoBCuKgSBJZt9Kf XCe3Hccpg5LrQ== Received: by mail-ed1-f71.google.com with SMTP id u4-20020a50eac40000b02903bddc52675eso10763915edp.4 for ; Tue, 10 Aug 2021 08:42:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cgm6Dvro9y/RLevD5DjnZT/M95vntDEsHLJXgRH5WSU=; b=jRQoq2GkgYQhAB1tlvRMVj3BlcxmJbS7delYWvNkQPbtEzeWoF0O/13zObqiTKitGO 1WIgjvpJgZElr2tcpZzxP9gCuUmRwABgwsUolg6erYuwYgfJj6YKXPgbOi4cK4gy+FmI Jhkd0vR8Pkl8g5SgK++eEbrjy//4CGDMiKLxaOWqHyuTx+nq0uJPU47UsvjahB72gtqZ 9FgGPBp6Gyf32rIcE0+Rhozd16zbQmhBZ40HUtEfLE6JVcariu5tnGPzgbDZW3pd27CN knitpd8dLIaKnt99o1eE9uakSUZyNCN4i++o+1HHoNc0dGeaQ0fZAFwspFeMMfb5SrE+ w5SA== X-Gm-Message-State: AOAM532Tcw+CNNN37BTYJ8JXjUadsGjUOL0QJ50u6ZUuemFvIaFuzAY5 ge4jE3qhSH3IJEhjwfppeQuTxL87R8kwmbmPPPWIobKdm2I7gB/mbthyz4gYQ7Arcwh047zSZ7i ETJd3VyPhnCBclEWmkkiNFXO0 X-Received: by 2002:a17:906:11ca:: with SMTP id o10mr27694908eja.21.1628610177664; Tue, 10 Aug 2021 08:42:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIRwBmbiXRB1umJFQmi13OfnkOfmVF6BrZwXd4TWEuEOlp2a1DK3t0tBMAWWMOlYxjN6fmug== X-Received: by 2002:a17:906:11ca:: with SMTP id o10mr27694890eja.21.1628610177407; Tue, 10 Aug 2021 08:42:57 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id 8sm783795ejy.65.2021.08.10.08.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 08:42:56 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Lance Richardson Cc: Ajit Khaparde , dpdk stable Date: Tue, 10 Aug 2021 17:39:29 +0200 Message-Id: <20210810154022.749358-49-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810154022.749358-1-christian.ehrhardt@canonical.com> References: <20210810154022.749358-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix Tx descriptor status implementation' has been queued to stable release 19.11.10 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/cca90b556a33225f9713e46ad1de83cd2f4e1512 Thanks. Christian Ehrhardt --- >From cca90b556a33225f9713e46ad1de83cd2f4e1512 Mon Sep 17 00:00:00 2001 From: Lance Richardson Date: Wed, 16 Jun 2021 13:55:21 -0400 Subject: [PATCH] net/bnxt: fix Tx descriptor status implementation [ upstream commit ce5c57ac01af038b930d5164df2cb16193e238ec ] With Tx completion batching, a single transmit completion can correspond to one or more transmit descriptors, adjust implementation to account for this. RTE_ETH_TX_DESC_DONE should be returned for descriptors that are available for use instead of RTE_ETH_TX_DESC_UNAVAIL. Fixes: 5735eb241947 ("net/bnxt: support Tx batching") Fixes: 478ed3bb7b9d ("net/bnxt: support Tx descriptor status") Signed-off-by: Lance Richardson Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 54 +++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3d07efd0f0..c3a8b68885 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -2597,41 +2597,49 @@ static int bnxt_tx_descriptor_status_op(void *tx_queue, uint16_t offset) { struct bnxt_tx_queue *txq = (struct bnxt_tx_queue *)tx_queue; - struct bnxt_tx_ring_info *txr; - struct bnxt_cp_ring_info *cpr; - struct bnxt_sw_tx_bd *tx_buf; - struct tx_pkt_cmpl *txcmp; - uint32_t cons, cp_cons; + struct bnxt_cp_ring_info *cpr = txq->cp_ring; + uint32_t ring_mask, raw_cons, nb_tx_pkts = 0; + struct bnxt_ring *cp_ring_struct; + struct cmpl_base *cp_desc_ring; int rc; - if (!txq) - return -EINVAL; - rc = is_bnxt_in_error(txq->bp); if (rc) return rc; - cpr = txq->cp_ring; - txr = txq->tx_ring; - if (offset >= txq->nb_tx_desc) return -EINVAL; - cons = RING_CMP(cpr->cp_ring_struct, offset); - txcmp = (struct tx_pkt_cmpl *)&cpr->cp_desc_ring[cons]; - cp_cons = cpr->cp_raw_cons; + /* Return "desc done" if descriptor is available for use. */ + if (bnxt_tx_bds_in_hw(txq) <= offset) + return RTE_ETH_TX_DESC_DONE; - if (cons > cp_cons) { - if (CMPL_VALID(txcmp, cpr->valid)) - return RTE_ETH_TX_DESC_UNAVAIL; - } else { - if (CMPL_VALID(txcmp, !cpr->valid)) - return RTE_ETH_TX_DESC_UNAVAIL; + raw_cons = cpr->cp_raw_cons; + cp_desc_ring = cpr->cp_desc_ring; + cp_ring_struct = cpr->cp_ring_struct; + ring_mask = cpr->cp_ring_struct->ring_mask; + + /* Check to see if hw has posted a completion for the descriptor. */ + while (1) { + struct tx_cmpl *txcmp; + uint32_t cons; + + cons = RING_CMPL(ring_mask, raw_cons); + txcmp = (struct tx_cmpl *)&cp_desc_ring[cons]; + + if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct)) + break; + + if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2) + nb_tx_pkts += rte_le_to_cpu_32(txcmp->opaque); + + if (nb_tx_pkts > offset) + return RTE_ETH_TX_DESC_DONE; + + raw_cons = NEXT_RAW_CMP(raw_cons); } - tx_buf = &txr->tx_buf_ring[cons]; - if (tx_buf->mbuf == NULL) - return RTE_ETH_TX_DESC_DONE; + /* Descriptor is pending transmit, not yet completed by hardware. */ return RTE_ETH_TX_DESC_FULL; } -- 2.32.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-10 15:11:14.924065675 +0200 +++ 0049-net-bnxt-fix-Tx-descriptor-status-implementation.patch 2021-08-10 15:11:13.026638158 +0200 @@ -1 +1 @@ -From ce5c57ac01af038b930d5164df2cb16193e238ec Mon Sep 17 00:00:00 2001 +From cca90b556a33225f9713e46ad1de83cd2f4e1512 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ce5c57ac01af038b930d5164df2cb16193e238ec ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 74ade93b71..4d51a209f9 100644 +index 3d07efd0f0..c3a8b68885 100644 @@ -27 +28 @@ -@@ -3296,41 +3296,49 @@ static int +@@ -2597,41 +2597,49 @@ static int @@ -33 +34 @@ -- struct rte_mbuf **tx_buf; +- struct bnxt_sw_tx_bd *tx_buf; @@ -93 +94 @@ -- if (*tx_buf == NULL) +- if (tx_buf->mbuf == NULL)