Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143015301
D5416.id54425.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D5416.id54425.diff
View Options
Index: head/sys/net/ifq.h
===================================================================
--- head/sys/net/ifq.h
+++ head/sys/net/ifq.h
@@ -369,7 +369,7 @@
return (m);
}
#endif
- return(buf_ring_peek(br));
+ return(buf_ring_peek_clear_sc(br));
}
static __inline void
Index: head/sys/sys/buf_ring.h
===================================================================
--- head/sys/sys/buf_ring.h
+++ head/sys/sys/buf_ring.h
@@ -268,6 +268,37 @@
return (br->br_ring[br->br_cons_head]);
}
+static __inline void *
+buf_ring_peek_clear_sc(struct buf_ring *br)
+{
+#ifdef DEBUG_BUFRING
+ void *ret;
+
+ if (!mtx_owned(br->br_lock))
+ panic("lock not held on single consumer dequeue");
+#endif
+ /*
+ * I believe it is safe to not have a memory barrier
+ * here because we control cons and tail is worst case
+ * a lagging indicator so we worst case we might
+ * return NULL immediately after a buffer has been enqueued
+ */
+ if (br->br_cons_head == br->br_prod_tail)
+ return (NULL);
+
+#ifdef DEBUG_BUFRING
+ /*
+ * Single consumer, i.e. cons_head will not move while we are
+ * running, so atomic_swap_ptr() is not necessary here.
+ */
+ ret = br->br_ring[br->br_cons_head];
+ br->br_ring[br->br_cons_head] = NULL;
+ return (ret);
+#else
+ return (br->br_ring[br->br_cons_head]);
+#endif
+}
+
static __inline int
buf_ring_full(struct buf_ring *br)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 26, 7:05 AM (6 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28009750
Default Alt Text
D5416.id54425.diff (1 KB)
Attached To
Mode
D5416: buf_ring/drbr: Add buf_ring_peek_clear_sc and use it in drbr_peek
Attached
Detach File
Event Timeline
Log In to Comment