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

Add support for getting Rx 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   | 18 ++++++++++++++++++
 drivers/net/nfp/nfp_rxtx.h   |  3 +++
 3 files changed, 22 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 53afdc8b18..8baf459e18 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -863,6 +863,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = {
        .rss_hash_conf_get      = nfp_net_rss_hash_conf_get,
        .rx_queue_setup         = nfp_net_rx_queue_setup,
        .rx_queue_release       = nfp_net_rx_queue_release,
+       .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,
        .rx_queue_intr_enable   = nfp_rx_queue_intr_enable,
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 8697c5d711..3e7829ed0c 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -828,3 +828,21 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev,
                return nfp_net_nfdk_tx_queue_setup(dev, queue_idx,
                                nb_desc, socket_id, tx_conf);
 }
+
+void
+nfp_net_rx_queue_info_get(struct rte_eth_dev *dev,
+               uint16_t queue_id,
+               struct rte_eth_rxq_info *info)
+{
+       struct rte_eth_dev_info dev_info;
+       struct nfp_net_rxq *rxq = dev->data->rx_queues[queue_id];
+
+       info->mp = rxq->mem_pool;
+       info->nb_desc = rxq->rx_count;
+
+       info->conf.rx_free_thresh = rxq->rx_free_thresh;
+
+       nfp_net_infos_get(dev, &dev_info);
+       info->conf.offloads = dev_info.rx_offload_capa &
+                       dev->data->dev_conf.rxmode.offloads;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 7a89ca1d9e..62b6dab8bc 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -235,5 +235,8 @@ int nfp_net_tx_queue_setup(struct rte_eth_dev *dev,
                unsigned int socket_id,
                const struct rte_eth_txconf *tx_conf);
 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);
 
 #endif /* __NFP_RXTX_H__ */
-- 
2.39.1

Reply via email to