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 1B184A04B5; Fri, 2 Oct 2020 16:15:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D02AF1D976; Fri, 2 Oct 2020 16:12:34 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id DFACE1D16E for ; Fri, 2 Oct 2020 16:12:24 +0200 (CEST) IronPort-SDR: Uod1PIgpPFg81r2JXEaf2Bh8GTXsvUI/8bB44dgu9cNb4dkU74WQkJQaZASzLH61xOZ3+ZAyUK S25UJvh6myNA== X-IronPort-AV: E=McAfee;i="6000,8403,9761"; a="160399054" X-IronPort-AV: E=Sophos;i="5.77,327,1596524400"; d="scan'208";a="160399054" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2020 07:12:16 -0700 IronPort-SDR: r61N78uBBgv1zsBUPNSac5sVo4eV7fvCDlYF3xIjd+TzjGXR97SxKS2i4kxZsYAVcjBGbQrAvU UZGC0tmi5e6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,327,1596524400"; d="scan'208";a="352381953" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga007.jf.intel.com with ESMTP; 02 Oct 2020 07:12:12 -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 092ECCZs003678; Fri, 2 Oct 2020 15:12:12 +0100 Received: from sivswdev09.ir.intel.com (localhost [127.0.0.1]) by sivswdev09.ir.intel.com with ESMTP id 092ECCVm025443; Fri, 2 Oct 2020 15:12:12 +0100 Received: (from lma25@localhost) by sivswdev09.ir.intel.com with LOCAL id 092ECCoa025439; Fri, 2 Oct 2020 15:12:12 +0100 From: Liang Ma To: dev@dpdk.org Cc: david.hunt@intel.com, stephen@networkplumber.org, konstantin.ananyev@intel.com, Liang Ma , Anatoly Burakov Date: Fri, 2 Oct 2020 15:11:52 +0100 Message-Id: <1601647919-25312-3-git-send-email-liang.j.ma@intel.com> X-Mailer: git-send-email 1.7.7.4 In-Reply-To: <1601647919-25312-1-git-send-email-liang.j.ma@intel.com> References: <1599214740-3927-1-git-send-email-liang.j.ma@intel.com> <1601647919-25312-1-git-send-email-liang.j.ma@intel.com> Subject: [dpdk-dev] [PATCH v4 03/10] 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 wake up address from PMD. Also include internal structure update. Signed-off-by: Liang Ma Signed-off-by: Anatoly Burakov --- lib/librte_ethdev/rte_ethdev.c | 19 ++++++++++++++++ lib/librte_ethdev/rte_ethdev.h | 24 ++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 28 ++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 1 + 4 files changed, 72 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index d7668114ca..88253d95f9 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -4804,6 +4804,25 @@ rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode)); } +int +rte_eth_get_wake_addr(uint16_t port_id, uint16_t queue_id, + volatile void **wake_addr, + uint64_t *expected, uint64_t *mask) +{ + struct rte_eth_dev *dev; + uint16_t ret; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + dev = &rte_eth_devices[port_id]; + + ret = (*dev->dev_ops->get_wake_addr) + (dev->data->rx_queues[queue_id], + wake_addr, expected, mask); + + return ret; +} + int rte_eth_dev_set_mc_addr_list(uint16_t port_id, struct rte_ether_addr *mc_addr_set, diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index d2bf74f128..a6cfe3cd57 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -4014,6 +4014,30 @@ __rte_experimental int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode); +/** + * Retrieve the wake up address from specific queue + * + * @param port_id + * The port identifier of the Ethernet device. + * @param queue_id + * The Tx queue on the Ethernet device for which information + * will be retrieved. + * @param wake_addr + * The pointer point to the address which is used for monitoring. + * @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 + * - 0: Success. + * -EINVAL: Failed to get wake address. + */ +__rte_experimental +int rte_eth_get_wake_addr(uint16_t port_id, uint16_t queue_id, + volatile void **wake_addr, + uint64_t *expected, uint64_t *mask); + /** * Retrieve device registers and register attributes (number of registers and * register size) diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index c3062c246c..935d46f25c 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -574,6 +574,31 @@ typedef int (*eth_tx_hairpin_queue_setup_t) uint16_t nb_tx_desc, const struct rte_eth_hairpin_conf *hairpin_conf); +/** + * @internal + * Get the Wake up 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_get_wake_addr_t) + (void *rxq, volatile void **tail_desc_addr, + uint64_t *expected, uint64_t *mask); + + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -713,6 +738,9 @@ 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_get_wake_addr_t get_wake_addr; + /**< Get wake up address. */ + }; /** diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index c95ef5157a..3cb2093980 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -229,6 +229,7 @@ EXPERIMENTAL { # added in 20.11 rte_eth_link_speed_to_str; rte_eth_link_to_str; + rte_eth_get_wake_addr; }; INTERNAL { -- 2.17.1