From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1BA41A04F1; Thu, 18 Jun 2020 08:31:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3CBBBAAB7; Thu, 18 Jun 2020 08:31:50 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6E0CB4C90 for ; Thu, 18 Jun 2020 08:31:48 +0200 (CEST) IronPort-SDR: CKE2ra6+/qSXWtw92wM163jGYhatnZWlw4BNodHKrC51gl5ZT1houP57gs4GKoV8fT90gAyWhv eNXT39uZBjiw== X-IronPort-AV: E=McAfee;i="6000,8403,9655"; a="140811584" X-IronPort-AV: E=Sophos;i="5.73,525,1583222400"; d="scan'208";a="140811584" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2020 23:31:47 -0700 IronPort-SDR: W+e7i5EuwAzVbTMmkg2uPGoXAke8TPK96GLsdPPUC5ZJ2bibiG6XwYKSZG4LMnWsJwHWAw77Wy Drv3piwnbZDg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,525,1583222400"; d="scan'208";a="383434103" Received: from orsmsx109.amr.corp.intel.com ([10.22.240.7]) by fmsmga001.fm.intel.com with ESMTP; 17 Jun 2020 23:31:47 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX109.amr.corp.intel.com (10.22.240.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 17 Jun 2020 23:31:45 -0700 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 17 Jun 2020 23:31:44 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 17 Jun 2020 23:31:44 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.105) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 17 Jun 2020 23:31:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bm1pHKQbvU28+fCNmi7z0/9XB2obI03m0kW1frfuhFMmQs+Uad+534GrjvwIc9bHZKtDF04h1B5s9SZUTjrqAhQj2nHI+l4YBYsIthhxfznF+U3QDl6Dv8jooLIyb95JRQ0bWyH2KT/Por/vOl69bVD1boMGXLI+ewLDcN0CQCCe4hSSa5sG7YXHcjOJIBH5vrXzEahfIULvuwv5TzYYfVTAqJ5wwghhm9DqiumZ+MS61Jul/smeheO1ipq1t853hhD2ExRPg+NpB103FlsuAmO70q9QJZNNU9Mg3MtmrnP+izKbxlBjeoO5ETOmLxXd7fSMquRtnC0SFWZ90FMTZQ== 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-SenderADCheck; bh=A9vgArCqD54TFTGj2srXsoTyrLJhoU4EbyB/3tL/JNU=; b=PtDJE7WuNH/OF5caXTSP3dNnljGlwuleqcIXNcEdiDAWMH7B/CONNhzSNT9Uz+2GUJED8WEAWWHKG09dg8AObJbnD1ucEskx89YV1oA0jbx25M/pqp+p9UMdxse8mhj2s6Eq3xVFd+UIOJ0CCU0od19jgQ5qdh1R9nQ8F/D1mhXUKeTA42WTzImlw5aZzEHx9C2OvRMwirOmQB4NZgGHEenFsDmzq2Ci5bxEPuvZksGmcd7QKGnxSBWzjODq1cvSBCpP+Ye5IyAeg66Nx9Oke2aLinoSSs+nFA86XFOSdZHiJraoYbG2NJbcf7RJBew6uqa1PPfy/ZCW16AN7HKtLA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A9vgArCqD54TFTGj2srXsoTyrLJhoU4EbyB/3tL/JNU=; b=Ay+1CMvbePeO8FUZwR/hdJLzeFQKC6wa04c1eaEKx/L3GhVfFBhjpaCSc8ijC1b19j2jZ6ZhnoFuMtJv6W8/sC/dAR8HETCuQbcenrDRLFavOEHXmkLLAerd4Qy86ayU8wVHZwhn5eMwaD8sXupgoZtjjfIvx2OPyB0K/vECEaY= Received: from BN6PR11MB0017.namprd11.prod.outlook.com (2603:10b6:405:6c::34) by BN6PR11MB1394.namprd11.prod.outlook.com (2603:10b6:404:49::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21; Thu, 18 Jun 2020 06:31:36 +0000 Received: from BN6PR11MB0017.namprd11.prod.outlook.com ([fe80::c8eb:f4c9:5b58:3120]) by BN6PR11MB0017.namprd11.prod.outlook.com ([fe80::c8eb:f4c9:5b58:3120%6]) with mapi id 15.20.3088.025; Thu, 18 Jun 2020 06:31:36 +0000 From: "Yang, Qiming" To: "Xu, Ting" , "dev@dpdk.org" CC: "Zhang, Qi Z" , "Wu, Jingjing" , "Xing, Beilei" , "Kovacevic, Marko" , "Mcnamara, John" , "Ye, Xiaolong" Thread-Topic: [PATCH v3 10/12] net/ice: enable stats for DCF Thread-Index: AQHWQ5iaM4EIiV8YTEqCIh7imUDd26jd7KEg Date: Thu, 18 Jun 2020 06:31:36 +0000 Message-ID: References: <20200616124112.108014-1-ting.xu@intel.com> <20200616124112.108014-11-ting.xu@intel.com> In-Reply-To: <20200616124112.108014-11-ting.xu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e6bc6343-564a-4090-bfc0-08d813514051 x-ms-traffictypediagnostic: BN6PR11MB1394: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:605; x-forefront-prvs: 0438F90F17 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3KKz2LPIeeqEAxjggLk8c6BYVHEhStrIfxXiDhSoozSN+bCCvw0s4ZXB9uXe4PXiooMrD5OrKMtXIUkQxca25sGbm+L5YCDC3yNx1GPo4Yn5oNgsuIu5tddFPncGRni/zKQ0nGXnVvoWVqUcwVwCuAizGZZQqfG0HPOKJkBxrRB5KON/dLRarBKcY0yTOymtys+VDRJPxlwgFxRe0/Mf6YCc0qV+bzn9Pvtq1bCq/BMo3Kj8jjUDU7Hg34CoUu5KFeMLQvUwYRhigQKVLInGi/G4pInm4yhilcyivJ4lSHATS9NirAX211sFgmCbUTcVJNbxB3MvWdGoTxkAE3x31Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN6PR11MB0017.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(7696005)(53546011)(6506007)(110136005)(54906003)(8936002)(33656002)(316002)(8676002)(4326008)(83380400001)(66446008)(64756008)(66556008)(66946007)(478600001)(9686003)(76116006)(55016002)(52536014)(107886003)(5660300002)(26005)(186003)(2906002)(86362001)(66476007)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: fcpXar2/MSQmvbYJtUEdGJcLvHaHoveeiI17DaLRNbBIf2UfaJfkCpaAxP06BNytOldpTP+6Sycdc8tWN4PRk6G/3htXWgsiEclupU3PTI6oMf8j7NUnhgYoVk+NW9MSQTfCJIH20n61BrZCfw210b0zMEi6AvwaR0+ZO+WD7vHWv26IjGdx84nHSp3euk0oNgDKvSuEKAz805esZRDY86BQ4jFVCKEUKG0g4c0OXnxCmIJmC/GhCJbZMrJcZgw/nFQTrcR/Ajavw5W0NzggVDsYQESWerQfVGEP0mxA+pCpWzjjLBtNzqLxFzpVKUi+UbZgK0j5dQJ84JF1kvjUSpTZ+5J6vmM+JxL9O8q2jNrYCyoLH5JgsXYqpWzUnCGOLafPIyaFWnY+CLyyBZwl40ZIEKpkjRbZ8xCqejcyIVkGPRvNQ9qK+ogrbG/b06TQb1IhiYoNLtc/o9r6JqvV8QznwznMZNmWRIfND4HYXm4= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e6bc6343-564a-4090-bfc0-08d813514051 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jun 2020 06:31:36.2444 (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: gVKaYv58lzQrH/PoWEmMGt8pvOuXd28d1VTHz/HIpbglcKbCO67U8XG1W/LPifHwllxziIviTl7HPglw/N4dBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1394 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 10/12] net/ice: enable stats for DCF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Xu, Ting > Sent: Tuesday, June 16, 2020 20:41 > To: dev@dpdk.org > Cc: Zhang, Qi Z ; Yang, Qiming > ; Wu, Jingjing ; Xing, Beil= ei > ; Kovacevic, Marko ; > Mcnamara, John ; Ye, Xiaolong > > Subject: [PATCH v3 10/12] net/ice: enable stats for DCF >=20 > From: Qi Zhang >=20 > Add support to get and reset Rx/Tx stats in DCF. Query stats from PF. >=20 > Signed-off-by: Qi Zhang > Signed-off-by: Ting Xu > --- > drivers/net/ice/ice_dcf.c | 27 ++++++++ > drivers/net/ice/ice_dcf.h | 4 ++ > drivers/net/ice/ice_dcf_ethdev.c | 102 +++++++++++++++++++++++++++-- > -- > 3 files changed, 120 insertions(+), 13 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index > f18c0f16a..fbeb58ee1 100644 > --- a/drivers/net/ice/ice_dcf.c > +++ b/drivers/net/ice/ice_dcf.c > @@ -993,3 +993,30 @@ ice_dcf_disable_queues(struct ice_dcf_hw *hw) >=20 > return err; > } > + > +int > +ice_dcf_query_stats(struct ice_dcf_hw *hw, > + struct virtchnl_eth_stats *pstats) { > + struct virtchnl_queue_select q_stats; > + struct dcf_virtchnl_cmd args; > + int err; > + > + memset(&q_stats, 0, sizeof(q_stats)); > + q_stats.vsi_id =3D hw->vsi_res->vsi_id; > + > + args.v_op =3D VIRTCHNL_OP_GET_STATS; > + args.req_msg =3D (uint8_t *)&q_stats; > + args.req_msglen =3D sizeof(q_stats); > + args.rsp_msglen =3D sizeof(*pstats); > + args.rsp_msgbuf =3D (uint8_t *)pstats; > + args.rsp_buflen =3D sizeof(*pstats); > + > + err =3D ice_dcf_execute_virtchnl_cmd(hw, &args); Why don't use ice_dcf_send_cmd_req_no_irq? all the other virtual channel in= terface are called by ice_dcf_send_cmd_req_no_irq in dcf, like ice_dcf_get_= vf_vsi_map > + if (err) { > + PMD_DRV_LOG(ERR, "fail to execute command > OP_GET_STATS"); > + return err; > + } > + > + return 0; > +} > diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index > 68e1661c0..e82bc7748 100644 > --- a/drivers/net/ice/ice_dcf.h > +++ b/drivers/net/ice/ice_dcf.h > @@ -58,6 +58,7 @@ struct ice_dcf_hw { > uint16_t msix_base; > uint16_t nb_msix; > uint16_t rxq_map[16]; > + struct virtchnl_eth_stats eth_stats_offset; > }; >=20 > int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw, @@ -72,4 +73,7 > @@ int ice_dcf_configure_queues(struct ice_dcf_hw *hw); int > ice_dcf_config_irq_map(struct ice_dcf_hw *hw); int > ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool o= n); > int ice_dcf_disable_queues(struct ice_dcf_hw *hw); > +int ice_dcf_query_stats(struct ice_dcf_hw *hw, > + struct virtchnl_eth_stats *pstats); > + > #endif /* _ICE_DCF_H_ */ > diff --git a/drivers/net/ice/ice_dcf_ethdev.c > b/drivers/net/ice/ice_dcf_ethdev.c > index 239426b09..1a675064a 100644 > --- a/drivers/net/ice/ice_dcf_ethdev.c > +++ b/drivers/net/ice/ice_dcf_ethdev.c > @@ -695,19 +695,6 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, > return 0; > } >=20 > -static int > -ice_dcf_stats_get(__rte_unused struct rte_eth_dev *dev, > - __rte_unused struct rte_eth_stats *igb_stats) > -{ > - return 0; > -} > - > -static int > -ice_dcf_stats_reset(__rte_unused struct rte_eth_dev *dev) -{ > - return 0; > -} > - > static int > ice_dcf_dev_promiscuous_enable(__rte_unused struct rte_eth_dev *dev) > { @@ -760,6 +747,95 @@ ice_dcf_dev_filter_ctrl(struct rte_eth_dev *dev, > return ret; > } >=20 > +#define ICE_DCF_32_BIT_WIDTH (CHAR_BIT * 4) #define > +ICE_DCF_48_BIT_WIDTH (CHAR_BIT * 6) #define ICE_DCF_48_BIT_MASK > +RTE_LEN2MASK(ICE_DCF_48_BIT_WIDTH, uint64_t) > + > +static void > +ice_dcf_stat_update_48(uint64_t *offset, uint64_t *stat) { > + if (*stat >=3D *offset) > + *stat =3D *stat - *offset; > + else > + *stat =3D (uint64_t)((*stat + > + ((uint64_t)1 << ICE_DCF_48_BIT_WIDTH)) - *offset); > + > + *stat &=3D ICE_DCF_48_BIT_MASK; > +} > + > +static void > +ice_dcf_stat_update_32(uint64_t *offset, uint64_t *stat) { > + if (*stat >=3D *offset) > + *stat =3D (uint64_t)(*stat - *offset); > + else > + *stat =3D (uint64_t)((*stat + > + ((uint64_t)1 << ICE_DCF_32_BIT_WIDTH)) - *offset); } > + > +static void > +ice_dcf_update_stats(struct virtchnl_eth_stats *oes, > + struct virtchnl_eth_stats *nes) > +{ > + ice_dcf_stat_update_48(&oes->rx_bytes, &nes->rx_bytes); > + ice_dcf_stat_update_48(&oes->rx_unicast, &nes->rx_unicast); > + ice_dcf_stat_update_48(&oes->rx_multicast, &nes->rx_multicast); > + ice_dcf_stat_update_48(&oes->rx_broadcast, &nes->rx_broadcast); > + ice_dcf_stat_update_32(&oes->rx_discards, &nes->rx_discards); > + ice_dcf_stat_update_48(&oes->tx_bytes, &nes->tx_bytes); > + ice_dcf_stat_update_48(&oes->tx_unicast, &nes->tx_unicast); > + ice_dcf_stat_update_48(&oes->tx_multicast, &nes->tx_multicast); > + ice_dcf_stat_update_48(&oes->tx_broadcast, &nes->tx_broadcast); > + ice_dcf_stat_update_32(&oes->tx_errors, &nes->tx_errors); > + ice_dcf_stat_update_32(&oes->tx_discards, &nes->tx_discards); } > + > + > +static int > +ice_dcf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) > +{ > + struct ice_dcf_adapter *ad =3D dev->data->dev_private; > + struct ice_dcf_hw *hw =3D &ad->real_hw; > + struct virtchnl_eth_stats pstats; > + int ret; > + > + ret =3D ice_dcf_query_stats(hw, &pstats); > + if (ret =3D=3D 0) { > + ice_dcf_update_stats(&hw->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 * RTE_ETHER_CRC_LEN; > + stats->obytes =3D pstats.tx_bytes; > + } else { > + PMD_DRV_LOG(ERR, "Get statistics failed"); > + } > + return ret; > +} > + > +static int > +ice_dcf_stats_reset(struct rte_eth_dev *dev) { > + struct ice_dcf_adapter *ad =3D dev->data->dev_private; > + struct ice_dcf_hw *hw =3D &ad->real_hw; > + struct virtchnl_eth_stats pstats; > + int ret; > + > + /* read stat values to clear hardware registers */ > + ret =3D ice_dcf_query_stats(hw, &pstats); > + if (ret !=3D 0) > + return ret; > + > + /* set stats offset base on current values */ > + hw->eth_stats_offset =3D pstats; > + > + return 0; > +} > + > static void > ice_dcf_dev_close(struct rte_eth_dev *dev) { > -- > 2.17.1