* Return the number of entries in a ring. * * @param r * A pointer to the ring structure. * @return * The number of entries in the ring. */
| 499 | * The number of entries in the ring. |
| 500 | */ |
| 501 | static inline unsigned int |
| 502 | rte_ring_count(const struct rte_ring *r) |
| 503 | { |
| 504 | uint32_t prod_tail = r->prod.tail; |
| 505 | uint32_t cons_tail = r->cons.tail; |
| 506 | uint32_t count = (prod_tail - cons_tail) & r->mask; |
| 507 | return (count > r->capacity) ? r->capacity : count; |
| 508 | } |
| 509 | |
| 510 | /** |
| 511 | * Return the number of free entries in a ring. |
no outgoing calls