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 355D541D93; Mon, 27 Feb 2023 22:53:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 299AC41140; Mon, 27 Feb 2023 22:53:02 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) by mails.dpdk.org (Postfix) with ESMTP id D1EBC40A7D for ; Mon, 27 Feb 2023 22:53:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YmxNaqIIpH7WYjyCewBEuMkPal3BpT/UkgEfr1xpShESK3rMUUnXP5FVVpt2tu+ssgpBJonWL3UZMpG2u7rmNLJq05SeJrzFPmNDa6siKoCal6Ffk2H+6apBeflj7kcYWXnc0XiJ5p/hQp9+QMPIrPR0yFLIYKA60rSSTOlvbl+ypXUEH6PvImItwhWuoSyWTqDn62DRMGGzqZN2d3cktiPZY8SQ4G23HHm6hRE8cMPFphjiU1pNgv6awdKwwsczXobw0nFsJuQaebjZknhoxUWR2jNF4g96pfxGAaa2IwtHX9jFutqVLLYZtPNRuqPgX1CDLCAkpDOoCQ+Oi8WJ+g== 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=V16lYamHHWGGTcbmnEb6Hut7jUhE9f9DWYrUhElgx3U=; b=KQgdiHAcg4e5oc5n2nJQxal9P2j8CgD1FoDW/lG0AiA+XFcwVJ4g4yiTk9pE3hOaRl1UgfNy49QUcr2frkaEXvE/s8sOyIcsoztlL1lkShtDUO4PR7ZOXAD/OU+bSoERdyzjwmTrScm1zJxo10RsSek+yc+oyor6X4wtfdFSk3Mpf7uWSbs6gI/uzjhMdV1GJITgpYTskY81+HQ2TiYU8sFle3AfwlYwExVjrkess+J6CyEKlJ/paCMLg3EtmYi5IMG1/wk1RbrXDIhfqI7d52d4Y0lAk6rLayXeRM6STMAPjR265WpO8TQBJw2mFPEnlgW4Vc6Q69qyUOOSgfeuAg== 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=V16lYamHHWGGTcbmnEb6Hut7jUhE9f9DWYrUhElgx3U=; b=EoOaWr+lRAqWAeikeoqlWMsj8NXhdh33YFU1LPZaJDVKyR3G2tOM6EyruioVqtqPsnZ2tPGO2p34z6qDsY/mthZM/w9DEQ+ShssaSrEEaJSoux0rvs/UNEc5bEfx7jAmbDFI6ZH60Qfn2CW8pgMTsAG97C1F909gZTdAUpyDXqc= 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 SJ0PR12MB7006.namprd12.prod.outlook.com (2603:10b6:a03:486::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.21; Mon, 27 Feb 2023 21:52:58 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48%7]) with mapi id 15.20.6134.029; Mon, 27 Feb 2023 21:52:58 +0000 Message-ID: <4eda5bd9-0bf1-8ab2-f098-b739e959a61d@amd.com> Date: Mon, 27 Feb 2023 21:52:53 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Mingxia Liu , dev@dpdk.org, beilei.xing@intel.com, yuying.zhang@intel.com References: <20230213021956.2953088-1-mingxia.liu@intel.com> <20230216003010.3439881-1-mingxia.liu@intel.com> <20230216003010.3439881-22-mingxia.liu@intel.com> From: Ferruh Yigit Subject: Re: [PATCH v7 21/21] net/cpfl: add xstats ops In-Reply-To: <20230216003010.3439881-22-mingxia.liu@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO6P123CA0018.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:313::11) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SJ0PR12MB7006:EE_ X-MS-Office365-Filtering-Correlation-Id: 274434cf-bbed-4272-dc2b-08db190cfd7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FtBdthUgjDi5rcpZ509m5OnkphyHj/6zMjFXxfG28aFi9m+pL5QajZLm0/u2J8r/TtPhMb4nXXZBlHlyUqNwb62eAtNAUQQS1qWfDnDN/NfneDQaV3cBMDN2z5G0UIjNVmCDQl3aIQ1U+tgKBbgmRygHAbaMiraMgRNae6d5h6SHsuOA5O6lrAJmkg4fojMZDhme1/STIy4CsI/QpnEukAW0ppxprLP/0SBxnMvS1ASn/WHhG9wM25WJPYy+NhOtucnT8VCKKC2/zlRG7gaphlF3clUnqKgzLskuNkZQrNvv/bmxQG/14haDSCPzogJW6hA+YdKehvBlyKOHu6um5g1KK1qBxXhSZ9zZEsRpM0rxXAmEOFNPzXR8eqSHRpKS13Gr67RWt57NpPvGofys55x+AxhyveVJk55Um3xd/495OY8K01+bPKZ1Lyf5zYMOFl0XwPF66jie74fwUCYIwzKkaODAbcIoA8SpxnJ0cgmAR6O+BPgf/Q45359VfPRu/plwDk7ckcoKifMsXT10bOxxGQagahxysgt9y0+kS5a947ivtZaIP7CmQBc4gTuSfhX9YVKKAwMrAen661+70PFkL1IPIDf9PwUT7u7uQLfMT2qVMemaV11bwKSHmiTJq39B83QeXxFJjDx/1g/TzLwIOeinKD0V0SB3mjoqETDfMKYIoLpWACVgNY3F4vt1UiJh0cEc1VUmZ7MMApYMniojyM3i4FLYMbJ/5QVa/8Y= 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:(13230025)(4636009)(366004)(136003)(376002)(346002)(396003)(39860400002)(451199018)(86362001)(66946007)(6486002)(83380400001)(66556008)(5660300002)(6506007)(8676002)(66476007)(41300700001)(316002)(8936002)(2616005)(53546011)(478600001)(26005)(186003)(6666004)(6512007)(36756003)(2906002)(38100700002)(44832011)(31696002)(31686004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UzBGQThEQXErR2hRTDg0TmVId1BuVzltZzNkcXoxd090cDBHQXR3dXpROG1K?= =?utf-8?B?MUQvb0pEZHNuV2pwR3labVFtUzB4V3NsYnY0V0FqM3ZkRHJia1IveTd4dllM?= =?utf-8?B?WXVRY0RKcmZxZkUxSVlTYWcydkF5Zk90RkMxbDZuN2pKdHRWcEZ0Nm5jb1VB?= =?utf-8?B?VWE2TUloNEppamhvSWZncmd0ak1NUW1ldTQrKzMvZkpTcDJPZHlyNEozaC9y?= =?utf-8?B?Q0FGbmtJRmZuWlA0bzZIZGFOUktXWlZmQTN1Q0pUWEVGSDNrdjdnUWllbENq?= =?utf-8?B?YzBWT3dVUzN6MFp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DSkhRZi8xZ1VDb05EVkkvUW55?= =?utf-8?Q?S+Ib4dVradtDd4DwQHWSB+WWf?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 274434cf-bbed-4272-dc2b-08db190cfd7a X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 21:52:58.8233 (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: NnbSMfWl3nE5QCSL3tYS+ribXJ9HW2JPjwEskP0rDPvoOBPnZSzvBPDBVtE9/EvY X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7006 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 2/16/2023 12:30 AM, Mingxia Liu wrote: > Add support for these device ops: > - dev_xstats_get > - dev_xstats_get_names > - dev_xstats_reset > > Signed-off-by: Mingxia Liu > --- > drivers/net/cpfl/cpfl_ethdev.c | 80 ++++++++++++++++++++++++++++++++++ > 1 file changed, 80 insertions(+) > > diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c > index f959a2911d..543dbd60f0 100644 > --- a/drivers/net/cpfl/cpfl_ethdev.c > +++ b/drivers/net/cpfl/cpfl_ethdev.c > @@ -80,6 +80,30 @@ static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP | > RTE_ETH_RSS_NONFRAG_IPV6_OTHER | > RTE_ETH_RSS_FRAG_IPV6; > > +struct rte_cpfl_xstats_name_off { > + char name[RTE_ETH_XSTATS_NAME_SIZE]; > + unsigned int offset; > +}; > + > +static const struct rte_cpfl_xstats_name_off rte_cpfl_stats_strings[] = { > + {"rx_bytes", offsetof(struct virtchnl2_vport_stats, rx_bytes)}, > + {"rx_unicast_packets", offsetof(struct virtchnl2_vport_stats, rx_unicast)}, > + {"rx_multicast_packets", offsetof(struct virtchnl2_vport_stats, rx_multicast)}, > + {"rx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, rx_broadcast)}, > + {"rx_dropped_packets", offsetof(struct virtchnl2_vport_stats, rx_discards)}, > + {"rx_errors", offsetof(struct virtchnl2_vport_stats, rx_errors)}, > + {"rx_unknown_protocol_packets", offsetof(struct virtchnl2_vport_stats, > + rx_unknown_protocol)}, > + {"tx_bytes", offsetof(struct virtchnl2_vport_stats, tx_bytes)}, > + {"tx_unicast_packets", offsetof(struct virtchnl2_vport_stats, tx_unicast)}, > + {"tx_multicast_packets", offsetof(struct virtchnl2_vport_stats, tx_multicast)}, > + {"tx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, tx_broadcast)}, > + {"tx_dropped_packets", offsetof(struct virtchnl2_vport_stats, tx_discards)}, > + {"tx_error_packets", offsetof(struct virtchnl2_vport_stats, tx_errors)}}; > + > +#define CPFL_NB_XSTATS (sizeof(rte_cpfl_stats_strings) / \ > + sizeof(rte_cpfl_stats_strings[0])) > + Can use RTE_DIM here. > static int > cpfl_dev_link_update(struct rte_eth_dev *dev, > __rte_unused int wait_to_complete) > @@ -313,6 +337,59 @@ cpfl_dev_stats_reset(struct rte_eth_dev *dev) > return 0; > } > > +static int cpfl_dev_xstats_reset(struct rte_eth_dev *dev) > +{ > + cpfl_dev_stats_reset(dev); > + return 0; > +} > + > +static int cpfl_dev_xstats_get(struct rte_eth_dev *dev, > + struct rte_eth_xstat *xstats, unsigned int n) > +{ > + struct idpf_vport *vport = > + (struct idpf_vport *)dev->data->dev_private; > + struct virtchnl2_vport_stats *pstats = NULL; > + unsigned int i; > + int ret; > + > + if (n < CPFL_NB_XSTATS) > + return CPFL_NB_XSTATS; > + > + if (!xstats) > + return 0; > + if 'xstats' is NULL, it should return 'CPFL_NB_XSTATS'.