- remove an extra parenthesis in a closing brace;

- add the macro NETMAP_RING_FIRST_RESERVED() which returns
  the index of the first non-released buffer in the ring
  (this is useful for code that retains buffers for some time
  instead of processing them immediately)
This commit is contained in:
Luigi Rizzo 2012-03-11 17:35:12 +00:00
parent 0e738b4c0f
commit a72505824c

View File

@ -77,11 +77,16 @@
#define NETMAP_BUF_IDX(ring, buf) \
( ((char *)(buf) - ((char *)(ring) + (ring)->buf_ofs) ) / \
(ring)->nr_buf_size) )
(ring)->nr_buf_size )
#define NETMAP_RING_NEXT(r, i) \
((i)+1 == (r)->num_slots ? 0 : (i) + 1 )
#define NETMAP_RING_FIRST_RESERVED(r) \
( (r)->cur < (r)->reserved ? \
(r)->cur + (r)->num_slots - (r)->reserved : \
(r)->cur - (r)->reserved )
/*
* Return 1 if the given tx ring is empty.
*/