Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net wg: Add missing kpreempt_disable/enable around pktq_...
details: https://anonhg.NetBSD.org/src/rev/22d59989d2da
branches: trunk
changeset: 943941:22d59989d2da
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Sep 13 17:17:31 2020 +0000
description:
wg: Add missing kpreempt_disable/enable around pktq_enqueue.
diffstat:
sys/net/if_wg.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (66 lines):
diff -r e5b48d4366db -r 22d59989d2da sys/net/if_wg.c
--- a/sys/net/if_wg.c Sun Sep 13 16:53:19 2020 +0000
+++ b/sys/net/if_wg.c Sun Sep 13 17:17:31 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wg.c,v 1.56 2020/09/08 16:39:57 riastradh Exp $ */
+/* $NetBSD: if_wg.c,v 1.57 2020/09/13 17:17:31 riastradh Exp $ */
/*
* Copyright (C) Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.56 2020/09/08 16:39:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.57 2020/09/13 17:17:31 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1954,13 +1954,14 @@
* immediately or else the responder will never answer.
*/
if ((m = atomic_swap_ptr(&wgp->wgp_pending, NULL)) != NULL) {
+ kpreempt_disable();
const uint32_t h = curcpu()->ci_index; // pktq_rps_hash(m)
-
M_SETCTX(m, wgp);
if (__predict_false(!pktq_enqueue(wg_pktq, m, h))) {
WGLOG(LOG_ERR, "pktq full, dropping\n");
m_freem(m);
}
+ kpreempt_enable();
} else {
wg_send_keepalive_msg(wgp, wgs);
}
@@ -2929,13 +2930,14 @@
/* If we had a data packet queued up, send it. */
if ((m = atomic_swap_ptr(&wgp->wgp_pending, NULL)) != NULL) {
+ kpreempt_disable();
const uint32_t h = curcpu()->ci_index; // pktq_rps_hash(m)
-
M_SETCTX(m, wgp);
if (__predict_false(!pktq_enqueue(wg_pktq, m, h))) {
WGLOG(LOG_ERR, "pktq full, dropping\n");
m_freem(m);
}
+ kpreempt_enable();
}
if (wgs_prev->wgs_state == WGS_STATE_ESTABLISHED) {
@@ -3969,6 +3971,7 @@
panic("invalid af=%d", af);
}
+ kpreempt_disable();
const u_int h = curcpu()->ci_index;
if (__predict_true(pktq_enqueue(pktq, m, h))) {
if_statadd(ifp, if_ibytes, pktlen);
@@ -3976,6 +3979,7 @@
} else {
m_freem(m);
}
+ kpreempt_enable();
}
static void
Home |
Main Index |
Thread Index |
Old Index