From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9EE234265D;
	Thu, 28 Sep 2023 09:46:54 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 730F140A8A;
	Thu, 28 Sep 2023 09:46:28 +0200 (CEST)
Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187])
 by mails.dpdk.org (Postfix) with ESMTP id 247F040273
 for <dev@dpdk.org>; Thu, 28 Sep 2023 09:46:17 +0200 (CEST)
Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53])
 by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rx58F6mLzzrSpC
 for <dev@dpdk.org>; Thu, 28 Sep 2023 15:43:57 +0800 (CST)
Received: from localhost.localdomain (10.67.165.2) 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.31; Thu, 28 Sep 2023 15:46:14 +0800
From: Jie Hai <haijie1@huawei.com>
To: <dev@dpdk.org>, Qi Zhang <qi.z.zhang@intel.com>, Xiao Wang
 <xiao.w.wang@intel.com>
CC: <haijie1@huawei.com>, <lihuisong@huawei.com>
Subject: [PATCH v2 6/8] net/fm10k: support getting queue information
Date: Thu, 28 Sep 2023 15:43:03 +0800
Message-ID: <20230928074305.2991100-7-haijie1@huawei.com>
X-Mailer: git-send-email 2.30.0
In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com>
References: <20230908112901.1169869-1-haijie1@huawei.com>
 <20230928074305.2991100-1-haijie1@huawei.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [10.67.165.2]
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

This patch adds support for querying Rx/Tx queue information.

Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 4d3c4c10cfa4..e12177b7cdba 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2835,6 +2835,32 @@ fm10k_dev_close(struct rte_eth_dev *dev)
 	return ret;
 }
 
+
+static void
+fm10k_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
+		  struct rte_eth_rxq_info *qinfo)
+{
+	struct fm10k_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[rx_queue_id];
+	qinfo->nb_desc = rxq->nb_desc;
+	qinfo->conf.rx_drop_en = rxq->drop_en;
+	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+static void
+fm10k_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
+		  struct rte_eth_txq_info *qinfo)
+{
+	struct fm10k_tx_queue *txq;
+
+	txq = dev->data->tx_queues[tx_queue_id];
+	qinfo->nb_desc = txq->nb_desc;
+	qinfo->conf.tx_rs_thresh = txq->rs_thresh;
+	qinfo->conf.tx_free_thresh = txq->free_thresh;
+	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
+
 static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.dev_configure		= fm10k_dev_configure,
 	.dev_start		= fm10k_dev_start,
@@ -2866,6 +2892,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
+	.rxq_info_get		= fm10k_dev_rxq_info_get,
+	.txq_info_get		= fm10k_dev_txq_info_get,
 	.reta_update		= fm10k_reta_update,
 	.reta_query		= fm10k_reta_query,
 	.rss_hash_update	= fm10k_rss_hash_update,
-- 
2.30.0