DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
To: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>,
	"Min Hu (Connor)" <humin29@huawei.com>,
	Yisen Zhuang <yisen.zhuang@huawei.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH v4 2/3] net/hns3: support getting Tx and Rx queue information
Date: Mon, 24 Aug 2020 19:01:29 +0800
Message-ID: <20200824110130.16647-3-huwei013@chinasoftinc.com> (raw)
In-Reply-To: <20200824110130.16647-1-huwei013@chinasoftinc.com>

From: Huisong Li <lihuisong@huawei.com>

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

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
v3 -> v4:
	remove unused variable ‘hw’ in hns3_rxq_info_get
	and hns3_rxq_info_get function.
---
 drivers/net/hns3/hns3_ethdev.c    |  2 ++
 drivers/net/hns3/hns3_ethdev_vf.c |  2 ++
 drivers/net/hns3/hns3_rxtx.c      | 31 +++++++++++++++++++++++++++++++
 drivers/net/hns3/hns3_rxtx.h      |  5 ++++-
 4 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index bcbbd7e81..fab1914c3 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -5422,6 +5422,8 @@ static const struct eth_dev_ops hns3_eth_dev_ops = {
 	.tx_queue_release       = hns3_dev_tx_queue_release,
 	.rx_queue_intr_enable   = hns3_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable  = hns3_dev_rx_queue_intr_disable,
+	.rxq_info_get           = hns3_rxq_info_get,
+	.txq_info_get           = hns3_txq_info_get,
 	.dev_configure          = hns3_dev_configure,
 	.flow_ctrl_get          = hns3_flow_ctrl_get,
 	.flow_ctrl_set          = hns3_flow_ctrl_set,
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 3156ed7f5..60b576b02 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2482,6 +2482,8 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = {
 	.tx_queue_release   = hns3_dev_tx_queue_release,
 	.rx_queue_intr_enable   = hns3_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable  = hns3_dev_rx_queue_intr_disable,
+	.rxq_info_get       = hns3_rxq_info_get,
+	.txq_info_get       = hns3_txq_info_get,
 	.dev_configure      = hns3vf_dev_configure,
 	.mac_addr_add       = hns3vf_add_mac_addr,
 	.mac_addr_remove    = hns3vf_remove_mac_addr,
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 3e5e32e38..fc1a256f3 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2820,3 +2820,34 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev)
 		eth_dev->tx_pkt_prepare = hns3_dummy_rxtx_burst;
 	}
 }
+
+void
+hns3_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+		  struct rte_eth_rxq_info *qinfo)
+{
+	struct hns3_rx_queue *rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mb_pool;
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	/*
+	 * If there are no available Rx buffer descriptors, incoming packets
+	 * are always dropped by hardware based on hns3 network engine.
+	 */
+	qinfo->conf.rx_drop_en = 1;
+	qinfo->conf.offloads = dev->data->dev_conf.rxmode.offloads;
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+void
+hns3_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+		  struct rte_eth_txq_info *qinfo)
+{
+	struct hns3_tx_queue *txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads;
+	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index 0d20a27c8..f1fb3b56a 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -402,5 +402,8 @@ int hns3_set_fake_rx_or_tx_queues(struct rte_eth_dev *dev, uint16_t nb_rx_q,
 int hns3_config_gro(struct hns3_hw *hw, bool en);
 int hns3_restore_gro_conf(struct hns3_hw *hw);
 void hns3_update_all_queues_pvid_state(struct hns3_hw *hw);
-
+void hns3_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+		       struct rte_eth_rxq_info *qinfo);
+void hns3_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+		       struct rte_eth_txq_info *qinfo);
 #endif /* _HNS3_RXTX_H_ */
-- 
2.27.0


  parent reply	other threads:[~2020-08-24 11:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18  2:51 [dpdk-dev] [PATCH] " Wei Hu (Xavier)
2020-08-18  3:07 ` [dpdk-dev] [PATCH V2] " Wei Hu (Xavier)
2020-08-19 16:19   ` Ferruh Yigit
2020-08-20  9:07     ` Wei Hu (Xavier)
2020-08-20  9:03 ` [dpdk-dev] [PATCH v3 0/3] minor updates for getting queue info Wei Hu (Xavier)
2020-08-20  9:03   ` [dpdk-dev] [PATCH v3 1/3] net/hns3: report Rx drop packets enable configuration Wei Hu (Xavier)
2020-08-20  9:03   ` [dpdk-dev] [PATCH v3 2/3] net/hns3: support getting Tx and Rx queue information Wei Hu (Xavier)
2020-08-20  9:03   ` [dpdk-dev] [PATCH v3 3/3] ethdev: check if queue setupped when getting queue info Wei Hu (Xavier)
2020-08-24 11:01 ` [dpdk-dev] [PATCH v4 0/3] minor updates for " Wei Hu (Xavier)
2020-08-24 11:01   ` [dpdk-dev] [PATCH v4 1/3] net/hns3: report Rx drop packets enable configuration Wei Hu (Xavier)
2020-08-24 11:01   ` Wei Hu (Xavier) [this message]
2020-08-24 11:01   ` [dpdk-dev] [PATCH v4 3/3] ethdev: check if queue setupped when getting queue info Wei Hu (Xavier)
2020-08-25  8:43     ` Ferruh Yigit
2020-08-25  8:44   ` [dpdk-dev] [PATCH v4 0/3] minor updates for " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200824110130.16647-3-huwei013@chinasoftinc.com \
    --to=huwei013@chinasoftinc.com \
    --cc=dev@dpdk.org \
    --cc=humin29@huawei.com \
    --cc=xavier.huwei@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git