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 50A3AA0C47; Tue, 26 Oct 2021 12:48:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D34044111E; Tue, 26 Oct 2021 12:48:52 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 724EB41109 for ; Tue, 26 Oct 2021 12:48:51 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10148"; a="290711859" X-IronPort-AV: E=Sophos;i="5.87,182,1631602800"; d="scan'208";a="290711859" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 03:48:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,182,1631602800"; d="scan'208";a="497282428" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by orsmga008.jf.intel.com with ESMTP; 26 Oct 2021 03:48:50 -0700 From: Naga Harish K S V To: jerinj@marvell.com, jay.jayatheerthan@intel.com Cc: dev@dpdk.org Date: Tue, 26 Oct 2021 05:48:43 -0500 Message-Id: <20211026104843.1929689-2-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20211026104843.1929689-1-s.v.naga.harish.k@intel.com> References: <20211026104843.1929689-1-s.v.naga.harish.k@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 2/2] eventdev/eth_rx: support telemetry 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" Added telemetry support for rxa_queue_stats to get rx queue stats Signed-off-by: Naga Harish K S V --- lib/eventdev/rte_event_eth_rx_adapter.c | 67 +++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index a485c89ffe..3e28ee5379 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -3278,6 +3278,69 @@ handle_rxa_get_queue_conf(const char *cmd __rte_unused, return 0; } +static int +handle_rxa_get_queue_stats(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d) +{ + uint8_t rx_adapter_id; + uint16_t rx_queue_id; + int eth_dev_id; + char *token, *l_params; + struct rte_event_eth_rx_adapter_queue_stats q_stats; + + if (params == NULL || strlen(params) == 0 || !isdigit(*params)) + return -1; + + /* Get Rx adapter ID from parameter string */ + l_params = strdup(params); + token = strtok(l_params, ","); + rx_adapter_id = strtoul(token, NULL, 10); + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(rx_adapter_id, -EINVAL); + + token = strtok(NULL, ","); + if (token == NULL || strlen(token) == 0 || !isdigit(*token)) + return -1; + + /* Get device ID from parameter string */ + eth_dev_id = strtoul(token, NULL, 10); + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(eth_dev_id, -EINVAL); + + token = strtok(NULL, ","); + if (token == NULL || strlen(token) == 0 || !isdigit(*token)) + return -1; + + /* Get Rx queue ID from parameter string */ + rx_queue_id = strtoul(token, NULL, 10); + if (rx_queue_id >= rte_eth_devices[eth_dev_id].data->nb_rx_queues) { + RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", rx_queue_id); + return -EINVAL; + } + + token = strtok(NULL, "\0"); + if (token != NULL) + RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" + " telemetry command, igrnoring"); + + if (rte_event_eth_rx_adapter_queue_stats_get(rx_adapter_id, eth_dev_id, + rx_queue_id, &q_stats)) { + RTE_EDEV_LOG_ERR("Failed to get Rx adapter queue stats"); + return -1; + } + + rte_tel_data_start_dict(d); + rte_tel_data_add_dict_u64(d, "rx_adapter_id", rx_adapter_id); + rte_tel_data_add_dict_u64(d, "eth_dev_id", eth_dev_id); + rte_tel_data_add_dict_u64(d, "rx_queue_id", rx_queue_id); + RXA_ADD_DICT(q_stats, rx_event_buf_count); + RXA_ADD_DICT(q_stats, rx_event_buf_size); + RXA_ADD_DICT(q_stats, rx_poll_count); + RXA_ADD_DICT(q_stats, rx_packets); + RXA_ADD_DICT(q_stats, rx_dropped); + + return 0; +} + RTE_INIT(rxa_init_telemetry) { rte_telemetry_register_cmd("/eventdev/rxa_stats", @@ -3291,4 +3354,8 @@ RTE_INIT(rxa_init_telemetry) rte_telemetry_register_cmd("/eventdev/rxa_queue_conf", handle_rxa_get_queue_conf, "Returns Rx queue config. Parameter: rxa_id, dev_id, queue_id"); + + rte_telemetry_register_cmd("/eventdev/rxa_queue_stats", + handle_rxa_get_queue_stats, + "Returns Rx queue stats. Parameter: rxa_id, dev_id, queue_id"); } -- 2.25.1