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 5DD5CA0A0A for ; Thu, 3 Jun 2021 07:20:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2FE004067A; Thu, 3 Jun 2021 07:20:22 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id 7FB214067A for ; Thu, 3 Jun 2021 07:20:20 +0200 (CEST) Received: from mail-qk1-f198.google.com ([209.85.222.198]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lofmG-0002dq-8K for stable@dpdk.org; Thu, 03 Jun 2021 05:20:20 +0000 Received: by mail-qk1-f198.google.com with SMTP id k125-20020a3788830000b02903a65618d46cso3492254qkd.3 for ; Wed, 02 Jun 2021 22:20:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DAxIKiZGwwRUiJjtMQdgkR6yKhTVKvfJThwXNAhffek=; b=CNUkJpRQL0w9qlVV0tKNre1UPPpWFvZltCRus3kCnnD7KP+GqOHNqH4fixKifLG5RH u3YaAsGnHxxQpsn0sFEGHZWSOYz5duy3F737TzfbN3toRsskj9G50ogEA0gbVK7QZGgI 3NtRf3SeSqBl0PZ1/5yd5Imoo/87S83eTDci4qOd9vsrE2qJwxTzCa0Vdsiqf2kjYqZh 0Gov/sFn75l9zE9qKIEXEL4og5NnXbcl3kmgfnqeltjsv7fHqAZzHwA74HMqmhRBepv7 tT8wDt047z13hPRwBdmuS6yVbaaiDcoicFWlPdQpsAuMT+WfeNU+7egnP9hObSNGOB5G rOvQ== X-Gm-Message-State: AOAM531ouSX3FgyH7zgVCsilNS8MABHJlAT4BjxqVteVWe9/eXd+a4AM 4ppw65gdMNYtdqHg+wark6IE/wKD+FWHzd+BBrxnlXBhlc/k68QvoVXoeS//OxpLbSu7K+YnmnX jlHxpHxw9fj6dTVqfMJKbbDD2UYfdTesUCZMMeo79 X-Received: by 2002:a05:622a:50a:: with SMTP id l10mr27344880qtx.235.1622697619369; Wed, 02 Jun 2021 22:20:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQLDRUXFtewzyhWWjjgffpO8fLFYejzRDFkJDhZfs1ben6qWEZHWoUQDbKh6h6RZvBS42g2PxAGqNjTqze/Rs= X-Received: by 2002:a05:622a:50a:: with SMTP id l10mr27344875qtx.235.1622697619153; Wed, 02 Jun 2021 22:20:19 -0700 (PDT) MIME-Version: 1.0 References: <20210521080216.24408-1-kalesh-anakkur.purayil@broadcom.com> In-Reply-To: <20210521080216.24408-1-kalesh-anakkur.purayil@broadcom.com> From: Christian Ehrhardt Date: Thu, 3 Jun 2021 07:19:53 +0200 Message-ID: To: Kalesh A P Cc: dpdk stable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] [PATCH 19.11] net/bnxt: fix Rx descriptor status 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" On Fri, May 21, 2021 at 9:40 AM Kalesh A P wrote: > > From: Kalesh AP > > [ upstream commit 25fefa2b1760a5feb8762fa12845982b98d91f3d ] Thanks applied to the 19.11.x series > Fix a number of issues in the bnxt receive descriptor status > function, including: > - Provide status of receive descriptor instead of completion > descriptor. > - Remove invalid comparison of raw ring index with masked ring > index. > - Correct misinterpretation of offset parameter as ring index. > - Correct misuse of completion ring index for mbuf ring (the > two rings have different sizes). > > Fixes: 0fe613bb87b2 ("net/bnxt: support Rx descriptor status") > > Signed-off-by: Lance Richardson > Signed-off-by: Kalesh AP > Reviewed-by: Andy Gospodarek > Reviewed-by: Ajit Khaparde > --- > drivers/net/bnxt/bnxt_ethdev.c | 81 ++++++++++++++++++++++++++++++------------ > 1 file changed, 58 insertions(+), 23 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index 1660782..b98b6d2 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -2519,42 +2519,77 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id) > static int > bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset) > { > - struct bnxt_rx_queue *rxq = (struct bnxt_rx_queue *)rx_queue; > - struct bnxt_rx_ring_info *rxr; > + struct bnxt_rx_queue *rxq = rx_queue; > struct bnxt_cp_ring_info *cpr; > struct bnxt_sw_rx_bd *rx_buf; > + struct bnxt_rx_ring_info *rxr; > + uint32_t desc, raw_cons; > + struct bnxt *bp = rxq->bp; > struct rx_pkt_cmpl *rxcmp; > - uint32_t cons, cp_cons; > int rc; > > - if (!rxq) > - return -EINVAL; > - > - rc = is_bnxt_in_error(rxq->bp); > + rc = is_bnxt_in_error(bp); > if (rc) > return rc; > > - cpr = rxq->cp_ring; > - rxr = rxq->rx_ring; > - > if (offset >= rxq->nb_rx_desc) > return -EINVAL; > > - cons = RING_CMP(cpr->cp_ring_struct, offset); > - cp_cons = cpr->cp_raw_cons; > - rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons]; > + rxr = rxq->rx_ring; > + cpr = rxq->cp_ring; > > - if (cons > cp_cons) { > - if (CMPL_VALID(rxcmp, cpr->valid)) > - return RTE_ETH_RX_DESC_DONE; > - } else { > - if (CMPL_VALID(rxcmp, !cpr->valid)) > - return RTE_ETH_RX_DESC_DONE; > - } > - rx_buf = &rxr->rx_buf_ring[cons]; > - if (rx_buf->mbuf == NULL) > - return RTE_ETH_RX_DESC_UNAVAIL; > + raw_cons = cpr->cp_raw_cons; > + desc = 0; > + while (1) { > + uint32_t agg_cnt, cons, cmpl_type; > + > + cons = RING_CMP(cpr->cp_ring_struct, raw_cons); > + rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons]; > > + if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct)) > + break; > + > + cmpl_type = CMP_TYPE(rxcmp); > + > + switch (cmpl_type) { > + case CMPL_BASE_TYPE_RX_L2: > + if (desc == offset) { > + cons = rxcmp->opaque; > + rx_buf = &rxr->rx_buf_ring[cons]; > + if (rx_buf->mbuf != NULL) > + return RTE_ETH_RX_DESC_DONE; > + else > + return RTE_ETH_RX_DESC_UNAVAIL; > + } > + agg_cnt = BNXT_RX_L2_AGG_BUFS(rxcmp); > + raw_cons = raw_cons + CMP_LEN(cmpl_type) + agg_cnt; > + desc++; > + break; > + > + case CMPL_BASE_TYPE_RX_TPA_END: > + if (desc == offset) > + return RTE_ETH_RX_DESC_DONE; > + > + if (BNXT_CHIP_THOR(rxq->bp)) { > + struct rx_tpa_v2_end_cmpl_hi *p5_tpa_end; > + > + p5_tpa_end = (void *)rxcmp; > + agg_cnt = BNXT_TPA_END_AGG_BUFS_TH(p5_tpa_end); > + } else { > + struct rx_tpa_end_cmpl *tpa_end; > + > + tpa_end = (void *)rxcmp; > + agg_cnt = BNXT_TPA_END_AGG_BUFS(tpa_end); > + } > + > + raw_cons = raw_cons + CMP_LEN(cmpl_type) + agg_cnt; > + desc++; > + break; > + > + default: > + raw_cons += CMP_LEN(cmpl_type); > + } > + } > > return RTE_ETH_RX_DESC_AVAIL; > } > -- > 2.10.1 > -- Christian Ehrhardt Staff Engineer, Ubuntu Server Canonical Ltd