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 0B842A0526; Fri, 24 Jul 2020 22:23:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 512CB1C065; Fri, 24 Jul 2020 22:23:37 +0200 (CEST) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by dpdk.org (Postfix) with ESMTP id 6090B1C034 for ; Fri, 24 Jul 2020 22:23:34 +0200 (CEST) Received: by mail-qk1-f193.google.com with SMTP id 11so9881794qkn.2 for ; Fri, 24 Jul 2020 13:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=radio-canada-ca.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HJG68ZzOlPr3cJN9Ojy0Owngi2KF0UCwBwFr8GmwT8s=; b=RsaJn8KtSvavFKJBZCcy54bc/Ggumj+P3BnYTLdEVhyAkYmRirQx+ND0BUrP7jgg9O s2zPC2qaTVAiBs3x6aj5pXJMeJGayziy2AvQaqbPlkSLCvcoGyDyyY0jLHiP7Jb1Mj0z scBMghCSrMQZaRV2JnaNsMhSHsnNDKaCRE+YCALbeNaBndRrx6PaJ+ctSk6tqe+ScY+F k0O1M5V5vsHHn5u+GKW9m0SHIWBNM9B432oI1WLLblYTq70OOYsRfoIbmN1YJr+TD4tR POiiMEQKP9L7P4NYA+tqqO32dAK8y9cAnarW0Y754VL0V7VcH4MsVqR74ncywD0rGFCD zorg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HJG68ZzOlPr3cJN9Ojy0Owngi2KF0UCwBwFr8GmwT8s=; b=eOE4m2EPl/S+pGbhxsKQXPfMcDJdcezAk/iovbj+wxqky+78FViH43MZeUIipcXMpy 1c6vdlXtUKrKkgj1BIRr3A2HqGNQgWE5h+QD4kKdQmEyV/HnZeDgZcbZjFsQ3Xgx52ut b6G5hDRuAYY9LS3RPX/8y1VHxLWq3tc78TG6lVhcHIu1Ht2+G4gOrKKdIDmkNf3+5vnu cixqa+fxfxBHpYj3cpcWaVif/YUCpQ7OCoV11feEC6wgYs1CTuI5zIWNdcIjzogTP+te uLxeHFRjx4mlkz0Ho6iiniUd7QSccexyG1vCCj2EhUKttWJ5Ux8nfph4yKPnH5eCPcCi wNcQ== X-Gm-Message-State: AOAM532xqfIYGI6NZj5gsWeLlotYR1dEVg1Zs3zIqop7JmQ4ai64KJgI tUQuoaUuycjIQYh1cnUYF6Ffrcat7UQ= X-Google-Smtp-Source: ABdhPJyZ3G8tcpynGUaP5A19vMJsc7XlW16VU6XQFJ6I79OsM7t8Exc0bOHR0tDcpZiRqUhdADbkhg== X-Received: by 2002:a37:de19:: with SMTP id h25mr12278494qkj.354.1595622213529; Fri, 24 Jul 2020 13:23:33 -0700 (PDT) Received: from localhost.localdomain (modemcable246.10-73-45.static.videotron.ca. [45.73.10.246]) by smtp.gmail.com with ESMTPSA id f7sm5216089qkj.32.2020.07.24.13.23.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 13:23:33 -0700 (PDT) From: Patrick Keroulas To: dev@dpdk.org Cc: Patrick Keroulas Date: Fri, 24 Jul 2020 16:23:13 -0400 Message-Id: <20200724202315.19533-3-patrick.keroulas@radio-canada.ca> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200724202315.19533-1-patrick.keroulas@radio-canada.ca> References: <20200724202315.19533-1-patrick.keroulas@radio-canada.ca> Subject: [dpdk-dev] [[PATCH v3 2/4] ethdev: add API to query device frequency 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" Signed-off-by: Patrick Keroulas --- lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++++ lib/librte_ethdev/rte_ethdev.h | 17 +++++++++++++++++ lib/librte_ethdev/rte_ethdev_core.h | 5 +++++ lib/librte_ethdev/rte_ethdev_version.map | 2 ++ 4 files changed, 36 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 7858ad5f11..8e8812782f 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -4882,6 +4882,18 @@ rte_eth_read_clock(uint16_t port_id, uint64_t *clock) return eth_err(port_id, (*dev->dev_ops->read_clock)(dev, clock)); } +int +rte_eth_get_clock_freq(uint16_t port_id, uint64_t *freq) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_clock_freq, -ENOTSUP); + return eth_err(port_id, (*dev->dev_ops->get_clock_freq)(dev, freq)); +} + int rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info) { diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 57e4a6ca58..d17838e66f 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -4264,6 +4264,23 @@ __rte_experimental int rte_eth_read_clock(uint16_t port_id, uint64_t *clock); +/** + * Get the clock frequency of ethernet device, in Hz + * + * @param port_id + * The port identifier of the Ethernet device. + * @param[out] freq + * Pointer to the device clock frequency. + * + * @return + * - 0: Success. + * - -ENODEV: The port ID is invalid. + * - -ENOTSUP: The function is not supported by the Ethernet driver. + */ +__rte_experimental +int +rte_eth_get_clock_freq(uint16_t port_id, uint64_t *freq); + /** * Config l2 tunnel ether type of an Ethernet device for filtering specific * tunnel packets by ether type. diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 32407dd418..ac64961e6f 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -468,6 +468,10 @@ typedef int (*eth_read_clock)(struct rte_eth_dev *dev, uint64_t *timestamp); /**< @internal Function used to get the current value of the device clock. */ +typedef int (*eth_get_clock_freq)(struct rte_eth_dev *dev, + uint64_t *freq); +/**< @internal Function used to frequency from device clock */ + typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev, struct rte_dev_reg_info *info); /**< @internal Retrieve registers */ @@ -731,6 +735,7 @@ struct eth_dev_ops { eth_timesync_write_time timesync_write_time; /** Set the device clock time. */ eth_read_clock read_clock; + eth_get_clock_freq get_clock_freq; eth_xstats_get_by_id_t xstats_get_by_id; /**< Get extended device statistic values by ID. */ diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index 1212a17d32..ffc00bf94f 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -241,6 +241,8 @@ EXPERIMENTAL { __rte_ethdev_trace_rx_burst; __rte_ethdev_trace_tx_burst; rte_flow_get_aged_flows; + + rte_eth_get_clock_freq; }; INTERNAL { -- 2.17.1