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 AE704A04C5; Fri, 4 Sep 2020 22:55:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 123F31BC25; Fri, 4 Sep 2020 22:55:05 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4796ACF3 for ; Fri, 4 Sep 2020 22:55:03 +0200 (CEST) IronPort-SDR: ucdiVlXad1EIrmD+3WzOOE0rxwLH360UF63BWqhFL36Ddwzr1hXXnvkVwk8RQfRi55XJYYBr1B HMxybkHx9a7A== X-IronPort-AV: E=McAfee;i="6000,8403,9734"; a="155320997" X-IronPort-AV: E=Sophos;i="5.76,391,1592895600"; d="scan'208";a="155320997" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2020 13:55:01 -0700 IronPort-SDR: BqK+4ohxKSmslqmG6BHGT9qQNl5tbqRpMWzVywSDEqwEHRkBthJBq/h/5ydPrt8boeIi9olhtb 53jyRG9A602A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,391,1592895600"; d="scan'208";a="298543999" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga003.jf.intel.com with ESMTP; 04 Sep 2020 13:55:01 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 4 Sep 2020 13:55:00 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.1713.5 via Frontend Transport; Fri, 4 Sep 2020 13:55:00 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.54) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Fri, 4 Sep 2020 13:54:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GwccgacJRxubfHv276OI06Af2TAjWcfUZIiRFIPEaiUr7zeM7hOrlIl4GLH2GglFd4NVQU91FIlcP4vIVftAVbF67YDLXQ/ZUBoRvd12UNe4VQs/Bbeoln5Y3ObjbjuqTJfC+tEXDgf9B59MEJUV32+qgkiIOfnAU4vQfYCi5SgUor+Zj4/jOFjzPNt1286tSLVqIFwX4/HwVEuwW8ryJh9dWpXcFjvlmSiv/ch2OUcuTdIzF2bpURJZaKAK1GKsDIkNpBFdxi2N9gn8Gndx+qWC2aA9KY+OmQO7SU7LfMfHfhCtk+3G9u9krcgmSuuaju/GFCfv3qRTk2T1kQOasw== 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=GpP7iycfuofU5yHFXfeBzWD9d5vX5UQaPGXoYRfFwFE=; b=gd61+V6kqmJMwcMNKeKpxdDo7SwncaNE4L3reW1+h2YouAoYhPxwx4gr+g3ieAyvnLpZ6RP5xlIhchB/9VD9FyNhblqwNuPIh5dWLgpePMi9PX7xjSs4JjNBzMaOyV+iVbALKvrQ9DjSQhND8xqYe76wkvmJ79KssQ7JW/YfKON7vgJP4KjtxBNr5fTgeSgJsPhUjjnpgvj+ssQgZ86WfVWr/tPzpq2QP1cF9oq/bb1+y3EMJQ/v9C9dLumgs7bE0uK16ZjFV2ZCNRIk0kSep2JItHHwlzpncorI9QAZtbXGjfQ94631+h8OaCYFF5aqAOHS3ylQ+NLx9zI4XT7icQ== 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=GpP7iycfuofU5yHFXfeBzWD9d5vX5UQaPGXoYRfFwFE=; b=aUh+YtirHvDtew/mugDifXUVNrDDQwLAv2s801AEbuK3loRZeMDQvjCKFtekvJL+TqcVgn+Ywh6BgTaQ3Xf9YYD40aWEAxcvQwXXFc9vvV9nSib0bnhp61r9pHyWPa6ZqGmugnC2tJgtrNcmAPJuPjof9lM1HV7FIlUQJ2OSl5E= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB2725.namprd11.prod.outlook.com (2603:10b6:a02:c5::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.16; Fri, 4 Sep 2020 20:54:49 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f43b:a137:dab8:8b0b]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f43b:a137:dab8:8b0b%6]) with mapi id 15.20.3348.015; Fri, 4 Sep 2020 20:54:49 +0000 From: "Ananyev, Konstantin" To: "Ma, Liang J" , "dev@dpdk.org" CC: "Hunt, David" , "Burakov, Anatoly" , "Ma, Liang J" Thread-Topic: [dpdk-dev] [PATCH v3 2/6] ethdev: add simple power management API Thread-Index: AQHWgqTrsG/LU9CSCkyfmWVHfW5l7qlY9Hyw Date: Fri, 4 Sep 2020 20:54:49 +0000 Message-ID: References: <1597141666-20621-1-git-send-email-liang.j.ma@intel.com> <1599214740-3927-1-git-send-email-liang.j.ma@intel.com> <1599214740-3927-2-git-send-email-liang.j.ma@intel.com> In-Reply-To: <1599214740-3927-2-git-send-email-liang.j.ma@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 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: [46.7.39.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 28bbde45-d219-4132-1a94-08d85114c390 x-ms-traffictypediagnostic: BYAPR11MB2725: 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:1417; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RR1fczc25wzndBo54Vrebul2TFdjUu0uzQb+thR04ICx+OsNs1m5J/kX+aVMYVsly8AaMqWgx1ZnEwjcJRQjdEgzFTcJp7qC21FHw00YH2S4ewND2t9rkMBYOPajJR4BQPEEFs5aCZB8y3SfP69xdIs+FlZYFOKvBGVZpTpfLIFlkHJiCJoLS9nXJj9Ha8T5o3RGqTpsQiSUmSbCnaKpCns4pnEnDKs5Juh1A27aATMAkH10Py9DAv3wLwfQInqhkpMXI8XRn2j2Dz2+JrIS9vgmCZ75OM/aSh29EHfXZrHCBuy8QlqyeYJVxQ+DK9iq3HRusvD2sNhjuxrbYDrcCA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(366004)(39860400002)(376002)(346002)(6506007)(186003)(76116006)(33656002)(86362001)(7696005)(9686003)(5660300002)(26005)(66476007)(2906002)(52536014)(66556008)(64756008)(55016002)(66946007)(66446008)(83380400001)(8676002)(478600001)(8936002)(54906003)(4326008)(316002)(71200400001)(107886003)(110136005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: Iy6tzckqUuc7eocl4O2eTiFLG3zMkBTNx1iTt5QNfg6Neduj98DVj7OQwzlND5vAEXtNI3MNeRFYT0k517VujISKe0sXdI/4YFwz8KoOzYc8/HkXw4wFEwnq8zTorcWBOUjSavQMjjuT1cHSjAk2921Dzi8Mu2XFkHp8ySY47qJkqyTlH7HmDFjEvQzD01RyLfFHyke4Ge/eK+Gi0Q2r4qzZw2b5QLTMtLpkQGL3xdUobvPRqdqrnMc61SlFWPWWKUQ+7zQrRRTXU4C/jSShvF4URvUjlpfKsTS5iCyBm0Gd+hDBC8J2j0tyzYvr1gxLA0Jk+nFiryVBqTP7n9upWG5O45e3WQyHKNJgMLj6Dxw1uBjgbbx9wRP6F3QA7Z7hZfFtP9wBx23YTj55MTN1v9y3EkXl+BN0/BGDbMxMpdQst/IQ+p7IBYt+s3Alp8WtJ2nPr96lK7P9efPkiz0a/ybyqXboC//lNgawpp5OIK8kJa1tin74i3M6fInJbxKywxl0Idl4/af3btYytt2PUrLF7yaiTfRjZpjzIj4PRU0FSbrROmvJs7Ipg9/wNka9tLAz1ykBj4bu6l3AssEDlp4sw3P8kjL3Pky4XUoKfemN1PjASnRc3FMOZ7LYxH2VkrVfYXlhM61Hib6CHFqmhQ== 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: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28bbde45-d219-4132-1a94-08d85114c390 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Sep 2020 20:54:49.4173 (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: X9OjllHgFkp9HC5N9Dh1Ekp9rD1hTy2DwXNGGneP4nvUjJqJBDj7fvFw8t+2QFEJ3tMy0uNmkL4Qp62+cMWZfg1mNfeLTTHhPwJf/bGIet8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2725 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 2/6] ethdev: add simple power management API 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" > Add a simple API allow ethdev get the last > available queue descriptor address from PMD. > Also include internal structure update. >=20 > Signed-off-by: Liang Ma > Signed-off-by: Anatoly Burakov > --- > lib/librte_ethdev/rte_ethdev.h | 22 ++++++++++++++ > lib/librte_ethdev/rte_ethdev_core.h | 46 +++++++++++++++++++++++++++-- > 2 files changed, 66 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethde= v.h > index 70295d7ab7..d9312d3e11 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -157,6 +157,7 @@ extern "C" { > #include > #include > #include > +#include >=20 > #include "rte_ethdev_trace_fp.h" > #include "rte_dev_info.h" > @@ -775,6 +776,7 @@ rte_eth_rss_hf_refine(uint64_t rss_hf) > /** Maximum nb. of vlan per mirror rule */ > #define ETH_MIRROR_MAX_VLANS 64 >=20 > +#define ETH_EMPTYPOLL_MAX 512 /**< Empty poll number threshlold= */ > #define ETH_MIRROR_VIRTUAL_POOL_UP 0x01 /**< Virtual Pool uplink Mi= rroring. */ > #define ETH_MIRROR_UPLINK_PORT 0x02 /**< Uplink Port Mirroring.= */ > #define ETH_MIRROR_DOWNLINK_PORT 0x04 /**< Downlink Port Mirrorin= g. */ > @@ -1602,6 +1604,26 @@ enum rte_eth_dev_state { > RTE_ETH_DEV_REMOVED, > }; >=20 > +#define RTE_ETH_PAUSE_NUM 64 /* How many times to pause */ > +/** > + * Possible power management states of an ethdev port. > + */ > +enum rte_eth_dev_power_mgmt_state { > + /** Device power management is disabled. */ > + RTE_ETH_DEV_POWER_MGMT_DISABLED =3D 0, > + /** Device power management is enabled. */ > + RTE_ETH_DEV_POWER_MGMT_ENABLED, > +}; > + > +enum rte_eth_dev_power_mgmt_cb_mode { > + /** WAIT callback mode. */ > + RTE_ETH_DEV_POWER_MGMT_CB_WAIT =3D 1, > + /** PAUSE callback mode. */ > + RTE_ETH_DEV_POWER_MGMT_CB_PAUSE, > + /** Freq Scaling callback mode. */ > + RTE_ETH_DEV_POWER_MGMT_CB_SCALE, > +}; > + I don't think we need to put all these power related staff into rte_ethdev library. rte_power or so, seems like much better place for it. > struct rte_eth_dev_sriov { > uint8_t active; /**< SRIOV is active with 16, 32 or 64 po= ols */ > uint8_t nb_q_per_pool; /**< rx queue number per pool */ > diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_= ethdev_core.h > index 32407dd418..16e54bb4e4 100644 > --- a/lib/librte_ethdev/rte_ethdev_core.h > +++ b/lib/librte_ethdev/rte_ethdev_core.h > @@ -603,6 +603,30 @@ typedef int (*eth_tx_hairpin_queue_setup_t) > uint16_t nb_tx_desc, > const struct rte_eth_hairpin_conf *hairpin_conf); >=20 > +/** > + * @internal > + * Get the next RX ring descriptor address. > + * > + * @param rxq > + * ethdev queue pointer. > + * @param tail_desc_addr > + * the pointer point to descriptor address var. > + * @param expected > + * the pointer point to value to be expected when descriptor is set. > + * @param mask > + * the pointer point to comparison bitmask for the expected value. > + * @return > + * Negative errno value on error, 0 on success. > + * > + * @retval 0 > + * Success. > + * @retval -EINVAL > + * Failed to get descriptor address. > + */ > +typedef int (*eth_next_rx_desc_t) > + (void *rxq, volatile void **tail_desc_addr, > + uint64_t *expected, uint64_t *mask); > + In theory it could be anything: next RXD, doorbell, even some global variable. So I think function name needs to be more neutral: eth_rx_wait_addr() or so. Also I think you need a new rte_eth_ wrapper function for that dev op. =20 > /** > * @internal A structure containing the functions exported by an Etherne= t driver. > */ > @@ -752,6 +776,8 @@ struct eth_dev_ops { > /**< Set up device RX hairpin queue. */ > eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup; > /**< Set up device TX hairpin queue. */ > + eth_next_rx_desc_t next_rx_desc; > + /**< Get next RX ring descriptor address. */ > }; >=20 > /** > @@ -768,6 +794,14 @@ struct rte_eth_rxtx_callback { > void *param; > }; >=20 > +/** > + * @internal > + * Structure used to hold counters for empty poll > + */ > +struct rte_eth_ep_stat { > + uint64_t num; > +} __rte_cache_aligned; > + > /** > * @internal > * The generic data structure associated with each ethernet device. > @@ -807,8 +841,16 @@ struct rte_eth_dev { > enum rte_eth_dev_state state; /**< Flag indicating the port state */ > void *security_ctx; /**< Context for security ops */ >=20 > - uint64_t reserved_64s[4]; /**< Reserved for future fields */ > - void *reserved_ptrs[4]; /**< Reserved for future fields */ > + /**< Empty poll number */ > + enum rte_eth_dev_power_mgmt_state pwr_mgmt_state; > + /**< Power mgmt Callback mode */ > + enum rte_eth_dev_power_mgmt_cb_mode cb_mode; > + uint64_t reserved_64s[3]; /**< Reserved for future fields */ > + > + /**< Flag indicating the port power state */ > + struct rte_eth_ep_stat *empty_poll_stats; > + const struct rte_eth_rxtx_callback *cur_pwr_cb; > + void *reserved_ptrs[2]; /**< Reserved for future fields */ > } __rte_cache_aligned; >=20 > struct rte_eth_dev_sriov; > -- > 2.17.1