net/hns3: support getting queue information
authorHuisong Li <lihuisong@huawei.com>
Mon, 24 Aug 2020 11:01:29 +0000 (19:01 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:06 +0000 (18:55 +0200)
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>
drivers/net/hns3/hns3_ethdev.c
drivers/net/hns3/hns3_ethdev_vf.c
drivers/net/hns3/hns3_rxtx.c
drivers/net/hns3/hns3_rxtx.h

index bcbbd7e..fab1914 100644 (file)
@@ -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,
index e6c69ce..6551940 100644 (file)
@@ -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,
index 3e5e32e..fc1a256 100644 (file)
@@ -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;
+}
index 0d20a27..f1fb3b5 100644 (file)
@@ -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_ */