diff options
author | luigi <luigi@FreeBSD.org> | 2012-03-11 17:35:12 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2012-03-11 17:35:12 +0000 |
commit | 29d8b56ae7b6eaa508be51997f4be28a1b338d99 (patch) | |
tree | 4eb8cd6d9d3c1084898ef820508213afbca9091f | |
parent | 0e86a223a9a4dc551a3a102c400f5f81d1b411a3 (diff) | |
download | FreeBSD-src-29d8b56ae7b6eaa508be51997f4be28a1b338d99.zip FreeBSD-src-29d8b56ae7b6eaa508be51997f4be28a1b338d99.tar.gz |
- 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)
-rw-r--r-- | sys/net/netmap_user.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h index be66e7a..4efdec3 100644 --- a/sys/net/netmap_user.h +++ b/sys/net/netmap_user.h @@ -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. */ |