summaryrefslogtreecommitdiffstats
path: root/sys/dev/cxgb
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/cxgb')
-rw-r--r--sys/dev/cxgb/cxgb_osdep.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/cxgb/cxgb_osdep.h b/sys/dev/cxgb/cxgb_osdep.h
index 7f75779..3a0b774 100644
--- a/sys/dev/cxgb/cxgb_osdep.h
+++ b/sys/dev/cxgb/cxgb_osdep.h
@@ -203,6 +203,12 @@ buf_ring_empty(struct buf_ring *mr)
return (mr->br_cons == mr->br_prod);
}
+static __inline int
+buf_ring_full(struct buf_ring *mr)
+{
+ return (mr->br_cons == (mr->br_prod + 1));
+}
+
/*
* The producer and consumer are independently locked
* this relies on the consumer providing his own serialization
@@ -217,6 +223,7 @@ buf_ring_dequeue(struct buf_ring *mr)
ring = (caddr_t *)mr->br_ring;
mask = mr->br_size - 1;
cons = mr->br_cons;
+ mb();
prod = mr->br_prod;
m = NULL;
if (cons != prod) {
@@ -234,9 +241,10 @@ __buf_ring_enqueue(struct buf_ring *mr, void *m)
int prod, cons, mask, err;
- cons = mr->br_cons;
- prod = mr->br_prod;
mask = mr->br_size - 1;
+ prod = mr->br_prod;
+ mb();
+ cons = mr->br_cons;
if (((prod + 1) & mask) != cons) {
mr->br_ring[prod] = m;
mb();
OpenPOWER on IntegriCloud