Author: luigi
Date: Sun Mar 11 17:35:12 2012
New Revision: 232824
URL: http://svn.freebsd.org/changeset/base/232824

Log:
  - 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)

Modified:
  head/sys/net/netmap_user.h

Modified: head/sys/net/netmap_user.h
==============================================================================
--- head/sys/net/netmap_user.h  Sun Mar 11 15:58:27 2012        (r232823)
+++ head/sys/net/netmap_user.h  Sun Mar 11 17:35:12 2012        (r232824)
@@ -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.
  */
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to