From 312f5f8a4fb92c46b5499139b48cf525a4049243 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Sat, 4 Sep 2021 14:18:45 +0200 Subject: [PATCH] altq: mark callouts as mpsafe There's no reason to acquire the Giant lock while executing the ALTQ callouts. While here also remove a few backwards compatibility defines for long obsolete FreeBSD versions. Reviewed by: mav Suggested by: mav Differential Revision: https://reviews.freebsd.org/D31835 --- sys/net/altq/altq_subr.c | 4 +--- sys/net/altq/altq_var.h | 9 +-------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index 39f91c4daf63..32999b694bcb 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -908,9 +908,7 @@ EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL, static void init_machclk_setup(void) { -#if (__FreeBSD_version >= 600000) - callout_init(&tbr_callout, 0); -#endif + callout_init(&tbr_callout, 1); machclk_usepcc = 1; diff --git a/sys/net/altq/altq_var.h b/sys/net/altq/altq_var.h index f711e09334cb..6763fd972d7d 100644 --- a/sys/net/altq/altq_var.h +++ b/sys/net/altq/altq_var.h @@ -164,16 +164,9 @@ typedef u_long ioctlcmd_t; /* use callout */ #include -#if (__FreeBSD_version > 500000) -#define CALLOUT_INIT(c) callout_init((c), 0) -#else -#define CALLOUT_INIT(c) callout_init((c)) -#endif +#define CALLOUT_INIT(c) callout_init((c), 1) #define CALLOUT_RESET(c,t,f,a) callout_reset((c),(t),(f),(a)) #define CALLOUT_STOP(c) callout_stop((c)) -#if !defined(CALLOUT_INITIALIZER) && (__FreeBSD_version < 600000) -#define CALLOUT_INITIALIZER { { { NULL } }, 0, NULL, NULL, 0 } -#endif #define m_pktlen(m) ((m)->m_pkthdr.len)