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 E314BA00C5;
	Thu, 30 Dec 2021 07:11:57 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 6A8B041161;
	Thu, 30 Dec 2021 07:10:05 +0100 (CET)
Received: from VLXDG1SPAM1.ramaxel.com (email.ramaxel.com [221.4.138.186])
 by mails.dpdk.org (Postfix) with ESMTP id 5B80E41153
 for <dev@dpdk.org>; Thu, 30 Dec 2021 07:10:00 +0100 (CET)
Received: from V12DG1MBS01.ramaxel.local (v12dg1mbs01.ramaxel.local
 [172.26.18.31])
 by VLXDG1SPAM1.ramaxel.com with ESMTPS id 1BU69DWl040086
 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);
 Thu, 30 Dec 2021 14:09:15 +0800 (GMT-8)
 (envelope-from songyl@ramaxel.com)
Received: from localhost.localdomain (10.64.9.47) by V12DG1MBS01.ramaxel.local
 (172.26.18.31) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 30
 Dec 2021 14:09:14 +0800
From: Yanling Song <songyl@ramaxel.com>
To: <dev@dpdk.org>
CC: <songyl@ramaxel.com>, <yanling.song@linux.dev>, <yanggan@ramaxel.com>,
 <xuyun@ramaxel.com>, <ferruh.yigit@intel.com>,
 <stephen@networkplumber.org>, <lihuisong@huawei.com>
Subject: [PATCH v6 21/26] net/spnic: support getting Tx/Rx queues info
Date: Thu, 30 Dec 2021 14:08:59 +0800
Message-ID: <a2b1cdb677f7effb1ead98f0bdd04d02858759e0.1640838702.git.songyl@ramaxel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1640838702.git.songyl@ramaxel.com>
References: <cover.1640838702.git.songyl@ramaxel.com>
MIME-Version: 1.0
Content-Type: text/plain
X-Originating-IP: [10.64.9.47]
X-ClientProxiedBy: V12DG1MBS03.ramaxel.local (172.26.18.33) To
 V12DG1MBS01.ramaxel.local (172.26.18.31)
X-DNSRBL: 
X-MAIL: VLXDG1SPAM1.ramaxel.com 1BU69DWl040086
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 implements rxq_info_get() and txq_info_get() to
support getting queue depth and mbuf pool info of specified
Tx/Rx queue.

Signed-off-by: Yanling Song <songyl@ramaxel.com>
---
 drivers/net/spnic/spnic_ethdev.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/spnic/spnic_ethdev.c b/drivers/net/spnic/spnic_ethdev.c
index 1b90212024..820f34da2f 100644
--- a/drivers/net/spnic/spnic_ethdev.c
+++ b/drivers/net/spnic/spnic_ethdev.c
@@ -1827,6 +1827,23 @@ static int spnic_rss_reta_update(struct rte_eth_dev *dev,
 	return err;
 }
 
+static void spnic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			       struct rte_eth_rxq_info *rxq_info)
+{
+	struct spnic_rxq *rxq = dev->data->rx_queues[queue_id];
+
+	rxq_info->mp = rxq->mb_pool;
+	rxq_info->nb_desc = rxq->q_depth;
+}
+
+static void spnic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			       struct rte_eth_txq_info *txq_qinfo)
+{
+	struct spnic_txq *txq = dev->data->tx_queues[queue_id];
+
+	txq_qinfo->nb_desc = txq->q_depth;
+}
+
 /**
  * Update MAC address
  *
@@ -2046,6 +2063,8 @@ static const struct eth_dev_ops spnic_pmd_ops = {
 	.rss_hash_conf_get             = spnic_rss_conf_get,
 	.reta_update                   = spnic_rss_reta_update,
 	.reta_query                    = spnic_rss_reta_query,
+	.rxq_info_get                  = spnic_rxq_info_get,
+	.txq_info_get                  = spnic_txq_info_get,
 	.mac_addr_set                  = spnic_set_mac_addr,
 	.mac_addr_remove               = spnic_mac_addr_remove,
 	.mac_addr_add                  = spnic_mac_addr_add,
@@ -2073,6 +2092,8 @@ static const struct eth_dev_ops spnic_pmd_vf_ops = {
 	.rss_hash_conf_get             = spnic_rss_conf_get,
 	.reta_update                   = spnic_rss_reta_update,
 	.reta_query                    = spnic_rss_reta_query,
+	.rxq_info_get                  = spnic_rxq_info_get,
+	.txq_info_get                  = spnic_txq_info_get,
 	.mac_addr_set                  = spnic_set_mac_addr,
 	.mac_addr_remove               = spnic_mac_addr_remove,
 	.mac_addr_add                  = spnic_mac_addr_add,
-- 
2.32.0