Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Ifdef out fast path that relies on atomic 64-bit loa...



details:   https://anonhg.NetBSD.org/src/rev/b05ee743f846
branches:  trunk
changeset: 975091:b05ee743f846
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Aug 21 07:05:25 2020 +0000

description:
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.)

diffstat:

 sys/net/if_wg.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r 4d41f456a7ef -r b05ee743f846 sys/net/if_wg.c
--- a/sys/net/if_wg.c   Fri Aug 21 07:04:31 2020 +0000
+++ b/sys/net/if_wg.c   Fri Aug 21 07:05:25 2020 +0000
@@ -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.ryota%gmail.com@localhost>
@@ -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 @@
         * 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 @@
 
                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.  */



Home | Main Index | Thread Index | Old Index