From: Chengchang Tang <tangchengchang@huawei.com>
To: <dev@dpdk.org>
Cc: <linuxarm@huawei.com>, <thomas@monjalon.net>,
<arybchenko@solarflare.com>, <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [RFC v2 2/3] net/hns3: add support for query of rx/tx queue info
Date: Wed, 22 Jul 2020 14:38:09 +0800 [thread overview]
Message-ID: <1595399890-27300-3-git-send-email-tangchengchang@huawei.com> (raw)
In-Reply-To: <1595399890-27300-1-git-send-email-tangchengchang@huawei.com>
From: Huisong Li <lihuisong@huawei.com>
This patch adds support for query of rx/tx queue info for hns3. And the
new field rx_buf_size in rte_eth_rxq_info is also filled.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Chengchang Tang <xavier.huwei@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
drivers/net/hns3/hns3_ethdev.c | 2 ++
drivers/net/hns3/hns3_ethdev_vf.c | 2 ++
drivers/net/hns3/hns3_rxtx.c | 48 +++++++++++++++++++++++++++++++++++++++
drivers/net/hns3/hns3_rxtx.h | 4 ++++
4 files changed, 56 insertions(+)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 81e7730..c6a16f3 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -5413,6 +5413,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 1d2941f..73f89e3 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2473,6 +2473,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 c0f7981..5a7fb7d 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2814,3 +2814,51 @@ 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_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct hns3_rx_queue *rxq = dev->data->rx_queues[queue_id];
+
+ if (rxq == NULL) {
+ hns3_err(hw, "queue pointer of rx queue_id (%u) is NULL.",
+ queue_id);
+ return;
+ }
+
+ qinfo->mp = rxq->mb_pool;
+ qinfo->nb_desc = rxq->nb_rx_desc;
+ qinfo->scattered_rx = dev->data->scattered_rx;
+ /*
+ * Report the hw rx buffer length which may be smaller than the mbuf
+ * date room size to user. This value affects the number of packets
+ * when receive a jumbo frame in scatter mode.
+ */
+ qinfo->rx_buf_size = rxq->rx_buf_len;
+
+ /* If no descriptors available, packets are always dropped. */
+ 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_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct hns3_tx_queue *txq = dev->data->tx_queues[queue_id];
+
+ if (txq == NULL) {
+ hns3_err(hw, "queue pointer of tx queue_id (%u) is NULL.",
+ queue_id);
+ return;
+ }
+
+ 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 0d20a27..7a97a37 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -403,4 +403,8 @@ 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.7.4
next prev parent reply other threads:[~2020-07-22 6:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 6:48 [dpdk-dev] [RFC] ethdev: add a field for rte_eth_rxq_info Chengchang Tang
2020-06-23 9:30 ` Andrew Rybchenko
2020-06-24 3:48 ` Chengchang Tang
2020-06-24 8:52 ` Ferruh Yigit
2020-06-24 18:32 ` Ferruh Yigit
2020-06-25 9:06 ` Andrew Rybchenko
2020-06-23 14:48 ` Stephen Hemminger
2020-06-23 15:22 ` Andrew Rybchenko
2020-07-22 6:38 ` [dpdk-dev] [RFC v2 0/3] add rx buffer size " Chengchang Tang
2020-07-22 6:38 ` [dpdk-dev] [RFC v2 1/3] ethdev: add a field " Chengchang Tang
2020-07-22 6:38 ` Chengchang Tang [this message]
2020-07-22 6:38 ` [dpdk-dev] [RFC v2 3/3] app/testpmd: Add RX buffer size dispaly in queue info querry Chengchang Tang
2020-07-28 6:29 ` [dpdk-dev] [RFC v2 0/3] add rx buffer size for rte_eth_rxq_info Chengchang Tang
2020-07-28 9:30 ` Ferruh Yigit
2020-07-28 11:39 ` Chengchang Tang
2020-07-28 15:27 ` Thomas Monjalon
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=1595399890-27300-3-git-send-email-tangchengchang@huawei.com \
--to=tangchengchang@huawei.com \
--cc=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=linuxarm@huawei.com \
--cc=thomas@monjalon.net \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).