Enhance both functions of e1000 and igb to retrieve more informations
about queue descriptors according to new adds on rte_eth_(tx|rx)q_info
struct

Signed-off-by: Amine Kherbouche <amine.kherbouche at 6wind.com>
---
 drivers/net/e1000/em_rxtx.c  |    4 ++++
 drivers/net/e1000/igb_rxtx.c |    4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 03e1bc2..1ff750b 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1873,6 +1873,8 @@ em_rxq_info_get(struct rte_eth_dev *dev, uint16_t 
queue_id,
        qinfo->mp = rxq->mb_pool;
        qinfo->scattered_rx = dev->data->scattered_rx;
        qinfo->nb_desc = rxq->nb_rx_desc;
+       qinfo->used_desc = (uint16_t)eth_em_rx_queue_count(dev, queue_id);
+       qinfo->free_desc = qinfo->nb_desc - qinfo->used_desc;
        qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
 }

@@ -1885,6 +1887,8 @@ em_txq_info_get(struct rte_eth_dev *dev, uint16_t 
queue_id,
        txq = dev->data->tx_queues[queue_id];

        qinfo->nb_desc = txq->nb_tx_desc;
+       qinfo->free_desc = txq->nb_tx_free;
+       qinfo->used_desc = qinfo->nb_desc - qinfo->free_desc;

        qinfo->conf.tx_thresh.pthresh = txq->pthresh;
        qinfo->conf.tx_thresh.hthresh = txq->hthresh;
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index cca3300..4956075 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -2483,6 +2483,8 @@ igb_rxq_info_get(struct rte_eth_dev *dev, uint16_t 
queue_id,
        qinfo->mp = rxq->mb_pool;
        qinfo->scattered_rx = dev->data->scattered_rx;
        qinfo->nb_desc = rxq->nb_rx_desc;
+       qinfo->used_desc = eth_igb_rx_queue_count(dev, rxq->queue_id);
+       qinfo->free_desc =  qinfo->nb_desc - qinfo->used_desc;

        qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
        qinfo->conf.rx_drop_en = rxq->drop_en;
@@ -2497,6 +2499,8 @@ igb_txq_info_get(struct rte_eth_dev *dev, uint16_t 
queue_id,
        txq = dev->data->tx_queues[queue_id];

        qinfo->nb_desc = txq->nb_tx_desc;
+       qinfo->used_desc = txq->tx_tail - txq->tx_head % txq->nb_tx_desc;
+       qinfo->free_desc = qinfo->nb_desc - qinfo->used_desc;

        qinfo->conf.tx_thresh.pthresh = txq->pthresh;
        qinfo->conf.tx_thresh.hthresh = txq->hthresh;
-- 
1.7.10.4

Reply via email to