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 51AA34240F; Wed, 18 Jan 2023 17:22:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 407BE4067E; Wed, 18 Jan 2023 17:22:11 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2077.outbound.protection.outlook.com [40.107.96.77]) by mails.dpdk.org (Postfix) with ESMTP id D0A0D400D6 for ; Wed, 18 Jan 2023 17:22:09 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FYRHCy3uy8xPrP7f8fIPMavaAEEyvs1TbJReqU8SmVmnx5RkqnyH5nP/7Z3e7Ye7ue4d991bsBXZvW16wa6g3Rpm7/JMss/cmwx4nLU4+oKk1YHCVqTO3cil3INNGrKbacuhBxBrtua8VEK9F1xHgX1kLwVUmcH6L2583Pp+OvG2llUYvqVKDtHV3EiqN9AaxVAzgWw2POCBVIaqSI88My42/kvRrAf3+OVf7bFHoSz274bCB1xHhb0Je7IZCIYlkM7YHrWgaEH1tkV4OdtBKLMvUIwBtMf7JKmwHZbjnKlyya8+L1Q6ibor10Q0MWglKcn3FeZFzGTjvn6Y3mMfhw== 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=jGL5HPAM89tPhs52By30Ca9aNm7CCaPPmDAcmkVmENw=; b=GMFWUHlLsetPcSFXinW21bdj8/gBi2b72kTEJkSVn+Nt/ZfyVNbCXpHs1sE3nD/RMuYXcoHxQYo/y4kzcFU92QckkiQCfD9cm99iJzAg5pbB8ZrD56rTbPf0Qi+RUf7vruh2O0+RXg+av8fT9IRVENQUuQS5id3JSXs6OVgF5wgiqPaMVaBnOh15r5wPPAfNr6/vSYCbPJE3Pg33tcV2VqbA297MddjjBiXvZbeunWNT5bN44gBXVvIyyAHnt4e1G1y9pd7Ev5PbW9HiXJ0uNiMpOo4dmqqZNn2zQtp25JN/ttA5OA3draHbGrfmJxjnZ3fbKFMo7FPnQWNKBjIcIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jGL5HPAM89tPhs52By30Ca9aNm7CCaPPmDAcmkVmENw=; b=EpXZVJ4iGn6VIcPeLtumfWlTyZYdJ3MSiYJDMhv3moLa/7QFiZ/naUPSisq4I0+dxFOaDdDG7Ug9LHFkQsZXhTOcP8YRTbl9JC/9IXMoPyubHuApRWRId+BdMTFOQfyIr9faMdRrQCj4jamcL15qAY+vOE4SyvXrn3UrKVt3tsk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by DS7PR12MB6358.namprd12.prod.outlook.com (2603:10b6:8:95::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Wed, 18 Jan 2023 16:22:07 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a%8]) with mapi id 15.20.6002.024; Wed, 18 Jan 2023 16:22:07 +0000 Message-ID: <78fcfa68-120b-af64-fb42-aa2031d45592@amd.com> Date: Wed, 18 Jan 2023 16:22:00 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: en-US To: Joshua Washington , Rushil Gupta Cc: Stephen Hemminger , Junfeng Guo , qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, dev@dpdk.org, jeroendb@google.com, jrkim@google.com, Xiaoyun Li References: <20221124073335.3985214-1-junfeng.guo@intel.com> <20221207083948.22af7cae@hermes.local> From: Ferruh Yigit Subject: Re: [PATCH] net/gve: add support for basic stats In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0342.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::23) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|DS7PR12MB6358:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b89dbee-b443-4f86-e69b-08daf970247f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ocCCSZvLe5r1CsrMHFG++IVWBBeyX+5xyp5ewWUbwF+SR2DdqXKzl1uPBicHo+BdVniw7mgNH3l0TXE2QnaFlIBupPA24GuNxO0nqvd3Y1JWR0mKwfLGLTpq9uLnmpBdlajQv8LhysVEl8O8b2tJRcWbOsVKtrJdMrdXaxaUlsdxk6f7A8cprIYq8kk1B7K4lRM6sMlZOSqzjUBzCuj6+Ih+9oStjXIrHbmxThNWaYLnyW2J08WY/UIGckkDjUcaANw530k8sd+q8ZIFK1AHWFqFv6G5WOH/aQnykoHkmzunUlGl3PTxnXbYdAvKYAcIfCf6+zQ+KKr/l5FfodMfIal+46Yw3TXEi8gtqhzh++FnLVoziRQQ/LkqPSSfy2ewnpIzEmhanQ1uWfSMMC5OsXQFlnrZwDXBwxRcCryhe0nPPNaWm/i4zpHl/YnCbqnrYz9LChwzRlwsfU8Sr+AvnyYfzHP6iEzJcoIr5vcTr2xpCasgvZlXZxfP5+wkAn2tdLI4HTLku45ORKvd23hR3bYuDAZzMxEVQuM8ijwYlywlx5+yrBRgYfaB4LyLjON8AK89KKJUtDwbDZZh0QzLApohIZ2gq0lQtai15Ba39/MQrQ7xcrMckdnKRMrZsg/kGrWLdUYS1mApFH2l7stxxndKvANypHXqZ7DA2usSrvmiulW2pIpy1760g/WvZ/eSw20sAXhu7YwvBvTncsC4nX189uo+Kqsi79fmQ9c08Xd+Jd1VOsG6m/HHJizdQljGoVtECvhkg78RTPEZads0g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(346002)(376002)(136003)(39860400002)(396003)(451199015)(31686004)(36756003)(38100700002)(86362001)(4326008)(8936002)(66476007)(66556008)(31696002)(66946007)(2906002)(7416002)(5660300002)(8676002)(44832011)(83380400001)(40140700001)(110136005)(54906003)(6666004)(6486002)(316002)(966005)(478600001)(26005)(41300700001)(2616005)(53546011)(66574015)(6506007)(186003)(6512007)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UElvSzVOc0xqNmZZY0dZbHp4QUttMjlicFQrL1k2d1RPTTZkK3BZbExoR0F3?= =?utf-8?B?MjVFYUlMYjNHWXBuWldWQWlveWFxcUNwaUlWMGJTbDk0VDAvc0pmUTg2dUpy?= =?utf-8?B?OFFCUlBNLzlMSGd3UFp4c1lkSmVXSHVseEhvZFp6L0F0UmNOWEViNEVNTFlP?= =?utf-8?B?bWZ2MU5KNXpsSWZlRUxsc0FkZXBxaWdESVVTWkduUDdQZytNM2tyaF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djNqZ3kraVVwRW0rSzQ3MWg4YWREYWMxZDhuSzc5dGpmUGl0eWk1MUV5?= =?utf-8?B?ZjZqSjQrT0lvZmxxU0Jrb3B5eGs2TDNoNEVpR2hzSWhCSEJLVUYvSjh1V1JM?= =?utf-8?Q?77osBdGzGut2EAvRYw8BnI8J8?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b89dbee-b443-4f86-e69b-08daf970247f X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2023 16:22:07.3017 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dKwmnpTzDpgSDI7MMeDVoAFVxYYUcOwbDn/Ek4NjPhuVzU+JsW/es145eTep0gUO X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6358 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 On 12/19/2022 7:38 PM, Joshua Washington wrote: > Hello, > > As it turns out, this error actually propagates to the "total" stats as > well, which I assume is just calculated by adding TX-packets and > TX-dropped. Here are the full stats from the example that Rushil mentioned: > >   ---------------------- Forward statistics for port 0 >  ---------------------- >   RX-packets: 2453802        RX-dropped: 0             RX-total: 2453802 >   TX-packets: 34266881       TX-dropped: 447034        TX-total: 34713915 >   > ---------------------------------------------------------------------------- > >   ---------------------- Forward statistics for port 1 >  ---------------------- >   RX-packets: 34713915       RX-dropped: 0             RX-total: 34713915 >   TX-packets: 2453802        TX-dropped: 0             TX-total: 2453802 >   > ---------------------------------------------------------------------------- > >   +++++++++++++++ Accumulated forward statistics for all > ports+++++++++++++++ >   RX-packets: 37167717       RX-dropped: 0             RX-total: 37167717 >   TX-packets: 36720683       TX-dropped: 807630        TX-total: 37528313 >   > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > It can be seen that the stats for the individual ports are consistent, > but the TX-total and TX-dropped are not consistent with the stats for > the individual ports, as I believe that the TX-total and RX-total > accumulated stats should be equal. > Hi Joshua, Rushil, As I checked for it, issue may be related to testpmd stats display, While displaying per port TX-dropped value, it only takes 'ports_stats[pt_id].tx_dropped' into account, but for accumulated TX-dropped results it takes both 'ports_stats[pt_id].tx_dropped' & 'stats.oerrors' into account. If you can reproduce it easily, can you please test with following change: diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 134d79a55547..49322d07d7d6 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2056,6 +2056,8 @@ fwd_stats_display(void) fwd_cycles += fs->core_cycles; } for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { + uint64_t tx_dropped = 0; + pt_id = fwd_ports_ids[i]; port = &ports[pt_id]; @@ -2077,8 +2079,9 @@ fwd_stats_display(void) total_recv += stats.ipackets; total_xmit += stats.opackets; total_rx_dropped += stats.imissed; - total_tx_dropped += ports_stats[pt_id].tx_dropped; - total_tx_dropped += stats.oerrors; + tx_dropped += ports_stats[pt_id].tx_dropped; + tx_dropped += stats.oerrors; + total_tx_dropped += tx_dropped; total_rx_nombuf += stats.rx_nombuf; printf("\n %s Forward statistics for port %-2d %s\n", @@ -2105,8 +2108,8 @@ fwd_stats_display(void) printf(" TX-packets: %-14"PRIu64" TX-dropped: %-14"PRIu64 "TX-total: %-"PRIu64"\n", - stats.opackets, ports_stats[pt_id].tx_dropped, - stats.opackets + ports_stats[pt_id].tx_dropped); + stats.opackets, tx_dropped, + stats.opackets + tx_dropped); if (record_burst_stats) { if (ports_stats[pt_id].rx_stream) > > On Mon, Dec 19, 2022 at 11:17 AM Rushil Gupta > wrote: > > Hi all > Josh just found out some inconsistencies in the Tx/Rx statistics sum > for all ports. Not sure if we can screenshot here but it goes like > this: > Tx-dropped for port0: 447034 > Tx-dropped for port1: 0 > Accumulated forward statistics for all ports: 807630 > > Please note that this issue is only with Tx-dropped (not > Tx-packets/Tx-total). > > > On Wed, Dec 7, 2022 at 8:39 AM Stephen Hemminger > > wrote: > > > > On Wed, 7 Dec 2022 15:09:08 +0000 > > Ferruh Yigit > > wrote: > > > > > On 11/24/2022 7:33 AM, Junfeng Guo wrote: > > > > Add support for dev_ops of stats_get and stats_reset. > > > > > > > > Queue stats update will be moved into xstat [1], but the basic > stats > > > > items may still be required. So we just keep the remaining > ones and > > > > will implement the queue stats via xstats in the coming release. > > > > > > > > [1] > > > > https://elixir.bootlin.com/dpdk/v22.07/ > \ > > > >     source/doc/guides/rel_notes/deprecation.rst#L118 > > > > > > > > Signed-off-by: Xiaoyun Li > > > > > Signed-off-by: Junfeng Guo > > > > > > > <...> > > > > > > > +static int > > > > +gve_dev_stats_get(struct rte_eth_dev *dev, struct > rte_eth_stats *stats) > > > > +{ > > > > +   uint16_t i; > > > > + > > > > +   for (i = 0; i < dev->data->nb_tx_queues; i++) { > > > > +           struct gve_tx_queue *txq = dev->data->tx_queues[i]; > > > > +           if (txq == NULL) > > > > +                   continue; > > > > + > > > > +           stats->opackets += txq->packets; > > > > +           stats->obytes += txq->bytes; > > > > +           stats->oerrors += txq->errors; > > > > > > Hi Junfeng, Qi, Jingjing, Beilei, > > > > > > Above logic looks wrong to me, did you test it? > > > > > > If the 'gve_dev_stats_get()' called multiple times (without > stats reset > > > in between), same values will be keep added to stats. > > > Some hw based implementations does this, because reading from stats > > > registers automatically reset those registers but this shouldn't > be case > > > for this driver. > > > > > > I expect it to be something like: > > > > > > local_stats = 0 > > > foreach queue > > >       local_stats += queue->stats > > > stats = local_stats > > > > The zero of local_stats is unnecessary. > > The only caller of the PMD stats_get is rte_ethdev_stats_get > > and it zeros the stats structure before calling the PMD. > > > > > > int > > rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats) > > { > >         struct rte_eth_dev *dev; > > > >         RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > >         dev = &rte_eth_devices[port_id]; > > > >         memset(stats, 0, sizeof(*stats)); > > ... > >         stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed; > >         return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, > stats)); > > > > If any PMD has extra memset in their stats get that could be removed. > > > > -- > > Joshua Washington | Software Engineer | joshwash@google.com >  | (414) 366-4423 >