svn commit: r185649 - in user/kmacy/HEAD_fast_multi_xmit/sys: net
sys
Kip Macy
kmacy at FreeBSD.org
Fri Dec 5 13:16:13 PST 2008
Author: kmacy
Date: Fri Dec 5 21:16:13 2008
New Revision: 185649
URL: http://svn.freebsd.org/changeset/base/185649
Log:
add inline helper functions for buf_ring enqueue and free
Modified:
user/kmacy/HEAD_fast_multi_xmit/sys/net/if_var.h
user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h
Modified: user/kmacy/HEAD_fast_multi_xmit/sys/net/if_var.h
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/net/if_var.h Fri Dec 5 21:14:30 2008 (r185648)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/net/if_var.h Fri Dec 5 21:16:13 2008 (r185649)
@@ -82,6 +82,7 @@ struct ifvlantrunk;
#include <sys/mutex.h> /* XXX */
#include <sys/event.h> /* XXX */
#include <sys/_task.h>
+#include <sys/buf_ring.h>
#define IF_DUNIT_NONE -1
@@ -540,6 +541,34 @@ do { \
IFQ_PURGE(ifq); \
} while (0)
+
+static __inline int
+drbr_enqueue(struct buf_ring *br, struct mbuf *m)
+{
+ int error = 0;
+
+ if ((error = buf_ring_enqueue(br, m)) == ENOBUFS) {
+ br->br_drops++;
+ m_freem(m);
+ }
+
+ return (error);
+}
+
+static __inline void
+drbr_free(struct buf_ring *br, struct malloc_type *type)
+{
+ struct mbuf *m;
+
+ while ((m = buf_ring_dequeue_sc(br)) != NULL)
+ m_freem(m);
+
+ buf_ring_free(br, type);
+}
+
+
+
+
/*
* 72 was chosen below because it is the size of a TCP/IP
* header (40) + the minimum mss (32).
Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h Fri Dec 5 21:14:30 2008 (r185648)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h Fri Dec 5 21:16:13 2008 (r185649)
@@ -48,10 +48,11 @@ struct buf_ring {
volatile uint32_t br_prod_tail;
int br_prod_size;
int br_prod_mask;
+ uint64_t br_drops;
/*
* Pad out to next L2 cache line
*/
- uint64_t _pad0[14];
+ uint64_t _pad0[13];
volatile uint32_t br_cons_head;
volatile uint32_t br_cons_tail;
More information about the svn-src-user
mailing list