summaryrefslogtreecommitdiffstatshomepage
path: root/src/compat.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-10-02 03:53:24 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2016-10-02 06:24:10 +0200
commit2f05eb3738e47aafc70fa63b4dc0ccd161f5c0b0 (patch)
treefd180890d1a3b6ed2e3567b50e7f7ccfdceb0211 /src/compat.h
parentremote-run: reflect recent makefile changes (diff)
downloadwireguard-monolithic-historical-2f05eb3738e47aafc70fa63b4dc0ccd161f5c0b0.tar.xz
wireguard-monolithic-historical-2f05eb3738e47aafc70fa63b4dc0ccd161f5c0b0.zip
send: only avoid parallel path when there aren't inflight jobs
Otherwise we get packet reordering.
Diffstat (limited to 'src/compat.h')
-rw-r--r--src/compat.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compat.h b/src/compat.h
index 29bd8c4..68c56e3 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -129,4 +129,17 @@ static inline struct net_device *netdev_pub(void *dev)
return (struct net_device *)((char *)dev - ALIGN(sizeof(struct net_device), NETDEV_ALIGN));
}
+/* https://lkml.org/lkml/2016/10/1/187 */
+#ifdef CONFIG_WIREGUARD_PARALLEL
+#include <linux/padata.h>
+static inline int padata_queue_len(struct padata_instance *pinst)
+{
+ int len;
+ rcu_read_lock_bh();
+ len = atomic_read(&rcu_dereference_bh(pinst->pd)->refcnt);
+ rcu_read_unlock_bh();
+ return len;
+}
+#endif
+
#endif