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 C66B3A0501; Fri, 6 May 2022 00:00:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 280C64282D; Fri, 6 May 2022 00:00:40 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2061.outbound.protection.outlook.com [40.107.237.61]) by mails.dpdk.org (Postfix) with ESMTP id D3C7C40042 for ; Fri, 6 May 2022 00:00:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FxznQHhO10RezKU32AsXPyFHGTs8qfSS/GNA03hPeNdPQo/MBgxWnAfKseUkgEg7mhlyfqRJG+RYld7sbUsYVtfoaFxSlORSi4stYWG7f2sO+fyuQjdpkzkK7ylYMRCtlBhh3oJUHEFNEyvu9IecFknzsY62Wl0wXIqYcMK7JDvwjaE/ION2OE6vl5ZDWrz0PbfUklh4bIeEMfc858DnL1GmvP8r7777q6UbSYwAcic6e7TuCvIsE8+IsANEerFNFMiy5Ae9ZYgs+x3A2q/1IeyZeSCVNEJ+dbyYRbXWo3nFEBzM7neIdv3NPTJeQgQVvBKbQQEolTmHnSOo3FTk5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=86+d9LxjvWF/UtkZzrs5gKsGYDVAW2SYJ7lMoQ4q0N0=; b=ZTHoYzRj/3RnahrUTnhE0X3SXZl4W+p1j1gQfipfnMMEB/KFYi8VZC0/K/FRn97yU8o95cLJga5R26B033ipoIwrcDwGktPFHHGmqmRTVxdDgpk4WAcXevLe3A60lTJAomxfFsLbj8NUFTlzOZEXlflKvZs3XiPcvFp2eqkJAA7kMe2gkoaElSbgYUc9lVMgKHqH5dFIMMh8W65fLFU9pWP/Z5Mkv2NlWD0R403SdQnt2bGHJUc40vgDaS9lm9ef12rPUz0D6fweTFWjD9FrFY1BH3E6OIQLJv2dofzO7ha8v5icTItNZnS6rpQ9MDBNCfJSmOUfQ3cyXvnDynme4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=86+d9LxjvWF/UtkZzrs5gKsGYDVAW2SYJ7lMoQ4q0N0=; b=pd1IPFPJGK81uKDTMP5a3IqbethMcAhHukOK43KZqeSaXSC+oFg4sqXzuCel+kFROR1KTP8KdMdpNgMZD9Bv5fFKdAnOT3s/qBuPzcZQVrWisuyV7nD289aVi6Bpdb7SPs89KAddNC/9Fjs7gfjyuU5/NEJIpzzGtq5d7dJwwqc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; Received: from BYAPR05MB5624.namprd05.prod.outlook.com (2603:10b6:a03:1d::13) by PH0PR05MB7883.namprd05.prod.outlook.com (2603:10b6:510:97::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.9; Thu, 5 May 2022 22:00:34 +0000 Received: from BYAPR05MB5624.namprd05.prod.outlook.com ([fe80::5161:a7c5:8c7d:f3b2]) by BYAPR05MB5624.namprd05.prod.outlook.com ([fe80::5161:a7c5:8c7d:f3b2%7]) with mapi id 15.20.5206.024; Thu, 5 May 2022 22:00:34 +0000 From: Pankaj Gupta To: jbehrens@vmware.com, yongwang@vmware.com Cc: dev@dpdk.org, pagupta@vmware.com Subject: [PATCH v4 3/8] net/vmxnet3: add Rx queue usage count utility Date: Thu, 5 May 2022 18:00:14 -0400 Message-Id: <20220505220019.31166-4-pagupta@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220505220019.31166-1-pagupta@vmware.com> References: <20220505220019.31166-1-pagupta@vmware.com> Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0354.namprd03.prod.outlook.com (2603:10b6:a03:39c::29) To BYAPR05MB5624.namprd05.prod.outlook.com (2603:10b6:a03:1d::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8defed7c-c962-4f34-d5f2-08da2ee2ad4d X-MS-TrafficTypeDiagnostic: PH0PR05MB7883:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mop9MijGH4A8twrEeH7hAIbPJacun3GabSjq82S3moVM8dZPPmm9YkMJQYrjlQzQjjrwwl4A2I8ckBYpHuu2dX3C5c8pwcu8wYMCN4BY+RxEf/gvFVHhLvxXEnsWe9lx7/bfogkJACigsTLAZrUcTsdFCtr/2UMb7LRWeS2y3SH1U6awI4h7/+hLxpblINlUD4hAmbCrQzORYMlM3cpLKofWg0rqh1EpG/041RgmdkEEn21F78pJPUtLvphNtMIvq8zWsGxTZBV7xsx+oboCLQwocqrTOfG4wYJttuHdT0I3SG7H20AkF/UQRHZu3owpiY6cSVkf0i8lZlxEhSCMy65kc5AoBUk3KzQl1uUyd3jK/DIHGdYxZtYc7KrmSRk7nGdE5/Ev0NF4Wo6Yx2CKXknbpY8d8h+hbBqd1rwfItjdcZ8EefeaJyMnssA3yowdo248hQvy2/UCsc4QHEelJNHZJJDhSuJb2rNDgsObs8/QZgmRa2MS7DaK7txBpVfPcT/U/Q0uXLt1Tg/R9gw4wgcmofDu21DuPIFFtfOAKg5EO2u5BaD32wnUkvwHnKgYKCRbZPRvmBsJJ8+3vX1BPu5AORiKJ6rQslUwrhcwQmBlOQ0Boj1k1kMdLlUElR+vRi1/72Hsea2JgACyho3s5W9cm/XpFKFdWEKBEtDfzLPsmcF0KP/hYRdpP0P1TCzkWTLWVJ+mNprG2Tfpn2SNoQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR05MB5624.namprd05.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(316002)(19627235002)(38100700002)(38350700002)(83380400001)(6666004)(36756003)(26005)(2616005)(6636002)(6512007)(4326008)(52116002)(66946007)(186003)(66556008)(8676002)(66476007)(1076003)(2906002)(508600001)(6486002)(86362001)(5660300002)(6506007)(8936002)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KXAn2F0TMCX4xm0gZJjDe9oDv9clb0uhQI0r2yUtkSOulac0czQJf/3qHsCj?= =?us-ascii?Q?g20U2hCpcgpPncRSr7TR4dzVKPiUAjUXrX78ldgrEu22WO2RTWE0e/cLO/Rh?= =?us-ascii?Q?PDd00dHyYuutnPc+8tx1ymQJl7/uhIeGRlUg6tsZNC3UHhJPRVX3i+1tM+EG?= =?us-ascii?Q?jsU2bI2TPL31Ihcq6CMZnq2zdUNNAnM34hLGJxpszYQagcyng1ITsAAaE7BL?= =?us-ascii?Q?+S4VkGZNjE32YT0Iy38rNPKwXa/5xAu8ZnlzOV/ZX64kxWyVM4QVvE8lkxgQ?= =?us-ascii?Q?0pY7mkCUPO9iBNIuw+K1jbZ7vkqx6rgik1mWsk5dGfaet+Q5IzxRhRcqxZm2?= =?us-ascii?Q?WZS18oY1zH499YMl8TpsN+Ht0LoZtKQz4ZzA9PWFGjbt8ysiI06aHwKrorIu?= =?us-ascii?Q?8KsOOY8RjYu6/rGJ3ze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bAV/UGt7?= =?us-ascii?Q?bzjZP5u7uhbGbu16oxK9EK4sJAdUbpLExle4FpOGGGhkYdZAlSdlkoCiLIex?= =?us-ascii?Q?oRBF2RIOgOv8pE0ct6xl+GRGvw5Ex/sp+4g0TwYyQWLPEM+JUwreBVB2edh2?= =?us-ascii?Q?DUtUPt3um3mcrZq0cgxX/m5nRoAgT4cbE9LuWuxF6WRsfXRgNDKTJ+EaL4+F?= =?us-ascii?Q?qf50dqV5FzqYpmmTPb3ej2ysho4iaZzjs67MRZV/uswsACBA8RCTcjMClf3q?= =?us-ascii?Q?5KhCx4HmqeIPm8dJWKuXpGOtAS5OMQpD6DnkoI/spUsplxpXRfcdeufXMEpn?= =?us-ascii?Q?UmFpmBzU+CgAt2IjB0V0ZA3GMa24l4YfHw9FR7Zut30ZtEwP5/8wnN1VjLiY?= =?us-ascii?Q?jBReoCF51+dFVsT7x1YqiziTS1Oukh34YZ0hdI7upjimHPQPuNiJJyTBHdDF?= =?us-ascii?Q?v2+SJm5ZAQ=3D=3D?= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8defed7c-c962-4f34-d5f2-08da2ee2ad4d X-MS-Exchange-CrossTenant-AuthSource: BYAPR05MB5624.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 22:00:33.2486 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BypP3RWaKejYwrSi8kzjuGzs6puk8lFL9+Nc6dLc5ZjKqo6DlssZ+ZQ61I9yELqQ3N8aQQCxqL+RtSKqDfwQ/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR05MB7883 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Count the number of entries in the Rx queue for debugging. Tested, using testpmd, for different hardware version on ESXi 7.0 Update 2 Signed-off-by: Pankaj Gupta Reviewed-by: Jochen Behrens --- drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 + drivers/net/vmxnet3/vmxnet3_ethdev.h | 3 +++ drivers/net/vmxnet3/vmxnet3_rxtx.c | 30 ++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index d5f9903946..2725e49ae9 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -294,6 +294,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &vmxnet3_recv_pkts; eth_dev->tx_pkt_burst = &vmxnet3_xmit_pkts; eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts; + eth_dev->rx_queue_count = vmxnet3_dev_rx_queue_count, pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); /* extra mbuf field is required to guess MSS */ diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h index 7ec3b2e1f0..ceaeb66392 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -193,6 +193,9 @@ int vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool); + +uint32_t vmxnet3_dev_rx_queue_count(void *rx_queue); + int vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index d745064bc4..e15b377d8c 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -1019,6 +1019,36 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) return nb_rx; } +uint32_t +vmxnet3_dev_rx_queue_count(void *rx_queue) +{ + const vmxnet3_rx_queue_t *rxq; + const Vmxnet3_RxCompDesc *rcd; + uint32_t idx, nb_rxd = 0; + uint8_t gen; + + rxq = rx_queue; + if (unlikely(rxq->stopped)) { + PMD_RX_LOG(DEBUG, "Rx queue is stopped."); + return 0; + } + + gen = rxq->comp_ring.gen; + idx = rxq->comp_ring.next2proc; + rcd = &rxq->comp_ring.base[idx].rcd; + while (rcd->gen == gen) { + if (rcd->eop) + ++nb_rxd; + if (++idx == rxq->comp_ring.size) { + idx = 0; + gen ^= 1; + } + rcd = &rxq->comp_ring.base[idx].rcd; + } + + return nb_rxd; +} + int vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, -- 2.17.1