]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_kni/rte_kni_fifo.h
ethdev: fix missing imissed counter in xstats
[dpdk.git] / lib / librte_kni / rte_kni_fifo.h
index 8cb858739d22c8e9b706a805c1c5be779c35ae5d..6f2c3cb3bcffb9f99f83677ed546ba565e7b800b 100644 (file)
@@ -73,7 +73,7 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned num)
 }
 
 /**
- * Get up to num elements from the fifo. Return the number actully read
+ * Get up to num elements from the fifo. Return the number actually read
  */
 static inline unsigned
 kni_fifo_get(struct rte_kni_fifo *fifo, void **data, unsigned num)
@@ -91,3 +91,12 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, unsigned num)
        fifo->read = new_read;
        return i;
 }
+
+/**
+ * Get the num of elements in the fifo
+ */
+static inline uint32_t
+kni_fifo_count(struct rte_kni_fifo *fifo)
+{
+       return (fifo->len + fifo->write - fifo->read) & (fifo->len - 1);
+}