From: Long Wu <long...@corigine.com>

Add support for getting Tx queue information on NFP CoreNIC firmware.

Signed-off-by: Long Wu <long...@corigine.com>
Reviewed-by: Chaoyong He <chaoyong...@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c |  1 +
 drivers/net/nfp/nfp_rxtx.c   | 21 +++++++++++++++++++++
 drivers/net/nfp/nfp_rxtx.h   |  3 +++
 3 files changed, 25 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 8baf459e18..004c725ef8 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -866,6 +866,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = {
        .rxq_info_get           = nfp_net_rx_queue_info_get,
        .tx_queue_setup         = nfp_net_tx_queue_setup,
        .tx_queue_release       = nfp_net_tx_queue_release,
+       .txq_info_get           = nfp_net_tx_queue_info_get,
        .rx_queue_intr_enable   = nfp_rx_queue_intr_enable,
        .rx_queue_intr_disable  = nfp_rx_queue_intr_disable,
        .udp_tunnel_port_add    = nfp_udp_tunnel_port_add,
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 3e7829ed0c..1db79ad1cd 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -846,3 +846,24 @@ nfp_net_rx_queue_info_get(struct rte_eth_dev *dev,
        info->conf.offloads = dev_info.rx_offload_capa &
                        dev->data->dev_conf.rxmode.offloads;
 }
+
+void
+nfp_net_tx_queue_info_get(struct rte_eth_dev *dev,
+               uint16_t queue_id,
+               struct rte_eth_txq_info *info)
+{
+       struct rte_eth_dev_info dev_info;
+       struct nfp_net_hw *hw = nfp_net_get_hw(dev);
+       struct nfp_net_txq *txq = dev->data->tx_queues[queue_id];
+
+       if (hw->ver.extend == NFP_NET_CFG_VERSION_DP_NFD3)
+               info->nb_desc = txq->tx_count / NFD3_TX_DESC_PER_PKT;
+       else
+               info->nb_desc = txq->tx_count / NFDK_TX_DESC_PER_SIMPLE_PKT;
+
+       info->conf.tx_free_thresh = txq->tx_free_thresh;
+
+       nfp_net_infos_get(dev, &dev_info);
+       info->conf.offloads = dev_info.tx_offload_capa &
+                       dev->data->dev_conf.txmode.offloads;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 62b6dab8bc..9806384a63 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -238,5 +238,8 @@ uint32_t nfp_net_tx_free_bufs(struct nfp_net_txq *txq);
 void nfp_net_rx_queue_info_get(struct rte_eth_dev *dev,
                uint16_t queue_id,
                struct rte_eth_rxq_info *qinfo);
+void nfp_net_tx_queue_info_get(struct rte_eth_dev *dev,
+               uint16_t queue_id,
+               struct rte_eth_txq_info *qinfo);
 
 #endif /* __NFP_RXTX_H__ */
-- 
2.39.1

Reply via email to