fm10k: support Rx descriptor check
authorShaopeng He <shaopeng.he@intel.com>
Fri, 5 Feb 2016 04:57:45 +0000 (12:57 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 16 Mar 2016 16:49:58 +0000 (17:49 +0100)
rx_descriptor_done is used by interrupt mode example application
(l3fwd-power) to check rxd DD bit to decide the RX trend,
then l3fwd-power will adjust the cpu frequency according to
the result.

Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
drivers/net/fm10k/fm10k.h
drivers/net/fm10k/fm10k_ethdev.c
drivers/net/fm10k/fm10k_rxtx.c

index cd38af2..e2f677a 100644 (file)
@@ -345,6 +345,9 @@ uint16_t fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
                struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
 
+int
+fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        uint16_t nb_pkts);
 
index aa75627..a28879a 100644 (file)
@@ -2434,6 +2434,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
        .rx_queue_release       = fm10k_rx_queue_release,
        .tx_queue_setup         = fm10k_tx_queue_setup,
        .tx_queue_release       = fm10k_tx_queue_release,
+       .rx_descriptor_done     = fm10k_dev_rx_descriptor_done,
        .reta_update            = fm10k_reta_update,
        .reta_query             = fm10k_reta_query,
        .rss_hash_update        = fm10k_rss_hash_update,
index de31cad..4eca3d6 100644 (file)
@@ -369,6 +369,31 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
        return nb_rcv;
 }
 
+int
+fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
+{
+       volatile union fm10k_rx_desc *rxdp;
+       struct fm10k_rx_queue *rxq = rx_queue;
+       uint16_t desc;
+       int ret;
+
+       if (unlikely(offset >= rxq->nb_desc)) {
+               PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+               return 0;
+       }
+
+       desc = rxq->next_dd + offset;
+       if (desc >= rxq->nb_desc)
+               desc -= rxq->nb_desc;
+
+       rxdp = &rxq->hw_ring[desc];
+
+       ret = !!(rxdp->w.status &
+                       rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+       return ret;
+}
+
 static inline void tx_free_descriptors(struct fm10k_tx_queue *q)
 {
        uint16_t next_rs, count = 0;