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 1778AA00C3; Wed, 8 Jun 2022 13:16:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D8F54281B; Wed, 8 Jun 2022 13:16:54 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 9716940689 for ; Wed, 8 Jun 2022 13:16:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654687011; x=1686223011; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oNSSVPlqG/7CgzeGxaX+YVzJdmBUZiXbKKsf5YcFN/U=; b=Zy8Yh7C2QgQhfK4Ocd1QPriJ1e7w7tycVSUKmK9S5bScHhwKSut0rOYO tyluMZyvqjcJVrOuS6/R42pi3aWCJZsNwsK39mBSNrkiBzdvxLl7/k4Pv F64JpxhmUh9+aruJtgkf1AdGNr//GC4Z2nqowmMjTHqKQ+UvSc9qcQIWX eRILPfcqiFKe9Awtd6c1jh8F2jxqZS4GH+IhhWd2wOiQyrXbTLlXlHAPh u3zAzEL2yrO96ZYvOMnVL4tFz6K0Fj+720XBGGN3Z37c+y1YdCviLs/2r nqf4D9B/IVuPzx9Xl/KHOSxDNYn7uSVnRD9t/VZ4UgfPTVWR3MHLeTqJo w==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="256688578" X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="256688578" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 04:16:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="670498904" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 08 Jun 2022 04:16:48 -0700 From: Ganapati Kundapura To: jerinjacobk@gmail.com, dev@dpdk.org, jay.jayatheerthan@intel.com Cc: s.v.naga.harish.k@intel.com Subject: [PATCH v5 2/7] eventdev/eth_rx: add telemetry callback for instance get Date: Wed, 8 Jun 2022 06:16:39 -0500 Message-Id: <20220608111644.3939628-2-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220608111644.3939628-1-ganapati.kundapura@intel.com> References: <20220607151320.3561528-1-ganapati.kundapura@intel.com> <20220608111644.3939628-1-ganapati.kundapura@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Added telemetry handler for rte_event_eth_rx_adapter_instance_get() to retrieve adapter instance id for specified ethernet device id and rx queue index. Signed-off-by: Ganapati Kundapura diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index d1b4874..3095647 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -3697,6 +3697,68 @@ handle_rxa_queue_stats_reset(const char *cmd __rte_unused, return ret; } +static int +handle_rxa_instance_get(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d) +{ + uint8_t instance_id; + uint16_t rx_queue_id; + int eth_dev_id, ret = -1; + char *token, *l_params; + + if (params == NULL || strlen(params) == 0 || !isdigit(*params)) + return -1; + + l_params = strdup(params); + if (l_params == NULL) + return -ENOMEM; + token = strtok(l_params, ","); + RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); + + /* Get device ID from parameter string */ + eth_dev_id = strtoul(token, NULL, 10); + RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); + + token = strtok(NULL, ","); + RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -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); + ret = -EINVAL; + goto error; + } + + token = strtok(NULL, "\0"); + if (token != NULL) + RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" + " telemetry command, ignoring"); + + /* Parsing parameter finished */ + free(l_params); + + if (rte_event_eth_rx_adapter_instance_get(eth_dev_id, + rx_queue_id, + &instance_id)) { + RTE_EDEV_LOG_ERR("Failed to get RX adapter instance ID " + " for rx_queue_id = %d", rx_queue_id); + return -1; + } + + rte_tel_data_start_dict(d); + 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); + rte_tel_data_add_dict_u64(d, "rxa_instance_id", instance_id); + + return 0; + +error: + free(l_params); + return ret; +} + RTE_INIT(rxa_init_telemetry) { rte_telemetry_register_cmd("/eventdev/rxa_stats", @@ -3718,4 +3780,8 @@ RTE_INIT(rxa_init_telemetry) rte_telemetry_register_cmd("/eventdev/rxa_queue_stats_reset", handle_rxa_queue_stats_reset, "Reset Rx queue stats. Parameter: rxa_id, dev_id, queue_id"); + + rte_telemetry_register_cmd("/eventdev/rxa_rxq_instance_get", + handle_rxa_instance_get, + "Returns Rx adapter instance id. Parameter: dev_id, queue_id"); } -- 2.6.4