PERFORCE change 126792 for review
Kip Macy
kmacy at FreeBSD.org
Mon Sep 24 14:51:56 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=126792
Change 126792 by kmacy at kmacy_home:ethng on 2007/09/24 21:51:45
add stack utility functions for creating LIFO cache
Affected files ...
.. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_osdep.h#9 edit
.. //depot/projects/ethng/src/sys/dev/cxgb/sys/cxgb_support.c#1 add
Differences ...
==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_osdep.h#9 (text+ko) ====
@@ -100,7 +100,6 @@
return (m);
}
-
static __inline struct mbuf *
mbuf_ring_peek(struct mbuf_ring *mr)
{
@@ -118,6 +117,31 @@
return (m);
}
+struct buf_stack {
+ caddr_t *bs_stack;
+ volatile int bs_head;
+ int bs_size;
+};
+
+static __inline int
+buf_push(struct buf_stack *bs, caddr_t buf)
+{
+ if (bs->bs_head + 1 >= bs->bs_size)
+ return (1);
+
+ bs->bs_stack[++(bs->bs_head)] = buf;
+ return (0);
+}
+
+static __inline caddr_t
+buf_pop(struct buf_stack *bs)
+{
+ if (bs->bs_head < 0)
+ return (NULL);
+
+ return (bs->bs_stack[(bs->bs_head)--]);
+}
+
#define PANIC_IF(exp) do { \
if (exp) \
panic("BUG: %s", exp); \
More information about the p4-projects
mailing list