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 2433A41C3C; Wed, 8 Feb 2023 09:30:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A63AB40DFD; Wed, 8 Feb 2023 09:30:00 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 3A40D40141 for ; Wed, 8 Feb 2023 09:29:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675844998; x=1707380998; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=PygYAEb2/44jH7jNZ/MEaurds21vWnz19nS4Y8rec6Y=; b=a6UXtdDE1kET7qLL5doXBm8LgbM+WO/rLlOcb09aH5lg1iwuq6cBJaLM rm0tTzY8KxR9bpVmmojAa1O7u4hPrMxCsixPtntT8pZiZhfN436wcaJFE TXbErcnH/y0bq5Mau8qy0B+2EC8k/Gz6K7R7easQ+FGL7exOE7BzKgj+s Z3P3Ltd6mkXHmasV37ddUvK0Z0vkxM5tHGKCexFZStX4NrPalcua/S0hk 2Sz9rdBlXbK/Uv6Bv8VkXG/oSC0D3uW+wo8t6Lj5zl4JXwtp83jHWm7SO T9ET7IhJRRDm7bx9cOUusXbCbvSmq7BGNgNtP4FpbtYxz0OT/Zf/kRg+q g==; X-IronPort-AV: E=McAfee;i="6500,9779,10614"; a="309393246" X-IronPort-AV: E=Sophos;i="5.97,280,1669104000"; d="scan'208";a="309393246" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2023 00:28:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10614"; a="660572231" X-IronPort-AV: E=Sophos;i="5.97,280,1669104000"; d="scan'208";a="660572231" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga007.jf.intel.com with ESMTP; 08 Feb 2023 00:28:56 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 8 Feb 2023 00:28:55 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 8 Feb 2023 00:28:55 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Wed, 8 Feb 2023 00:28:55 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Wed, 8 Feb 2023 00:28:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l+SuJZ+jYmPLBxpQmVFVJ1CuL1n5YAtg8w09qc8wWKu36ossUKztCmL2epGWLko+8XVSsdZ7RI5WxwoqqJ35Oc0cGxUJXvbrYI+sRCiGtZ6bzwiFVHvbW/Fx/FDZnCrOxmHX22OhYIjgggXanv0ZeJbzQ223eG74+76ubd+cMGGVSAMO7kpfSGpPzyx3jV907ca8LSuZnWpa2qs6pFyhIz57XyOFfrDPnjn374SkuG4w9muAZ90MiH3PeF4oJW/cv5FkqwLyXS+wn4UQfEdfduVvHRMyTvzI8J5o3UQYbjfxNsrrhXnifHzjQ4sekQ253Ib95ozzVt+8n1r26echQA== 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=VQHUNWa2E8cwYw35MlBxBFk/2ZlWlY02JFZRpkJKt7o=; b=I63i7onfMMBhUbBZeIgr06bk8BHzuA4k0eeh5bxePJ+s/UONyh2wwRnwLHb4PAMXUqEXw1ie2u9oX9r0YWyzvHAdsbC4jX1BA7tJZpgkjWLG9SGuXBLHiLhLhDbpnzPOcb7Zf70k9+7z/ax3Qrp4VBSlES8Ak4UluZdtIZwidWOpAbWL715kr8sduTiNu3Kgke43S8rxcl109/4GjEIaqt7eBnNnMReDgvXCbOK52JEf6P5sd7QHJhZuLis2NLmLSwdv34ByGZN3FNnnH7PeqYG12LtPt8YNPKilnH0nHgC+47zIdYm4Cwd2rW9sqVpB4r6Vs12u8JqikCl7rPMO/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH0PR11MB5877.namprd11.prod.outlook.com (2603:10b6:510:141::12) by PH0PR11MB5192.namprd11.prod.outlook.com (2603:10b6:510:3b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Wed, 8 Feb 2023 08:28:51 +0000 Received: from PH0PR11MB5877.namprd11.prod.outlook.com ([fe80::8c1c:6df6:533f:282c]) by PH0PR11MB5877.namprd11.prod.outlook.com ([fe80::8c1c:6df6:533f:282c%8]) with mapi id 15.20.6064.027; Wed, 8 Feb 2023 08:28:51 +0000 From: "Liu, Mingxia" To: "Zhang, Qi Z" , "dev@dpdk.org" , "Wu, Jingjing" , "Xing, Beilei" Subject: RE: [PATCH v6 1/6] common/idpf: add hw statistics Thread-Topic: [PATCH v6 1/6] common/idpf: add hw statistics Thread-Index: AQHZOuVOGe93tiQ7WEiVojmVBKxkWa7ETE8AgABsUzA= Date: Wed, 8 Feb 2023 08:28:50 +0000 Message-ID: References: <20230207100859.2401709-2-mingxia.liu@intel.com> <20230207101650.2402452-1-mingxia.liu@intel.com> <20230207101650.2402452-2-mingxia.liu@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB5877:EE_|PH0PR11MB5192:EE_ x-ms-office365-filtering-correlation-id: 6392025b-0141-43ea-75b1-08db09ae81ac x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IWW79riR7XowhVtohTJ+Omx4P+t5rwT6jOIGKxaS0VYG8apPwBBHT9Y4XU/IauFSIv+IGs6K6L6LJcIOPc40fKJweVKyQdMTnkq3eSduVBQ6qg7aP9SjRexSMhmymr3IfSiMa/eUZ8i9q+xRuFvpik7k9Y1Kn47Lrn34KJSB27Bt7bWrEt6a8C2USeyV84uul8yCB6WC7+oV6m+W1aq1bI+V/XlIDhlugegzoWUrHuqncRW0SGlmwsRVQ8BIB/c0qhynODAdppb263EBr2vSnGIVO0K90G4ki7UP7P8ObRTEvfu6Cunkza/sy4pvwn8e3N9KEq7aTpK+xd0y9ynItRsEVfVHoF5nMiPh8HS5oR5ZM8RswtwqEDxXbvgrLjb7hIZ/37Je5MTwTXaR9wvjBPKPefcyGrZ+PIXjtRTiekIfmAtDylzBBj/HL9ZmUidTDX7cT3x9U/lgluT/V1JC+zQaSsSu5Ok7UZXVZKRj8N5OPQMEMlhdVgOFFoIaWFX2yYD3QdygVDEbV9WUINH0kBNLvIuOVbD+d8p8YlVhG25ONs94YVUh/np8ZzbcL6ZcV7E1JrDcnSR7iUegcXkljnM/e+OUU4qMXzEYu9JUN4UuVo/lg/WS5wcKk1RQVq3tN/tlHWvbz/bBTomIvO1kGS11iJ8e6QB/jpvZaUvSFv+mxOWiByNtwVLXCGTDHXbnj8ixzgDS+8szBUlJMeQ4GQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5877.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(39860400002)(376002)(136003)(346002)(366004)(451199018)(5660300002)(2906002)(83380400001)(55016003)(38070700005)(76116006)(38100700002)(82960400001)(8676002)(122000001)(66946007)(6636002)(110136005)(66476007)(316002)(8936002)(52536014)(33656002)(64756008)(41300700001)(66446008)(66556008)(186003)(6506007)(53546011)(26005)(71200400001)(9686003)(478600001)(7696005)(86362001)(66899018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?YLxx6V1qVnuiiBa1drCgbty2O+9KwiH7Z/onnwf/GEUjI8eiGyAQ2DUqhSbC?= =?us-ascii?Q?8zcKy3n0sHx8dSzcPlhr8RNEOG+V62ob1UGjYpMTsbhKR1wf/pD9lyDiP1zr?= =?us-ascii?Q?72FNp4kyN+u6kgKcTYYcY1vAhlsY6CgeFdAWGmW/SZZ64S+FatrmCop6e1ZM?= =?us-ascii?Q?Ih7GqJAS9xPu1hN1Pq5L9bYOQu6MCHGN3Ubt/bQsSweUnassKppQwKl2GJbl?= =?us-ascii?Q?MR41p9s4jCAuULmX2Ml5UyOv3p0LvSKFVVGkg+iMuQ03X6dyXaHneoEuVZJf?= =?us-ascii?Q?G0jinko9HVL5hs43hpWO9UDLJChgA28RhBRT6yOATVOSlYbDO1q40HmTLsrS?= =?us-ascii?Q?AuscWIHuTc33WnKA+Wcw4HxguXdblRaWwIr2KLFhAYuH3U/MasmLTbzIf/m2?= =?us-ascii?Q?4+snPKfhmSVXyWYKldvGO3ipSJ/ak+VSQGM+vmh0DqXBqHRtDa9SY/RSTN/r?= =?us-ascii?Q?EncZYiWUgR54TLfvQeugKc6jP4LdswUNx9H76TOFQlhgQxyPtygY++OJiZA/?= =?us-ascii?Q?844/cHb+2+wCF7fj4Ptt6+A3NjBacmV4esOYRQHI/bf3m09lW7ElUVKFYeKH?= =?us-ascii?Q?kb8ZJ83IiklUfhEUJHVk9GK1Dk5vMJHLL+cofrWIN1F4ucdmBJCsQfpMNFan?= =?us-ascii?Q?eK0rDEVhq1tAo94Uk8AelGKmBNmVS4sgK4+rOOs0M/a8qbN43ff1Q37kUihJ?= =?us-ascii?Q?HddRdhJ9XauUhkQfL6dbomVpiU3EwXV0h+k0ruTTNIhN/yThfWOflBtAfbO4?= =?us-ascii?Q?9rGfzaAQ5uESR61nFM4/OvJLWR7hJig9KbmN5E2Y971jl4XouYvyb9DCC4rD?= =?us-ascii?Q?UCEaRJM8ZOsn/hfcK3DPj+B+EzmG5tMZGCVWiMWDwCGoz90C2bjb5oZstfRr?= =?us-ascii?Q?BtQur1BPJTQArWdlOuodbZ/YV+2IJ3G5RhcBsiYERithu84ypk8BiNL2ngxI?= =?us-ascii?Q?rFwT7kyEcJ/vrl9hGQ4MhYQ0nFlfWJ/N1lub5icMDEoWxHPbmSxeSfYT9xAO?= =?us-ascii?Q?fEFsnuwIzeHaAAnRZCctvo1uLbDlGs0dVkXjlxWgp2PE88CAREsccKDrgXJ/?= =?us-ascii?Q?FcNmyH8+qwhyRIllLHCdN99rS9Ha1IVp+ggsXF/jzuF+XjcG4mSflouh6Aaw?= =?us-ascii?Q?ULUgxT5LV/k2yUYqXZryjfBZbXq3CNUvMp7YKIIEdyZ10EBenRcu0dVOHRBB?= =?us-ascii?Q?pPXrupYRcQtSMCD2NHQurpGGWOVVDQt2YkSm8QOi5G6Bnv+qo96tkebV7oGn?= =?us-ascii?Q?P0VmCKCYF3s37gVVHO6CEZ9cxrLJxYWJ+EE2Ncaq2ztQrZ4zc2DsDa6P9sqZ?= =?us-ascii?Q?bh8zpJhhJfRXI6lN2U6OQC476pKLDx4cq01rSdJmQpTLW4cvD6xzqINSx3xe?= =?us-ascii?Q?kArcDPKOZjypNXo9vtS8qDJOQb7zwxNAQcpNfNL9/tbg7kHmJkG6C06H+fJD?= =?us-ascii?Q?6q40hHyG32sy5i/9vuJbtIC0NQ2D1YUvWKM3mumR44m0SyX0ICxQRcLEvEvY?= =?us-ascii?Q?qzrINqbNpeH1ECqjNFIBPm7ucN5OP4Qtj3cEU4woWMANUExjRK+dAzYq1wVG?= =?us-ascii?Q?7hCPbhQITQeruZez7wKkFDygLC0f7v677y4b0Xpr?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5877.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6392025b-0141-43ea-75b1-08db09ae81ac X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2023 08:28:50.7111 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3FJH3vBoo4tFz1gW68eXsS7zfkSaXaix9sY5p6DIC016K/hiI5urZNvaAZZXMkhgRDhwIb434NBuOh2Phe3P7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5192 X-OriginatorOrg: intel.com 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 Thanks, will update module name. And there is no warning when checked by ./devtools/check-git-log.sh. > -----Original Message----- > From: Zhang, Qi Z > Sent: Wednesday, February 8, 2023 10:00 AM > To: Liu, Mingxia ; dev@dpdk.org; Wu, Jingjing > ; Xing, Beilei > Subject: RE: [PATCH v6 1/6] common/idpf: add hw statistics >=20 >=20 >=20 > > -----Original Message----- > > From: Liu, Mingxia > > Sent: Tuesday, February 7, 2023 6:17 PM > > To: dev@dpdk.org; Zhang, Qi Z ; Wu, Jingjing > > ; Xing, Beilei > > Cc: Liu, Mingxia > > Subject: [PATCH v6 1/6] common/idpf: add hw statistics >=20 > Suggest to use ./devtools/check-git-log.sh to fix any title warning if po= ssible > Also the main purpose of this patch is to support stats_get /stats_reset = API, > the prefix is more reasonable to be "net/idpf" but not "common/idpf. >=20 > Please fix other patches if any similar issue. >=20 > > > > This patch add hardware packets/bytes statistics. > > > > Signed-off-by: Mingxia Liu > > --- > > drivers/common/idpf/idpf_common_device.c | 17 +++++ > > drivers/common/idpf/idpf_common_device.h | 4 + > > drivers/common/idpf/idpf_common_virtchnl.c | 27 +++++++ > > drivers/common/idpf/idpf_common_virtchnl.h | 3 + > > drivers/common/idpf/version.map | 2 + > > drivers/net/idpf/idpf_ethdev.c | 86 ++++++++++++++++++++++ > > 6 files changed, 139 insertions(+) > > > > diff --git a/drivers/common/idpf/idpf_common_device.c > > b/drivers/common/idpf/idpf_common_device.c > > index 48b3e3c0dd..5475a3e52c 100644 > > --- a/drivers/common/idpf/idpf_common_device.c > > +++ b/drivers/common/idpf/idpf_common_device.c > > @@ -652,4 +652,21 @@ idpf_vport_info_init(struct idpf_vport *vport, > > return 0; > > } > > > > +void > > +idpf_vport_stats_update(struct virtchnl2_vport_stats *oes, struct > > +virtchnl2_vport_stats *nes) { > > + nes->rx_bytes =3D nes->rx_bytes - oes->rx_bytes; > > + nes->rx_unicast =3D nes->rx_unicast - oes->rx_unicast; > > + nes->rx_multicast =3D nes->rx_multicast - oes->rx_multicast; > > + nes->rx_broadcast =3D nes->rx_broadcast - oes->rx_broadcast; > > + nes->rx_errors =3D nes->rx_errors - oes->rx_errors; > > + nes->rx_discards =3D nes->rx_discards - oes->rx_discards; > > + nes->tx_bytes =3D nes->tx_bytes - oes->tx_bytes; > > + nes->tx_unicast =3D nes->tx_unicast - oes->tx_unicast; > > + nes->tx_multicast =3D nes->tx_multicast - oes->tx_multicast; > > + nes->tx_broadcast =3D nes->tx_broadcast - oes->tx_broadcast; > > + nes->tx_errors =3D nes->tx_errors - oes->tx_errors; > > + nes->tx_discards =3D nes->tx_discards - oes->tx_discards; } > > + > > RTE_LOG_REGISTER_SUFFIX(idpf_common_logtype, common, NOTICE); > diff > > --git a/drivers/common/idpf/idpf_common_device.h > > b/drivers/common/idpf/idpf_common_device.h > > index 545117df79..1d8e7d405a 100644 > > --- a/drivers/common/idpf/idpf_common_device.h > > +++ b/drivers/common/idpf/idpf_common_device.h > > @@ -115,6 +115,8 @@ struct idpf_vport { > > bool tx_vec_allowed; > > bool rx_use_avx512; > > bool tx_use_avx512; > > + > > + struct virtchnl2_vport_stats eth_stats_offset; > > }; > > > > /* Message type read in virtual channel from PF */ @@ -191,5 +193,7 > > @@ int idpf_vport_irq_unmap_config(struct idpf_vport *vport, uint16_t > > nb_rx_queues) __rte_internal int idpf_vport_info_init(struct > > idpf_vport *vport, > > struct virtchnl2_create_vport *vport_info); > > +__rte_internal > > +void idpf_vport_stats_update(struct virtchnl2_vport_stats *oes, > > +struct virtchnl2_vport_stats *nes); > > > > #endif /* _IDPF_COMMON_DEVICE_H_ */ > > diff --git a/drivers/common/idpf/idpf_common_virtchnl.c > > b/drivers/common/idpf/idpf_common_virtchnl.c > > index 31fadefbd3..40cff34c09 100644 > > --- a/drivers/common/idpf/idpf_common_virtchnl.c > > +++ b/drivers/common/idpf/idpf_common_virtchnl.c > > @@ -217,6 +217,7 @@ idpf_vc_cmd_execute(struct idpf_adapter > *adapter, > > struct idpf_cmd_info *args) > > case VIRTCHNL2_OP_UNMAP_QUEUE_VECTOR: > > case VIRTCHNL2_OP_ALLOC_VECTORS: > > case VIRTCHNL2_OP_DEALLOC_VECTORS: > > + case VIRTCHNL2_OP_GET_STATS: > > /* for init virtchnl ops, need to poll the response */ > > err =3D idpf_vc_one_msg_read(adapter, args->ops, args- > > >out_size, args->out_buffer); > > clear_cmd(adapter); > > @@ -806,6 +807,32 @@ idpf_vc_ptype_info_query(struct idpf_adapter > > *adapter) > > return err; > > } > > > > +int > > +idpf_vc_stats_query(struct idpf_vport *vport, > > + struct virtchnl2_vport_stats **pstats) { > > + struct idpf_adapter *adapter =3D vport->adapter; > > + struct virtchnl2_vport_stats vport_stats; > > + struct idpf_cmd_info args; > > + int err; > > + > > + vport_stats.vport_id =3D vport->vport_id; > > + args.ops =3D VIRTCHNL2_OP_GET_STATS; > > + args.in_args =3D (u8 *)&vport_stats; > > + args.in_args_size =3D sizeof(vport_stats); > > + args.out_buffer =3D adapter->mbx_resp; > > + args.out_size =3D IDPF_DFLT_MBX_BUF_SIZE; > > + > > + err =3D idpf_vc_cmd_execute(adapter, &args); > > + if (err) { > > + DRV_LOG(ERR, "Failed to execute command of > > VIRTCHNL2_OP_GET_STATS"); > > + *pstats =3D NULL; > > + return err; > > + } > > + *pstats =3D (struct virtchnl2_vport_stats *)args.out_buffer; > > + return 0; > > +} > > + > > #define IDPF_RX_BUF_STRIDE 64 > > int > > idpf_vc_rxq_config(struct idpf_vport *vport, struct idpf_rx_queue > > *rxq) diff - -git a/drivers/common/idpf/idpf_common_virtchnl.h > > b/drivers/common/idpf/idpf_common_virtchnl.h > > index c105f02836..6b94fd5b8f 100644 > > --- a/drivers/common/idpf/idpf_common_virtchnl.h > > +++ b/drivers/common/idpf/idpf_common_virtchnl.h > > @@ -49,4 +49,7 @@ __rte_internal > > int idpf_vc_rxq_config(struct idpf_vport *vport, struct idpf_rx_queue > > *rxq); __rte_internal int idpf_vc_txq_config(struct idpf_vport > > *vport, struct idpf_tx_queue *txq); > > +__rte_internal > > +int idpf_vc_stats_query(struct idpf_vport *vport, > > + struct virtchnl2_vport_stats **pstats); > > #endif /* _IDPF_COMMON_VIRTCHNL_H_ */ diff --git > > a/drivers/common/idpf/version.map b/drivers/common/idpf/version.map > > index 8b33130bd6..e6a02828ba > > 100644 > > --- a/drivers/common/idpf/version.map > > +++ b/drivers/common/idpf/version.map > > @@ -46,6 +46,7 @@ INTERNAL { > > idpf_vc_rss_key_set; > > idpf_vc_rss_lut_set; > > idpf_vc_rxq_config; > > + idpf_vc_stats_query; > > idpf_vc_txq_config; > > idpf_vc_vectors_alloc; > > idpf_vc_vectors_dealloc; > > @@ -59,6 +60,7 @@ INTERNAL { > > idpf_vport_irq_map_config; > > idpf_vport_irq_unmap_config; > > idpf_vport_rss_config; > > + idpf_vport_stats_update; > > > > local: *; > > }; > > diff --git a/drivers/net/idpf/idpf_ethdev.c > > b/drivers/net/idpf/idpf_ethdev.c index 33f5e90743..02ddb0330a 100644 > > --- a/drivers/net/idpf/idpf_ethdev.c > > +++ b/drivers/net/idpf/idpf_ethdev.c > > @@ -140,6 +140,87 @@ idpf_dev_supported_ptypes_get(struct > rte_eth_dev > > *dev __rte_unused) > > return ptypes; > > } > > > > +static uint64_t > > +idpf_get_mbuf_alloc_failed_stats(struct rte_eth_dev *dev) { > > + uint64_t mbuf_alloc_failed =3D 0; > > + struct idpf_rx_queue *rxq; > > + int i =3D 0; > > + > > + for (i =3D 0; i < dev->data->nb_rx_queues; i++) { > > + rxq =3D dev->data->rx_queues[i]; > > + mbuf_alloc_failed +=3D __atomic_load_n(&rxq- > > >rx_stats.mbuf_alloc_failed, > > + __ATOMIC_RELAXED); > > + } > > + > > + return mbuf_alloc_failed; > > +} > > + > > +static int > > +idpf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats > > +*stats) { > > + struct idpf_vport *vport =3D > > + (struct idpf_vport *)dev->data->dev_private; > > + struct virtchnl2_vport_stats *pstats =3D NULL; > > + int ret; > > + > > + ret =3D idpf_vc_stats_query(vport, &pstats); > > + if (ret =3D=3D 0) { > > + uint8_t crc_stats_len =3D (dev->data- > > >dev_conf.rxmode.offloads & > > + RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? > > 0 : > > + RTE_ETHER_CRC_LEN; > > + > > + idpf_vport_stats_update(&vport->eth_stats_offset, pstats); > > + stats->ipackets =3D pstats->rx_unicast + pstats->rx_multicast + > > + pstats->rx_broadcast - pstats->rx_discards; > > + stats->opackets =3D pstats->tx_broadcast + pstats- > > >tx_multicast + > > + pstats->tx_unicast; > > + stats->imissed =3D pstats->rx_discards; > > + stats->oerrors =3D pstats->tx_errors + pstats->tx_discards; > > + stats->ibytes =3D pstats->rx_bytes; > > + stats->ibytes -=3D stats->ipackets * crc_stats_len; > > + stats->obytes =3D pstats->tx_bytes; > > + > > + dev->data->rx_mbuf_alloc_failed =3D > > idpf_get_mbuf_alloc_failed_stats(dev); > > + stats->rx_nombuf =3D dev->data->rx_mbuf_alloc_failed; > > + } else { > > + PMD_DRV_LOG(ERR, "Get statistics failed"); > > + } > > + return ret; > > +} > > + > > +static void > > +idpf_reset_mbuf_alloc_failed_stats(struct rte_eth_dev *dev) { > > + struct idpf_rx_queue *rxq; > > + int i; > > + > > + for (i =3D 0; i < dev->data->nb_rx_queues; i++) { > > + rxq =3D dev->data->rx_queues[i]; > > + __atomic_store_n(&rxq->rx_stats.mbuf_alloc_failed, 0, > > __ATOMIC_RELAXED); > > + } > > +} > > + > > +static int > > +idpf_dev_stats_reset(struct rte_eth_dev *dev) { > > + struct idpf_vport *vport =3D > > + (struct idpf_vport *)dev->data->dev_private; > > + struct virtchnl2_vport_stats *pstats =3D NULL; > > + int ret; > > + > > + ret =3D idpf_vc_stats_query(vport, &pstats); > > + if (ret !=3D 0) > > + return ret; > > + > > + /* set stats offset base on current values */ > > + vport->eth_stats_offset =3D *pstats; > > + > > + idpf_reset_mbuf_alloc_failed_stats(dev); > > + > > + return 0; > > +} > > + > > static int > > idpf_init_rss(struct idpf_vport *vport) { @@ -327,6 +408,9 @@ > > idpf_dev_start(struct rte_eth_dev *dev) > > goto err_vport; > > } > > > > + if (idpf_dev_stats_reset(dev)) > > + PMD_DRV_LOG(ERR, "Failed to reset stats"); > > + > > vport->stopped =3D 0; > > > > return 0; > > @@ -606,6 +690,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops > =3D { > > .tx_queue_release =3D idpf_dev_tx_queue_release, > > .mtu_set =3D idpf_dev_mtu_set, > > .dev_supported_ptypes_get =3D idpf_dev_supported_ptypes_get, > > + .stats_get =3D idpf_dev_stats_get, > > + .stats_reset =3D idpf_dev_stats_reset, > > }; > > > > static uint16_t > > -- > > 2.25.1