]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_kni/rte_kni_fifo.h
test mbuf attach
[dpdk.git] / lib / librte_kni / rte_kni_fifo.h
index 287d7deb292ceffffaec8dae9674e8d63a881ec0..d2ec82fe87fc1edadd31e9b8ba9718bf942bbfe8 100644 (file)
@@ -104,3 +104,14 @@ kni_fifo_count(struct rte_kni_fifo *fifo)
        unsigned fifo_read = __KNI_LOAD_ACQUIRE(&fifo->read);
        return (fifo->len + fifo_write - fifo_read) & (fifo->len - 1);
 }
+
+/**
+ * Get the num of available elements in the fifo
+ */
+static inline uint32_t
+kni_fifo_free_count(struct rte_kni_fifo *fifo)
+{
+       uint32_t fifo_write = __KNI_LOAD_ACQUIRE(&fifo->write);
+       uint32_t fifo_read = __KNI_LOAD_ACQUIRE(&fifo->read);
+       return (fifo_read - fifo_write - 1) & (fifo->len - 1);
+}