Module Name:    src
Committed By:   riastradh
Date:           Fri Aug 21 07:05:25 UTC 2020

Modified Files:
        src/sys/net: if_wg.c

Log Message:
Ifdef out fast path that relies on atomic 64-bit load/store.

(Really this sliding window business could probably be done with
32-bit sequence numbers and careful detection of wraparound, but
that's a little more effort to work out -- let's just unbreak the
builds for now.)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/net/if_wg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.19 src/sys/net/if_wg.c:1.20
--- src/sys/net/if_wg.c:1.19	Thu Aug 20 21:36:21 2020
+++ src/sys/net/if_wg.c	Fri Aug 21 07:05:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.19 2020/08/20 21:36:21 riastradh Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.20 2020/08/21 07:05:25 riastradh Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki <ozaki.ry...@gmail.com>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.19 2020/08/20 21:36:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.20 2020/08/21 07:05:25 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -372,8 +372,10 @@ sliwin_check_fast(const volatile struct 
 	 * If it's more than one window older than the highest sequence
 	 * number we've seen, reject.
 	 */
+#ifdef __HAVE_ATOMIC64_LOADSTORE
 	if (S + SLIWIN_NPKT < atomic_load_relaxed(&W->T))
 		return EAUTH;
+#endif
 
 	/*
 	 * Otherwise, we need to take the lock to decide, so don't
@@ -406,7 +408,11 @@ sliwin_update(struct sliwin *W, uint64_t
 
 		for (k = 0; k < MIN(j - i, SLIWIN_WORDS); k++)
 			W->B[(i + k + 1) % SLIWIN_WORDS] = 0;
+#ifdef __HAVE_ATOMIC64_LOADSTORE
 		atomic_store_relaxed(&W->T, S);
+#else
+		W->T = S;
+#endif
 	}
 
 	/* Test and set the bit -- if already set, reject.  */

Reply via email to