From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3EF2DA0524; Tue, 1 Jun 2021 14:00:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9CF6410E3; Tue, 1 Jun 2021 14:00:45 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id E643540E64 for ; Tue, 1 Jun 2021 14:00:42 +0200 (CEST) IronPort-SDR: Zt3RQsIJ6nfQlR6AIKQsdWrykurFyKL/m1d7PUlzZ5awMul0AKll3GjKzBK6S2xqAP4WfiDwsP y8uTO94b6w+A== X-IronPort-AV: E=McAfee;i="6200,9189,10001"; a="203528469" X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="203528469" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2021 05:00:42 -0700 IronPort-SDR: eN3k6PN3C6ghrePUTI9J9RenxglJnAkKZcLxl4fWlx+xnKVqTRJyS68Fja9VkwXl/vHzgV9RM8 upcjt3AyvvBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="549706987" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.54]) by fmsmga001.fm.intel.com with ESMTP; 01 Jun 2021 05:00:40 -0700 From: Anatoly Burakov To: dev@dpdk.org, Ciara Loftus , Qi Zhang Cc: david.hunt@intel.com Date: Tue, 1 Jun 2021 12:00:31 +0000 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 2/7] net/af_xdp: add power monitor support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Implement support for .get_monitor_addr in AF_XDP driver. Signed-off-by: Anatoly Burakov --- drivers/net/af_xdp/rte_eth_af_xdp.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index eb5660a3dc..dfbf74ea53 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "compat.h" @@ -788,6 +789,29 @@ eth_dev_configure(struct rte_eth_dev *dev) return 0; } +static int +eth_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc) +{ + struct pkt_rx_queue *rxq = rx_queue; + unsigned int *prod = rxq->rx.producer; + const uint32_t cur_val = rxq->rx.cached_prod; /* use cached value */ + + /* watch for changes in producer ring */ + pmc->addr = (void*)prod; + + /* store current value */ + pmc->val = cur_val; + pmc->mask = (uint32_t)~0; /* mask entire uint32_t value */ + + /* AF_XDP producer ring index is 32-bit */ + pmc->size = sizeof(uint32_t); + + /* this requires an inverted check */ + pmc->invert = 1; + + return 0; +} + static int eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -1448,6 +1472,7 @@ static const struct eth_dev_ops ops = { .link_update = eth_link_update, .stats_get = eth_stats_get, .stats_reset = eth_stats_reset, + .get_monitor_addr = eth_get_monitor_addr }; /** parse busy_budget argument */ -- 2.25.1