Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Mar 2012 17:35:12 +0000 (UTC)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232824 - head/sys/net
Message-ID:  <201203111735.q2BHZCww019970@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.
  */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203111735.q2BHZCww019970>