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 8758CA0C4C for ; Mon, 12 Jul 2021 15:14:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82250406B4; Mon, 12 Jul 2021 15:14:45 +0200 (CEST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 37FBD40685 for ; Mon, 12 Jul 2021 15:14:44 +0200 (CEST) Received: by mail-wm1-f41.google.com with SMTP id g8-20020a1c9d080000b02901f13dd1672aso9771966wme.0 for ; Mon, 12 Jul 2021 06:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PmKnnTthHF9LBy14XewptA/Hk4NSDTGNIPUTfSC8yVQ=; b=R57Au0cDb1fse6j7Vcm0e2zeRFLxEZROAQFhpUPTZebyRm20ujaYJw7uyzZ60cxV3L 2UbqDjLL4N2tZHuXprwlWjzpnCNhEeUHThDq4PBCNT9CdMv9liflKTo/pbJf1U27v9Sg elLGjLQRORK8UbkXfLoLrBWafbJ3/X/dW+dS5vcWTkhjISrNkLISUsRzD6D4ofGlh0fa wu4aH/SB+gWqPaodfk/5+UDQakv1QsNa6HHiNh/b8F5QZGSpSLyYmAFMYXc2tZRWl2R9 yAxVskI3B4KUWShZteyNesxD7XMlg04fQ7EoAO21nocFkDgh/VwT21z5lhU3kzT4xIlg 7aDA== 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=PmKnnTthHF9LBy14XewptA/Hk4NSDTGNIPUTfSC8yVQ=; b=r6s44t6CondJHCYkUyY5AG5Lqz/c/jW9930RuKgny3kVS+iicztzT+x4ZHKQW2/CU5 bYukFBgZBnpoUR8EvGcD09J28dYaD3lpLY8pwm5P5j4YLNd71WJ21qa2mU58YdsfOvE+ qamCWAkM644wtpDSkWqS89LDABGEyMJzIQCFZZNnyip6KqQCqeTO8NLuD46qfxIUPtbJ 7Bnef+VvU/lmVGRndjMrPoZmRMEInPu3nImmG0+G6/9Xi2d5yozY7JQxZMp+Q3bOE1C/ FMe8KA2kfwoW4OmhvN8URf4ax7h/1WcPsqXoQllIFMpNJ70lJsnXLnZJnNj6JJ22JQn8 JhOQ== X-Gm-Message-State: AOAM530817U2plbNmNm9lieJpAsn3fFYoaSVqWE4g0mRieLLMNa76NV2 cJj0p6cQuDdvdkjMbpd86xg= X-Google-Smtp-Source: ABdhPJzyns6kK7DrP1RxfhqV5lt3Gg5NE8+2Ely0dJxNYL3q70GTZNyMMF7RMN/CC4neR43fU7bu0Q== X-Received: by 2002:a7b:c7d2:: with SMTP id z18mr2359911wmk.70.1626095684042; Mon, 12 Jul 2021 06:14:44 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id t11sm14352520wrz.7.2021.07.12.06.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 06:14:43 -0700 (PDT) From: luca.boccassi@gmail.com To: Lance Richardson Cc: Ajit Khaparde , dpdk stable Date: Mon, 12 Jul 2021 14:05:24 +0100 Message-Id: <20210712130551.2462159-89-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.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 20.11.3 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 20.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/14/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/2dfab9aad47e5209eb356e11cf937605f645189d Thanks. Luca Boccassi --- >From 2dfab9aad47e5209eb356e11cf937605f645189d 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 | 56 +++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index f34e90e8df..2bd3c9eaa5 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3213,41 +3213,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; - - 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; - } - tx_buf = &txr->tx_buf_ring[cons]; - if (tx_buf->mbuf == NULL) + /* Return "desc done" if descriptor is available for use. */ + if (bnxt_tx_bds_in_hw(txq) <= offset) return RTE_ETH_TX_DESC_DONE; + 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); + } + + /* Descriptor is pending transmit, not yet completed by hardware. */ return RTE_ETH_TX_DESC_FULL; } -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-12 13:41:41.203927310 +0100 +++ 0089-net-bnxt-fix-Tx-descriptor-status-implementation.patch 2021-07-12 13:41:36.758128194 +0100 @@ -1 +1 @@ -From ce5c57ac01af038b930d5164df2cb16193e238ec Mon Sep 17 00:00:00 2001 +From 2dfab9aad47e5209eb356e11cf937605f645189d 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 f34e90e8df..2bd3c9eaa5 100644 @@ -27 +28 @@ -@@ -3296,41 +3296,49 @@ static int +@@ -3213,41 +3213,49 @@ static int @@ -33 +34 @@ -- struct rte_mbuf **tx_buf; +- struct bnxt_sw_tx_bd *tx_buf; @@ -67 +68 @@ -- if (*tx_buf == NULL) +- if (tx_buf->mbuf == NULL)