]> git.droids-corp.org - dpdk.git/commitdiff
net/igb: implement descriptor status API
authorOlivier Matz <olivier.matz@6wind.com>
Wed, 29 Mar 2017 08:36:30 +0000 (10:36 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 30 Mar 2017 13:27:42 +0000 (15:27 +0200)
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
doc/guides/nics/features/igb.ini
doc/guides/nics/features/igb_vf.ini
drivers/net/e1000/e1000_ethdev.h
drivers/net/e1000/igb_ethdev.c
drivers/net/e1000/igb_rxtx.c

index 26ae008b3340199ffcfc128e5b0d2da3ae457ac5..11450270db588e73affa2cb2edafd720735624ce 100644 (file)
@@ -33,6 +33,8 @@ L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
 Timesync             = Y
+Rx descriptor status = Y
+Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 FW version           = Y
index b61782028eb203308d7f96e7bbc4f807c9776cf0..e641a2c975a248d3cae6e4ccc8ab0fc8dbddb14b 100644 (file)
@@ -17,6 +17,8 @@ QinQ offload         = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
+Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Registers dump       = Y
index f8dc72f7ce566c8d7993f5db5cc0a47caeb1f554..8352d0a7936bcd9b74b3e8f2f207e632703b5f2b 100644 (file)
@@ -311,6 +311,9 @@ uint32_t eth_igb_rx_queue_count(struct rte_eth_dev *dev,
 
 int eth_igb_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int eth_igb_rx_descriptor_status(void *rx_queue, uint16_t offset);
+int eth_igb_tx_descriptor_status(void *tx_queue, uint16_t offset);
+
 int eth_igb_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
                uint16_t nb_tx_desc, unsigned int socket_id,
                const struct rte_eth_txconf *tx_conf);
index 71d05a9381c701ef30e9cca58b498b976d4fa9c3..a73cd7a0228382c2c779162b8d1c552271a22413 100644 (file)
@@ -406,6 +406,8 @@ static const struct eth_dev_ops eth_igb_ops = {
        .rx_queue_release     = eth_igb_rx_queue_release,
        .rx_queue_count       = eth_igb_rx_queue_count,
        .rx_descriptor_done   = eth_igb_rx_descriptor_done,
+       .rx_descriptor_status = eth_igb_rx_descriptor_status,
+       .tx_descriptor_status = eth_igb_tx_descriptor_status,
        .tx_queue_setup       = eth_igb_tx_queue_setup,
        .tx_queue_release     = eth_igb_tx_queue_release,
        .tx_done_cleanup      = eth_igb_tx_done_cleanup,
index cba3704bae546420ce70243498b7f4b968a404e2..b3b601b79a27d2dc8539f9a2f7b2c9ad93e884e4 100644 (file)
@@ -1727,6 +1727,51 @@ eth_igb_rx_descriptor_done(void *rx_queue, uint16_t offset)
        return !!(rxdp->wb.upper.status_error & E1000_RXD_STAT_DD);
 }
 
+int
+eth_igb_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+       struct igb_rx_queue *rxq = rx_queue;
+       volatile uint32_t *status;
+       uint32_t desc;
+
+       if (unlikely(offset >= rxq->nb_rx_desc))
+               return -EINVAL;
+
+       if (offset >= rxq->nb_rx_desc - rxq->nb_rx_hold)
+               return RTE_ETH_RX_DESC_UNAVAIL;
+
+       desc = rxq->rx_tail + offset;
+       if (desc >= rxq->nb_rx_desc)
+               desc -= rxq->nb_rx_desc;
+
+       status = &rxq->rx_ring[desc].wb.upper.status_error;
+       if (*status & rte_cpu_to_le_32(E1000_RXD_STAT_DD))
+               return RTE_ETH_RX_DESC_DONE;
+
+       return RTE_ETH_RX_DESC_AVAIL;
+}
+
+int
+eth_igb_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+       struct igb_tx_queue *txq = tx_queue;
+       volatile uint32_t *status;
+       uint32_t desc;
+
+       if (unlikely(offset >= txq->nb_tx_desc))
+               return -EINVAL;
+
+       desc = txq->tx_tail + offset;
+       if (desc >= txq->nb_tx_desc)
+               desc -= txq->nb_tx_desc;
+
+       status = &txq->tx_ring[desc].wb.status;
+       if (*status & rte_cpu_to_le_32(E1000_TXD_STAT_DD))
+               return RTE_ETH_TX_DESC_DONE;
+
+       return RTE_ETH_TX_DESC_FULL;
+}
+
 void
 igb_dev_clear_queues(struct rte_eth_dev *dev)
 {