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 C3B9DA04B0; Thu, 13 Aug 2020 20:11:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CF15B1C0C6; Thu, 13 Aug 2020 20:11:51 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8C8211C0C2 for ; Thu, 13 Aug 2020 20:11:50 +0200 (CEST) IronPort-SDR: Ze6qUTSYiUWR0AFvsB/Ip455JGTmNG80YhfrMkJMEYPQteq/+9+Zh7fQNSKXViqDXdkxK+AM2f NPfBl2ZD0K6Q== X-IronPort-AV: E=McAfee;i="6000,8403,9712"; a="215825084" X-IronPort-AV: E=Sophos;i="5.76,309,1592895600"; d="scan'208";a="215825084" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 11:11:49 -0700 IronPort-SDR: yehCC10MBfQMbHS3cgAatm2aSl6jIOd6cfzkRyvZCnevNpQDdP6Xvg/2a1ZpOxlDM+ScRTybmd X7uDWwn0z3lw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,309,1592895600"; d="scan'208";a="439870154" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga004.jf.intel.com with ESMTP; 13 Aug 2020 11:11:48 -0700 Received: from sivswdev09.ir.intel.com (sivswdev09.ir.intel.com [10.237.217.48]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 07DIBm9q019978; Thu, 13 Aug 2020 19:11:48 +0100 Received: from sivswdev09.ir.intel.com (localhost [127.0.0.1]) by sivswdev09.ir.intel.com with ESMTP id 07DIBl5H008015; Thu, 13 Aug 2020 19:11:47 +0100 Received: (from lma25@localhost) by sivswdev09.ir.intel.com with LOCAL id 07DIBlpA008011; Thu, 13 Aug 2020 19:11:47 +0100 Date: Thu, 13 Aug 2020 19:11:47 +0100 From: "Liang, Ma" To: dev@dpdk.org Cc: anatoly.burakov@intel.com Message-ID: <20200813181147.GC28651@sivswdev09.ir.intel.com> References: <1597141666-20621-1-git-send-email-liang.j.ma@intel.com> <1597141666-20621-2-git-send-email-liang.j.ma@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1597141666-20621-2-git-send-email-liang.j.ma@intel.com> Subject: Re: [dpdk-dev] [RFC v2 2/5] ethdev: add simple power management API and callback 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" On 11 Aug 11:27, Liang Ma wrote: > +static uint16_t > +rte_ethdev_pmgmt_umait(uint16_t port_id, uint16_t qidx, > + struct rte_mbuf **pkts __rte_unused, uint16_t nb_rx, > + uint16_t max_pkts __rte_unused, void *_ __rte_unused) > +{ > + > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + > + if (dev->pwr_mgmt_state == RTE_ETH_DEV_POWER_MGMT_ENABLED) { > + if (unlikely(nb_rx == 0)) { > + dev->empty_poll_stats[qidx].num++; > + if (unlikely(dev->empty_poll_stats[qidx].num > > + ETH_EMPTYPOLL_MAX)) { > + volatile void *target_addr; > + uint64_t expected, mask; > + uint16_t ret; > + > + /* > + * get address of next descriptor in the RX > + * ring for this queue, as well as expected > + * value and a mask. > + */ > + ret = (*dev->dev_ops->next_rx_desc) > + (dev->data->rx_queues[qidx], > + &target_addr, &expected, &mask); > + if (ret == 0) > + /* -1ULL is maximum value for TSC */ > + rte_power_monitor(target_addr, > + expected, mask, > + 0, -1ULL); > + } > + } else > + dev->empty_poll_stats[qidx].num = 0; > + } > + > + return 0; should return nb_rx here. that's fixed in v3. > +} > + > +static uint16_t > +rte_ethdev_pmgmt_pause(uint16_t port_id, uint16_t qidx, > + struct rte_mbuf **pkts __rte_unused, uint16_t nb_rx, > + uint16_t max_pkts __rte_unused, void *_ __rte_unused) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + > + int i; > + > + if (dev->pwr_mgmt_state == RTE_ETH_DEV_POWER_MGMT_ENABLED) { > + if (unlikely(nb_rx == 0)) { > + > + dev->empty_poll_stats[qidx].num++; > + > + if (unlikely(dev->empty_poll_stats[qidx].num > > + ETH_EMPTYPOLL_MAX)) { > + > + for (i = 0; i < RTE_ETH_PAUSE_NUM; i++) > + rte_pause(); > + > + } > + } else > + dev->empty_poll_stats[qidx].num = 0; > + } > + > + return 0; should return nb_rx here. that's fixed in v3. > +} > + > +static uint16_t > +rte_ethdev_pmgmt_scalefreq(uint16_t port_id, uint16_t qidx, > + struct rte_mbuf **pkts __rte_unused, uint16_t nb_rx, > + uint16_t max_pkts __rte_unused, void *_ __rte_unused) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + > + if (dev->pwr_mgmt_state == RTE_ETH_DEV_POWER_MGMT_ENABLED) { > + if (unlikely(nb_rx == 0)) { > + dev->empty_poll_stats[qidx].num++; > + if (unlikely(dev->empty_poll_stats[qidx].num > > + ETH_EMPTYPOLL_MAX)) { > + > + /*scale down freq */ > + rte_power_freq_min(rte_lcore_id()); > + > + } > + } else { > + dev->empty_poll_stats[qidx].num = 0; > + /* scal up freq */ > + rte_power_freq_max(rte_lcore_id()); > + } > + } > + > + return 0; should return nb_rx here. that's fixed in v3. > +} > + -- > 2.17.1 >