net/axgbe: support descriptor status
authorAmaranath Somalapuram <asomalap@amd.com>
Mon, 2 Mar 2020 08:16:55 +0000 (13:46 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 18 Mar 2020 14:29:39 +0000 (15:29 +0100)
Adding API axgbe_dev_rx_descriptor_status, axgbe_dev_tx_descriptor_status

Signed-off-by: Amaranath Somalapuram <asomalap@amd.com>
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
drivers/net/axgbe/axgbe_ethdev.c
drivers/net/axgbe/axgbe_rxtx.c
drivers/net/axgbe/axgbe_rxtx.h

index b0cdcff..8670588 100644 (file)
@@ -212,6 +212,8 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
        .rxq_info_get                 = axgbe_rxq_info_get,
        .txq_info_get                 = axgbe_txq_info_get,
        .dev_supported_ptypes_get     = axgbe_dev_supported_ptypes_get,
+       .rx_descriptor_status         = axgbe_dev_rx_descriptor_status,
+       .tx_descriptor_status         = axgbe_dev_tx_descriptor_status,
 };
 
 static int axgbe_phy_reset(struct axgbe_port *pdata)
index 57e2bbb..30c467d 100644 (file)
@@ -819,3 +819,49 @@ void axgbe_dev_clear_queues(struct rte_eth_dev *dev)
                }
        }
 }
+
+int
+axgbe_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+       struct axgbe_rx_queue *rxq = rx_queue;
+       volatile union axgbe_rx_desc *desc;
+       uint16_t idx;
+
+
+       if (unlikely(offset >= rxq->nb_desc))
+               return -EINVAL;
+
+       if (offset >= rxq->nb_desc - rxq->dirty)
+               return RTE_ETH_RX_DESC_UNAVAIL;
+
+       idx = AXGBE_GET_DESC_IDX(rxq, rxq->cur);
+       desc = &rxq->desc[idx + offset];
+
+       if (!AXGMAC_GET_BITS_LE(desc->write.desc3, RX_NORMAL_DESC3, OWN))
+               return RTE_ETH_RX_DESC_DONE;
+
+       return RTE_ETH_RX_DESC_AVAIL;
+}
+
+int
+axgbe_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+       struct axgbe_tx_queue *txq = tx_queue;
+       volatile struct axgbe_tx_desc *desc;
+       uint16_t idx;
+
+
+       if (unlikely(offset >= txq->nb_desc))
+               return -EINVAL;
+
+       if (offset >= txq->nb_desc - txq->dirty)
+               return RTE_ETH_TX_DESC_UNAVAIL;
+
+       idx = AXGBE_GET_DESC_IDX(txq, txq->dirty + txq->free_batch_cnt - 1);
+       desc = &txq->desc[idx + offset];
+
+       if (!AXGMAC_GET_BITS_LE(desc->desc3, TX_NORMAL_DESC3, OWN))
+               return RTE_ETH_TX_DESC_DONE;
+
+       return RTE_ETH_TX_DESC_FULL;
+}
index f6796b0..f2fbe92 100644 (file)
@@ -185,5 +185,7 @@ uint16_t axgbe_recv_pkts_threshold_refresh(void *rx_queue,
                                           struct rte_mbuf **rx_pkts,
                                           uint16_t nb_pkts);
 void axgbe_dev_clear_queues(struct rte_eth_dev *dev);
+int axgbe_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+int axgbe_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
 
 #endif /* _AXGBE_RXTX_H_ */