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 14FA845C98; Wed, 6 Nov 2024 17:08:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05FE7402C3; Wed, 6 Nov 2024 17:08:04 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mails.dpdk.org (Postfix) with ESMTP id A3A1D402B2 for ; Wed, 6 Nov 2024 17:08:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730909283; x=1762445283; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SAUt8IfV5rm5yllagBkmjKcw2Yoyul39grcnQF25BiE=; b=dzB1M+6r+xmQObyFgZo553+NdrG24o2q91UgMLD1GaiG0kMWnPPGliPL wDYU6wTRlyZN5sVWVdTamAb2CkNhQB+Wp0cZH+goL/MVGqDKKPhMGrwL3 MXhdP6pY14p2pPU0pXgNBLVaUewTyDKtAcB2hUed14BghNTYcIPs6qnZE PlJQLKOqPCjJbptpW1ZHA04zbPKNkK7KvQ3ZrFnqomAC/clzOsWfqIUY9 y9A0te9HbTY/wbnUta+1P6qTZevDMsIR6IotzfqQqjaBLTc3XyICOcb9E Jv1EQ+gEnzRdbe0Su9UYef1ocagULSuNDeQvb9Y0h6q8+hlm0t/j/ozke A==; X-CSE-ConnectionGUID: H52fBzaFRiGKlxYkJNcNOw== X-CSE-MsgGUID: FQElp4vVQauaLRF5X8qTMQ== X-IronPort-AV: E=McAfee;i="6700,10204,11248"; a="30932612" X-IronPort-AV: E=Sophos;i="6.11,263,1725346800"; d="scan'208";a="30932612" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2024 08:08:02 -0800 X-CSE-ConnectionGUID: SzKjFnN0RJ+i4Cv0nlawcg== X-CSE-MsgGUID: mJQRLAnLRNCN6NUIV1LKRA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,263,1725346800"; d="scan'208";a="89211008" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by fmviesa004.fm.intel.com with ESMTP; 06 Nov 2024 08:07:56 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Jerin Jacob Subject: [PATCH] eventdev: add device info telemetry command Date: Wed, 6 Nov 2024 16:07:50 +0000 Message-ID: <20241106160750.1093172-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 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 The eventdev telemetry support did not have a command for showing basic info about each eventdev device, such as the name and driver in use. Add this callback to allow telemetry user to determine which eventdev device is which. Signed-off-by: Bruce Richardson --- lib/eventdev/rte_eventdev.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index ca295c87c4..23631ff3f6 100644 --- a/lib/eventdev/rte_eventdev.c +++ b/lib/eventdev/rte_eventdev.c @@ -1725,6 +1725,41 @@ handle_dev_list(const char *cmd __rte_unused, return 0; } +static int +handle_dev_info(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d) +{ + uint8_t dev_id; + struct rte_eventdev *dev; + char *end_param; + + if (params == NULL || strlen(params) == 0 || !isdigit(*params)) + return -1; + + dev_id = strtoul(params, &end_param, 10); + if (*end_param != '\0') + RTE_EDEV_LOG_DEBUG( + "Extra parameters passed to eventdev telemetry command, ignoring"); + + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + dev = &rte_eventdevs[dev_id]; + + rte_tel_data_start_dict(d); + rte_tel_data_add_dict_int(d, "dev_id", dev_id); + rte_tel_data_add_dict_string(d, "dev_name", dev->dev->name); + rte_tel_data_add_dict_string(d, "dev_driver", dev->dev->driver->name); + rte_tel_data_add_dict_string(d, "state", + dev->data->dev_started ? "started" : "stopped"); + rte_tel_data_add_dict_int(d, "socket_id", dev->data->socket_id); + rte_tel_data_add_dict_int(d, "nb_queues", dev->data->nb_queues); + rte_tel_data_add_dict_int(d, "nb_ports", dev->data->nb_ports); + rte_tel_data_add_dict_uint_hex(d, "capabilities", dev->data->event_dev_cap, + sizeof(dev->data->event_dev_cap) * CHAR_BIT); + + return 0; +} + static int handle_port_list(const char *cmd __rte_unused, const char *params, @@ -2030,6 +2065,8 @@ RTE_INIT(eventdev_init_telemetry) { rte_telemetry_register_cmd("/eventdev/dev_list", handle_dev_list, "Returns list of available eventdevs. Takes no parameters"); + rte_telemetry_register_cmd("/eventdev/dev_info", handle_dev_info, + "Returns basic info about an eventdev. Parameter: DevID"); rte_telemetry_register_cmd("/eventdev/port_list", handle_port_list, "Returns list of available ports. Parameter: DevID"); rte_telemetry_register_cmd("/eventdev/queue_list", handle_queue_list, -- 2.43.0