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 C081E42C4A; Wed, 7 Jun 2023 09:46:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 430D742D3F; Wed, 7 Jun 2023 09:45:34 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 1FEB241153 for ; Wed, 7 Jun 2023 09:45:27 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QbfQY4p8HzqTqH; Wed, 7 Jun 2023 15:40:37 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 7 Jun 2023 15:45:25 +0800 From: Jie Hai To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , Subject: [PATCH v2 08/13] ethdev: support telemetry query Tx queue info Date: Wed, 7 Jun 2023 15:42:03 +0800 Message-ID: <20230607074209.4798-9-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230607074209.4798-1-haijie1@huawei.com> References: <20230530090510.56812-1-haijie1@huawei.com> <20230607074209.4798-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500020.china.huawei.com (7.221.188.8) X-CFilter-Loop: Reflected 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 This patch support querying information of Tx queues. The command is like: --> /ethdev/tx_queue,0,0 { "/ethdev/tx_queue": { "host_threshold": 0, "prefetch_threshold": 0, "writeback_threshold": 0, "rs_threshold": 32, "free_threshold": 928, "deferred_start": "off", "offloads": [ "MBUF_FAST_FREE" ], "queue_state": 1, "nb_desc": 1024, "burst_flags": 0, "burst_mode": "Vector Neon" } } Signed-off-by: Jie Hai --- lib/ethdev/rte_ethdev_telemetry.c | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/lib/ethdev/rte_ethdev_telemetry.c b/lib/ethdev/rte_ethdev_telemetry.c index d1875dbe110e..f69bcedac86f 100644 --- a/lib/ethdev/rte_ethdev_telemetry.c +++ b/lib/ethdev/rte_ethdev_telemetry.c @@ -575,6 +575,54 @@ eth_dev_handle_port_rxq(const char *cmd __rte_unused, return ret; } +static int +eth_dev_handle_port_txq(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d) +{ + struct rte_eth_thresh *tx_thresh; + struct rte_eth_txconf *txconf; + struct rte_eth_txq_info qinfo; + struct rte_tel_data *offload; + uint16_t port_id, queue_id; + int ret; + + ret = ethdev_parse_queue_params(params, false, &port_id, &queue_id); + if (ret != 0) + return ret; + + ret = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo); + if (ret != 0) + return ret; + + rte_tel_data_start_dict(d); + tx_thresh = &qinfo.conf.tx_thresh; + txconf = &qinfo.conf; + rte_tel_data_add_dict_uint(d, "host_threshold", tx_thresh->hthresh); + rte_tel_data_add_dict_uint(d, "prefetch_threshold", tx_thresh->pthresh); + rte_tel_data_add_dict_uint(d, "writeback_threshold", tx_thresh->wthresh); + rte_tel_data_add_dict_uint(d, "rs_threshold", txconf->tx_rs_thresh); + rte_tel_data_add_dict_uint(d, "free_threshold", txconf->tx_free_thresh); + rte_tel_data_add_dict_string(d, "deferred_start", + txconf->tx_deferred_start == 0 ? "off" : "on"); + + offload = rte_tel_data_alloc(); + if (offload == NULL) + return -ENOMEM; + + eth_dev_parse_tx_offloads(txconf->offloads, offload); + rte_tel_data_add_dict_container(d, "offloads", offload, 0); + + rte_tel_data_add_dict_uint(d, "queue_state", qinfo.queue_state); + rte_tel_data_add_dict_uint(d, "nb_desc", qinfo.nb_desc); + + ret = eth_dev_add_burst_mode(port_id, queue_id, false, d); + if (ret != 0) + rte_tel_data_free(offload); + + return 0; +} + RTE_INIT(ethdev_init_telemetry) { rte_telemetry_register_cmd("/ethdev/list", eth_dev_handle_port_list, @@ -600,4 +648,6 @@ RTE_INIT(ethdev_init_telemetry) "Returns flow ctrl info for a port. Parameters: int port_id"); rte_telemetry_register_cmd("/ethdev/rx_queue", eth_dev_handle_port_rxq, "Returns Rx queue info for a port. Parameters: int port_id, int queue_id (Optional if only one queue)"); + rte_telemetry_register_cmd("/ethdev/tx_queue", eth_dev_handle_port_txq, + "Returns Tx queue info for a port. Parameters: int port_id, int queue_id (Optional if only one queue)"); } -- 2.33.0