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 CFA21A00C3; Wed, 7 Dec 2022 16:09:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B94840F17; Wed, 7 Dec 2022 16:09:19 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2044.outbound.protection.outlook.com [40.107.93.44]) by mails.dpdk.org (Postfix) with ESMTP id 8A23540156 for ; Wed, 7 Dec 2022 16:09:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GEaPMiHxnRgR1Gje76GDM9YwVzilIwulBHzDvRqNkiqG0sL45UpRhWF65OCTZmw+qlxFo2Fbx81VP+2OEJ29Z0V5nnu6t9qK5AJQZmJBQSisMZ9Ns3jDKBMZSp65+GNp76TeuemB2/xDeVOXUQNnBFIgLI+OFxGgrk6dDdJ1jElvb/ZjRF7gtOzFnsiR1gjpgkQ/PbbLLNwMqCHn8dveztoZbbenb6TcxATp5aygi4YVrzhgmdmpJocUvYr7lQA3gakQrE3ZRJ5gKcnKVF3itc98ArkFGHklo1UmY0AKiet3QSgV5hZpIlAmrNQl1awBscS6bEFj8kxOizRpRtcDHA== 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=IKPCuvMiIK3rLvvxkTHqCasDNXkgTYTNjFFo1o8VSL4=; b=Lmtxa4IS4wKc3SW3YwiXYLyMoR7IKE5/DRoGuW1qMfTGAtyLuGuG/CaxCO8PnPc5enaXXnS1+npvb53apcbYrI8jwyUgqPH/AXeeMRvtDqITbA0ZUT0nd2pl2yrCGbhO2Zb/LSdagig0wX9EVUdsJmG98QK+2FT6OAvfstYFdlZkbM1faKYBx77IXg7fpNAuZrxu+5D8yJb/TAFUF5SXPORARnakV2RcOV6Bo4oEuIvIhUACIlh9VpTUedVf83TQ8tG9j9aU76buXfANKy8g2xrPPrwXuOc+KR/5NJGrIhDBtsxT2QfpQY8KJmd8dBXv8BUQtrXqPIC858z9Oa13BQ== 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=IKPCuvMiIK3rLvvxkTHqCasDNXkgTYTNjFFo1o8VSL4=; b=NWhpEi+/Gy7wImqqlMiJEpEn3DU6d7CuCVbP2pZxEqk0UFNEYRdHEQmvB6nWRYUT1d/0qXrm2GVdxoSHyYH7bNKvaL24FU1K4gN6PK8UKsfhysc9FAU430umanV+LHRLNOJVn+KQIAviNVv6nFckD1RsMZ1xLp9t68ZSphuamGk= 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 DS7PR12MB6093.namprd12.prod.outlook.com (2603:10b6:8:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Wed, 7 Dec 2022 15:09:14 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::b482:d5bd:c7d0:3842]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::b482:d5bd:c7d0:3842%8]) with mapi id 15.20.5880.014; Wed, 7 Dec 2022 15:09:14 +0000 Message-ID: Date: Wed, 7 Dec 2022 15:09:08 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Content-Language: en-US To: Junfeng Guo , qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, jeroendb@google.com, rushilg@google.com, jrkim@google.com, Xiaoyun Li References: <20221124073335.3985214-1-junfeng.guo@intel.com> From: Ferruh Yigit Subject: Re: [PATCH] net/gve: add support for basic stats In-Reply-To: <20221124073335.3985214-1-junfeng.guo@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0110.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::7) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|DS7PR12MB6093:EE_ X-MS-Office365-Filtering-Correlation-Id: f47e89ca-71a8-4cee-5350-08dad86500c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2Ujf5P3yMDu+7h+4BGCXwfj6mpfT2osR1JoyWYc217EGz3uFfT+TiVhI6PZlqaAK1tBvMtXbszn0VHyLGt8gxS1CB5CzrIZnIB5A8sEug4ooDLiZTRF/zq5vNlJ2PZdGa2ilFOSDzcP7CK7EY+GtxV9YV0AOfFOakJCqOf79E2x1VkKrvQUF0BeN1HiwbMV/4VotuP99bs3l8OXxXJNVsTMfW+Z9GbkQGdhdLGoh8u43GBh7nSIYkCm4bTzoJnKJS236R2FS0kuhJk5s07GntQltZtdL8uuyldF6H3Qw3h0aZW4+8e91JbHq2gMMC1yHAphltMRoSrbdnrfufFcKww1HJ8Ae8xWkLCrr++lcZ5trmqK5+V3oautw6b4nsMgRMKOIviJ5nASB+GdGRTlGmis9MZ8auwGeaQ1eqonxtiuUzqcatwDwmU3x596VqoplL9tyXyv68nettavJncfMZBa4Fix7M56sL7ZksRgtr29j56UDuHc7RvmCzjH1RXYeGee3rI/OsqZCcwFcnWP3zWuQuFfb0BE4wZqVjPZ09FoOtXGpekComQetU8vwowGuxwtJHloNZkoSJzll15VrG7UZP+dP4C7M8W0xKhN331g/uveC7cRsM44J5nUA5w7VK9RZ5jrEt7vW5w7UIhpkBvKYtTtnZcC6I7pT+swwJlC+nO7LPzQP93jCXuzhGywBMUsYSeBvkI0HvTX4c5XlUoRL38WBzGi8PY1JZxxjNkq5L3JSCUHbnayp0In8pceE 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)(39860400002)(376002)(136003)(396003)(346002)(366004)(451199015)(478600001)(66946007)(38100700002)(66556008)(6506007)(44832011)(66476007)(6666004)(4326008)(8676002)(53546011)(2906002)(316002)(36756003)(6486002)(966005)(86362001)(31696002)(31686004)(83380400001)(8936002)(5660300002)(2616005)(6512007)(41300700001)(186003)(26005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R3ZaRERBZEkwWk5WamVvWFJpOHZIbjNnUE00RHFheG11VnZIN2o1VWd2MkVo?= =?utf-8?B?aEFVR1UybTkrL2I0TU5zNFFkOWZKQklqNzlkU2g0RHRqK3VsNHdsV1lVRGlB?= =?utf-8?B?U3YzdHIzYW4wdHJrUVY3R2toVnBwbW80QnF1bVFCbGRnN1dUTEJ1TXZkK2Yx?= =?utf-8?B?Lys2Qm9wZnN5U1YxY3hVbm5BT2E2UHo3cWk4QVhTbjQvTHl4QkIwTkZkdmFS?= =?utf-8?B?Q2x1Sm1nS2pZZ3VyTTZvYllvYWRYRmZ2ZmtJSjJDUDYwNzZWZ1JQcVluVlVL?= =?utf-8?B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WM4OG5sQzdHeExxUG0xTEFKMEMz?= =?utf-8?Q?32FIQSCJT/2Af7Xt4mRP3AbXu?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f47e89ca-71a8-4cee-5350-08dad86500c1 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2022 15:09:14.4187 (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: OqYXlkOamW3iE6rtGJQCBuzwddPOcz5K5KVdiuyU0MCarQRiseKqb/Du3x3dpX1f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6093 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 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