From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BEAE0A2EDB for ; Wed, 2 Oct 2019 19:20:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 954141BF9A; Wed, 2 Oct 2019 19:18:22 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id A38281BF30; Wed, 2 Oct 2019 19:17:54 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 8164B30D37C; Wed, 2 Oct 2019 10:16:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 8164B30D37C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570036597; bh=1icY5ar/IqCsQBYVXZ/ef/5w+dwbQnqd5HeuIkhCQ6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCvOiAhVZjLGNy9m/4hkgvtMUOBaTiPb0wB/nQQGH6LlI0aGjx9uJ2FvVy8fnMSNN TcOyxbBw38mzCUxTkcExq3zur6UG61PeTNzmVFdyMKqOs2MCKCPyKXgBqmcw8P/WXP fk2rUUZbnX+qyv8dQaEDc1rpbxTUnKRkZUj9RMwU= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 3AC2F140097; Wed, 2 Oct 2019 10:17:49 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Rahul Gupta , stable@dpdk.org, Somnath Kotur Date: Wed, 2 Oct 2019 10:17:42 -0700 Message-Id: <20191002171745.4504-14-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191002171745.4504-1-ajit.khaparde@broadcom.com> References: <20191002055423.99659-1-ajit.khaparde@broadcom.com> <20191002171745.4504-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 13/16] net/bnxt: fix Rx queue count devop 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: Rahul Gupta Fix Computing of number of used descriptors in an Rx queue. Fixes: 1b7ceba3e375 ("net/bnxt: support Rx queue count") Cc: stable@dpdk.org Signed-off-by: Rahul Gupta Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 74ded7717a..0159be3462 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -2096,9 +2096,6 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id) struct bnxt_cp_ring_info *cpr; struct bnxt_rx_queue *rxq; struct rx_pkt_cmpl *rxcmp; - uint16_t cmp_type; - uint8_t cmp = 1; - bool valid; int rc; rc = is_bnxt_in_error(bp); @@ -2107,33 +2104,19 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id) rxq = dev->data->rx_queues[rx_queue_id]; cpr = rxq->cp_ring; - valid = cpr->valid; + raw_cons = cpr->cp_raw_cons; - while (raw_cons < rxq->nb_rx_desc) { + while (1) { cons = RING_CMP(cpr->cp_ring_struct, raw_cons); + rte_prefetch0(&cpr->cp_desc_ring[cons]); rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons]; - if (!CMPL_VALID(rxcmp, valid)) - goto nothing_to_do; - valid = FLIP_VALID(cons, cpr->cp_ring_struct->ring_mask, valid); - cmp_type = CMP_TYPE(rxcmp); - if (cmp_type == RX_TPA_END_CMPL_TYPE_RX_TPA_END) { - cmp = (rte_le_to_cpu_32( - ((struct rx_tpa_end_cmpl *) - (rxcmp))->agg_bufs_v1) & - RX_TPA_END_CMPL_AGG_BUFS_MASK) >> - RX_TPA_END_CMPL_AGG_BUFS_SFT; - desc++; - } else if (cmp_type == 0x11) { - desc++; - cmp = (rxcmp->agg_bufs_v1 & - RX_PKT_CMPL_AGG_BUFS_MASK) >> - RX_PKT_CMPL_AGG_BUFS_SFT; + if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct)) { + break; } else { - cmp = 1; + raw_cons++; + desc++; } -nothing_to_do: - raw_cons += cmp ? cmp : 2; } return desc; -- 2.20.1 (Apple Git-117)