igb: check DD bit of specific RX descriptor
authorIntel <intel.com>
Mon, 22 Jul 2013 22:00:00 +0000 (00:00 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 17 Sep 2013 12:16:10 +0000 (14:16 +0200)
Signed-off-by: Intel
lib/librte_pmd_e1000/e1000_ethdev.h
lib/librte_pmd_e1000/em_ethdev.c
lib/librte_pmd_e1000/em_rxtx.c
lib/librte_pmd_e1000/igb_ethdev.c
lib/librte_pmd_e1000/igb_rxtx.c

index 9ebb5ba..999420a 100644 (file)
@@ -120,6 +120,8 @@ int eth_igb_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 uint32_t eth_igb_rx_queue_count(struct rte_eth_dev *dev, 
                uint16_t rx_queue_id);
 
+int eth_igb_rx_descriptor_done(void *rx_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);
@@ -166,6 +168,8 @@ int eth_em_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 uint32_t eth_em_rx_queue_count(struct rte_eth_dev *dev, 
                uint16_t rx_queue_id);
 
+int eth_em_rx_descriptor_done(void *rx_queue, uint16_t offset);
+
 int eth_em_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 dd73e22..9c6ff20 100644 (file)
@@ -148,6 +148,7 @@ static struct eth_dev_ops eth_em_ops = {
        .rx_queue_setup       = eth_em_rx_queue_setup,
        .rx_queue_release     = eth_em_rx_queue_release,
        .rx_queue_count       = eth_em_rx_queue_count,
+       .rx_descriptor_done   = eth_em_rx_descriptor_done,
        .tx_queue_setup       = eth_em_tx_queue_setup,
        .tx_queue_release     = eth_em_tx_queue_release,
        .dev_led_on           = eth_em_led_on,
index a6b2acd..eb00b0c 100644 (file)
@@ -1445,6 +1445,23 @@ eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
        return desc;
 }
 
+int
+eth_em_rx_descriptor_done(void *rx_queue, uint16_t offset)
+{
+       volatile struct e1000_rx_desc *rxdp;
+       struct em_rx_queue *rxq = rx_queue;
+       uint16_t desc;
+
+       if (unlikely(offset >= rxq->nb_rx_desc))
+               return 0;
+       desc = rxq->rx_tail + offset;
+       if (desc >= rxq->nb_rx_desc)
+               desc -= rxq->nb_rx_desc;
+
+       rxdp = &rxq->rx_ring[desc];
+       return !!(rxdp->status & E1000_RXD_STAT_DD);
+}
+
 void
 em_dev_clear_queues(struct rte_eth_dev *dev)
 {
index b8be40e..14bdc2b 100644 (file)
@@ -184,6 +184,7 @@ static struct eth_dev_ops eth_igb_ops = {
        .rx_queue_setup       = eth_igb_rx_queue_setup,
        .rx_queue_release     = eth_igb_rx_queue_release,
        .rx_queue_count       = eth_igb_rx_queue_count,
+       .rx_descriptor_done   = eth_igb_rx_descriptor_done,
        .tx_queue_setup       = eth_igb_tx_queue_setup,
        .tx_queue_release     = eth_igb_tx_queue_release,
        .dev_led_on           = eth_igb_led_on,
index b816fb5..71f2ef4 100644 (file)
@@ -1416,6 +1416,23 @@ eth_igb_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
        return 0;
 }
 
+int
+eth_igb_rx_descriptor_done(void *rx_queue, uint16_t offset)
+{
+       volatile union e1000_adv_rx_desc *rxdp;
+       struct igb_rx_queue *rxq = rx_queue;
+       uint32_t desc;
+
+       if (unlikely(offset >= rxq->nb_rx_desc))
+               return 0;
+       desc = rxq->rx_tail + offset;
+       if (desc >= rxq->nb_rx_desc)
+               desc -= rxq->nb_rx_desc;
+
+       rxdp = &rxq->rx_ring[desc];
+       return !!(rxdp->wb.upper.status_error & E1000_RXD_STAT_DD);
+}
+
 void
 igb_dev_clear_queues(struct rte_eth_dev *dev)
 {