ethdev: 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_ether/rte_ethdev.c
lib/librte_ether/rte_ethdev.h

index afc9b72..2e85ab7 100644 (file)
@@ -1739,6 +1739,21 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
        FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
        return (*dev->dev_ops->rx_queue_count)(dev, queue_id);  
 }
+
+int
+rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
+{
+       struct rte_eth_dev *dev;
+
+       if (port_id >= nb_ports) {
+               PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+               return (-ENODEV);
+       }
+       dev = &rte_eth_devices[port_id];
+       FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
+       return (*dev->dev_ops->rx_descriptor_done)( \
+               dev->data->rx_queues[queue_id], offset);
+}
 #endif
 
 int
index 3509aea..253a47c 100644 (file)
@@ -782,6 +782,9 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
                                         uint16_t rx_queue_id);
 /**< @Get number of available descriptors on a receive queue of an Ethernet device. */
 
+typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
+/**< @Check DD bit of specific RX descriptor */
+
 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
                                  uint16_t vlan_id,
                                  int on);
@@ -904,6 +907,7 @@ struct eth_dev_ops {
        eth_rx_queue_setup_t       rx_queue_setup;/**< Set up device RX queue.*/
        eth_queue_release_t        rx_queue_release;/**< Release RX queue.*/
        eth_rx_queue_count_t       rx_queue_count; /**< Get Rx queue count. */
+       eth_rx_descriptor_done_t   rx_descriptor_done;  /**< Check rxd DD bit */
        eth_tx_queue_setup_t       tx_queue_setup;/**< Set up device TX queue.*/
        eth_queue_release_t        tx_queue_release;/**< Release TX queue.*/
        eth_dev_led_on_t           dev_led_on;    /**< Turn on LED. */
@@ -1734,6 +1738,36 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
 }
 #endif
 
+/**
+ * Check if the DD bit of the specific RX descriptor in the queue has been set
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The queue id on the specific port.
+ * @offset
+ *  The offset of the descriptor ID from tail.
+ * @return
+ *  - (1) if the specific DD bit is set.
+ *  - (0) if the specific DD bit is not set.
+ *  - (-ENODEV) if *port_id* invalid.
+ */
+#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+extern int rte_eth_rx_descriptor_done(uint8_t port_id,
+                                     uint16_t queue_id,
+                                     uint16_t offset);
+#else
+static inline int
+rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
+{
+       struct rte_eth_dev *dev;
+
+       dev = &rte_eth_devices[port_id];
+       return (*dev->dev_ops->rx_descriptor_done)( \
+               dev->data->rx_queues[queue_id], offset);
+}
+#endif
+
 /**
  * Send a burst of output packets on a transmit queue of an Ethernet device.
  *