aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorThomas Gschwantner <tharre3@gmail.com>2018-06-01 01:53:34 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-04 20:30:02 +0200
commit044ddc520cf1f009f4a78cc6392aaac507fa4612 (patch)
tree9c662f9a6c31c0c2d92765e31a3d12d423f75cac
parentWIP6 (diff)
downloadwireguard-monolithic-historical-044ddc520cf1f009f4a78cc6392aaac507fa4612.tar.xz
wireguard-monolithic-historical-044ddc520cf1f009f4a78cc6392aaac507fa4612.zip
WIP7
-rw-r--r--src/mpmc_ring.h20
-rw-r--r--src/queueing.h4
2 files changed, 12 insertions, 12 deletions
diff --git a/src/mpmc_ring.h b/src/mpmc_ring.h
index e3e993b..6af5939 100644
--- a/src/mpmc_ring.h
+++ b/src/mpmc_ring.h
@@ -69,14 +69,14 @@ static inline int ck_ring_init(struct ck_ring *ring, uint size, gfp_t gfp)
return 0;
}
-__always_inline static bool
+__always_inline static int
_ck_ring_enqueue_mp(struct ck_ring *ring, const void *entry, unsigned int ts,
unsigned int *size)
{
const unsigned int mask = ring->mask;
unsigned int producer, consumer, delta;
void *buffer;
- bool r = true;
+ int ret = 0;
producer = atomic_read(&ring->p_head);
@@ -118,7 +118,7 @@ _ck_ring_enqueue_mp(struct ck_ring *ring, const void *entry, unsigned int ts,
* during this iteration).
*/
if (producer == new_producer) {
- r = false;
+ ret = -ENOSPC;
goto leave;
}
@@ -150,19 +150,19 @@ leave:
if (size != NULL)
*size = (producer - consumer) & mask;
- return r;
+ return ret;
}
-__always_inline static bool
+__always_inline static int
_ck_ring_enqueue_mp_size(struct ck_ring *ring, const void *entry,
unsigned int ts, unsigned int *size)
{
unsigned int sz;
- bool r;
+ int ret;
- r = _ck_ring_enqueue_mp(ring, entry, ts, &sz);
+ ret = _ck_ring_enqueue_mp(ring, entry, ts, &sz);
*size = sz;
- return r;
+ return ret;
}
__always_inline static bool
@@ -360,13 +360,13 @@ static __always_inline void mpmc_ptr_ring_discard(struct ck_ring *ring)
* ring buffer containing pointers. Correctness is provided for any number of
* producers and consumers.
*/
-inline static bool
+inline static int
ck_ring_enqueue_mpmc(struct ck_ring *ring, const void *entry)
{
return _ck_ring_enqueue_mp(ring, &entry, sizeof(entry), NULL);
}
-inline static bool
+inline static int
ck_ring_enqueue_mpmc_size(struct ck_ring *ring, const void *entry,
unsigned int *size)
{
diff --git a/src/queueing.h b/src/queueing.h
index 51d0b8e..0280a35 100644
--- a/src/queueing.h
+++ b/src/queueing.h
@@ -120,10 +120,10 @@ static inline int queue_enqueue_per_device_and_peer(struct crypt_queue *device_q
int cpu;
atomic_set(&PACKET_CB(skb)->state, PACKET_STATE_UNCRYPTED);
- if (unlikely(!ck_ring_enqueue_mpmc(&peer_queue->ring, skb)))
+ if (unlikely(ck_ring_enqueue_mpmc(&peer_queue->ring, skb)))
return -ENOSPC;
cpu = cpumask_next_online(next_cpu);
- if (unlikely(!ck_ring_enqueue_mpmc(&device_queue->ring, skb)))
+ if (unlikely(ck_ring_enqueue_mpmc(&device_queue->ring, skb)))
return -EPIPE;
queue_work_on(cpu, wq, &per_cpu_ptr(device_queue->worker, cpu)->work);
return 0;