From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 04:07:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67EB064E319; Mon, 12 Jul 2021 04:07:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNVbZ28bHz3C1F; Mon, 12 Jul 2021 04:07:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3138327F38; Mon, 12 Jul 2021 04:07:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16C47c3c072586; Mon, 12 Jul 2021 04:07:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16C47cku072585; Mon, 12 Jul 2021 04:07:38 GMT (envelope-from git) Date: Mon, 12 Jul 2021 04:07:38 GMT Message-Id: <202107120407.16C47cku072585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 9428c3c912db - stable/13 - math(3): Use the .Fa macro for function arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9428c3c912db68ca58e0f947c6e77e51454d92ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 04:07:38 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9428c3c912db68ca58e0f947c6e77e51454d92ee commit 9428c3c912db68ca58e0f947c6e77e51454d92ee Author: Gordon Bergling AuthorDate: 2021-07-09 17:51:44 +0000 Commit: Gordon Bergling CommitDate: 2021-07-12 04:07:24 +0000 math(3): Use the .Fa macro for function arguments .Fa is the suitable macro for functions in comparsion to the .Ar macro, which should be used for commandline arguments. While here, fix some mandoc warnings. Reviewed by: imp (earlier version) Obtained from: OpenBSD (in partial) Differential Revision: https://reviews.freebsd.org/D31090 (cherry picked from commit c5cbef2f85e6020ef8357b7d3af3ca228a262309) --- lib/msun/man/acos.3 | 2 +- lib/msun/man/acosh.3 | 4 ++-- lib/msun/man/asin.3 | 2 +- lib/msun/man/asinh.3 | 4 ++-- lib/msun/man/atan2.3 | 16 ++++++++-------- lib/msun/man/atanh.3 | 6 +++--- lib/msun/man/ccos.3 | 2 +- lib/msun/man/ccosh.3 | 2 +- lib/msun/man/exp.3 | 8 ++++---- lib/msun/man/sincos.3 | 6 +++--- lib/msun/man/sqrt.3 | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/msun/man/acos.3 b/lib/msun/man/acos.3 index e0c7e676f5d6..4e75f854c1da 100644 --- a/lib/msun/man/acos.3 +++ b/lib/msun/man/acos.3 @@ -60,7 +60,7 @@ These functions return the arc cosine in the range radians. If: .Bd -unfilled -offset indent -.Pf \&| Ns Ar x Ns \&| > 1 , +.Pf \&| Ns Fa x Ns \&| > 1 , .Ed .Pp .Fn acos x diff --git a/lib/msun/man/acosh.3 b/lib/msun/man/acosh.3 index 6af85f85ddfb..c2943317573c 100644 --- a/lib/msun/man/acosh.3 +++ b/lib/msun/man/acosh.3 @@ -55,13 +55,13 @@ and functions compute the inverse hyperbolic cosine of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic cosine of -.Ar x . +.Fa x . If the argument is less than 1, .Fn acosh raises an invalid exception and returns an \*(Na. diff --git a/lib/msun/man/asin.3 b/lib/msun/man/asin.3 index 8bb3c3be66ec..15c181bd8d1f 100644 --- a/lib/msun/man/asin.3 +++ b/lib/msun/man/asin.3 @@ -62,7 +62,7 @@ These functions return the arc sine in the range radians. If: .Bd -unfilled -offset indent -.Pf \&| Ns Ar x Ns \&| > 1 +.Pf \&| Ns Fa x Ns \&| > 1 .Ed .Pp .Fn asin x diff --git a/lib/msun/man/asinh.3 b/lib/msun/man/asinh.3 index 38b33175dd2a..c2181dc49d32 100644 --- a/lib/msun/man/asinh.3 +++ b/lib/msun/man/asinh.3 @@ -55,13 +55,13 @@ and functions compute the inverse hyperbolic sine of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic sine of -.Ar x . +.Fa x . .Sh SEE ALSO .Xr acosh 3 , .Xr atanh 3 , diff --git a/lib/msun/man/atan2.3 b/lib/msun/man/atan2.3 index 59c8a0e3de36..307dadd1a628 100644 --- a/lib/msun/man/atan2.3 +++ b/lib/msun/man/atan2.3 @@ -63,7 +63,7 @@ The and .Fn atan2l functions compute the principal value of the arc tangent of -.Fa y/ Ns Ar x , +.Fa y/ Ns Fa x , using the signs of both arguments to determine the quadrant of the return value. .Pp @@ -94,7 +94,7 @@ and .Fn atan2l functions, if successful, return the arc tangent of -.Fa y/ Ns Ar x +.Fa y/ Ns Fa x in the range .Bk -words .Bq \&- Ns \*(Pi , \&+ Ns \*(Pi @@ -105,22 +105,22 @@ Here are some of the special cases: .It Fn atan2 y x No := Ta .Fn atan y/x Ta if -.Ar x +.Fa x > 0, -.It Ta sign( Ns Ar y Ns )*(\*(Pi - +.It Ta sign( Ns Fa y Ns )*(\*(Pi - .Fn atan "\*(Bay/x\*(Ba" ) Ta if -.Ar x +.Fa x < 0, .It Ta .No 0 Ta if x = y = 0, or .It Ta -.Pf sign( Ar y Ns )*\*(Pi/2 Ta +.Pf sign( Fa y Ns )*\*(Pi/2 Ta if -.Ar x +.Fa x = 0 \(!= -.Ar y . +.Fa y . .El .Sh NOTES The function diff --git a/lib/msun/man/atanh.3 b/lib/msun/man/atanh.3 index 5c3bb7e30f16..5984ee89337e 100644 --- a/lib/msun/man/atanh.3 +++ b/lib/msun/man/atanh.3 @@ -55,18 +55,18 @@ and functions compute the inverse hyperbolic tangent of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic tangent of -.Ar x +.Fa x if successful. If the argument has absolute value 1, a divide-by-zero exception is raised and an infinity is returned. If -.Ar |x| +.Fa |x| > 1, an invalid exception is raised and an \*(Na is returned. .Sh SEE ALSO .Xr acosh 3 , diff --git a/lib/msun/man/ccos.3 b/lib/msun/man/ccos.3 index c07205e6d91d..2c66b6b1b9cf 100644 --- a/lib/msun/man/ccos.3 +++ b/lib/msun/man/ccos.3 @@ -31,7 +31,7 @@ .Nm ccos , .Nm ccosf , .Nm csin , -.Nm csinf +.Nm csinf , .Nm ctan , .Nm ctanf .Nd complex trigonometric functions diff --git a/lib/msun/man/ccosh.3 b/lib/msun/man/ccosh.3 index f006442cdc1d..748b5429b072 100644 --- a/lib/msun/man/ccosh.3 +++ b/lib/msun/man/ccosh.3 @@ -31,7 +31,7 @@ .Nm ccosh , .Nm ccoshf , .Nm csinh , -.Nm csinhf +.Nm csinhf , .Nm ctanh , .Nm ctanhf .Nd complex hyperbolic functions diff --git a/lib/msun/man/exp.3 b/lib/msun/man/exp.3 index 2244bfac375a..ee43081bad83 100644 --- a/lib/msun/man/exp.3 +++ b/lib/msun/man/exp.3 @@ -108,9 +108,9 @@ and the .Fn powl functions compute the value of -.Ar x +.Fa x to the exponent -.Ar y . +.Fa y . .Sh ERROR (due to Roundoff etc.) The values of .Fn exp 0 , @@ -181,8 +181,8 @@ then \*(Na**0 = 1 too because x**0 = 1 for all finite and infinite x, i.e., independently of x. .El .Sh SEE ALSO -.Xr clog 3 -.Xr cpow 3 +.Xr clog 3 , +.Xr cpow 3 , .Xr fenv 3 , .Xr ldexp 3 , .Xr log 3 , diff --git a/lib/msun/man/sincos.3 b/lib/msun/man/sincos.3 index 7d44bea931b1..eecccf3cf37a 100644 --- a/lib/msun/man/sincos.3 +++ b/lib/msun/man/sincos.3 @@ -67,13 +67,13 @@ Upon returning from and .Fn sincosl , the memory pointed to by -.Ar "*s" +.Fa "*s" and -.Ar "*c" +.Fa "*c" are assigned the values of sine and cosine, respectively. .Sh SEE ALSO .Xr cos 3 , -.Xr sin 3 , +.Xr sin 3 .Sh HISTORY These functions were added to .Fx 9.0 diff --git a/lib/msun/man/sqrt.3 b/lib/msun/man/sqrt.3 index bf6c3436cdbf..8214f8a2a7fb 100644 --- a/lib/msun/man/sqrt.3 +++ b/lib/msun/man/sqrt.3 @@ -63,7 +63,7 @@ and .Fn cbrtl functions compute the cube root of -.Ar x . +.Fa x . .Pp The .Fn sqrt , @@ -72,7 +72,7 @@ and .Fn sqrtl functions compute the non-negative square root of -.Ar x . +.Fa x . .Sh RETURN VALUES The .Fn cbrt , From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:33:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E21466546C; Mon, 12 Jul 2021 19:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNv7w0t3qz3QTQ; Mon, 12 Jul 2021 19:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06AA314BA5; Mon, 12 Jul 2021 19:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJXVbu016936; Mon, 12 Jul 2021 19:33:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJXVKw016935; Mon, 12 Jul 2021 19:33:31 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:33:31 GMT Message-Id: <202107121933.16CJXVKw016935@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d765d5c2c309 - stable/13 - config_intrhook: provide config_intrhook_drain MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d765d5c2c30971f109723ea4af6245e8dd201d3a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:33:32 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d765d5c2c30971f109723ea4af6245e8dd201d3a commit d765d5c2c30971f109723ea4af6245e8dd201d3a Author: Warner Losh AuthorDate: 2021-03-11 15:42:09 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:30:55 +0000 config_intrhook: provide config_intrhook_drain config_intrhook_drain will remove the hook from the list as config_intrhook_disestablish does if the hook hasn't been called. If it has, config_intrhook_drain will wait for the hook to be disestablished in the normal course (or expedited, it's up to the driver to decide how and when to call config_intrhook_disestablish). This is intended for removable devices that use config_intrhook and might be attached early in boot, but that may be removed before the kernel can call the config_intrhook or before it ends. To prevent all races, the detach routine will need to call config_intrhook_train. Sponsored by: Netflix, Inc Reviewed by: jhb, mav, gde (in D29006 for man page) Differential Revision: https://reviews.freebsd.org/D29005 (cherry picked from commit e52368365db3c0a696b37bfc09d08b7093b41b57) --- share/man/man9/Makefile | 1 + share/man/man9/config_intrhook.9 | 21 ++++++++++++++++- sys/kern/subr_autoconf.c | 50 +++++++++++++++++++++++++++++++++++++--- sys/sys/kernel.h | 5 ++++ 4 files changed, 73 insertions(+), 4 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 0b025df78061..8bf3b7c22f74 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -859,6 +859,7 @@ MLINKS+=condvar.9 cv_broadcast.9 \ condvar.9 cv_wait_unlock.9 \ condvar.9 cv_wmesg.9 MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \ + config_intrhook.9 config_intrhook_drain.9 \ config_intrhook.9 config_intrhook_establish.9 \ config_intrhook.9 config_intrhook_oneshot.9 MLINKS+=contigmalloc.9 contigmalloc_domainset.9 \ diff --git a/share/man/man9/config_intrhook.9 b/share/man/man9/config_intrhook.9 index 0414ad88218a..6892a089b00f 100644 --- a/share/man/man9/config_intrhook.9 +++ b/share/man/man9/config_intrhook.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 10, 2017 +.Dd March 8, 2021 .Dt CONFIG_INTRHOOK 9 .Os .Sh NAME @@ -40,6 +40,8 @@ but before root is mounted .Fn config_intrhook_establish "struct intr_config_hook *hook" .Ft void .Fn config_intrhook_disestablish "struct intr_config_hook *hook" +.Ft int +.Fn config_intrhook_drain "struct intr_config_hook *hook" .Ft void .Fn config_intrhook_oneshot "ich_func_t func" "void *arg" .Sh DESCRIPTION @@ -55,6 +57,23 @@ The function removes the entry from the hook queue. .Pp The +.Fn config_intrhook_drain +function removes the entry from the hook queue in a safe way. +If the hook is not currently active it removes +.Fa hook +from the hook queue and returns +.Vt ICHS_QUEUED . +If the hook is active, it waits for the hook to complete before returning +.Vt ICHS_RUNNING . +If the hook has previously completed, it returns +.Vt ICHS_DONE . +Because a +.Vt config_intrhook +is undefined prior to +.Fn config_intrhook_establish , +this function may only be called after that function has returned. +.Pp +The .Fn config_intrhook_oneshot function schedules a function to be run as described for .Fn config_intrhook_establish ; diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index 6a998a533801..77c48485e1da 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -138,6 +138,7 @@ run_interrupt_driven_config_hooks() while (next_to_notify != NULL) { hook_entry = next_to_notify; next_to_notify = TAILQ_NEXT(hook_entry, ich_links); + hook_entry->ich_state = ICHS_RUNNING; mtx_unlock(&intr_config_hook_lock); (*hook_entry->ich_func)(hook_entry->ich_arg); mtx_lock(&intr_config_hook_lock); @@ -199,6 +200,7 @@ config_intrhook_establish(struct intr_config_hook *hook) TAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links); if (next_to_notify == NULL) next_to_notify = hook; + hook->ich_state = ICHS_QUEUED; mtx_unlock(&intr_config_hook_lock); if (cold == 0) /* @@ -226,12 +228,11 @@ config_intrhook_oneshot(ich_func_t func, void *arg) config_intrhook_establish(&ohook->och_hook); } -void -config_intrhook_disestablish(struct intr_config_hook *hook) +static void +config_intrhook_disestablish_locked(struct intr_config_hook *hook) { struct intr_config_hook *hook_entry; - mtx_lock(&intr_config_hook_lock); TAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) if (hook_entry == hook) break; @@ -245,8 +246,51 @@ config_intrhook_disestablish(struct intr_config_hook *hook) TSRELEASE("config hooks"); /* Wakeup anyone watching the list */ + hook->ich_state = ICHS_DONE; wakeup(&intr_config_hook_list); +} + +void +config_intrhook_disestablish(struct intr_config_hook *hook) +{ + mtx_lock(&intr_config_hook_lock); + config_intrhook_disestablish_locked(hook); + mtx_unlock(&intr_config_hook_lock); +} + +int +config_intrhook_drain(struct intr_config_hook *hook) +{ + mtx_lock(&intr_config_hook_lock); + + /* + * The config hook has completed, so just return. + */ + if (hook->ich_state == ICHS_DONE) { + mtx_unlock(&intr_config_hook_lock); + return (ICHS_DONE); + } + + /* + * The config hook hasn't started running, just call disestablish. + */ + if (hook->ich_state == ICHS_QUEUED) { + config_intrhook_disestablish_locked(hook); + mtx_unlock(&intr_config_hook_lock); + return (ICHS_QUEUED); + } + + /* + * The config hook is running, so wait for it to complete and return. + */ + while (hook->ich_state != ICHS_DONE) { + if (msleep(&intr_config_hook_list, &intr_config_hook_lock, + 0, "confhd", hz) == EWOULDBLOCK) { + // XXX do I whine? + } + } mtx_unlock(&intr_config_hook_lock); + return (ICHS_RUNNING); } #ifdef DDB diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 181036c98a6a..3e48a57e0f83 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -467,12 +467,17 @@ typedef void (*ich_func_t)(void *_arg); struct intr_config_hook { TAILQ_ENTRY(intr_config_hook) ich_links; + uintptr_t ich_state; +#define ICHS_QUEUED 0x1 +#define ICHS_RUNNING 0x2 +#define ICHS_DONE 0x3 ich_func_t ich_func; void *ich_arg; }; int config_intrhook_establish(struct intr_config_hook *hook); void config_intrhook_disestablish(struct intr_config_hook *hook); +int config_intrhook_drain(struct intr_config_hook *hook); void config_intrhook_oneshot(ich_func_t _func, void *_arg); #endif /* !_SYS_KERNEL_H_*/ From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:33:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73E5A665815; Mon, 12 Jul 2021 19:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNv7x2Tq1z3QJR; Mon, 12 Jul 2021 19:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27C3B14C1B; Mon, 12 Jul 2021 19:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJXXPW016963; Mon, 12 Jul 2021 19:33:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJXXsd016962; Mon, 12 Jul 2021 19:33:33 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:33:33 GMT Message-Id: <202107121933.16CJXXsd016962@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: c7b2c5da0004 - stable/13 - nvme: use config_intrhook_drain to avoid removable card races MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c7b2c5da000425ae11155d8f24c73ecbc0be6339 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:33:33 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c7b2c5da000425ae11155d8f24c73ecbc0be6339 commit c7b2c5da000425ae11155d8f24c73ecbc0be6339 Author: Warner Losh AuthorDate: 2021-03-11 15:42:44 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:30:55 +0000 nvme: use config_intrhook_drain to avoid removable card races nvme drives are configured early in boot. However, a number of the configuration steps takes which take a while, so we defer those to a config intrhook that runs before the root filesystem is mounted. At the same time, the PCI hot plug wakes up and tests the status of the card. It may decide that the card has gone away and deletes the child. As part of that process nvme_detach is called. If this call happens after the config_intrhook starts to run, but before it is finished, there's a race where we can tear down the device's soft state while the config_intrhook is still using it. Use the new config_intrhook_drain to disestablish the hook. Either it will be removed w/o running, or the routine will wait for it to finish. This closes the race and allows safe hotplug at any time, even very early in boot. Sponsored by: Netflix, Inc Reviewed by: jhb, mav Differential Revision: https://reviews.freebsd.org/D29006 (cherry picked from commit 8423f5d4c127f18e7500bc455bc7b6b1691385ef) --- sys/dev/nvme/nvme.c | 5 +---- sys/dev/nvme/nvme_ctrlr.c | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 3c145c817f88..f36125ba247b 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -143,10 +143,7 @@ nvme_detach(device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); - if (ctrlr->config_hook.ich_arg != NULL) { - config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; - } + config_intrhook_drain(&ctrlr->config_hook); nvme_ctrlr_destruct(ctrlr, dev); return (0); diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 9f86e3a8c846..b6befb2c88d0 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1134,7 +1134,6 @@ nvme_ctrlr_start_config_hook(void *arg) fail: nvme_ctrlr_fail(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; return; } @@ -1153,7 +1152,6 @@ fail: nvme_sysctl_initialize_ctrlr(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; ctrlr->is_initialized = 1; nvme_notify_new_controller(ctrlr); From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:33:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2EB1665796; Mon, 12 Jul 2021 19:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNv7y35h5z3QTW; Mon, 12 Jul 2021 19:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4616514C9E; Mon, 12 Jul 2021 19:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJXYJb016987; Mon, 12 Jul 2021 19:33:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJXYvM016986; Mon, 12 Jul 2021 19:33:34 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:33:34 GMT Message-Id: <202107121933.16CJXYvM016986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1109ce0da292 - stable/13 - nvme: fix a race between failing the controller and failing requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1109ce0da292fca8952301086beef63ecaed8649 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:33:35 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1109ce0da292fca8952301086beef63ecaed8649 commit 1109ce0da292fca8952301086beef63ecaed8649 Author: Warner Losh AuthorDate: 2021-05-29 05:01:52 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:30:55 +0000 nvme: fix a race between failing the controller and failing requests Part of the nvme recovery process for errors is to reset the card. Sometimes, this results in failing the entire controller. When nda is in use, we free the sim, which will sleep until all the I/O has completed. However, with only one thread, the request fail task never runs once the reset thread sleeps here. Create two threads to allow I/O to fail until it's all processed and the reset task can proceed. This is a temporary kludge until I can work out questions that arose during the review, not least is what was the race that queueing to a failure task solved. The original commit is vague and other error paths in the same context do a direct failure. I'll investigate that more completely before committing changing that to a direct failure. mav@ raised this issue during the review, but didn't otherwise object. Multiple threads, though, solve the problem in the mean time until other such means can be perfected. Reviewed by: jhb@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30366 (cherry picked from commit f0f47121653e88197d8537572294b90f5aef7f17) --- sys/dev/nvme/nvme_ctrlr.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index b6befb2c88d0..d8760158a75f 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1429,9 +1429,20 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0) return (ENXIO); + /* + * Create 2 threads for the taskqueue. The reset thread will block when + * it detects that the controller has failed until all I/O has been + * failed up the stack. The fail_req task needs to be able to run in + * this case to finish the request failure for some cases. + * + * We could partially solve this race by draining the failed requeust + * queue before proceding to free the sim, though nothing would stop + * new I/O from coming in after we do that drain, but before we reach + * cam_sim_free, so this big hammer is used instead. + */ ctrlr->taskqueue = taskqueue_create("nvme_taskq", M_WAITOK, taskqueue_thread_enqueue, &ctrlr->taskqueue); - taskqueue_start_threads(&ctrlr->taskqueue, 1, PI_DISK, "nvme taskq"); + taskqueue_start_threads(&ctrlr->taskqueue, 2, PI_DISK, "nvme taskq"); ctrlr->is_resetting = 0; ctrlr->is_initialized = 0; From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:33:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16C74665478; Mon, 12 Jul 2021 19:33:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNv7z6KRVz3QWv; Mon, 12 Jul 2021 19:33:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A7C014AC6; Mon, 12 Jul 2021 19:33:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJXZI1017011; Mon, 12 Jul 2021 19:33:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJXZKZ017010; Mon, 12 Jul 2021 19:33:35 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:33:35 GMT Message-Id: <202107121933.16CJXZKZ017010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1a3011fe0b44 - stable/13 - nvme: style nit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1a3011fe0b441dcc7d3ea8cb866e81f6a3baf2e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:33:36 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1a3011fe0b441dcc7d3ea8cb866e81f6a3baf2e7 commit 1a3011fe0b441dcc7d3ea8cb866e81f6a3baf2e7 Author: Warner Losh AuthorDate: 2021-07-02 21:58:14 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:30:55 +0000 nvme: style nit Put the { on the same line as the struct nvme_foo when we define these structures. It's FreeBSD standard and these were inconsistent. Sponsored by: Netflix (cherry picked from commit 80a75155e1601bddc2c595c06ab6ea916c603071) --- sys/dev/nvme/nvme.h | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index b28a8d4348db..d63a074f321d 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -546,8 +546,7 @@ enum shst_value { NVME_SHST_COMPLETE = 0x2, }; -struct nvme_registers -{ +struct nvme_registers { uint32_t cap_lo; /* controller capabilities */ uint32_t cap_hi; uint32_t vs; /* version */ @@ -584,8 +583,7 @@ struct nvme_registers _Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for nvme_registers"); -struct nvme_command -{ +struct nvme_command { /* dword 0 */ uint8_t opc; /* opcode */ uint8_t fuse; /* fused operation */ @@ -1446,8 +1444,7 @@ struct nvme_sanitize_status_page { _Static_assert(sizeof(struct nvme_sanitize_status_page) == 512, "bad size for nvme_sanitize_status_page"); -struct intel_log_temp_stats -{ +struct intel_log_temp_stats { uint64_t current; uint64_t overtemp_flag_last; uint64_t overtemp_flag_life; @@ -1461,8 +1458,7 @@ struct intel_log_temp_stats _Static_assert(sizeof(struct intel_log_temp_stats) == 13 * 8, "bad size for intel_log_temp_stats"); -struct nvme_resv_reg_ctrlr -{ +struct nvme_resv_reg_ctrlr { uint16_t ctrlr_id; /* Controller ID */ uint8_t rcsts; /* Reservation Status */ uint8_t reserved3[5]; @@ -1472,8 +1468,7 @@ struct nvme_resv_reg_ctrlr _Static_assert(sizeof(struct nvme_resv_reg_ctrlr) == 24, "bad size for nvme_resv_reg_ctrlr"); -struct nvme_resv_reg_ctrlr_ext -{ +struct nvme_resv_reg_ctrlr_ext { uint16_t ctrlr_id; /* Controller ID */ uint8_t rcsts; /* Reservation Status */ uint8_t reserved3[5]; @@ -1484,8 +1479,7 @@ struct nvme_resv_reg_ctrlr_ext _Static_assert(sizeof(struct nvme_resv_reg_ctrlr_ext) == 64, "bad size for nvme_resv_reg_ctrlr_ext"); -struct nvme_resv_status -{ +struct nvme_resv_status { uint32_t gen; /* Generation */ uint8_t rtype; /* Reservation Type */ uint8_t regctl[2]; /* Number of Registered Controllers */ @@ -1497,8 +1491,7 @@ struct nvme_resv_status _Static_assert(sizeof(struct nvme_resv_status) == 24, "bad size for nvme_resv_status"); -struct nvme_resv_status_ext -{ +struct nvme_resv_status_ext { uint32_t gen; /* Generation */ uint8_t rtype; /* Reservation Type */ uint8_t regctl[2]; /* Number of Registered Controllers */ From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:33:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE26F6655F1; Mon, 12 Jul 2021 19:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNv811VnYz3QPw; Mon, 12 Jul 2021 19:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C10014C1C; Mon, 12 Jul 2021 19:33:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJXawL017035; Mon, 12 Jul 2021 19:33:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJXaUM017034; Mon, 12 Jul 2021 19:33:36 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:33:36 GMT Message-Id: <202107121933.16CJXaUM017034@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 8c66f8811d52 - stable/13 - nvme: Fix alignment on nvme structures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8c66f8811d5258e492801e34f818fa4749d54385 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:33:37 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8c66f8811d5258e492801e34f818fa4749d54385 commit 8c66f8811d5258e492801e34f818fa4749d54385 Author: Warner Losh AuthorDate: 2021-07-02 21:58:19 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:30:56 +0000 nvme: Fix alignment on nvme structures Remove __packed from nvme_command, nvme_completion and nvme_dsm_trim. Add super-alignment to nvme_completion since it's always at least that aligned in hardware (and in our existing uses of it embedded in structures). It generates better code in nvme_qpair_process_completions on riscv64 because otherwise the ABI assumes a 4-byte alignment, and the same on all other platforms. Reviewed by: jrtc27@, mav@, chuck@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31001 (cherry picked from commit fea3cf1d6da0acf40bc1d3dadeeea7eeccbc10dd) --- sys/dev/nvme/nvme.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index d63a074f321d..7d153c61165c 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -578,8 +578,8 @@ struct nvme_registers { struct { uint32_t sq_tdbl; /* submission queue tail doorbell */ uint32_t cq_hdbl; /* completion queue head doorbell */ - } doorbell[1] __packed; -} __packed; + } doorbell[1]; +}; _Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for nvme_registers"); @@ -612,7 +612,7 @@ struct nvme_command { uint32_t cdw13; /* command-specific */ uint32_t cdw14; /* command-specific */ uint32_t cdw15; /* command-specific */ -} __packed; +}; _Static_assert(sizeof(struct nvme_command) == 16 * 4, "bad size for nvme_command"); @@ -630,7 +630,7 @@ struct nvme_completion { /* dword 3 */ uint16_t cid; /* command identifier */ uint16_t status; -} __packed; +} __aligned(8); /* riscv: nvme_qpair_process_completions has better code gen */ _Static_assert(sizeof(struct nvme_completion) == 4 * 4, "bad size for nvme_completion"); @@ -638,7 +638,7 @@ struct nvme_dsm_range { uint32_t attributes; uint32_t length; uint64_t starting_lba; -} __packed; +}; /* Largest DSM Trim that can be done */ #define NVME_MAX_DSM_TRIM 4096 From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:41:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74A75665B20; Mon, 12 Jul 2021 19:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNvJb2wxVz3h0g; Mon, 12 Jul 2021 19:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D6A014C2D; Mon, 12 Jul 2021 19:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJf34B029210; Mon, 12 Jul 2021 19:41:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJf3XF029209; Mon, 12 Jul 2021 19:41:03 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:41:03 GMT Message-Id: <202107121941.16CJf3XF029209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: ffb294bd3157 - stable/13 - nvme: coherently read status of completion records MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ffb294bd3157bebacbb6bf0189a06247285fb98e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:41:03 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ffb294bd3157bebacbb6bf0189a06247285fb98e commit ffb294bd3157bebacbb6bf0189a06247285fb98e Author: Warner Losh AuthorDate: 2021-07-02 22:00:42 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:39:58 +0000 nvme: coherently read status of completion records Coherently read the phase bit of the status completion record. We loop over the completion record array, looking for all the transactions in the same phase that have been completed. In doing that, we have to be careful to read the status field first, and if it indicates a complete record, we need to read and process that record. Otherwise, the host might be overtaken by device when reading this completion record, leading to a mistaken belief that the record is in phase. This leads to the code using old values and looking at an already completed entry, which has no current tracker. To work around this problem, we read the status and make sure it is in phase, we then re-read the entire completion record guaranteeing it's complete, valid, and consistent . In addition we resync the dmatag to reflect changes since the prior loop for the bouncing dma case. Reviewed by: jrtc27@, chuck@ Found by: jrtc27 (this fix is based in part on her D30995 fix) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31002 (cherry picked from commit aa0ab681ae755e01cd69435fab50f6852f248c42) --- sys/dev/nvme/nvme_qpair.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 0726ca248442..12770f38d42e 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -583,13 +583,30 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) } while (1) { - cpl = qpair->cpl[qpair->cq_head]; + uint16_t status; - /* Convert to host endian */ + /* + * We need to do this dance to avoid a race between the host and + * the device where the device overtakes the host while the host + * is reading this record, leaving the status field 'new' and + * the sqhd and cid fields potentially stale. If the phase + * doesn't match, that means status hasn't yet been updated and + * we'll get any pending changes next time. It also means that + * the phase must be the same the second time. We have to sync + * before reading to ensure any bouncing completes. + */ + status = le16toh(qpair->cpl[qpair->cq_head].status); + if (NVME_STATUS_GET_P(status) != qpair->phase) + break; + + bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + cpl = qpair->cpl[qpair->cq_head]; nvme_completion_swapbytes(&cpl); - if (NVME_STATUS_GET_P(cpl.status) != qpair->phase) - break; + KASSERT( + NVME_STATUS_GET_P(status) == NVME_STATUS_GET_P(cpl.status), + ("Phase unexpectedly inconsistent")); tr = qpair->act_tr[cpl.cid]; From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:43:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99D42665A76; Mon, 12 Jul 2021 19:43:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNvMf3Y7mz3hBF; Mon, 12 Jul 2021 19:43:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61B4514ED7; Mon, 12 Jul 2021 19:43:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJhgFT030229; Mon, 12 Jul 2021 19:43:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJhgCS030228; Mon, 12 Jul 2021 19:43:42 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:43:42 GMT Message-Id: <202107121943.16CJhgCS030228@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 940fae408255 - stable/13 - nanobsd: remove sparc64 embedded example MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 940fae4082550e7a6a5040b573705d5cdf87d560 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:43:42 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=940fae4082550e7a6a5040b573705d5cdf87d560 commit 940fae4082550e7a6a5040b573705d5cdf87d560 Author: Warner Losh AuthorDate: 2021-07-08 23:55:20 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:42:13 +0000 nanobsd: remove sparc64 embedded example Remove the qemu sparc64 example. It was only ever compile tested since qemu had issues booting FreeBSD/sparc64. Also remove obsolete info about armv5 configs removed long ago. Sponsored by: Netflix (cherry picked from commit 25a66f1fb177e0f3628f92f73b6ecf48a305d230) --- tools/tools/nanobsd/embedded/README | 9 ------- tools/tools/nanobsd/embedded/qemu-sparc64.cfg | 36 --------------------------- 2 files changed, 45 deletions(-) diff --git a/tools/tools/nanobsd/embedded/README b/tools/tools/nanobsd/embedded/README index 78f6c31b2c6d..b77d3302d861 100644 --- a/tools/tools/nanobsd/embedded/README +++ b/tools/tools/nanobsd/embedded/README @@ -31,17 +31,8 @@ qemu-powerpc.cfg Create a bootable 32-bit powerpc image for qemu qemu-powerpc64.cfg Create a bootable 64-bit IBM-flavor image for qemu -qemu-sparc64.cfg Create a bootable sparc64 image for qemu rpi.cfg Create a bootable image for Raspberry Pi B rpi2.cfg Create a bootable image for Raspberry Pi2 -sam9260ek.cfg Create a bootable image for an Atmel SAM9260-EK - evaluation board (still needs a kernel loaded - into dataflash or NAND, so experimental). -sam9g20ek.cfg Create a bootable image for an Atmel SAM9G20-EK - evaluation board (still needs a kernel loaded - into dataflash or NAND, so experimental). Also - works on many after-market boards that are somewhat - compatible with the references board. QEMU command lines for serial console access diff --git a/tools/tools/nanobsd/embedded/qemu-sparc64.cfg b/tools/tools/nanobsd/embedded/qemu-sparc64.cfg deleted file mode 100644 index 9a63c9b42d55..000000000000 --- a/tools/tools/nanobsd/embedded/qemu-sparc64.cfg +++ /dev/null @@ -1,36 +0,0 @@ -# $FreeBSD$ - -#- -# Copyright (c) 2015 M. Warner Losh -# Copyright (c) 2010-2011 iXsystems, Inc. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# - -NANO_ARCH=sparc64 -NANO_KERNEL=GENERIC -NANO_DRIVE=ada0 -NANO_NAME=qemu-sparc64 - -. common # Pull in common definitions - -qemu_env From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:43:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C62E665B3F; Mon, 12 Jul 2021 19:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNvMh5kT5z3hQB; Mon, 12 Jul 2021 19:43:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C4FF14D43; Mon, 12 Jul 2021 19:43:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJhikF030284; Mon, 12 Jul 2021 19:43:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJhiKe030283; Mon, 12 Jul 2021 19:43:44 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:43:44 GMT Message-Id: <202107121943.16CJhiKe030283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 39d7a1f47909 - stable/13 - nvmecontrol: document power command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 39d7a1f4790910c990db53a2eb75cba34ab734bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:43:45 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=39d7a1f4790910c990db53a2eb75cba34ab734bf commit 39d7a1f4790910c990db53a2eb75cba34ab734bf Author: Warner Losh AuthorDate: 2021-07-10 16:51:15 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:42:59 +0000 nvmecontrol: document power command The description of the power command is missing. While the synopsis is present, there's no explanation. Add one. Reviewed by: mav, chuck PR: 237866 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31122 (cherry picked from commit 445b5554bf97254a0ead3d70f801871d62dcfb62) --- sbin/nvmecontrol/nvmecontrol.8 | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 2d634eb54216..7d70e1762f73 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -470,6 +470,37 @@ Run in mode. This will report status on a sanitize that is already running on the drive. .El +.Ss power +Manage the power modes of the NVMe controller. +.Bl -tag -width 6n +.It Fl l +List all supported power modes. +.It Fl p Ar mode +Set the power mode to +.Ar mode . +This must be a mode listed with the +.Dl nvmecontrol power -l +command. +.It Fl w Ar hint +Set the workload hint for automatic power mode control. +.Bl -tag -compact -width 6n +.It 0 +No workload hint is provided. +.It 1 +Extended idle period workload. +The device is often idle for minutes at a time. +A burst of write commands comes in over a period of seconds. +Then the device returns to being idle. +.It 2 +Heavy sequential writes. +A huge number of sequential writes will be submitted, filling the submission queues. +.It Other +All other values are reserved and have no standard meaning. +.El +Please see the +.Dq NVM Subsystem Workloads +section of the relevant NVM Express Base Standard for details. +.El .Ss selftest Start the specified device self-test: .Bl -tag -width 6n @@ -505,7 +536,7 @@ and commands send NVMe commands to either the administrative or the data part of the device. These commands are expected to be compatible with nvme-cli. -Please see the NVMe Standard for details. +Please see the NVM Express Base Standard for details. .Bl -tag -width 16n .It Fl o -opcode Ar opcode Opcode to send. From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 19:43:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3623665D33; Mon, 12 Jul 2021 19:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNvMg48Wpz3hBG; Mon, 12 Jul 2021 19:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76E4F14C6D; Mon, 12 Jul 2021 19:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CJhh3I030259; Mon, 12 Jul 2021 19:43:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJhhfl030258; Mon, 12 Jul 2021 19:43:43 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:43:43 GMT Message-Id: <202107121943.16CJhhfl030258@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 9cd9a0c86924 - stable/13 - stand/kmem_zalloc: panic when a M_WAITOK allocation fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9cd9a0c86924c350f83e5c8fbcadc84ee0d72e26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:43:43 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9cd9a0c86924c350f83e5c8fbcadc84ee0d72e26 commit 9cd9a0c86924c350f83e5c8fbcadc84ee0d72e26 Author: Warner Losh AuthorDate: 2021-07-09 17:21:18 +0000 Commit: Warner Losh CommitDate: 2021-07-12 19:42:58 +0000 stand/kmem_zalloc: panic when a M_WAITOK allocation fails Malloc() might return NULL, in which case we will panic with a NULL pointer deref. Make it panic when the allocation fails to preserve the postcondtion that we never return a non-NULL value. Reviewed by: tsoome PR: 249859 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31106 (cherry picked from commit 72821668b039c276914569e9caa1cdfa4e4cb674) --- sys/sys/malloc.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 52a17b5171bc..8982e534fc22 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -297,16 +297,20 @@ extern void *Malloc(size_t bytes, const char *file, int line); * flags mean anything and there's no need declare malloc types. * Define the simple alloc / free routines in terms of Malloc and * Free. None of the kernel features that this stuff disables are needed. - * - * XXX we are setting ourselves up for a potential crash if we can't allocate - * memory for a M_WAITOK call. */ -#define M_WAITOK 0 +#define M_WAITOK 1 #define M_ZERO 0 -#define M_NOWAIT 0 +#define M_NOWAIT 2 #define MALLOC_DECLARE(x) -#define kmem_zalloc(size, flags) Malloc((size), __FILE__, __LINE__) +#define kmem_zalloc(size, flags) ({ \ + void *p = Malloc((size), __FILE__, __LINE__); \ + if (p == NULL && (flags & M_WAITOK) != 0) \ + panic("Could not malloc %zd bytes with M_WAITOK from %s line %d", \ + (size_t)size, __FILE__, __LINE__); \ + p; \ +}) + #define kmem_free(p, size) Free(p, __FILE__, __LINE__) /* @@ -314,5 +318,6 @@ extern void *Malloc(size_t bytes, const char *file, int line); * M_WAITOK. Given the above, it will also be a nop. */ #define KM_SLEEP M_WAITOK +#define KM_NOSLEEP M_NOWAIT #endif /* _STANDALONE */ #endif /* !_SYS_MALLOC_H_ */ From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 20:38:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A604666C92; Mon, 12 Jul 2021 20:38:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNwZX04Tlz3rM7; Mon, 12 Jul 2021 20:38:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAF1815821; Mon, 12 Jul 2021 20:38:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CKcBUB097856; Mon, 12 Jul 2021 20:38:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CKcBVv097855; Mon, 12 Jul 2021 20:38:11 GMT (envelope-from git) Date: Mon, 12 Jul 2021 20:38:11 GMT Message-Id: <202107122038.16CKcBVv097855@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d2299b715974 - stable/13 - nvmecontrol: Report status from passthru commands MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2299b7159743b89b7a281cbb50481655d7be144 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 20:38:12 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d2299b7159743b89b7a281cbb50481655d7be144 commit d2299b7159743b89b7a281cbb50481655d7be144 Author: Warner Losh AuthorDate: 2021-03-25 07:41:53 +0000 Commit: Warner Losh CommitDate: 2021-07-12 20:37:07 +0000 nvmecontrol: Report status from passthru commands Report status from dword0 for passthru commands. Many commands report some status or information here, so reporting it can help know what's going on. Sponsored by: Netflix (cherry picked from commit 510a3da1477a917aa2aaf6b9e3cd6fd50dd13206) --- sbin/nvmecontrol/passthru.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c index add6cf1cc7ca..8284261b769b 100644 --- a/sbin/nvmecontrol/passthru.c +++ b/sbin/nvmecontrol/passthru.c @@ -246,7 +246,8 @@ passthru(const struct cmd *f, int argc, char *argv[]) errno = 0; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(EX_IOERR, "passthrough request failed"); - /* XXX report status */ + if (!opt.binary) + printf("DWORD0 status= %#x\n", pt.cpl.cdw0); if (opt.read) { if (opt.binary) write(STDOUT_FILENO, data, opt.data_len); From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 20:38:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 353BB666D96; Mon, 12 Jul 2021 20:38:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNwZY0pdBz3rPt; Mon, 12 Jul 2021 20:38:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03136158F8; Mon, 12 Jul 2021 20:38:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CKcCdV097880; Mon, 12 Jul 2021 20:38:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CKcCIL097879; Mon, 12 Jul 2021 20:38:12 GMT (envelope-from git) Date: Mon, 12 Jul 2021 20:38:12 GMT Message-Id: <202107122038.16CKcCIL097879@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 99ff43c0c7e8 - stable/13 - nvmecontrol: update copyright on passthru command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 99ff43c0c7e82e8618228a74a5591949b9291430 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 20:38:13 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=99ff43c0c7e82e8618228a74a5591949b9291430 commit 99ff43c0c7e82e8618228a74a5591949b9291430 Author: Warner Losh AuthorDate: 2021-05-06 22:05:42 +0000 Commit: Warner Losh CommitDate: 2021-07-12 20:37:07 +0000 nvmecontrol: update copyright on passthru command I wrote this code, not Intel, so put my copyright on this. I mistakenly copied it for the initial commit. Sponsored by: Netflix (cherry picked from commit 6d6cca363392943689204f920fa2da9226e42056) --- sbin/nvmecontrol/passthru.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c index 8284261b769b..0b24d7b1ea1f 100644 --- a/sbin/nvmecontrol/passthru.c +++ b/sbin/nvmecontrol/passthru.c @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (C) 2012-2013 Intel Corporation - * All rights reserved. + * Copyright (c) 2019-2021 Netflix, Inc * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-dev-commits-src-branches@freebsd.org Mon Jul 12 20:38:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E997666F0A; Mon, 12 Jul 2021 20:38:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNwZZ21tZz3rVr; Mon, 12 Jul 2021 20:38:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25395158F9; Mon, 12 Jul 2021 20:38:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CKcEG6097906; Mon, 12 Jul 2021 20:38:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CKcEl4097905; Mon, 12 Jul 2021 20:38:14 GMT (envelope-from git) Date: Mon, 12 Jul 2021 20:38:14 GMT Message-Id: <202107122038.16CKcEl4097905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 5a604e56d49d - stable/13 - nvmecontrol: fix typo (s/Managment/Management/) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a604e56d49db44875dd3ffde6abb6cf838619a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 20:38:14 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5a604e56d49db44875dd3ffde6abb6cf838619a9 commit 5a604e56d49db44875dd3ffde6abb6cf838619a9 Author: Edward Tomasz Napierala AuthorDate: 2021-05-07 12:12:30 +0000 Commit: Warner Losh CommitDate: 2021-07-12 20:37:07 +0000 nvmecontrol: fix typo (s/Managment/Management/) Reported By: pstef (cherry picked from commit 95a74ab4fb0879da270342bc98719b0e735694f3) --- sbin/nvmecontrol/identify_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c index 6e30ef0487a8..311c8cba09a9 100644 --- a/sbin/nvmecontrol/identify_ext.c +++ b/sbin/nvmecontrol/identify_ext.c @@ -138,7 +138,7 @@ nvme_print_controller(struct nvme_controller_data *cdata) fmt ? "Supported" : "Not Supported"); printf("Firmware Activate/Download: %s\n", fw ? "Supported" : "Not Supported"); - printf("Namespace Managment: %s\n", + printf("Namespace Management: %s\n", nsmgmt ? "Supported" : "Not Supported"); printf("Device Self-test: %sSupported\n", ((oacs >> NVME_CTRLR_DATA_OACS_SELFTEST_SHIFT) & From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 00:28:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8555864C398; Tue, 13 Jul 2021 00:28:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GP1hj38RRz4snD; Tue, 13 Jul 2021 00:28:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 526F518A1B; Tue, 13 Jul 2021 00:28:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16D0Sr1Y005079; Tue, 13 Jul 2021 00:28:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16D0Sreg005078; Tue, 13 Jul 2021 00:28:53 GMT (envelope-from git) Date: Tue, 13 Jul 2021 00:28:53 GMT Message-Id: <202107130028.16D0Sreg005078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: ae2e05423dff - stable/13 - Skip netgraph tests when WITHOUT_NETGRAPH is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ae2e05423dfff64cdfcf6263de6e62ef49dec6a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 00:28:53 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ae2e05423dfff64cdfcf6263de6e62ef49dec6a0 commit ae2e05423dfff64cdfcf6263de6e62ef49dec6a0 Author: Ed Maste AuthorDate: 2021-07-06 13:44:15 +0000 Commit: Ed Maste CommitDate: 2021-07-13 00:27:19 +0000 Skip netgraph tests when WITHOUT_NETGRAPH is set PR: 256986 Reported by: John Marshall MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999) --- tests/sys/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 4ba885405ce7..2781f7fb4ded 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -20,7 +20,7 @@ TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= net -TESTS_SUBDIRS+= netgraph +TESTS_SUBDIRS+= ${_netgraph} TESTS_SUBDIRS+= netinet TESTS_SUBDIRS+= netinet6 TESTS_SUBDIRS+= netipsec @@ -40,6 +40,10 @@ _audit= audit _cddl= cddl .endif +.if ${MK_NETGRAPH} != "no" +_netgraph= netgraph +.endif + # Items not integrated into kyua runs by default SUBDIR+= pjdfstest From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 01:54:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B31364DA84; Tue, 13 Jul 2021 01:54:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GP3bv3Hbvz3Mv1; Tue, 13 Jul 2021 01:54:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 539F719D0A; Tue, 13 Jul 2021 01:54:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16D1spxm023914; Tue, 13 Jul 2021 01:54:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16D1spHT023913; Tue, 13 Jul 2021 01:54:51 GMT (envelope-from git) Date: Tue, 13 Jul 2021 01:54:51 GMT Message-Id: <202107130154.16D1spHT023913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: a469b89bf206 - stable/13 - nvme(4): Report NPWA before NPWG as stripesize. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a469b89bf206731430f26e975d120c4485b71e23 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 01:54:51 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=a469b89bf206731430f26e975d120c4485b71e23 commit a469b89bf206731430f26e975d120c4485b71e23 Author: Alexander Motin AuthorDate: 2021-07-06 02:19:48 +0000 Commit: Alexander Motin CommitDate: 2021-07-13 01:54:44 +0000 nvme(4): Report NPWA before NPWG as stripesize. New Samsung 980 SSDs report Namespace Preferred Write Alignment of 8 (4KB) and Namespace Preferred Write Granularity of 32 (16KB). My quick tests show that 16KB is a minimal sequential write size when the SSD reaches peak IOPS, so writing much less is very slow. But writing slightly less or slightly more does not change much, so it seems not so much a size granularity as minimum I/O size. Thinking about different stripesize consumers: - Partition alignment should be based on NPWA by definition. - ZFS ashift in part of forcing alignment of all I/Os should also be based on NPWA. In part of forcing size granularity, if really needed, it may be set to NPWG, but too big value can make ZFS too space-inefficient, and the 16KB is actually the biggest supported value there now. - ZFS recordsize/volblocksize could potentially be tuned up toward NPWG to work as I/O size granularity, but enabled compression makes it too fuzzy. And those are normally user-configurable things. - ZFS I/O aggregation code could definitely use Optimal Write Size value and may be NPWG, but we don't have fields in GEOM now to report the minimal and optimal I/O sizes, and even maximal is not reported outside GEOM DISK to be used by ZFS. MFC after: 1 week (cherry picked from commit e3bcd07d834def94dcf570ac7350ca2c454ebf10) --- sys/dev/nvme/nvme_ns.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 82ab48efa826..8f97b08b88f4 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -231,10 +231,15 @@ nvme_ns_get_data(struct nvme_namespace *ns) uint32_t nvme_ns_get_stripesize(struct nvme_namespace *ns) { + uint32_t ss; if (((ns->data.nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & - NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && ns->data.npwg != 0) { - return ((ns->data.npwg + 1) * nvme_ns_get_sector_size(ns)); + NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0) { + ss = nvme_ns_get_sector_size(ns); + if (ns->data.npwa != 0) + return ((ns->data.npwa + 1) * ss); + else if (ns->data.npwg != 0) + return ((ns->data.npwg + 1) * ss); } return (ns->boundary); } From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 01:55:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70FFF64DAA2; Tue, 13 Jul 2021 01:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GP3ck2qxbz3NHS; Tue, 13 Jul 2021 01:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F32D19F07; Tue, 13 Jul 2021 01:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16D1tYkZ024099; Tue, 13 Jul 2021 01:55:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16D1tYJY024098; Tue, 13 Jul 2021 01:55:34 GMT (envelope-from git) Date: Tue, 13 Jul 2021 01:55:34 GMT Message-Id: <202107130155.16D1tYJY024098@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: c38e334b175c - stable/12 - nvme(4): Report NPWA before NPWG as stripesize. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c38e334b175c244ad596def2a77852fb294aff1b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 01:55:34 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c38e334b175c244ad596def2a77852fb294aff1b commit c38e334b175c244ad596def2a77852fb294aff1b Author: Alexander Motin AuthorDate: 2021-07-06 02:19:48 +0000 Commit: Alexander Motin CommitDate: 2021-07-13 01:55:14 +0000 nvme(4): Report NPWA before NPWG as stripesize. New Samsung 980 SSDs report Namespace Preferred Write Alignment of 8 (4KB) and Namespace Preferred Write Granularity of 32 (16KB). My quick tests show that 16KB is a minimal sequential write size when the SSD reaches peak IOPS, so writing much less is very slow. But writing slightly less or slightly more does not change much, so it seems not so much a size granularity as minimum I/O size. Thinking about different stripesize consumers: - Partition alignment should be based on NPWA by definition. - ZFS ashift in part of forcing alignment of all I/Os should also be based on NPWA. In part of forcing size granularity, if really needed, it may be set to NPWG, but too big value can make ZFS too space-inefficient, and the 16KB is actually the biggest supported value there now. - ZFS recordsize/volblocksize could potentially be tuned up toward NPWG to work as I/O size granularity, but enabled compression makes it too fuzzy. And those are normally user-configurable things. - ZFS I/O aggregation code could definitely use Optimal Write Size value and may be NPWG, but we don't have fields in GEOM now to report the minimal and optimal I/O sizes, and even maximal is not reported outside GEOM DISK to be used by ZFS. MFC after: 1 week (cherry picked from commit e3bcd07d834def94dcf570ac7350ca2c454ebf10) --- sys/dev/nvme/nvme_ns.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 9452f6460973..3bdf30e9264c 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -231,10 +231,15 @@ nvme_ns_get_data(struct nvme_namespace *ns) uint32_t nvme_ns_get_stripesize(struct nvme_namespace *ns) { + uint32_t ss; if (((ns->data.nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & - NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && ns->data.npwg != 0) { - return ((ns->data.npwg + 1) * nvme_ns_get_sector_size(ns)); + NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0) { + ss = nvme_ns_get_sector_size(ns); + if (ns->data.npwa != 0) + return ((ns->data.npwa + 1) * ss); + else if (ns->data.npwg != 0) + return ((ns->data.npwg + 1) * ss); } return (ns->boundary); } From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 15:47:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57E0D66091B; Tue, 13 Jul 2021 15:47:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPQ5B20jwz3kp8; Tue, 13 Jul 2021 15:47:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D06F25211; Tue, 13 Jul 2021 15:47:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DFlwov037009; Tue, 13 Jul 2021 15:47:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DFlwZ2037008; Tue, 13 Jul 2021 15:47:58 GMT (envelope-from git) Date: Tue, 13 Jul 2021 15:47:58 GMT Message-Id: <202107131547.16DFlwZ2037008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: d5a71c929dfa - stable/13 - zfsd: Check for error from zpool_vdev_online MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d5a71c929dfaab37bf7a8a9278d8cf1e8dfaa4ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 15:47:58 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=d5a71c929dfaab37bf7a8a9278d8cf1e8dfaa4ef commit d5a71c929dfaab37bf7a8a9278d8cf1e8dfaa4ef Author: Ryan Moeller AuthorDate: 2021-07-06 16:00:18 +0000 Commit: Ryan Moeller CommitDate: 2021-07-13 15:44:32 +0000 zfsd: Check for error from zpool_vdev_online Onlining a vdev can fail. Log the error if it does. Reviewed by: mav, asomers MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30882 (cherry picked from commit 53b438b2425c374f6147ac80b3330a9ec08432bb) --- cddl/usr.sbin/zfsd/case_file.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc index da2125b4d716..8da711fc10cb 100644 --- a/cddl/usr.sbin/zfsd/case_file.cc +++ b/cddl/usr.sbin/zfsd/case_file.cc @@ -280,9 +280,17 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { - zpool_vdev_online(pool, vdev->GUIDString().c_str(), - ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, - &m_vdevState); + if (zpool_vdev_online(pool, vdev->GUIDString().c_str(), + ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, + &m_vdevState) != 0) { + syslog(LOG_ERR, + "Failed to online vdev(%s/%s:%s): %s: %s\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", zpool_get_name(pool), vdev->GUIDString().c_str(), devPath.c_str(), From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 15:51:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 629DA660E0E; Tue, 13 Jul 2021 15:51:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPQ9g5drsz3lHd; Tue, 13 Jul 2021 15:51:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93B682523C; Tue, 13 Jul 2021 15:51:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DFppuQ049538; Tue, 13 Jul 2021 15:51:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DFppOU049537; Tue, 13 Jul 2021 15:51:51 GMT (envelope-from git) Date: Tue, 13 Jul 2021 15:51:51 GMT Message-Id: <202107131551.16DFppOU049537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 207b3a418a53 - stable/12 - zfsd: Check for error from zpool_vdev_online MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 207b3a418a536853af0561b443f32911da18bba9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 15:51:52 -0000 The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=207b3a418a536853af0561b443f32911da18bba9 commit 207b3a418a536853af0561b443f32911da18bba9 Author: Ryan Moeller AuthorDate: 2021-07-06 16:00:18 +0000 Commit: Ryan Moeller CommitDate: 2021-07-13 15:48:33 +0000 zfsd: Check for error from zpool_vdev_online Onlining a vdev can fail. Log the error if it does. Reviewed by: mav, asomers MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30882 (cherry picked from commit 53b438b2425c374f6147ac80b3330a9ec08432bb) --- cddl/usr.sbin/zfsd/case_file.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc index 19c4abe45fc9..6a4483ec49c2 100644 --- a/cddl/usr.sbin/zfsd/case_file.cc +++ b/cddl/usr.sbin/zfsd/case_file.cc @@ -281,9 +281,17 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { - zpool_vdev_online(pool, vdev->GUIDString().c_str(), - ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, - &m_vdevState); + if (zpool_vdev_online(pool, vdev->GUIDString().c_str(), + ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, + &m_vdevState) != 0) { + syslog(LOG_ERR, + "Failed to online vdev(%s/%s:%s): %s: %s\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", zpool_get_name(pool), vdev->GUIDString().c_str(), devPath.c_str(), From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 17:59:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8024E662AB3; Tue, 13 Jul 2021 17:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPT0d36GTz4dpY; Tue, 13 Jul 2021 17:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52EF726B66; Tue, 13 Jul 2021 17:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DHxDhV010785; Tue, 13 Jul 2021 17:59:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DHxD0v010784; Tue, 13 Jul 2021 17:59:13 GMT (envelope-from git) Date: Tue, 13 Jul 2021 17:59:13 GMT Message-Id: <202107131759.16DHxD0v010784@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 67d02e13011f - stable/13 - vmm: Fix ivrs_drv device_printf usage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 67d02e13011fa80786a243c9464cea248de4c127 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 17:59:13 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=67d02e13011fa80786a243c9464cea248de4c127 commit 67d02e13011fa80786a243c9464cea248de4c127 Author: Ka Ho Ng AuthorDate: 2021-06-19 06:05:13 +0000 Commit: Ka Ho Ng CommitDate: 2021-07-13 17:58:56 +0000 vmm: Fix ivrs_drv device_printf usage The original %b description string is wrong. Sponsored by: The FreeBSD Foundation Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D30805 (cherry picked from commit 210e6aec4f83ee0efef348ed9dd86be7592596a1) --- sys/amd64/vmm/amd/ivrs_drv.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/amd64/vmm/amd/ivrs_drv.c b/sys/amd64/vmm/amd/ivrs_drv.c index 1cd76069d0a2..cdc66f3ecce0 100644 --- a/sys/amd64/vmm/amd/ivrs_drv.c +++ b/sys/amd64/vmm/amd/ivrs_drv.c @@ -467,7 +467,7 @@ ivhd_print_flag(device_t dev, enum IvrsType ivhd_type, uint8_t flag) "\005IotlbSup" "\006Coherent" "\007PreFSup" - "\008PPRSup"); + "\010PPRSup"); break; case IVRS_TYPE_HARDWARE_EFR: @@ -557,9 +557,9 @@ ivhd_print_ext_feature(device_t dev, uint64_t ext_feature) "\005GTSup" "\006" "\007IASup" - "\008GASup" - "\009HESup" - "\010PCSup", + "\010GASup" + "\011HESup" + "\012PCSup", REG_BITS(ext_low, 11, 10), REG_BITS(ext_low, 13, 12), REG_BITS(ext_low, 15, 14), @@ -576,17 +576,17 @@ ivhd_print_ext_feature(device_t dev, uint64_t ext_feature) (int)(ext_high), "\020" "\006USSup" - "\009PprOvrflwEarlySup" - "\010PPRAutoRspSup" - "\013BlKStopMrkSup" - "\014PerfOptSup" - "\015MsiCapMmioSup" - "\017GIOSup" - "\018HASup" - "\019EPHSup" - "\020AttrFWSup" - "\021HDSup" - "\023InvIotlbSup", + "\011PprOvrflwEarlySup" + "\012PPRAutoRspSup" + "\015BlKStopMrkSup" + "\016PerfOptSup" + "\017MsiCapMmioSup" + "\021GIOSup" + "\022HASup" + "\023EPHSup" + "\024AttrFWSup" + "\025HDSup" + "\027InvIotlbSup", REG_BITS(ext_high, 5, 0), REG_BITS(ext_high, 8, 7), REG_BITS(ext_high, 11, 10)); From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 18:27:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9299B663060; Tue, 13 Jul 2021 18:27:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPTd13YC6z4j5v; Tue, 13 Jul 2021 18:27:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 617A9272A9; Tue, 13 Jul 2021 18:27:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DIRHx1050979; Tue, 13 Jul 2021 18:27:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DIRHfW050978; Tue, 13 Jul 2021 18:27:17 GMT (envelope-from git) Date: Tue, 13 Jul 2021 18:27:17 GMT Message-Id: <202107131827.16DIRHfW050978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: c5ba872129b3 - stable/13 - tcp: tolerate missing timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c5ba872129b3afee95953294fbe55e014559d408 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 18:27:17 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=c5ba872129b3afee95953294fbe55e014559d408 commit c5ba872129b3afee95953294fbe55e014559d408 Author: Michael Tuexen AuthorDate: 2021-06-11 18:14:34 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 18:24:09 +0000 tcp: tolerate missing timestamps Some TCP stacks negotiate TS support, but do not send TS at all or not for keep-alive segments. Since this includes modern widely deployed stacks, tolerate the violation of RFC 7323 per default. Reviewed by: rgrimes, rrs, rscheff Differential Revision: https://reviews.freebsd.org/D30740 Sponsored by: Netflix, Inc. (cherry picked from commit 870af3f4dc57a6bbfc03f6a49ca0d5b7ff1b975a) --- share/man/man4/tcp.4 | 6 ++++-- sys/netinet/tcp_subr.c | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index 0b59e2ec801d..86c289c5bec5 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 24, 2021 +.Dd June 27, 2021 .Dt TCP 4 .Os .Sh NAME @@ -382,7 +382,9 @@ segments belonging to connections for which support of .Tn TCP timestamps has been negotiated. -(default is 0, i.e., the missing of timestamps is not tolerated). +As of June 2021, several TCP stacks are known to violate RFC 7323, including +modern widely deployed ones. +Therefore the default is 1, i.e., the missing of timestamps is tolerated. .It Dv TCPCTL_MSSDFLT .Pq Va mssdflt The default value used for the maximum segment size diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 32a814ac2c4e..c3afb3a1567a 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -268,7 +268,14 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc1323), 0, "Enable rfc1323 (high performance TCP) extensions"); -VNET_DEFINE(int, tcp_tolerate_missing_ts) = 0; +/* + * As of June 2021, several TCP stacks violate RFC 7323 from September 2014. + * Some stacks negotiate TS, but never send them after connection setup. Some + * stacks negotiate TS, but don't send them when sending keep-alive segments. + * These include modern widely deployed TCP stacks. + * Therefore tolerating violations for now... + */ +VNET_DEFINE(int, tcp_tolerate_missing_ts) = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, tolerate_missing_ts, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_tolerate_missing_ts), 0, "Tolerate missing TCP timestamps"); From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 18:28:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09351662FE7; Tue, 13 Jul 2021 18:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPTfD6xbZz4jCP; Tue, 13 Jul 2021 18:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D52BE272AA; Tue, 13 Jul 2021 18:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DISKLh051164; Tue, 13 Jul 2021 18:28:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DISKc9051163; Tue, 13 Jul 2021 18:28:20 GMT (envelope-from git) Date: Tue, 13 Jul 2021 18:28:20 GMT Message-Id: <202107131828.16DISKc9051163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 24df96b64253 - stable/13 - sctp: Fix length check for ECNE chunks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 24df96b642531eb62572599d28f932590be9ba20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 18:28:21 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=24df96b642531eb62572599d28f932590be9ba20 commit 24df96b642531eb62572599d28f932590be9ba20 Author: Michael Tuexen AuthorDate: 2021-06-27 14:10:39 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 18:27:58 +0000 sctp: Fix length check for ECNE chunks (cherry picked from commit 6587a2bd1e88b5b99aea114e3d20b0d4c48c95df) --- sys/netinet/sctp_input.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 442e58afd0ff..b822c9eae2ca 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2887,10 +2887,6 @@ sctp_handle_ecn_echo(struct sctp_ecne_chunk *cp, unsigned int pkt_cnt; len = ntohs(cp->ch.chunk_length); - if ((len != sizeof(struct sctp_ecne_chunk)) && - (len != sizeof(struct old_sctp_ecne_chunk))) { - return; - } if (len == sizeof(struct old_sctp_ecne_chunk)) { /* Its the old format */ memcpy(&bkup, cp, sizeof(struct old_sctp_ecne_chunk)); @@ -5022,7 +5018,8 @@ process_control_chunks: if (stcb->asoc.ecn_supported == 0) { goto unknown_chunk; } - if (chk_length != sizeof(struct sctp_ecne_chunk)) { + if ((chk_length != sizeof(struct sctp_ecne_chunk)) && + (chk_length != sizeof(struct old_sctp_ecne_chunk))) { break; } sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, stcb); From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 18:29:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E172662FF6; Tue, 13 Jul 2021 18:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPTg016qxz4jFf; Tue, 13 Jul 2021 18:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EB2F27523; Tue, 13 Jul 2021 18:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DISxCL051315; Tue, 13 Jul 2021 18:28:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DISx8i051314; Tue, 13 Jul 2021 18:28:59 GMT (envelope-from git) Date: Tue, 13 Jul 2021 18:28:59 GMT Message-Id: <202107131828.16DISx8i051314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 6a4f29a3c48d - stable/13 - sctp: initialize sequence numbers for ECN correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6a4f29a3c48dd709e68c00b4925ded4bebadd0b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 18:29:00 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6a4f29a3c48dd709e68c00b4925ded4bebadd0b3 commit 6a4f29a3c48dd709e68c00b4925ded4bebadd0b3 Author: Michael Tuexen AuthorDate: 2021-06-27 18:14:48 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 18:28:48 +0000 sctp: initialize sequence numbers for ECN correctly Reported by: Junseok Yang (for the userland stack) (cherry picked from commit c7f048ab3532a9f081addd6da0adf96f25271de8) --- sys/netinet/sctp_input.c | 11 ++--------- sys/netinet/sctp_output.c | 2 +- sys/netinet/sctp_pcb.c | 6 +++--- sys/netinet/sctp_pcb.h | 4 ++-- sys/netinet/sctp_usrreq.c | 4 ++-- sys/netinet/sctputil.c | 22 ++++++++++++++-------- sys/netinet/sctputil.h | 2 +- sys/netinet6/sctp6_usrreq.c | 2 +- 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index b822c9eae2ca..6a0b5d41052a 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2053,7 +2053,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, * getting a cookie, we cannot be unbound. */ stcb = sctp_aloc_assoc(inp, init_src, &error, - ntohl(initack_cp->init.initiate_tag), vrf_id, + ntohl(initack_cp->init.initiate_tag), + ntohl(initack_cp->init.initial_tsn), vrf_id, ntohs(initack_cp->init.num_outbound_streams), port, (struct thread *)NULL, @@ -2097,15 +2098,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, return (NULL); } /* process the INIT-ACK info (my info) */ - asoc->my_vtag = ntohl(initack_cp->init.initiate_tag); asoc->my_rwnd = ntohl(initack_cp->init.a_rwnd); - asoc->init_seq_number = ntohl(initack_cp->init.initial_tsn); - asoc->sending_seq = asoc->asconf_seq_out = asoc->str_reset_seq_out = asoc->init_seq_number; - asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1; - asoc->asconf_seq_in = asoc->last_acked_seq = asoc->init_seq_number - 1; - asoc->str_reset_seq_in = asoc->init_seq_number; - - asoc->advanced_peer_ack_point = asoc->last_acked_seq; /* process the INIT info (peer's info) */ if (sctp_process_init(init_cp, stcb) < 0) { diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 0f7ade931e61..c69db88f7d7d 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12703,7 +12703,7 @@ sctp_lower_sosend(struct socket *so, panic("Error, should hold create lock and I don't?"); } #endif - stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, + stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 08acccbf9185..ce4850469144 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4154,8 +4154,8 @@ try_again: */ struct sctp_tcb * sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, - int *error, uint32_t override_tag, uint32_t vrf_id, - uint16_t o_streams, uint16_t port, + int *error, uint32_t override_tag, uint32_t initial_tsn, + uint32_t vrf_id, uint16_t o_streams, uint16_t port, struct thread *p, int initialize_auth_params) { @@ -4312,7 +4312,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, /* setup back pointer's */ stcb->sctp_ep = inp; stcb->sctp_socket = inp->sctp_socket; - if ((err = sctp_init_asoc(inp, stcb, override_tag, vrf_id, o_streams))) { + if ((err = sctp_init_asoc(inp, stcb, override_tag, initial_tsn, vrf_id, o_streams))) { /* failed */ SCTP_TCB_LOCK_DESTROY(stcb); SCTP_TCB_SEND_LOCK_DESTROY(stcb); diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index 08ca30a45803..c978e8c72b42 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -573,8 +573,8 @@ void sctp_inpcb_free(struct sctp_inpcb *, int, int); struct sctp_tcb * sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *, - int *, uint32_t, uint32_t, uint16_t, uint16_t, struct thread *, - int); + int *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, + struct thread *, int); int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 238c20c0e368..6308cabf5d63 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -1425,7 +1425,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval, vrf_id = inp->def_vrf_id; /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, sa, &error, 0, vrf_id, + stcb = sctp_aloc_assoc(inp, sa, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, (struct thread *)p, @@ -7076,7 +7076,7 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p) vrf_id = inp->def_vrf_id; /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, + stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, SCTP_INITIALIZE_AUTH_PARAMS); diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 82fc38b39ff7..aec2298e26b2 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1112,7 +1112,8 @@ sctp_map_assoc_state(int kernel_state) int sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - uint32_t override_tag, uint32_t vrf_id, uint16_t o_strms) + uint32_t override_tag, uint32_t initial_tsn, uint32_t vrf_id, + uint16_t o_strms) { struct sctp_association *asoc; @@ -1190,9 +1191,15 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, #endif asoc->refcnt = 0; asoc->assoc_up_sent = 0; - asoc->asconf_seq_out = asoc->str_reset_seq_out = asoc->init_seq_number = asoc->sending_seq = - sctp_select_initial_TSN(&inp->sctp_ep); - asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1; + if (override_tag) { + asoc->init_seq_number = initial_tsn; + } else { + asoc->init_seq_number = sctp_select_initial_TSN(&inp->sctp_ep); + } + asoc->asconf_seq_out = asoc->init_seq_number; + asoc->str_reset_seq_out = asoc->init_seq_number; + asoc->sending_seq = asoc->init_seq_number; + asoc->asconf_seq_out_acked = asoc->init_seq_number - 1; /* we are optimisitic here */ asoc->peer_supports_nat = 0; asoc->sent_queue_retran_cnt = 0; @@ -1200,13 +1207,12 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* for CMT */ asoc->last_net_cmt_send_started = NULL; - /* This will need to be adjusted */ asoc->last_acked_seq = asoc->init_seq_number - 1; - asoc->advanced_peer_ack_point = asoc->last_acked_seq; - asoc->asconf_seq_in = asoc->last_acked_seq; + asoc->advanced_peer_ack_point = asoc->init_seq_number - 1; + asoc->asconf_seq_in = asoc->init_seq_number - 1; /* here we are different, we hold the next one we expect */ - asoc->str_reset_seq_in = asoc->last_acked_seq + 1; + asoc->str_reset_seq_in = asoc->init_seq_number; asoc->initial_init_rto_max = inp->sctp_ep.initial_init_rto_max; asoc->initial_rto = inp->sctp_ep.initial_rto; diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index 2e054c9d37e3..c81633223224 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -79,7 +79,7 @@ uint32_t sctp_select_initial_TSN(struct sctp_pcb *); uint32_t sctp_select_a_tag(struct sctp_inpcb *, uint16_t lport, uint16_t rport, int); -int sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t, uint16_t); +int sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t, uint32_t, uint16_t); void sctp_fill_random_store(struct sctp_pcb *); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 3be7a3e25de8..09371ce249db 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -943,7 +943,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p) return (EALREADY); } /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, + stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, SCTP_INITIALIZE_AUTH_PARAMS); From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 18:30:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 688D1663240; Tue, 13 Jul 2021 18:30:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPThB29DQz4jZH; Tue, 13 Jul 2021 18:30:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3358B27525; Tue, 13 Jul 2021 18:30:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DIU2uX053258; Tue, 13 Jul 2021 18:30:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DIU2rF053255; Tue, 13 Jul 2021 18:30:02 GMT (envelope-from git) Date: Tue, 13 Jul 2021 18:30:02 GMT Message-Id: <202107131830.16DIU2rF053255@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 7f21500f4912 - stable/13 - sctp: provide sac_error also for ABORT chunk being sent MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7f21500f491257f3506deb5e036eb0c1600d92d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 18:30:02 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=7f21500f491257f3506deb5e036eb0c1600d92d0 commit 7f21500f491257f3506deb5e036eb0c1600d92d0 Author: Michael Tuexen AuthorDate: 2021-07-09 11:46:27 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 18:29:33 +0000 sctp: provide sac_error also for ABORT chunk being sent Thanks to Florent Castelli for bringing this issue up for the userland stack and providing an initial patch. (cherry picked from commit 84992a3251d56df3bc36e0ac33ba383f41107864) --- sys/netinet/sctputil.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index aec2298e26b2..1f909fa1d8d4 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -4367,19 +4367,29 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t mflowtype, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { + struct sctp_gen_error_cause *cause; uint32_t vtag; + uint16_t cause_code; - vtag = 0; if (stcb != NULL) { vtag = stcb->asoc.peer_vtag; vrf_id = stcb->asoc.vrf_id; + if (op_err != NULL) { + /* Read the cause code from the error cause. */ + cause = mtod(op_err, struct sctp_gen_error_cause *); + cause_code = ntohs(cause->code); + } else { + cause_code = 0; + } + } else { + vtag = 0; } sctp_send_abort(m, iphlen, src, dst, sh, vtag, op_err, mflowtype, mflowid, inp->fibnum, vrf_id, port); if (stcb != NULL) { /* We have a TCB to abort, send notification too */ - sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, cause_code, NULL, SCTP_SO_NOT_LOCKED); /* Ok, now lets free it */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -4458,6 +4468,8 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct mbuf *op_err, int so_locked) { + struct sctp_gen_error_cause *cause; + uint16_t cause_code; if (stcb == NULL) { /* Got to have a TCB */ @@ -4469,6 +4481,13 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } return; } + if (op_err != NULL) { + /* Read the cause code from the error cause. */ + cause = mtod(op_err, struct sctp_gen_error_cause *); + cause_code = ntohs(cause->code); + } else { + cause_code = 0; + } /* notify the peer */ sctp_send_abort_tcb(stcb, op_err, so_locked); SCTP_STAT_INCR_COUNTER32(sctps_aborted); @@ -4478,7 +4497,7 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* notify the ulp */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - sctp_abort_notification(stcb, 0, 0, NULL, so_locked); + sctp_abort_notification(stcb, 0, cause_code, NULL, so_locked); } /* now free the asoc */ #ifdef SCTP_ASOCLOG_OF_TSNS From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 18:30:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54FA7662ED8; Tue, 13 Jul 2021 18:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPThx1tM0z4jVN; Tue, 13 Jul 2021 18:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28B1727528; Tue, 13 Jul 2021 18:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DIUfsm059872; Tue, 13 Jul 2021 18:30:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DIUfK1059871; Tue, 13 Jul 2021 18:30:41 GMT (envelope-from git) Date: Tue, 13 Jul 2021 18:30:41 GMT Message-Id: <202107131830.16DIUfK1059871@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 9e8d5ea2b557 - stable/13 - sctp: provide consistent stream information in case of early errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9e8d5ea2b5579eee381375bb10a40b6c7197f1d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 18:30:41 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=9e8d5ea2b5579eee381375bb10a40b6c7197f1d6 commit 9e8d5ea2b5579eee381375bb10a40b6c7197f1d6 Author: Michael Tuexen AuthorDate: 2021-07-09 12:15:22 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 18:30:21 +0000 sctp: provide consistent stream information in case of early errors While there, make sure the function is called correctly. (cherry picked from commit ce64352a702db1fef8c0e33f3a6f13a3e5d92736) --- sys/netinet/sctputil.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 1f909fa1d8d4..21e49bdfcb23 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -3163,6 +3163,8 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, uint16_t abort_len; unsigned int i; + KASSERT((abort == NULL) || (from_peer != 0), + ("sctp_notify_assoc_change: ABORT chunk provided for local termination")); if (stcb == NULL) { return; } @@ -3202,9 +3204,13 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, sac->sac_length = sizeof(struct sctp_assoc_change); sac->sac_state = state; sac->sac_error = error; - /* XXX verify these stream counts */ - sac->sac_outbound_streams = stcb->asoc.streamoutcnt; - sac->sac_inbound_streams = stcb->asoc.streamincnt; + if (state == SCTP_CANT_STR_ASSOC) { + sac->sac_outbound_streams = 0; + sac->sac_inbound_streams = 0; + } else { + sac->sac_outbound_streams = stcb->asoc.streamoutcnt; + sac->sac_inbound_streams = stcb->asoc.streamincnt; + } sac->sac_assoc_id = sctp_get_associd(stcb); if (notif_len > sizeof(struct sctp_assoc_change)) { if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 18:31:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D6BD66341B; Tue, 13 Jul 2021 18:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPTjj17QVz4jdx; Tue, 13 Jul 2021 18:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B9042753A; Tue, 13 Jul 2021 18:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DIVLSq064281; Tue, 13 Jul 2021 18:31:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DIVKBo064279; Tue, 13 Jul 2021 18:31:20 GMT (envelope-from git) Date: Tue, 13 Jul 2021 18:31:20 GMT Message-Id: <202107131831.16DIVKBo064279@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: a3f96f1e5740 - stable/13 - sctp: Fix errno in case of association setup failures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3f96f1e5740e7b0648bab091083cb2c2e9d289b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 18:31:21 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=a3f96f1e5740e7b0648bab091083cb2c2e9d289b commit a3f96f1e5740e7b0648bab091083cb2c2e9d289b Author: Michael Tuexen AuthorDate: 2021-07-09 21:17:35 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 18:30:57 +0000 sctp: Fix errno in case of association setup failures Do not report always ETIMEDOUT, but only when appropriate. In other cases report ECONNABORTED. (cherry picked from commit 105b68b42dd11bce5c554b1ef0ddf73aa069d7da) --- sys/netinet/sctp_asconf.c | 2 +- sys/netinet/sctp_constants.h | 1 + sys/netinet/sctp_indata.c | 34 ++++++++++++++--------------- sys/netinet/sctp_input.c | 8 +++---- sys/netinet/sctp_output.c | 10 ++++----- sys/netinet/sctp_pcb.c | 4 ++-- sys/netinet/sctp_timer.c | 4 ++-- sys/netinet/sctp_usrreq.c | 4 ++-- sys/netinet/sctputil.c | 52 ++++++++++++++++++++++++++++---------------- sys/netinet/sctputil.h | 4 ++-- sys/netinet6/sctp6_usrreq.c | 2 +- 11 files changed, 70 insertions(+), 55 deletions(-) diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index c06ddf7b1f2e..0915e187ee40 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -1704,7 +1704,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n"); SCTP_SNPRINTF(msg, sizeof(msg), "Never sent serial number %8.8x", serial_num); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return; } diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h index 197b93791944..1ff3f3918ef6 100644 --- a/sys/netinet/sctp_constants.h +++ b/sys/netinet/sctp_constants.h @@ -716,6 +716,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_NO_PEER_AUTH 25 #define SCTP_NOTIFY_SENDER_DRY 26 #define SCTP_NOTIFY_REMOTE_ERROR 27 +#define SCTP_NOTIFY_ASSOC_TIMEDOUT 28 /* This is the value for messages that are NOT completely * copied down where we will start to split the message. diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index 6997a0099c88..fb1327a94475 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -444,7 +444,7 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, chk->data = NULL; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_1; - sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } @@ -533,7 +533,7 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -623,7 +623,7 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, sctp_clean_up_control(stcb, control); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } } @@ -1745,7 +1745,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, */ op_err = sctp_generate_no_user_data_cause(tsn); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -1811,7 +1811,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, * receiver. Send peer an ABORT! */ op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -1882,7 +1882,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, err_out: op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -2017,7 +2017,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_18; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -2736,7 +2736,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "%s", "DATA chunk received when I-DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if ((asoc->idata_supported == 0) && @@ -2747,7 +2747,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-DATA chunk received when DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_22; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if ((ch->chunk_type == SCTP_DATA) || @@ -2772,7 +2772,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_23; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } #ifdef SCTP_AUDITING_ENABLED @@ -2841,7 +2841,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "DATA chunk followed by chunk of type %2.2x", ch->chunk_type); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } default: @@ -2860,7 +2860,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "Chunk of length %u", chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if (ch->chunk_type & 0x40) { @@ -4003,7 +4003,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, cumack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } asoc->this_sack_highest_gap = cumack; @@ -4308,7 +4308,7 @@ again: /* XXX */ op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_28; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && @@ -4524,7 +4524,7 @@ hopeless_peer: cum_ack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_29; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } /**********************/ @@ -4985,7 +4985,7 @@ hopeless_peer: /* XXX */ op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_35; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && @@ -5533,7 +5533,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, new_cum_tsn, asoc->highest_tsn_inside_map); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_37; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } SCTP_STAT_INCR(sctps_fwdtsn_map_over); diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 6a0b5d41052a..ed15b81ba3e5 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -414,7 +414,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, &nat_friendly, &cookie_found); if (abort_flag) { /* Send an abort and notify peer */ - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return (-1); } @@ -785,7 +785,7 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_INPUT + SCTP_LOC_7); /* notify user of the abort and clean up... */ - sctp_abort_notification(stcb, 1, error, abort, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, error, abort, SCTP_SO_NOT_LOCKED); /* free the tcb */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -1140,7 +1140,7 @@ sctp_handle_error(struct sctp_chunkhdr *ch, asoc->stale_cookie_count++; if (asoc->stale_cookie_count > asoc->max_init_times) { - sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, false, true, 0, NULL, SCTP_SO_NOT_LOCKED); /* now free the asoc */ (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_12); @@ -5106,7 +5106,7 @@ process_control_chunks: SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-FORWARD-TSN chunk received when FORWARD-TSN was negotiated"); } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *offset = length; return (NULL); } diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index c69db88f7d7d..e34534e80fa3 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6631,7 +6631,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, * us. */ atomic_add_int(&stcb->asoc.refcnt, 1); - sctp_abort_an_association(inp, stcb, m, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, m, false, SCTP_SO_NOT_LOCKED); /* * sctp_abort_an_association calls sctp_free_asoc() free * association will NOT free it since we incremented the @@ -6715,7 +6715,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, msg); atomic_add_int(&stcb->asoc.refcnt, 1); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_NOT_LOCKED); + op_err, false, SCTP_SO_NOT_LOCKED); atomic_add_int(&stcb->asoc.refcnt, -1); goto no_chunk_output; } @@ -9555,7 +9555,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, msg); atomic_add_int(&stcb->asoc.refcnt, 1); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, - so_locked); + false, so_locked); SCTP_TCB_LOCK(stcb); atomic_subtract_int(&stcb->asoc.refcnt, 1); return (SCTP_RETRAN_EXIT); @@ -12967,7 +12967,7 @@ sctp_lower_sosend(struct socket *so, free_cnt_applied = 0; /* release this lock, otherwise we hang on ourselves */ NET_EPOCH_ENTER(et); - sctp_abort_an_association(stcb->sctp_ep, stcb, mm, SCTP_SO_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, mm, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); /* now relock the stcb so everything is sane */ hold_tcblock = 0; @@ -13544,7 +13544,7 @@ dataless_eof: msg); NET_EPOCH_ENTER(et); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_LOCKED); + op_err, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); /* * now relock the stcb so everything diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index ce4850469144..bdc575de615f 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -6198,7 +6198,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, op_err, + stcb_tmp, op_err, false, SCTP_SO_NOT_LOCKED); goto add_it_now; } @@ -6298,7 +6298,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, op_err, + stcb_tmp, op_err, false, SCTP_SO_NOT_LOCKED); goto add_it_now6; } diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 582abd8e8854..2d3836829e89 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -157,7 +157,7 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Association error counter exceeded"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_2; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, true, SCTP_SO_NOT_LOCKED); return (1); } return (0); @@ -1071,7 +1071,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Cookie timer expired, but no cookie"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_3; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); } else { #ifdef INVARIANTS panic("Cookie timer expires in wrong state?"); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 6308cabf5d63..822a8ffb534f 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -189,7 +189,7 @@ sctp_notify(struct sctp_inpcb *inp, } else if ((icmp_code == ICMP_UNREACH_PROTOCOL) || (icmp_code == ICMP_UNREACH_PORT)) { /* Treat it like an ABORT. */ - sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, 0, NULL, SCTP_SO_NOT_LOCKED); (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_2); /* no need to unlock here, since the TCB is gone */ @@ -960,7 +960,7 @@ sctp_shutdown(struct socket *so) stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; SCTP_INP_RUNLOCK(inp); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_LOCKED); + op_err, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); return (0); } diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 21e49bdfcb23..ad4409f666df 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1998,7 +1998,7 @@ sctp_timeout_handler(void *t) SCTP_STAT_INCR(sctps_timoshutdownguard); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Shutdown guard timer expired"); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, true, SCTP_SO_NOT_LOCKED); /* no need to unlock on tcb its gone */ goto out_decr; case SCTP_TIMER_TYPE_AUTOCLOSE: @@ -3154,7 +3154,8 @@ sctp_pad_lastmbuf(struct mbuf *m, int padval, struct mbuf *last_mbuf) static void sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, - uint16_t error, struct sctp_abort_chunk *abort, uint8_t from_peer, int so_locked) + uint16_t error, struct sctp_abort_chunk *abort, + bool from_peer, bool timedout, int so_locked) { struct mbuf *m_notify; struct sctp_assoc_change *sac; @@ -3163,8 +3164,10 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, uint16_t abort_len; unsigned int i; - KASSERT((abort == NULL) || (from_peer != 0), + KASSERT(abort == NULL || from_peer, ("sctp_notify_assoc_change: ABORT chunk provided for local termination")); + KASSERT(!from_peer || !timedout, + ("sctp_notify_assoc_change: timeouts can only be local")); if (stcb == NULL) { return; } @@ -3272,8 +3275,7 @@ set_error: stcb->sctp_socket->so_error = ECONNRESET; } } else { - if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || - (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { + if (timedout) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ETIMEDOUT); stcb->sctp_socket->so_error = ETIMEDOUT; } else { @@ -4085,7 +4087,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, switch (notification) { case SCTP_NOTIFY_ASSOC_UP: if (stcb->asoc.assoc_up_sent == 0) { - sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, false, false, so_locked); stcb->asoc.assoc_up_sent = 1; } if (stcb->asoc.adaptation_needed && (stcb->asoc.adaptation_sent == 0)) { @@ -4097,7 +4099,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, } break; case SCTP_NOTIFY_ASSOC_DOWN: - sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, false, false, so_locked); break; case SCTP_NOTIFY_INTERFACE_DOWN: { @@ -4150,21 +4152,29 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, case SCTP_NOTIFY_ASSOC_LOC_ABORTED: if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, 0, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, false, false, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 0, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, false, false, so_locked); } break; case SCTP_NOTIFY_ASSOC_REM_ABORTED: if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, 1, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, true, false, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 1, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, true, false, so_locked); + } + break; + case SCTP_NOTIFY_ASSOC_TIMEDOUT: + if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || + (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, false, true, so_locked); + } else { + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, false, true, so_locked); } break; case SCTP_NOTIFY_ASSOC_RESTART: - sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, false, false, so_locked); if (stcb->asoc.auth_supported == 0) { sctp_ulp_notify(SCTP_NOTIFY_NO_PEER_AUTH, stcb, 0, NULL, so_locked); @@ -4337,8 +4347,9 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int so_locked) } void -sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error, - struct sctp_abort_chunk *abort, int so_locked) +sctp_abort_notification(struct sctp_tcb *stcb, bool from_peer, bool timeout, + uint16_t error, struct sctp_abort_chunk *abort, + int so_locked) { if (stcb == NULL) { return; @@ -4361,7 +4372,11 @@ sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error if (from_peer) { sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); } else { - sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); + if (timeout) { + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_TIMEDOUT, stcb, error, abort, so_locked); + } else { + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); + } } } @@ -4395,7 +4410,7 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, vrf_id, port); if (stcb != NULL) { /* We have a TCB to abort, send notification too */ - sctp_abort_notification(stcb, 0, cause_code, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, false, false, cause_code, NULL, SCTP_SO_NOT_LOCKED); /* Ok, now lets free it */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -4471,8 +4486,7 @@ none_in: void sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct mbuf *op_err, - int so_locked) + struct mbuf *op_err, bool timedout, int so_locked) { struct sctp_gen_error_cause *cause; uint16_t cause_code; @@ -4503,7 +4517,7 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* notify the ulp */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - sctp_abort_notification(stcb, 0, cause_code, NULL, so_locked); + sctp_abort_notification(stcb, false, timedout, cause_code, NULL, so_locked); } /* now free the asoc */ #ifdef SCTP_ASOCLOG_OF_TSNS diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index c81633223224..3319eb4f455b 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -167,7 +167,7 @@ void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int); int sctp_expand_mapping_array(struct sctp_association *, uint32_t); void -sctp_abort_notification(struct sctp_tcb *, uint8_t, uint16_t, +sctp_abort_notification(struct sctp_tcb *, bool, bool, uint16_t, struct sctp_abort_chunk *, int); /* We abort responding to an IP packet for some reason */ @@ -181,7 +181,7 @@ sctp_abort_association(struct sctp_inpcb *, struct sctp_tcb *, struct mbuf *, /* We choose to abort via user input */ void sctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int); + struct mbuf *, bool, int); void sctp_handle_ootb(struct mbuf *, int, int, diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 09371ce249db..6f5d639e6367 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -200,7 +200,7 @@ sctp6_notify(struct sctp_inpcb *inp, case ICMP6_PARAM_PROB: /* Treat it like an ABORT. */ if (icmp6_code == ICMP6_PARAMPROB_NEXTHEADER) { - sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, 0, NULL, SCTP_SO_NOT_LOCKED); (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_2); } else { From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 18:53:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86C20663988; Tue, 13 Jul 2021 18:53:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPVBx389Rz4n9Q; Tue, 13 Jul 2021 18:53:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5383C274CF; Tue, 13 Jul 2021 18:53:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DIrDfY091169; Tue, 13 Jul 2021 18:53:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DIrDS1091168; Tue, 13 Jul 2021 18:53:13 GMT (envelope-from git) Date: Tue, 13 Jul 2021 18:53:13 GMT Message-Id: <202107131853.16DIrDS1091168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 648c68168c24 - stable/13 - tcp: Rack not being very friendly with V6:4 socket and having a connection from V4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 648c68168c24592967df9d9c6a4d79e1792e4562 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 18:53:13 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=648c68168c24592967df9d9c6a4d79e1792e4562 commit 648c68168c24592967df9d9c6a4d79e1792e4562 Author: Randall Stewart AuthorDate: 2021-06-24 18:42:21 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 18:51:55 +0000 tcp: Rack not being very friendly with V6:4 socket and having a connection from V4 There were two bugs that prevented V4 sockets from connecting to a rack server running a V4/V6 socket. As well as a bug that stops the mapped v4 in V6 address from working. Reviewed by: tuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30885 PR: 256657 (cherry picked from commit 66aec14a5391bda1e9a20f5e4381626797c3e0fb) --- sys/netinet/tcp_stacks/rack.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index dc3c8d47dc31..79eec2a7d063 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12491,6 +12491,9 @@ rack_fini(struct tcpcb *tp, int32_t tcb_is_purged) static void rack_set_state(struct tcpcb *tp, struct tcp_rack *rack) { + if ((rack->r_state == TCPS_CLOSED) && (tp->t_state != TCPS_CLOSED)) { + rack->r_is_v6 = (tp->t_inpcb->inp_vflag & INP_IPV6) != 0; + } switch (tp->t_state) { case TCPS_SYN_SENT: rack->r_state = TCPS_SYN_SENT; @@ -16215,7 +16218,7 @@ rack_output(struct tcpcb *tp) } idle = 0; } - if (rack_use_fsb && (rack->r_fsb_inited == 0)) + if (rack_use_fsb && (rack->r_fsb_inited == 0) && (rack->r_state != TCPS_CLOSED)) rack_init_fsb_block(tp, rack); again: /* From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 20:34:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14A2466521E; Tue, 13 Jul 2021 20:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPXS05CGMz3KFJ; Tue, 13 Jul 2021 20:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C4CFDEA; Tue, 13 Jul 2021 20:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DKYefp025772; Tue, 13 Jul 2021 20:34:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DKYeOh025771; Tue, 13 Jul 2021 20:34:40 GMT (envelope-from git) Date: Tue, 13 Jul 2021 20:34:40 GMT Message-Id: <202107132034.16DKYeOh025771@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 1843b06deeb2 - stable/13 - tcp: enter network epoch when calling tfb_tcp_fb_fini MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1843b06deeb22ae5990d5a0308bebaad1bd27e98 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 20:34:41 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=1843b06deeb22ae5990d5a0308bebaad1bd27e98 commit 1843b06deeb22ae5990d5a0308bebaad1bd27e98 Author: Andrew Gallatin AuthorDate: 2021-05-25 17:45:37 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 19:54:43 +0000 tcp: enter network epoch when calling tfb_tcp_fb_fini We need to enter the network epoch when calling into tfb_tcp_fb_fini. I noticed this when I hit an assert running the latest rack Differential Revision: https://reviews.freebsd.org/D30407 Reviewed by: rrs, tuexen Sponsored by: Netflix (cherry picked from commit 086a35562f47917a516d30acc8b78a4884e31a4f) --- sys/netinet/tcp_usrreq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index bd847426681e..cf62eeeb18d5 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1825,11 +1825,14 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) * new one already. */ if (tp->t_fb->tfb_tcp_fb_fini) { + struct epoch_tracker et; /* * Tell the stack to cleanup with 0 i.e. * the tcb is not going away. */ + NET_EPOCH_ENTER(et); (*tp->t_fb->tfb_tcp_fb_fini)(tp, 0); + NET_EPOCH_EXIT(et); } #ifdef TCPHPTS /* Assure that we are not on any hpts */ From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 20:36:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 843B3664F6B; Tue, 13 Jul 2021 20:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPXV33LD2z3KZ8; Tue, 13 Jul 2021 20:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B84E108A; Tue, 13 Jul 2021 20:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DKaRFh026010; Tue, 13 Jul 2021 20:36:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DKaRmU026009; Tue, 13 Jul 2021 20:36:27 GMT (envelope-from git) Date: Tue, 13 Jul 2021 20:36:27 GMT Message-Id: <202107132036.16DKaRmU026009@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 2e1fdc728b81 - stable/13 - tcp: Preparation for allowing hardware TLS to be able to kick a tcp connection that is retransmitting too much out of hardware and back to software. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e1fdc728b8146cc528b20f1849ba8cb7be0efd9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 20:36:27 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=2e1fdc728b8146cc528b20f1849ba8cb7be0efd9 commit 2e1fdc728b8146cc528b20f1849ba8cb7be0efd9 Author: Randall Stewart AuthorDate: 2021-06-25 13:30:54 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 19:56:06 +0000 tcp: Preparation for allowing hardware TLS to be able to kick a tcp connection that is retransmitting too much out of hardware and back to software. Hardware TLS is now supported in some interface cards and it works well. Except that when we have connections that retransmit a lot we get into trouble with all the retransmits. This prep step makes way for change that Drew will be making so that we can "kick out" a session from hardware TLS. Reviewed by: tuexen, gallatin Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30895 (cherry picked from commit 9e4d9e4c4d79db58740a05d67645351e640aa32c) --- sys/netinet/tcp_output.c | 2 +- sys/netinet/tcp_stacks/bbr.c | 2 +- sys/netinet/tcp_stacks/rack.c | 68 +++++++++++++++++++++++++++++++-------- sys/netinet/tcp_stacks/tcp_rack.h | 6 ++-- sys/netinet/tcp_var.h | 6 ++-- 5 files changed, 63 insertions(+), 21 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 44333d772482..9a395f593162 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1552,7 +1552,7 @@ send: out: if (error == 0) - tcp_account_for_send(tp, len, (tp->snd_nxt != tp->snd_max), 0); + tcp_account_for_send(tp, len, (tp->snd_nxt != tp->snd_max), 0, hw_tls); /* * In transmit state, time the transmission and arrange for * the retransmit. In persist state, just set snd_max. diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 06975c45cdbd..aa507dcfa334 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -13750,7 +13750,7 @@ out: * retransmit. In persist state, just set snd_max. */ if (error == 0) { - tcp_account_for_send(tp, len, (rsm != NULL), doing_tlp); + tcp_account_for_send(tp, len, (rsm != NULL), doing_tlp, hw_tls); if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 79eec2a7d063..0b7de9b6292a 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ipsec.h" #include "opt_tcpdebug.h" #include "opt_ratelimit.h" +#include "opt_kern_tls.h" #include #include #include @@ -483,7 +484,7 @@ rack_log_ack(struct tcpcb *tp, struct tcpopt *to, static void rack_log_output(struct tcpcb *tp, struct tcpopt *to, int32_t len, uint32_t seq_out, uint8_t th_flags, int32_t err, uint64_t ts, - struct rack_sendmap *hintrsm, uint16_t add_flags, struct mbuf *s_mb, uint32_t s_moff); + struct rack_sendmap *hintrsm, uint16_t add_flags, struct mbuf *s_mb, uint32_t s_moff, int hw_tls); static void rack_log_sack_passed(struct tcpcb *tp, struct tcp_rack *rack, @@ -6061,7 +6062,8 @@ rack_clone_rsm(struct tcp_rack *rack, struct rack_sendmap *nrsm, /* Push bit must go to the right edge as well */ if (rsm->r_flags & RACK_HAD_PUSH) rsm->r_flags &= ~RACK_HAD_PUSH; - + /* Clone over the state of the hw_tls flag */ + nrsm->r_hw_tls = rsm->r_hw_tls; /* * Now we need to find nrsm's new location in the mbuf chain * we basically calculate a new offset, which is soff + @@ -7191,7 +7193,7 @@ rack_update_entry(struct tcpcb *tp, struct tcp_rack *rack, static void rack_log_output(struct tcpcb *tp, struct tcpopt *to, int32_t len, uint32_t seq_out, uint8_t th_flags, int32_t err, uint64_t cts, - struct rack_sendmap *hintrsm, uint16_t add_flag, struct mbuf *s_mb, uint32_t s_moff) + struct rack_sendmap *hintrsm, uint16_t add_flag, struct mbuf *s_mb, uint32_t s_moff, int hw_tls) { struct tcp_rack *rack; struct rack_sendmap *rsm, *nrsm, *insret, fe; @@ -7295,6 +7297,8 @@ again: } else { rsm->r_flags = add_flag; } + if (hw_tls) + rsm->r_hw_tls = 1; rsm->r_tim_lastsent[0] = cts; rsm->r_rtr_cnt = 1; rsm->r_rtr_bytes = 0; @@ -14875,7 +14879,7 @@ rack_log_fsb(struct tcp_rack *rack, struct tcpcb *tp, struct socket *so, uint32_ static struct mbuf * rack_fo_base_copym(struct mbuf *the_m, uint32_t the_off, int32_t *plen, struct rack_fast_send_blk *fsb, - int32_t seglimit, int32_t segsize) + int32_t seglimit, int32_t segsize, int hw_tls) { #ifdef KERN_TLS struct ktls_session *tls, *ntls; @@ -15059,7 +15063,7 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, *s_mb = rack->r_ctl.fsb.m; n = rack_fo_base_copym(m, soff, plen, &rack->r_ctl.fsb, - seglimit, segsize); + seglimit, segsize, rack->r_ctl.fsb.hw_tls); return (n); } @@ -15243,7 +15247,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma /* Fix up the orig_m_len and possibly the mbuf offset */ rack_adjust_orig_mlen(rsm); } - m->m_next = rack_fo_base_copym(rsm->m, rsm->soff, &len, NULL, if_hw_tsomaxsegcount, if_hw_tsomaxsegsize); + m->m_next = rack_fo_base_copym(rsm->m, rsm->soff, &len, NULL, if_hw_tsomaxsegcount, if_hw_tsomaxsegsize, rsm->r_hw_tls); if (len <= segsiz) { /* * Must have ran out of mbufs for the copy @@ -15405,13 +15409,13 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma goto failed; } rack_log_output(tp, &to, len, rsm->r_start, flags, error, rack_to_usec_ts(tv), - rsm, RACK_SENT_FP, rsm->m, rsm->soff); + rsm, RACK_SENT_FP, rsm->m, rsm->soff, rsm->r_hw_tls); if (doing_tlp && (rack->fast_rsm_hack == 0)) { rack->rc_tlp_in_progress = 1; rack->r_ctl.rc_tlp_cnt_out++; } if (error == 0) - tcp_account_for_send(tp, len, 1, doing_tlp); + tcp_account_for_send(tp, len, 1, doing_tlp, rsm->r_hw_tls); tp->t_flags &= ~(TF_ACKNOW | TF_DELACK); rack->forced_ack = 0; /* If we send something zap the FA flag */ if (IN_FASTRECOVERY(tp->t_flags) && rsm) @@ -15688,7 +15692,8 @@ again: goto failed; /* s_mb and s_soff are saved for rack_log_output */ - m->m_next = rack_fo_m_copym(rack, &len, if_hw_tsomaxsegcount, if_hw_tsomaxsegsize, &s_mb, &s_soff); + m->m_next = rack_fo_m_copym(rack, &len, if_hw_tsomaxsegcount, if_hw_tsomaxsegsize, + &s_mb, &s_soff); if (len <= segsiz) { /* * Must have ran out of mbufs for the copy @@ -15883,7 +15888,7 @@ again: goto failed; } rack_log_output(tp, &to, len, tp->snd_max, flags, error, rack_to_usec_ts(tv), - NULL, add_flag, s_mb, s_soff); + NULL, add_flag, s_mb, s_soff, rack->r_ctl.fsb.hw_tls); m = NULL; if (tp->snd_una == tp->snd_max) { rack->r_ctl.rc_tlp_rxt_last_time = cts; @@ -15891,7 +15896,7 @@ again: tp->t_acktime = ticks; } if (error == 0) - tcp_account_for_send(tp, len, 0, 0); + tcp_account_for_send(tp, len, 0, 0, rack->r_ctl.fsb.hw_tls); rack->forced_ack = 0; /* If we send something zap the FA flag */ tot_len += len; @@ -17030,6 +17035,10 @@ just_return_nolock: rack->r_ctl.fsb.o_m_len = rack->r_ctl.fsb.m->m_len; rack->r_ctl.fsb.tcp_flags = flags; rack->r_ctl.fsb.left_to_send = orig_len - len; + if (hw_tls) + rack->r_ctl.fsb.hw_tls = 1; + else + rack->r_ctl.fsb.hw_tls = 0; KASSERT((rack->r_ctl.fsb.left_to_send <= (sbavail(sb) - (tp->snd_max - tp->snd_una))), ("rack:%p left_to_send:%u sbavail:%u out:%u", rack, rack->r_ctl.fsb.left_to_send, sbavail(sb), @@ -18118,7 +18127,7 @@ out: * retransmit. In persist state, just set snd_max. */ if (error == 0) { - tcp_account_for_send(tp, len, (rsm != NULL), doing_tlp); + tcp_account_for_send(tp, len, (rsm != NULL), doing_tlp, hw_tls); rack->forced_ack = 0; /* If we send something zap the FA flag */ if (rsm && (doing_tlp == 0)) { /* Set we retransmitted */ @@ -18166,7 +18175,7 @@ out: } rack_log_output(tp, &to, len, rack_seq, (uint8_t) flags, error, rack_to_usec_ts(&tv), - rsm, add_flag, s_mb, s_moff); + rsm, add_flag, s_mb, s_moff, hw_tls); if ((error == 0) && @@ -18489,6 +18498,10 @@ enobufs: rack->r_ctl.fsb.o_m_len = rack->r_ctl.fsb.m->m_len; rack->r_ctl.fsb.tcp_flags = flags; rack->r_ctl.fsb.left_to_send = orig_len - len; + if (hw_tls) + rack->r_ctl.fsb.hw_tls = 1; + else + rack->r_ctl.fsb.hw_tls = 0; KASSERT((rack->r_ctl.fsb.left_to_send <= (sbavail(sb) - (tp->snd_max - tp->snd_una))), ("rack:%p left_to_send:%u sbavail:%u out:%u", rack, rack->r_ctl.fsb.left_to_send, sbavail(sb), @@ -18535,6 +18548,10 @@ enobufs: rack->r_ctl.fsb.o_m_len = rack->r_ctl.fsb.m->m_len; rack->r_ctl.fsb.tcp_flags = flags; rack->r_ctl.fsb.left_to_send = orig_len - len; + if (hw_tls) + rack->r_ctl.fsb.hw_tls = 1; + else + rack->r_ctl.fsb.hw_tls = 0; KASSERT((rack->r_ctl.fsb.left_to_send <= (sbavail(sb) - (tp->snd_max - tp->snd_una))), ("rack:%p left_to_send:%u sbavail:%u out:%u", rack, rack->r_ctl.fsb.left_to_send, sbavail(sb), @@ -19458,6 +19475,29 @@ rack_apply_deferred_options(struct tcp_rack *rack) } } +static void +rack_hw_tls_change(struct tcpcb *tp, int chg) +{ + /* + * HW tls state has changed.. fix all + * rsm's in flight. + */ + struct tcp_rack *rack; + struct rack_sendmap *rsm; + + rack = (struct tcp_rack *)tp->t_fb_ptr; + RB_FOREACH(rsm, rack_rb_tree_head, &rack->r_ctl.rc_mtree) { + if (chg) + rsm->r_hw_tls = 1; + else + rsm->r_hw_tls = 0; + } + if (chg) + rack->r_ctl.fsb.hw_tls = 1; + else + rack->r_ctl.fsb.hw_tls = 0; +} + static int rack_pru_options(struct tcpcb *tp, int flags) { @@ -19483,7 +19523,7 @@ static struct tcp_function_block __tcp_rack = { .tfb_tcp_handoff_ok = rack_handoff_ok, .tfb_tcp_mtu_chg = rack_mtu_change, .tfb_pru_options = rack_pru_options, - + .tfb_hwtls_change = rack_hw_tls_change, }; /* diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 349f6daec2f4..54582d4fd9c5 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -68,7 +68,8 @@ struct rack_sendmap { uint8_t r_just_ret : 1, /* After sending, the next pkt was just returned, i.e. limited */ r_one_out_nr : 1, /* Special case 1 outstanding and not in recovery */ r_no_rtt_allowed : 1, /* No rtt measurement allowed */ - r_avail : 5; + r_hw_tls : 1, + r_avail : 4; uint64_t r_tim_lastsent[RACK_NUM_OF_RETRANS]; uint64_t r_ack_arrival; /* This is the time of ack-arrival (if SACK'd) */ RB_ENTRY(rack_sendmap) r_next; /* RB Tree next */ @@ -330,7 +331,8 @@ struct rack_fast_send_blk { struct mbuf *m; uint32_t o_m_len; uint32_t rfo_apply_push : 1, - unused : 31; + hw_tls : 1, + unused : 30; }; struct rack_control { diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 367dd9765534..323472f96cfb 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -367,6 +367,7 @@ struct tcp_function_block { int (*tfb_tcp_handoff_ok)(struct tcpcb *); void (*tfb_tcp_mtu_chg)(struct tcpcb *); int (*tfb_pru_options)(struct tcpcb *, int); + void (*tfb_hwtls_change)(struct tcpcb *, int); volatile uint32_t tfb_refcnt; uint32_t tfb_flags; uint8_t tfb_id; @@ -1132,7 +1133,8 @@ tcp_fields_to_net(struct tcphdr *th) } static inline void -tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, uint8_t is_tlp) +tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, + uint8_t is_tlp, int hw_tls __unused) { if (is_tlp) { tp->t_sndtlppack++; @@ -1143,9 +1145,7 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, uint8_t is_ tp->t_snd_rxt_bytes += len; else tp->t_sndbytes += len; - } - #endif /* _KERNEL */ #endif /* _NETINET_TCP_VAR_H_ */ From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 20:37:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C0B8664DF4; Tue, 13 Jul 2021 20:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPXWS0n4yz3Knk; Tue, 13 Jul 2021 20:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02994D71; Tue, 13 Jul 2021 20:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DKbdIg026196; Tue, 13 Jul 2021 20:37:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DKbdaj026195; Tue, 13 Jul 2021 20:37:39 GMT (envelope-from git) Date: Tue, 13 Jul 2021 20:37:39 GMT Message-Id: <202107132037.16DKbdaj026195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 3b2aeae7260b - stable/13 - tcp: Address goodput and TLP edge cases. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3b2aeae7260b73936cdf19118a44b1ec893c7230 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 20:37:40 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=3b2aeae7260b73936cdf19118a44b1ec893c7230 commit 3b2aeae7260b73936cdf19118a44b1ec893c7230 Author: Randall Stewart AuthorDate: 2021-07-06 14:36:14 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 19:57:20 +0000 tcp: Address goodput and TLP edge cases. There are several cases where we make a goodput measurement and we are running out of data when we decide to make the measurement. In reality we should not make such a measurement if there is no chance we can have "enough" data. There is also some corner case TLP's that end up not registering as a TLP like they should, we fix this by pushing the doing_tlp setup to the actual timeout that knows it did a TLP. This makes it so we always have the appropriate flag on the sendmap indicating a TLP being done as well as count correctly so we make no more that two TLP's. In addressing the goodput lets also add a "quality" metric that can be viewed via blackbox logs so that a casual observer does not have to figure out how good of a measurement it is. This is needed due to the fact that we may still make a measurement that is of a poorer quality as we run out of data but still have a minimal amount of data to make a measurement. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31076 (cherry picked from commit e834f9a44acc577e658f40023d9465e887c94920) --- sys/netinet/tcp_stacks/rack.c | 329 +++++++++++++++++++++++++++----------- sys/netinet/tcp_stacks/tcp_rack.h | 11 ++ 2 files changed, 251 insertions(+), 89 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 0b7de9b6292a..59b3f84fa7c4 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -458,9 +458,11 @@ rack_log_alt_to_to_cancel(struct tcp_rack *rack, uint32_t flex3, uint32_t flex4, uint32_t flex5, uint32_t flex6, uint16_t flex7, uint8_t mod); + static void rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, - uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, int line, struct rack_sendmap *rsm); + uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, int line, + struct rack_sendmap *rsm, uint8_t quality); static struct rack_sendmap * rack_find_high_nonack(struct tcp_rack *rack, struct rack_sendmap *rsm); @@ -472,7 +474,7 @@ rack_get_sockopt(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp, struct tcp_rack *rack); static void rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, - tcp_seq th_ack, int line); + tcp_seq th_ack, int line, uint8_t quality); static uint32_t rack_get_pacing_len(struct tcp_rack *rack, uint64_t bw, uint32_t mss); static int32_t rack_handoff_ok(struct tcpcb *tp); @@ -1566,9 +1568,6 @@ rack_init_sysctls(void) SYSCTL_CHILDREN(rack_counters), OID_AUTO, "hwpace_lost", CTLFLAG_RD, &rack_hw_pace_lost, "Total number of times we failed to initialize hw pacing"); - - - rack_badfr = counter_u64_alloc(M_WAITOK); SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_counters), @@ -3045,7 +3044,7 @@ rack_get_measure_window(struct tcpcb *tp, struct tcp_rack *rack) /* * We have no measurement (IW is in flight?) so * we can only guess using our data_window sysctl - * value (usually 100MSS). + * value (usually 20MSS). */ return (def_len); } @@ -3113,7 +3112,7 @@ rack_get_measure_window(struct tcpcb *tp, struct tcp_rack *rack) } static int -rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ack) +rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ack, uint8_t *quality) { uint32_t tim, srtts, segsiz; @@ -3123,6 +3122,7 @@ rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ if ((tp->snd_max == tp->snd_una) || (th_ack == tp->snd_max)){ /* All is acked */ + *quality = RACK_QUALITY_ALLACKED; return (1); } if (SEQ_LT(th_ack, tp->gput_seq)) { @@ -3136,17 +3136,19 @@ rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ return (0); } if (rack->r_ctl.rc_first_appl && - (rack->r_ctl.rc_first_appl->r_start == th_ack)) { + (SEQ_GEQ(th_ack, rack->r_ctl.rc_first_appl->r_end))) { /* - * We are up to the app limited point + * We are up to the app limited send point * we have to measure irrespective of the time.. */ + *quality = RACK_QUALITY_APPLIMITED; return (1); } /* Now what about time? */ srtts = (rack->r_ctl.rc_gp_srtt * rack_min_srtts); tim = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time) - tp->gput_ts; if (tim >= srtts) { + *quality = RACK_QUALITY_HIGH; return (1); } /* Nope not even a full SRTT has passed */ @@ -3673,7 +3675,8 @@ rack_enter_probertt(struct tcp_rack *rack, uint32_t us_cts) * now. */ rack_do_goodput_measurement(rack->rc_tp, rack, - rack->rc_tp->snd_una, __LINE__); + rack->rc_tp->snd_una, __LINE__, + RACK_QUALITY_PROBERTT); } rack->r_ctl.rack_per_of_gp_probertt = rack_per_of_gp_probertt; rack->r_ctl.rc_time_probertt_entered = us_cts; @@ -3711,7 +3714,8 @@ rack_exit_probertt(struct tcp_rack *rack, uint32_t us_cts) * now. */ rack_do_goodput_measurement(rack->rc_tp, rack, - rack->rc_tp->snd_una, __LINE__); + rack->rc_tp->snd_una, __LINE__, + RACK_QUALITY_PROBERTT); } else if (rack->rc_tp->t_flags & TF_GPUTINPROG) { /* * We don't have enough data to make a measurement. @@ -4188,7 +4192,7 @@ rack_make_timely_judgement(struct tcp_rack *rack, uint32_t rtt, int32_t rtt_diff static void rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, - tcp_seq th_ack, int line) + tcp_seq th_ack, int line, uint8_t quality) { uint64_t tim, bytes_ps, ltim, stim, utim; uint32_t segsiz, bytes, reqbytes, us_cts; @@ -4202,7 +4206,6 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, tim = us_cts - tp->gput_ts; else tim = 0; - if (rack->r_ctl.rc_gp_cumack_ts > rack->r_ctl.rc_gp_output_ts) stim = rack->r_ctl.rc_gp_cumack_ts - rack->r_ctl.rc_gp_output_ts; else @@ -4230,7 +4233,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } if (rack->r_ctl.rc_gp_lowrtt == 0xffffffff) { @@ -4238,7 +4241,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } /* @@ -4275,7 +4278,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } else bytes = (th_ack - tp->gput_seq); @@ -4307,7 +4310,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, if ((bytes_ps < reqbytes) || rack->app_limited_needs_set) { rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, rack->r_ctl.rc_app_limited_cnt, - 0, 0, 10, __LINE__, NULL); + 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } /* @@ -4349,7 +4352,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, */ rack_log_pacing_delay_calc(rack, bytes, reqbytes, bytes_ps, rack->r_ctl.last_max_bw, 0, - 11, __LINE__, NULL); + 11, __LINE__, NULL, quality); bytes_ps = rack->r_ctl.last_max_bw; } /* We store gp for b/w in bytes per second */ @@ -4363,7 +4366,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, } else { rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, rack->r_ctl.rc_app_limited_cnt, - 0, 0, 10, __LINE__, NULL); + 0, 0, 10, __LINE__, NULL, quality); } if (rack->rc_inp->inp_in_hpts && (rack->r_ctl.rc_hpts_flags & PACE_PKT_OUTPUT)) { @@ -4504,14 +4507,14 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, rack_apply_deferred_options(rack); } rack_log_pacing_delay_calc(rack, subpart, addpart, bytes_ps, stim, - rack_get_bw(rack), 22, did_add, NULL); + rack_get_bw(rack), 22, did_add, NULL, quality); /* We do not update any multipliers if we are in or have seen a probe-rtt */ if ((rack->measure_saw_probe_rtt == 0) && rack->rc_gp_rtt_set) rack_update_multiplier(rack, timely_says, bytes_ps, rack->r_ctl.rc_gp_srtt, rack->r_ctl.rc_rtt_diff); rack_log_pacing_delay_calc(rack, bytes, tim, bytes_ps, stim, - rack_get_bw(rack), 3, line, NULL); + rack_get_bw(rack), 3, line, NULL, quality); /* reset the gp srtt and setup the new prev */ rack->r_ctl.rc_prev_gp_srtt = rack->r_ctl.rc_gp_srtt; /* Record the lost count for the next measurement */ @@ -4554,14 +4557,13 @@ skip_measurement: TCPS_HAVEESTABLISHED(tp->t_state) && rack->r_ctl.rc_app_limited_cnt && (SEQ_GT(rack->r_ctl.rc_first_appl->r_start, th_ack)) && - ((rack->r_ctl.rc_first_appl->r_start - th_ack) > + ((rack->r_ctl.rc_first_appl->r_end - th_ack) > max(rc_init_window(rack), (MIN_GP_WIN * segsiz)))) { /* * Yep there is enough outstanding to make a measurement here. */ struct rack_sendmap *rsm, fe; - tp->t_flags |= TF_GPUTINPROG; rack->r_ctl.rc_gp_lowrtt = 0xffffffff; rack->r_ctl.rc_gp_high_rwnd = rack->rc_tp->snd_wnd; tp->gput_ts = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time); @@ -4572,13 +4574,34 @@ skip_measurement: else if ((rack->measure_saw_probe_rtt) && (SEQ_GEQ(tp->gput_seq, rack->r_ctl.rc_probertt_sndmax_atexit))) rack->measure_saw_probe_rtt = 0; - if ((rack->r_ctl.rc_first_appl->r_start - th_ack) >= rack_get_measure_window(tp, rack)) { + if ((rack->r_ctl.rc_first_appl->r_end - th_ack) >= rack_get_measure_window(tp, rack)) { /* There is a full window to gain info from */ tp->gput_ack = tp->gput_seq + rack_get_measure_window(tp, rack); } else { /* We can only measure up to the applimited point */ - tp->gput_ack = tp->gput_seq + (rack->r_ctl.rc_first_appl->r_start - th_ack); + tp->gput_ack = tp->gput_seq + (rack->r_ctl.rc_first_appl->r_end - th_ack); + if ((tp->gput_ack - tp->gput_seq) < (MIN_GP_WIN * segsiz)) { + /* + * We don't have enough to make a measurement. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, tp->gput_ack, tp->gput_seq, + 0, 0, 0, 6, __LINE__, NULL, quality); + return; + } + } + if (tp->t_state >= TCPS_FIN_WAIT_1) { + /* + * We will get no more data into the SB + * this means we need to have the data available + * before we start a measurement. + */ + if (sbavail(&tp->t_inpcb->inp_socket->so_snd) < (tp->gput_ack - tp->gput_seq)) { + /* Nope not enough data. */ + return; + } } + tp->t_flags |= TF_GPUTINPROG; /* * Now we need to find the timestamp of the send at tp->gput_seq * for the send based measurement. @@ -4619,7 +4642,7 @@ skip_measurement: tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, quality); } } @@ -4632,7 +4655,7 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint { uint32_t prior_cwnd, acked; struct tcp_log_buffer *lgb = NULL; - uint8_t labc_to_use; + uint8_t labc_to_use, quality; INP_WLOCK_ASSERT(tp->t_inpcb); tp->ccv->nsegs = nsegs; @@ -4649,10 +4672,11 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint stats_voi_update_abs_s32(tp->t_stats, VOI_TCP_CALCFRWINDIFF, ((int32_t)rack->r_ctl.cwnd_to_use) - tp->snd_wnd); #endif + quality = RACK_QUALITY_NONE; if ((tp->t_flags & TF_GPUTINPROG) && - rack_enough_for_measurement(tp, rack, th_ack)) { + rack_enough_for_measurement(tp, rack, th_ack, &quality)) { /* Measure the Goodput */ - rack_do_goodput_measurement(tp, rack, th_ack, __LINE__); + rack_do_goodput_measurement(tp, rack, th_ack, __LINE__, quality); #ifdef NETFLIX_PEAKRATE if ((type == CC_ACK) && (tp->t_maxpeakrate)) { @@ -5511,7 +5535,8 @@ rack_enter_persist(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) * Stop the goodput now, the calling of the * measurement function clears the flag. */ - rack_do_goodput_measurement(tp, rack, tp->snd_una, __LINE__); + rack_do_goodput_measurement(tp, rack, tp->snd_una, __LINE__, + RACK_QUALITY_PERSIST); } #ifdef NETFLIX_SHARED_CWND if (rack->r_ctl.rc_scw) { @@ -5678,7 +5703,7 @@ rack_start_hpts_timer(struct tcp_rack *rack, struct tcpcb *tp, uint32_t cts, rack->r_ctl.rc_hpts_flags = 0; us_cts = tcp_get_usecs(&tv); /* Now early/late accounting */ - rack_log_pacing_delay_calc(rack, entry_slot, slot, 0, 0, 0, 26, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, entry_slot, slot, 0, 0, 0, 26, __LINE__, NULL, 0); if (rack->r_early && (rack->rc_ack_can_sendout_data == 0)) { /* * We have a early carry over set, @@ -5820,7 +5845,7 @@ rack_start_hpts_timer(struct tcp_rack *rack, struct tcpcb *tp, uint32_t cts, hpts_timeout = 0x7ffffffe; rack->r_ctl.rc_timer_exp = cts + hpts_timeout; } - rack_log_pacing_delay_calc(rack, entry_slot, slot, hpts_timeout, 0, 0, 27, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, entry_slot, slot, hpts_timeout, 0, 0, 27, __LINE__, NULL, 0); if ((rack->gp_ready == 0) && (rack->use_fixed_rate == 0) && (hpts_timeout < slot) && @@ -6152,7 +6177,7 @@ rack_merge_rsm(struct tcp_rack *rack, * when all timers have been stopped (destroyed PCB?). */ static int -rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) +rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t *doing_tlp) { /* * Tail Loss Probe. @@ -6194,6 +6219,22 @@ rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) collapsed_win = 1; goto need_retran; } + if ((tp->t_flags & TF_GPUTINPROG) && + (rack->r_ctl.rc_tlp_cnt_out == 1)) { + /* + * If this is the second in a row + * TLP and we are doing a measurement + * its time to abandon the measurement. + * Something is likely broken on + * the clients network and measuring a + * broken network does us no good. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } /* * Check our send oldest always settings, and if * there is an oldest to send jump to the need_retran. @@ -6219,6 +6260,7 @@ rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) if (rack->rack_no_prr == 0) { if (out + amm <= tp->snd_wnd) { rack->r_ctl.rc_prr_sndcnt = amm; + rack->r_ctl.rc_tlp_new_data = amm; rack_log_to_prr(rack, 4, 0); } } else @@ -6312,6 +6354,8 @@ need_retran: } rack->r_ctl.rc_tlpsend = rsm; send: + /* Make sure output path knows we are doing a TLP */ + *doing_tlp = 1; rack->r_timer_override = 1; rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_TLP; return (0); @@ -6675,6 +6719,20 @@ rack_timeout_rxt(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) if (tp->t_timers->tt_flags & TT_STOPPED) { return (1); } + if ((tp->t_flags & TF_GPUTINPROG) && + (tp->t_rxtshift)) { + /* + * We have had a second timeout + * measurements on successive rxt's are not profitable. + * It is unlikely to be of any use (the network is + * broken or the client went away). + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } if (ctf_progress_timeout_check(tp, false)) { tcp_log_end_status(tp, TCP_EI_STATUS_RETRAN); rack_log_progress_event(rack, tp, tick, PROGRESS_DROP, __LINE__); @@ -6912,11 +6970,37 @@ out: } static int -rack_process_timers(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t hpts_calling) +rack_process_timers(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t hpts_calling, uint8_t *doing_tlp) { int32_t ret = 0; int32_t timers = (rack->r_ctl.rc_hpts_flags & PACE_TMR_MASK); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } if (timers == 0) { return (0); } @@ -6980,7 +7064,7 @@ skip_time_check: ret = rack_timeout_rack(tp, rack, cts); } else if (timers & PACE_TMR_TLP) { rack->r_ctl.rc_tlp_rxt_last_time = cts; - ret = rack_timeout_tlp(tp, rack, cts); + ret = rack_timeout_tlp(tp, rack, cts, doing_tlp); } else if (timers & PACE_TMR_RXT) { rack->r_ctl.rc_tlp_rxt_last_time = cts; rack->r_fast_output = 0; @@ -8106,7 +8190,7 @@ rack_need_set_test(struct tcpcb *tp, (SEQ_GEQ(tp->gput_seq, rack->r_ctl.rc_probertt_sndmax_atexit))) rack->measure_saw_probe_rtt = 0; rack_log_pacing_delay_calc(rack, ts, tp->gput_ts, - seq, tp->gput_seq, 0, 5, line, NULL); + seq, tp->gput_seq, 0, 5, line, NULL, 0); if (rack->rc_gp_filled && ((tp->gput_ack - tp->gput_seq) < max(rc_init_window(rack), (MIN_GP_WIN * @@ -8123,7 +8207,7 @@ rack_need_set_test(struct tcpcb *tp, */ tp->t_flags &= ~TF_GPUTINPROG; rack_log_pacing_delay_calc(rack, tp->gput_ack, tp->gput_seq, - 0, 0, 0, 6, __LINE__, NULL); + 0, 0, 0, 6, __LINE__, NULL, 0); } else { /* * Reset the window further out. @@ -12861,6 +12945,32 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb if (rack->r_state != tp->t_state) rack_set_state(tp, rack); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } to = &to_holder; to->to_flags = 0; KASSERT((m->m_len >= sizeof(struct tcp_ackent)), @@ -13465,6 +13575,8 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, * tv passed from common code is from either M_TSTMP_LRO or * tcp_get_usecs() if no LRO m_pkthdr timestamp is present. */ + rack = (struct tcp_rack *)tp->t_fb_ptr; + cts = tcp_tv_to_usectick(tv); if (m->m_flags & M_ACKCMP) { return (rack_do_compressed_ack_processing(tp, so, m, nxt_pkt, tv)); } @@ -13479,9 +13591,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, if (thflags & TH_ACK) ts_val = get_cyclecount(); #endif - cts = tcp_tv_to_usectick(tv); - rack = (struct tcp_rack *)tp->t_fb_ptr; - if ((m->m_flags & M_TSTMP) || (m->m_flags & M_TSTMP_LRO)) { mbuf_tstmp2timespec(m, &ts); @@ -13532,6 +13641,32 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, __func__)); KASSERT(tp->t_state != TCPS_TIME_WAIT, ("%s: TCPS_TIME_WAIT", __func__)); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } if (tp->t_logstate != TCP_LOG_STATE_OFF) { union tcp_log_stackspecific log; struct timeval ltv; @@ -13813,6 +13948,7 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, /* Check in on probertt */ rack_check_probe_rtt(rack, us_cts); } + rack_clear_rate_sample(rack); if (rack->forced_ack) { uint32_t us_rtt; @@ -13828,8 +13964,8 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, us_rtt = us_cts - rack->r_ctl.forced_ack_ts; if (us_rtt == 0) us_rtt = 1; - rack_log_rtt_upd(tp, rack, us_rtt, 0, NULL, 3); rack_apply_updated_usrtt(rack, us_rtt, us_cts); + tcp_rack_xmit_timer(rack, us_rtt, 0, us_rtt, 3, NULL, 1); } /* * This is the one exception case where we set the rack state @@ -13843,7 +13979,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, (rsm = RB_MIN(rack_rb_tree_head, &rack->r_ctl.rc_mtree)) != NULL) kern_prefetch(rsm, &prev_state); prev_state = rack->r_state; - rack_clear_rate_sample(rack); retval = (*rack->r_substate) (m, th, so, tp, &to, drop_hdrlen, tlen, tiwin, thflags, nxt_pkt, iptos); @@ -14088,7 +14223,7 @@ check_it: static void rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, - int line, struct rack_sendmap *rsm) + int line, struct rack_sendmap *rsm, uint8_t quality) { if (rack->rc_tp->t_logstate != TCP_LOG_STATE_OFF) { union tcp_log_stackspecific log; @@ -14145,6 +14280,7 @@ rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, log.u_bbr.cwnd_gain |= rack->rc_gp_saw_ss; log.u_bbr.cwnd_gain <<= 1; log.u_bbr.cwnd_gain |= rack->rc_gp_saw_ca; + log.u_bbr.bbr_substate = quality; TCP_LOG_EVENTP(rack->rc_tp, NULL, &rack->rc_inp->inp_socket->so_rcv, &rack->rc_inp->inp_socket->so_snd, @@ -14269,7 +14405,7 @@ pace_to_fill_cwnd(struct tcp_rack *rack, int32_t slot, uint32_t len, uint32_t se *rate_wanted = fill_bw; if (non_paced || (lentim < slot)) { rack_log_pacing_delay_calc(rack, len, slot, fill_bw, - 0, lentim, 12, __LINE__, NULL); + 0, lentim, 12, __LINE__, NULL, 0); return ((int32_t)lentim); } else return (slot); @@ -14278,7 +14414,6 @@ pace_to_fill_cwnd(struct tcp_rack *rack, int32_t slot, uint32_t len, uint32_t se static int32_t rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, struct rack_sendmap *rsm, uint32_t segsiz) { - struct rack_sendmap *lrsm; int32_t slot = 0; int can_start_hw_pacing = 1; int err; @@ -14331,29 +14466,14 @@ rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, str slot = 0; } slot *= HPTS_USEC_IN_MSEC; - if (rsm == NULL) { - /* - * We always consider ourselves app limited with old style - * that are not retransmits. This could be the initial - * measurement, but thats ok its all setup and specially - * handled. If another send leaks out, then that too will - * be mark app-limited. - */ - lrsm = RB_MAX(rack_rb_tree_head, &rack->r_ctl.rc_mtree); - if (lrsm && ((lrsm->r_flags & RACK_APP_LIMITED) == 0)) { - rack->r_ctl.rc_first_appl = lrsm; - lrsm->r_flags |= RACK_APP_LIMITED; - rack->r_ctl.rc_app_limited_cnt++; - } - } if (rack->rc_pace_to_cwnd) { uint64_t rate_wanted = 0; slot = pace_to_fill_cwnd(rack, slot, len, segsiz, NULL, &rate_wanted, 1); rack->rc_ack_can_sendout_data = 1; - rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, 0, 0, 14, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, 0, 0, 14, __LINE__, NULL, 0); } else - rack_log_pacing_delay_calc(rack, len, slot, tr_perms, reduce, 0, 7, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, tr_perms, reduce, 0, 7, __LINE__, NULL, 0); } else { uint64_t bw_est, res, lentim, rate_wanted; uint32_t orig_val, srtt, segs, oh; @@ -14428,7 +14548,7 @@ rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, str } /* Did we change the TSO size, if so log it */ if (rack->r_ctl.rc_pace_max_segs != orig_val) - rack_log_pacing_delay_calc(rack, len, slot, orig_val, 0, 0, 15, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, orig_val, 0, 0, 15, __LINE__, NULL, 0); prev_fill = rack->r_via_fill_cw; if ((rack->rc_pace_to_cwnd) && (capped == 0) && @@ -14582,11 +14702,11 @@ done_w_hdwr: else srtt = RACK_INITIAL_RTO * HPTS_USEC_IN_MSEC; /* its in ms convert */ if (srtt < slot) { - rack_log_pacing_delay_calc(rack, srtt, slot, rate_wanted, bw_est, lentim, 99, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, srtt, slot, rate_wanted, bw_est, lentim, 99, __LINE__, NULL, 0); slot = srtt; } } - rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, bw_est, lentim, 2, __LINE__, rsm); + rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, bw_est, lentim, 2, __LINE__, rsm, 0); } if (rack->r_ctl.crte && (rack->r_ctl.crte->rs_num_enobufs > 0)) { /* @@ -14626,6 +14746,20 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, */ return; } + if (tp->t_state >= TCPS_FIN_WAIT_1) { + /* + * We will get no more data into the SB + * this means we need to have the data available + * before we start a measurement. + */ + + if (sbavail(&tp->t_inpcb->inp_socket->so_snd) < + max(rc_init_window(rack), + (MIN_GP_WIN * ctf_fixed_maxseg(tp)))) { + /* Nope not enough data */ + return; + } + } tp->t_flags |= TF_GPUTINPROG; rack->r_ctl.rc_gp_lowrtt = 0xffffffff; rack->r_ctl.rc_gp_high_rwnd = rack->rc_tp->snd_wnd; @@ -14664,7 +14798,7 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, 0); return; } if (sb_offset) { @@ -14672,7 +14806,6 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, * We are out somewhere in the sb * can we use the already outstanding data? */ - if (rack->r_ctl.rc_app_limited_cnt == 0) { /* * Yes first one is good and in this case @@ -14748,7 +14881,7 @@ start_set: tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, 0); return; } @@ -14796,7 +14929,7 @@ use_latest: (uint64_t)my_rsm, tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, - 9, __LINE__, NULL); + 9, __LINE__, NULL, 0); } static inline uint32_t @@ -15069,7 +15202,7 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, static int rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendmap *rsm, - uint64_t ts_val, uint32_t cts, uint32_t ms_cts, struct timeval *tv, int len) + uint64_t ts_val, uint32_t cts, uint32_t ms_cts, struct timeval *tv, int len, uint8_t doing_tlp) { /* * Enter the fast retransmit path. We are given that a sched_pin is @@ -15090,7 +15223,6 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma uint64_t crtsc; int cnt_thru = 1; #endif - int doing_tlp = 0; struct tcpopt to; u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; @@ -15116,6 +15248,8 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma } if (rsm->r_flags & RACK_TLP) doing_tlp = 1; + else if (doing_tlp) + rsm->r_flags |= RACK_TLP; startseq = rsm->r_start; segsiz = min(ctf_fixed_maxseg(tp), rack->r_ctl.rc_pace_min_segs); inp = rack->rc_inp; @@ -15371,7 +15505,10 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma log.u_bbr.flex6 = rack->r_ctl.rc_agg_early; log.u_bbr.applimited = rack->r_ctl.rc_agg_delayed; log.u_bbr.bw_inuse = rack_get_bw(rack); - log.u_bbr.flex8 = 1; + if (doing_tlp == 0) + log.u_bbr.flex8 = 1; + else + log.u_bbr.flex8 = 2; log.u_bbr.pacing_gain = rack_get_output_gain(rack, NULL); log.u_bbr.flex7 = 55; log.u_bbr.pkts_out = tp->t_maxseg; @@ -16010,6 +16147,7 @@ rack_output(struct tcpcb *tp) int32_t sup_rack = 0; uint32_t cts, ms_cts, delayed, early; uint16_t add_flag = RACK_SENT_SP; + /* The doing_tlp flag will be set by the actual rack_timeout_tlp() */ uint8_t hpts_calling, doing_tlp = 0; uint32_t cwnd_to_use, pace_max_seg; int32_t do_a_prefetch = 0; @@ -16090,7 +16228,7 @@ rack_output(struct tcpcb *tp) } /* Do the timers, which may override the pacer */ if (rack->r_ctl.rc_hpts_flags & PACE_TMR_MASK) { - if (rack_process_timers(tp, rack, cts, hpts_calling)) { + if (rack_process_timers(tp, rack, cts, hpts_calling, &doing_tlp)) { counter_u64_add(rack_out_size[TCP_MSS_ACCT_ATIMER], 1); #ifdef TCP_ACCOUNTING sched_unpin(); @@ -16158,6 +16296,7 @@ rack_output(struct tcpcb *tp) rack_set_state(tp, rack); } if ((rack->r_fast_output) && + (doing_tlp == 0) && (tp->rcv_numsacks == 0)) { int ret; @@ -16323,7 +16462,6 @@ again: long cwin; long tlen; - doing_tlp = 1; /* * Check if we can do a TLP with a RACK'd packet * this can happen if we are not doing the rack @@ -16422,7 +16560,7 @@ again: ((rsm->r_flags & RACK_HAS_FIN) == 0)) { int ret; - ret = rack_fast_rsm_output(tp, rack, rsm, ts_val, cts, ms_cts, &tv, len); + ret = rack_fast_rsm_output(tp, rack, rsm, ts_val, cts, ms_cts, &tv, len, doing_tlp); if (ret == 0) return (0); } @@ -16516,8 +16654,6 @@ again: } else { len = rack->r_ctl.rc_tlp_new_data; } - rack->r_ctl.rc_tlp_new_data = 0; - doing_tlp = 1; } else { len = rack_what_can_we_send(tp, rack, cwnd_to_use, avail, sb_offset); } @@ -17167,12 +17303,23 @@ just_return_nolock: if (end_window) { uint8_t log = 0; + /* Adjust the Gput measurement */ if ((tp->t_flags & TF_GPUTINPROG) && SEQ_GT(tp->gput_ack, tp->snd_max)) { - /* Mark the last packet has app limited */ tp->gput_ack = tp->snd_max; - log = 1; + if ((tp->gput_ack - tp->gput_seq) < (MIN_GP_WIN * segsiz)) { + /* + * There is not enough to measure. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } else + log = 1; } + /* Mark the last packet has app limited */ rsm = RB_MAX(rack_rb_tree_head, &rack->r_ctl.rc_mtree); if (rsm && ((rsm->r_flags & RACK_APP_LIMITED) == 0)) { if (rack->r_ctl.rc_app_limited_cnt == 0) @@ -17193,7 +17340,7 @@ just_return_nolock: if (log) rack_log_pacing_delay_calc(rack, rack->r_ctl.rc_app_limited_cnt, seq, - tp->gput_ack, 0, 0, 4, __LINE__, NULL); + tp->gput_ack, 0, 0, 4, __LINE__, NULL, 0); } } if (slot) { @@ -18141,6 +18288,10 @@ out: rack->rc_gp_saw_ss = 1; } } + if (doing_tlp && (rsm == NULL)) { + /* Make sure new data TLP cnt is clear */ + rack->r_ctl.rc_tlp_new_data = 0; + } if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) @@ -18624,7 +18775,7 @@ rack_update_seg(struct tcp_rack *rack) orig_val = rack->r_ctl.rc_pace_max_segs; rack_set_pace_segments(rack->rc_tp, rack, __LINE__, NULL); if (orig_val != rack->r_ctl.rc_pace_max_segs) - rack_log_pacing_delay_calc(rack, 0, 0, orig_val, 0, 0, 15, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, 0, 0, orig_val, 0, 0, 15, __LINE__, NULL, 0); } static void @@ -19242,7 +19393,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL,0); break; case TCP_RACK_PACE_RATE_SS: @@ -19260,7 +19411,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_PACE_RATE_CA: @@ -19278,7 +19429,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_REC: RACK_OPTS_INC(tcp_gp_inc_rec); @@ -19287,7 +19438,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_CA: RACK_OPTS_INC(tcp_gp_inc_ca); @@ -19305,7 +19456,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_SS: RACK_OPTS_INC(tcp_gp_inc_ss); @@ -19323,7 +19474,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_RR_CONF: RACK_OPTS_INC(tcp_rack_rrr_no_conf_rate); @@ -19555,8 +19706,8 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, case TCP_RACK_GP_INCREASE_REC: /* URL:gp_inc_rec */ case TCP_RACK_RR_CONF: /* URL:rrr_conf */ case TCP_BBR_HDWR_PACE: /* URL:hdwrpace */ - case TCP_HDWR_RATE_CAP: /* URL: hdwrcap boolean */ - case TCP_PACING_RATE_CAP: /* URL:cap-- used by side-channel */ + case TCP_HDWR_RATE_CAP: /* URL:hdwrcap boolean */ + case TCP_PACING_RATE_CAP: /* URL:cap -- used by side-channel */ case TCP_HDWR_UP_ONLY: /* URL:uponly -- hardware pacing boolean */ /* End pacing related */ case TCP_FAST_RSM_HACK: /* URL:frsm_hack */ diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 54582d4fd9c5..55ebb07549d0 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -268,6 +268,15 @@ struct rack_opts_stats { #define TLP_USE_TWO_TWO 3 /* Use 2.2 behavior */ #define RACK_MIN_BW 8000 /* 64kbps in Bps */ +/* Rack quality indicators for GPUT measurements */ +#define RACK_QUALITY_NONE 0 /* No quality stated */ +#define RACK_QUALITY_HIGH 1 /* A normal measurement of a GP RTT */ +#define RACK_QUALITY_APPLIMITED 2 /* An app limited case that may be of lower quality */ +#define RACK_QUALITY_PERSIST 3 /* A measurement where we went into persists */ +#define RACK_QUALITY_PROBERTT 4 /* A measurement where we went into or exited probe RTT */ +#define RACK_QUALITY_ALLACKED 5 /* All data is now acknowledged */ + + #define MIN_GP_WIN 6 /* We need at least 6 MSS in a GP measurement */ #ifdef _KERNEL #define RACK_OPTS_SIZE (sizeof(struct rack_opts_stats)/sizeof(uint64_t)) @@ -318,6 +327,7 @@ extern counter_u64_t rack_opts_arry[RACK_OPTS_SIZE]; #define RACK_GP_HIST 4 /* How much goodput history do we maintain? */ #define RACK_NUM_FSB_DEBUG 16 +#ifdef _KERNEL struct rack_fast_send_blk { uint32_t left_to_send; uint16_t tcp_ip_hdr_len; @@ -501,6 +511,7 @@ struct rack_control { uint8_t rc_rate_sample_method; uint8_t rc_gp_hist_idx; }; +#endif #define RACK_TIMELY_CNT_BOOST 5 /* At 5th increase boost */ #define RACK_MINRTT_FILTER_TIM 10 /* Seconds */ From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 20:39:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3061A665502; Tue, 13 Jul 2021 20:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPXY00sJQz3Kxr; Tue, 13 Jul 2021 20:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06BA8108C; Tue, 13 Jul 2021 20:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DKcxad026394; Tue, 13 Jul 2021 20:38:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DKcxBB026393; Tue, 13 Jul 2021 20:38:59 GMT (envelope-from git) Date: Tue, 13 Jul 2021 20:38:59 GMT Message-Id: <202107132038.16DKcxBB026393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: deb3c279d156 - stable/13 - tcp: HPTS performance enhancements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: deb3c279d1560f71c1777f52bf3e73eebe3d986a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 20:39:00 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=deb3c279d1560f71c1777f52bf3e73eebe3d986a commit deb3c279d1560f71c1777f52bf3e73eebe3d986a Author: Randall Stewart AuthorDate: 2021-07-06 19:23:22 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 19:58:30 +0000 tcp: HPTS performance enhancements HPTS drives both rack and bbr, and yet there have been many complaints about performance. This bit of work restructures hpts to help reduce CPU overhead. It does this by now instead of relying on the timer/callout to drive it instead use user return from a system call as well as lro flushes to drive hpts. The timer becomes a backstop that dynamically adjusts based on how "late" we are. Reviewed by: tuexen, glebius Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31083 (cherry picked from commit d7955cc0ffdf9fb58013245a6f181c757574ea0a) --- sys/kern/subr_trap.c | 10 + sys/netinet/in_pcb.h | 4 +- sys/netinet/tcp_hpts.c | 1309 +++++++++++++++++++++++++---------------- sys/netinet/tcp_hpts.h | 99 +++- sys/netinet/tcp_lro.c | 28 +- sys/netinet/tcp_lro.h | 10 +- sys/netinet/tcp_stacks/bbr.c | 6 +- sys/netinet/tcp_stacks/rack.c | 22 +- 8 files changed, 931 insertions(+), 557 deletions(-) diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 8981091b50ed..d0f616d037c5 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -140,6 +140,16 @@ userret(struct thread *td, struct trapframe *frame) #ifdef HWPMC_HOOKS if (PMC_THREAD_HAS_SAMPLES(td)) PMC_CALL_HOOK(td, PMC_FN_THR_USERRET, NULL); +#endif +#ifdef TCPHPTS + /* + * @gallatin is adament that this needs to go here, I + * am not so sure. Running hpts is a lot like + * a lro_flush() that happens while a user process + * is running. But he may know best so I will go + * with his view of accounting. :-) + */ + tcp_run_hpts(); #endif /* * Let the scheduler adjust our priority etc. diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 9604a837cfb4..1849ad34fe6c 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -258,6 +258,7 @@ struct inpcb { volatile uint32_t inp_in_input; /* on input hpts (lock b) */ #endif volatile uint16_t inp_hpts_cpu; /* Lock (i) */ + volatile uint16_t inp_irq_cpu; /* Set by LRO in behalf of or the driver */ u_int inp_refcount; /* (i) refcount */ int inp_flags; /* (i) generic IP/datagram flags */ int inp_flags2; /* (i) generic IP/datagram flags #2*/ @@ -266,7 +267,8 @@ struct inpcb { inp_input_cpu_set : 1, /* on input hpts (i) */ inp_hpts_calls :1, /* (i) from output hpts */ inp_input_calls :1, /* (i) from input hpts */ - inp_spare_bits2 : 4; + inp_irq_cpu_set :1, /* (i) from LRO/Driver */ + inp_spare_bits2 : 3; uint8_t inp_numa_domain; /* numa domain */ void *inp_ppcb; /* (i) pointer to per-protocol pcb */ struct socket *inp_socket; /* (i) back pointer to socket */ diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index fd8b66b9ccdb..9a390e3a85c8 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -193,23 +193,29 @@ static int tcp_bind_threads = 1; #else static int tcp_bind_threads = 2; #endif -TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); - +static int tcp_use_irq_cpu = 0; static struct tcp_hptsi tcp_pace; +static uint32_t *cts_last_ran; static int hpts_does_tp_logging = 0; +static int hpts_use_assigned_cpu = 1; +static int32_t hpts_uses_oldest = OLDEST_THRESHOLD; -static void tcp_wakehpts(struct tcp_hpts_entry *p); -static void tcp_wakeinput(struct tcp_hpts_entry *p); static void tcp_input_data(struct tcp_hpts_entry *hpts, struct timeval *tv); -static void tcp_hptsi(struct tcp_hpts_entry *hpts); +static int32_t tcp_hptsi(struct tcp_hpts_entry *hpts, int from_callout); static void tcp_hpts_thread(void *ctx); static void tcp_init_hptsi(void *st); int32_t tcp_min_hptsi_time = DEFAULT_MIN_SLEEP; -static int32_t tcp_hpts_callout_skip_swi = 0; +static int conn_cnt_thresh = DEFAULT_CONNECTION_THESHOLD; +static int32_t dynamic_min_sleep = DYNAMIC_MIN_SLEEP; +static int32_t dynamic_max_sleep = DYNAMIC_MAX_SLEEP; + + SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hpts, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "TCP Hpts controls"); +SYSCTL_NODE(_net_inet_tcp_hpts, OID_AUTO, stats, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "TCP Hpts statistics"); #define timersub(tvp, uvp, vvp) \ do { \ @@ -230,44 +236,92 @@ struct hpts_domain_info { struct hpts_domain_info hpts_domains[MAXMEMDOM]; -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, precision, CTLFLAG_RW, - &tcp_hpts_precision, 120, - "Value for PRE() precision of callout"); - counter_u64_t hpts_hopelessly_behind; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, hopeless, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, hopeless, CTLFLAG_RD, &hpts_hopelessly_behind, "Number of times hpts could not catch up and was behind hopelessly"); counter_u64_t hpts_loops; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, loops, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, loops, CTLFLAG_RD, &hpts_loops, "Number of times hpts had to loop to catch up"); counter_u64_t back_tosleep; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, no_tcbsfound, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, no_tcbsfound, CTLFLAG_RD, &back_tosleep, "Number of times hpts found no tcbs"); counter_u64_t combined_wheel_wrap; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, comb_wheel_wrap, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, comb_wheel_wrap, CTLFLAG_RD, &combined_wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); counter_u64_t wheel_wrap; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, wheel_wrap, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, wheel_wrap, CTLFLAG_RD, &wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); -static int32_t out_ts_percision = 0; +counter_u64_t hpts_direct_call; +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, direct_call, CTLFLAG_RD, + &hpts_direct_call, "Number of times hpts was called by syscall/trap or other entry"); + +counter_u64_t hpts_wake_timeout; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, timeout_wakeup, CTLFLAG_RD, + &hpts_wake_timeout, "Number of times hpts threads woke up via the callout expiring"); + +counter_u64_t hpts_direct_awakening; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, direct_awakening, CTLFLAG_RD, + &hpts_direct_awakening, "Number of times hpts threads woke up via the callout expiring"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, out_tspercision, CTLFLAG_RW, - &out_ts_percision, 0, - "Do we use a percise timestamp for every output cts"); +counter_u64_t hpts_back_tosleep; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, back_tosleep, CTLFLAG_RD, + &hpts_back_tosleep, "Number of times hpts threads woke up via the callout expiring and went back to sleep no work"); + +counter_u64_t cpu_uses_flowid; +counter_u64_t cpu_uses_random; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, cpusel_flowid, CTLFLAG_RD, + &cpu_uses_flowid, "Number of times when setting cpuid we used the flowid field"); +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, cpusel_random, CTLFLAG_RD, + &cpu_uses_random, "Number of times when setting cpuid we used the a random value"); + +TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); +TUNABLE_INT("net.inet.tcp.use_irq", &tcp_use_irq_cpu); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, bind_hptss, CTLFLAG_RD, + &tcp_bind_threads, 2, + "Thread Binding tunable"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_irq, CTLFLAG_RD, + &tcp_use_irq_cpu, 0, + "Use of irq CPU tunable"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, precision, CTLFLAG_RW, + &tcp_hpts_precision, 120, + "Value for PRE() precision of callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, cnt_thresh, CTLFLAG_RW, + &conn_cnt_thresh, 0, + "How many connections (below) make us use the callout based mechanism"); SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, logging, CTLFLAG_RW, &hpts_does_tp_logging, 0, "Do we add to any tp that has logging on pacer logs"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_assigned_cpu, CTLFLAG_RW, + &hpts_use_assigned_cpu, 0, + "Do we start any hpts timer on the assigned cpu?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_oldest, CTLFLAG_RW, + &hpts_uses_oldest, OLDEST_THRESHOLD, + "Do syscalls look for the hpts that has been the longest since running (or just use cpu no if 0)?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, dyn_minsleep, CTLFLAG_RW, + &dynamic_min_sleep, 250, + "What is the dynamic minsleep value?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, dyn_maxsleep, CTLFLAG_RW, + &dynamic_max_sleep, 5000, + "What is the dynamic maxsleep value?"); + + + + static int32_t max_pacer_loops = 10; SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, loopmax, CTLFLAG_RW, @@ -287,7 +341,7 @@ sysctl_net_inet_tcp_hpts_max_sleep(SYSCTL_HANDLER_ARGS) new = hpts_sleep_max; error = sysctl_handle_int(oidp, &new, 0, req); if (error == 0 && req->newptr) { - if ((new < (NUM_OF_HPTSI_SLOTS / 4)) || + if ((new < dynamic_min_sleep) || (new > HPTS_MAX_SLEEP_ALLOWED)) error = EINVAL; else @@ -296,26 +350,60 @@ sysctl_net_inet_tcp_hpts_max_sleep(SYSCTL_HANDLER_ARGS) return (error); } +static int +sysctl_net_inet_tcp_hpts_min_sleep(SYSCTL_HANDLER_ARGS) +{ + int error; + uint32_t new; + + new = tcp_min_hptsi_time; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error == 0 && req->newptr) { + if (new < LOWEST_SLEEP_ALLOWED) + error = EINVAL; + else + tcp_min_hptsi_time = new; + } + return (error); +} + SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, maxsleep, CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &hpts_sleep_max, 0, &sysctl_net_inet_tcp_hpts_max_sleep, "IU", "Maximum time hpts will sleep"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, minsleep, CTLFLAG_RW, +SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, minsleep, + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &tcp_min_hptsi_time, 0, + &sysctl_net_inet_tcp_hpts_min_sleep, "IU", "The minimum time the hpts must sleep before processing more slots"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, skip_swi, CTLFLAG_RW, - &tcp_hpts_callout_skip_swi, 0, - "Do we have the callout call directly to the hpts?"); +static int ticks_indicate_more_sleep = TICKS_INDICATE_MORE_SLEEP; +static int ticks_indicate_less_sleep = TICKS_INDICATE_LESS_SLEEP; +static int tcp_hpts_no_wake_over_thresh = 1; + +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, more_sleep, CTLFLAG_RW, + &ticks_indicate_more_sleep, 0, + "If we only process this many or less on a timeout, we need longer sleep on the next callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, less_sleep, CTLFLAG_RW, + &ticks_indicate_less_sleep, 0, + "If we process this many or more on a timeout, we need less sleep on the next callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, nowake_over_thresh, CTLFLAG_RW, + &tcp_hpts_no_wake_over_thresh, 0, + "When we are over the threshold on the pacer do we prohibit wakeups?"); static void tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, - int ticks_to_run, int idx) + int slots_to_run, int idx, int from_callout) { union tcp_log_stackspecific log; - + /* + * Unused logs are + * 64 bit - delRate, rttProp, bw_inuse + * 16 bit - cwnd_gain + * 8 bit - bbr_state, bbr_substate, inhpts, ininput; + */ memset(&log.u_bbr, 0, sizeof(log.u_bbr)); log.u_bbr.flex1 = hpts->p_nxt_slot; log.u_bbr.flex2 = hpts->p_cur_slot; @@ -323,8 +411,9 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, log.u_bbr.flex4 = idx; log.u_bbr.flex5 = hpts->p_curtick; log.u_bbr.flex6 = hpts->p_on_queue_cnt; - log.u_bbr.use_lt_bw = 1; - log.u_bbr.inflight = ticks_to_run; + log.u_bbr.flex7 = hpts->p_cpu; + log.u_bbr.flex8 = (uint8_t)from_callout; + log.u_bbr.inflight = slots_to_run; log.u_bbr.applimited = hpts->overidden_sleep; log.u_bbr.delivered = hpts->saved_curtick; log.u_bbr.timeStamp = tcp_tv_to_usectick(tv); @@ -332,7 +421,9 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, log.u_bbr.lt_epoch = hpts->saved_prev_slot; log.u_bbr.pkts_out = hpts->p_delayed_by; log.u_bbr.lost = hpts->p_hpts_sleep_time; - log.u_bbr.cur_del_rate = hpts->p_runningtick; + log.u_bbr.pacing_gain = hpts->p_cpu; + log.u_bbr.pkt_epoch = hpts->p_runningslot; + log.u_bbr.use_lt_bw = 1; TCP_LOG_EVENTP(tp, NULL, &tp->t_inpcb->inp_socket->so_rcv, &tp->t_inpcb->inp_socket->so_snd, @@ -341,47 +432,40 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, } static void -hpts_timeout_swi(void *arg) +tcp_wakehpts(struct tcp_hpts_entry *hpts) { - struct tcp_hpts_entry *hpts; + HPTS_MTX_ASSERT(hpts); - hpts = (struct tcp_hpts_entry *)arg; - swi_sched(hpts->ie_cookie, 0); + if (tcp_hpts_no_wake_over_thresh && (hpts->p_on_queue_cnt >= conn_cnt_thresh)) { + hpts->p_direct_wake = 0; + return; + } + if (hpts->p_hpts_wake_scheduled == 0) { + hpts->p_hpts_wake_scheduled = 1; + swi_sched(hpts->ie_cookie, 0); + } } static void -hpts_timeout_dir(void *arg) +hpts_timeout_swi(void *arg) { - tcp_hpts_thread(arg); + struct tcp_hpts_entry *hpts; + + hpts = (struct tcp_hpts_entry *)arg; + swi_sched(hpts->ie_cookie, 0); } static inline void hpts_sane_pace_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hptsh *head, int clear) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_hpts_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_hpts == 0) { - /* We are not on the hpts? */ - panic("%s: hpts:%p inp:%p not on the hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_hpts != 0, ("%s: hpts:%p inp:%p not on the hpts?", __FUNCTION__, hpts, inp)); TAILQ_REMOVE(head, inp, inp_hpts); hpts->p_on_queue_cnt--; - if (hpts->p_on_queue_cnt < 0) { - /* Count should not go negative .. */ -#ifdef INVARIANTS - panic("Hpts goes negative inp:%p hpts:%p", - inp, hpts); -#endif - hpts->p_on_queue_cnt = 0; - } + KASSERT(hpts->p_on_queue_cnt >= 0, + ("Hpts goes negative inp:%p hpts:%p", + inp, hpts)); if (clear) { inp->inp_hpts_request = 0; inp->inp_in_hpts = 0; @@ -391,20 +475,13 @@ hpts_sane_pace_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hpt static inline void hpts_sane_pace_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hptsh *head, int line, int noref) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_hpts_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if ((noref == 0) && (inp->inp_in_hpts == 1)) { - /* We are already on the hpts? */ - panic("%s: hpts:%p inp:%p already on the hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(((noref == 1) && (inp->inp_in_hpts == 1)) || + ((noref == 0) && (inp->inp_in_hpts == 0)), + ("%s: hpts:%p inp:%p already on the hpts?", + __FUNCTION__, hpts, inp)); TAILQ_INSERT_TAIL(head, inp, inp_hpts); inp->inp_in_hpts = 1; hpts->p_on_queue_cnt++; @@ -416,37 +493,20 @@ hpts_sane_pace_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hpt static inline void hpts_sane_input_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, int clear) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_input_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_input == 0) { - /* We are not on the input hpts? */ - panic("%s: hpts:%p inp:%p not on the input hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_input != 0, + ("%s: hpts:%p inp:%p not on the input hpts?", __FUNCTION__, hpts, inp)); TAILQ_REMOVE(&hpts->p_input, inp, inp_input); hpts->p_on_inqueue_cnt--; - if (hpts->p_on_inqueue_cnt < 0) { -#ifdef INVARIANTS - panic("Hpts in goes negative inp:%p hpts:%p", - inp, hpts); -#endif - hpts->p_on_inqueue_cnt = 0; - } -#ifdef INVARIANTS - if (TAILQ_EMPTY(&hpts->p_input) && - (hpts->p_on_inqueue_cnt != 0)) { - /* We should not be empty with a queue count */ - panic("%s hpts:%p in_hpts input empty but cnt:%d", - __FUNCTION__, hpts, hpts->p_on_inqueue_cnt); - } -#endif + KASSERT(hpts->p_on_inqueue_cnt >= 0, + ("Hpts in goes negative inp:%p hpts:%p", + inp, hpts)); + KASSERT((((TAILQ_EMPTY(&hpts->p_input) != 0) && (hpts->p_on_inqueue_cnt == 0)) || + ((TAILQ_EMPTY(&hpts->p_input) == 0) && (hpts->p_on_inqueue_cnt > 0))), + ("%s hpts:%p input cnt (p_on_inqueue):%d and queue state mismatch", + __FUNCTION__, hpts, hpts->p_on_inqueue_cnt)); if (clear) inp->inp_in_input = 0; } @@ -454,46 +514,17 @@ hpts_sane_input_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, int clear static inline void hpts_sane_input_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, int line) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_input_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_input == 1) { - /* We are already on the input hpts? */ - panic("%s: hpts:%p inp:%p already on the input hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_input == 0, + ("%s: hpts:%p inp:%p already on the input hpts?", __FUNCTION__, hpts, inp)); TAILQ_INSERT_TAIL(&hpts->p_input, inp, inp_input); inp->inp_in_input = 1; hpts->p_on_inqueue_cnt++; in_pcbref(inp); } -static void -tcp_wakehpts(struct tcp_hpts_entry *hpts) -{ - HPTS_MTX_ASSERT(hpts); - if (hpts->p_hpts_wake_scheduled == 0) { - hpts->p_hpts_wake_scheduled = 1; - swi_sched(hpts->ie_cookie, 0); - } -} - -static void -tcp_wakeinput(struct tcp_hpts_entry *hpts) -{ - HPTS_MTX_ASSERT(hpts); - if (hpts->p_hpts_wake_scheduled == 0) { - hpts->p_hpts_wake_scheduled = 1; - swi_sched(hpts->ie_cookie, 0); - } -} - struct tcp_hpts_entry * tcp_cur_hpts(struct inpcb *inp) { @@ -514,12 +545,9 @@ tcp_hpts_lock(struct inpcb *inp) again: hpts_num = inp->inp_hpts_cpu; hpts = tcp_pace.rp_ent[hpts_num]; -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx)) { - panic("Hpts:%p owns mtx prior-to lock line:%d", - hpts, __LINE__); - } -#endif + KASSERT(mtx_owned(&hpts->p_mtx) == 0, + ("Hpts:%p owns mtx prior-to lock line:%d", + hpts, __LINE__)); mtx_lock(&hpts->p_mtx); if (hpts_num != inp->inp_hpts_cpu) { mtx_unlock(&hpts->p_mtx); @@ -537,12 +565,9 @@ tcp_input_lock(struct inpcb *inp) again: hpts_num = inp->inp_input_cpu; hpts = tcp_pace.rp_ent[hpts_num]; -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx)) { - panic("Hpts:%p owns mtx prior-to lock line:%d", - hpts, __LINE__); - } -#endif + KASSERT(mtx_owned(&hpts->p_mtx) == 0, + ("Hpts:%p owns mtx prior-to lock line:%d", + hpts, __LINE__)); mtx_lock(&hpts->p_mtx); if (hpts_num != inp->inp_input_cpu) { mtx_unlock(&hpts->p_mtx); @@ -555,6 +580,7 @@ static void tcp_remove_hpts_ref(struct inpcb *inp, struct tcp_hpts_entry *hpts, int line) { int32_t add_freed; + int32_t ret; if (inp->inp_flags2 & INP_FREED) { /* @@ -567,26 +593,11 @@ tcp_remove_hpts_ref(struct inpcb *inp, struct tcp_hpts_entry *hpts, int line) add_freed = 0; } #ifndef INP_REF_DEBUG - if (in_pcbrele_wlocked(inp)) { - /* - * This should not happen. We have the inpcb referred to by - * the main socket (why we are called) and the hpts. It - * should always return 0. - */ - panic("inpcb:%p release ret 1", - inp); - } + ret = in_pcbrele_wlocked(inp); #else - if (__in_pcbrele_wlocked(inp, line)) { - /* - * This should not happen. We have the inpcb referred to by - * the main socket (why we are called) and the hpts. It - * should always return 0. - */ - panic("inpcb:%p release ret 1", - inp); - } + ret = __in_pcbrele_wlocked(inp, line); #endif + KASSERT(ret != 1, ("inpcb:%p release ret 1", inp)); if (add_freed) { inp->inp_flags2 |= INP_FREED; } @@ -642,73 +653,76 @@ __tcp_hpts_remove(struct inpcb *inp, int32_t flags, int32_t line) } static inline int -hpts_tick(uint32_t wheel_tick, uint32_t plus) +hpts_slot(uint32_t wheel_slot, uint32_t plus) { /* * Given a slot on the wheel, what slot * is that plus ticks out? */ - KASSERT(wheel_tick < NUM_OF_HPTSI_SLOTS, ("Invalid tick %u not on wheel", wheel_tick)); - return ((wheel_tick + plus) % NUM_OF_HPTSI_SLOTS); + KASSERT(wheel_slot < NUM_OF_HPTSI_SLOTS, ("Invalid tick %u not on wheel", wheel_slot)); + return ((wheel_slot + plus) % NUM_OF_HPTSI_SLOTS); } static inline int tick_to_wheel(uint32_t cts_in_wticks) { /* - * Given a timestamp in wheel ticks (10usec inc's) - * map it to our limited space wheel. + * Given a timestamp in ticks (so by + * default to get it to a real time one + * would multiply by 10.. i.e the number + * of ticks in a slot) map it to our limited + * space wheel. */ return (cts_in_wticks % NUM_OF_HPTSI_SLOTS); } static inline int -hpts_ticks_diff(int prev_tick, int tick_now) +hpts_slots_diff(int prev_slot, int slot_now) { /* - * Given two ticks that are someplace + * Given two slots that are someplace * on our wheel. How far are they apart? */ - if (tick_now > prev_tick) - return (tick_now - prev_tick); - else if (tick_now == prev_tick) + if (slot_now > prev_slot) + return (slot_now - prev_slot); + else if (slot_now == prev_slot) /* * Special case, same means we can go all of our * wheel less one slot. */ return (NUM_OF_HPTSI_SLOTS - 1); else - return ((NUM_OF_HPTSI_SLOTS - prev_tick) + tick_now); + return ((NUM_OF_HPTSI_SLOTS - prev_slot) + slot_now); } /* - * Given a tick on the wheel that is the current time - * mapped to the wheel (wheel_tick), what is the maximum + * Given a slot on the wheel that is the current time + * mapped to the wheel (wheel_slot), what is the maximum * distance forward that can be obtained without - * wrapping past either prev_tick or running_tick + * wrapping past either prev_slot or running_slot * depending on the htps state? Also if passed - * a uint32_t *, fill it with the tick location. + * a uint32_t *, fill it with the slot location. * * Note if you do not give this function the current - * time (that you think it is) mapped to the wheel + * time (that you think it is) mapped to the wheel slot * then the results will not be what you expect and * could lead to invalid inserts. */ static inline int32_t -max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t *target_tick) +max_slots_available(struct tcp_hpts_entry *hpts, uint32_t wheel_slot, uint32_t *target_slot) { - uint32_t dis_to_travel, end_tick, pacer_to_now, avail_on_wheel; + uint32_t dis_to_travel, end_slot, pacer_to_now, avail_on_wheel; if ((hpts->p_hpts_active == 1) && (hpts->p_wheel_complete == 0)) { - end_tick = hpts->p_runningtick; + end_slot = hpts->p_runningslot; /* Back up one tick */ - if (end_tick == 0) - end_tick = NUM_OF_HPTSI_SLOTS - 1; + if (end_slot == 0) + end_slot = NUM_OF_HPTSI_SLOTS - 1; else - end_tick--; - if (target_tick) - *target_tick = end_tick; + end_slot--; + if (target_slot) + *target_slot = end_slot; } else { /* * For the case where we are @@ -718,26 +732,26 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * * prev tick and subtract one from it. This puts us * as far out as possible on the wheel. */ - end_tick = hpts->p_prev_slot; - if (end_tick == 0) - end_tick = NUM_OF_HPTSI_SLOTS - 1; + end_slot = hpts->p_prev_slot; + if (end_slot == 0) + end_slot = NUM_OF_HPTSI_SLOTS - 1; else - end_tick--; - if (target_tick) - *target_tick = end_tick; + end_slot--; + if (target_slot) + *target_slot = end_slot; /* * Now we have close to the full wheel left minus the * time it has been since the pacer went to sleep. Note * that wheel_tick, passed in, should be the current time * from the perspective of the caller, mapped to the wheel. */ - if (hpts->p_prev_slot != wheel_tick) - dis_to_travel = hpts_ticks_diff(hpts->p_prev_slot, wheel_tick); + if (hpts->p_prev_slot != wheel_slot) + dis_to_travel = hpts_slots_diff(hpts->p_prev_slot, wheel_slot); else dis_to_travel = 1; /* * dis_to_travel in this case is the space from when the - * pacer stopped (p_prev_slot) and where our wheel_tick + * pacer stopped (p_prev_slot) and where our wheel_slot * is now. To know how many slots we can put it in we * subtract from the wheel size. We would not want * to place something after p_prev_slot or it will @@ -746,21 +760,21 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * return (NUM_OF_HPTSI_SLOTS - dis_to_travel); } /* - * So how many slots are open between p_runningtick -> p_cur_slot + * So how many slots are open between p_runningslot -> p_cur_slot * that is what is currently un-available for insertion. Special * case when we are at the last slot, this gets 1, so that * the answer to how many slots are available is all but 1. */ - if (hpts->p_runningtick == hpts->p_cur_slot) + if (hpts->p_runningslot == hpts->p_cur_slot) dis_to_travel = 1; else - dis_to_travel = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + dis_to_travel = hpts_slots_diff(hpts->p_runningslot, hpts->p_cur_slot); /* * How long has the pacer been running? */ - if (hpts->p_cur_slot != wheel_tick) { + if (hpts->p_cur_slot != wheel_slot) { /* The pacer is a bit late */ - pacer_to_now = hpts_ticks_diff(hpts->p_cur_slot, wheel_tick); + pacer_to_now = hpts_slots_diff(hpts->p_cur_slot, wheel_slot); } else { /* The pacer is right on time, now == pacers start time */ pacer_to_now = 0; @@ -774,24 +788,24 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * /* * Now how many of those we will eat due to the pacer's * time (p_cur_slot) of start being behind the - * real time (wheel_tick)? + * real time (wheel_slot)? */ if (avail_on_wheel <= pacer_to_now) { /* * Wheel wrap, we can't fit on the wheel, that * is unusual the system must be way overloaded! - * Insert into the assured tick, and return special + * Insert into the assured slot, and return special * "0". */ counter_u64_add(combined_wheel_wrap, 1); - *target_tick = hpts->p_nxt_slot; + *target_slot = hpts->p_nxt_slot; return (0); } else { /* * We know how many slots are open * on the wheel (the reverse of what * is left to run. Take away the time - * the pacer started to now (wheel_tick) + * the pacer started to now (wheel_slot) * and that tells you how many slots are * open that can be inserted into that won't * be touched by the pacer until later. @@ -815,7 +829,7 @@ tcp_queue_to_hpts_immediate_locked(struct inpcb *inp, struct tcp_hpts_entry *hpt * A sleeping hpts we want in next slot to run * note that in this state p_prev_slot == p_cur_slot */ - inp->inp_hptsslot = hpts_tick(hpts->p_prev_slot, 1); + inp->inp_hptsslot = hpts_slot(hpts->p_prev_slot, 1); if ((hpts->p_on_min_sleep == 0) && (hpts->p_hpts_active == 0)) need_wake = 1; } else if ((void *)inp == hpts->p_inp) { @@ -827,7 +841,7 @@ tcp_queue_to_hpts_immediate_locked(struct inpcb *inp, struct tcp_hpts_entry *hpt */ inp->inp_hptsslot = hpts->p_nxt_slot; } else - inp->inp_hptsslot = hpts->p_runningtick; + inp->inp_hptsslot = hpts->p_runningslot; hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, noref); if (need_wake) { /* @@ -862,9 +876,9 @@ check_if_slot_would_be_wrong(struct tcp_hpts_entry *hpts, struct inpcb *inp, uin * Sanity checks for the pacer with invariants * on insert. */ - if (inp_hptsslot >= NUM_OF_HPTSI_SLOTS) - panic("hpts:%p inp:%p slot:%d > max", - hpts, inp, inp_hptsslot); + KASSERT(inp_hptsslot < NUM_OF_HPTSI_SLOTS, + ("hpts:%p inp:%p slot:%d > max", + hpts, inp, inp_hptsslot)); if ((hpts->p_hpts_active) && (hpts->p_wheel_complete == 0)) { /* @@ -875,17 +889,16 @@ check_if_slot_would_be_wrong(struct tcp_hpts_entry *hpts, struct inpcb *inp, uin */ int distance, yet_to_run; - distance = hpts_ticks_diff(hpts->p_runningtick, inp_hptsslot); - if (hpts->p_runningtick != hpts->p_cur_slot) - yet_to_run = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + distance = hpts_slots_diff(hpts->p_runningslot, inp_hptsslot); + if (hpts->p_runningslot != hpts->p_cur_slot) + yet_to_run = hpts_slots_diff(hpts->p_runningslot, hpts->p_cur_slot); else yet_to_run = 0; /* processing last slot */ - if (yet_to_run > distance) { - panic("hpts:%p inp:%p slot:%d distance:%d yet_to_run:%d rs:%d cs:%d", - hpts, inp, inp_hptsslot, - distance, yet_to_run, - hpts->p_runningtick, hpts->p_cur_slot); - } + KASSERT(yet_to_run <= distance, + ("hpts:%p inp:%p slot:%d distance:%d yet_to_run:%d rs:%d cs:%d", + hpts, inp, inp_hptsslot, + distance, yet_to_run, + hpts->p_runningslot, hpts->p_cur_slot)); } } #endif @@ -895,8 +908,9 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t struct hpts_diag *diag, struct timeval *tv) { uint32_t need_new_to = 0; - uint32_t wheel_cts, last_tick; - int32_t wheel_tick, maxticks; + uint32_t wheel_cts; + int32_t wheel_slot, maxslots, last_slot; + int cpu; int8_t need_wakeup = 0; HPTS_MTX_ASSERT(hpts); @@ -904,7 +918,7 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t memset(diag, 0, sizeof(struct hpts_diag)); diag->p_hpts_active = hpts->p_hpts_active; diag->p_prev_slot = hpts->p_prev_slot; - diag->p_runningtick = hpts->p_runningtick; + diag->p_runningslot = hpts->p_runningslot; diag->p_nxt_slot = hpts->p_nxt_slot; diag->p_cur_slot = hpts->p_cur_slot; diag->p_curtick = hpts->p_curtick; @@ -913,131 +927,120 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t diag->p_on_min_sleep = hpts->p_on_min_sleep; diag->hpts_sleep_time = hpts->p_hpts_sleep_time; } - if (inp->inp_in_hpts == 0) { - if (slot == 0) { - /* Immediate */ - tcp_queue_to_hpts_immediate_locked(inp, hpts, line, 0); - return; - } - /* Get the current time relative to the wheel */ - wheel_cts = tcp_tv_to_hptstick(tv); - /* Map it onto the wheel */ - wheel_tick = tick_to_wheel(wheel_cts); - /* Now what's the max we can place it at? */ - maxticks = max_ticks_available(hpts, wheel_tick, &last_tick); - if (diag) { - diag->wheel_tick = wheel_tick; - diag->maxticks = maxticks; - diag->wheel_cts = wheel_cts; + KASSERT(inp->inp_in_hpts == 0, ("Hpts:%p tp:%p already on hpts and add?", hpts, inp)); + if (slot == 0) { + /* Immediate */ + tcp_queue_to_hpts_immediate_locked(inp, hpts, line, 0); + return; + } + /* Get the current time relative to the wheel */ + wheel_cts = tcp_tv_to_hptstick(tv); + /* Map it onto the wheel */ + wheel_slot = tick_to_wheel(wheel_cts); + /* Now what's the max we can place it at? */ + maxslots = max_slots_available(hpts, wheel_slot, &last_slot); + if (diag) { + diag->wheel_slot = wheel_slot; + diag->maxslots = maxslots; + diag->wheel_cts = wheel_cts; + } + if (maxslots == 0) { + /* The pacer is in a wheel wrap behind, yikes! */ + if (slot > 1) { + /* + * Reduce by 1 to prevent a forever loop in + * case something else is wrong. Note this + * probably does not hurt because the pacer + * if its true is so far behind we will be + * > 1second late calling anyway. + */ + slot--; } - if (maxticks == 0) { - /* The pacer is in a wheel wrap behind, yikes! */ - if (slot > 1) { - /* - * Reduce by 1 to prevent a forever loop in - * case something else is wrong. Note this - * probably does not hurt because the pacer - * if its true is so far behind we will be - * > 1second late calling anyway. - */ - slot--; - } - inp->inp_hptsslot = last_tick; - inp->inp_hpts_request = slot; - } else if (maxticks >= slot) { - /* It all fits on the wheel */ - inp->inp_hpts_request = 0; - inp->inp_hptsslot = hpts_tick(wheel_tick, slot); - } else { - /* It does not fit */ - inp->inp_hpts_request = slot - maxticks; - inp->inp_hptsslot = last_tick; + inp->inp_hptsslot = last_slot; + inp->inp_hpts_request = slot; + } else if (maxslots >= slot) { + /* It all fits on the wheel */ + inp->inp_hpts_request = 0; + inp->inp_hptsslot = hpts_slot(wheel_slot, slot); + } else { + /* It does not fit */ + inp->inp_hpts_request = slot - maxslots; + inp->inp_hptsslot = last_slot; + } + if (diag) { + diag->slot_remaining = inp->inp_hpts_request; + diag->inp_hptsslot = inp->inp_hptsslot; + } +#ifdef INVARIANTS + check_if_slot_would_be_wrong(hpts, inp, inp->inp_hptsslot, line); +#endif + hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, 0); + if ((hpts->p_hpts_active == 0) && + (inp->inp_hpts_request == 0) && + (hpts->p_on_min_sleep == 0)) { + /* + * The hpts is sleeping and NOT on a minimum + * sleep time, we need to figure out where + * it will wake up at and if we need to reschedule + * its time-out. + */ + uint32_t have_slept, yet_to_sleep; + + /* Now do we need to restart the hpts's timer? */ + have_slept = hpts_slots_diff(hpts->p_prev_slot, wheel_slot); + if (have_slept < hpts->p_hpts_sleep_time) + yet_to_sleep = hpts->p_hpts_sleep_time - have_slept; + else { + /* We are over-due */ + yet_to_sleep = 0; + need_wakeup = 1; } if (diag) { - diag->slot_remaining = inp->inp_hpts_request; - diag->inp_hptsslot = inp->inp_hptsslot; + diag->have_slept = have_slept; + diag->yet_to_sleep = yet_to_sleep; } -#ifdef INVARIANTS - check_if_slot_would_be_wrong(hpts, inp, inp->inp_hptsslot, line); -#endif - hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, 0); - if ((hpts->p_hpts_active == 0) && - (inp->inp_hpts_request == 0) && - (hpts->p_on_min_sleep == 0)) { + if (yet_to_sleep && *** 1485 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 20:39:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16A0D66533F; Tue, 13 Jul 2021 20:39:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPXZ36jVzz3KsY; Tue, 13 Jul 2021 20:39:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC71CDEC; Tue, 13 Jul 2021 20:39:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DKdt4s026605; Tue, 13 Jul 2021 20:39:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DKdtxH026604; Tue, 13 Jul 2021 20:39:55 GMT (envelope-from git) Date: Tue, 13 Jul 2021 20:39:55 GMT Message-Id: <202107132039.16DKdtxH026604@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 1bb521ab7de7 - stable/13 - tcp: Fix 32 bit platform breakage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1bb521ab7de7923c001bdbab30269dd3f336b371 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 20:39:56 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=1bb521ab7de7923c001bdbab30269dd3f336b371 commit 1bb521ab7de7923c001bdbab30269dd3f336b371 Author: Randall Stewart AuthorDate: 2021-07-08 11:06:58 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 19:59:50 +0000 tcp: Fix 32 bit platform breakage This fixes the incorrect use of a sysctl add to u64. It was for a useconds time, but on 32 bit platforms its not a u64. Instead use the long directive. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31107 (cherry picked from commit 7312e4e5cfc8e48597acf17f4faa8159f0b5fa06) --- sys/netinet/tcp_hpts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index 9a390e3a85c8..9ec092f703ec 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -2208,10 +2208,10 @@ tcp_init_hptsi(void *st) OID_AUTO, "lastran", CTLFLAG_RD, &cts_last_ran[i], 0, "The last usec tick that this hpts ran"); - SYSCTL_ADD_U64(&hpts->hpts_ctx, + SYSCTL_ADD_LONG(&hpts->hpts_ctx, SYSCTL_CHILDREN(hpts->hpts_root), OID_AUTO, "cur_min_sleep", CTLFLAG_RD, - &hpts->p_mysleep.tv_usec, 0, + &hpts->p_mysleep.tv_usec, "What the running pacers is using for p_mysleep.tv_usec"); SYSCTL_ADD_U64(&hpts->hpts_ctx, SYSCTL_CHILDREN(hpts->hpts_root), From owner-dev-commits-src-branches@freebsd.org Tue Jul 13 20:40:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1112F66551B; Tue, 13 Jul 2021 20:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPXb701xqz3LSv; Tue, 13 Jul 2021 20:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD79C9CD; Tue, 13 Jul 2021 20:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DKeoJA034973; Tue, 13 Jul 2021 20:40:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DKeoot034972; Tue, 13 Jul 2021 20:40:50 GMT (envelope-from git) Date: Tue, 13 Jul 2021 20:40:50 GMT Message-Id: <202107132040.16DKeoot034972@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 7751a6b58512 - stable/13 - tcp: fix alternate stack build with LINT-NO{INET, INET6, IP} MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7751a6b5851274c774c63aafd4dca70b68f2464d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 20:40:51 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=7751a6b5851274c774c63aafd4dca70b68f2464d commit 7751a6b5851274c774c63aafd4dca70b68f2464d Author: Andrew Gallatin AuthorDate: 2021-07-07 17:02:08 +0000 Commit: Michael Tuexen CommitDate: 2021-07-13 20:00:50 +0000 tcp: fix alternate stack build with LINT-NO{INET,INET6,IP} When fixing another bug, I noticed that the alternate TCP stacks do not build when various combinations of ipv4 and ipv6 are disabled. Reviewed by: rrs, tuexen Differential Revision: https://reviews.freebsd.org/D31094 Sponsored by: Netflix (cherry picked from commit b1e806c0ed960e1eb9ee889c7d0df3c168290c4f) --- sys/netinet/tcp_stacks/bbr.c | 9 ++++--- sys/netinet/tcp_stacks/rack.c | 45 ++++++++++++++++++++++++-------- sys/netinet/tcp_stacks/rack_bbr_common.c | 6 ++++- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 1877ad1a9efd..ac8e3423ebbb 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -3515,13 +3515,16 @@ bbr_get_header_oh(struct tcp_bbr *bbr) if (bbr->r_ctl.rc_inc_ip_oh) { /* Do we include IP overhead? */ #ifdef INET6 - if (bbr->r_is_v6) + if (bbr->r_is_v6) { seg_oh += sizeof(struct ip6_hdr); - else + } else #endif + { + #ifdef INET seg_oh += sizeof(struct ip); #endif + } } if (bbr->r_ctl.rc_inc_enet_oh) { /* Do we include the ethernet overhead? */ @@ -11956,7 +11959,7 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeval *tv) uint32_t tot_len = 0; uint32_t rtr_cnt = 0; uint32_t maxseg, pace_max_segs, p_maxseg; - int32_t csum_flags; + int32_t csum_flags = 0; int32_t hw_tls; #if defined(IPSEC) || defined(IPSEC_SUPPORT) unsigned ipsec_optlen = 0; diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 0badc42d3914..2f4668b027da 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12043,7 +12043,9 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) #ifdef INET struct ip *ip = NULL; #endif +#if defined(INET) || defined(INET6) struct udphdr *udp = NULL; +#endif /* Ok lets fill in the fast block, it can only be used with no IP options! */ #ifdef INET6 @@ -12067,6 +12069,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) ip6, rack->r_ctl.fsb.th); } else #endif /* INET6 */ +#ifdef INET { rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct tcpiphdr); ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; @@ -12086,6 +12089,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) tp->t_port, ip, rack->r_ctl.fsb.th); } +#endif rack->r_fsb_inited = 1; } @@ -15226,7 +15230,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma struct tcpopt to; u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; - int32_t slot, segsiz, max_val, tso = 0, error, flags, ulen = 0; + int32_t slot, segsiz, max_val, tso = 0, error = 0, flags, ulen = 0; uint32_t us_cts; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; @@ -15706,7 +15710,7 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val, u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; int cnt_thru = 1; - int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error, flags, ulen = 0; + int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error = 0, flags, ulen = 0; uint32_t us_cts, s_soff; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; @@ -16119,9 +16123,9 @@ rack_output(struct tcpcb *tp) long tot_len_this_send = 0; #ifdef INET struct ip *ip = NULL; -#endif #ifdef TCPDEBUG struct ipovly *ipov = NULL; +#endif #endif struct udphdr *udp = NULL; struct tcp_rack *rack; @@ -16130,7 +16134,10 @@ rack_output(struct tcpcb *tp) uint8_t mark = 0; uint8_t wanted_cookie = 0; u_char opt[TCP_MAXOLEN]; - unsigned ipoptlen, optlen, hdrlen, ulen=0; + unsigned ipoptlen, optlen, hdrlen; +#if defined(INET) || defined(INET6) + unsigned ulen=0; +#endif uint32_t rack_seq; #if defined(IPSEC) || defined(IPSEC_SUPPORT) @@ -17830,21 +17837,29 @@ send: #endif if ((ipoptlen == 0) && (rack->r_ctl.fsb.tcp_ip_hdr) && rack->r_fsb_inited) { #ifdef INET6 - if (isipv6) + if (isipv6) { ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr; - else + } else #endif /* INET6 */ + { +#ifdef INET ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; +#endif + } th = rack->r_ctl.fsb.th; udp = rack->r_ctl.fsb.udp; if (udp) { #ifdef INET6 - if (isipv6) + if (isipv6) { ulen = hdrlen + len - sizeof(struct ip6_hdr); - else + } else #endif /* INET6 */ + { +#ifdef INET ulen = hdrlen + len - sizeof(struct ip); - udp->uh_ulen = htons(ulen); + udp->uh_ulen = htons(ulen); +#endif + } } } else { #ifdef INET6 @@ -17863,6 +17878,7 @@ send: } else #endif /* INET6 */ { +#ifdef INET ip = mtod(m, struct ip *); #ifdef TCPDEBUG ipov = (struct ipovly *)ip; @@ -17877,6 +17893,7 @@ send: } else th = (struct tcphdr *)(ip + 1); tcpip_fillheaders(inp, tp->t_port, ip, th); +#endif /* INET */ } } /* @@ -17915,11 +17932,15 @@ send: if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && (sack_rxmit == 0)) { #ifdef INET6 - if (isipv6) + if (isipv6) { ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); - else + } else #endif + { +#ifdef INET ip->ip_tos |= IPTOS_ECN_ECT0; +#endif + } KMOD_TCPSTAT_INC(tcps_ecn_ect0); /* * Reply with proper ECN notifications. @@ -18024,7 +18045,9 @@ send: ip6 = mtod(m, struct ip6_hdr *); else #endif /* INET6 */ +#ifdef INET ip = mtod(m, struct ip *); +#endif /* INET */ th = (struct tcphdr *)(cpto + ((uint8_t *)rack->r_ctl.fsb.th - rack->r_ctl.fsb.tcp_ip_hdr)); /* If we have a udp header lets set it into the mbuf as well */ if (udp) diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c index 501d29ac48da..d9f48f733e93 100644 --- a/sys/netinet/tcp_stacks/rack_bbr_common.c +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c @@ -166,17 +166,21 @@ static int ctf_get_enet_type(struct ifnet *ifp, struct mbuf *m) { struct ether_header *eh; - struct tcphdr *th; #ifdef INET6 struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */ #endif #ifdef INET struct ip *ip = NULL; /* Keep compiler happy. */ #endif +#if defined(INET) || defined(INET6) + struct tcphdr *th; int32_t tlen; uint16_t drop_hdrlen; +#endif uint16_t etype; +#ifdef INET uint8_t iptos; +#endif /* Is it the easy way? */ if (m->m_flags & M_LRO_EHDRSTRP) From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 07:19:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6569A66D961; Wed, 14 Jul 2021 07:19:45 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPpmK03Nhz4s0n; Wed, 14 Jul 2021 07:19:44 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from smtpclient.apple (ip1f100e9c.dynamic.kabel-deutschland.de [31.16.14.156]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 9D115721E2825; Wed, 14 Jul 2021 09:19:39 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: c5ba872129b3 - stable/13 - tcp: tolerate missing timestamps From: Michael Tuexen In-Reply-To: <202107140411.16E4B9CA049744@nuc.oldach.net> Date: Wed, 14 Jul 2021 09:19:36 +0200 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-branches@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <358AF780-84F1-4F4C-8884-94E6CD685A02@freebsd.org> References: <202107140411.16E4B9CA049744@nuc.oldach.net> To: Helge Oldach X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4GPpmK03Nhz4s0n X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 07:19:45 -0000 > On 14. Jul 2021, at 06:11, Helge Oldach wrote: >=20 > Hi, >=20 > Michael Tuexen wrote on Tue, 13 Jul 2021 20:27:17 +0200 (CEST): >> The branch stable/13 has been updated by tuexen: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dc5ba872129b3afee95953294fbe55e01= 4559d408 >>=20 >> commit c5ba872129b3afee95953294fbe55e014559d408 >> Author: Michael Tuexen >> AuthorDate: 2021-06-11 18:14:34 +0000 >> Commit: Michael Tuexen >> CommitDate: 2021-07-13 18:24:09 +0000 >>=20 >> tcp: tolerate missing timestamps >>=20 >> Some TCP stacks negotiate TS support, but do not send TS at all >> or not for keep-alive segments. Since this includes modern widely >> deployed stacks, tolerate the violation of RFC 7323 per default. >>=20 >> Reviewed by: rgrimes, rrs, rscheff >> Differential Revision: https://reviews.freebsd.org/D30740 >> Sponsored by: Netflix, Inc. >=20 > I assume this would fix the behaviour discussed in = https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253476? Yes. Best regards Michael >=20 > Kind regards > Helge From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 07:44:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FBA466DFFA; Wed, 14 Jul 2021 07:44:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPqJk0clRz3C9r; Wed, 14 Jul 2021 07:44:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7BC212494; Wed, 14 Jul 2021 07:44:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16E7iL0C018224; Wed, 14 Jul 2021 07:44:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16E7iLd0018223; Wed, 14 Jul 2021 07:44:21 GMT (envelope-from git) Date: Wed, 14 Jul 2021 07:44:21 GMT Message-Id: <202107140744.16E7iLd0018223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: b9dc12859790 - stable/12 - tcp: tolerate missing timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b9dc1285979058cb2751675d926a773513e83fc8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 07:44:22 -0000 The branch stable/12 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b9dc1285979058cb2751675d926a773513e83fc8 commit b9dc1285979058cb2751675d926a773513e83fc8 Author: Michael Tuexen AuthorDate: 2021-06-11 18:14:34 +0000 Commit: Michael Tuexen CommitDate: 2021-07-14 07:43:16 +0000 tcp: tolerate missing timestamps Some TCP stacks negotiate TS support, but do not send TS at all or not for keep-alive segments. Since this includes modern widely deployed stacks, tolerate the violation of RFC 7323 per default. Reviewed by: rgrimes, rrs, rscheff Differential Revision: https://reviews.freebsd.org/D30740 Sponsored by: Netflix, Inc. (cherry picked from commit 870af3f4dc57a6bbfc03f6a49ca0d5b7ff1b975a) --- share/man/man4/tcp.4 | 6 ++++-- sys/netinet/tcp_subr.c | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index e1e87afd7fd6..ad7e3f117d68 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 14, 2021 +.Dd June 27, 2021 .Dt TCP 4 .Os .Sh NAME @@ -343,7 +343,9 @@ segments belonging to connections for which support of .Tn TCP timestamps has been negotiated. -(default is 0, i.e., the missing of timestamps is not tolerated). +As of June 2021, several TCP stacks are known to violate RFC 7323, including +modern widely deployed ones. +Therefore the default is 1, i.e., the missing of timestamps is tolerated. .It Dv TCPCTL_MSSDFLT .Pq Va mssdflt The default value used for the maximum segment size diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 5394a63c1a12..c82a5bf21a15 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -195,7 +195,14 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc1323), 0, "Enable rfc1323 (high performance TCP) extensions"); -VNET_DEFINE(int, tcp_tolerate_missing_ts) = 0; +/* + * As of June 2021, several TCP stacks violate RFC 7323 from September 2014. + * Some stacks negotiate TS, but never send them after connection setup. Some + * stacks negotiate TS, but don't send them when sending keep-alive segments. + * These include modern widely deployed TCP stacks. + * Therefore tolerating violations for now... + */ +VNET_DEFINE(int, tcp_tolerate_missing_ts) = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, tolerate_missing_ts, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_tolerate_missing_ts), 0, "Tolerate missing TCP timestamps"); From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 10:08:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF48D66FC92; Wed, 14 Jul 2021 10:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPtVv5N72z3tYr; Wed, 14 Jul 2021 10:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A10CC13FB6; Wed, 14 Jul 2021 10:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EA8Nbk005212; Wed, 14 Jul 2021 10:08:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EA8NQP005211; Wed, 14 Jul 2021 10:08:23 GMT (envelope-from git) Date: Wed, 14 Jul 2021 10:08:23 GMT Message-Id: <202107141008.16EA8NQP005211@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 1fcecff2b3b5 - stable/13 - pf: rename pf_state to pf_kstate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1fcecff2b3b52cd799eac0d83ff7cd5f9cd07212 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 10:08:23 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1fcecff2b3b52cd799eac0d83ff7cd5f9cd07212 commit 1fcecff2b3b52cd799eac0d83ff7cd5f9cd07212 Author: Kristof Provost AuthorDate: 2021-07-06 09:42:20 +0000 Commit: Kristof Provost CommitDate: 2021-07-14 05:55:54 +0000 pf: rename pf_state to pf_kstate Indicate that this is a kernel-only structure, and make it easier to distinguish from others used to communicate with userspace. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31096 (cherry picked from commit 211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49) --- sys/net/pfvar.h | 56 +++++++++++----------- sys/netpfil/pf/if_pfsync.c | 84 ++++++++++++++++----------------- sys/netpfil/pf/pf.c | 114 ++++++++++++++++++++++----------------------- sys/netpfil/pf/pf_ioctl.c | 42 ++++++++--------- sys/netpfil/pf/pf_norm.c | 4 +- sys/netpfil/pf/pf_nv.c | 2 +- sys/netpfil/pf/pf_nv.h | 2 +- 7 files changed, 152 insertions(+), 152 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b63f22e84bc0..5d4860ec981a 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -491,10 +491,10 @@ struct pf_state_key { u_int8_t pad[2]; LIST_ENTRY(pf_state_key) entry; - TAILQ_HEAD(, pf_state) states[2]; + TAILQ_HEAD(, pf_kstate) states[2]; }; -/* Keep synced with struct pf_state. */ +/* Keep synced with struct pf_kstate. */ struct pf_state_cmp { u_int64_t id; u_int32_t creatorid; @@ -511,16 +511,16 @@ struct pf_state_cmp { #define PFSTATE_SETMASK (PFSTATE_SETPRIO) #ifdef _KERNEL -struct pf_state { +struct pf_kstate { u_int64_t id; u_int32_t creatorid; u_int8_t direction; u_int8_t pad[3]; u_int refs; - TAILQ_ENTRY(pf_state) sync_list; - TAILQ_ENTRY(pf_state) key_list[2]; - LIST_ENTRY(pf_state) entry; + TAILQ_ENTRY(pf_kstate) sync_list; + TAILQ_ENTRY(pf_kstate) key_list[2]; + LIST_ENTRY(pf_kstate) entry; struct pf_state_peer src; struct pf_state_peer dst; union pf_krule_ptr rule; @@ -552,7 +552,7 @@ struct pf_state { /* * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that. */ -_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes"); +_Static_assert(sizeof(struct pf_kstate) <= 312, "pf_kstate size crosses 312 bytes"); #endif /* @@ -613,11 +613,11 @@ struct pfsync_state { #ifdef _KERNEL /* pfsync */ typedef int pfsync_state_import_t(struct pfsync_state *, u_int8_t); -typedef void pfsync_insert_state_t(struct pf_state *); -typedef void pfsync_update_state_t(struct pf_state *); -typedef void pfsync_delete_state_t(struct pf_state *); +typedef void pfsync_insert_state_t(struct pf_kstate *); +typedef void pfsync_update_state_t(struct pf_kstate *); +typedef void pfsync_delete_state_t(struct pf_kstate *); typedef void pfsync_clear_states_t(u_int32_t, const char *); -typedef int pfsync_defer_t(struct pf_state *, struct mbuf *); +typedef int pfsync_defer_t(struct pf_kstate *, struct mbuf *); typedef void pfsync_detach_ifnet_t(struct ifnet *); VNET_DECLARE(pfsync_state_import_t *, pfsync_state_import_ptr); @@ -635,7 +635,7 @@ VNET_DECLARE(pfsync_defer_t *, pfsync_defer_ptr); extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, - struct pf_state *); + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1410,7 +1410,7 @@ struct pf_keyhash { }; struct pf_idhash { - LIST_HEAD(, pf_state) states; + LIST_HEAD(, pf_kstate) states; struct mtx lock; }; @@ -1484,26 +1484,26 @@ extern void pf_unload_vnet_purge(void); extern void pf_intr(void *); extern void pf_purge_expired_src_nodes(void); -extern int pf_unlink_state(struct pf_state *, u_int); +extern int pf_unlink_state(struct pf_kstate *, u_int); #define PF_ENTER_LOCKED 0x00000001 #define PF_RETURN_LOCKED 0x00000002 extern int pf_state_insert(struct pfi_kkif *, struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, - struct pf_state *); -extern struct pf_state *pf_alloc_state(int); -extern void pf_free_state(struct pf_state *); + struct pf_kstate *); +extern struct pf_kstate *pf_alloc_state(int); +extern void pf_free_state(struct pf_kstate *); static __inline void -pf_ref_state(struct pf_state *s) +pf_ref_state(struct pf_kstate *s) { refcount_acquire(&s->refs); } static __inline int -pf_release_state(struct pf_state *s) +pf_release_state(struct pf_kstate *s) { if (refcount_release(&s->refs)) { @@ -1514,7 +1514,7 @@ pf_release_state(struct pf_state *s) } static __inline int -pf_release_staten(struct pf_state *s, u_int n) +pf_release_staten(struct pf_kstate *s, u_int n) { if (refcount_releasen(&s->refs, n)) { @@ -1524,14 +1524,14 @@ pf_release_staten(struct pf_state *s, u_int n) return (0); } -extern struct pf_state *pf_find_state_byid(uint64_t, uint32_t); -extern struct pf_state *pf_find_state_all(struct pf_state_key_cmp *, +extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); +extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); extern u_int pf_free_src_nodes(struct pf_ksrc_node_list *); -extern void pf_print_state(struct pf_state *); +extern void pf_print_state(struct pf_kstate *); extern void pf_print_flags(u_int8_t); extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, u_int8_t); @@ -1562,7 +1562,7 @@ void pf_addr_inc(struct pf_addr *, sa_family_t); int pf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *); #endif /* INET6 */ -u_int32_t pf_new_isn(struct pf_state *); +u_int32_t pf_new_isn(struct pf_kstate *); void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *, sa_family_t); void pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t); @@ -1573,7 +1573,7 @@ void pf_patch_16_unaligned(struct mbuf *, u_int16_t *, void *, u_int16_t, bool, u_int8_t); void pf_patch_32_unaligned(struct mbuf *, u_int16_t *, void *, u_int32_t, bool, u_int8_t); -void pf_send_deferred_syn(struct pf_state *); +void pf_send_deferred_syn(struct pf_kstate *); int pf_match_addr(u_int8_t, struct pf_addr *, struct pf_addr *, struct pf_addr *, sa_family_t); int pf_match_addr_range(struct pf_addr *, struct pf_addr *, @@ -1584,14 +1584,14 @@ void pf_normalize_init(void); void pf_normalize_cleanup(void); int pf_normalize_tcp(int, struct pfi_kkif *, struct mbuf *, int, int, void *, struct pf_pdesc *); -void pf_normalize_tcp_cleanup(struct pf_state *); +void pf_normalize_tcp_cleanup(struct pf_kstate *); int pf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *, struct tcphdr *, struct pf_state_peer *, struct pf_state_peer *); int pf_normalize_tcp_stateful(struct mbuf *, int, struct pf_pdesc *, - u_short *, struct tcphdr *, struct pf_state *, + u_short *, struct tcphdr *, struct pf_kstate *, struct pf_state_peer *, struct pf_state_peer *, int *); u_int32_t - pf_state_expires(const struct pf_state *); + pf_state_expires(const struct pf_kstate *); void pf_purge_expired_fragments(void); void pf_purge_fragments(uint32_t); int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *, diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 16878fe87750..7208444d65d7 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -115,7 +115,7 @@ struct pfsync_pkt { u_int8_t flags; }; -static int pfsync_upd_tcp(struct pf_state *, struct pfsync_state_peer *, +static int pfsync_upd_tcp(struct pf_kstate *, struct pfsync_state_peer *, struct pfsync_state_peer *); static int pfsync_in_clr(struct pfsync_pkt *, struct mbuf *, int, int); static int pfsync_in_ins(struct pfsync_pkt *, struct mbuf *, int, int); @@ -147,16 +147,16 @@ static int (*pfsync_acts[])(struct pfsync_pkt *, struct mbuf *, int, int) = { }; struct pfsync_q { - void (*write)(struct pf_state *, void *); + void (*write)(struct pf_kstate *, void *); size_t len; u_int8_t action; }; /* we have one of these for every PFSYNC_S_ */ -static void pfsync_out_state(struct pf_state *, void *); -static void pfsync_out_iack(struct pf_state *, void *); -static void pfsync_out_upd_c(struct pf_state *, void *); -static void pfsync_out_del(struct pf_state *, void *); +static void pfsync_out_state(struct pf_kstate *, void *); +static void pfsync_out_iack(struct pf_kstate *, void *); +static void pfsync_out_upd_c(struct pf_kstate *, void *); +static void pfsync_out_del(struct pf_kstate *, void *); static struct pfsync_q pfsync_qs[] = { { pfsync_out_state, sizeof(struct pfsync_state), PFSYNC_ACT_INS }, @@ -166,10 +166,10 @@ static struct pfsync_q pfsync_qs[] = { { pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } }; -static void pfsync_q_ins(struct pf_state *, int, bool); -static void pfsync_q_del(struct pf_state *, bool, struct pfsync_bucket *); +static void pfsync_q_ins(struct pf_kstate *, int, bool); +static void pfsync_q_del(struct pf_kstate *, bool, struct pfsync_bucket *); -static void pfsync_update_state(struct pf_state *); +static void pfsync_update_state(struct pf_kstate *); struct pfsync_upd_req_item { TAILQ_ENTRY(pfsync_upd_req_item) ur_entry; @@ -182,7 +182,7 @@ struct pfsync_deferral { u_int pd_refs; struct callout pd_tmo; - struct pf_state *pd_st; + struct pf_kstate *pd_st; struct mbuf *pd_m; }; @@ -198,7 +198,7 @@ struct pfsync_bucket #define PFSYNCF_BUCKET_PUSH 0x00000001 size_t b_len; - TAILQ_HEAD(, pf_state) b_qs[PFSYNC_S_COUNT]; + TAILQ_HEAD(, pf_kstate) b_qs[PFSYNC_S_COUNT]; TAILQ_HEAD(, pfsync_upd_req_item) b_upd_req_list; TAILQ_HEAD(, pfsync_deferral) b_deferrals; u_int b_deferred; @@ -291,13 +291,13 @@ static int pfsyncoutput(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); static int pfsyncioctl(struct ifnet *, u_long, caddr_t); -static int pfsync_defer(struct pf_state *, struct mbuf *); +static int pfsync_defer(struct pf_kstate *, struct mbuf *); static void pfsync_undefer(struct pfsync_deferral *, int); -static void pfsync_undefer_state(struct pf_state *, int); +static void pfsync_undefer_state(struct pf_kstate *, int); static void pfsync_defer_tmo(void *); static void pfsync_request_update(u_int32_t, u_int64_t); -static bool pfsync_update_state_req(struct pf_state *); +static bool pfsync_update_state_req(struct pf_kstate *); static void pfsync_drop(struct pfsync_softc *); static void pfsync_sendout(int, int); @@ -313,7 +313,7 @@ static void pfsync_detach_ifnet(struct ifnet *); static void pfsync_update_net_tdb(struct pfsync_tdb *); #endif static struct pfsync_bucket *pfsync_get_bucket(struct pfsync_softc *, - struct pf_state *); + struct pf_kstate *); #define PFSYNC_MAX_BULKTRIES 12 @@ -461,7 +461,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) struct pfsync_state_key key[2]; #endif struct pfsync_state_key *kw, *ks; - struct pf_state *st = NULL; + struct pf_kstate *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; struct pf_krule *r = NULL; struct pfi_kkif *kif; @@ -753,7 +753,7 @@ pfsync_in_clr(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) for (int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; - struct pf_state *s; + struct pf_kstate *s; relock: PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { @@ -812,7 +812,7 @@ static int pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_ins_ack *ia, *iaa; - struct pf_state *st; + struct pf_kstate *st; struct mbuf *mp; int len = count * sizeof(*ia); @@ -846,7 +846,7 @@ pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) } static int -pfsync_upd_tcp(struct pf_state *st, struct pfsync_state_peer *src, +pfsync_upd_tcp(struct pf_kstate *st, struct pfsync_state_peer *src, struct pfsync_state_peer *dst) { int sync = 0; @@ -884,7 +884,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_state *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int sync; struct mbuf *mp; @@ -970,7 +970,7 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_upd_c *ua, *up; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*up); int sync; struct mbuf *mp; @@ -1060,7 +1060,7 @@ pfsync_in_ureq(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) int len = count * sizeof(*ur); int i, offp; - struct pf_state *st; + struct pf_kstate *st; mp = m_pulldown(m, offset, len, &offp); if (mp == NULL) { @@ -1098,7 +1098,7 @@ pfsync_in_del(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct mbuf *mp; struct pfsync_state *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*sp); int offp, i; @@ -1129,7 +1129,7 @@ pfsync_in_del_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct mbuf *mp; struct pfsync_del_c *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*sp); int offp, i; @@ -1480,7 +1480,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } static void -pfsync_out_state(struct pf_state *st, void *buf) +pfsync_out_state(struct pf_kstate *st, void *buf) { struct pfsync_state *sp = buf; @@ -1488,7 +1488,7 @@ pfsync_out_state(struct pf_state *st, void *buf) } static void -pfsync_out_iack(struct pf_state *st, void *buf) +pfsync_out_iack(struct pf_kstate *st, void *buf) { struct pfsync_ins_ack *iack = buf; @@ -1497,7 +1497,7 @@ pfsync_out_iack(struct pf_state *st, void *buf) } static void -pfsync_out_upd_c(struct pf_state *st, void *buf) +pfsync_out_upd_c(struct pf_kstate *st, void *buf) { struct pfsync_upd_c *up = buf; @@ -1510,7 +1510,7 @@ pfsync_out_upd_c(struct pf_state *st, void *buf) } static void -pfsync_out_del(struct pf_state *st, void *buf) +pfsync_out_del(struct pf_kstate *st, void *buf) { struct pfsync_del_c *dp = buf; @@ -1522,7 +1522,7 @@ pfsync_out_del(struct pf_state *st, void *buf) static void pfsync_drop(struct pfsync_softc *sc) { - struct pf_state *st, *next; + struct pf_kstate *st, *next; struct pfsync_upd_req_item *ur; struct pfsync_bucket *b; int c, q; @@ -1562,7 +1562,7 @@ pfsync_sendout(int schedswi, int c) struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; - struct pf_state *st, *st_next; + struct pf_kstate *st, *st_next; struct pfsync_upd_req_item *ur; struct pfsync_bucket *b = &sc->sc_buckets[c]; int offset; @@ -1702,7 +1702,7 @@ pfsync_sendout(int schedswi, int c) } static void -pfsync_insert_state(struct pf_state *st) +pfsync_insert_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); @@ -1730,7 +1730,7 @@ pfsync_insert_state(struct pf_state *st) } static int -pfsync_defer(struct pf_state *st, struct mbuf *m) +pfsync_defer(struct pf_kstate *st, struct mbuf *m) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; @@ -1778,7 +1778,7 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop) { struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; - struct pf_state *st = pd->pd_st; + struct pf_kstate *st = pd->pd_st; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PFSYNC_BUCKET_LOCK_ASSERT(b); @@ -1804,7 +1804,7 @@ pfsync_defer_tmo(void *arg) struct pfsync_deferral *pd = arg; struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; - struct pf_state *st = pd->pd_st; + struct pf_kstate *st = pd->pd_st; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PFSYNC_BUCKET_LOCK_ASSERT(b); @@ -1828,7 +1828,7 @@ pfsync_defer_tmo(void *arg) } static void -pfsync_undefer_state(struct pf_state *st, int drop) +pfsync_undefer_state(struct pf_kstate *st, int drop) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; @@ -1851,14 +1851,14 @@ pfsync_undefer_state(struct pf_state *st, int drop) } static struct pfsync_bucket* -pfsync_get_bucket(struct pfsync_softc *sc, struct pf_state *st) +pfsync_get_bucket(struct pfsync_softc *sc, struct pf_kstate *st) { int c = PF_IDHASH(st) % pfsync_buckets; return &sc->sc_buckets[c]; } static void -pfsync_update_state(struct pf_state *st) +pfsync_update_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; bool sync = false, ref = true; @@ -1956,7 +1956,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) } static bool -pfsync_update_state_req(struct pf_state *st) +pfsync_update_state_req(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; bool ref = true, full = false; @@ -2003,7 +2003,7 @@ pfsync_update_state_req(struct pf_state *st) } static void -pfsync_delete_state(struct pf_state *st) +pfsync_delete_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); @@ -2067,7 +2067,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *ifname) } static void -pfsync_q_ins(struct pf_state *st, int q, bool ref) +pfsync_q_ins(struct pf_kstate *st, int q, bool ref) { struct pfsync_softc *sc = V_pfsyncif; size_t nlen = pfsync_qs[q].len; @@ -2097,7 +2097,7 @@ pfsync_q_ins(struct pf_state *st, int q, bool ref) } static void -pfsync_q_del(struct pf_state *st, bool unref, struct pfsync_bucket *b) +pfsync_q_del(struct pf_kstate *st, bool unref, struct pfsync_bucket *b) { int q = st->sync_state; @@ -2137,7 +2137,7 @@ static void pfsync_bulk_update(void *arg) { struct pfsync_softc *sc = arg; - struct pf_state *s; + struct pf_kstate *s; int i, sent = 0; PFSYNC_BLOCK_ASSERT(sc); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 6ac19c9ad5d3..04a62535f461 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -115,12 +115,12 @@ __FBSDID("$FreeBSD$"); SDT_PROVIDER_DEFINE(pf); SDT_PROBE_DEFINE4(pf, ip, test, done, "int", "int", "struct pf_krule *", - "struct pf_state *"); + "struct pf_kstate *"); SDT_PROBE_DEFINE4(pf, ip, test6, done, "int", "int", "struct pf_krule *", - "struct pf_state *"); + "struct pf_kstate *"); SDT_PROBE_DEFINE5(pf, ip, state, lookup, "struct pfi_kkif *", "struct pf_state_key_cmp *", "int", "struct pf_pdesc *", - "struct pf_state *"); + "struct pf_kstate *"); /* * Global variables @@ -224,7 +224,7 @@ VNET_DEFINE(uint64_t, pf_stateid[MAXCPU]); #define PFID_MAXID (~PFID_CPUMASK) CTASSERT((1 << PFID_CPUBITS) >= MAXCPU); -static void pf_src_tree_remove_state(struct pf_state *); +static void pf_src_tree_remove_state(struct pf_kstate *); static void pf_init_threshold(struct pf_threshold *, u_int32_t, u_int32_t); static void pf_add_threshold(struct pf_threshold *); @@ -247,13 +247,13 @@ static void pf_send_tcp(struct mbuf *, u_int16_t, struct ifnet *); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); -static void pf_detach_state(struct pf_state *); +static void pf_detach_state(struct pf_kstate *); static int pf_state_key_attach(struct pf_state_key *, - struct pf_state_key *, struct pf_state *); -static void pf_state_key_detach(struct pf_state *, int); + struct pf_state_key *, struct pf_kstate *); +static void pf_state_key_detach(struct pf_kstate *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); -static int pf_test_rule(struct pf_krule **, struct pf_state **, +static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **, struct inpcb *); @@ -262,29 +262,29 @@ static int pf_create_state(struct pf_krule *, struct pf_krule *, struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, u_int16_t, u_int16_t, int *, struct pfi_kkif *, - struct pf_state **, int, u_int16_t, u_int16_t, + struct pf_kstate **, int, u_int16_t, u_int16_t, int); static int pf_test_fragment(struct pf_krule **, int, struct pfi_kkif *, struct mbuf *, void *, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **); static int pf_tcp_track_full(struct pf_state_peer *, - struct pf_state_peer *, struct pf_state **, + struct pf_state_peer *, struct pf_kstate **, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, u_short *, int *); static int pf_tcp_track_sloppy(struct pf_state_peer *, - struct pf_state_peer *, struct pf_state **, + struct pf_state_peer *, struct pf_kstate **, struct pf_pdesc *, u_short *); -static int pf_test_state_tcp(struct pf_state **, int, +static int pf_test_state_tcp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); -static int pf_test_state_udp(struct pf_state **, int, +static int pf_test_state_udp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *); -static int pf_test_state_icmp(struct pf_state **, int, +static int pf_test_state_icmp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); -static int pf_test_state_other(struct pf_state **, int, +static int pf_test_state_other(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); @@ -294,15 +294,15 @@ static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, u_int8_t, sa_family_t); -static void pf_print_state_parts(struct pf_state *, +static void pf_print_state_parts(struct pf_kstate *, struct pf_state_key *, struct pf_state_key *); static int pf_addr_wrap_neq(struct pf_addr_wrap *, struct pf_addr_wrap *); static void pf_patch_8(struct mbuf *, u_int16_t *, u_int8_t *, u_int8_t, bool, u_int8_t); -static struct pf_state *pf_find_state(struct pfi_kkif *, +static struct pf_kstate *pf_find_state(struct pfi_kkif *, struct pf_state_key_cmp *, u_int); -static int pf_src_connlimit(struct pf_state **); +static int pf_src_connlimit(struct pf_kstate **); static void pf_overload_task(void *v, int pending); static int pf_insert_src_node(struct pf_ksrc_node **, struct pf_krule *, struct pf_addr *, sa_family_t); @@ -312,14 +312,14 @@ static int pf_mtag_uminit(void *, int, int); static void pf_mtag_free(struct m_tag *); #ifdef INET static void pf_route(struct mbuf **, struct pf_krule *, int, - struct ifnet *, struct pf_state *, + struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET */ #ifdef INET6 static void pf_change_a6(struct pf_addr *, u_int16_t *, struct pf_addr *, u_int8_t); static void pf_route6(struct mbuf **, struct pf_krule *, int, - struct ifnet *, struct pf_state *, + struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET6 */ @@ -476,7 +476,7 @@ pf_hashsrc(struct pf_addr *addr, sa_family_t af) #ifdef ALTQ static int -pf_state_hash(struct pf_state *s) +pf_state_hash(struct pf_kstate *s) { u_int32_t hv = (intptr_t)s / sizeof(*s); @@ -539,7 +539,7 @@ pf_check_threshold(struct pf_threshold *threshold) } static int -pf_src_connlimit(struct pf_state **state) +pf_src_connlimit(struct pf_kstate **state) { struct pf_overload_entry *pfoe; int bad = 0; @@ -655,7 +655,7 @@ pf_overload_task(void *v, int pending) for (int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; struct pf_state_key *sk; - struct pf_state *s; + struct pf_kstate *s; PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { @@ -840,7 +840,7 @@ pf_initialize() V_pf_hashseed = arc4random(); /* States and state keys storage. */ - V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_state), + V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_kstate), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); V_pf_limits[PF_LIMIT_STATES].zone = V_pf_state_z; uma_zone_set_max(V_pf_state_z, PFSTATE_HIWAT); @@ -1003,11 +1003,11 @@ pf_get_mtag(struct mbuf *m) static int pf_state_key_attach(struct pf_state_key *skw, struct pf_state_key *sks, - struct pf_state *s) + struct pf_kstate *s) { struct pf_keyhash *khs, *khw, *kh; struct pf_state_key *sk, *cur; - struct pf_state *si, *olds = NULL; + struct pf_kstate *si, *olds = NULL; int idx; KASSERT(s->refs == 0, ("%s: state not pristine", __func__)); @@ -1168,7 +1168,7 @@ stateattach: } static void -pf_detach_state(struct pf_state *s) +pf_detach_state(struct pf_kstate *s) { struct pf_state_key *sks = s->key[PF_SK_STACK]; struct pf_keyhash *kh; @@ -1199,7 +1199,7 @@ pf_detach_state(struct pf_state *s) } static void -pf_state_key_detach(struct pf_state *s, int idx) +pf_state_key_detach(struct pf_kstate *s, int idx) { struct pf_state_key *sk = s->key[idx]; #ifdef INVARIANTS @@ -1264,10 +1264,10 @@ pf_state_key_clone(struct pf_state_key *orig) int pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, - struct pf_state_key *skw, struct pf_state_key *sks, struct pf_state *s) + struct pf_state_key *skw, struct pf_state_key *sks, struct pf_kstate *s) { struct pf_idhash *ih; - struct pf_state *cur; + struct pf_kstate *cur; int error; KASSERT(TAILQ_EMPTY(&sks->states[0]) && TAILQ_EMPTY(&sks->states[1]), @@ -1324,11 +1324,11 @@ pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, /* * Find state by ID: returns with locked row on success. */ -struct pf_state * +struct pf_kstate * pf_find_state_byid(uint64_t id, uint32_t creatorid) { struct pf_idhash *ih; - struct pf_state *s; + struct pf_kstate *s; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1349,12 +1349,12 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid) * Find state by key. * Returns with ID hash slot locked on success. */ -static struct pf_state * +static struct pf_kstate * pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) { struct pf_keyhash *kh; struct pf_state_key *sk; - struct pf_state *s; + struct pf_kstate *s; int idx; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1393,12 +1393,12 @@ pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) return (NULL); } -struct pf_state * +struct pf_kstate * pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more) { struct pf_keyhash *kh; struct pf_state_key *sk; - struct pf_state *s, *ret = NULL; + struct pf_kstate *s, *ret = NULL; int idx, inout = 0; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1588,7 +1588,7 @@ pf_unload_vnet_purge(void) } u_int32_t -pf_state_expires(const struct pf_state *state) +pf_state_expires(const struct pf_kstate *state) { u_int32_t timeout; u_int32_t start; @@ -1652,7 +1652,7 @@ pf_purge_expired_src_nodes() } static void -pf_src_tree_remove_state(struct pf_state *s) +pf_src_tree_remove_state(struct pf_kstate *s) { struct pf_ksrc_node *sn; struct pf_srchash *sh; @@ -1689,7 +1689,7 @@ pf_src_tree_remove_state(struct pf_state *s) * unlocked, since it needs to go through key hash locking. */ int -pf_unlink_state(struct pf_state *s, u_int flags) +pf_unlink_state(struct pf_kstate *s, u_int flags) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; @@ -1736,7 +1736,7 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (pf_release_staten(s, 2)); } -struct pf_state * +struct pf_kstate * pf_alloc_state(int flags) { @@ -1744,7 +1744,7 @@ pf_alloc_state(int flags) } void -pf_free_state(struct pf_state *cur) +pf_free_state(struct pf_kstate *cur) { KASSERT(cur->refs == 0, ("%s: %p has refs", __func__, cur)); @@ -1763,7 +1763,7 @@ static u_int pf_purge_expired_states(u_int i, int maxcheck) { struct pf_idhash *ih; - struct pf_state *s; + struct pf_kstate *s; V_pf_status.states = uma_zone_get_cur(V_pf_state_z); @@ -1921,13 +1921,13 @@ pf_print_host(struct pf_addr *addr, u_int16_t p, sa_family_t af) } void -pf_print_state(struct pf_state *s) +pf_print_state(struct pf_kstate *s) { pf_print_state_parts(s, NULL, NULL); } static void -pf_print_state_parts(struct pf_state *s, +pf_print_state_parts(struct pf_kstate *s, struct pf_state_key *skwp, struct pf_state_key *sksp) { struct pf_state_key *skw, *sks; @@ -3326,7 +3326,7 @@ pf_tcp_iss(struct pf_pdesc *pd) } static int -pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, +pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, struct pf_krule **am, struct pf_kruleset **rsm, struct inpcb *inp) { @@ -3703,10 +3703,10 @@ static int pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, - u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_state **sm, + u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_kstate **sm, int tag, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen) { - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_ksrc_node *sn = NULL; struct tcphdr *th = &pd->hdr.tcp; u_int16_t mss = V_tcp_mssdflt; @@ -4045,7 +4045,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, static int pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pfi_kkif *kif, struct mbuf *m, int off, + struct pf_kstate **state, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, u_short *reason, int *copyback) { struct tcphdr *th = &pd->hdr.tcp; @@ -4371,7 +4371,7 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, static int pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pf_pdesc *pd, u_short *reason) + struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) { struct tcphdr *th = &pd->hdr.tcp; @@ -4441,7 +4441,7 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { @@ -4609,7 +4609,7 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_udp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -4676,7 +4676,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_icmp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { struct pf_addr *saddr = pd->src, *daddr = pd->dst; @@ -5280,7 +5280,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_other(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_other(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -5452,7 +5452,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *kif, #ifdef INET static void pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, - struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) + struct pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0, *m1; struct sockaddr_in dst; @@ -5640,7 +5640,7 @@ bad: #ifdef INET6 static void pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, - struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) + struct pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0; struct sockaddr_in6 dst; @@ -5929,7 +5929,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * struct ip *h = NULL; struct m_tag *ipfwtag; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, dirndx, pqid = 0; @@ -6317,7 +6317,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb struct m_tag *mtag; struct ip6_hdr *h = NULL; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 2e332156a488..4eebc8a43de8 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1783,7 +1783,7 @@ pf_label_match(const struct pf_krule *rule, const char *label) static unsigned int pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) { - struct pf_state *match; + struct pf_kstate *match; int more = 0; unsigned int killed = 0; @@ -1801,7 +1801,7 @@ pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) static int pf_killstates_row(struct pf_kstate_kill *psk, struct pf_idhash *ih) { *** 167 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 10:08:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C213A66FD1E; Wed, 14 Jul 2021 10:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPtWX4rfLz3tl4; Wed, 14 Jul 2021 10:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 874DB13DE8; Wed, 14 Jul 2021 10:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EA8uml005365; Wed, 14 Jul 2021 10:08:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EA8u8e005364; Wed, 14 Jul 2021 10:08:56 GMT (envelope-from git) Date: Wed, 14 Jul 2021 10:08:56 GMT Message-Id: <202107141008.16EA8u8e005364@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 1adc5faa2ae0 - stable/12 - pf: rename pf_state to pf_kstate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1adc5faa2ae0c0128f322bae6f8ec14fa9e5feb3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 10:08:56 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1adc5faa2ae0c0128f322bae6f8ec14fa9e5feb3 commit 1adc5faa2ae0c0128f322bae6f8ec14fa9e5feb3 Author: Kristof Provost AuthorDate: 2021-07-06 09:42:20 +0000 Commit: Kristof Provost CommitDate: 2021-07-14 10:08:39 +0000 pf: rename pf_state to pf_kstate Indicate that this is a kernel-only structure, and make it easier to distinguish from others used to communicate with userspace. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31096 (cherry picked from commit 211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49) --- sys/net/pfvar.h | 56 +++++++++++----------- sys/netpfil/pf/if_pfsync.c | 84 ++++++++++++++++----------------- sys/netpfil/pf/pf.c | 114 ++++++++++++++++++++++----------------------- sys/netpfil/pf/pf_ioctl.c | 42 ++++++++--------- sys/netpfil/pf/pf_norm.c | 4 +- sys/netpfil/pf/pf_nv.c | 2 +- sys/netpfil/pf/pf_nv.h | 2 +- 7 files changed, 152 insertions(+), 152 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index c11455837072..6fbbb46b69b9 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -491,10 +491,10 @@ struct pf_state_key { u_int8_t pad[2]; LIST_ENTRY(pf_state_key) entry; - TAILQ_HEAD(, pf_state) states[2]; + TAILQ_HEAD(, pf_kstate) states[2]; }; -/* Keep synced with struct pf_state. */ +/* Keep synced with struct pf_kstate. */ struct pf_state_cmp { u_int64_t id; u_int32_t creatorid; @@ -511,16 +511,16 @@ struct pf_state_cmp { #define PFSTATE_SETMASK (PFSTATE_SETPRIO) #ifdef _KERNEL -struct pf_state { +struct pf_kstate { u_int64_t id; u_int32_t creatorid; u_int8_t direction; u_int8_t pad[3]; u_int refs; - TAILQ_ENTRY(pf_state) sync_list; - TAILQ_ENTRY(pf_state) key_list[2]; - LIST_ENTRY(pf_state) entry; + TAILQ_ENTRY(pf_kstate) sync_list; + TAILQ_ENTRY(pf_kstate) key_list[2]; + LIST_ENTRY(pf_kstate) entry; struct pf_state_peer src; struct pf_state_peer dst; union pf_krule_ptr rule; @@ -552,7 +552,7 @@ struct pf_state { /* * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that. */ -_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes"); +_Static_assert(sizeof(struct pf_kstate) <= 312, "pf_kstate size crosses 312 bytes"); #endif /* @@ -613,11 +613,11 @@ struct pfsync_state { #ifdef _KERNEL /* pfsync */ typedef int pfsync_state_import_t(struct pfsync_state *, u_int8_t); -typedef void pfsync_insert_state_t(struct pf_state *); -typedef void pfsync_update_state_t(struct pf_state *); -typedef void pfsync_delete_state_t(struct pf_state *); +typedef void pfsync_insert_state_t(struct pf_kstate *); +typedef void pfsync_update_state_t(struct pf_kstate *); +typedef void pfsync_delete_state_t(struct pf_kstate *); typedef void pfsync_clear_states_t(u_int32_t, const char *); -typedef int pfsync_defer_t(struct pf_state *, struct mbuf *); +typedef int pfsync_defer_t(struct pf_kstate *, struct mbuf *); typedef void pfsync_detach_ifnet_t(struct ifnet *); VNET_DECLARE(pfsync_state_import_t *, pfsync_state_import_ptr); @@ -635,7 +635,7 @@ VNET_DECLARE(pfsync_defer_t *, pfsync_defer_ptr); extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, - struct pf_state *); + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1411,7 +1411,7 @@ struct pf_keyhash { }; struct pf_idhash { - LIST_HEAD(, pf_state) states; + LIST_HEAD(, pf_kstate) states; struct mtx lock; }; @@ -1485,26 +1485,26 @@ extern void pf_unload_vnet_purge(void); extern void pf_intr(void *); extern void pf_purge_expired_src_nodes(void); -extern int pf_unlink_state(struct pf_state *, u_int); +extern int pf_unlink_state(struct pf_kstate *, u_int); #define PF_ENTER_LOCKED 0x00000001 #define PF_RETURN_LOCKED 0x00000002 extern int pf_state_insert(struct pfi_kkif *, struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, - struct pf_state *); -extern struct pf_state *pf_alloc_state(int); -extern void pf_free_state(struct pf_state *); + struct pf_kstate *); +extern struct pf_kstate *pf_alloc_state(int); +extern void pf_free_state(struct pf_kstate *); static __inline void -pf_ref_state(struct pf_state *s) +pf_ref_state(struct pf_kstate *s) { refcount_acquire(&s->refs); } static __inline int -pf_release_state(struct pf_state *s) +pf_release_state(struct pf_kstate *s) { if (refcount_release(&s->refs)) { @@ -1515,7 +1515,7 @@ pf_release_state(struct pf_state *s) } static __inline int -pf_release_staten(struct pf_state *s, u_int n) +pf_release_staten(struct pf_kstate *s, u_int n) { if (refcount_releasen(&s->refs, n)) { @@ -1525,14 +1525,14 @@ pf_release_staten(struct pf_state *s, u_int n) return (0); } -extern struct pf_state *pf_find_state_byid(uint64_t, uint32_t); -extern struct pf_state *pf_find_state_all(struct pf_state_key_cmp *, +extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); +extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); extern u_int pf_free_src_nodes(struct pf_ksrc_node_list *); -extern void pf_print_state(struct pf_state *); +extern void pf_print_state(struct pf_kstate *); extern void pf_print_flags(u_int8_t); extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, u_int8_t); @@ -1563,7 +1563,7 @@ void pf_addr_inc(struct pf_addr *, sa_family_t); int pf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *); #endif /* INET6 */ -u_int32_t pf_new_isn(struct pf_state *); +u_int32_t pf_new_isn(struct pf_kstate *); void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *, sa_family_t); void pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t); @@ -1574,7 +1574,7 @@ void pf_patch_16_unaligned(struct mbuf *, u_int16_t *, void *, u_int16_t, bool, u_int8_t); void pf_patch_32_unaligned(struct mbuf *, u_int16_t *, void *, u_int32_t, bool, u_int8_t); -void pf_send_deferred_syn(struct pf_state *); +void pf_send_deferred_syn(struct pf_kstate *); int pf_match_addr(u_int8_t, struct pf_addr *, struct pf_addr *, struct pf_addr *, sa_family_t); int pf_match_addr_range(struct pf_addr *, struct pf_addr *, @@ -1585,14 +1585,14 @@ void pf_normalize_init(void); void pf_normalize_cleanup(void); int pf_normalize_tcp(int, struct pfi_kkif *, struct mbuf *, int, int, void *, struct pf_pdesc *); -void pf_normalize_tcp_cleanup(struct pf_state *); +void pf_normalize_tcp_cleanup(struct pf_kstate *); int pf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *, struct tcphdr *, struct pf_state_peer *, struct pf_state_peer *); int pf_normalize_tcp_stateful(struct mbuf *, int, struct pf_pdesc *, - u_short *, struct tcphdr *, struct pf_state *, + u_short *, struct tcphdr *, struct pf_kstate *, struct pf_state_peer *, struct pf_state_peer *, int *); u_int32_t - pf_state_expires(const struct pf_state *); + pf_state_expires(const struct pf_kstate *); void pf_purge_expired_fragments(void); void pf_purge_fragments(uint32_t); int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *, diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index fe50b9b270d2..8feaea615867 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -115,7 +115,7 @@ struct pfsync_pkt { u_int8_t flags; }; -static int pfsync_upd_tcp(struct pf_state *, struct pfsync_state_peer *, +static int pfsync_upd_tcp(struct pf_kstate *, struct pfsync_state_peer *, struct pfsync_state_peer *); static int pfsync_in_clr(struct pfsync_pkt *, struct mbuf *, int, int); static int pfsync_in_ins(struct pfsync_pkt *, struct mbuf *, int, int); @@ -147,16 +147,16 @@ static int (*pfsync_acts[])(struct pfsync_pkt *, struct mbuf *, int, int) = { }; struct pfsync_q { - void (*write)(struct pf_state *, void *); + void (*write)(struct pf_kstate *, void *); size_t len; u_int8_t action; }; /* we have one of these for every PFSYNC_S_ */ -static void pfsync_out_state(struct pf_state *, void *); -static void pfsync_out_iack(struct pf_state *, void *); -static void pfsync_out_upd_c(struct pf_state *, void *); -static void pfsync_out_del(struct pf_state *, void *); +static void pfsync_out_state(struct pf_kstate *, void *); +static void pfsync_out_iack(struct pf_kstate *, void *); +static void pfsync_out_upd_c(struct pf_kstate *, void *); +static void pfsync_out_del(struct pf_kstate *, void *); static struct pfsync_q pfsync_qs[] = { { pfsync_out_state, sizeof(struct pfsync_state), PFSYNC_ACT_INS }, @@ -166,10 +166,10 @@ static struct pfsync_q pfsync_qs[] = { { pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } }; -static void pfsync_q_ins(struct pf_state *, int, bool); -static void pfsync_q_del(struct pf_state *, bool, struct pfsync_bucket *); +static void pfsync_q_ins(struct pf_kstate *, int, bool); +static void pfsync_q_del(struct pf_kstate *, bool, struct pfsync_bucket *); -static void pfsync_update_state(struct pf_state *); +static void pfsync_update_state(struct pf_kstate *); struct pfsync_upd_req_item { TAILQ_ENTRY(pfsync_upd_req_item) ur_entry; @@ -182,7 +182,7 @@ struct pfsync_deferral { u_int pd_refs; struct callout pd_tmo; - struct pf_state *pd_st; + struct pf_kstate *pd_st; struct mbuf *pd_m; }; @@ -198,7 +198,7 @@ struct pfsync_bucket #define PFSYNCF_BUCKET_PUSH 0x00000001 size_t b_len; - TAILQ_HEAD(, pf_state) b_qs[PFSYNC_S_COUNT]; + TAILQ_HEAD(, pf_kstate) b_qs[PFSYNC_S_COUNT]; TAILQ_HEAD(, pfsync_upd_req_item) b_upd_req_list; TAILQ_HEAD(, pfsync_deferral) b_deferrals; u_int b_deferred; @@ -290,13 +290,13 @@ static int pfsyncoutput(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); static int pfsyncioctl(struct ifnet *, u_long, caddr_t); -static int pfsync_defer(struct pf_state *, struct mbuf *); +static int pfsync_defer(struct pf_kstate *, struct mbuf *); static void pfsync_undefer(struct pfsync_deferral *, int); -static void pfsync_undefer_state(struct pf_state *, int); +static void pfsync_undefer_state(struct pf_kstate *, int); static void pfsync_defer_tmo(void *); static void pfsync_request_update(u_int32_t, u_int64_t); -static bool pfsync_update_state_req(struct pf_state *); +static bool pfsync_update_state_req(struct pf_kstate *); static void pfsync_drop(struct pfsync_softc *); static void pfsync_sendout(int, int); @@ -312,7 +312,7 @@ static void pfsync_detach_ifnet(struct ifnet *); static void pfsync_update_net_tdb(struct pfsync_tdb *); #endif static struct pfsync_bucket *pfsync_get_bucket(struct pfsync_softc *, - struct pf_state *); + struct pf_kstate *); #define PFSYNC_MAX_BULKTRIES 12 @@ -462,7 +462,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) struct pfsync_state_key key[2]; #endif struct pfsync_state_key *kw, *ks; - struct pf_state *st = NULL; + struct pf_kstate *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; struct pf_krule *r = NULL; struct pfi_kkif *kif; @@ -754,7 +754,7 @@ pfsync_in_clr(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) for (int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; - struct pf_state *s; + struct pf_kstate *s; relock: PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { @@ -813,7 +813,7 @@ static int pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_ins_ack *ia, *iaa; - struct pf_state *st; + struct pf_kstate *st; struct mbuf *mp; int len = count * sizeof(*ia); @@ -847,7 +847,7 @@ pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) } static int -pfsync_upd_tcp(struct pf_state *st, struct pfsync_state_peer *src, +pfsync_upd_tcp(struct pf_kstate *st, struct pfsync_state_peer *src, struct pfsync_state_peer *dst) { int sync = 0; @@ -885,7 +885,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_state *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int sync; struct mbuf *mp; @@ -971,7 +971,7 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_upd_c *ua, *up; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*up); int sync; struct mbuf *mp; @@ -1061,7 +1061,7 @@ pfsync_in_ureq(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) int len = count * sizeof(*ur); int i, offp; - struct pf_state *st; + struct pf_kstate *st; mp = m_pulldown(m, offset, len, &offp); if (mp == NULL) { @@ -1099,7 +1099,7 @@ pfsync_in_del(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct mbuf *mp; struct pfsync_state *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*sp); int offp, i; @@ -1130,7 +1130,7 @@ pfsync_in_del_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct mbuf *mp; struct pfsync_del_c *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*sp); int offp, i; @@ -1482,7 +1482,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } static void -pfsync_out_state(struct pf_state *st, void *buf) +pfsync_out_state(struct pf_kstate *st, void *buf) { struct pfsync_state *sp = buf; @@ -1490,7 +1490,7 @@ pfsync_out_state(struct pf_state *st, void *buf) } static void -pfsync_out_iack(struct pf_state *st, void *buf) +pfsync_out_iack(struct pf_kstate *st, void *buf) { struct pfsync_ins_ack *iack = buf; @@ -1499,7 +1499,7 @@ pfsync_out_iack(struct pf_state *st, void *buf) } static void -pfsync_out_upd_c(struct pf_state *st, void *buf) +pfsync_out_upd_c(struct pf_kstate *st, void *buf) { struct pfsync_upd_c *up = buf; @@ -1512,7 +1512,7 @@ pfsync_out_upd_c(struct pf_state *st, void *buf) } static void -pfsync_out_del(struct pf_state *st, void *buf) +pfsync_out_del(struct pf_kstate *st, void *buf) { struct pfsync_del_c *dp = buf; @@ -1524,7 +1524,7 @@ pfsync_out_del(struct pf_state *st, void *buf) static void pfsync_drop(struct pfsync_softc *sc) { - struct pf_state *st, *next; + struct pf_kstate *st, *next; struct pfsync_upd_req_item *ur; struct pfsync_bucket *b; int c, q; @@ -1564,7 +1564,7 @@ pfsync_sendout(int schedswi, int c) struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; - struct pf_state *st, *st_next; + struct pf_kstate *st, *st_next; struct pfsync_upd_req_item *ur; struct pfsync_bucket *b = &sc->sc_buckets[c]; int offset; @@ -1704,7 +1704,7 @@ pfsync_sendout(int schedswi, int c) } static void -pfsync_insert_state(struct pf_state *st) +pfsync_insert_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); @@ -1732,7 +1732,7 @@ pfsync_insert_state(struct pf_state *st) } static int -pfsync_defer(struct pf_state *st, struct mbuf *m) +pfsync_defer(struct pf_kstate *st, struct mbuf *m) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; @@ -1780,7 +1780,7 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop) { struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; - struct pf_state *st = pd->pd_st; + struct pf_kstate *st = pd->pd_st; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PFSYNC_BUCKET_LOCK_ASSERT(b); @@ -1805,7 +1805,7 @@ pfsync_defer_tmo(void *arg) struct pfsync_deferral *pd = arg; struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; - struct pf_state *st = pd->pd_st; + struct pf_kstate *st = pd->pd_st; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PFSYNC_BUCKET_LOCK_ASSERT(b); @@ -1827,7 +1827,7 @@ pfsync_defer_tmo(void *arg) } static void -pfsync_undefer_state(struct pf_state *st, int drop) +pfsync_undefer_state(struct pf_kstate *st, int drop) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; @@ -1850,14 +1850,14 @@ pfsync_undefer_state(struct pf_state *st, int drop) } static struct pfsync_bucket* -pfsync_get_bucket(struct pfsync_softc *sc, struct pf_state *st) +pfsync_get_bucket(struct pfsync_softc *sc, struct pf_kstate *st) { int c = PF_IDHASH(st) % pfsync_buckets; return &sc->sc_buckets[c]; } static void -pfsync_update_state(struct pf_state *st) +pfsync_update_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; bool sync = false, ref = true; @@ -1955,7 +1955,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) } static bool -pfsync_update_state_req(struct pf_state *st) +pfsync_update_state_req(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; bool ref = true, full = false; @@ -2002,7 +2002,7 @@ pfsync_update_state_req(struct pf_state *st) } static void -pfsync_delete_state(struct pf_state *st) +pfsync_delete_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); @@ -2066,7 +2066,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *ifname) } static void -pfsync_q_ins(struct pf_state *st, int q, bool ref) +pfsync_q_ins(struct pf_kstate *st, int q, bool ref) { struct pfsync_softc *sc = V_pfsyncif; size_t nlen = pfsync_qs[q].len; @@ -2096,7 +2096,7 @@ pfsync_q_ins(struct pf_state *st, int q, bool ref) } static void -pfsync_q_del(struct pf_state *st, bool unref, struct pfsync_bucket *b) +pfsync_q_del(struct pf_kstate *st, bool unref, struct pfsync_bucket *b) { int q = st->sync_state; @@ -2136,7 +2136,7 @@ static void pfsync_bulk_update(void *arg) { struct pfsync_softc *sc = arg; - struct pf_state *s; + struct pf_kstate *s; int i, sent = 0; PFSYNC_BLOCK_ASSERT(sc); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 6edbd60b8d07..cb616ef5788f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -116,12 +116,12 @@ __FBSDID("$FreeBSD$"); SDT_PROVIDER_DEFINE(pf); SDT_PROBE_DEFINE4(pf, ip, test, done, "int", "int", "struct pf_krule *", - "struct pf_state *"); + "struct pf_kstate *"); SDT_PROBE_DEFINE4(pf, ip, test6, done, "int", "int", "struct pf_krule *", - "struct pf_state *"); + "struct pf_kstate *"); SDT_PROBE_DEFINE5(pf, ip, state, lookup, "struct pfi_kkif *", "struct pf_state_key_cmp *", "int", "struct pf_pdesc *", - "struct pf_state *"); + "struct pf_kstate *"); /* * Global variables @@ -225,7 +225,7 @@ VNET_DEFINE(uint64_t, pf_stateid[MAXCPU]); #define PFID_MAXID (~PFID_CPUMASK) CTASSERT((1 << PFID_CPUBITS) >= MAXCPU); -static void pf_src_tree_remove_state(struct pf_state *); +static void pf_src_tree_remove_state(struct pf_kstate *); static void pf_init_threshold(struct pf_threshold *, u_int32_t, u_int32_t); static void pf_add_threshold(struct pf_threshold *); @@ -248,13 +248,13 @@ static void pf_send_tcp(struct mbuf *, u_int16_t, struct ifnet *); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); -static void pf_detach_state(struct pf_state *); +static void pf_detach_state(struct pf_kstate *); static int pf_state_key_attach(struct pf_state_key *, - struct pf_state_key *, struct pf_state *); -static void pf_state_key_detach(struct pf_state *, int); + struct pf_state_key *, struct pf_kstate *); +static void pf_state_key_detach(struct pf_kstate *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); -static int pf_test_rule(struct pf_krule **, struct pf_state **, +static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **, struct inpcb *); @@ -263,29 +263,29 @@ static int pf_create_state(struct pf_krule *, struct pf_krule *, struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, u_int16_t, u_int16_t, int *, struct pfi_kkif *, - struct pf_state **, int, u_int16_t, u_int16_t, + struct pf_kstate **, int, u_int16_t, u_int16_t, int); static int pf_test_fragment(struct pf_krule **, int, struct pfi_kkif *, struct mbuf *, void *, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **); static int pf_tcp_track_full(struct pf_state_peer *, - struct pf_state_peer *, struct pf_state **, + struct pf_state_peer *, struct pf_kstate **, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, u_short *, int *); static int pf_tcp_track_sloppy(struct pf_state_peer *, - struct pf_state_peer *, struct pf_state **, + struct pf_state_peer *, struct pf_kstate **, struct pf_pdesc *, u_short *); -static int pf_test_state_tcp(struct pf_state **, int, +static int pf_test_state_tcp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); -static int pf_test_state_udp(struct pf_state **, int, +static int pf_test_state_udp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *); -static int pf_test_state_icmp(struct pf_state **, int, +static int pf_test_state_icmp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); -static int pf_test_state_other(struct pf_state **, int, +static int pf_test_state_other(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); @@ -295,15 +295,15 @@ static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, u_int8_t, sa_family_t); -static void pf_print_state_parts(struct pf_state *, +static void pf_print_state_parts(struct pf_kstate *, struct pf_state_key *, struct pf_state_key *); static int pf_addr_wrap_neq(struct pf_addr_wrap *, struct pf_addr_wrap *); static void pf_patch_8(struct mbuf *, u_int16_t *, u_int8_t *, u_int8_t, bool, u_int8_t); -static struct pf_state *pf_find_state(struct pfi_kkif *, +static struct pf_kstate *pf_find_state(struct pfi_kkif *, struct pf_state_key_cmp *, u_int); -static int pf_src_connlimit(struct pf_state **); +static int pf_src_connlimit(struct pf_kstate **); static void pf_overload_task(void *v, int pending); static int pf_insert_src_node(struct pf_ksrc_node **, struct pf_krule *, struct pf_addr *, sa_family_t); @@ -313,14 +313,14 @@ static int pf_mtag_uminit(void *, int, int); static void pf_mtag_free(struct m_tag *); #ifdef INET static void pf_route(struct mbuf **, struct pf_krule *, int, - struct ifnet *, struct pf_state *, + struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET */ #ifdef INET6 static void pf_change_a6(struct pf_addr *, u_int16_t *, struct pf_addr *, u_int8_t); static void pf_route6(struct mbuf **, struct pf_krule *, int, - struct ifnet *, struct pf_state *, + struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET6 */ @@ -476,7 +476,7 @@ pf_hashsrc(struct pf_addr *addr, sa_family_t af) #ifdef ALTQ static int -pf_state_hash(struct pf_state *s) +pf_state_hash(struct pf_kstate *s) { u_int32_t hv = (intptr_t)s / sizeof(*s); @@ -539,7 +539,7 @@ pf_check_threshold(struct pf_threshold *threshold) } static int -pf_src_connlimit(struct pf_state **state) +pf_src_connlimit(struct pf_kstate **state) { struct pf_overload_entry *pfoe; int bad = 0; @@ -655,7 +655,7 @@ pf_overload_task(void *v, int pending) for (int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; struct pf_state_key *sk; - struct pf_state *s; + struct pf_kstate *s; PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { @@ -840,7 +840,7 @@ pf_initialize() V_pf_hashseed = arc4random(); /* States and state keys storage. */ - V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_state), + V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_kstate), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); V_pf_limits[PF_LIMIT_STATES].zone = V_pf_state_z; uma_zone_set_max(V_pf_state_z, PFSTATE_HIWAT); @@ -1003,11 +1003,11 @@ pf_get_mtag(struct mbuf *m) static int pf_state_key_attach(struct pf_state_key *skw, struct pf_state_key *sks, - struct pf_state *s) + struct pf_kstate *s) { struct pf_keyhash *khs, *khw, *kh; struct pf_state_key *sk, *cur; - struct pf_state *si, *olds = NULL; + struct pf_kstate *si, *olds = NULL; int idx; KASSERT(s->refs == 0, ("%s: state not pristine", __func__)); @@ -1168,7 +1168,7 @@ stateattach: } static void -pf_detach_state(struct pf_state *s) +pf_detach_state(struct pf_kstate *s) { struct pf_state_key *sks = s->key[PF_SK_STACK]; struct pf_keyhash *kh; @@ -1199,7 +1199,7 @@ pf_detach_state(struct pf_state *s) } static void -pf_state_key_detach(struct pf_state *s, int idx) +pf_state_key_detach(struct pf_kstate *s, int idx) { struct pf_state_key *sk = s->key[idx]; #ifdef INVARIANTS @@ -1264,10 +1264,10 @@ pf_state_key_clone(struct pf_state_key *orig) int pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, - struct pf_state_key *skw, struct pf_state_key *sks, struct pf_state *s) + struct pf_state_key *skw, struct pf_state_key *sks, struct pf_kstate *s) { struct pf_idhash *ih; - struct pf_state *cur; + struct pf_kstate *cur; int error; KASSERT(TAILQ_EMPTY(&sks->states[0]) && TAILQ_EMPTY(&sks->states[1]), @@ -1324,11 +1324,11 @@ pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, /* * Find state by ID: returns with locked row on success. */ -struct pf_state * +struct pf_kstate * pf_find_state_byid(uint64_t id, uint32_t creatorid) { struct pf_idhash *ih; - struct pf_state *s; + struct pf_kstate *s; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1349,12 +1349,12 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid) * Find state by key. * Returns with ID hash slot locked on success. */ -static struct pf_state * +static struct pf_kstate * pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) { struct pf_keyhash *kh; struct pf_state_key *sk; - struct pf_state *s; + struct pf_kstate *s; int idx; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1393,12 +1393,12 @@ pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) return (NULL); } -struct pf_state * +struct pf_kstate * pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more) { struct pf_keyhash *kh; struct pf_state_key *sk; - struct pf_state *s, *ret = NULL; + struct pf_kstate *s, *ret = NULL; int idx, inout = 0; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1586,7 +1586,7 @@ pf_unload_vnet_purge(void) u_int32_t -pf_state_expires(const struct pf_state *state) +pf_state_expires(const struct pf_kstate *state) { u_int32_t timeout; u_int32_t start; @@ -1650,7 +1650,7 @@ pf_purge_expired_src_nodes() } static void -pf_src_tree_remove_state(struct pf_state *s) +pf_src_tree_remove_state(struct pf_kstate *s) { struct pf_ksrc_node *sn; struct pf_srchash *sh; @@ -1687,7 +1687,7 @@ pf_src_tree_remove_state(struct pf_state *s) * unlocked, since it needs to go through key hash locking. */ int -pf_unlink_state(struct pf_state *s, u_int flags) +pf_unlink_state(struct pf_kstate *s, u_int flags) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; @@ -1734,7 +1734,7 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (pf_release_staten(s, 2)); } -struct pf_state * +struct pf_kstate * pf_alloc_state(int flags) { @@ -1742,7 +1742,7 @@ pf_alloc_state(int flags) } void -pf_free_state(struct pf_state *cur) +pf_free_state(struct pf_kstate *cur) { KASSERT(cur->refs == 0, ("%s: %p has refs", __func__, cur)); @@ -1761,7 +1761,7 @@ static u_int pf_purge_expired_states(u_int i, int maxcheck) { struct pf_idhash *ih; - struct pf_state *s; + struct pf_kstate *s; V_pf_status.states = uma_zone_get_cur(V_pf_state_z); @@ -1920,13 +1920,13 @@ pf_print_host(struct pf_addr *addr, u_int16_t p, sa_family_t af) } void -pf_print_state(struct pf_state *s) +pf_print_state(struct pf_kstate *s) { pf_print_state_parts(s, NULL, NULL); } static void -pf_print_state_parts(struct pf_state *s, +pf_print_state_parts(struct pf_kstate *s, struct pf_state_key *skwp, struct pf_state_key *sksp) { struct pf_state_key *skw, *sks; @@ -3327,7 +3327,7 @@ pf_tcp_iss(struct pf_pdesc *pd) } static int -pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, +pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, struct pf_krule **am, struct pf_kruleset **rsm, struct inpcb *inp) { @@ -3704,10 +3704,10 @@ static int pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, - u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_state **sm, + u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_kstate **sm, int tag, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen) { - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_ksrc_node *sn = NULL; struct tcphdr *th = &pd->hdr.tcp; u_int16_t mss = V_tcp_mssdflt; @@ -4046,7 +4046,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, static int pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pfi_kkif *kif, struct mbuf *m, int off, + struct pf_kstate **state, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, u_short *reason, int *copyback) { struct tcphdr *th = &pd->hdr.tcp; @@ -4375,7 +4375,7 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, static int pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pf_pdesc *pd, u_short *reason) + struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) { struct tcphdr *th = &pd->hdr.tcp; @@ -4445,7 +4445,7 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { @@ -4613,7 +4613,7 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_udp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -4680,7 +4680,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_icmp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { struct pf_addr *saddr = pd->src, *daddr = pd->dst; @@ -5285,7 +5285,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_other(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_other(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -5582,7 +5582,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *kif, #ifdef INET static void pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, - struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) + struct pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0, *m1; struct sockaddr_in dst; @@ -5745,7 +5745,7 @@ bad: #ifdef INET6 static void pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, - struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) + struct pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0; struct sockaddr_in6 dst; @@ -6013,7 +6013,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * struct ip *h = NULL; struct m_tag *ipfwtag; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, dirndx, pqid = 0; @@ -6404,7 +6404,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb struct m_tag *mtag; struct ip6_hdr *h = NULL; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 92b0cda8261e..0481e58ae1e2 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1784,7 +1784,7 @@ pf_label_match(const struct pf_krule *rule, const char *label) static unsigned int pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) { - struct pf_state *match; + struct pf_kstate *match; int more = 0; unsigned int killed = 0; @@ -1802,7 +1802,7 @@ pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) static int pf_killstates_row(struct pf_kstate_kill *psk, struct pf_idhash *ih) { *** 167 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 11:51:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3374264A0FC; Wed, 14 Jul 2021 11:51:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPwnf0qNRz4hvC; Wed, 14 Jul 2021 11:51:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0529115A1D; Wed, 14 Jul 2021 11:51:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EBpHPJ052193; Wed, 14 Jul 2021 11:51:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EBpHeY052192; Wed, 14 Jul 2021 11:51:17 GMT (envelope-from git) Date: Wed, 14 Jul 2021 11:51:17 GMT Message-Id: <202107141151.16EBpHeY052192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 791035c8da5e - stable/13 - libalias: fix divide by zero causing panic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 791035c8da5e8a693b3b954db67ff50b4f8695cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 11:51:18 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=791035c8da5e8a693b3b954db67ff50b4f8695cb commit 791035c8da5e8a693b3b954db67ff50b4f8695cb Author: Stefan Eßer AuthorDate: 2021-07-10 11:00:56 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-14 11:49:21 +0000 libalias: fix divide by zero causing panic The packet_limit can fall to 0, leading to a divide by zero abort in the "packets % packet_limit". An possible solution would be to apply a lower limit of 1 after the calculation of packet_limit, but since any number modulo 1 gives 0, the more efficient solution is to skip the modulo operation for packet_limit <= 1. Reported by: Karl Denninger (cherry picked from commit 58080fbca09fda6d5f011d37059edbca8ceb4c58) --- sys/netinet/libalias/alias_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 783a8ca3baa8..ed222c4133d4 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1769,7 +1769,7 @@ HouseKeeping(struct libalias *la) * Reduce the amount of house keeping work substantially by * sampling over the packets. */ - if (packets % packet_limit == 0) { + if (packet_limit <= 1 || packets % packet_limit == 0) { time_t now; #ifdef _KERNEL From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 11:54:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5E2B64A1CA; Wed, 14 Jul 2021 11:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPwsV4gy1z4jh8; Wed, 14 Jul 2021 11:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 886F315941; Wed, 14 Jul 2021 11:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EBscbi053245; Wed, 14 Jul 2021 11:54:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EBscrb053244; Wed, 14 Jul 2021 11:54:38 GMT (envelope-from git) Date: Wed, 14 Jul 2021 11:54:38 GMT Message-Id: <202107141154.16EBscrb053244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 5c55ab57c818 - stable/12 - libalias: fix divide by zero causing panic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5c55ab57c81885cf6b269bfb77dbb334ca0a9bde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 11:54:38 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=5c55ab57c81885cf6b269bfb77dbb334ca0a9bde commit 5c55ab57c81885cf6b269bfb77dbb334ca0a9bde Author: Stefan Eßer AuthorDate: 2021-07-10 11:00:56 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-14 11:54:15 +0000 libalias: fix divide by zero causing panic The packet_limit can fall to 0, leading to a divide by zero abort in the "packets % packet_limit". An possible solution would be to apply a lower limit of 1 after the calculation of packet_limit, but since any number modulo 1 gives 0, the more efficient solution is to skip the modulo operation for packet_limit <= 1. Reported by: Karl Denninger (cherry picked from commit 58080fbca09fda6d5f011d37059edbca8ceb4c58) --- sys/netinet/libalias/alias_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 783a8ca3baa8..ed222c4133d4 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1769,7 +1769,7 @@ HouseKeeping(struct libalias *la) * Reduce the amount of house keeping work substantially by * sampling over the packets. */ - if (packets % packet_limit == 0) { + if (packet_limit <= 1 || packets % packet_limit == 0) { time_t now; #ifdef _KERNEL From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 14:54:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB75764D632; Wed, 14 Jul 2021 14:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ0sD1synz4R8S; Wed, 14 Jul 2021 14:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27BBF18281; Wed, 14 Jul 2021 14:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EEse0f098893; Wed, 14 Jul 2021 14:54:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEseYJ098892; Wed, 14 Jul 2021 14:54:40 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:54:40 GMT Message-Id: <202107141454.16EEseYJ098892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: ce02bfa524b2 - stable/13 - pf: depessimize table handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ce02bfa524b279ae0d5436b38b15353e523f5a92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:54:40 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ce02bfa524b279ae0d5436b38b15353e523f5a92 commit ce02bfa524b279ae0d5436b38b15353e523f5a92 Author: Mateusz Guzik AuthorDate: 2021-07-02 11:19:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-14 14:50:12 +0000 pf: depessimize table handling Creating tables and zeroing their counters induces excessive IPIs (14 per table), which in turns kills single- and multi-threaded performance. Work around the problem by extending per-CPU counters with a general counter populated on "zeroing" requests -- it stores the currently found sum. Then requests to report the current value are the sum of per-CPU counters subtracted by the saved value. Sample timings when loading a config with 100k tables on a 104-way box: stock: pfctl -f tables100000.conf 0.39s user 69.37s system 99% cpu 1:09.76 total pfctl -f tables100000.conf 0.40s user 68.14s system 99% cpu 1:08.54 total patched: pfctl -f tables100000.conf 0.35s user 6.41s system 99% cpu 6.771 total pfctl -f tables100000.conf 0.48s user 6.47s system 99% cpu 6.949 total Reviewed by: kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f92c21a28cd856834249a008771b2f002e477a39) --- sys/net/pfvar.h | 62 ++++++++++++++++++++++++++++++++++++++++++++--- sys/netpfil/pf/pf_table.c | 58 +++++++++++++++++++++----------------------- 2 files changed, 85 insertions(+), 35 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 5d4860ec981a..3485592ffec7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -814,16 +814,70 @@ struct pfr_tstats { int pfrts_refcnt[PFR_REFCNT_MAX]; }; +#ifdef _KERNEL + +struct pfr_kstate_counter { + counter_u64_t pkc_pcpu; + u_int64_t pkc_zero; +}; + +static inline int +pfr_kstate_counter_init(struct pfr_kstate_counter *pfrc, int flags) +{ + + pfrc->pkc_zero = 0; + pfrc->pkc_pcpu = counter_u64_alloc(flags); + if (pfrc->pkc_pcpu == NULL) + return (ENOMEM); + return (0); +} + +static inline void +pfr_kstate_counter_deinit(struct pfr_kstate_counter *pfrc) +{ + + counter_u64_free(pfrc->pkc_pcpu); +} + +static inline u_int64_t +pfr_kstate_counter_fetch(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + c -= pfrc->pkc_zero; + return (c); +} + +static inline void +pfr_kstate_counter_zero(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + pfrc->pkc_zero = c; +} + +static inline void +pfr_kstate_counter_add(struct pfr_kstate_counter *pfrc, int64_t n) +{ + + counter_u64_add(pfrc->pkc_pcpu, n); +} + struct pfr_ktstats { struct pfr_table pfrts_t; - counter_u64_t pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_t pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_t pfrkts_match; - counter_u64_t pfrkts_nomatch; + struct pfr_kstate_counter pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_match; + struct pfr_kstate_counter pfrkts_nomatch; long pfrkts_tzero; int pfrkts_cnt; int pfrkts_refcnt[PFR_REFCNT_MAX]; }; + +#endif /* _KERNEL */ + #define pfrts_name pfrts_t.pfrt_name #define pfrts_flags pfrts_t.pfrt_flags diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index f643790ff620..cd7d96eacd13 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1326,15 +1326,15 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size, for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { tbl->pfrts_packets[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_packets[pfr_dir][pfr_op]); tbl->pfrts_bytes[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_bytes[pfr_dir][pfr_op]); } } - tbl->pfrts_match = counter_u64_fetch(p->pfrkt_match); - tbl->pfrts_nomatch = counter_u64_fetch(p->pfrkt_nomatch); + tbl->pfrts_match = pfr_kstate_counter_fetch(&p->pfrkt_match); + tbl->pfrts_nomatch = pfr_kstate_counter_fetch(&p->pfrkt_nomatch); tbl->pfrts_tzero = p->pfrkt_tzero; tbl->pfrts_cnt = p->pfrkt_cnt; for (pfr_op = 0; pfr_op < PFR_REFCNT_MAX; pfr_op++) @@ -1870,12 +1870,12 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse) } for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - counter_u64_zero(kt->pfrkt_packets[pfr_dir][pfr_op]); - counter_u64_zero(kt->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_zero(&kt->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_zero(&kt->pfrkt_bytes[pfr_dir][pfr_op]); } } - counter_u64_zero(kt->pfrkt_match); - counter_u64_zero(kt->pfrkt_nomatch); + pfr_kstate_counter_zero(&kt->pfrkt_match); + pfr_kstate_counter_zero(&kt->pfrkt_nomatch); kt->pfrkt_tzero = tzero; } @@ -1905,28 +1905,24 @@ pfr_create_ktable(struct pfr_table *tbl, long tzero, int attachruleset) for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - kt->pfrkt_packets[pfr_dir][pfr_op] = - counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_packets[pfr_dir][pfr_op]) { + if (pfr_kstate_counter_init( + &kt->pfrkt_packets[pfr_dir][pfr_op], M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } - kt->pfrkt_bytes[pfr_dir][pfr_op] = - counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_bytes[pfr_dir][pfr_op]) { + if (pfr_kstate_counter_init( + &kt->pfrkt_bytes[pfr_dir][pfr_op], M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } } } - kt->pfrkt_match = counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_match) { + if (pfr_kstate_counter_init(&kt->pfrkt_match, M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } - kt->pfrkt_nomatch = counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_nomatch) { + if (pfr_kstate_counter_init(&kt->pfrkt_nomatch, M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } @@ -1977,12 +1973,12 @@ pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr) } for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - counter_u64_free(kt->pfrkt_packets[pfr_dir][pfr_op]); - counter_u64_free(kt->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_deinit(&kt->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_deinit(&kt->pfrkt_bytes[pfr_dir][pfr_op]); } } - counter_u64_free(kt->pfrkt_match); - counter_u64_free(kt->pfrkt_nomatch); + pfr_kstate_counter_deinit(&kt->pfrkt_match); + pfr_kstate_counter_deinit(&kt->pfrkt_nomatch); free(kt, M_PFTABLE); } @@ -2052,9 +2048,9 @@ pfr_match_addr(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af) } match = (ke && !ke->pfrke_not); if (match) - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); else - counter_u64_add(kt->pfrkt_nomatch, 1); + pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1); return (match); } @@ -2109,8 +2105,8 @@ pfr_update_stats(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af, ("pfr_update_stats: assertion failed.\n")); op_pass = PFR_OP_XPASS; } - counter_u64_add(kt->pfrkt_packets[dir_out][op_pass], 1); - counter_u64_add(kt->pfrkt_bytes[dir_out][op_pass], len); + pfr_kstate_counter_add(&kt->pfrkt_packets[dir_out][op_pass], 1); + pfr_kstate_counter_add(&kt->pfrkt_bytes[dir_out][op_pass], len); if (ke != NULL && op_pass != PFR_OP_XPASS && (kt->pfrkt_flags & PFR_TFLAG_COUNTERS)) { counter_u64_add(pfr_kentry_counter(&ke->pfrke_counters, @@ -2206,7 +2202,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, _next_block: ke = pfr_kentry_byidx(kt, idx, af); if (ke == NULL) { - counter_u64_add(kt->pfrkt_nomatch, 1); + pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1); return (1); } pfr_prepare_network(&umask, af, ke->pfrke_net); @@ -2231,7 +2227,7 @@ _next_block: /* this is a single IP address - no possible nested block */ PF_ACPY(counter, addr, af); *pidx = idx; - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); return (0); } for (;;) { @@ -2251,7 +2247,7 @@ _next_block: /* lookup return the same block - perfect */ PF_ACPY(counter, addr, af); *pidx = idx; - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); return (0); } From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 14:54:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C861E64CFFF; Wed, 14 Jul 2021 14:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ0sG4RgWz4R8f; Wed, 14 Jul 2021 14:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70BE218282; Wed, 14 Jul 2021 14:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EEsgJX098943; Wed, 14 Jul 2021 14:54:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEsg2Y098942; Wed, 14 Jul 2021 14:54:42 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:54:42 GMT Message-Id: <202107141454.16EEsg2Y098942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8ef908c1d5b5 - stable/13 - pf: padalign global locks found in pf.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8ef908c1d5b56f028dbedaefaa5e25f71cb198b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:54:42 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8ef908c1d5b56f028dbedaefaa5e25f71cb198b5 commit 8ef908c1d5b56f028dbedaefaa5e25f71cb198b5 Author: Mateusz Guzik AuthorDate: 2021-07-05 09:26:29 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-14 14:50:12 +0000 pf: padalign global locks found in pf.c Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f649cff58721f493f218a4d1fb88a12255945472) --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0e53c92fcd85..4f112c87d6d2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -118,7 +118,7 @@ struct pfi_dynaddr { #define PF_STATE_LOCK_ASSERT(s) do {} while (0) #endif /* INVARIANTS */ -extern struct mtx pf_unlnkdrules_mtx; +extern struct mtx_padalign pf_unlnkdrules_mtx; #define PF_UNLNKDRULES_LOCK() mtx_lock(&pf_unlnkdrules_mtx) #define PF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) @@ -133,7 +133,7 @@ extern struct rmlock pf_rules_lock; #define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) -extern struct mtx pf_table_stats_lock; +extern struct mtx_padalign pf_table_stats_lock; #define PF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) #define PF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) #define PF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a33854a207aa..167d565d7413 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -178,7 +178,7 @@ STAILQ_HEAD(pf_send_head, pf_send_entry); VNET_DEFINE_STATIC(struct pf_send_head, pf_sendqueue); #define V_pf_sendqueue VNET(pf_sendqueue) -static struct mtx pf_sendqueue_mtx; +static struct mtx_padalign pf_sendqueue_mtx; MTX_SYSINIT(pf_sendqueue_mtx, &pf_sendqueue_mtx, "pf send queue", MTX_DEF); #define PF_SENDQ_LOCK() mtx_lock(&pf_sendqueue_mtx) #define PF_SENDQ_UNLOCK() mtx_unlock(&pf_sendqueue_mtx) @@ -200,18 +200,18 @@ VNET_DEFINE_STATIC(struct pf_overload_head, pf_overloadqueue); VNET_DEFINE_STATIC(struct task, pf_overloadtask); #define V_pf_overloadtask VNET(pf_overloadtask) -static struct mtx pf_overloadqueue_mtx; +static struct mtx_padalign pf_overloadqueue_mtx; MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx, "pf overload/flush queue", MTX_DEF); #define PF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx) #define PF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx) VNET_DEFINE(struct pf_krulequeue, pf_unlinked_rules); -struct mtx pf_unlnkdrules_mtx; +struct mtx_padalign pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); -struct mtx pf_table_stats_lock; +struct mtx_padalign pf_table_stats_lock; MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", MTX_DEF); From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 14:54:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24C4064CFFE; Wed, 14 Jul 2021 14:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ0sF4JpCz4R2J; Wed, 14 Jul 2021 14:54:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D3A3180A4; Wed, 14 Jul 2021 14:54:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EEsfQP098919; Wed, 14 Jul 2021 14:54:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEsfhO098918; Wed, 14 Jul 2021 14:54:41 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:54:41 GMT Message-Id: <202107141454.16EEsfhO098918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: a65a22739870 - stable/13 - pf: allow table stats clearing and reading with ruleset rlock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a65a227398703c23168120723694f04c1a71737f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:54:42 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a65a227398703c23168120723694f04c1a71737f commit a65a227398703c23168120723694f04c1a71737f Author: Mateusz Guzik AuthorDate: 2021-07-02 12:55:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-14 14:50:12 +0000 pf: allow table stats clearing and reading with ruleset rlock Instead serialize against these operations with a dedicated lock. Prior to the change, When pushing 17 mln pps of traffic, calling DIOCRGETTSTATS in a loop would restrict throughput to about 7 mln. With the change there is no slowdown. Reviewed by: kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit dc1ab04e4c9ede3606985e0cce1200e3060ac166) --- sys/net/pfvar.h | 7 +++++++ sys/netpfil/pf/pf.c | 4 ++++ sys/netpfil/pf/pf_ioctl.c | 18 ++++++++++++------ sys/netpfil/pf/pf_table.c | 2 ++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 3485592ffec7..0e53c92fcd85 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -128,10 +128,17 @@ extern struct rmlock pf_rules_lock; #define PF_RULES_RUNLOCK() rm_runlock(&pf_rules_lock, &_pf_rules_tracker) #define PF_RULES_WLOCK() rm_wlock(&pf_rules_lock) #define PF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#define PF_RULES_WOWNED() rm_wowned(&pf_rules_lock) #define PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) #define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) +extern struct mtx pf_table_stats_lock; +#define PF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) +#define PF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) +#define PF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) +#define PF_TABLE_STATS_ASSERT() mtx_assert(&pf_rules_lock, MA_OWNED) + extern struct sx pf_end_lock; #define PF_MODVER 1 diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 04a62535f461..a33854a207aa 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -211,6 +211,10 @@ struct mtx pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); +struct mtx pf_table_stats_lock; +MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", + MTX_DEF); + VNET_DEFINE_STATIC(uma_zone_t, pf_sources_z); #define V_pf_sources_z VNET(pf_sources_z) uma_zone_t pf_mtag_z; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 4eebc8a43de8..694134c6c663 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3726,10 +3726,12 @@ DIOCCHANGEADDR_error: error = ENODEV; break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); if (n < 0) { - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); error = EINVAL; break; } @@ -3740,12 +3742,14 @@ DIOCCHANGEADDR_error: sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT); if (pfrtstats == NULL) { error = ENOMEM; - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); break; } error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); if (error == 0) error = copyout(pfrtstats, io->pfrio_buffer, totlen); free(pfrtstats, M_TEMP); @@ -3780,10 +3784,12 @@ DIOCCHANGEADDR_error: break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); error = pfr_clr_tstats(pfrts, io->pfrio_size, &io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); free(pfrts, M_TEMP); break; } diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index cd7d96eacd13..5afc90e54d7c 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1864,6 +1864,8 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse) struct pfr_kentryworkq addrq; int pfr_dir, pfr_op; + MPASS(PF_TABLE_STATS_OWNED() || PF_RULES_WOWNED()); + if (recurse) { pfr_enqueue_addrs(kt, &addrq, NULL, 0); pfr_clstats_kentries(kt, &addrq, tzero, 0); From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 14:54:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16CE564D84B; Wed, 14 Jul 2021 14:54:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ0sJ4Xvpz4R6s; Wed, 14 Jul 2021 14:54:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BAC618220; Wed, 14 Jul 2021 14:54:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EEshf5098967; Wed, 14 Jul 2021 14:54:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEshwo098966; Wed, 14 Jul 2021 14:54:43 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:54:43 GMT Message-Id: <202107141454.16EEshwo098966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: cfaec275f6b4 - stable/13 - pf: add pf_find_state_all_exists MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cfaec275f6b4c7d463bc5acdb5a159252191f4b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:54:45 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=cfaec275f6b4c7d463bc5acdb5a159252191f4b4 commit cfaec275f6b4c7d463bc5acdb5a159252191f4b4 Author: Mateusz Guzik AuthorDate: 2021-07-08 13:11:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-14 14:50:12 +0000 pf: add pf_find_state_all_exists Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 19d6e29b872232c47190344f3dfded2f73edd8ae) --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/pf.c | 9 +++++++++ sys/netpfil/pf/pf_lb.c | 10 ++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 4f112c87d6d2..df86ce4f92c2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1588,6 +1588,8 @@ pf_release_staten(struct pf_kstate *s, u_int n) extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); +extern bool pf_find_state_all_exists(struct pf_state_key_cmp *, + u_int); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 167d565d7413..ce836eb492f2 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1453,6 +1453,15 @@ second_run: return (ret); } +bool +pf_find_state_all_exists(struct pf_state_key_cmp *key, u_int dir) +{ + struct pf_kstate *s; + + s = pf_find_state_all(key, dir, NULL); + return (s != NULL); +} + /* END state table stuff */ static void diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 5e281eccc144..000ee69d9ae9 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -244,13 +244,13 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, * (traceroute -I through nat) */ key.port[1] = sport; - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = sport; return (0); } } else if (low == high) { key.port[1] = htons(low); - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(low); return (0); } @@ -268,8 +268,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, /* low <= cut <= high */ for (tmp = cut; tmp <= high && tmp <= 0xffff; ++tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } @@ -277,8 +276,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, tmp = cut; for (tmp -= 1; tmp >= low && tmp <= 0xffff; --tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 14:57:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7CFA64DC06; Wed, 14 Jul 2021 14:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ0x02w35z4RSf; Wed, 14 Jul 2021 14:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4769818223; Wed, 14 Jul 2021 14:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EEvu5j099335; Wed, 14 Jul 2021 14:57:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEvuTu099334; Wed, 14 Jul 2021 14:57:56 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:57:56 GMT Message-Id: <202107141457.16EEvuTu099334@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: d098fc21ee5b - stable/12 - pf: depessimize table handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d098fc21ee5bc260ffd79c53c0f7925145967041 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:57:56 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d098fc21ee5bc260ffd79c53c0f7925145967041 commit d098fc21ee5bc260ffd79c53c0f7925145967041 Author: Mateusz Guzik AuthorDate: 2021-07-02 11:19:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-14 14:55:26 +0000 pf: depessimize table handling Creating tables and zeroing their counters induces excessive IPIs (14 per table), which in turns kills single- and multi-threaded performance. Work around the problem by extending per-CPU counters with a general counter populated on "zeroing" requests -- it stores the currently found sum. Then requests to report the current value are the sum of per-CPU counters subtracted by the saved value. Sample timings when loading a config with 100k tables on a 104-way box: stock: pfctl -f tables100000.conf 0.39s user 69.37s system 99% cpu 1:09.76 total pfctl -f tables100000.conf 0.40s user 68.14s system 99% cpu 1:08.54 total patched: pfctl -f tables100000.conf 0.35s user 6.41s system 99% cpu 6.771 total pfctl -f tables100000.conf 0.48s user 6.47s system 99% cpu 6.949 total Reviewed by: kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f92c21a28cd856834249a008771b2f002e477a39) --- sys/net/pfvar.h | 62 ++++++++++++++++++++++++++++++++++++++++++++--- sys/netpfil/pf/pf_table.c | 58 +++++++++++++++++++++----------------------- 2 files changed, 85 insertions(+), 35 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 6fbbb46b69b9..a98bdac54529 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -814,16 +814,70 @@ struct pfr_tstats { int pfrts_refcnt[PFR_REFCNT_MAX]; }; +#ifdef _KERNEL + +struct pfr_kstate_counter { + counter_u64_t pkc_pcpu; + u_int64_t pkc_zero; +}; + +static inline int +pfr_kstate_counter_init(struct pfr_kstate_counter *pfrc, int flags) +{ + + pfrc->pkc_zero = 0; + pfrc->pkc_pcpu = counter_u64_alloc(flags); + if (pfrc->pkc_pcpu == NULL) + return (ENOMEM); + return (0); +} + +static inline void +pfr_kstate_counter_deinit(struct pfr_kstate_counter *pfrc) +{ + + counter_u64_free(pfrc->pkc_pcpu); +} + +static inline u_int64_t +pfr_kstate_counter_fetch(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + c -= pfrc->pkc_zero; + return (c); +} + +static inline void +pfr_kstate_counter_zero(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + pfrc->pkc_zero = c; +} + +static inline void +pfr_kstate_counter_add(struct pfr_kstate_counter *pfrc, int64_t n) +{ + + counter_u64_add(pfrc->pkc_pcpu, n); +} + struct pfr_ktstats { struct pfr_table pfrts_t; - counter_u64_t pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_t pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_t pfrkts_match; - counter_u64_t pfrkts_nomatch; + struct pfr_kstate_counter pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_match; + struct pfr_kstate_counter pfrkts_nomatch; long pfrkts_tzero; int pfrkts_cnt; int pfrkts_refcnt[PFR_REFCNT_MAX]; }; + +#endif /* _KERNEL */ + #define pfrts_name pfrts_t.pfrt_name #define pfrts_flags pfrts_t.pfrt_flags diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index e9fd5f133c3f..d0b91fff1656 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1327,15 +1327,15 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size, for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { tbl->pfrts_packets[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_packets[pfr_dir][pfr_op]); tbl->pfrts_bytes[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_bytes[pfr_dir][pfr_op]); } } - tbl->pfrts_match = counter_u64_fetch(p->pfrkt_match); - tbl->pfrts_nomatch = counter_u64_fetch(p->pfrkt_nomatch); + tbl->pfrts_match = pfr_kstate_counter_fetch(&p->pfrkt_match); + tbl->pfrts_nomatch = pfr_kstate_counter_fetch(&p->pfrkt_nomatch); tbl->pfrts_tzero = p->pfrkt_tzero; tbl->pfrts_cnt = p->pfrkt_cnt; for (pfr_op = 0; pfr_op < PFR_REFCNT_MAX; pfr_op++) @@ -1871,12 +1871,12 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse) } for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - counter_u64_zero(kt->pfrkt_packets[pfr_dir][pfr_op]); - counter_u64_zero(kt->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_zero(&kt->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_zero(&kt->pfrkt_bytes[pfr_dir][pfr_op]); } } - counter_u64_zero(kt->pfrkt_match); - counter_u64_zero(kt->pfrkt_nomatch); + pfr_kstate_counter_zero(&kt->pfrkt_match); + pfr_kstate_counter_zero(&kt->pfrkt_nomatch); kt->pfrkt_tzero = tzero; } @@ -1906,28 +1906,24 @@ pfr_create_ktable(struct pfr_table *tbl, long tzero, int attachruleset) for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - kt->pfrkt_packets[pfr_dir][pfr_op] = - counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_packets[pfr_dir][pfr_op]) { + if (pfr_kstate_counter_init( + &kt->pfrkt_packets[pfr_dir][pfr_op], M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } - kt->pfrkt_bytes[pfr_dir][pfr_op] = - counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_bytes[pfr_dir][pfr_op]) { + if (pfr_kstate_counter_init( + &kt->pfrkt_bytes[pfr_dir][pfr_op], M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } } } - kt->pfrkt_match = counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_match) { + if (pfr_kstate_counter_init(&kt->pfrkt_match, M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } - kt->pfrkt_nomatch = counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_nomatch) { + if (pfr_kstate_counter_init(&kt->pfrkt_nomatch, M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } @@ -1978,12 +1974,12 @@ pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr) } for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - counter_u64_free(kt->pfrkt_packets[pfr_dir][pfr_op]); - counter_u64_free(kt->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_deinit(&kt->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_deinit(&kt->pfrkt_bytes[pfr_dir][pfr_op]); } } - counter_u64_free(kt->pfrkt_match); - counter_u64_free(kt->pfrkt_nomatch); + pfr_kstate_counter_deinit(&kt->pfrkt_match); + pfr_kstate_counter_deinit(&kt->pfrkt_nomatch); free(kt, M_PFTABLE); } @@ -2053,9 +2049,9 @@ pfr_match_addr(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af) } match = (ke && !ke->pfrke_not); if (match) - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); else - counter_u64_add(kt->pfrkt_nomatch, 1); + pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1); return (match); } @@ -2110,8 +2106,8 @@ pfr_update_stats(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af, ("pfr_update_stats: assertion failed.\n")); op_pass = PFR_OP_XPASS; } - counter_u64_add(kt->pfrkt_packets[dir_out][op_pass], 1); - counter_u64_add(kt->pfrkt_bytes[dir_out][op_pass], len); + pfr_kstate_counter_add(&kt->pfrkt_packets[dir_out][op_pass], 1); + pfr_kstate_counter_add(&kt->pfrkt_bytes[dir_out][op_pass], len); if (ke != NULL && op_pass != PFR_OP_XPASS && (kt->pfrkt_flags & PFR_TFLAG_COUNTERS)) { counter_u64_add(pfr_kentry_counter(&ke->pfrke_counters, @@ -2207,7 +2203,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, _next_block: ke = pfr_kentry_byidx(kt, idx, af); if (ke == NULL) { - counter_u64_add(kt->pfrkt_nomatch, 1); + pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1); return (1); } pfr_prepare_network(&umask, af, ke->pfrke_net); @@ -2232,7 +2228,7 @@ _next_block: /* this is a single IP address - no possible nested block */ PF_ACPY(counter, addr, af); *pidx = idx; - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); return (0); } for (;;) { @@ -2252,7 +2248,7 @@ _next_block: /* lookup return the same block - perfect */ PF_ACPY(counter, addr, af); *pidx = idx; - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); return (0); } From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 14:57:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEBB464DA9D; Wed, 14 Jul 2021 14:57:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ0x13kGnz4RbK; Wed, 14 Jul 2021 14:57:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5465D17DAF; Wed, 14 Jul 2021 14:57:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EEvvnd099359; Wed, 14 Jul 2021 14:57:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEvvxJ099358; Wed, 14 Jul 2021 14:57:57 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:57:57 GMT Message-Id: <202107141457.16EEvvxJ099358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 7267f83272b1 - stable/12 - pf: allow table stats clearing and reading with ruleset rlock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7267f83272b148f8734c0ced0489ff1022c1f68d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:57:57 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7267f83272b148f8734c0ced0489ff1022c1f68d commit 7267f83272b148f8734c0ced0489ff1022c1f68d Author: Mateusz Guzik AuthorDate: 2021-07-02 12:55:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-14 14:55:29 +0000 pf: allow table stats clearing and reading with ruleset rlock Instead serialize against these operations with a dedicated lock. Prior to the change, When pushing 17 mln pps of traffic, calling DIOCRGETTSTATS in a loop would restrict throughput to about 7 mln. With the change there is no slowdown. Reviewed by: kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit dc1ab04e4c9ede3606985e0cce1200e3060ac166) --- sys/net/pfvar.h | 7 +++++++ sys/netpfil/pf/pf.c | 4 ++++ sys/netpfil/pf/pf_ioctl.c | 18 ++++++++++++------ sys/netpfil/pf/pf_table.c | 2 ++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index a98bdac54529..6c934ad47bf2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -128,10 +128,17 @@ extern struct rmlock pf_rules_lock; #define PF_RULES_RUNLOCK() rm_runlock(&pf_rules_lock, &_pf_rules_tracker) #define PF_RULES_WLOCK() rm_wlock(&pf_rules_lock) #define PF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#define PF_RULES_WOWNED() rm_wowned(&pf_rules_lock) #define PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) #define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) +extern struct mtx pf_table_stats_lock; +#define PF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) +#define PF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) +#define PF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) +#define PF_TABLE_STATS_ASSERT() mtx_assert(&pf_rules_lock, MA_OWNED) + extern struct sx pf_end_lock; #define PF_MODVER 1 diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index cb616ef5788f..aa7a01d50823 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -212,6 +212,10 @@ struct mtx pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); +struct mtx pf_table_stats_lock; +MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", + MTX_DEF); + VNET_DEFINE_STATIC(uma_zone_t, pf_sources_z); #define V_pf_sources_z VNET(pf_sources_z) uma_zone_t pf_mtag_z; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 0481e58ae1e2..eb9719886bbe 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3740,10 +3740,12 @@ DIOCCHANGEADDR_error: error = ENODEV; break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); if (n < 0) { - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); error = EINVAL; break; } @@ -3754,12 +3756,14 @@ DIOCCHANGEADDR_error: sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT); if (pfrtstats == NULL) { error = ENOMEM; - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); break; } error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); if (error == 0) error = copyout(pfrtstats, io->pfrio_buffer, totlen); free(pfrtstats, M_TEMP); @@ -3798,10 +3802,12 @@ DIOCCHANGEADDR_error: break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); error = pfr_clr_tstats(pfrts, io->pfrio_size, &io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); free(pfrts, M_TEMP); break; } diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index d0b91fff1656..8dbab5e7bbe1 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1865,6 +1865,8 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse) struct pfr_kentryworkq addrq; int pfr_dir, pfr_op; + MPASS(PF_TABLE_STATS_OWNED() || PF_RULES_WOWNED()); + if (recurse) { pfr_enqueue_addrs(kt, &addrq, NULL, 0); pfr_clstats_kentries(kt, &addrq, tzero, 0); From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 14:57:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BA9F64DB23; Wed, 14 Jul 2021 14:57:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ0x25d64z4RdL; Wed, 14 Jul 2021 14:57:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C0B2180A8; Wed, 14 Jul 2021 14:57:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EEvwO1099390; Wed, 14 Jul 2021 14:57:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEvwRp099389; Wed, 14 Jul 2021 14:57:58 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:57:58 GMT Message-Id: <202107141457.16EEvwRp099389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: a3b8a5841c59 - stable/12 - pf: padalign global locks found in pf.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a3b8a5841c59f4cba9cd5c86d210cd525598daa4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:57:59 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a3b8a5841c59f4cba9cd5c86d210cd525598daa4 commit a3b8a5841c59f4cba9cd5c86d210cd525598daa4 Author: Mateusz Guzik AuthorDate: 2021-07-05 09:26:29 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-14 14:55:32 +0000 pf: padalign global locks found in pf.c Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f649cff58721f493f218a4d1fb88a12255945472) --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 6c934ad47bf2..d327451d869a 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -118,7 +118,7 @@ struct pfi_dynaddr { #define PF_STATE_LOCK_ASSERT(s) do {} while (0) #endif /* INVARIANTS */ -extern struct mtx pf_unlnkdrules_mtx; +extern struct mtx_padalign pf_unlnkdrules_mtx; #define PF_UNLNKDRULES_LOCK() mtx_lock(&pf_unlnkdrules_mtx) #define PF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) @@ -133,7 +133,7 @@ extern struct rmlock pf_rules_lock; #define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) -extern struct mtx pf_table_stats_lock; +extern struct mtx_padalign pf_table_stats_lock; #define PF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) #define PF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) #define PF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index aa7a01d50823..5f201c1228eb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -179,7 +179,7 @@ STAILQ_HEAD(pf_send_head, pf_send_entry); VNET_DEFINE_STATIC(struct pf_send_head, pf_sendqueue); #define V_pf_sendqueue VNET(pf_sendqueue) -static struct mtx pf_sendqueue_mtx; +static struct mtx_padalign pf_sendqueue_mtx; MTX_SYSINIT(pf_sendqueue_mtx, &pf_sendqueue_mtx, "pf send queue", MTX_DEF); #define PF_SENDQ_LOCK() mtx_lock(&pf_sendqueue_mtx) #define PF_SENDQ_UNLOCK() mtx_unlock(&pf_sendqueue_mtx) @@ -201,18 +201,18 @@ VNET_DEFINE_STATIC(struct pf_overload_head, pf_overloadqueue); VNET_DEFINE_STATIC(struct task, pf_overloadtask); #define V_pf_overloadtask VNET(pf_overloadtask) -static struct mtx pf_overloadqueue_mtx; +static struct mtx_padalign pf_overloadqueue_mtx; MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx, "pf overload/flush queue", MTX_DEF); #define PF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx) #define PF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx) VNET_DEFINE(struct pf_krulequeue, pf_unlinked_rules); -struct mtx pf_unlnkdrules_mtx; +struct mtx_padalign pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); -struct mtx pf_table_stats_lock; +struct mtx_padalign pf_table_stats_lock; MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", MTX_DEF); From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 14:58:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CC0B64DB24; Wed, 14 Jul 2021 14:58:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ0x35yRMz4RZF; Wed, 14 Jul 2021 14:57:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CF9618284; Wed, 14 Jul 2021 14:57:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EEvxuH099415; Wed, 14 Jul 2021 14:57:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEvx4r099414; Wed, 14 Jul 2021 14:57:59 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:57:59 GMT Message-Id: <202107141457.16EEvx4r099414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: db306b0b412a - stable/12 - pf: add pf_find_state_all_exists MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: db306b0b412a0d14c8a25ab5194c82106a09d0e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:58:00 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=db306b0b412a0d14c8a25ab5194c82106a09d0e2 commit db306b0b412a0d14c8a25ab5194c82106a09d0e2 Author: Mateusz Guzik AuthorDate: 2021-07-08 13:11:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-14 14:55:35 +0000 pf: add pf_find_state_all_exists Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 19d6e29b872232c47190344f3dfded2f73edd8ae) --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/pf.c | 9 +++++++++ sys/netpfil/pf/pf_lb.c | 10 ++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index d327451d869a..b2c4231f29cc 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1589,6 +1589,8 @@ pf_release_staten(struct pf_kstate *s, u_int n) extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); +extern bool pf_find_state_all_exists(struct pf_state_key_cmp *, + u_int); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 5f201c1228eb..6cabec0fdeaa 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1453,6 +1453,15 @@ second_run: return (ret); } +bool +pf_find_state_all_exists(struct pf_state_key_cmp *key, u_int dir) +{ + struct pf_kstate *s; + + s = pf_find_state_all(key, dir, NULL); + return (s != NULL); +} + /* END state table stuff */ static void diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 8160166edc95..b7079c47308a 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -244,13 +244,13 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, * (traceroute -I through nat) */ key.port[1] = sport; - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = sport; return (0); } } else if (low == high) { key.port[1] = htons(low); - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(low); return (0); } @@ -268,8 +268,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, /* low <= cut <= high */ for (tmp = cut; tmp <= high && tmp <= 0xffff; ++tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } @@ -277,8 +276,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, tmp = cut; for (tmp -= 1; tmp >= low && tmp <= 0xffff; --tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 20:48:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32EF5656141; Wed, 14 Jul 2021 20:48:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ8jv0zwMz4Ssd; Wed, 14 Jul 2021 20:48:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A2F71C7C7; Wed, 14 Jul 2021 20:48:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EKmola074238; Wed, 14 Jul 2021 20:48:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EKmol3074237; Wed, 14 Jul 2021 20:48:50 GMT (envelope-from git) Date: Wed, 14 Jul 2021 20:48:50 GMT Message-Id: <202107142048.16EKmol3074237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: cd2e5ae71bb1 - stable/13 - nfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cd2e5ae71bb1f283fba1d6dfd7aa63708ff1529f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 20:48:51 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=cd2e5ae71bb1f283fba1d6dfd7aa63708ff1529f commit cd2e5ae71bb1f283fba1d6dfd7aa63708ff1529f Author: Rick Macklem AuthorDate: 2021-06-30 22:15:41 +0000 Commit: Rick Macklem CommitDate: 2021-07-14 20:45:41 +0000 nfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message When the setting of kern.ipc.maxsockbuf is less than what is desired for I/O based on vfs.maxbcachebuf and vfs.nfs.bufpackets, a console message of "Consider increasing kern.ipc.maxsockbuf". is printed. This patch modifies the message to provide a suggested value for kern.ipc.maxsockbuf. Note that the setting is only needed when the NFS rsize/wsize is set to vfs.maxbcachebuf. While here, make nfs_bufpackets global, so that it can be used by a future patch that adds a sysctl to set the NFS server's maximum I/O size. Also, remove "sizeof(u_int32_t)" from the maximum packet length, since NFS_MAXXDR is already an "overestimate" of the actual length. (cherry picked from commit c5f4772c66d2eb31b84a84a89c8a284043f03452) --- sys/fs/nfs/nfs_commonkrpc.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 04ef04955ce0..63ff02331a0e 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -101,8 +101,8 @@ extern int nfscl_debuglevel; extern int nfsrv_lease; SVCPOOL *nfscbd_pool; +int nfs_bufpackets = 4; static int nfsrv_gsscallbackson = 0; -static int nfs_bufpackets = 4; static int nfs_reconnects; static int nfs3_jukebox_delay = 10; static int nfs_skip_wcc_data_onerr = 1; @@ -180,6 +180,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, struct thread *td = curthread; SVCXPRT *xprt; struct timeval timo; + uint64_t tval; /* * We need to establish the socket using the credentials of @@ -238,8 +239,21 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, do { if (error != 0 && pktscale > 2) { if (nmp != NULL && nrp->nr_sotype == SOCK_STREAM && - pktscale == pktscalesav) - printf("Consider increasing kern.ipc.maxsockbuf\n"); + pktscale == pktscalesav) { + /* + * Suggest vfs.nfs.bufpackets * maximum RPC message, + * adjusted for the sb_max->sb_max_adj conversion of + * MCLBYTES / (MSIZE + MCLBYTES) as the minimum setting + * for kern.ipc.maxsockbuf. + */ + tval = (NFS_MAXBSIZE + NFS_MAXXDR) * nfs_bufpackets; + tval *= MSIZE + MCLBYTES; + tval += MCLBYTES - 1; /* Round up divide by MCLBYTES. */ + tval /= MCLBYTES; + printf("Consider increasing kern.ipc.maxsockbuf to a " + "minimum of %ju to support %ubyte NFS I/O\n", + (uintmax_t)tval, NFS_MAXBSIZE); + } pktscale--; } if (nrp->nr_sotype == SOCK_DGRAM) { @@ -255,10 +269,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, if (nrp->nr_sotype != SOCK_STREAM) panic("nfscon sotype"); if (nmp != NULL) { - sndreserve = (NFS_MAXBSIZE + NFS_MAXXDR + - sizeof (u_int32_t)) * pktscale; - rcvreserve = (NFS_MAXBSIZE + NFS_MAXXDR + - sizeof (u_int32_t)) * pktscale; + sndreserve = (NFS_MAXBSIZE + NFS_MAXXDR) * + pktscale; + rcvreserve = (NFS_MAXBSIZE + NFS_MAXXDR) * + pktscale; } else { sndreserve = rcvreserve = 1024 * pktscale; } From owner-dev-commits-src-branches@freebsd.org Thu Jul 15 23:28:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF834653410; Thu, 15 Jul 2021 23:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQrCj4JXWz4rns; Thu, 15 Jul 2021 23:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70DAB12AE1; Thu, 15 Jul 2021 23:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16FNSX7C014206; Thu, 15 Jul 2021 23:28:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FNSXGh014205; Thu, 15 Jul 2021 23:28:33 GMT (envelope-from git) Date: Thu, 15 Jul 2021 23:28:33 GMT Message-Id: <202107152328.16FNSXGh014205@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 40a925385fa6 - stable/12 - awk: revert upstream's attempt to disallow hex strings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 40a925385fa6b7c1a177880e36aa0fc278043e49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 23:28:33 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=40a925385fa6b7c1a177880e36aa0fc278043e49 commit 40a925385fa6b7c1a177880e36aa0fc278043e49 Author: Warner Losh AuthorDate: 2021-07-15 22:46:06 +0000 Commit: Warner Losh CommitDate: 2021-07-15 23:27:57 +0000 awk: revert upstream's attempt to disallow hex strings Upstream one-true-awk decided to disallow hex strings as numbers. This is in line with awk's behavior prior to C99, and allowed by the POSIX standard. The standard, however, allows them to be treated as numbers because that's what the standard said in the 2001 through 2004 editions. Since 2001, the nawk in FreeBSD has treated them as numbers, so restore that behavior, allowed by the standard. A number of scripts in the FreeBSD tree depend on this interpretation, including scripts to build the kernel which had mysteriously started failing for some people and not others. By re-allowing 0x hex numbers, this fixes those scripts and restores POLA. Upstream issue: https://github.com/onetrueawk/awk/issues/126 Sponsored by: Netflix Reviewed by: kevans MFC After: asap due to regression alrady merged to stable Differential Revision: https://reviews.freebsd.org/D31199 (cherry picked from commit d4d252c49976de33d0a2926df733744d0b8d95fa) --- contrib/one-true-awk/lib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/one-true-awk/lib.c b/contrib/one-true-awk/lib.c index 18adbd2d1fd6..6bfe5e8eaad9 100644 --- a/contrib/one-true-awk/lib.c +++ b/contrib/one-true-awk/lib.c @@ -793,9 +793,18 @@ bool is_valid_number(const char *s, bool trailing_stuff_ok, while (isspace(*s)) s++; +/* + * This test, while allowed by newer POSIX standards, represents a regression + * where hex strings were treated as numbers in nawk the whole time it has been + * in FreeBSD (since 2001). The POSIX 2001 through 2004 standards mandated this + * behavior and the current standard allows it. Deviate from upstream by restoring + * the prior FreeBSD behavior. + */ +#if 0 // no hex floating point, sorry if (s[0] == '0' && tolower(s[1]) == 'x') return false; +#endif // allow +nan, -nan, +inf, -inf, any other letter, no if (s[0] == '+' || s[0] == '-') { From owner-dev-commits-src-branches@freebsd.org Thu Jul 15 23:29:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26279652B5B; Thu, 15 Jul 2021 23:29:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQrDK0ZJ1z4rmd; Thu, 15 Jul 2021 23:29:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFD3412BD9; Thu, 15 Jul 2021 23:29:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16FNT4bH014351; Thu, 15 Jul 2021 23:29:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FNT4Xx014350; Thu, 15 Jul 2021 23:29:04 GMT (envelope-from git) Date: Thu, 15 Jul 2021 23:29:04 GMT Message-Id: <202107152329.16FNT4Xx014350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 3e8044635219 - stable/13 - awk: revert upstream's attempt to disallow hex strings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3e8044635219ecc467165d0fd020df03ec02ff2c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 23:29:05 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3e8044635219ecc467165d0fd020df03ec02ff2c commit 3e8044635219ecc467165d0fd020df03ec02ff2c Author: Warner Losh AuthorDate: 2021-07-15 22:46:06 +0000 Commit: Warner Losh CommitDate: 2021-07-15 23:28:37 +0000 awk: revert upstream's attempt to disallow hex strings Upstream one-true-awk decided to disallow hex strings as numbers. This is in line with awk's behavior prior to C99, and allowed by the POSIX standard. The standard, however, allows them to be treated as numbers because that's what the standard said in the 2001 through 2004 editions. Since 2001, the nawk in FreeBSD has treated them as numbers, so restore that behavior, allowed by the standard. A number of scripts in the FreeBSD tree depend on this interpretation, including scripts to build the kernel which had mysteriously started failing for some people and not others. By re-allowing 0x hex numbers, this fixes those scripts and restores POLA. Upstream issue: https://github.com/onetrueawk/awk/issues/126 Sponsored by: Netflix Reviewed by: kevans MFC After: asap due to regression alrady merged to stable Differential Revision: https://reviews.freebsd.org/D31199 (cherry picked from commit d4d252c49976de33d0a2926df733744d0b8d95fa) --- contrib/one-true-awk/lib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/one-true-awk/lib.c b/contrib/one-true-awk/lib.c index 18adbd2d1fd6..6bfe5e8eaad9 100644 --- a/contrib/one-true-awk/lib.c +++ b/contrib/one-true-awk/lib.c @@ -793,9 +793,18 @@ bool is_valid_number(const char *s, bool trailing_stuff_ok, while (isspace(*s)) s++; +/* + * This test, while allowed by newer POSIX standards, represents a regression + * where hex strings were treated as numbers in nawk the whole time it has been + * in FreeBSD (since 2001). The POSIX 2001 through 2004 standards mandated this + * behavior and the current standard allows it. Deviate from upstream by restoring + * the prior FreeBSD behavior. + */ +#if 0 // no hex floating point, sorry if (s[0] == '0' && tolower(s[1]) == 'x') return false; +#endif // allow +nan, -nan, +inf, -inf, any other letter, no if (s[0] == '+' || s[0] == '-') { From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 00:40:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FA64654BD6; Fri, 16 Jul 2021 00:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQspn0DDVz3KRG; Fri, 16 Jul 2021 00:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCF3213B4F; Fri, 16 Jul 2021 00:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G0eWqT016805; Fri, 16 Jul 2021 00:40:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G0eWLI016804; Fri, 16 Jul 2021 00:40:32 GMT (envelope-from git) Date: Fri, 16 Jul 2021 00:40:32 GMT Message-Id: <202107160040.16G0eWLI016804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: feb1dc84d895 - stable/12 - Skip netgraph tests when WITHOUT_NETGRAPH is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: feb1dc84d895bfb53b0b205a1b55b955ab32b0a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 00:40:33 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=feb1dc84d895bfb53b0b205a1b55b955ab32b0a5 commit feb1dc84d895bfb53b0b205a1b55b955ab32b0a5 Author: Ed Maste AuthorDate: 2021-07-06 13:44:15 +0000 Commit: Ed Maste CommitDate: 2021-07-16 00:39:34 +0000 Skip netgraph tests when WITHOUT_NETGRAPH is set PR: 256986 Reported by: John Marshall MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999) --- tests/sys/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 2bf51bcd3fd7..5d96c7654a28 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -18,7 +18,7 @@ TESTS_SUBDIRS+= kern TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue -TESTS_SUBDIRS+= netgraph +TESTS_SUBDIRS+= ${_netgraph} TESTS_SUBDIRS+= netinet TESTS_SUBDIRS+= netinet6 TESTS_SUBDIRS+= netipsec @@ -38,6 +38,10 @@ _audit= audit _cddl= cddl .endif +.if ${MK_NETGRAPH} != "no" +_netgraph= netgraph +.endif + # Items not integrated into kyua runs by default SUBDIR+= pjdfstest From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 04:08:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFC6F659F57; Fri, 16 Jul 2021 04:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQyQr560pz4bgk; Fri, 16 Jul 2021 04:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 970BF1692D; Fri, 16 Jul 2021 04:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G48aP3089577; Fri, 16 Jul 2021 04:08:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G48aPZ089576; Fri, 16 Jul 2021 04:08:36 GMT (envelope-from git) Date: Fri, 16 Jul 2021 04:08:36 GMT Message-Id: <202107160408.16G48aPZ089576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 8b9b3d90de5d - stable/12 - UPDATING: Not unusual side effect of the awk bug fixed in 40a925385fa6b MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8b9b3d90de5dbeba0f8d68a154c657c0c139e5a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 04:08:36 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8b9b3d90de5dbeba0f8d68a154c657c0c139e5a9 commit 8b9b3d90de5dbeba0f8d68a154c657c0c139e5a9 Author: Warner Losh AuthorDate: 2021-07-16 04:05:31 +0000 Commit: Warner Losh CommitDate: 2021-07-16 04:08:14 +0000 UPDATING: Not unusual side effect of the awk bug fixed in 40a925385fa6b You might not be able to build the kernel if you have an awk between Jul 10th and today. In stable/12, more (all) platforms than -current or stable/13 have the first offset of the thread structure in the 0xfxx range, which triggers this problem. If you've updated awk, you'll likely need to follow the instructions here to install a fixed version before you'll be able to build a kernel. Sponsored by: Netflix --- UPDATING | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/UPDATING b/UPDATING index 83cf3b8e6ffa..dcde1cb75903 100644 --- a/UPDATING +++ b/UPDATING @@ -17,6 +17,22 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20210715: + The 20210707 awk update brought in a change in behavior. This has + been corrected as of d4d252c49976. Between these dates, if you + installed a new awk binary, you may not be able to build a new + kernel because the change in behavior affected the genoffset + script used to build the kernel. If you did update, the fix is + to update your sources past the above hash and do + % cd usr.bin/awk + % make clean all + % sudo -E make install + to enable building kernels again. + +20210710: + awk has been updated to the latest one-true-awk version 20210215. + This contains a number of minor bug fixes. + 20210626: Commit 6ae32cc8182f changed the internal KAPI between the krpc and nfsd modules. As such, both need to be rebuilt from sources. From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 04:09:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B3E0659FB9; Fri, 16 Jul 2021 04:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQyRZ3kQjz4bvm; Fri, 16 Jul 2021 04:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 677A0166F4; Fri, 16 Jul 2021 04:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G49EgD089738; Fri, 16 Jul 2021 04:09:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G49EIv089737; Fri, 16 Jul 2021 04:09:14 GMT (envelope-from git) Date: Fri, 16 Jul 2021 04:09:14 GMT Message-Id: <202107160409.16G49EIv089737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d5c098328bb6 - stable/13 - UPDATING: Not unusual side effect of the awk bug fixed in 3e804463521 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d5c098328bb62a16d19ac5132f8a0f478b4e0e55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 04:09:14 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d5c098328bb62a16d19ac5132f8a0f478b4e0e55 commit d5c098328bb62a16d19ac5132f8a0f478b4e0e55 Author: Warner Losh AuthorDate: 2021-07-16 04:03:24 +0000 Commit: Warner Losh CommitDate: 2021-07-16 04:03:24 +0000 UPDATING: Not unusual side effect of the awk bug fixed in 3e804463521 You might not be able to build the kernel if you have an awk between Jul 10th and today. It does not affect all platforms due to the nature of the bug (so amd64 is unaffected in stable/13 or current, but is affected in stable/12. i386 seems to be affected everywhere). Sponsored by: Netflix --- UPDATING | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/UPDATING b/UPDATING index 073e9b03867a..a3fe9b74a245 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,18 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20210715: + The 20210707 awk update brought in a change in behavior. This has + been corrected as of d4d252c49976. Between these dates, if you + installed a new awk binary, you may not be able to build a new + kernel because the change in behavior affected the genoffset + script used to build the kernel. If you did update, the fix is + to update your sources past the above hash and do + % cd usr.bin/awk + % make clean all + % sudo -E make install + to enable building kernels again. + 20210711: Commit 8a04edfdcbd2 changes the default minor version used for NFSv4 mounts to the highest minor version supported @@ -21,6 +33,10 @@ and/or ports. that this would be acceptable to do and would not be considered a POLA violation. +20210710: + awk has been updated to the latest one-true-awk version 20210215. + This contains a number of minor bug fixes. + 20210630: Commit ca179c4d74f2/632e3f2f3a66 changed the package in which the OpenSSL libraries and utilities are packaged. From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 06:35:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3162865BF06; Fri, 16 Jul 2021 06:35:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR1ht0ptKz3G50; Fri, 16 Jul 2021 06:35:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2E23189A8; Fri, 16 Jul 2021 06:35:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G6ZvDK088091; Fri, 16 Jul 2021 06:35:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G6ZvnX088090; Fri, 16 Jul 2021 06:35:57 GMT (envelope-from git) Date: Fri, 16 Jul 2021 06:35:57 GMT Message-Id: <202107160635.16G6ZvnX088090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 4ee2bcb486ad - stable/13 - rc.d: unbreak sysctl lastload MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4ee2bcb486ad49ba547ae5a7c74d967f1f27605f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 06:35:58 -0000 The branch stable/13 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=4ee2bcb486ad49ba547ae5a7c74d967f1f27605f commit 4ee2bcb486ad49ba547ae5a7c74d967f1f27605f Author: Eugene Grosbein AuthorDate: 2021-05-19 13:02:31 +0000 Commit: Eugene Grosbein CommitDate: 2021-07-16 06:35:11 +0000 rc.d: unbreak sysctl lastload /etc/rc.d/securelevel is supposed to run /etc/rc.d/sysctl lastload late at boot time to apply /etc/sysctl.conf settings that fail to apply early. However, this does not work in default configuration because of kern_securelevel_enable="NO" by default. Add new script /etc/rc.d/sysctl_lastload that starts unconditionally. Reported by: Marek Zarychta (cherry picked from commit f4b38c360e63a6e66245efedbd6c070f9c0aee55) --- libexec/rc/rc.d/securelevel | 6 +----- libexec/rc/rc.d/sysctl_lastload | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libexec/rc/rc.d/securelevel b/libexec/rc/rc.d/securelevel index 24dbf269df3f..8bb09dd920bd 100755 --- a/libexec/rc/rc.d/securelevel +++ b/libexec/rc/rc.d/securelevel @@ -4,7 +4,7 @@ # # PROVIDE: securelevel -# REQUIRE: adjkerntz ipfw pf +# REQUIRE: adjkerntz ipfw pf sysctl_lastload . /etc/rc.subr @@ -14,10 +14,6 @@ rcvar='kern_securelevel_enable' start_cmd="securelevel_start" stop_cmd=":" -# Last chance to set sysctl variables that failed the first time. -# -/etc/rc.d/sysctl lastload - securelevel_start() { if [ ${kern_securelevel} -ge 0 ]; then diff --git a/libexec/rc/rc.d/sysctl_lastload b/libexec/rc/rc.d/sysctl_lastload new file mode 100755 index 000000000000..22aafd96d051 --- /dev/null +++ b/libexec/rc/rc.d/sysctl_lastload @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: sysctl_lastload +# REQUIRE: LOGIN +# BEFORE: jail + +. /etc/rc.subr + +name="sysctl_lastload" +desc="Last chance to set sysctl variables that failed the first time." +start_cmd="/etc/rc.d/sysctl lastload" +stop_cmd=":" + +load_rc_config $name +run_rc_command "$1" From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 06:37:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C556E65BE17; Fri, 16 Jul 2021 06:37:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR1l15Cyfz3GWC; Fri, 16 Jul 2021 06:37:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C95D189A9; Fri, 16 Jul 2021 06:37:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G6bn8Y088399; Fri, 16 Jul 2021 06:37:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G6bnjh088398; Fri, 16 Jul 2021 06:37:49 GMT (envelope-from git) Date: Fri, 16 Jul 2021 06:37:49 GMT Message-Id: <202107160637.16G6bnjh088398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 6ec2f0d74b22 - stable/12 - rc.d: unbreak sysctl lastload MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6ec2f0d74b22f857530b87ce8db153831fff1cca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 06:37:49 -0000 The branch stable/12 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=6ec2f0d74b22f857530b87ce8db153831fff1cca commit 6ec2f0d74b22f857530b87ce8db153831fff1cca Author: Eugene Grosbein AuthorDate: 2021-05-19 13:02:31 +0000 Commit: Eugene Grosbein CommitDate: 2021-07-16 06:37:04 +0000 rc.d: unbreak sysctl lastload /etc/rc.d/securelevel is supposed to run /etc/rc.d/sysctl lastload late at boot time to apply /etc/sysctl.conf settings that fail to apply early. However, this does not work in default configuration because of kern_securelevel_enable="NO" by default. Add new script /etc/rc.d/sysctl_lastload that starts unconditionally. Reported by: Marek Zarychta MFC after: 1 month (cherry picked from commit f4b38c360e63a6e66245efedbd6c070f9c0aee55) --- libexec/rc/rc.d/securelevel | 6 +----- libexec/rc/rc.d/sysctl_lastload | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libexec/rc/rc.d/securelevel b/libexec/rc/rc.d/securelevel index 24dbf269df3f..8bb09dd920bd 100755 --- a/libexec/rc/rc.d/securelevel +++ b/libexec/rc/rc.d/securelevel @@ -4,7 +4,7 @@ # # PROVIDE: securelevel -# REQUIRE: adjkerntz ipfw pf +# REQUIRE: adjkerntz ipfw pf sysctl_lastload . /etc/rc.subr @@ -14,10 +14,6 @@ rcvar='kern_securelevel_enable' start_cmd="securelevel_start" stop_cmd=":" -# Last chance to set sysctl variables that failed the first time. -# -/etc/rc.d/sysctl lastload - securelevel_start() { if [ ${kern_securelevel} -ge 0 ]; then diff --git a/libexec/rc/rc.d/sysctl_lastload b/libexec/rc/rc.d/sysctl_lastload new file mode 100755 index 000000000000..22aafd96d051 --- /dev/null +++ b/libexec/rc/rc.d/sysctl_lastload @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: sysctl_lastload +# REQUIRE: LOGIN +# BEFORE: jail + +. /etc/rc.subr + +name="sysctl_lastload" +desc="Last chance to set sysctl variables that failed the first time." +start_cmd="/etc/rc.d/sysctl lastload" +stop_cmd=":" + +load_rc_config $name +run_rc_command "$1" From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 06:42:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC5C665C144; Fri, 16 Jul 2021 06:42:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR1qv5pcpz3Gvl; Fri, 16 Jul 2021 06:42:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE4EA18AFF; Fri, 16 Jul 2021 06:42:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G6g39E001209; Fri, 16 Jul 2021 06:42:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G6g39O001208; Fri, 16 Jul 2021 06:42:03 GMT (envelope-from git) Date: Fri, 16 Jul 2021 06:42:03 GMT Message-Id: <202107160642.16G6g39O001208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: c403205e553e - stable/13 - ipfw: reload sysctl.conf variables if needed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c403205e553ee7402ab1adf6da4a8dbd722f8608 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 06:42:03 -0000 The branch stable/13 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=c403205e553ee7402ab1adf6da4a8dbd722f8608 commit c403205e553ee7402ab1adf6da4a8dbd722f8608 Author: Eugene Grosbein AuthorDate: 2021-05-17 21:03:15 +0000 Commit: Eugene Grosbein CommitDate: 2021-07-16 06:40:39 +0000 ipfw: reload sysctl.conf variables if needed Currently ipfw has multiple components that are not parts of GENERIC kernel like dummynet etc. They can bring in important sysctls if enabled with rc.conf(5) and loaded with ipfw startup script by means of "required_modules" after initial consult with /etc/sysctl.conf at boot time. Here is an example of one increasing limit for dummynet hold queues that defaults to 100: net.inet.ip.dummynet.pipe_slot_limit=1000 This makes it possible to use ipfw/dummynet rules such as: ipfw pipe 1 config bw 50Mbit/s queue 1000 Such rule is rejected unless above sysctl is applied. Another example is a group of net.inet.ip.alias.* sysctls created after libalias.ko loaded as dependency of ipfw_nat. This is not a problem if corresponding code compiled in custom kernel so sysctls exist when sysctl.conf is read early or kernel modules loaded with a loader. This change makes it work also for GENERIC and modules loaded by means of rc.conf(5) settings. (cherry picked from commit f5b5de1a3210234f3a6864c88a2d3e11ac2dbf04) --- libexec/rc/rc.d/ipfw | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/ipfw b/libexec/rc/rc.d/ipfw index fd1c97671d70..22b65d2908cb 100755 --- a/libexec/rc/rc.d/ipfw +++ b/libexec/rc/rc.d/ipfw @@ -47,7 +47,7 @@ ipfw_prestart() ipfw_start() { - local _firewall_type + local _firewall_type _module _sysctl_reload if [ -n "${1}" ]; then _firewall_type=$1 @@ -55,6 +55,19 @@ ipfw_start() _firewall_type=${firewall_type} fi + _sysctl_reload=no + for _module in ${required_modules} + do + if kldstat -qn ${_module}; then + _sysctl_reload=yes + break + fi + done + + if [ ${_sysctl_reload} = yes ]; then + /etc/rc.d/sysctl reload + fi + # set the firewall rules script if none was specified [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 06:42:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 185C365C199; Fri, 16 Jul 2021 06:42:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR1rb0DZlz3HL2; Fri, 16 Jul 2021 06:42:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E54EE183E0; Fri, 16 Jul 2021 06:42:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G6gcvx001384; Fri, 16 Jul 2021 06:42:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G6gcfT001383; Fri, 16 Jul 2021 06:42:38 GMT (envelope-from git) Date: Fri, 16 Jul 2021 06:42:38 GMT Message-Id: <202107160642.16G6gcfT001383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 61891195f8ed - stable/12 - ipfw: reload sysctl.conf variables if needed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 61891195f8ed2767112810040a79a705e9a285d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 06:42:39 -0000 The branch stable/12 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=61891195f8ed2767112810040a79a705e9a285d5 commit 61891195f8ed2767112810040a79a705e9a285d5 Author: Eugene Grosbein AuthorDate: 2021-05-17 21:03:15 +0000 Commit: Eugene Grosbein CommitDate: 2021-07-16 06:42:20 +0000 ipfw: reload sysctl.conf variables if needed Currently ipfw has multiple components that are not parts of GENERIC kernel like dummynet etc. They can bring in important sysctls if enabled with rc.conf(5) and loaded with ipfw startup script by means of "required_modules" after initial consult with /etc/sysctl.conf at boot time. Here is an example of one increasing limit for dummynet hold queues that defaults to 100: net.inet.ip.dummynet.pipe_slot_limit=1000 This makes it possible to use ipfw/dummynet rules such as: ipfw pipe 1 config bw 50Mbit/s queue 1000 Such rule is rejected unless above sysctl is applied. Another example is a group of net.inet.ip.alias.* sysctls created after libalias.ko loaded as dependency of ipfw_nat. This is not a problem if corresponding code compiled in custom kernel so sysctls exist when sysctl.conf is read early or kernel modules loaded with a loader. This change makes it work also for GENERIC and modules loaded by means of rc.conf(5) settings. (cherry picked from commit f5b5de1a3210234f3a6864c88a2d3e11ac2dbf04) --- libexec/rc/rc.d/ipfw | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/ipfw b/libexec/rc/rc.d/ipfw index 50d95543023d..5d0bcc816560 100755 --- a/libexec/rc/rc.d/ipfw +++ b/libexec/rc/rc.d/ipfw @@ -47,7 +47,7 @@ ipfw_prestart() ipfw_start() { - local _firewall_type + local _firewall_type _module _sysctl_reload if [ -n "${1}" ]; then _firewall_type=$1 @@ -55,6 +55,19 @@ ipfw_start() _firewall_type=${firewall_type} fi + _sysctl_reload=no + for _module in ${required_modules} + do + if kldstat -qn ${_module}; then + _sysctl_reload=yes + break + fi + done + + if [ ${_sysctl_reload} = yes ]; then + /etc/rc.d/sysctl reload + fi + # set the firewall rules script if none was specified [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 06:45:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F30ED65C169; Fri, 16 Jul 2021 06:45:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR1wL6Rg0z3HfD; Fri, 16 Jul 2021 06:45:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C10CF189E4; Fri, 16 Jul 2021 06:45:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G6jsZW001854; Fri, 16 Jul 2021 06:45:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G6jsR1001852; Fri, 16 Jul 2021 06:45:54 GMT (envelope-from git) Date: Fri, 16 Jul 2021 06:45:54 GMT Message-Id: <202107160645.16G6jsR1001852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 5cc84f7ae5a6 - stable/13 - rc.d: connect sysctl_lastload MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5cc84f7ae5a6a32cd52aaad5ceeb0151cf6b64f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 06:45:55 -0000 The branch stable/13 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=5cc84f7ae5a6a32cd52aaad5ceeb0151cf6b64f3 commit 5cc84f7ae5a6a32cd52aaad5ceeb0151cf6b64f3 Author: Eugene Grosbein AuthorDate: 2021-05-20 04:51:31 +0000 Commit: Eugene Grosbein CommitDate: 2021-07-16 06:45:33 +0000 rc.d: connect sysctl_lastload Add recently added sysctl_lastload. (cherry picked from commit 20eb969793921dce9e524d19fc02b84cabd98f74) --- libexec/rc/rc.d/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 13ed6048efc0..ed4827a10226 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -107,6 +107,7 @@ CONFS= DAEMON \ swap \ swaplate \ sysctl \ + sysctl_lastload \ syslogd \ sysvipc \ tmp \ From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 06:46:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B4C165BBEE; Fri, 16 Jul 2021 06:46:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR1wn5NrMz3HWC; Fri, 16 Jul 2021 06:46:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A220F18B07; Fri, 16 Jul 2021 06:46:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G6kHte002012; Fri, 16 Jul 2021 06:46:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G6kHpR002011; Fri, 16 Jul 2021 06:46:17 GMT (envelope-from git) Date: Fri, 16 Jul 2021 06:46:17 GMT Message-Id: <202107160646.16G6kHpR002011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: aed0c36c718c - stable/12 - rc.d: connect sysctl_lastload MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: aed0c36c718c2fc0b336544b3ece3d2651456fcf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 06:46:18 -0000 The branch stable/12 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=aed0c36c718c2fc0b336544b3ece3d2651456fcf commit aed0c36c718c2fc0b336544b3ece3d2651456fcf Author: Eugene Grosbein AuthorDate: 2021-05-20 04:51:31 +0000 Commit: Eugene Grosbein CommitDate: 2021-07-16 06:46:04 +0000 rc.d: connect sysctl_lastload Add recently added sysctl_lastload. (cherry picked from commit 20eb969793921dce9e524d19fc02b84cabd98f74) --- libexec/rc/rc.d/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index f6e6c437fece..699505f98770 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -111,6 +111,7 @@ CONFS= DAEMON \ swap \ swaplate \ sysctl \ + sysctl_lastload \ syslogd \ sysvipc \ tmp \ From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:53:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C729B660210; Fri, 16 Jul 2021 11:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lk4pgdz4qpG; Fri, 16 Jul 2021 11:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C6CA1CB92; Fri, 16 Jul 2021 11:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBrsg4016000; Fri, 16 Jul 2021 11:53:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBrs2f015999; Fri, 16 Jul 2021 11:53:54 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:53:54 GMT Message-Id: <202107161153.16GBrs2f015999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a47d7a2e8e19 - stable/13 - pf: Remove unneeded NULL check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a47d7a2e8e19b87c9871bcb54942150bb4e1ff98 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:53:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a47d7a2e8e19b87c9871bcb54942150bb4e1ff98 commit a47d7a2e8e19b87c9871bcb54942150bb4e1ff98 Author: Kristof Provost AuthorDate: 2021-07-05 12:02:06 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 09:08:27 +0000 pf: Remove unneeded NULL check pidx is never NULL, and is used unconditionally later on in the function. Add an assertion, as documentation for the requirement to provide an idx pointer. Reported by: clang --analyze MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20) --- sys/netpfil/pf/pf_table.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index 5afc90e54d7c..4cfe5d61e83e 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -2177,6 +2177,8 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, struct pfr_kentry *ke, *ke2 = NULL; int idx = -1, use_counter = 0; + MPASS(pidx != NULL); + switch (af) { case AF_INET: uaddr.sin.sin_len = sizeof(struct sockaddr_in); @@ -2194,8 +2196,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE)) return (-1); - if (pidx != NULL) - idx = *pidx; + idx = *pidx; if (counter != NULL && idx >= 0) use_counter = 1; if (idx < 0) From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:53:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDA04660018; Fri, 16 Jul 2021 11:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8ll5ppSz4qZw; Fri, 16 Jul 2021 11:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AECAC1CCC1; Fri, 16 Jul 2021 11:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBrtHS016024; Fri, 16 Jul 2021 11:53:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBrt6l016023; Fri, 16 Jul 2021 11:53:55 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:53:55 GMT Message-Id: <202107161153.16GBrt6l016023@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: fa21fc599d94 - stable/13 - pf: Handle errors returned by pf_killstates() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa21fc599d948ce822adf471ba876dfb228a9ec9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:53:56 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fa21fc599d948ce822adf471ba876dfb228a9ec9 commit fa21fc599d948ce822adf471ba876dfb228a9ec9 Author: Kristof Provost AuthorDate: 2021-07-05 12:21:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 09:08:27 +0000 pf: Handle errors returned by pf_killstates() Happily this wasn't a real bug, because pf_killstates() never fails, but we should check the return value anyway, in case it does ever start returning errors. Reported by: clang --analyze MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15) --- sys/netpfil/pf/pf_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 694134c6c663..68ccb741710a 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -4888,6 +4888,8 @@ pf_killstates_nv(struct pfioc_nv *nv) ERROUT(error); error = pf_killstates(&kill, &killed); + if (error) + ERROUT(error); free(nvlpacked, M_NVLIST); nvlpacked = NULL; From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:53:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87EBB65FF71; Fri, 16 Jul 2021 11:53:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8ln0t0jz4qsB; Fri, 16 Jul 2021 11:53:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2F161CA45; Fri, 16 Jul 2021 11:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBrujV016048; Fri, 16 Jul 2021 11:53:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBru8v016047; Fri, 16 Jul 2021 11:53:56 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:53:56 GMT Message-Id: <202107161153.16GBru8v016047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 52ed44d9c09a - stable/13 - pf: pf_killstates() never fails, so remove the return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 52ed44d9c09a4606c108c2caa79ce7bbeed060fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:53:57 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=52ed44d9c09a4606c108c2caa79ce7bbeed060fc commit 52ed44d9c09a4606c108c2caa79ce7bbeed060fc Author: Kristof Provost AuthorDate: 2021-07-08 08:54:16 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 09:08:27 +0000 pf: pf_killstates() never fails, so remove the return value Suggested by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 34641052826c718566b994b75cd2bddb53a21583) --- sys/netpfil/pf/pf_ioctl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 68ccb741710a..bed3e8b057d1 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -202,7 +202,7 @@ struct cdev *pf_dev; */ static void pf_clear_all_states(void); static unsigned int pf_clear_states(const struct pf_kstate_kill *); -static int pf_killstates(struct pf_kstate_kill *, +static void pf_killstates(struct pf_kstate_kill *, unsigned int *); static int pf_killstates_row(struct pf_kstate_kill *, struct pf_idhash *); @@ -2780,7 +2780,7 @@ DIOCCHANGERULE_error: break; psk->psk_killed = 0; - error = pf_killstates(&kill, &psk->psk_killed); + pf_killstates(&kill, &psk->psk_killed); break; } @@ -4835,7 +4835,7 @@ relock_DIOCCLRSTATES: return (killed); } -static int +static void pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) { struct pf_kstate *s; @@ -4848,13 +4848,13 @@ pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) pf_unlink_state(s, PF_ENTER_LOCKED); *killed = 1; } - return (0); + return; } for (unsigned int i = 0; i <= pf_hashmask; i++) *killed += pf_killstates_row(kill, &V_pf_idhash[i]); - return (0); + return; } static int @@ -4887,9 +4887,7 @@ pf_killstates_nv(struct pfioc_nv *nv) if (error) ERROUT(error); - error = pf_killstates(&kill, &killed); - if (error) - ERROUT(error); + pf_killstates(&kill, &killed); free(nvlpacked, M_NVLIST); nvlpacked = NULL; From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:53:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3080065FF73; Fri, 16 Jul 2021 11:53:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lp0bkDz4qb2; Fri, 16 Jul 2021 11:53:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE81B1C55B; Fri, 16 Jul 2021 11:53:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBrvdX016088; Fri, 16 Jul 2021 11:53:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBrvLl016087; Fri, 16 Jul 2021 11:53:57 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:53:57 GMT Message-Id: <202107161153.16GBrvLl016087@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 6d6ad3130815 - stable/13 - dummynet: reduce console spam MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6d6ad313081535416ca26da26dc2e0b57da6bf37 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:53:58 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6d6ad313081535416ca26da26dc2e0b57da6bf37 commit 6d6ad313081535416ca26da26dc2e0b57da6bf37 Author: Luiz Otavio O Souza AuthorDate: 2016-02-11 13:35:01 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 09:08:27 +0000 dummynet: reduce console spam Only print this warning when boot verbose is enabled. This can get pretty annoying (and useless) in some systems. Reviewed by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit c5dd8bac0b96e11da02181bd1dbee677e270842d) --- sys/netpfil/ipfw/ip_dummynet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index 56fa56138d96..d3242fd85817 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -169,7 +169,7 @@ ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg) op = "Clamp"; } else return *v; - if (op && msg) + if (op && msg && bootverbose) printf("%s %s to %d (was %d)\n", op, msg, *v, oldv); return *v; } From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:53:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A13F965FBFE; Fri, 16 Jul 2021 11:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lp4gkXz4qvR; Fri, 16 Jul 2021 11:53:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 858B61CCC2; Fri, 16 Jul 2021 11:53:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBrw0E016190; Fri, 16 Jul 2021 11:53:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBrw0A016189; Fri, 16 Jul 2021 11:53:58 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:53:58 GMT Message-Id: <202107161153.16GBrw0A016189@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: dd1ed4d48787 - stable/12 - pf: Remove unneeded NULL check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: dd1ed4d4878765e2f77f01f2d6f35491221a454a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:53:59 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dd1ed4d4878765e2f77f01f2d6f35491221a454a commit dd1ed4d4878765e2f77f01f2d6f35491221a454a Author: Kristof Provost AuthorDate: 2021-07-05 12:02:06 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 08:04:13 +0000 pf: Remove unneeded NULL check pidx is never NULL, and is used unconditionally later on in the function. Add an assertion, as documentation for the requirement to provide an idx pointer. Reported by: clang --analyze MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20) --- sys/netpfil/pf/pf_table.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index 8dbab5e7bbe1..af7e36c91c08 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -2178,6 +2178,8 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, struct pfr_kentry *ke, *ke2 = NULL; int idx = -1, use_counter = 0; + MPASS(pidx != NULL); + switch (af) { case AF_INET: uaddr.sin.sin_len = sizeof(struct sockaddr_in); @@ -2195,8 +2197,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE)) return (-1); - if (pidx != NULL) - idx = *pidx; + idx = *pidx; if (counter != NULL && idx >= 0) use_counter = 1; if (idx < 0) From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6256666001D; Fri, 16 Jul 2021 11:54:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lq2KGkz4qYJ; Fri, 16 Jul 2021 11:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12D4A1CCC3; Fri, 16 Jul 2021 11:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBrwEP016215; Fri, 16 Jul 2021 11:53:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBrwLw016214; Fri, 16 Jul 2021 11:53:58 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:53:58 GMT Message-Id: <202107161153.16GBrwLw016214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e540d078793b - stable/13 - pf: add DIOCGETSTATESV2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e540d078793bacd4a291b499c96a34e027b13d8a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:00 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e540d078793bacd4a291b499c96a34e027b13d8a commit e540d078793bacd4a291b499c96a34e027b13d8a Author: Kristof Provost AuthorDate: 2021-07-06 10:12:12 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 09:08:27 +0000 pf: add DIOCGETSTATESV2 Add a new version of the DIOCGETSTATES call, which extends the struct to include the original interface information. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31097 (cherry picked from commit c6bf20a2a46dc36bf881ac594454f71379828a9a) --- sys/net/pfvar.h | 73 ++++++++++++++++++++++++++++ sys/netpfil/pf/pf_ioctl.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index df86ce4f92c2..b6a2045473ec 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -517,6 +517,65 @@ struct pf_state_cmp { #define PFSTATE_SETPRIO 0x0200 #define PFSTATE_SETMASK (PFSTATE_SETPRIO) +struct pf_state_scrub_export { + uint16_t pfss_flags; + uint8_t pfss_ttl; /* stashed TTL */ +#define PF_SCRUB_FLAG_VALID 0x01 + uint8_t scrub_flag; + uint32_t pfss_ts_mod; /* timestamp modulation */ +}; + +struct pf_state_key_export { + struct pf_addr addr[2]; + uint16_t port[2]; +}; + +struct pf_state_peer_export { + struct pf_state_scrub_export scrub; /* state is scrubbed */ + uint32_t seqlo; /* Max sequence number sent */ + uint32_t seqhi; /* Max the other end ACKd + win */ + uint32_t seqdiff; /* Sequence number modulator */ + uint16_t max_win; /* largest window (pre scaling) */ + uint16_t mss; /* Maximum segment size option */ + uint8_t state; /* active state level */ + uint8_t wscale; /* window scaling factor */ + uint8_t dummy[6]; +}; +_Static_assert(sizeof(struct pf_state_peer_export) == 32, "size incorrect"); + +struct pf_state_export { + uint64_t version; +#define PF_STATE_VERSION 20210706 + uint64_t id; + char ifname[IFNAMSIZ]; + char orig_ifname[IFNAMSIZ]; + struct pf_state_key_export key[2]; + struct pf_state_peer_export src; + struct pf_state_peer_export dst; + struct pf_addr rt_addr; + uint32_t rule; + uint32_t anchor; + uint32_t nat_rule; + uint32_t creation; + uint32_t expire; + uint32_t spare0; + uint64_t packets[2]; + uint64_t bytes[2]; + uint32_t creatorid; + uint32_t spare1; + sa_family_t af; + uint8_t proto; + uint8_t direction; + uint8_t log; + uint8_t state_flags; + uint8_t timeout; + uint8_t sync_flags; + uint8_t updates; + + uint8_t spare[112]; +}; +_Static_assert(sizeof(struct pf_state_export) == 384, "size incorrect"); + #ifdef _KERNEL struct pf_kstate { u_int64_t id; @@ -643,6 +702,8 @@ extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, struct pf_kstate *); +void pf_state_export(struct pf_state_export *, + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1184,6 +1245,17 @@ struct pfioc_states { #define ps_states ps_u.psu_states }; +struct pfioc_states_v2 { + int ps_len; + uint64_t ps_req_version; + union { + caddr_t psu_buf; + struct pf_state_export *psu_states; + } ps_u; +#define ps_buf ps_u.psu_buf +#define ps_states ps_u.psu_states +}; + struct pfioc_src_nodes { int psn_len; union { @@ -1399,6 +1471,7 @@ struct pfioc_iface { #define DIOCCLRIFFLAG _IOWR('D', 90, struct pfioc_iface) #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) #define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) +#define DIOCGETSTATESV2 _IOWR('D', 93, struct pfioc_states_v2) struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index bed3e8b057d1..24e40c1c716c 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2109,6 +2109,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCNATLOOK: case DIOCSETDEBUG: case DIOCGETSTATES: + case DIOCGETSTATESV2: case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: @@ -2162,6 +2163,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATENV: case DIOCGETSTATUS: case DIOCGETSTATES: + case DIOCGETSTATESV2: case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: @@ -2872,6 +2874,60 @@ DIOCGETSTATES_full: break; } + case DIOCGETSTATESV2: { + struct pfioc_states_v2 *ps = (struct pfioc_states_v2 *)addr; + struct pf_kstate *s; + struct pf_state_export *pstore, *p; + int i, nr; + + if (ps->ps_req_version > PF_STATE_VERSION) { + error = ENOTSUP; + break; + } + + if (ps->ps_len <= 0) { + nr = uma_zone_get_cur(V_pf_state_z); + ps->ps_len = sizeof(struct pf_state_export) * nr; + break; + } + + p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + nr = 0; + + for (i = 0; i <= pf_hashmask; i++) { + struct pf_idhash *ih = &V_pf_idhash[i]; + + if (LIST_EMPTY(&ih->states)) + continue; + + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + + if ((nr+1) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESV2_full; + } + pf_state_export(p, s); + p++; + nr++; + } + PF_HASHROW_UNLOCK(ih); + } +DIOCGETSTATESV2_full: + error = copyout(pstore, ps->ps_states, + sizeof(struct pf_state_export) * nr); + if (error) { + free(pstore, M_TEMP); + break; + } + ps->ps_len = sizeof(struct pf_state_export) * nr; + free(pstore, M_TEMP); + + break; + } + case DIOCGETSTATESNV: { error = pf_getstates((struct pfioc_nv *)addr); break; @@ -4595,7 +4651,70 @@ pfsync_state_export(struct pfsync_state *sp, struct pf_kstate *st) pf_state_counter_hton(st->packets[1], sp->packets[1]); pf_state_counter_hton(st->bytes[0], sp->bytes[0]); pf_state_counter_hton(st->bytes[1], sp->bytes[1]); +} + +void +pf_state_export(struct pf_state_export *sp, struct pf_kstate *st) +{ + bzero(sp, sizeof(*sp)); + + sp->version = PF_STATE_VERSION; + + /* copy from state key */ + sp->key[PF_SK_WIRE].addr[0] = st->key[PF_SK_WIRE]->addr[0]; + sp->key[PF_SK_WIRE].addr[1] = st->key[PF_SK_WIRE]->addr[1]; + sp->key[PF_SK_WIRE].port[0] = st->key[PF_SK_WIRE]->port[0]; + sp->key[PF_SK_WIRE].port[1] = st->key[PF_SK_WIRE]->port[1]; + sp->key[PF_SK_STACK].addr[0] = st->key[PF_SK_STACK]->addr[0]; + sp->key[PF_SK_STACK].addr[1] = st->key[PF_SK_STACK]->addr[1]; + sp->key[PF_SK_STACK].port[0] = st->key[PF_SK_STACK]->port[0]; + sp->key[PF_SK_STACK].port[1] = st->key[PF_SK_STACK]->port[1]; + sp->proto = st->key[PF_SK_WIRE]->proto; + sp->af = st->key[PF_SK_WIRE]->af; + + /* copy from state */ + strlcpy(sp->ifname, st->kif->pfik_name, sizeof(sp->ifname)); + strlcpy(sp->orig_ifname, st->orig_kif->pfik_name, + sizeof(sp->orig_ifname)); + bcopy(&st->rt_addr, &sp->rt_addr, sizeof(sp->rt_addr)); + sp->creation = htonl(time_uptime - st->creation); + sp->expire = pf_state_expires(st); + if (sp->expire <= time_uptime) + sp->expire = htonl(0); + else + sp->expire = htonl(sp->expire - time_uptime); + + sp->direction = st->direction; + sp->log = st->log; + sp->timeout = st->timeout; + sp->state_flags = st->state_flags; + if (st->src_node) + sp->sync_flags |= PFSYNC_FLAG_SRCNODE; + if (st->nat_src_node) + sp->sync_flags |= PFSYNC_FLAG_NATSRCNODE; + + sp->id = st->id; + sp->creatorid = st->creatorid; + pf_state_peer_hton(&st->src, &sp->src); + pf_state_peer_hton(&st->dst, &sp->dst); + + if (st->rule.ptr == NULL) + sp->rule = htonl(-1); + else + sp->rule = htonl(st->rule.ptr->nr); + if (st->anchor.ptr == NULL) + sp->anchor = htonl(-1); + else + sp->anchor = htonl(st->anchor.ptr->nr); + if (st->nat_rule.ptr == NULL) + sp->nat_rule = htonl(-1); + else + sp->nat_rule = htonl(st->nat_rule.ptr->nr); + sp->packets[0] = st->packets[0]; + sp->packets[1] = st->packets[1]; + sp->bytes[0] = st->bytes[0]; + sp->bytes[1] = st->bytes[1]; } static void From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63F4F660392; Fri, 16 Jul 2021 11:54:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lq6m6pz4qhH; Fri, 16 Jul 2021 11:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACDA51C939; Fri, 16 Jul 2021 11:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBrxvp016239; Fri, 16 Jul 2021 11:53:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBrxuD016238; Fri, 16 Jul 2021 11:53:59 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:53:59 GMT Message-Id: <202107161153.16GBrxuD016238@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 073b9f50739a - stable/12 - pf: Handle errors returned by pf_killstates() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 073b9f50739a725d96c1e9a78a747adbad947e97 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:00 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=073b9f50739a725d96c1e9a78a747adbad947e97 commit 073b9f50739a725d96c1e9a78a747adbad947e97 Author: Kristof Provost AuthorDate: 2021-07-05 12:21:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 08:04:13 +0000 pf: Handle errors returned by pf_killstates() Happily this wasn't a real bug, because pf_killstates() never fails, but we should check the return value anyway, in case it does ever start returning errors. Reported by: clang --analyze MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15) --- sys/netpfil/pf/pf_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index eb9719886bbe..242d79053d9c 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -4955,6 +4955,8 @@ pf_killstates_nv(struct pfioc_nv *nv) ERROUT(error); error = pf_killstates(&kill, &killed); + if (error) + ERROUT(error); free(nvlpacked, M_NVLIST); nvlpacked = NULL; From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D90A6660492; Fri, 16 Jul 2021 11:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8ls2HFFz4qhM; Fri, 16 Jul 2021 11:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB80D1C93A; Fri, 16 Jul 2021 11:54:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBs0n1016287; Fri, 16 Jul 2021 11:54:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBs0im016286; Fri, 16 Jul 2021 11:54:00 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:54:00 GMT Message-Id: <202107161154.16GBs0im016286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3965592abaea - stable/12 - pf: pf_killstates() never fails, so remove the return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3965592abaeacbe83adfd5ec2568e5743322a456 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:02 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3965592abaeacbe83adfd5ec2568e5743322a456 commit 3965592abaeacbe83adfd5ec2568e5743322a456 Author: Kristof Provost AuthorDate: 2021-07-08 08:54:16 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 08:04:13 +0000 pf: pf_killstates() never fails, so remove the return value Suggested by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 34641052826c718566b994b75cd2bddb53a21583) --- sys/netpfil/pf/pf_ioctl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 242d79053d9c..338880edf7e9 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -202,7 +202,7 @@ struct cdev *pf_dev; */ static void pf_clear_all_states(void); static unsigned int pf_clear_states(const struct pf_kstate_kill *); -static int pf_killstates(struct pf_kstate_kill *, +static void pf_killstates(struct pf_kstate_kill *, unsigned int *); static int pf_killstates_row(struct pf_kstate_kill *, struct pf_idhash *); @@ -2792,7 +2792,7 @@ DIOCCHANGERULE_error: break; psk->psk_killed = 0; - error = pf_killstates(&kill, &psk->psk_killed); + pf_killstates(&kill, &psk->psk_killed); break; } @@ -4902,7 +4902,7 @@ relock_DIOCCLRSTATES: return (killed); } -static int +static void pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) { struct pf_kstate *s; @@ -4915,13 +4915,13 @@ pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) pf_unlink_state(s, PF_ENTER_LOCKED); *killed = 1; } - return (0); + return; } for (unsigned int i = 0; i <= pf_hashmask; i++) *killed += pf_killstates_row(kill, &V_pf_idhash[i]); - return (0); + return; } static int @@ -4954,9 +4954,7 @@ pf_killstates_nv(struct pfioc_nv *nv) if (error) ERROUT(error); - error = pf_killstates(&kill, &killed); - if (error) - ERROUT(error); + pf_killstates(&kill, &killed); free(nvlpacked, M_NVLIST); nvlpacked = NULL; From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 820B9660503; Fri, 16 Jul 2021 11:54:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8ls64yFz4qqC; Fri, 16 Jul 2021 11:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CE761CB93; Fri, 16 Jul 2021 11:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBs1Tt016311; Fri, 16 Jul 2021 11:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBs1M8016310; Fri, 16 Jul 2021 11:54:01 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:54:01 GMT Message-Id: <202107161154.16GBs1M8016310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 569798e0824a - stable/13 - pf: bound DIOCGETSTATESV2 memory use MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 569798e0824a61f7f5308da4619322110523471b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:02 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=569798e0824a61f7f5308da4619322110523471b commit 569798e0824a61f7f5308da4619322110523471b Author: Kristof Provost AuthorDate: 2021-07-08 13:01:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 09:08:28 +0000 pf: bound DIOCGETSTATESV2 memory use Rather than allocating however much memory userspace asks for we only allocate enough for a handful of states, and copy to userspace for each completed row. We start out with enough space for 16 states (per row), but grow that as required. In most configurations we expect at most a handful of states per row (more than that would have other negative effects on packet processing performance). Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31111 (cherry picked from commit 3fc12ae042040192aa43984106a75663aaa9e0f5) --- sys/netpfil/pf/pf_ioctl.c | 48 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 24e40c1c716c..c9105bf22385 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2879,6 +2879,8 @@ DIOCGETSTATES_full: struct pf_kstate *s; struct pf_state_export *pstore, *p; int i, nr; + size_t slice_count = 16, count; + void *out; if (ps->ps_req_version > PF_STATE_VERSION) { error = ENOTSUP; @@ -2891,38 +2893,60 @@ DIOCGETSTATES_full: break; } - p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + out = ps->ps_states; + pstore = mallocarray(slice_count, + sizeof(struct pf_state_export), M_TEMP, M_WAITOK | M_ZERO); nr = 0; for (i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; +DIOCGETSTATESV2_retry: + p = pstore; + if (LIST_EMPTY(&ih->states)) continue; PF_HASHROW_LOCK(ih); + count = 0; + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + count++; + } + + if (count > slice_count) { + PF_HASHROW_UNLOCK(ih); + free(pstore, M_TEMP); + slice_count = count * 2; + pstore = mallocarray(slice_count, + sizeof(struct pf_state_export), M_TEMP, + M_WAITOK | M_ZERO); + goto DIOCGETSTATESV2_retry; + } + + if ((nr+count) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESV2_full; + } + LIST_FOREACH(s, &ih->states, entry) { if (s->timeout == PFTM_UNLINKED) continue; - if ((nr+1) * sizeof(*p) > ps->ps_len) { - PF_HASHROW_UNLOCK(ih); - goto DIOCGETSTATESV2_full; - } pf_state_export(p, s); p++; nr++; } PF_HASHROW_UNLOCK(ih); + error = copyout(pstore, out, + sizeof(struct pf_state_export) * count); + if (error) + break; + out = ps->ps_states + nr; } DIOCGETSTATESV2_full: - error = copyout(pstore, ps->ps_states, - sizeof(struct pf_state_export) * nr); - if (error) { - free(pstore, M_TEMP); - break; - } - ps->ps_len = sizeof(struct pf_state_export) * nr; + ps->ps_len = nr * sizeof(struct pf_state_export); free(pstore, M_TEMP); break; From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9525A660408; Fri, 16 Jul 2021 11:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lt3WSXz4qYY; Fri, 16 Jul 2021 11:54:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E03281CAA7; Fri, 16 Jul 2021 11:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBs1L4016335; Fri, 16 Jul 2021 11:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBs1r4016334; Fri, 16 Jul 2021 11:54:01 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:54:01 GMT Message-Id: <202107161154.16GBs1r4016334@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 16e4988fb79d - stable/12 - dummynet: reduce console spam MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 16e4988fb79d64cfc7c0dddcac0f1e226d93388b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:04 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=16e4988fb79d64cfc7c0dddcac0f1e226d93388b commit 16e4988fb79d64cfc7c0dddcac0f1e226d93388b Author: Luiz Otavio O Souza AuthorDate: 2016-02-11 13:35:01 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 08:04:13 +0000 dummynet: reduce console spam Only print this warning when boot verbose is enabled. This can get pretty annoying (and useless) in some systems. Reviewed by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit c5dd8bac0b96e11da02181bd1dbee677e270842d) --- sys/netpfil/ipfw/ip_dummynet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index 57565e0d7d23..5a88a803e88d 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -170,7 +170,7 @@ ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg) op = "Clamp"; } else return *v; - if (op && msg) + if (op && msg && bootverbose) printf("%s %s to %d (was %d)\n", op, msg, *v, oldv); return *v; } From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B3F0660586; Fri, 16 Jul 2021 11:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lw56vfz4qfM; Fri, 16 Jul 2021 11:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F6D31C55D; Fri, 16 Jul 2021 11:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBs4vj016438; Fri, 16 Jul 2021 11:54:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBs45o016437; Fri, 16 Jul 2021 11:54:04 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:54:04 GMT Message-Id: <202107161154.16GBs45o016437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: fa3da0e87de7 - stable/12 - libpfctl: migrate to DIOCGETSTATESV2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fa3da0e87de7e9c654881aedd7cf04d417768d50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:06 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fa3da0e87de7e9c654881aedd7cf04d417768d50 commit fa3da0e87de7e9c654881aedd7cf04d417768d50 Author: Kristof Provost AuthorDate: 2021-07-06 11:05:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 08:04:14 +0000 libpfctl: migrate to DIOCGETSTATESV2 Stop using the *NV version to retrieve states, as its performance is unacceptably bad. For 1,000,000 states the nvlist version needed ~100 seconds to retrieve the states, the new version needs ~3 seconds. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31098 (cherry picked from commit be70c7a50d324dd56f3a0d37d8372e7855dd580b) --- lib/libpfctl/libpfctl.c | 196 +++++++++++++++++++----------------------------- 1 file changed, 79 insertions(+), 117 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index bbb53edf8bc1..6421a2c752a8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -637,150 +637,112 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, } static void -pf_nvstate_peer_to_state_peer(const nvlist_t *nvl, - struct pfctl_state_peer *peer) +pf_state_key_export_to_state_key(struct pfctl_state_key *ps, + const struct pf_state_key_export *s) { - bzero(peer, sizeof(*peer)); - - peer->seqlo = nvlist_get_number(nvl, "seqlo"); - peer->seqhi = nvlist_get_number(nvl, "seqhi"); - peer->seqdiff = nvlist_get_number(nvl, "seqdiff"); - peer->state = nvlist_get_number(nvl, "state"); - peer->wscale = nvlist_get_number(nvl, "wscale"); + bcopy(s->addr, ps->addr, sizeof(ps->addr[0]) * 2); + ps->port[0] = s->port[0]; + ps->port[1] = s->port[1]; } static void -pf_nvstate_key_to_state_key(const nvlist_t *nvl, struct pfctl_state_key *key) +pf_state_peer_export_to_state_peer(struct pfctl_state_peer *ps, + const struct pf_state_peer_export *s) { - const nvlist_t * const *tmp; - size_t count; - - bzero(key, sizeof(*key)); - - tmp = nvlist_get_nvlist_array(nvl, "addr", &count); - assert(count == 2); - - for (int i = 0; i < 2; i++) - pf_nvaddr_to_addr(tmp[i], &key->addr[i]); - - pf_nvuint_16_array(nvl, "port", 2, key->port, NULL); - - key->af = nvlist_get_number(nvl, "af"); - key->proto = nvlist_get_number(nvl, "proto"); + /* Ignore scrub. */ + ps->seqlo = s->seqlo; + ps->seqhi = s->seqhi; + ps->seqdiff = s->seqdiff; + /* Ignore max_win & mss */ + ps->state = s->state; + ps->wscale = s->wscale; } static void -pf_nvstate_to_state(const nvlist_t *nvl, struct pfctl_state *s) -{ - bzero(s, sizeof(*s)); - - s->id = nvlist_get_number(nvl, "id"); - s->creatorid = nvlist_get_number(nvl, "creatorid"); - s->direction = nvlist_get_number(nvl, "direction"); - - pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "src"), &s->src); - pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "dst"), &s->dst); - - pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "stack_key"), - &s->key[0]); - pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "wire_key"), - &s->key[1]); - - strlcpy(s->ifname, nvlist_get_string(nvl, "ifname"), - sizeof(s->ifname)); - strlcpy(s->orig_ifname, nvlist_get_string(nvl, "orig_ifname"), - sizeof(s->orig_ifname)); - - pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "rt_addr"), &s->rt_addr); - s->rule = nvlist_get_number(nvl, "rule"); - s->anchor = nvlist_get_number(nvl, "anchor"); - s->nat_rule = nvlist_get_number(nvl, "nat_rule"); - s->creation = nvlist_get_number(nvl, "creation"); - s->expire = nvlist_get_number(nvl, "expire"); - - pf_nvuint_64_array(nvl, "packets", 2, s->packets, NULL); - pf_nvuint_64_array(nvl, "bytes", 2, s->bytes, NULL); - - s->state_flags = nvlist_get_number(nvl, "state_flags"); - s->sync_flags = nvlist_get_number(nvl, "sync_flags"); +pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s) +{ + assert(s->version >= PF_STATE_VERSION); + + ps->id = s->id; + strlcpy(ps->ifname, s->ifname, sizeof(ps->ifname)); + strlcpy(ps->orig_ifname, s->orig_ifname, sizeof(ps->orig_ifname)); + pf_state_key_export_to_state_key(&ps->key[0], &s->key[0]); + pf_state_key_export_to_state_key(&ps->key[1], &s->key[1]); + pf_state_peer_export_to_state_peer(&ps->src, &s->src); + pf_state_peer_export_to_state_peer(&ps->dst, &s->dst); + bcopy(&s->rt_addr, &ps->rt_addr, sizeof(ps->rt_addr)); + ps->rule = s->rule; + ps->anchor = s->anchor; + ps->nat_rule = s->nat_rule; + ps->creation = s->creation; + ps->expire = s->expire; + ps->packets[0] = s->packets[0]; + ps->packets[1] = s->packets[1]; + ps->bytes[0] = s->bytes[0]; + ps->bytes[1] = s->bytes[1]; + ps->creatorid = s->creatorid; + ps->key[0].proto = s->proto; + ps->key[1].proto = s->proto; + ps->key[0].af = s->af; + ps->key[1].af = s->af; + ps->direction = s->direction; + ps->state_flags = s->state_flags; + ps->sync_flags = s->sync_flags; } int pfctl_get_states(int dev, struct pfctl_states *states) { - struct pfioc_nv nv; - nvlist_t *nvl = NULL; - const nvlist_t * const *slist; - size_t found_count; - int error = 0; + struct pfioc_states_v2 ps; + struct pf_state_export *p; + char *inbuf = NULL, *newinbuf = NULL; + unsigned int len = 0; + int i, error; + + bzero(&ps, sizeof(ps)); + ps.ps_req_version = PF_STATE_VERSION; bzero(states, sizeof(*states)); TAILQ_INIT(&states->states); - /* Just enough to get a number, and we'll grow from there. */ - nv.data = malloc(64); - nv.len = nv.size = 64; - for (;;) { - if (ioctl(dev, DIOCGETSTATESNV, &nv)) { - error = errno; - goto out; + ps.ps_len = len; + if (len) { + newinbuf = realloc(inbuf, len); + if (newinbuf == NULL) + return (ENOMEM); + ps.ps_buf = inbuf = newinbuf; } - - nvlist_destroy(nvl); - nvl = nvlist_unpack(nv.data, nv.len, 0); - if (nvl == NULL) { - error = EIO; - goto out; + if ((error = ioctl(dev, DIOCGETSTATESV2, &ps)) < 0) { + free(inbuf); + return (error); } - - states->count = nvlist_get_number(nvl, "count"); - - /* Are there any states? */ - if (states->count == 0) + if (ps.ps_len + sizeof(struct pfioc_states_v2) < len) break; + if (len == 0 && ps.ps_len == 0) + goto out; + if (len == 0 && ps.ps_len != 0) + len = ps.ps_len; + if (ps.ps_len == 0) + goto out; /* no states */ + len *= 2; + } + p = ps.ps_states; - if (nvlist_exists_nvlist_array(nvl, "states")) - slist = nvlist_get_nvlist_array(nvl, "states", &found_count); - else - found_count = 0; - - if (found_count < states->count) { - size_t new_size = nv.size + - (nv.size * states->count / (found_count + 1) * 2); - - /* Our buffer is too small. Estimate what we need based - * on how many states fit in the previous allocation - * and how many states there are. Doubled for margin. - * */ - nv.data = realloc(nv.data, new_size); - nv.size = new_size; - - if (nv.data == NULL) { - error = ENOMEM; - goto out; - } - continue; + for (i = 0; i < ps.ps_len; i += sizeof(*p), p++) { + struct pfctl_state *s = malloc(sizeof(*s)); + if (s == NULL) { + pfctl_free_states(states); + error = ENOMEM; + goto out; } - for (size_t i = 0; i < found_count; i++) { - struct pfctl_state *s = malloc(sizeof(*s)); - if (s == NULL) { - pfctl_free_states(states); - error = ENOMEM; - goto out; - } - - pf_nvstate_to_state(slist[i], s); - TAILQ_INSERT_TAIL(&states->states, s, entry); - } - break; + pf_state_export_to_state(s, p); + TAILQ_INSERT_TAIL(&states->states, s, entry); } out: - nvlist_destroy(nvl); - free(nv.data); - + free(inbuf); return (error); } From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2C3165FDFC; Fri, 16 Jul 2021 11:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8ls1sT2z4qvc; Fri, 16 Jul 2021 11:54:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B88A1C55C; Fri, 16 Jul 2021 11:54:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBs0DK016263; Fri, 16 Jul 2021 11:54:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBs06J016262; Fri, 16 Jul 2021 11:54:00 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:54:00 GMT Message-Id: <202107161154.16GBs06J016262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 25f13f477213 - stable/13 - libpfctl: migrate to DIOCGETSTATESV2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 25f13f47721385b0b1d384929b6e773ca874df0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:02 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=25f13f47721385b0b1d384929b6e773ca874df0b commit 25f13f47721385b0b1d384929b6e773ca874df0b Author: Kristof Provost AuthorDate: 2021-07-06 11:05:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 09:08:27 +0000 libpfctl: migrate to DIOCGETSTATESV2 Stop using the *NV version to retrieve states, as its performance is unacceptably bad. For 1,000,000 states the nvlist version needed ~100 seconds to retrieve the states, the new version needs ~3 seconds. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31098 (cherry picked from commit be70c7a50d324dd56f3a0d37d8372e7855dd580b) --- lib/libpfctl/libpfctl.c | 196 +++++++++++++++++++----------------------------- 1 file changed, 79 insertions(+), 117 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index bbb53edf8bc1..6421a2c752a8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -637,150 +637,112 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, } static void -pf_nvstate_peer_to_state_peer(const nvlist_t *nvl, - struct pfctl_state_peer *peer) +pf_state_key_export_to_state_key(struct pfctl_state_key *ps, + const struct pf_state_key_export *s) { - bzero(peer, sizeof(*peer)); - - peer->seqlo = nvlist_get_number(nvl, "seqlo"); - peer->seqhi = nvlist_get_number(nvl, "seqhi"); - peer->seqdiff = nvlist_get_number(nvl, "seqdiff"); - peer->state = nvlist_get_number(nvl, "state"); - peer->wscale = nvlist_get_number(nvl, "wscale"); + bcopy(s->addr, ps->addr, sizeof(ps->addr[0]) * 2); + ps->port[0] = s->port[0]; + ps->port[1] = s->port[1]; } static void -pf_nvstate_key_to_state_key(const nvlist_t *nvl, struct pfctl_state_key *key) +pf_state_peer_export_to_state_peer(struct pfctl_state_peer *ps, + const struct pf_state_peer_export *s) { - const nvlist_t * const *tmp; - size_t count; - - bzero(key, sizeof(*key)); - - tmp = nvlist_get_nvlist_array(nvl, "addr", &count); - assert(count == 2); - - for (int i = 0; i < 2; i++) - pf_nvaddr_to_addr(tmp[i], &key->addr[i]); - - pf_nvuint_16_array(nvl, "port", 2, key->port, NULL); - - key->af = nvlist_get_number(nvl, "af"); - key->proto = nvlist_get_number(nvl, "proto"); + /* Ignore scrub. */ + ps->seqlo = s->seqlo; + ps->seqhi = s->seqhi; + ps->seqdiff = s->seqdiff; + /* Ignore max_win & mss */ + ps->state = s->state; + ps->wscale = s->wscale; } static void -pf_nvstate_to_state(const nvlist_t *nvl, struct pfctl_state *s) -{ - bzero(s, sizeof(*s)); - - s->id = nvlist_get_number(nvl, "id"); - s->creatorid = nvlist_get_number(nvl, "creatorid"); - s->direction = nvlist_get_number(nvl, "direction"); - - pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "src"), &s->src); - pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "dst"), &s->dst); - - pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "stack_key"), - &s->key[0]); - pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "wire_key"), - &s->key[1]); - - strlcpy(s->ifname, nvlist_get_string(nvl, "ifname"), - sizeof(s->ifname)); - strlcpy(s->orig_ifname, nvlist_get_string(nvl, "orig_ifname"), - sizeof(s->orig_ifname)); - - pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "rt_addr"), &s->rt_addr); - s->rule = nvlist_get_number(nvl, "rule"); - s->anchor = nvlist_get_number(nvl, "anchor"); - s->nat_rule = nvlist_get_number(nvl, "nat_rule"); - s->creation = nvlist_get_number(nvl, "creation"); - s->expire = nvlist_get_number(nvl, "expire"); - - pf_nvuint_64_array(nvl, "packets", 2, s->packets, NULL); - pf_nvuint_64_array(nvl, "bytes", 2, s->bytes, NULL); - - s->state_flags = nvlist_get_number(nvl, "state_flags"); - s->sync_flags = nvlist_get_number(nvl, "sync_flags"); +pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s) +{ + assert(s->version >= PF_STATE_VERSION); + + ps->id = s->id; + strlcpy(ps->ifname, s->ifname, sizeof(ps->ifname)); + strlcpy(ps->orig_ifname, s->orig_ifname, sizeof(ps->orig_ifname)); + pf_state_key_export_to_state_key(&ps->key[0], &s->key[0]); + pf_state_key_export_to_state_key(&ps->key[1], &s->key[1]); + pf_state_peer_export_to_state_peer(&ps->src, &s->src); + pf_state_peer_export_to_state_peer(&ps->dst, &s->dst); + bcopy(&s->rt_addr, &ps->rt_addr, sizeof(ps->rt_addr)); + ps->rule = s->rule; + ps->anchor = s->anchor; + ps->nat_rule = s->nat_rule; + ps->creation = s->creation; + ps->expire = s->expire; + ps->packets[0] = s->packets[0]; + ps->packets[1] = s->packets[1]; + ps->bytes[0] = s->bytes[0]; + ps->bytes[1] = s->bytes[1]; + ps->creatorid = s->creatorid; + ps->key[0].proto = s->proto; + ps->key[1].proto = s->proto; + ps->key[0].af = s->af; + ps->key[1].af = s->af; + ps->direction = s->direction; + ps->state_flags = s->state_flags; + ps->sync_flags = s->sync_flags; } int pfctl_get_states(int dev, struct pfctl_states *states) { - struct pfioc_nv nv; - nvlist_t *nvl = NULL; - const nvlist_t * const *slist; - size_t found_count; - int error = 0; + struct pfioc_states_v2 ps; + struct pf_state_export *p; + char *inbuf = NULL, *newinbuf = NULL; + unsigned int len = 0; + int i, error; + + bzero(&ps, sizeof(ps)); + ps.ps_req_version = PF_STATE_VERSION; bzero(states, sizeof(*states)); TAILQ_INIT(&states->states); - /* Just enough to get a number, and we'll grow from there. */ - nv.data = malloc(64); - nv.len = nv.size = 64; - for (;;) { - if (ioctl(dev, DIOCGETSTATESNV, &nv)) { - error = errno; - goto out; + ps.ps_len = len; + if (len) { + newinbuf = realloc(inbuf, len); + if (newinbuf == NULL) + return (ENOMEM); + ps.ps_buf = inbuf = newinbuf; } - - nvlist_destroy(nvl); - nvl = nvlist_unpack(nv.data, nv.len, 0); - if (nvl == NULL) { - error = EIO; - goto out; + if ((error = ioctl(dev, DIOCGETSTATESV2, &ps)) < 0) { + free(inbuf); + return (error); } - - states->count = nvlist_get_number(nvl, "count"); - - /* Are there any states? */ - if (states->count == 0) + if (ps.ps_len + sizeof(struct pfioc_states_v2) < len) break; + if (len == 0 && ps.ps_len == 0) + goto out; + if (len == 0 && ps.ps_len != 0) + len = ps.ps_len; + if (ps.ps_len == 0) + goto out; /* no states */ + len *= 2; + } + p = ps.ps_states; - if (nvlist_exists_nvlist_array(nvl, "states")) - slist = nvlist_get_nvlist_array(nvl, "states", &found_count); - else - found_count = 0; - - if (found_count < states->count) { - size_t new_size = nv.size + - (nv.size * states->count / (found_count + 1) * 2); - - /* Our buffer is too small. Estimate what we need based - * on how many states fit in the previous allocation - * and how many states there are. Doubled for margin. - * */ - nv.data = realloc(nv.data, new_size); - nv.size = new_size; - - if (nv.data == NULL) { - error = ENOMEM; - goto out; - } - continue; + for (i = 0; i < ps.ps_len; i += sizeof(*p), p++) { + struct pfctl_state *s = malloc(sizeof(*s)); + if (s == NULL) { + pfctl_free_states(states); + error = ENOMEM; + goto out; } - for (size_t i = 0; i < found_count; i++) { - struct pfctl_state *s = malloc(sizeof(*s)); - if (s == NULL) { - pfctl_free_states(states); - error = ENOMEM; - goto out; - } - - pf_nvstate_to_state(slist[i], s); - TAILQ_INSERT_TAIL(&states->states, s, entry); - } - break; + pf_state_export_to_state(s, p); + TAILQ_INSERT_TAIL(&states->states, s, entry); } out: - nvlist_destroy(nvl); - free(nv.data); - + free(inbuf); return (error); } From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A58C566040A; Fri, 16 Jul 2021 11:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lw0KB6z4qYh; Fri, 16 Jul 2021 11:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 092F31CAA8; Fri, 16 Jul 2021 11:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBs2DJ016412; Fri, 16 Jul 2021 11:54:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBs2Bf016411; Fri, 16 Jul 2021 11:54:02 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:54:02 GMT Message-Id: <202107161154.16GBs2Bf016411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e8b98712d706 - stable/12 - pf: add DIOCGETSTATESV2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e8b98712d70675e48c84f31a4f108cba803c3a6c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:05 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e8b98712d70675e48c84f31a4f108cba803c3a6c commit e8b98712d70675e48c84f31a4f108cba803c3a6c Author: Kristof Provost AuthorDate: 2021-07-06 10:12:12 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 08:04:14 +0000 pf: add DIOCGETSTATESV2 Add a new version of the DIOCGETSTATES call, which extends the struct to include the original interface information. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31097 (cherry picked from commit c6bf20a2a46dc36bf881ac594454f71379828a9a) --- sys/net/pfvar.h | 73 ++++++++++++++++++++++++++++ sys/netpfil/pf/pf_ioctl.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b2c4231f29cc..dc9647f86c0b 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -517,6 +517,65 @@ struct pf_state_cmp { #define PFSTATE_SETPRIO 0x0200 #define PFSTATE_SETMASK (PFSTATE_SETPRIO) +struct pf_state_scrub_export { + uint16_t pfss_flags; + uint8_t pfss_ttl; /* stashed TTL */ +#define PF_SCRUB_FLAG_VALID 0x01 + uint8_t scrub_flag; + uint32_t pfss_ts_mod; /* timestamp modulation */ +}; + +struct pf_state_key_export { + struct pf_addr addr[2]; + uint16_t port[2]; +}; + +struct pf_state_peer_export { + struct pf_state_scrub_export scrub; /* state is scrubbed */ + uint32_t seqlo; /* Max sequence number sent */ + uint32_t seqhi; /* Max the other end ACKd + win */ + uint32_t seqdiff; /* Sequence number modulator */ + uint16_t max_win; /* largest window (pre scaling) */ + uint16_t mss; /* Maximum segment size option */ + uint8_t state; /* active state level */ + uint8_t wscale; /* window scaling factor */ + uint8_t dummy[6]; +}; +_Static_assert(sizeof(struct pf_state_peer_export) == 32, "size incorrect"); + +struct pf_state_export { + uint64_t version; +#define PF_STATE_VERSION 20210706 + uint64_t id; + char ifname[IFNAMSIZ]; + char orig_ifname[IFNAMSIZ]; + struct pf_state_key_export key[2]; + struct pf_state_peer_export src; + struct pf_state_peer_export dst; + struct pf_addr rt_addr; + uint32_t rule; + uint32_t anchor; + uint32_t nat_rule; + uint32_t creation; + uint32_t expire; + uint32_t spare0; + uint64_t packets[2]; + uint64_t bytes[2]; + uint32_t creatorid; + uint32_t spare1; + sa_family_t af; + uint8_t proto; + uint8_t direction; + uint8_t log; + uint8_t state_flags; + uint8_t timeout; + uint8_t sync_flags; + uint8_t updates; + + uint8_t spare[112]; +}; +_Static_assert(sizeof(struct pf_state_export) == 384, "size incorrect"); + #ifdef _KERNEL struct pf_kstate { u_int64_t id; @@ -643,6 +702,8 @@ extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, struct pf_kstate *); +void pf_state_export(struct pf_state_export *, + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1184,6 +1245,17 @@ struct pfioc_states { #define ps_states ps_u.psu_states }; +struct pfioc_states_v2 { + int ps_len; + uint64_t ps_req_version; + union { + caddr_t psu_buf; + struct pf_state_export *psu_states; + } ps_u; +#define ps_buf ps_u.psu_buf +#define ps_states ps_u.psu_states +}; + struct pfioc_src_nodes { int psn_len; union { @@ -1400,6 +1472,7 @@ struct pfioc_iface { #define DIOCCLRIFFLAG _IOWR('D', 90, struct pfioc_iface) #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) #define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) +#define DIOCGETSTATESV2 _IOWR('D', 93, struct pfioc_states_v2) struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 338880edf7e9..c8d7805b3fce 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2110,6 +2110,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCNATLOOK: case DIOCSETDEBUG: case DIOCGETSTATES: + case DIOCGETSTATESV2: case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: @@ -2163,6 +2164,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATENV: case DIOCGETSTATUS: case DIOCGETSTATES: + case DIOCGETSTATESV2: case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: @@ -2885,6 +2887,60 @@ DIOCGETSTATES_full: break; } + case DIOCGETSTATESV2: { + struct pfioc_states_v2 *ps = (struct pfioc_states_v2 *)addr; + struct pf_kstate *s; + struct pf_state_export *pstore, *p; + int i, nr; + + if (ps->ps_req_version > PF_STATE_VERSION) { + error = ENOTSUP; + break; + } + + if (ps->ps_len <= 0) { + nr = uma_zone_get_cur(V_pf_state_z); + ps->ps_len = sizeof(struct pf_state_export) * nr; + break; + } + + p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + nr = 0; + + for (i = 0; i <= pf_hashmask; i++) { + struct pf_idhash *ih = &V_pf_idhash[i]; + + if (LIST_EMPTY(&ih->states)) + continue; + + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + + if ((nr+1) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESV2_full; + } + pf_state_export(p, s); + p++; + nr++; + } + PF_HASHROW_UNLOCK(ih); + } +DIOCGETSTATESV2_full: + error = copyout(pstore, ps->ps_states, + sizeof(struct pf_state_export) * nr); + if (error) { + free(pstore, M_TEMP); + break; + } + ps->ps_len = sizeof(struct pf_state_export) * nr; + free(pstore, M_TEMP); + + break; + } + case DIOCGETSTATESNV: { error = pf_getstates((struct pfioc_nv *)addr); break; @@ -4662,7 +4718,70 @@ pfsync_state_export(struct pfsync_state *sp, struct pf_kstate *st) pf_state_counter_hton(st->packets[1], sp->packets[1]); pf_state_counter_hton(st->bytes[0], sp->bytes[0]); pf_state_counter_hton(st->bytes[1], sp->bytes[1]); +} + +void +pf_state_export(struct pf_state_export *sp, struct pf_kstate *st) +{ + bzero(sp, sizeof(*sp)); + + sp->version = PF_STATE_VERSION; + + /* copy from state key */ + sp->key[PF_SK_WIRE].addr[0] = st->key[PF_SK_WIRE]->addr[0]; + sp->key[PF_SK_WIRE].addr[1] = st->key[PF_SK_WIRE]->addr[1]; + sp->key[PF_SK_WIRE].port[0] = st->key[PF_SK_WIRE]->port[0]; + sp->key[PF_SK_WIRE].port[1] = st->key[PF_SK_WIRE]->port[1]; + sp->key[PF_SK_STACK].addr[0] = st->key[PF_SK_STACK]->addr[0]; + sp->key[PF_SK_STACK].addr[1] = st->key[PF_SK_STACK]->addr[1]; + sp->key[PF_SK_STACK].port[0] = st->key[PF_SK_STACK]->port[0]; + sp->key[PF_SK_STACK].port[1] = st->key[PF_SK_STACK]->port[1]; + sp->proto = st->key[PF_SK_WIRE]->proto; + sp->af = st->key[PF_SK_WIRE]->af; + + /* copy from state */ + strlcpy(sp->ifname, st->kif->pfik_name, sizeof(sp->ifname)); + strlcpy(sp->orig_ifname, st->orig_kif->pfik_name, + sizeof(sp->orig_ifname)); + bcopy(&st->rt_addr, &sp->rt_addr, sizeof(sp->rt_addr)); + sp->creation = htonl(time_uptime - st->creation); + sp->expire = pf_state_expires(st); + if (sp->expire <= time_uptime) + sp->expire = htonl(0); + else + sp->expire = htonl(sp->expire - time_uptime); + + sp->direction = st->direction; + sp->log = st->log; + sp->timeout = st->timeout; + sp->state_flags = st->state_flags; + if (st->src_node) + sp->sync_flags |= PFSYNC_FLAG_SRCNODE; + if (st->nat_src_node) + sp->sync_flags |= PFSYNC_FLAG_NATSRCNODE; + + sp->id = st->id; + sp->creatorid = st->creatorid; + pf_state_peer_hton(&st->src, &sp->src); + pf_state_peer_hton(&st->dst, &sp->dst); + + if (st->rule.ptr == NULL) + sp->rule = htonl(-1); + else + sp->rule = htonl(st->rule.ptr->nr); + if (st->anchor.ptr == NULL) + sp->anchor = htonl(-1); + else + sp->anchor = htonl(st->anchor.ptr->nr); + if (st->nat_rule.ptr == NULL) + sp->nat_rule = htonl(-1); + else + sp->nat_rule = htonl(st->nat_rule.ptr->nr); + sp->packets[0] = st->packets[0]; + sp->packets[1] = st->packets[1]; + sp->bytes[0] = st->bytes[0]; + sp->bytes[1] = st->bytes[1]; } static void From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 11:54:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D88A06603A4; Fri, 16 Jul 2021 11:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR8lx4hZTz4qbR; Fri, 16 Jul 2021 11:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 542661CA46; Fri, 16 Jul 2021 11:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GBs5YL016467; Fri, 16 Jul 2021 11:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GBs585016466; Fri, 16 Jul 2021 11:54:05 GMT (envelope-from git) Date: Fri, 16 Jul 2021 11:54:05 GMT Message-Id: <202107161154.16GBs585016466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4feb5667f59d - stable/12 - pf: bound DIOCGETSTATESV2 memory use MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4feb5667f59d7542395b021d1852e792b4baf90a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 11:54:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4feb5667f59d7542395b021d1852e792b4baf90a commit 4feb5667f59d7542395b021d1852e792b4baf90a Author: Kristof Provost AuthorDate: 2021-07-08 13:01:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-16 08:04:14 +0000 pf: bound DIOCGETSTATESV2 memory use Rather than allocating however much memory userspace asks for we only allocate enough for a handful of states, and copy to userspace for each completed row. We start out with enough space for 16 states (per row), but grow that as required. In most configurations we expect at most a handful of states per row (more than that would have other negative effects on packet processing performance). Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31111 (cherry picked from commit 3fc12ae042040192aa43984106a75663aaa9e0f5) --- sys/netpfil/pf/pf_ioctl.c | 48 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c8d7805b3fce..74f347ac1fa6 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2892,6 +2892,8 @@ DIOCGETSTATES_full: struct pf_kstate *s; struct pf_state_export *pstore, *p; int i, nr; + size_t slice_count = 16, count; + void *out; if (ps->ps_req_version > PF_STATE_VERSION) { error = ENOTSUP; @@ -2904,38 +2906,60 @@ DIOCGETSTATES_full: break; } - p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + out = ps->ps_states; + pstore = mallocarray(slice_count, + sizeof(struct pf_state_export), M_TEMP, M_WAITOK | M_ZERO); nr = 0; for (i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; +DIOCGETSTATESV2_retry: + p = pstore; + if (LIST_EMPTY(&ih->states)) continue; PF_HASHROW_LOCK(ih); + count = 0; + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + count++; + } + + if (count > slice_count) { + PF_HASHROW_UNLOCK(ih); + free(pstore, M_TEMP); + slice_count = count * 2; + pstore = mallocarray(slice_count, + sizeof(struct pf_state_export), M_TEMP, + M_WAITOK | M_ZERO); + goto DIOCGETSTATESV2_retry; + } + + if ((nr+count) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESV2_full; + } + LIST_FOREACH(s, &ih->states, entry) { if (s->timeout == PFTM_UNLINKED) continue; - if ((nr+1) * sizeof(*p) > ps->ps_len) { - PF_HASHROW_UNLOCK(ih); - goto DIOCGETSTATESV2_full; - } pf_state_export(p, s); p++; nr++; } PF_HASHROW_UNLOCK(ih); + error = copyout(pstore, out, + sizeof(struct pf_state_export) * count); + if (error) + break; + out = ps->ps_states + nr; } DIOCGETSTATESV2_full: - error = copyout(pstore, ps->ps_states, - sizeof(struct pf_state_export) * nr); - if (error) { - free(pstore, M_TEMP); - break; - } - ps->ps_len = sizeof(struct pf_state_export) * nr; + ps->ps_len = nr * sizeof(struct pf_state_export); free(pstore, M_TEMP); break; From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 17:46:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 086736651B5; Fri, 16 Jul 2021 17:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRJZq47nZz3msR; Fri, 16 Jul 2021 17:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76D4C2156D; Fri, 16 Jul 2021 17:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GHkhEm082019; Fri, 16 Jul 2021 17:46:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GHkhMt082018; Fri, 16 Jul 2021 17:46:43 GMT (envelope-from git) Date: Fri, 16 Jul 2021 17:46:43 GMT Message-Id: <202107161746.16GHkhMt082018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 819999651131 - stable/12 - sbuf(9): Add NOWAIT dynamic buffer extension mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 81999965113107eb9cecc217a4f496dd78c1ca3a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 17:46:44 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=81999965113107eb9cecc217a4f496dd78c1ca3a commit 81999965113107eb9cecc217a4f496dd78c1ca3a Author: Conrad Meyer AuthorDate: 2019-08-07 19:23:07 +0000 Commit: Warner Losh CommitDate: 2021-07-16 17:43:55 +0000 sbuf(9): Add NOWAIT dynamic buffer extension mode The goal is to avoid some kinds of low-memory deadlock when formatting heap-allocated buffers. Reviewed by: vangyzen Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D21015 (cherry picked from commit 71db411eb627601a5f9a3464f88d75741927ce60) --- share/man/man9/sbuf.9 | 11 +++++++++-- sys/kern/subr_sbuf.c | 16 +++++++++------- sys/sys/sbuf.h | 1 + 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9 index 519e801e4868..4184f77631a7 100644 --- a/share/man/man9/sbuf.9 +++ b/share/man/man9/sbuf.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 26, 2020 +.Dd July 12, 2021 .Dt SBUF 9 .Os .Sh NAME @@ -278,7 +278,14 @@ as a record boundary marker that will be used during drain operations to avoid records being split. If a record grows sufficiently large such that it fills the .Fa sbuf -and therefore cannot be drained without being split, an error of EDEADLK is set. +and therefore cannot be drained without being split, an error of +.Er EDEADLK +is set. +.It Dv SBUF_NOWAIT +Indicates that attempts to extend the storage buffer should fail in low memory +conditions, like +.Xr malloc 9 +.Dv M_NOWAIT . .El .Pp Note that if diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index 03f7b1e94c51..4a046cc41787 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -56,11 +56,11 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); -#define SBMALLOC(size) malloc(size, M_SBUF, M_WAITOK|M_ZERO) +#define SBMALLOC(size, flags) malloc(size, M_SBUF, (flags) | M_ZERO) #define SBFREE(buf) free(buf, M_SBUF) #else /* _KERNEL */ #define KASSERT(e, m) -#define SBMALLOC(size) calloc(1, size) +#define SBMALLOC(size, flags) calloc(1, size) #define SBFREE(buf) free(buf) #endif /* _KERNEL */ @@ -77,6 +77,8 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); #define SBUF_NULINCLUDED(s) ((s)->s_flags & SBUF_INCLUDENUL) #define SBUF_ISDRAINTOEOR(s) ((s)->s_flags & SBUF_DRAINTOEOR) #define SBUF_DODRAINTOEOR(s) (SBUF_ISSECTION(s) && SBUF_ISDRAINTOEOR(s)) +#define SBUF_MALLOCFLAG(s) \ + (((s)->s_flags & SBUF_NOWAIT) ? M_NOWAIT : M_WAITOK) /* * Set / clear flags @@ -171,7 +173,7 @@ sbuf_extend(struct sbuf *s, int addlen) if (!SBUF_CANEXTEND(s)) return (-1); newsize = sbuf_extendsize(s->s_size + addlen); - newbuf = SBMALLOC(newsize); + newbuf = SBMALLOC(newsize, SBUF_MALLOCFLAG(s)); if (newbuf == NULL) return (-1); memcpy(newbuf, s->s_buf, s->s_size); @@ -198,7 +200,7 @@ sbuf_newbuf(struct sbuf *s, char *buf, int length, int flags) s->s_size = length; s->s_buf = buf; - if ((s->s_flags & SBUF_AUTOEXTEND) == 0) { + if (!SBUF_CANEXTEND(s)) { KASSERT(s->s_size >= SBUF_MINSIZE, ("attempt to create an sbuf smaller than %d bytes", SBUF_MINSIZE)); @@ -207,10 +209,10 @@ sbuf_newbuf(struct sbuf *s, char *buf, int length, int flags) if (s->s_buf != NULL) return (s); - if ((flags & SBUF_AUTOEXTEND) != 0) + if (SBUF_CANEXTEND(s)) s->s_size = sbuf_extendsize(s->s_size); - s->s_buf = SBMALLOC(s->s_size); + s->s_buf = SBMALLOC(s->s_size, SBUF_MALLOCFLAG(s)); if (s->s_buf == NULL) return (NULL); SBUF_SETFLAG(s, SBUF_DYNAMIC); @@ -235,7 +237,7 @@ sbuf_new(struct sbuf *s, char *buf, int length, int flags) if (s != NULL) return (sbuf_newbuf(s, buf, length, flags)); - s = SBMALLOC(sizeof(*s)); + s = SBMALLOC(sizeof(*s), (flags & SBUF_NOWAIT) ? M_NOWAIT : M_WAITOK); if (s == NULL) return (NULL); if (sbuf_newbuf(s, buf, length, flags) == NULL) { diff --git a/sys/sys/sbuf.h b/sys/sys/sbuf.h index 1927996c8f38..9ef9bad7d9be 100644 --- a/sys/sys/sbuf.h +++ b/sys/sys/sbuf.h @@ -52,6 +52,7 @@ struct sbuf { #define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ #define SBUF_INCLUDENUL 0x00000002 /* nulterm byte is counted in len */ #define SBUF_DRAINTOEOR 0x00000004 /* use section 0 as drain EOR marker */ +#define SBUF_NOWAIT 0x00000008 /* Extend with non-blocking malloc */ #define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ #define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ #define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 17:46:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA714665160; Fri, 16 Jul 2021 17:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRJZr58Wmz3n06; Fri, 16 Jul 2021 17:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95D3F21451; Fri, 16 Jul 2021 17:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GHkiuP082050; Fri, 16 Jul 2021 17:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GHkivt082049; Fri, 16 Jul 2021 17:46:44 GMT (envelope-from git) Date: Fri, 16 Jul 2021 17:46:44 GMT Message-Id: <202107161746.16GHkivt082049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a61ff2574c19 - stable/12 - config_intrhook: provide config_intrhook_drain MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a61ff2574c19c16800db29957e103f96a85554af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 17:46:44 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a61ff2574c19c16800db29957e103f96a85554af commit a61ff2574c19c16800db29957e103f96a85554af Author: Warner Losh AuthorDate: 2021-03-11 15:42:09 +0000 Commit: Warner Losh CommitDate: 2021-07-16 17:43:55 +0000 config_intrhook: provide config_intrhook_drain config_intrhook_drain will remove the hook from the list as config_intrhook_disestablish does if the hook hasn't been called. If it has, config_intrhook_drain will wait for the hook to be disestablished in the normal course (or expedited, it's up to the driver to decide how and when to call config_intrhook_disestablish). This is intended for removable devices that use config_intrhook and might be attached early in boot, but that may be removed before the kernel can call the config_intrhook or before it ends. To prevent all races, the detach routine will need to call config_intrhook_train. Sponsored by: Netflix, Inc Reviewed by: jhb, mav, gde (in D29006 for man page) Differential Revision: https://reviews.freebsd.org/D29005 (cherry picked from commit e52368365db3c0a696b37bfc09d08b7093b41b57) --- share/man/man9/Makefile | 1 + share/man/man9/config_intrhook.9 | 21 ++++++++++++++++- sys/kern/subr_autoconf.c | 50 +++++++++++++++++++++++++++++++++++++--- sys/sys/kernel.h | 5 ++++ 4 files changed, 73 insertions(+), 4 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 8acf44f3dbeb..7a4fc64f5f88 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -814,6 +814,7 @@ MLINKS+=condvar.9 cv_broadcast.9 \ condvar.9 cv_wait_unlock.9 \ condvar.9 cv_wmesg.9 MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \ + config_intrhook.9 config_intrhook_drain.9 \ config_intrhook.9 config_intrhook_establish.9 \ config_intrhook.9 config_intrhook_oneshot.9 MLINKS+=contigmalloc.9 contigmalloc_domainset.9 \ diff --git a/share/man/man9/config_intrhook.9 b/share/man/man9/config_intrhook.9 index c92136fa076f..ab584f53773d 100644 --- a/share/man/man9/config_intrhook.9 +++ b/share/man/man9/config_intrhook.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 10, 2017 +.Dd March 8, 2021 .Dt CONFIG_INTRHOOK 9 .Os .Sh NAME @@ -40,6 +40,8 @@ but before root is mounted .Fn config_intrhook_establish "struct intr_config_hook *hook" .Ft void .Fn config_intrhook_disestablish "struct intr_config_hook *hook" +.Ft int +.Fn config_intrhook_drain "struct intr_config_hook *hook" .Ft void .Fn config_intrhook_oneshot "ich_func_t func" "void *arg" .Sh DESCRIPTION @@ -55,6 +57,23 @@ The function removes the entry from the hook queue. .Pp The +.Fn config_intrhook_drain +function removes the entry from the hook queue in a safe way. +If the hook is not currently active it removes +.Fa hook +from the hook queue and returns +.Vt ICHS_QUEUED . +If the hook is active, it waits for the hook to complete before returning +.Vt ICHS_RUNNING . +If the hook has previously completed, it returns +.Vt ICHS_DONE . +Because a +.Vt config_intrhook +is undefined prior to +.Fn config_intrhook_establish , +this function may only be called after that function has returned. +.Pp +The .Fn config_intrhook_oneshot function schedules a function to be run as described for .Fn config_intrhook_establish ; diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index 6a998a533801..77c48485e1da 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -138,6 +138,7 @@ run_interrupt_driven_config_hooks() while (next_to_notify != NULL) { hook_entry = next_to_notify; next_to_notify = TAILQ_NEXT(hook_entry, ich_links); + hook_entry->ich_state = ICHS_RUNNING; mtx_unlock(&intr_config_hook_lock); (*hook_entry->ich_func)(hook_entry->ich_arg); mtx_lock(&intr_config_hook_lock); @@ -199,6 +200,7 @@ config_intrhook_establish(struct intr_config_hook *hook) TAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links); if (next_to_notify == NULL) next_to_notify = hook; + hook->ich_state = ICHS_QUEUED; mtx_unlock(&intr_config_hook_lock); if (cold == 0) /* @@ -226,12 +228,11 @@ config_intrhook_oneshot(ich_func_t func, void *arg) config_intrhook_establish(&ohook->och_hook); } -void -config_intrhook_disestablish(struct intr_config_hook *hook) +static void +config_intrhook_disestablish_locked(struct intr_config_hook *hook) { struct intr_config_hook *hook_entry; - mtx_lock(&intr_config_hook_lock); TAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) if (hook_entry == hook) break; @@ -245,8 +246,51 @@ config_intrhook_disestablish(struct intr_config_hook *hook) TSRELEASE("config hooks"); /* Wakeup anyone watching the list */ + hook->ich_state = ICHS_DONE; wakeup(&intr_config_hook_list); +} + +void +config_intrhook_disestablish(struct intr_config_hook *hook) +{ + mtx_lock(&intr_config_hook_lock); + config_intrhook_disestablish_locked(hook); + mtx_unlock(&intr_config_hook_lock); +} + +int +config_intrhook_drain(struct intr_config_hook *hook) +{ + mtx_lock(&intr_config_hook_lock); + + /* + * The config hook has completed, so just return. + */ + if (hook->ich_state == ICHS_DONE) { + mtx_unlock(&intr_config_hook_lock); + return (ICHS_DONE); + } + + /* + * The config hook hasn't started running, just call disestablish. + */ + if (hook->ich_state == ICHS_QUEUED) { + config_intrhook_disestablish_locked(hook); + mtx_unlock(&intr_config_hook_lock); + return (ICHS_QUEUED); + } + + /* + * The config hook is running, so wait for it to complete and return. + */ + while (hook->ich_state != ICHS_DONE) { + if (msleep(&intr_config_hook_list, &intr_config_hook_lock, + 0, "confhd", hz) == EWOULDBLOCK) { + // XXX do I whine? + } + } mtx_unlock(&intr_config_hook_lock); + return (ICHS_RUNNING); } #ifdef DDB diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 0a1cb890b94f..ab9574192797 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -445,12 +445,17 @@ typedef void (*ich_func_t)(void *_arg); struct intr_config_hook { TAILQ_ENTRY(intr_config_hook) ich_links; + uintptr_t ich_state; +#define ICHS_QUEUED 0x1 +#define ICHS_RUNNING 0x2 +#define ICHS_DONE 0x3 ich_func_t ich_func; void *ich_arg; }; int config_intrhook_establish(struct intr_config_hook *hook); void config_intrhook_disestablish(struct intr_config_hook *hook); +int config_intrhook_drain(struct intr_config_hook *hook); void config_intrhook_oneshot(ich_func_t _func, void *_arg); #endif /* !_SYS_KERNEL_H_*/ From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 17:46:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28BF86650D6; Fri, 16 Jul 2021 17:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRJZs6Bzvz3n4f; Fri, 16 Jul 2021 17:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8FEA2159F; Fri, 16 Jul 2021 17:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GHkjki082074; Fri, 16 Jul 2021 17:46:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GHkjZA082073; Fri, 16 Jul 2021 17:46:45 GMT (envelope-from git) Date: Fri, 16 Jul 2021 17:46:45 GMT Message-Id: <202107161746.16GHkjZA082073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 5df3b843fe31 - stable/12 - devmatch: improve naming of devmatch config variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5df3b843fe3185bb04fda94e2a06231a31d6253a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 17:46:46 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5df3b843fe3185bb04fda94e2a06231a31d6253a commit 5df3b843fe3185bb04fda94e2a06231a31d6253a Author: Ceri Davies AuthorDate: 2021-06-18 12:17:30 +0000 Commit: Warner Losh CommitDate: 2021-07-16 17:45:11 +0000 devmatch: improve naming of devmatch config variable Accept the old rc.conf variable if the new one is not present for compatability. Approved by: imp Differential Revision: https://reviews.freebsd.org/D30806 --- libexec/rc/rc.conf | 2 +- libexec/rc/rc.d/devmatch | 4 ++-- share/man/man5/rc.conf.5 | 10 +++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 63f4cb425a59..bd2fd5eeae2a 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -42,7 +42,7 @@ ddb_config="/etc/ddb.conf" # ddb(8) config file. devd_enable="YES" # Run devd, to trigger programs on device tree changes. devd_flags="" # Additional flags for devd(8). devmatch_enable="YES" # Demand load kernel modules based on device ids. -devmatch_blacklist="" # List of modules (w/o .ko) to exclude from devmatch. +devmatch_blocklist="" # List of modules (w/o .ko) to exclude from devmatch. #kld_list="" # Kernel modules to load after local disks are mounted kldxref_enable="YES" # Build linker.hints files with kldxref(8). kldxref_clobber="NO" # Overwrite old linker.hints at boot. diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index a5f91727d547..f1c8a2bd59f9 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -59,9 +59,9 @@ devmatch_start() # or drivers that have symbolic links that # confuse devmatch by running it -n. # Finally, we filter out all items in the - # devmactch_blacklist. + # devmatch_blocklist. devctl freeze - x=$(echo ${devmatch_blacklist} | tr ' ' '#') + x=$(echo ${devmatch_blocklist:-${devmatch_blacklist}} | tr ' ' '#') for m in ${list}; do case "#${x}#" in *"#${m}#"*) continue ;; diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index fdb48845da26..458d93e2f532 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 10, 2021 +.Dd July 8, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -252,8 +252,16 @@ If set to .Dq Li NO , disable auto-loading of kernel modules with .Xr devmatch 8 . +.It Va devmatch_blocklist +.Pq Vt str +A whitespace-separated list of kernel modules to be ignored by +.Xr devmatch 8 . .It Va devmatch_blacklist .Pq Vt str +This variable is deprecated. +Use +.Va devmatch_blocklist +instead. A whitespace-separated list of kernel modules to be ignored by .Xr devmatch 8 . .It Va kld_list From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 17:46:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 433C56651B9; Fri, 16 Jul 2021 17:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRJZv0Pcvz3msY; Fri, 16 Jul 2021 17:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAD11215A0; Fri, 16 Jul 2021 17:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GHkkwH082098; Fri, 16 Jul 2021 17:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GHkkHj082097; Fri, 16 Jul 2021 17:46:46 GMT (envelope-from git) Date: Fri, 16 Jul 2021 17:46:46 GMT Message-Id: <202107161746.16GHkkHj082097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: bd14c0c6cdaf - stable/12 - devmatch: defer until after kld MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bd14c0c6cdaf14fdebdf517bf161d60b3b43fa21 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 17:46:47 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bd14c0c6cdaf14fdebdf517bf161d60b3b43fa21 commit bd14c0c6cdaf14fdebdf517bf161d60b3b43fa21 Author: Helge Oldach AuthorDate: 2021-07-07 20:43:35 +0000 Commit: Warner Losh CommitDate: 2021-07-16 17:45:11 +0000 devmatch: defer until after kld devmatch loads a number of things automatically. Allow the list of things to load to happen first in case those drivers affect what would be loaded. Normally, this will produce the same results, but there's some special cases that may not when drivers are loaded that report other drivers missing, like virtio_pci. PR: 253287 Reviewed by: imp MFC After: 2 weeks --- libexec/rc/rc.d/devmatch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index f1c8a2bd59f9..e45683decab7 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -26,7 +26,7 @@ # $FreeBSD$ # # PROVIDE: devmatch -# REQUIRE: kldxref +# REQUIRE: kld # BEFORE: netif # KEYWORD: nojail From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 17:46:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5EA46651BA; Fri, 16 Jul 2021 17:46:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRJZw1C8Vz3mlj; Fri, 16 Jul 2021 17:46:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F9C0215A1; Fri, 16 Jul 2021 17:46:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GHklxl082122; Fri, 16 Jul 2021 17:46:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GHklLo082121; Fri, 16 Jul 2021 17:46:47 GMT (envelope-from git) Date: Fri, 16 Jul 2021 17:46:47 GMT Message-Id: <202107161746.16GHklLo082121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 3b125a8b3174 - stable/12 - devmatch: Be tolerant of .ko being present. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3b125a8b3174e4efa2e98d02dfbba4e3ae9e52d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 17:46:49 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3b125a8b3174e4efa2e98d02dfbba4e3ae9e52d5 commit 3b125a8b3174e4efa2e98d02dfbba4e3ae9e52d5 Author: Warner Losh AuthorDate: 2021-07-08 19:44:21 +0000 Commit: Warner Losh CommitDate: 2021-07-16 17:45:11 +0000 devmatch: Be tolerant of .ko being present. We document that we did not need .ko on the module names in devmatch_blocklist, but we really needed them. Keep the documentation the same, but strip the .ko when we need to use the names so you can specify either. PR: 256240 MFC After: 2 weeks Sponsored by: Netflix --- libexec/rc/rc.d/devmatch | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index e45683decab7..d48661ca9e15 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -52,18 +52,23 @@ devmatch_start() [ -n "$list" ] || return - # While kldload can accept multiple modules - # on the line at once, we loop here in case - # there's some weird error with one of them. - # We also optimize against the false positives - # or drivers that have symbolic links that - # confuse devmatch by running it -n. - # Finally, we filter out all items in the - # devmatch_blocklist. + # While kldload can accept multiple modules on the line at once, we loop + # here in case there's some weird error with one of them. We also + # optimize against the false positives or drivers that have symbolic + # links that confuse devmatch by running it -n. Finally, we filter out + # all items in the devmatch_blocklist. + # + # We strip all the .ko suffixes off so that one may specify modules + # with or without .ko. Prior version documented it was without, while + # the code required it, so accept both now. devmatch produces module + # names with .ko + devctl freeze - x=$(echo ${devmatch_blocklist:-${devmatch_blacklist}} | tr ' ' '#') + x=$(echo '#'${devmatch_blocklist:-${devmatch_blacklist}}'#' | \ + sed -e "s/ /#/g;s/\.ko#/#/g") for m in ${list}; do - case "#${x}#" in + m="${m%.ko}" + case "${x}" in *"#${m}#"*) continue ;; esac echo "Autoloading module: ${m}" From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 17:46:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 913C6665224; Fri, 16 Jul 2021 17:46:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRJZx1lP2z3n2M; Fri, 16 Jul 2021 17:46:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E98120CF1; Fri, 16 Jul 2021 17:46:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GHkniB082146; Fri, 16 Jul 2021 17:46:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GHknJI082145; Fri, 16 Jul 2021 17:46:49 GMT (envelope-from git) Date: Fri, 16 Jul 2021 17:46:49 GMT Message-Id: <202107161746.16GHknJI082145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 66c5e65030ca - stable/12 - devmatch: don't announce autoloading so much MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 66c5e65030ca055ada3eae1c18cbbafe8131fa86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 17:46:49 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=66c5e65030ca055ada3eae1c18cbbafe8131fa86 commit 66c5e65030ca055ada3eae1c18cbbafe8131fa86 Author: Warner Losh AuthorDate: 2021-07-08 19:53:18 +0000 Commit: Warner Losh CommitDate: 2021-07-16 17:45:11 +0000 devmatch: don't announce autoloading so much devmatch rc script would announce it was loading a module multiple times. It used kldload -n so it really wasn't loading it that many times, but the message is confusing. Use kldstat to see if we need to load the module before saying we do. This fixes the vast majority of the problems. It may be possible to race devmatch with a user invocation and devd, though quite hard. In that case we'll announce things twice, but still only load it once. No attempt is made to fix this. PR: 232782 MFC After: 2 weeks Sponsored by: Netflix --- libexec/rc/rc.d/devmatch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index d48661ca9e15..cdea796c4689 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -71,8 +71,8 @@ devmatch_start() case "${x}" in *"#${m}#"*) continue ;; esac - echo "Autoloading module: ${m}" - kldload -n ${m} + kldstat -q -n ${m} || \ + (echo "Autoloading module: ${m}"; kldload -n ${m}) done devctl thaw } From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB522665CCD; Fri, 16 Jul 2021 18:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYX5fP9z3vCm; Fri, 16 Jul 2021 18:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAF8121CE6; Fri, 16 Jul 2021 18:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUelD047324; Fri, 16 Jul 2021 18:30:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUe6U047323; Fri, 16 Jul 2021 18:30:40 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:40 GMT Message-Id: <202107161830.16GIUe6U047323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1466c6253e55 - stable/13 - devmatch: defer until after kld MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1466c6253e559ae615446c3f0b27ef9d0ada4209 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:40 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1466c6253e559ae615446c3f0b27ef9d0ada4209 commit 1466c6253e559ae615446c3f0b27ef9d0ada4209 Author: Helge Oldach AuthorDate: 2021-07-07 20:43:35 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:43 +0000 devmatch: defer until after kld devmatch loads a number of things automatically. Allow the list of things to load to happen first in case those drivers affect what would be loaded. Normally, this will produce the same results, but there's some special cases that may not when drivers are loaded that report other drivers missing, like virtio_pci. PR: 253287 Reviewed by: imp MFC After: 2 weeks (cherry picked from commit f68e3ea831b76a8927eed7f7abfea55ee5a193c4) --- libexec/rc/rc.d/devmatch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index 0b2e3719dabb..dd61307a4e0a 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -26,7 +26,7 @@ # $FreeBSD$ # # PROVIDE: devmatch -# REQUIRE: kldxref +# REQUIRE: kld # BEFORE: netif # KEYWORD: nojail From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35C31665D37; Fri, 16 Jul 2021 18:30:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYZ0cMvz3vCp; Fri, 16 Jul 2021 18:30:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D200321DB2; Fri, 16 Jul 2021 18:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUf1x047348; Fri, 16 Jul 2021 18:30:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUf9g047347; Fri, 16 Jul 2021 18:30:41 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:41 GMT Message-Id: <202107161830.16GIUf9g047347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a4ce800b585b - stable/13 - devmatch: Be tolerant of .ko being present. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a4ce800b585ba01dc6e5787521654318906a1efd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:42 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a4ce800b585ba01dc6e5787521654318906a1efd commit a4ce800b585ba01dc6e5787521654318906a1efd Author: Warner Losh AuthorDate: 2021-07-08 19:44:21 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:43 +0000 devmatch: Be tolerant of .ko being present. We document that we did not need .ko on the module names in devmatch_blocklist, but we really needed them. Keep the documentation the same, but strip the .ko when we need to use the names so you can specify either. PR: 256240 MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit b29ebb9c65b350e78aedfc790bfcaf9717059b70) --- libexec/rc/rc.d/devmatch | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index dd61307a4e0a..f7f677b968e7 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -52,18 +52,23 @@ devmatch_start() [ -n "$list" ] || return - # While kldload can accept multiple modules - # on the line at once, we loop here in case - # there's some weird error with one of them. - # We also optimize against the false positives - # or drivers that have symbolic links that - # confuse devmatch by running it -n. - # Finally, we filter out all items in the - # devmatch_blocklist. + # While kldload can accept multiple modules on the line at once, we loop + # here in case there's some weird error with one of them. We also + # optimize against the false positives or drivers that have symbolic + # links that confuse devmatch by running it -n. Finally, we filter out + # all items in the devmatch_blocklist. + # + # We strip all the .ko suffixes off so that one may specify modules + # with or without .ko. Prior version documented it was without, while + # the code required it, so accept both now. devmatch produces module + # names with .ko + devctl freeze - x=$(echo ${devmatch_blocklist:-${devmatch_blacklist}} | tr ' ' '#') + x=$(echo '#'${devmatch_blocklist:-${devmatch_blacklist}}'#' | \ + sed -e "s/ /#/g;s/\.ko#/#/g") for m in ${list}; do - case "#${x}#" in + m="${m%.ko}" + case "${x}" in *"#${m}#"*) continue ;; esac echo "Autoloading module: ${m}" From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FDEC665F20; Fri, 16 Jul 2021 18:30:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYb1tBXz3v8h; Fri, 16 Jul 2021 18:30:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 000DF21AE3; Fri, 16 Jul 2021 18:30:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUgRC047372; Fri, 16 Jul 2021 18:30:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUgds047371; Fri, 16 Jul 2021 18:30:42 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:42 GMT Message-Id: <202107161830.16GIUgds047371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 00ed9aa54bec - stable/13 - devmatch: don't announce autoloading so much MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 00ed9aa54bec137327e37c25fcd5d59347bbf4e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:43 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=00ed9aa54bec137327e37c25fcd5d59347bbf4e6 commit 00ed9aa54bec137327e37c25fcd5d59347bbf4e6 Author: Warner Losh AuthorDate: 2021-07-08 19:53:18 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:44 +0000 devmatch: don't announce autoloading so much devmatch rc script would announce it was loading a module multiple times. It used kldload -n so it really wasn't loading it that many times, but the message is confusing. Use kldstat to see if we need to load the module before saying we do. This fixes the vast majority of the problems. It may be possible to race devmatch with a user invocation and devd, though quite hard. In that case we'll announce things twice, but still only load it once. No attempt is made to fix this. PR: 232782 MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit 5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8) --- libexec/rc/rc.d/devmatch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index f7f677b968e7..f5b8e8e51071 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -71,8 +71,8 @@ devmatch_start() case "${x}" in *"#${m}#"*) continue ;; esac - echo "Autoloading module: ${m}" - kldload -n ${m} + kldstat -q -n ${m} || \ + (echo "Autoloading module: ${m}"; kldload -n ${m}) done devctl thaw } From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F03AF665EA6; Fri, 16 Jul 2021 18:30:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYc3M3Lz3vJ0; Fri, 16 Jul 2021 18:30:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21B1121AE4; Fri, 16 Jul 2021 18:30:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUirt047396; Fri, 16 Jul 2021 18:30:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUhv9047395; Fri, 16 Jul 2021 18:30:43 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:43 GMT Message-Id: <202107161830.16GIUhv9047395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f219c053852d - stable/13 - arm: remove fslsdma from GENERIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f219c053852d82acb9852cd735c815ba315f416d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:45 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f219c053852d82acb9852cd735c815ba315f416d commit f219c053852d82acb9852cd735c815ba315f416d Author: MIHIRA Sanpei Yoshiro AuthorDate: 2021-07-09 17:12:39 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:44 +0000 arm: remove fslsdma from GENERIC The fslsdma device requires sdma_fw, but that's not included in GENERIC. That firmware is not in the FreeBSD tree at the moment, but could easily be. The license for the firmware can be found in the linux firmware repo: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=3123d78e09d2f815de4d94aa35c07b3c0469c80e and looks to be a BSD license + no reverse engineer. We can add this back after the firmware is imported, made a port, or whose automatic loading can be made to happen. Reviewed by: imp (with ian finding the license) PR: 237466 MFC after: 1 week (cherry picked from commit 9e3761d126c5c019d6c935e83989928eb1a0e76e) --- sys/arm/conf/GENERIC | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 3cfe16ccfe54..baef32a7a99d 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -257,7 +257,6 @@ device ti_pruss device ti_mbox # DMA controller -device fslsdma device ti_sdma device a10_dmac device a31_dmac From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F8DA665CD3; Fri, 16 Jul 2021 18:30:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYf52zLz3vD2; Fri, 16 Jul 2021 18:30:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5703921BC9; Fri, 16 Jul 2021 18:30:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUk2x047451; Fri, 16 Jul 2021 18:30:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUkFE047450; Fri, 16 Jul 2021 18:30:46 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:46 GMT Message-Id: <202107161830.16GIUkFE047450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 37053c21e9d9 - stable/13 - loader: support.4th resets the read buffer incorrectly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 37053c21e9d984e50d7cac0002f8ec370213c7b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:47 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=37053c21e9d984e50d7cac0002f8ec370213c7b1 commit 37053c21e9d984e50d7cac0002f8ec370213c7b1 Author: John Hood AuthorDate: 2021-07-11 14:44:12 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:44 +0000 loader: support.4th resets the read buffer incorrectly Large nextboot.conf files (over 80 bytes) are not read correctly by the Forth loader, causing file parsing to abort, and nextboot configuration fails to apply. Simple repro: nextboot -e foo=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx shutdown -r now That will cause the bug to cause a parse failure but shouldn't otherwise affect the boot. Depending on your loader configuration, you may also have to set beastie_disable and/or reduce the number of modules loaded to see the error on a small console screen. 12.0 or CURRENT users will also have to explicitly use the Forth loader instead of the Lua loader. The error will look something like: Warning: syntax error on file /boot/loader.conf.local foo="xxxxxxxxxxxxxxnextboot_enable="YES" ^ /boot/support.4th has crude file I/O buffering, which uses a buffer 'read_buffer', defined to be 80 bytes by the 'read_buffer_size' constant. The loader first tastes nextboot.conf, reading and parsing the first line in it for nextboot_enable="YES". If this is true, then it reopens the file and parses it like other loader .conf files. Unfortunately, the file I/O buffering code does not fully reset the buffer state in the reset_line_reading word. If the last file was read to the end, that doesn't matter; the file buffer is treated as empty anyway. But in the nextboot.conf case, the loader will not read to the end of file if it is over 80 bytes, and the file buffer may be reused when reading the next file. When the file is reread, the corrupt text may cause file parsing to abort on bad syntax (if the corrupt line has <>2 quotes in it), the wrong variable to be set, no variable to be set at all, or (if the splice happens to land at a line ending) something approximating normal operation. The bug is very old, dating back to at least 2000 if not before, and is still present in 12.0 and CURRENT r345863 (though it is now hidden by the Lua loader by default). Suggested one-line attached. This does change the behavior of the reset_line_reading word, which is exported in the line-reading dictionary (though the export is not documented in loader man pages). But repo history shows it was probably exported for the PNP support code, which was never included in the loader build, and was removed 5 months ago. One thing that puzzles me: how has this bug gone unnoticed/unfixed for nearly 2 decades? I find it hard to believe that nobody's tried to do something interesting with nextboot, like load a kernel and filesystem, which is what I'm doing. PR: 239315 Reviewed by: imp (cherry picked from commit 9c1c02093b90ae49745a174eb26ea85dd1990eec) --- stand/forth/support.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index d87cf16a16dd..ec04b7e9e322 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -485,7 +485,7 @@ variable fd get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading - 0 to read_buffer_ptr + 0 read_buffer .len ! ; : read_line From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3057F666195; Fri, 16 Jul 2021 18:30:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYd4p1Lz3v7G; Fri, 16 Jul 2021 18:30:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4416521DB3; Fri, 16 Jul 2021 18:30:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUjdT047427; Fri, 16 Jul 2021 18:30:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUjpW047426; Fri, 16 Jul 2021 18:30:45 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:45 GMT Message-Id: <202107161830.16GIUjpW047426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 9148a80a6546 - stable/13 - mk: LZMA_SUPPORT is unused MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9148a80a65463c40e5e20e861fed9669e4cd0c95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:46 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9148a80a65463c40e5e20e861fed9669e4cd0c95 commit 9148a80a65463c40e5e20e861fed9669e4cd0c95 Author: Warner Losh AuthorDate: 2021-07-10 16:52:12 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:44 +0000 mk: LZMA_SUPPORT is unused Retire LZMA_SUPPORT. It's unused since r332995. Reviewed by: delphij PR: 244302 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31088 (cherry picked from commit d8514fa6f1b0b9824b169c5ab66f37713b303c57) --- share/man/man5/src.conf.5 | 4 +--- share/mk/src.opts.mk | 1 - tools/build/options/WITHOUT_LZMA_SUPPORT | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 4f44bda093ce..c083d8b91cb1 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd June 9, 2021 +.Dd July 10, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1055,8 +1055,6 @@ and related programs. Set to build .Xr ls 1 without support for colors to distinguish file types. -.It Va WITHOUT_LZMA_SUPPORT -Set to build some programs without optional lzma compression support. .It Va WITHOUT_MAIL Set to not build any mail support (MUA or MTA). When set, it enforces these options: diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 70462adb6a37..7c64d54e39f3 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -140,7 +140,6 @@ __DEFAULT_YES_OPTIONS = \ LOCATE \ LPR \ LS_COLORS \ - LZMA_SUPPORT \ MAIL \ MAILWRAPPER \ MAKE \ diff --git a/tools/build/options/WITHOUT_LZMA_SUPPORT b/tools/build/options/WITHOUT_LZMA_SUPPORT deleted file mode 100644 index 627d46433066..000000000000 --- a/tools/build/options/WITHOUT_LZMA_SUPPORT +++ /dev/null @@ -1,2 +0,0 @@ -.\" $FreeBSD$ -Set to build some programs without optional lzma compression support. From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31A11665BFB; Fri, 16 Jul 2021 18:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYg4vPbz3vD9; Fri, 16 Jul 2021 18:30:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75C0721BCB; Fri, 16 Jul 2021 18:30:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUl6q047475; Fri, 16 Jul 2021 18:30:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUltV047474; Fri, 16 Jul 2021 18:30:47 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:47 GMT Message-Id: <202107161830.16GIUltV047474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1405d761ba36 - stable/13 - nanobsd: enhance fill_pkg.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1405d761ba36f6adc59986999befddaf1bedee3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:48 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1405d761ba36f6adc59986999befddaf1bedee3f commit 1405d761ba36f6adc59986999befddaf1bedee3f Author: Lev A. Serebryakov AuthorDate: 2021-07-11 15:04:39 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:44 +0000 nanobsd: enhance fill_pkg.sh NanoBSD has helper script "fill_pkg.sh" which links all packages and ther dependencies from "package dump" (like /usr/ports/packages/All) to specified director. fill_pkg.sh has some limitations: 1) It needs ports tree, which should have exactly same versions as "package dump". 2) It requires full paths to needed ports, including "/usr/ports" part. 3) It has assumptions about Nano Package Dir (it assumes, that it specified rtelative to current directory). 4) It does not have any diagnostics (almost). This PR enhances "fill_pkg.sh" script in several ways: 1) Nano package dir could be absolute path. 2) Script understands four ways to specify "root" ports/packages: (a) Absolute directory with port (old one) (b) Relative directory with port, relative to ${PORTSDIR} or /usr/ports (c) Absolute path to file with package (with .tbz suffix) (d) Name of package in dump dir, with or without .tbz suffix These ways can be mixed in one call. Dependencies for packages are obtained with 'pkg_info -r' call, and are searched for in same directory as "parent" package. Dependencies for ports are obtained in old way from port's Makefile. 3) Three levels of diagnostic (and -v option, could be repeated) are added. 4) All path variables are enclosed in quotes, to make script work with paths, containing spaces. Note: imp merged in the changes to fill_pkg.sh since this has been a PR. PR: 151695 Reviewed by: imp@ MFC After: 3 days Differential Revision: https://reviews.freebsd.org/D31101 (cherry picked from commit 36cfb5d50f8e8856695780a6792fb7e81816e9ee) --- tools/tools/nanobsd/fill_pkg.sh | 154 +++++++++++++++++++++++++++++----------- 1 file changed, 113 insertions(+), 41 deletions(-) diff --git a/tools/tools/nanobsd/fill_pkg.sh b/tools/tools/nanobsd/fill_pkg.sh index be240a3bf66f..80f61429ee8f 100644 --- a/tools/tools/nanobsd/fill_pkg.sh +++ b/tools/tools/nanobsd/fill_pkg.sh @@ -1,5 +1,6 @@ #!/bin/sh # +# Copyright (c) 2014 Lev Serebryakov. # Copyright (c) 2009 Poul-Henning Kamp. # All rights reserved. # @@ -27,70 +28,141 @@ # $FreeBSD$ # # Usage: -# $0 PACKAGE_DUMP NANO_PACKAGE_DIR /usr/ports/foo/bar ... +# $0 PACKAGE_DUMP NANO_PACKAGE_DIR /usr/ports/foo/bar [package.txz]... # # Will symlink the packages listed, including their runtime dependencies, # from the PACKAGE_DUMP to the NANO_PACKAGE_DIR. # -NANO_PKG_DUMP=$1 -shift; -if [ ! -d $NANO_PKG_DUMP ] ; then - echo "$NANO_PKG_DUMP not a directory" 1>&2 - exit 1 -fi +: ${PORTSDIR:=/usr/ports} -NANO_PACKAGE_DIR=$1 -shift; +usage () { + echo "Usage: $0 [-v] package-dump-dir nano-package-dir port-dir-or-pkg ..." 1>&2 + exit 2 +} + +msg () { + local l + l=$1 ; shift + [ "$l" -le "$VERBOSE" ] && echo $* +} ports_recurse() ( - of=$1 - shift - for d - do - if [ ! -d $d ] ; then - echo "Missing port $d" 1>&2 + local outputfile dumpdir type fullpath pkgname p + outputfile=$1 ; shift + dumpdir=$1 ; shift + for p do + if [ -d "$p" -a -f "$p/Makefile" ] ; then + msg 3 "$p: full path to port" + pkgname=`cd "$p" && make -V pkgname` + type=port + fullpath=$p + elif [ -d "${PORTSDIR}/$p" -a -f "${PORTSDIR}/$p/Makefile" ] ; then + msg 3 "$p: path to port relative to ${PORTSDIR}}" + pkgname=`cd "${PORTSDIR}/$p" && make -V pkgname` + type=port + fullpath=${PORTSDIR}/$p + elif [ "${p%.txz}" != "$p" -a -f "$p" ] && pkg info -F "$p" > /dev/null 2>&1 ; then + msg 3 "$p: full package file name" + pkgname=`basename "$p" | sed 's/\.txz$//I'` + type=pkg + fullpath=$p + elif [ "${p%.txz}" != "$p" -a -f "$dumpdir/$p" ] && pkg info -F "$dumpdir/$p" > /dev/null 2>&1 ; then + msg 3 "$p: package file name relative to $dumpdir" + pkgname=`basename "$p" | sed 's/\.txz$//I'` + type=pkg + fullpath=$dumpdir/$p + elif [ -f "$dumpdir/$p.txz" ] && pkg info -F "$dumpdir/$p.txz" > /dev/null 2>&1 ; then + msg 3 "$p: package name relative to $dumpdir" + pkgname=`basename "$p"` + type=pkg + fullpath=$dumpdir/$p.txz + else + echo "Missing port or package $p" 1>&2 exit 2 fi - if grep -q "^$d\$" $of ; then + if grep -q "^$pkgname\$" "$outputfile" ; then + msg 3 "$pkgname was added already" true - else + elif [ "$type" = "port" ] ; then ( - cd $d - rd=`make -V RUN_DEPENDS ${PORTS_OPTS}` - ld=`make -V LIB_DEPENDS ${PORTS_OPTS}` - - for x in $rd $ld - do - ports_recurse $of `echo $x | - sed 's/^[^:]*:\([^:]*\).*$/\1/'` - done + cd "$fullpath" + rd=`make -V RUN_DEPENDS ${PORTS_OPTS}` + ld=`make -V LIB_DEPENDS ${PORTS_OPTS}` + + for dep in $rd $ld ; do + arg=`echo $dep | sed 's/^[^:]*:\([^:]*\).*$/\1/'` + msg 2 "Check $arg as requirement for port $pkgname" + ports_recurse "$outputfile" "$dumpdir" "$arg" + done ) - echo $d >> $of + msg 1 "Add $pkgname" + echo "$pkgname" >> "$outputfile" + else + dir=`dirname "$p"` # Get directory from SPECIFIED path, not from full path + if [ "$dir" = "." ] ; then + dir="" + else + dir=${dir}/ + fi + deps=`pkg info -dF "$fullpath" | grep -v "$pkgname:"` + for dep in $deps ; do + arg=`echo $dep | sed -e "s|^|$dir|" -e 's/$/.txz/'` + msg 2 "Check $arg as requirement for package $pkgname" + ports_recurse "$outputfile" "$dumpdir" "$arg" + done + msg 1 "Add $pkgname" + echo "$pkgname" >> "$outputfile" fi done ) -rm -rf $NANO_PACKAGE_DIR -mkdir -p $NANO_PACKAGE_DIR +VERBOSE=0 + +while getopts v opt ; do + case "$opt" in + v) VERBOSE=$(($VERBOSE + 1)) ;; + [?]) usage ;; + esac +done +shift $(( ${OPTIND} - 1 )) + +if [ "$#" -lt 3 ] ; then + usage +fi + +NANO_PKG_DUMP=`realpath $1` +shift; +if [ ! -d "$NANO_PKG_DUMP" ] ; then + echo "$NANO_PKG_DUMP is not a directory" 1>&2 + usage +fi + +NANO_PKG_DIR=`realpath $1` +shift; +if [ ! -d "$NANO_PKG_DIR" ] ; then + echo "$NANO_PKG_DIR is not a directory" 1>&2 + usage +fi + +# Cleanup +rm -rf "$NANO_PKG_DIR/"* + +PL=$NANO_PKG_DIR/_list +true > "$PL" -PL=$NANO_PACKAGE_DIR/_list -true > $PL -for i -do - ports_recurse `pwd`/$PL $i +for p do + ports_recurse "$PL" "$NANO_PKG_DUMP" "$p" done -for i in `cat $PL` -do - p=`(cd $i && make -V PKGNAME)` - if [ -f $NANO_PKG_DUMP/$p.t[bx]z ] ; then - ln -s $NANO_PKG_DUMP/$p.t[bx]z $NANO_PACKAGE_DIR +for i in `cat "$PL"` ; do + if [ -f "$NANO_PKG_DUMP/$i.txz" ] ; then + ln -s "$NANO_PKG_DUMP/$i.txz" "$NANO_PKG_DIR" else - echo "Package $p misssing in $NANO_PKG_DUMP" 1>&2 + echo "Package $i misssing in $NANO_PKG_DUMP" 1>&2 exit 1 fi done -rm -f $PL +rm -f "$PL" exit 0 From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEFAD665DE1; Fri, 16 Jul 2021 18:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYj0mg3z3vS5; Fri, 16 Jul 2021 18:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95BB021CE9; Fri, 16 Jul 2021 18:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUmut047499; Fri, 16 Jul 2021 18:30:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUmXS047498; Fri, 16 Jul 2021 18:30:48 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:48 GMT Message-Id: <202107161830.16GIUmXS047498@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 864b57281a18 - stable/13 - MINIMAL: remove debugging and some loadable network modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 864b57281a18ea4a66a43818c9d54104ddd6c8bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:50 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=864b57281a18ea4a66a43818c9d54104ddd6c8bd commit 864b57281a18ea4a66a43818c9d54104ddd6c8bd Author: Helge Oldach AuthorDate: 2021-07-11 16:21:11 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:44 +0000 MINIMAL: remove debugging and some loadable network modules Remove deugging stuff, since it's arguably not needed in a minimal setup. Also vlan, tuntap and gif since they can be loaded. imp didn't include the part of the patch that removed xen guest support. Xen guest is relatively small and has no way of being loaded. Reviewed by: imp PR: 229564 MFC After: 3 days (cherry picked from commit b21f19c9e0b7f3c923d845e9e31c0552f0162a62) --- sys/amd64/conf/MINIMAL | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index 7edafe1957fe..945cc653e0fc 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -125,9 +125,6 @@ device loop # Network loopback device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support -device vlan # 802.1Q VLAN support -device tuntap # Packet tunnel. -device gif # IPv6 and IPv4 tunneling # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D80A665D4D; Fri, 16 Jul 2021 18:30:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYj6V3Mz3v9F; Fri, 16 Jul 2021 18:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC35D21EDE; Fri, 16 Jul 2021 18:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUnuJ047523; Fri, 16 Jul 2021 18:30:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUnDI047522; Fri, 16 Jul 2021 18:30:49 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:49 GMT Message-Id: <202107161830.16GIUnDI047522@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f32c4c3b00c4 - stable/13 - loader: update autoboot description and move to loader.conf.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f32c4c3b00c46c52d00679dbf98d431b747ad305 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:50 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f32c4c3b00c46c52d00679dbf98d431b747ad305 commit f32c4c3b00c46c52d00679dbf98d431b747ad305 Author: Daniel Gerzo AuthorDate: 2021-07-12 21:13:03 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:44 +0000 loader: update autoboot description and move to loader.conf.5 Document "NO" special value for the autoboot_delay and move the description to loader.conf.5. imp reworked some of the wording from danger's patch. Reviewed by: imp PR: 85128 Differential Revision: https://reviews.freebsd.org/D11887 (cherry picked from commit 71f6aea4150c66784cbad42c1e1ff908d909c2ec) --- stand/defaults/loader.conf.5 | 43 ++++++++++++++++++++++++++++++++++++++++++- stand/man/loader.8 | 31 ++----------------------------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 76ec32ef6bec..b4109371a1cf 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 6, 2021 +.Dd July 10, 2021 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -77,6 +77,47 @@ may have any prefix; the prefix identifies a module. All such settings sharing a common prefix refer to the same module. .Bl -tag -width Ar +.It Ar autoboot_delay +Delay in seconds before automatically booting. +A user with console access will be able to interrupt the +.Ic autoboot +process and escape into the interactive mode by pressing a key on +the console during this delay. +.Pp +If set to +.Dq Li NO , +no +.Ic autoboot +is automatically attempted after processing +.Pa /boot/loader.rc , +though explicit +.Ic autoboot Ns 's +are processed normally, using a 10 second delay. +.Pp +If set to +.Dq Li 0 , +no delay is inserted, but any keys pressed while the kernel and modules are +loaded will enter interactive mode. +.Pp +If set to +.Dq Li -1 , +no delay will be inserted and +.Nm +starts interactive mode only if +.Ic autoboot +has failed. +In combination with the +.Va beastie_disable +option, this option prevents users with console access from being able +to interrupt the +.Ic autoboot +process and escape to the loader prompt. +To use the +.Va autoboot_delay +option in this manner, +.Va beastie_disable +must be set to +.Dq Li YES . .It Ar exec Immediately executes a .Xr loader 8 diff --git a/stand/man/loader.8 b/stand/man/loader.8 index 5e8819628822..305c736939fc 100644 --- a/stand/man/loader.8 +++ b/stand/man/loader.8 @@ -354,35 +354,8 @@ Both types of builtin variables are described below. Number of seconds .Ic autoboot will wait before booting. -If this variable is not defined, -.Ic autoboot -will default to 10 seconds. -.Pp -If set to -.Dq Li NO , -no -.Ic autoboot -will be automatically attempted after processing -.Pa /boot/loader.rc , -though explicit -.Ic autoboot Ns 's -will be processed normally, defaulting to 10 seconds delay. -.Pp -If set to -.Dq Li 0 , -no delay will be inserted, but user still will be able to interrupt -.Ic autoboot -process and escape into the interactive mode by pressing some key -on the console while kernel and -modules are being loaded. -.Pp -If set to -.Dq Li -1 , -no delay will be inserted and -.Nm -will engage interactive mode only if -.Ic autoboot -has failed for some reason. +Configuration options are described in +.Xr loader.conf 5 . .It Va boot_askname Instructs the kernel to prompt the user for the name of the root device when the kernel is booted. From owner-dev-commits-src-branches@freebsd.org Fri Jul 16 18:30:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1322666620D; Fri, 16 Jul 2021 18:30:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRKYl347lz3vSB; Fri, 16 Jul 2021 18:30:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9E8821CEA; Fri, 16 Jul 2021 18:30:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GIUodq047553; Fri, 16 Jul 2021 18:30:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GIUoUG047552; Fri, 16 Jul 2021 18:30:50 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:30:50 GMT Message-Id: <202107161830.16GIUoUG047552@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1e1d3725569f - stable/13 - loader: Don't reserve space for symbols twice. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1e1d3725569fac88a9baeac88af8da82d00779d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:30:54 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1e1d3725569fac88a9baeac88af8da82d00779d1 commit 1e1d3725569fac88a9baeac88af8da82d00779d1 Author: Warner Losh AuthorDate: 2021-07-12 21:17:05 +0000 Commit: Warner Losh CommitDate: 2021-07-16 18:28:45 +0000 loader: Don't reserve space for symbols twice. The current code bumps lastaddr twice for the symbol table location. However, the first bump is bogus and results in wasted space. Remove it. PR: 110995 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31017 (cherry picked from commit 297e9f364b5aa243572ee52b1faef9b3542c1c9e) --- stand/common/load_elf_obj.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c index 78ece02433c6..f3c84cf31368 100644 --- a/stand/common/load_elf_obj.c +++ b/stand/common/load_elf_obj.c @@ -282,8 +282,6 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) case SHT_SYMTAB: nsym++; ef->symtabindex = i; - shdr[i].sh_addr = (Elf_Addr)lastaddr; - lastaddr += shdr[i].sh_size; break; } } From owner-dev-commits-src-branches@freebsd.org Sat Jul 17 11:02:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4EF16524E8; Sat, 17 Jul 2021 11:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRlZL5RCMz3kyc; Sat, 17 Jul 2021 11:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A16DB74B7; Sat, 17 Jul 2021 11:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16HB2ovZ065852; Sat, 17 Jul 2021 11:02:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HB2ohI065851; Sat, 17 Jul 2021 11:02:50 GMT (envelope-from git) Date: Sat, 17 Jul 2021 11:02:50 GMT Message-Id: <202107171102.16HB2ohI065851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 0ecd3cde77e5 - stable/13 - amd64 locore.S: add FF copyright for LA57 work MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ecd3cde77e52a482d78a675fac0148da3d56f7d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 11:02:50 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0ecd3cde77e52a482d78a675fac0148da3d56f7d commit 0ecd3cde77e52a482d78a675fac0148da3d56f7d Author: Konstantin Belousov AuthorDate: 2021-07-10 11:05:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-17 10:51:45 +0000 amd64 locore.S: add FF copyright for LA57 work (cherry picked from commit 63664df72036dc8ee99bd83fecc91faf167fa232) --- sys/amd64/amd64/locore.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index ce37288f4400..a49687ca9f90 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -2,6 +2,12 @@ * Copyright (c) 2003 Peter Wemm * All rights reserved. * + * Copyright (c) 2020, 2021 The FreeBSD Foundation + * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: From owner-dev-commits-src-branches@freebsd.org Sat Jul 17 11:02:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BEC56522C8; Sat, 17 Jul 2021 11:02:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRlZM6jFCz3kwc; Sat, 17 Jul 2021 11:02:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCD9B74B8; Sat, 17 Jul 2021 11:02:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16HB2p8S065876; Sat, 17 Jul 2021 11:02:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HB2piq065875; Sat, 17 Jul 2021 11:02:51 GMT (envelope-from git) Date: Sat, 17 Jul 2021 11:02:51 GMT Message-Id: <202107171102.16HB2piq065875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 48619df1d270 - stable/13 - amd64 mpboot.S: fix typo in comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 48619df1d270fcc328e4a1a48a1afa83acb05cf7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 11:02:52 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=48619df1d270fcc328e4a1a48a1afa83acb05cf7 commit 48619df1d270fcc328e4a1a48a1afa83acb05cf7 Author: Konstantin Belousov AuthorDate: 2021-07-10 11:06:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-17 10:51:50 +0000 amd64 mpboot.S: fix typo in comment (cherry picked from commit 71463a34ab3f65ff109b529f2fae93b694b73fdd) --- sys/amd64/amd64/mpboot.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/mpboot.S b/sys/amd64/amd64/mpboot.S index fb75d2b88440..e525102b5d3d 100644 --- a/sys/amd64/amd64/mpboot.S +++ b/sys/amd64/amd64/mpboot.S @@ -47,7 +47,7 @@ mptramp_start: mov %ax, %ss /* - * Find relocation base and patch the gdt descript and ljmp targets + * Find relocation base and patch the gdt descriptor and ljmp targets */ xorl %ebx,%ebx mov %cs, %bx From owner-dev-commits-src-branches@freebsd.org Sat Jul 17 11:02:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B67C6522CB; Sat, 17 Jul 2021 11:02:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRlZP14t0z3kyk; Sat, 17 Jul 2021 11:02:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F03407514; Sat, 17 Jul 2021 11:02:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16HB2qWY065900; Sat, 17 Jul 2021 11:02:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HB2qqn065899; Sat, 17 Jul 2021 11:02:52 GMT (envelope-from git) Date: Sat, 17 Jul 2021 11:02:52 GMT Message-Id: <202107171102.16HB2qqn065899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: dc5511d75d82 - stable/13 - amd64 locore.S: trim .globl list from symbols gone for long time MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dc5511d75d8221209a77171f68c7f6043306b097 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 11:02:53 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dc5511d75d8221209a77171f68c7f6043306b097 commit dc5511d75d8221209a77171f68c7f6043306b097 Author: Konstantin Belousov AuthorDate: 2021-07-10 11:04:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-17 10:51:55 +0000 amd64 locore.S: trim .globl list from symbols gone for long time (cherry picked from commit 9dc715230ccab1c3ad17f076379d29a017059030) --- sys/amd64/amd64/locore.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index a49687ca9f90..6e866269b687 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -42,7 +42,7 @@ /* * Compiled KERNBASE location */ - .globl kernbase, kernload, loc_PTmap, loc_PDmap, loc_PDPmap, dmapbase, dmapend + .globl kernbase, kernload, dmapbase, dmapend .set kernbase,KERNBASE .set kernload,KERNLOAD .set dmapbase,DMAP_MIN_ADDRESS From owner-dev-commits-src-branches@freebsd.org Sat Jul 17 11:02:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B5F6652621; Sat, 17 Jul 2021 11:02:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRlZQ1rcyz3kf0; Sat, 17 Jul 2021 11:02:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AE54763E; Sat, 17 Jul 2021 11:02:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16HB2rGB065931; Sat, 17 Jul 2021 11:02:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HB2rVg065930; Sat, 17 Jul 2021 11:02:53 GMT (envelope-from git) Date: Sat, 17 Jul 2021 11:02:53 GMT Message-Id: <202107171102.16HB2rVg065930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4b52622de77c - stable/13 - amd64 pmap: unexpand the NBPDR macro definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4b52622de77c214da4d5f51006380517769f7857 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 11:02:54 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4b52622de77c214da4d5f51006380517769f7857 commit 4b52622de77c214da4d5f51006380517769f7857 Author: Konstantin Belousov AuthorDate: 2021-07-10 11:07:41 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-17 10:51:59 +0000 amd64 pmap: unexpand the NBPDR macro definition (cherry picked from commit fdc71fa112d66c7c0aba9ff80adc7b8bb22ea6ca) --- sys/amd64/amd64/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 01644b9661af..9b95343f43f3 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1532,7 +1532,7 @@ nkpt_init(vm_paddr_t addr) #ifdef NKPT pt_pages = NKPT; #else - pt_pages = howmany(addr, 1 << PDRSHIFT); + pt_pages = howmany(addr, NBPDR); pt_pages += NKPDPE(pt_pages); /* From owner-dev-commits-src-branches@freebsd.org Sat Jul 17 11:02:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D774165252B; Sat, 17 Jul 2021 11:02:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRlZR4DtZz3kSV; Sat, 17 Jul 2021 11:02:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36BE0707B; Sat, 17 Jul 2021 11:02:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16HB2tdF065955; Sat, 17 Jul 2021 11:02:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HB2tuC065954; Sat, 17 Jul 2021 11:02:55 GMT (envelope-from git) Date: Sat, 17 Jul 2021 11:02:55 GMT Message-Id: <202107171102.16HB2tuC065954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: fec5a70e1f41 - stable/13 - x86: use ANSI C definition style for trap_fatal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fec5a70e1f41235dbbf43482ec2e54df030f4abc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 11:02:56 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fec5a70e1f41235dbbf43482ec2e54df030f4abc commit fec5a70e1f41235dbbf43482ec2e54df030f4abc Author: Konstantin Belousov AuthorDate: 2021-07-10 10:59:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-17 10:52:04 +0000 x86: use ANSI C definition style for trap_fatal PR: 257062 (cherry picked from commit 55e63ed307fb099722cf6d30a18c9badab9b5d03) --- sys/amd64/amd64/trap.c | 4 +--- sys/i386/i386/trap.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index e67e188bb4fd..942c99c4826e 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -871,9 +871,7 @@ after_vmfault: } static void -trap_fatal(frame, eva) - struct trapframe *frame; - vm_offset_t eva; +trap_fatal(struct trapframe *frame, vm_offset_t eva) { int code, ss; u_int type; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 6fd2a1393761..045478149be5 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -875,9 +875,7 @@ trap_pfault(struct trapframe *frame, bool usermode, vm_offset_t eva, } static void -trap_fatal(frame, eva) - struct trapframe *frame; - vm_offset_t eva; +trap_fatal(struct trapframe *frame, vm_offset_t eva) { int code, ss, esp; u_int type; From owner-dev-commits-src-branches@freebsd.org Sat Jul 17 22:10:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B74FC65C473; Sat, 17 Jul 2021 22:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS2Nm4dxvz3FkH; Sat, 17 Jul 2021 22:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 886F3185A0; Sat, 17 Jul 2021 22:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16HMAWwr057642; Sat, 17 Jul 2021 22:10:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HMAW62057641; Sat, 17 Jul 2021 22:10:32 GMT (envelope-from git) Date: Sat, 17 Jul 2021 22:10:32 GMT Message-Id: <202107172210.16HMAW62057641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 4c78f4997add - stable/13 - Use sleepq_signal(SLEEPQ_DROP) in cv_signal(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4c78f4997add1fa13334fe995958e372f666ac4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 22:10:32 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4c78f4997add1fa13334fe995958e372f666ac4e commit 4c78f4997add1fa13334fe995958e372f666ac4e Author: Alexander Motin AuthorDate: 2021-07-10 00:52:40 +0000 Commit: Alexander Motin CommitDate: 2021-07-17 22:10:25 +0000 Use sleepq_signal(SLEEPQ_DROP) in cv_signal(). Same as wakeup_one()/wakeup_any() commit before it reduces the lock hold time and so contention. MFC after: 1 week (cherry picked from commit 63ca9ea4f34d887b66c7b9f1710f5e4be543ebed) --- sys/kern/kern_condvar.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c index e26b689b4e11..ffceee44a5c0 100644 --- a/sys/kern/kern_condvar.c +++ b/sys/kern/kern_condvar.c @@ -397,26 +397,23 @@ _cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock, void cv_signal(struct cv *cvp) { - int wakeup_swapper; if (cvp->cv_waiters == 0) return; - wakeup_swapper = 0; sleepq_lock(cvp); - if (cvp->cv_waiters > 0) { - if (cvp->cv_waiters == CV_WAITERS_BOUND && - sleepq_lookup(cvp) == NULL) { - cvp->cv_waiters = 0; - } else { - if (cvp->cv_waiters < CV_WAITERS_BOUND) - cvp->cv_waiters--; - wakeup_swapper = sleepq_signal(cvp, SLEEPQ_CONDVAR, 0, - 0); - } + if (cvp->cv_waiters == 0) { + sleepq_release(cvp); + return; + } + if (cvp->cv_waiters == CV_WAITERS_BOUND && sleepq_lookup(cvp) == NULL) { + cvp->cv_waiters = 0; + sleepq_release(cvp); + } else { + if (cvp->cv_waiters < CV_WAITERS_BOUND) + cvp->cv_waiters--; + if (sleepq_signal(cvp, SLEEPQ_CONDVAR | SLEEPQ_DROP, 0, 0)) + kick_proc0(); } - sleepq_release(cvp); - if (wakeup_swapper) - kick_proc0(); } /* From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:29:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D1D965E5DE; Sun, 18 Jul 2021 00:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5Sx0n7gz3vgt; Sun, 18 Jul 2021 00:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2A6D1A250; Sun, 18 Jul 2021 00:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0TKfB035065; Sun, 18 Jul 2021 00:29:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0TKcB035064; Sun, 18 Jul 2021 00:29:20 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:29:20 GMT Message-Id: <202107180029.16I0TKcB035064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b1381828c6c1 - stable/13 - procctl(PROC_ASLR_STATUS): fix vmspace leak MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b1381828c6c1f8eb8d80886a129b129e38e9b4ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:29:21 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b1381828c6c1f8eb8d80886a129b129e38e9b4ec commit b1381828c6c1f8eb8d80886a129b129e38e9b4ec Author: Konstantin Belousov AuthorDate: 2021-07-14 23:40:04 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-18 00:26:52 +0000 procctl(PROC_ASLR_STATUS): fix vmspace leak (cherry picked from commit 0bdb2cbf9d7c4366a0668b4563c8630538a50086) --- sys/kern/kern_procctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index b6f6f1b772b2..b2694fd0c32c 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -509,8 +509,9 @@ aslr_status(struct thread *td, struct proc *p, int *data) _PHOLD(p); PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); - if (vm != NULL && (vm->vm_map.flags & MAP_ASLR) != 0) { - d |= PROC_ASLR_ACTIVE; + if (vm != NULL) { + if ((vm->vm_map.flags & MAP_ASLR) != 0) + d |= PROC_ASLR_ACTIVE; vmspace_free(vm); } PROC_LOCK(p); From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCCBD65EB6D; Sun, 18 Jul 2021 00:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cF50DFz4Qqh; Sun, 18 Jul 2021 00:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94C0819E4C; Sun, 18 Jul 2021 00:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0Zfmg048122; Sun, 18 Jul 2021 00:35:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0Zfbe048120; Sun, 18 Jul 2021 00:35:41 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:41 GMT Message-Id: <202107180035.16I0Zfbe048120@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 87c6a74dbe94 - stable/13 - pci: enhance printf for leaked MSI[-X] vectors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 87c6a74dbe941b2ef0092ac09a734b8a2eceb012 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:41 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=87c6a74dbe941b2ef0092ac09a734b8a2eceb012 commit 87c6a74dbe941b2ef0092ac09a734b8a2eceb012 Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 15:47:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:57 +0000 pci: enhance printf for leaked MSI[-X] vectors When debugging leaked MSI/MSI-X vectors through LinuxKPI I found the informational printf unhelpful. Rather than just stating we leaked also tell how many MSI or MSI-X vectors we leak. Sponsored by: The FreeBSD Foundation Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D29394 (cherry picked from commit a9f0367b04b385e7bed47914662badf5ab18bc88) --- sys/dev/pci/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 54d7957dcbf1..ef138e926b6f 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -5044,7 +5044,12 @@ pci_child_detached(device_t dev, device_t child) if (resource_list_release_active(rl, dev, child, SYS_RES_IRQ) != 0) pci_printf(&dinfo->cfg, "Device leaked IRQ resources\n"); if (dinfo->cfg.msi.msi_alloc != 0 || dinfo->cfg.msix.msix_alloc != 0) { - pci_printf(&dinfo->cfg, "Device leaked MSI vectors\n"); + if (dinfo->cfg.msi.msi_alloc != 0) + pci_printf(&dinfo->cfg, "Device leaked %d MSI " + "vectors\n", dinfo->cfg.msi.msi_alloc); + else + pci_printf(&dinfo->cfg, "Device leaked %d MSI-X " + "vectors\n", dinfo->cfg.msix.msix_alloc); (void)pci_release_msi(child); } if (resource_list_release_active(rl, dev, child, SYS_RES_MEMORY) != 0) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F193F65EFF7; Sun, 18 Jul 2021 00:35:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cG6Ksbz4QnW; Sun, 18 Jul 2021 00:35:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5F111A466; Sun, 18 Jul 2021 00:35:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZgJk048151; Sun, 18 Jul 2021 00:35:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZgH9048150; Sun, 18 Jul 2021 00:35:42 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:42 GMT Message-Id: <202107180035.16I0ZgH9048150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 50322316e54d - stable/13 - termios: add more speeds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 50322316e54d67474a099a2ac969f09066cb338b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:43 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=50322316e54d67474a099a2ac969f09066cb338b commit 50322316e54d67474a099a2ac969f09066cb338b Author: Bjoern A. Zeeb AuthorDate: 2021-03-10 22:17:07 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:57 +0000 termios: add more speeds A lot of small arm64 gadgets are using 1500000 as console speed. While cu can perfectly deal with this some 3rd party software, e.g., comms/conserver-con add speeds based on B being defined. Having it defined here simplifies enhancing other software. Obtained from: NetBSD sys/sys/termios.h 1.36 Reviewed by: philip (,okayed by imp) Differential Revision: https://reviews.freebsd.org/D29209 (cherry picked from commit 0209400ceaed553a3f06a5f3759de992ddb58037) --- sys/sys/_termios.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/sys/_termios.h b/sys/sys/_termios.h index edbda0a161fc..b9fe17881b3a 100644 --- a/sys/sys/_termios.h +++ b/sys/sys/_termios.h @@ -208,7 +208,15 @@ #define B115200 115200 #define B230400 230400 #define B460800 460800 +#define B500000 500000 #define B921600 921600 +#define B1000000 1000000U +#define B1500000 1500000U +#define B2000000 2000000U +#define B2500000 2500000U +#define B3000000 3000000U +#define B3500000 3500000U +#define B4000000 4000000U #define EXTA 19200 #define EXTB 38400 #endif From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22FB165EF7C; Sun, 18 Jul 2021 00:35:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cJ0FYKz4R1c; Sun, 18 Jul 2021 00:35:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1D701A1AF; Sun, 18 Jul 2021 00:35:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZhO9048175; Sun, 18 Jul 2021 00:35:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0Zhcq048174; Sun, 18 Jul 2021 00:35:43 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:43 GMT Message-Id: <202107180035.16I0Zhcq048174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: fa76753cef17 - stable/13 - net80211: rx_stats add 160Mhz channel width. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa76753cef171c90fac6452e3e6925ad913a2720 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:44 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fa76753cef171c90fac6452e3e6925ad913a2720 commit fa76753cef171c90fac6452e3e6925ad913a2720 Author: Bjoern A. Zeeb AuthorDate: 2021-02-28 19:24:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:57 +0000 net80211: rx_stats add 160Mhz channel width. Add the missing receive stat(u)s flag for 160Mhz channel width. While here correct the comment for c_phytype to reference the correct flags. (cherry picked from commit a9cc796fa73de2e80a2d989ba7c2c5a7c7ce9f2e) --- sys/net80211/_ieee80211.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h index 928d7b0fd957..dc6773afac09 100644 --- a/sys/net80211/_ieee80211.h +++ b/sys/net80211/_ieee80211.h @@ -580,6 +580,7 @@ struct ieee80211_mimo_info { #define IEEE80211_RX_FW_20MHZ 1 #define IEEE80211_RX_FW_40MHZ 2 #define IEEE80211_RX_FW_80MHZ 3 +#define IEEE80211_RX_FW_160MHZ 4 /* PHY type */ #define IEEE80211_RX_FP_11B 1 @@ -619,7 +620,7 @@ struct ieee80211_rx_stats { } evm; /* 32 bits */ - uint8_t c_phytype; /* PHY type, FP flags above */ + uint8_t c_phytype; /* PHY type, FW flags above */ uint8_t c_vhtnss; /* VHT - number of spatial streams */ uint8_t c_pad2[2]; }; From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C1A865F184; Sun, 18 Jul 2021 00:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cK1r5dz4R6Y; Sun, 18 Jul 2021 00:35:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 027381A467; Sun, 18 Jul 2021 00:35:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZicI048199; Sun, 18 Jul 2021 00:35:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZiMX048198; Sun, 18 Jul 2021 00:35:44 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:44 GMT Message-Id: <202107180035.16I0ZiMX048198@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: d9801e9a8c9f - stable/13 - net80211: ratectl header guard against multiple inclusions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d9801e9a8c9f9c572b8dad87b3c5c5485d88b995 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:46 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d9801e9a8c9f9c572b8dad87b3c5c5485d88b995 commit d9801e9a8c9f9c572b8dad87b3c5c5485d88b995 Author: Bjoern A. Zeeb AuthorDate: 2021-03-07 17:35:58 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:57 +0000 net80211: ratectl header guard against multiple inclusions Add missing #ifndef/#define/#endif guards against multiple inclusions to ieee80211_ratectl.h as they are missing. (cherry picked from commit 3fca90af438ac4232d6b33ee4874297089997dd6) --- sys/net80211/ieee80211_ratectl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/net80211/ieee80211_ratectl.h b/sys/net80211/ieee80211_ratectl.h index d147421a0364..6890e74bf518 100644 --- a/sys/net80211/ieee80211_ratectl.h +++ b/sys/net80211/ieee80211_ratectl.h @@ -27,6 +27,9 @@ * $FreeBSD$ */ +#ifndef _NET80211_IEEE80211_RATECTL_H_ +#define _NET80211_IEEE80211_RATECTL_H_ + enum ieee80211_ratealgs { IEEE80211_RATECTL_AMRR = 0, IEEE80211_RATECTL_RSSADAPT = 1, @@ -169,3 +172,5 @@ ieee80211_ratectl_node_stats(struct ieee80211_node *ni, struct sbuf *s) return; vap->iv_rate->ir_node_stats(ni, s); } + +#endif /* _NET80211_IEEE80211_RATECTL_H_ */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 794A265EE2F; Sun, 18 Jul 2021 00:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cL1pPfz4Qqt; Sun, 18 Jul 2021 00:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 248A71A687; Sun, 18 Jul 2021 00:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0Zkid048223; Sun, 18 Jul 2021 00:35:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0Zk2K048222; Sun, 18 Jul 2021 00:35:46 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:46 GMT Message-Id: <202107180035.16I0Zk2K048222@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a42584a066c9 - stable/13 - net80211: split up ieee80211_probereq() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a42584a066c91bd22e92c57ce4f2ee01218c264c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:46 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a42584a066c91bd22e92c57ce4f2ee01218c264c commit a42584a066c91bd22e92c57ce4f2ee01218c264c Author: Bjoern A. Zeeb AuthorDate: 2021-07-18 00:32:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:57 +0000 net80211: split up ieee80211_probereq() Factor out ieee80211_probereq_ie() and ieee80211_probereq_ie_len() and make the length dynamic rather than static max. The latter is needed as our current fixed length was longer than some "hw scan", e.g. that of ath10k, will take. This way we can pass what we have. Should this not be sufficient in the future we might have to deal with filtering and much more error handling. This also removes a duplicate calculation for ieee80211_ie_wpa [1]. c338cf2c6d5eacdee813191d5976aa531d450ee7 split up ieee80211_probereq_ie(). For HW scans we usually do not want to add a SSID to the IEs. During that split we allocate memory based on the length which will always include the length of the SSID and only later we reduced the length but never updated the value passed back to the caller. Split the SSID handling up and reduce the length before malloc(). This not only makes us not over-allocate in these situatoins but also fixes the length returned to the caller and with that usually directly passed to firmware. Repoprted by: Martin Husemann [1] Sponsored by: Rubicon Communications, LLC ("Netgate") Sponsored by: The FreeBSD Foundation (update for alloc) Reviewed by: adrian, martin NetBSD.org (earlier version) Reviewed by: philip Differential Revision: https://reviews.freebsd.org/D26545 Differential Revision: https://reviews.freebsd.org/D30813 (cherry picked from commit c338cf2c6d5eacdee813191d5976aa531d450ee7) (cherry picked from commit 243b95978debac3db06df6d26ca9f8d84f6cbd83) --- sys/net80211/ieee80211_output.c | 172 +++++++++++++++++++++++++++------------- sys/net80211/ieee80211_proto.h | 2 + 2 files changed, 118 insertions(+), 56 deletions(-) diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index b67302b8d66f..ab3e3142ad2c 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -2414,80 +2414,77 @@ ieee80211_add_qos(uint8_t *frm, const struct ieee80211_node *ni) } /* - * Send a probe request frame with the specified ssid - * and any optional information element data. + * ieee80211_send_probereq(): send a probe request frame with the specified ssid + * and any optional information element data; some helper functions as FW based + * HW scans need some of that information passed too. */ -int -ieee80211_send_probereq(struct ieee80211_node *ni, - const uint8_t sa[IEEE80211_ADDR_LEN], - const uint8_t da[IEEE80211_ADDR_LEN], - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t *ssid, size_t ssidlen) +static uint32_t +ieee80211_probereq_ie_len(struct ieee80211vap *vap, struct ieee80211com *ic) { - struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211com *ic = ni->ni_ic; - struct ieee80211_node *bss; - const struct ieee80211_txparam *tp; - struct ieee80211_bpf_params params; const struct ieee80211_rateset *rs; - struct mbuf *m; - uint8_t *frm; - int ret; - - bss = ieee80211_ref_node(vap->iv_bss); - if (vap->iv_state == IEEE80211_S_CAC) { - IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, - "block %s frame in CAC state", "probe request"); - vap->iv_stats.is_tx_badstate++; - ieee80211_free_node(bss); - return EIO; /* XXX */ - } - - /* - * Hold a reference on the node so it doesn't go away until after - * the xmit is complete all the way in the driver. On error we - * will remove our reference. - */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", - __func__, __LINE__, - ni, ether_sprintf(ni->ni_macaddr), - ieee80211_node_refcnt(ni)+1); - ieee80211_ref_node(ni); + rs = ieee80211_get_suprates(ic, ic->ic_curchan); /* * prreq frame format * [tlv] ssid * [tlv] supported rates * [tlv] RSN (optional) - * [tlv] extended supported rates + * [tlv] extended supported rates (if needed) * [tlv] HT cap (optional) * [tlv] VHT cap (optional) * [tlv] WPA (optional) * [tlv] user-specified ie's */ - m = ieee80211_getmgtframe(&frm, - ic->ic_headroom + sizeof(struct ieee80211_frame), - 2 + IEEE80211_NWID_LEN + return ( 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE - + sizeof(struct ieee80211_ie_htcap) - + sizeof(struct ieee80211_ie_vhtcap) + + ((vap->iv_flags & IEEE80211_F_WPA2 && vap->iv_rsn_ie != NULL) ? + vap->iv_rsn_ie[1] : 0) + + ((rs->rs_nrates > IEEE80211_RATE_SIZE) ? + 2 + (rs->rs_nrates - IEEE80211_RATE_SIZE) : 0) + + (((vap->iv_opmode == IEEE80211_M_IBSS) && + (vap->iv_flags_ht & IEEE80211_FHT_HT)) ? + sizeof(struct ieee80211_ie_htcap) : 0) +#ifdef notyet + sizeof(struct ieee80211_ie_htinfo) /* XXX not needed? */ - + sizeof(struct ieee80211_ie_wpa) - + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) - + sizeof(struct ieee80211_ie_wpa) + + sizeof(struct ieee80211_ie_vhtcap) +#endif + + ((vap->iv_flags & IEEE80211_F_WPA1 && vap->iv_wpa_ie != NULL) ? + vap->iv_wpa_ie[1] : 0) + (vap->iv_appie_probereq != NULL ? vap->iv_appie_probereq->ie_len : 0) ); - if (m == NULL) { - vap->iv_stats.is_tx_nobuf++; - ieee80211_free_node(ni); - ieee80211_free_node(bss); - return ENOMEM; - } +} + +int +ieee80211_probereq_ie(struct ieee80211vap *vap, struct ieee80211com *ic, + uint8_t **frmp, uint32_t *frmlen, const uint8_t *ssid, size_t ssidlen, + bool alloc) +{ + const struct ieee80211_rateset *rs; + uint8_t *frm; + uint32_t len; + + if (!alloc && (frmp == NULL || frmlen == NULL)) + return (EINVAL); - frm = ieee80211_add_ssid(frm, ssid, ssidlen); + len = ieee80211_probereq_ie_len(vap, ic); + if (!alloc && len > *frmlen) + return (ENOBUFS); + + /* For HW scans we usually do not pass in the SSID as IE. */ + if (ssidlen == -1) + len -= (2 + IEEE80211_NWID_LEN); + + if (alloc) { + frm = malloc(len, M_80211_VAP, M_WAITOK | M_ZERO); + *frmp = frm; + *frmlen = len; + } else + frm = *frmp; + + if (ssidlen != -1) + frm = ieee80211_add_ssid(frm, ssid, ssidlen); rs = ieee80211_get_suprates(ic, ic->ic_curchan); frm = ieee80211_add_rates(frm, rs); frm = ieee80211_add_rsn(frm, vap); @@ -2517,8 +2514,8 @@ ieee80211_send_probereq(struct ieee80211_node *ni, * XXX TODO: need to figure out what/how to update the * VHT channel. */ -#if 0 - (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { +#ifdef notyet + if (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { struct ieee80211_channel *c; c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, @@ -2531,8 +2528,71 @@ ieee80211_send_probereq(struct ieee80211_node *ni, frm = ieee80211_add_wpa(frm, vap); if (vap->iv_appie_probereq != NULL) frm = add_appie(frm, vap->iv_appie_probereq); - m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); + if (!alloc) { + *frmp = frm; + *frmlen = len; + } + + return (0); +} + +int +ieee80211_send_probereq(struct ieee80211_node *ni, + const uint8_t sa[IEEE80211_ADDR_LEN], + const uint8_t da[IEEE80211_ADDR_LEN], + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t *ssid, size_t ssidlen) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_node *bss; + const struct ieee80211_txparam *tp; + struct ieee80211_bpf_params params; + struct mbuf *m; + uint8_t *frm; + uint32_t frmlen; + int ret; + + bss = ieee80211_ref_node(vap->iv_bss); + + if (vap->iv_state == IEEE80211_S_CAC) { + IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, + "block %s frame in CAC state", "probe request"); + vap->iv_stats.is_tx_badstate++; + ieee80211_free_node(bss); + return EIO; /* XXX */ + } + + /* + * Hold a reference on the node so it doesn't go away until after + * the xmit is complete all the way in the driver. On error we + * will remove our reference. + */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", + __func__, __LINE__, + ni, ether_sprintf(ni->ni_macaddr), + ieee80211_node_refcnt(ni)+1); + ieee80211_ref_node(ni); + + /* See comments above for entire frame format. */ + frmlen = ieee80211_probereq_ie_len(vap, ic); + m = ieee80211_getmgtframe(&frm, + ic->ic_headroom + sizeof(struct ieee80211_frame), frmlen); + if (m == NULL) { + vap->iv_stats.is_tx_nobuf++; + ieee80211_free_node(ni); + ieee80211_free_node(bss); + return ENOMEM; + } + + ret = ieee80211_probereq_ie(vap, ic, &frm, &frmlen, ssid, ssidlen, + false); + KASSERT(ret == 0, + ("%s: ieee80211_probereq_ie railed: %d\n", __func__, ret)); + + m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); KASSERT(M_LEADINGSPACE(m) >= sizeof(struct ieee80211_frame), ("leading space %zd", M_LEADINGSPACE(m))); M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); diff --git a/sys/net80211/ieee80211_proto.h b/sys/net80211/ieee80211_proto.h index fafedf46cab5..4b324caa694b 100644 --- a/sys/net80211/ieee80211_proto.h +++ b/sys/net80211/ieee80211_proto.h @@ -114,6 +114,8 @@ struct mbuf *ieee80211_encap(struct ieee80211vap *, struct ieee80211_node *, void ieee80211_free_mbuf(struct mbuf *); int ieee80211_send_mgmt(struct ieee80211_node *, int, int); struct ieee80211_appie; +int ieee80211_probereq_ie(struct ieee80211vap *, struct ieee80211com *, + uint8_t **, uint32_t *, const uint8_t *, size_t, bool); int ieee80211_send_probereq(struct ieee80211_node *ni, const uint8_t sa[IEEE80211_ADDR_LEN], const uint8_t da[IEEE80211_ADDR_LEN], From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 897DF65F090; Sun, 18 Jul 2021 00:35:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cM368qz4RBr; Sun, 18 Jul 2021 00:35:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 427091A1B0; Sun, 18 Jul 2021 00:35:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZlfZ048247; Sun, 18 Jul 2021 00:35:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZlsQ048246; Sun, 18 Jul 2021 00:35:47 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:47 GMT Message-Id: <202107180035.16I0ZlsQ048246@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 546a1a111992 - stable/13 - lib80211: Start adding 11ac ETSI bits to regdomain.xml MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 546a1a111992efd7f7c8fd14faf96fae089d8db6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:47 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=546a1a111992efd7f7c8fd14faf96fae089d8db6 commit 546a1a111992efd7f7c8fd14faf96fae089d8db6 Author: Bjoern A. Zeeb AuthorDate: 2021-07-18 00:32:41 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:57 +0000 lib80211: Start adding 11ac ETSI bits to regdomain.xml This change currently (partially) duplicates AC1 freqbands as AC2 as they are not fully overlapping. It then adds the 11ac netband to the "etsi" domain including "indoor" and "dfs" flags, which we can deal with, as well as appropriate (round down) maxpower values. Comments are left for the actual frequency bands as we do use the centerfreq for the first/last (chansep sized) channel in the freqband and their "id" name, which can be confusing. Reviewed by: philip, adrian Differential Revision: https://reviews.freebsd.org/D25999 (cherry picked from commit 2ad93dade70a9c98174fc87d0cd24fd54bd0d120) --- lib/lib80211/regdomain.xml | 174 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 173 insertions(+), 1 deletion(-) diff --git a/lib/lib80211/regdomain.xml b/lib/lib80211/regdomain.xml index cad3039c3d3d..38ef48fa3b69 100644 --- a/lib/lib80211/regdomain.xml +++ b/lib/lib80211/regdomain.xml @@ -551,9 +551,112 @@ IEEE80211_CHAN_DFS + + + + + 23 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + INDOOR + + + + 23 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + INDOOR + + + + 23 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + INDOOR + + + + + + 20 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + INDOOR + + + + 20 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + INDOOR + + + + 20 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + INDOOR + + + + + + 26 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT160 + IEEE80211_CHAN_DFS + + + + + + 13 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + + + + 13 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + + + + 13 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + + - + ETSI2 @@ -1788,6 +1891,75 @@ 80 20 IEEE80211_CHAN_A + + + 5160 5240 + 20 20 + IEEE80211_CHAN_A + + + 5180 5240 + 40 20 + IEEE80211_CHAN_A + + + 5180 5240 + 80 20 + IEEE80211_CHAN_A + + + + 5260 5340 + 20 20 + IEEE80211_CHAN_A + + + 5260 5320 + 40 20 + IEEE80211_CHAN_A + + + 5260 5320 + 80 20 + IEEE80211_CHAN_A + + + + 5480 5700 + 20 20 + IEEE80211_CHAN_A + + + 5500 5680 + 40 20 + IEEE80211_CHAN_A + + + 5500 5640 + 80 20 + IEEE80211_CHAN_A + + + 5500 5640 + 160 20 + IEEE80211_CHAN_A + + + + 5745 5865 + 20 20 + IEEE80211_CHAN_A + + + 5745 5805 + 40 20 + IEEE80211_CHAN_A + + + 5745 5805 + 80 20 + IEEE80211_CHAN_A + 5180 5240 40 20 From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BBB965ECE4; Sun, 18 Jul 2021 00:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cP3K9xz4Qwn; Sun, 18 Jul 2021 00:35:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6977D1A688; Sun, 18 Jul 2021 00:35:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZmvK048277; Sun, 18 Jul 2021 00:35:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZmFH048276; Sun, 18 Jul 2021 00:35:48 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:48 GMT Message-Id: <202107180035.16I0ZmFH048276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: fbf653f6dd89 - stable/13 - net80211: prefix get_random_bytes() with net80211_ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fbf653f6dd8958671f2b1907f6bffdee03105ab1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:50 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fbf653f6dd8958671f2b1907f6bffdee03105ab1 commit fbf653f6dd8958671f2b1907f6bffdee03105ab1 Author: Bjoern A. Zeeb AuthorDate: 2021-03-18 22:15:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:57 +0000 net80211: prefix get_random_bytes() with net80211_ Both linux/random.h and net80211 have a function named get_random_bytes(). With overlapping files included these collide. Arguably the function could be renamed in linuxkpi but the generic name should also not be used in net80211 so rename it there. Sponsored by: The FreeBSD Foundation Reviewed by: philip, adrian Differential Revision: https://reviews.freebsd.org/D29335 (cherry picked from commit af7d9f8e31c4c185f277b27059e470ec8a5627a7) --- sys/net80211/ieee80211_crypto_wep.c | 2 +- sys/net80211/ieee80211_dfs.c | 2 +- sys/net80211/ieee80211_freebsd.c | 2 +- sys/net80211/ieee80211_freebsd.h | 2 +- sys/net80211/ieee80211_hostap.c | 2 +- sys/net80211/ieee80211_mesh.c | 2 +- sys/net80211/ieee80211_node.c | 3 ++- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/net80211/ieee80211_crypto_wep.c b/sys/net80211/ieee80211_crypto_wep.c index bdaab1b29e14..797de006cdf2 100644 --- a/sys/net80211/ieee80211_crypto_wep.c +++ b/sys/net80211/ieee80211_crypto_wep.c @@ -100,7 +100,7 @@ wep_attach(struct ieee80211vap *vap, struct ieee80211_key *k) ctx->wc_vap = vap; ctx->wc_ic = vap->iv_ic; - get_random_bytes(&ctx->wc_iv, sizeof(ctx->wc_iv)); + net80211_get_random_bytes(&ctx->wc_iv, sizeof(ctx->wc_iv)); nrefs++; /* NB: we assume caller locking */ return ctx; } diff --git a/sys/net80211/ieee80211_dfs.c b/sys/net80211/ieee80211_dfs.c index abe67576d711..b3959220bfc9 100644 --- a/sys/net80211/ieee80211_dfs.c +++ b/sys/net80211/ieee80211_dfs.c @@ -421,7 +421,7 @@ ieee80211_dfs_pickchannel(struct ieee80211com *ic) * one at random (skipping channels where radar has * been detected). */ - get_random_bytes(&v, sizeof(v)); + net80211_get_random_bytes(&v, sizeof(v)); v %= ic->ic_nchans; for (i = v; i < ic->ic_nchans; i++) { c = &ic->ic_channels[i]; diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c index 850c93d1e5df..011ae7060a6c 100644 --- a/sys/net80211/ieee80211_freebsd.c +++ b/sys/net80211/ieee80211_freebsd.c @@ -749,7 +749,7 @@ ieee80211_vap_xmitpkt(struct ieee80211vap *vap, struct mbuf *m) #include void -get_random_bytes(void *p, size_t n) +net80211_get_random_bytes(void *p, size_t n) { uint8_t *dp = p; diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h index c3811cc32e84..9d7b9cbb7cce 100644 --- a/sys/net80211/ieee80211_freebsd.h +++ b/sys/net80211/ieee80211_freebsd.h @@ -359,7 +359,7 @@ struct ieee80211com; int ieee80211_parent_xmitpkt(struct ieee80211com *, struct mbuf *); int ieee80211_vap_xmitpkt(struct ieee80211vap *, struct mbuf *); -void get_random_bytes(void *, size_t); +void net80211_get_random_bytes(void *, size_t); void ieee80211_sysctl_attach(struct ieee80211com *); void ieee80211_sysctl_detach(struct ieee80211com *); diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 8402ade857ff..16a3d97ae7f2 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -1093,7 +1093,7 @@ hostap_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh, /* NB: don't return error so they rexmit */ return; } - get_random_bytes(ni->ni_challenge, + net80211_get_random_bytes(ni->ni_challenge, IEEE80211_CHALLENGE_LEN); IEEE80211_NOTE(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH, ni, "shared key %sauth request", allocbs ? "" : "re"); diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index fdb84a2acb3d..48a3590d0cf3 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -962,7 +962,7 @@ mesh_generateid(struct ieee80211vap *vap) uint16_t r; do { - get_random_bytes(&r, 2); + net80211_get_random_bytes(&r, 2); ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, mesh_checkid, &r); maxiter--; } while (r == 0 && maxiter > 0); diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 64a0164aeb81..5a9677836dbd 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -363,7 +363,8 @@ ieee80211_create_ibss(struct ieee80211vap* vap, struct ieee80211_channel *chan) if (vap->iv_flags & IEEE80211_F_DESBSSID) IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid); else { - get_random_bytes(ni->ni_bssid, IEEE80211_ADDR_LEN); + net80211_get_random_bytes(ni->ni_bssid, + IEEE80211_ADDR_LEN); /* clear group bit, add local bit */ ni->ni_bssid[0] = (ni->ni_bssid[0] &~ 0x01) | 0x02; } From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB69065ECE9; Sun, 18 Jul 2021 00:35:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cQ6VHwz4R8Z; Sun, 18 Jul 2021 00:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF4931A468; Sun, 18 Jul 2021 00:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZoRJ048325; Sun, 18 Jul 2021 00:35:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0Zo86048324; Sun, 18 Jul 2021 00:35:50 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:50 GMT Message-Id: <202107180035.16I0Zo86048324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b3096b49f97e - stable/13 - LinuxKPI: add support for crc32_le() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b3096b49f97e0a3543f0568a71d67debbe41a93e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:51 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b3096b49f97e0a3543f0568a71d67debbe41a93e commit b3096b49f97e0a3543f0568a71d67debbe41a93e Author: Bjoern A. Zeeb AuthorDate: 2021-03-10 15:01:10 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 LinuxKPI: add support for crc32_le() Add support for crc32_le() as a wrapper around crc32_raw(). Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D29187 (cherry picked from commit 0c7b75f12840a31206ae24acca1f5ee35c8e341d) --- sys/compat/linuxkpi/common/include/linux/crc32.h | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/crc32.h b/sys/compat/linuxkpi/common/include/linux/crc32.h new file mode 100644 index 000000000000..6d43eb7b1859 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/crc32.h @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_CRC32_H +#define __LKPI_LINUX_CRC32_H + +#include + +static __inline uint32_t +crc32_le(uint32_t crc, const void *data, size_t len) +{ + + return (crc32_raw(data, len, crc)); +} + +#endif /* __LKPI_LINUX_CRC32_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68F6865F212; Sun, 18 Jul 2021 00:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cS0wLWz4Qws; Sun, 18 Jul 2021 00:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCBBF1A689; Sun, 18 Jul 2021 00:35:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0Zpg6048349; Sun, 18 Jul 2021 00:35:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0Zp0r048348; Sun, 18 Jul 2021 00:35:51 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:51 GMT Message-Id: <202107180035.16I0Zp0r048348@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 19807ebec668 - stable/13 - linuxkpi: add ieee80211_node.h to headers to include before LIST_HEAD MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 19807ebec668cd1038680bf2ae4f64061bea15ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:52 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=19807ebec668cd1038680bf2ae4f64061bea15ce commit 19807ebec668cd1038680bf2ae4f64061bea15ce Author: Bjoern A. Zeeb AuthorDate: 2021-03-18 22:23:15 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 linuxkpi: add ieee80211_node.h to headers to include before LIST_HEAD ieee80211_node.h uses LIST_HEAD() which LinuxKPI redefines and this can lead to problems (see comment there). Make sure the net80211 header file is handled correctly by adding it to the list of files to include before re-defining the macro. Also add header files needed as dependencies. Sponsored by: The FreeBSD Foundation Reviewed by: philip, hselasky Differential Revision: https://reviews.freebsd.org/D29336 (cherry picked from commit de8a7cc703f1d3eab293d53fbc8269e1aca3a6ab) --- sys/compat/linuxkpi/common/include/linux/list.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/list.h b/sys/compat/linuxkpi/common/include/linux/list.h index 977207376c45..93db449a4473 100644 --- a/sys/compat/linuxkpi/common/include/linux/list.h +++ b/sys/compat/linuxkpi/common/include/linux/list.h @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -67,6 +68,10 @@ #include #include +#include +#include +#include + #include #include #include From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63D1165F21E; Sun, 18 Jul 2021 00:35:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cT1BHXz4RHm; Sun, 18 Jul 2021 00:35:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08FDD1A469; Sun, 18 Jul 2021 00:35:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0Zq8P048373; Sun, 18 Jul 2021 00:35:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZqG0048372; Sun, 18 Jul 2021 00:35:52 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:52 GMT Message-Id: <202107180035.16I0ZqG0048372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 436c7e3ad12d - stable/13 - ofed/linuxkpi: use proper accessor function MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 436c7e3ad12d109bd2feb6d4402b95ed3049e3b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:53 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=436c7e3ad12d109bd2feb6d4402b95ed3049e3b5 commit 436c7e3ad12d109bd2feb6d4402b95ed3049e3b5 Author: Bjoern A. Zeeb AuthorDate: 2021-03-21 21:07:45 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 ofed/linuxkpi: use proper accessor function In the notifier event callback function rather than casting directly to the expected type use the proper accessor function as the mlx drivers already do. This is preparational work to allow us to improve the struct net_device is struct ifnet compat code shortcut in the future. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D29364 (cherry picked from commit a29bbfe6c6e41691bdd3bd0e5be89089523485d6) --- sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c index 8f6156333f4a..02acf29159e3 100644 --- a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c +++ b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c @@ -380,7 +380,7 @@ roce_gid_delete_all_event(struct net_device *ndev) static int inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr) { - struct net_device *ndev = ptr; + struct net_device *ndev = netdev_notifier_info_to_dev(ptr); switch (event) { case NETDEV_UNREGISTER: From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4BBC65F128; Sun, 18 Jul 2021 00:35:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cX3zS1z4R4l; Sun, 18 Jul 2021 00:35:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 598201A68B; Sun, 18 Jul 2021 00:35:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0Zudl048455; Sun, 18 Jul 2021 00:35:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0Zu8G048454; Sun, 18 Jul 2021 00:35:56 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:56 GMT Message-Id: <202107180035.16I0Zu8G048454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0fadaad3bd05 - stable/13 - LinuxKPI: add pci_ids.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0fadaad3bd05e423a38e993367b562ac6090eb5f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:58 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0fadaad3bd05e423a38e993367b562ac6090eb5f commit 0fadaad3bd05e423a38e993367b562ac6090eb5f Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 17:13:15 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 LinuxKPI: add pci_ids.h brcm80211 include pci_ids.h directly while historically we were tracking IDs in pci.h. Move the current set of IDs from pci.h to pci_ids.h and while here add IDs for Realtek and Broadcom as well as a network class as needed by their wireless drivers. We still include pci_ids.h from pci.h so this should not change anything. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D29400 (cherry picked from commit 5a402a3ae3975abb573ca9b53ff8cfe204c3771f) --- sys/compat/linuxkpi/common/include/linux/pci.h | 29 +-------- sys/compat/linuxkpi/common/include/linux/pci_ids.h | 72 ++++++++++++++++++++++ 2 files changed, 73 insertions(+), 28 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 0cc467f4cc8f..827fd98facb6 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -54,6 +54,7 @@ #include #include #include +#include struct pci_device_id { uint32_t vendor; @@ -67,35 +68,7 @@ struct pci_device_id { #define MODULE_DEVICE_TABLE(bus, table) -#define PCI_BASE_CLASS_DISPLAY 0x03 -#define PCI_CLASS_DISPLAY_VGA 0x0300 -#define PCI_CLASS_DISPLAY_OTHER 0x0380 -#define PCI_BASE_CLASS_BRIDGE 0x06 -#define PCI_CLASS_BRIDGE_ISA 0x0601 - #define PCI_ANY_ID -1U -#define PCI_VENDOR_ID_APPLE 0x106b -#define PCI_VENDOR_ID_ASUSTEK 0x1043 -#define PCI_VENDOR_ID_ATI 0x1002 -#define PCI_VENDOR_ID_DELL 0x1028 -#define PCI_VENDOR_ID_HP 0x103c -#define PCI_VENDOR_ID_IBM 0x1014 -#define PCI_VENDOR_ID_INTEL 0x8086 -#define PCI_VENDOR_ID_MELLANOX 0x15b3 -#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4 -#define PCI_VENDOR_ID_SERVERWORKS 0x1166 -#define PCI_VENDOR_ID_SONY 0x104d -#define PCI_VENDOR_ID_TOPSPIN 0x1867 -#define PCI_VENDOR_ID_VIA 0x1106 -#define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4 -#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159 -#define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 -#define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46 -#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 -#define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 -#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c -#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 -#define PCI_SUBDEVICE_ID_QEMU 0x1100 #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) diff --git a/sys/compat/linuxkpi/common/include/linux/pci_ids.h b/sys/compat/linuxkpi/common/include/linux/pci_ids.h new file mode 100644 index 000000000000..519d1b6eb663 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/pci_ids.h @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUXKPI_LINUX_PCI_IDS_H +#define _LINUXKPI_LINUX_PCI_IDS_H + +#define PCI_CLASS_NETWORK_OTHER 0x0280 + +#define PCI_BASE_CLASS_DISPLAY 0x03 +#define PCI_CLASS_DISPLAY_VGA 0x0300 +#define PCI_CLASS_DISPLAY_OTHER 0x0380 + +#define PCI_BASE_CLASS_BRIDGE 0x06 +#define PCI_CLASS_BRIDGE_ISA 0x0601 + + +/* XXX We should really generate these and use them throughout the tree. */ + +#define PCI_VENDOR_ID_APPLE 0x106b +#define PCI_VENDOR_ID_ASUSTEK 0x1043 +#define PCI_VENDOR_ID_ATI 0x1002 +#define PCI_VENDOR_ID_BROADCOM 0x14e4 +#define PCI_VENDOR_ID_DELL 0x1028 +#define PCI_VENDOR_ID_HP 0x103c +#define PCI_VENDOR_ID_IBM 0x1014 +#define PCI_VENDOR_ID_INTEL 0x8086 +#define PCI_VENDOR_ID_MELLANOX 0x15b3 +#define PCI_VENDOR_ID_REALTEK 0x10ec +#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4 +#define PCI_VENDOR_ID_SERVERWORKS 0x1166 +#define PCI_VENDOR_ID_SONY 0x104d +#define PCI_VENDOR_ID_TOPSPIN 0x1867 +#define PCI_VENDOR_ID_VIA 0x1106 +#define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4 +#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159 +#define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 +#define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46 +#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 +#define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 +#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c +#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 +#define PCI_SUBDEVICE_ID_QEMU 0x1100 + +#endif /* _LINUXKPI_LINUX_PCI_IDS_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3883F65F10F; Sun, 18 Jul 2021 00:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cP66mYz4R6v; Sun, 18 Jul 2021 00:35:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F7E11A48E; Sun, 18 Jul 2021 00:35:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZntN048301; Sun, 18 Jul 2021 00:35:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZnuL048300; Sun, 18 Jul 2021 00:35:49 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:49 GMT Message-Id: <202107180035.16I0ZnuL048300@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 05490438f2ed - stable/13 - ifconfig: 80211, add line break after key info MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 05490438f2edd7704a7a2eb570ffc33334bce5af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:50 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=05490438f2edd7704a7a2eb570ffc33334bce5af commit 05490438f2edd7704a7a2eb570ffc33334bce5af Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 15:08:46 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:57 +0000 ifconfig: 80211, add line break after key info Beauty correction for verbose mode or in case we print multiple key information to not continue with the next options directly after as we did so far, e.g.: AES-CCM 2:128-bit AES-CCM 3:128-bit powersavemode ... Sponsored by: The FreeBSD Foundation Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D29393 (cherry picked from commit 5ba4c8de15210bbc026c41b77b23d5af06613fe6) --- sbin/ifconfig/ifieee80211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index cfaf163f5930..ee611a14b45e 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -5060,6 +5060,8 @@ ieee80211_status(int s) printkey(&ik); } } + if (i > 0 && verbose) + LINE_BREAK(); end: ; } From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D56965F280; Sun, 18 Jul 2021 00:35:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cV40T5z4RFM; Sun, 18 Jul 2021 00:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B4781A68A; Sun, 18 Jul 2021 00:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZrZf048403; Sun, 18 Jul 2021 00:35:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZrDS048402; Sun, 18 Jul 2021 00:35:53 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:53 GMT Message-Id: <202107180035.16I0ZrDS048402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 36d6711bd68f - stable/13 - LinuxKPI: add more linux-specific errno MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 36d6711bd68f6c7a6d7acfa025fe47d82eb118a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:57 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=36d6711bd68f6c7a6d7acfa025fe47d82eb118a9 commit 36d6711bd68f6c7a6d7acfa025fe47d82eb118a9 Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 16:37:35 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 LinuxKPI: add more linux-specific errno Add ERFKILL and EBADE found in iwlwifi and brcmfmac wireless drivers. While here add a comment above the block of error numbers above 500 to document expectations. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D29396 (cherry picked from commit 4b0632cfc5c86587668b1d5d2ddc26d445072b03) --- sys/compat/linuxkpi/common/include/linux/errno.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/errno.h b/sys/compat/linuxkpi/common/include/linux/errno.h index e824480ab640..efdde9a7a72a 100644 --- a/sys/compat/linuxkpi/common/include/linux/errno.h +++ b/sys/compat/linuxkpi/common/include/linux/errno.h @@ -45,6 +45,10 @@ #define ENOTSUPP EOPNOTSUPP #define ENONET EHOSTDOWN +/* + * The error numbers below are arbitrary and do not resemble the numbers + * used in Linux. They should not be returned to user space. + */ #define ERESTARTNOINTR 513 #define ERESTARTNOHAND 514 #define ERESTART_RESTARTBLOCK 516 @@ -58,5 +62,7 @@ #define EBADTYPE 527 #define EJUKEBOX 528 #define EIOCBQUEUED 529 +#define ERFKILL 530 +#define EBADE 531 #endif /* _LINUX_ERRNO_H_ */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D51865ECF2; Sun, 18 Jul 2021 00:35:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cZ54MBz4R8x; Sun, 18 Jul 2021 00:35:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F0971A68C; Sun, 18 Jul 2021 00:35:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0Zwwe048503; Sun, 18 Jul 2021 00:35:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZwmL048502; Sun, 18 Jul 2021 00:35:58 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:58 GMT Message-Id: <202107180035.16I0ZwmL048502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 415e9b69a167 - stable/13 - LinuxKPI: remove < 5.0 version support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 415e9b69a167d242619ae00bc86695e2d339007a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:59 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=415e9b69a167d242619ae00bc86695e2d339007a commit 415e9b69a167d242619ae00bc86695e2d339007a Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 14:24:49 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 LinuxKPI: remove < 5.0 version support We are not aware of any out-of-tree consumers anymore which would need KPI support for before Linux version 5. Update the two in-tree consumers to use the new KPI. This allows us to remove the extra version check and will also give access to {lower,upper}_32_bits() unconditionally. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, rlibby, rstone X-MFC: to 13 only Differential Revision: https://reviews.freebsd.org/D29391 (cherry picked from commit 3b1ecc9fa1b57ca7a1c86661e9a323bc41c97ecc) --- sys/compat/linuxkpi/common/include/asm/uaccess.h | 4 ---- sys/compat/linuxkpi/common/include/linux/compiler.h | 3 --- sys/compat/linuxkpi/common/include/linux/uaccess.h | 4 ---- sys/dev/pms/freebsd/driver/common/lxencrypt.c | 4 ++-- sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 3 +-- 5 files changed, 3 insertions(+), 15 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/asm/uaccess.h b/sys/compat/linuxkpi/common/include/asm/uaccess.h index 0ae20b09dc8c..102373634ba3 100644 --- a/sys/compat/linuxkpi/common/include/asm/uaccess.h +++ b/sys/compat/linuxkpi/common/include/asm/uaccess.h @@ -52,11 +52,7 @@ copy_from_user(void *to, const void *from, unsigned long n) #define __copy_from_user(...) copy_from_user(__VA_ARGS__) #define __copy_in_user(...) copy_from_user(__VA_ARGS__) -#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 #define user_access_begin(ptr, len) access_ok(ptr, len) -#else -#define user_access_begin() do { } while (0) -#endif #define user_access_end() do { } while (0) #define unsafe_get_user(x, ptr, err) do { \ diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h index 1177674aa68f..d8aef4fa7988 100644 --- a/sys/compat/linuxkpi/common/include/linux/compiler.h +++ b/sys/compat/linuxkpi/common/include/linux/compiler.h @@ -81,11 +81,8 @@ #define barrier() __asm__ __volatile__("": : :"memory") -#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 -/* Moved from drm_os_freebsd.h */ #define lower_32_bits(n) ((u32)(n)) #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) -#endif #define ___PASTE(a,b) a##b #define __PASTE(a,b) ___PASTE(a,b) diff --git a/sys/compat/linuxkpi/common/include/linux/uaccess.h b/sys/compat/linuxkpi/common/include/linux/uaccess.h index c09c363a98a7..10a06a220f86 100644 --- a/sys/compat/linuxkpi/common/include/linux/uaccess.h +++ b/sys/compat/linuxkpi/common/include/linux/uaccess.h @@ -61,11 +61,7 @@ #define put_user(_x, _p) __put_user(_x, _p) #define clear_user(...) linux_clear_user(__VA_ARGS__) -#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 #define access_ok(a,b) linux_access_ok(a,b) -#else -#define access_ok(a,b,c) linux_access_ok(b,c) -#endif extern int linux_copyin(const void *uaddr, void *kaddr, size_t len); extern int linux_copyout(const void *kaddr, void *uaddr, size_t len); diff --git a/sys/dev/pms/freebsd/driver/common/lxencrypt.c b/sys/dev/pms/freebsd/driver/common/lxencrypt.c index c53c52fb2378..0d469f9fdbf7 100644 --- a/sys/dev/pms/freebsd/driver/common/lxencrypt.c +++ b/sys/dev/pms/freebsd/driver/common/lxencrypt.c @@ -838,7 +838,7 @@ printf("%s: Minor %d\n", __FUNCTION__, pIoctlPayload->hdr.MinorFunction); printf("%s: Add kek at index 0x%x wrapper 0x%x format 0x%x\n", __FUNCTION__, kek_add->kekIndex, kek_add->wrapperKekIndex, kek_add->blobFormat); /* Copy kek_blob from user pointer to local buffer */ - if(access_ok(VERIFY_READ, kek_add->EncryptKekBlob, sizeof(kek_blob))) { + if(access_ok(kek_add->EncryptKekBlob, sizeof(kek_blob))) { printf("%s: Starting copy from user %p to kernel %p\n", __FUNCTION__, kek_add->EncryptKekBlob, &kek_blob); if((rv = copy_from_user(&kek_blob, kek_add->EncryptKekBlob, sizeof(kek_blob))) != 0) { printf("%s: Copy error, %d left\n", __FUNCTION__, rv); @@ -873,7 +873,7 @@ printf("%s: Minor %d\n", __FUNCTION__, pIoctlPayload->hdr.MinorFunction); printf("%s: Add dek at index 0x%x, table %x, kek index %x, blob format %x, entry size %x\n", __FUNCTION__, dek_index, dek_table, kek_index, blob_format, entry_sz); /* Copy dek_blob from user pointer to local buffer */ - if(access_ok(VERIFY_READ, dek_add->dekBlob, sizeof(dek_blob))) { + if(access_ok(dek_add->dekBlob, sizeof(dek_blob))) { printf("%s: Starting copy from user %p to kernel %p\n", __FUNCTION__, dek_add->dekBlob, &dek_blob); if((rv = copy_from_user(&dek_blob, dek_add->dekBlob, sizeof(dek_blob))) != 0) { printf("%s: Copy error, %d left\n", __FUNCTION__, rv); diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index 8aab2ac3ff8d..e1b560774fbc 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -856,8 +856,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, goto out; } - if (!access_ok(VERIFY_WRITE, - (void __user *) (unsigned long) ex_hdr.response, + if (!access_ok((void __user *) (unsigned long) ex_hdr.response, (hdr.out_words + ex_hdr.provider_out_words) * 8)) { ret = -EFAULT; goto out; From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E91A965F09D; Sun, 18 Jul 2021 00:36:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cc2vjCz4R53; Sun, 18 Jul 2021 00:36:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B866E1A3C1; Sun, 18 Jul 2021 00:35:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZxV2048531; Sun, 18 Jul 2021 00:35:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0Zx47048530; Sun, 18 Jul 2021 00:35:59 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:59 GMT Message-Id: <202107180035.16I0Zx47048530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f81b4f3be750 - stable/13 - qlnxr: remove duplicate defines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f81b4f3be750012f5ede7c4d0b71b3f457eb8e7d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:02 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f81b4f3be750012f5ede7c4d0b71b3f457eb8e7d commit f81b4f3be750012f5ede7c4d0b71b3f457eb8e7d Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 14:31:37 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 qlnxr: remove duplicate defines upper_32_bits() and lower_32_bits() are defined twice in this file. With the extra conditinal removed on LinuxKPI in 3b1ecc9fa1b5 they are also included from there already. Use the LinuxKPI version and remove the two local ones. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D29392 (cherry picked from commit 5df6f7a8405899fac795f227de96ebadd10d60af) --- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c index 35b46e11a3b9..9c0087c1b76d 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c @@ -36,8 +36,6 @@ __FBSDID("$FreeBSD$"); #include "qlnxr_roce.h" #include "qlnxr_cm.h" -#define upper_32_bits(x) (uint32_t)(x >> 32) -#define lower_32_bits(x) (uint32_t)(x) #define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo)) #define TYPEPTR_ADDR_SET(type_ptr, field, vaddr) \ @@ -1365,9 +1363,6 @@ qlnxr_prepare_pbl_tbl(struct qlnxr_dev *dev, return 0; } -#define upper_32_bits(x) (uint32_t)(x >> 32) -#define lower_32_bits(x) (uint32_t)(x) - static void qlnxr_populate_pbls(struct qlnxr_dev *dev, struct ib_umem *umem, struct qlnxr_pbl *pbl, struct qlnxr_pbl_info *pbl_info) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 150B365ECFC; Sun, 18 Jul 2021 00:36:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cj2lkJz4RLT; Sun, 18 Jul 2021 00:36:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 570DE1A3C2; Sun, 18 Jul 2021 00:36:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a4P3048629; Sun, 18 Jul 2021 00:36:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a4cJ048628; Sun, 18 Jul 2021 00:36:04 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:04 GMT Message-Id: <202107180036.16I0a4cJ048628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 25002ad61046 - stable/13 - qlnxr: remove netdevice.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 25002ad6104667111f0a9e93452fc3f471e0573c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:06 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=25002ad6104667111f0a9e93452fc3f471e0573c commit 25002ad6104667111f0a9e93452fc3f471e0573c Author: Bjoern A. Zeeb AuthorDate: 2021-03-26 17:17:10 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 qlnxr: remove netdevice.h Remove unused #includes of a LinuxKPI header noticed while trying to solve LinuxKPI struct net_device and related functions. This takes qlnxr out of the picture of D29366. Sponsored by: The FreeBSD Foundation (cherry picked from commit 6c8dd7c863f111a22c8548ebf5d7e889117a964d) --- sys/dev/qlnx/qlnxr/qlnxr_def.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/qlnx/qlnxr/qlnxr_def.h b/sys/dev/qlnx/qlnxr/qlnxr_def.h index 0d8d33dd2686..9bc663e2a8d0 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_def.h +++ b/sys/dev/qlnx/qlnxr/qlnxr_def.h @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E20E65F311; Sun, 18 Jul 2021 00:36:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5ck0ts8z4R2r; Sun, 18 Jul 2021 00:36:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58E091A46B; Sun, 18 Jul 2021 00:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a5LU048656; Sun, 18 Jul 2021 00:36:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a50G048655; Sun, 18 Jul 2021 00:36:05 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:05 GMT Message-Id: <202107180036.16I0a50G048655@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0bbb50ec872d - stable/13 - cxgbe: remove unused linux headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0bbb50ec872d6997a70e4ca55cfba548504410e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:07 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0bbb50ec872d6997a70e4ca55cfba548504410e6 commit 0bbb50ec872d6997a70e4ca55cfba548504410e6 Author: Bjoern A. Zeeb AuthorDate: 2021-03-26 16:10:25 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 cxgbe: remove unused linux headers Remove unused #includes of LinuxKPI headers noticed while trying to solve LinuxKPI struct net_device and related functions. Neither netdevice.h nor inetdevice.h nor notifier.h seem to be needed. This takes cxgbe(4) out of the picture of D29366. Sponsored by: The FreeBSD Foundation Reviewed by: np Differential Revision: https://reviews.freebsd.org/D29432 (cherry picked from commit 0a7b99553f5c1e68868e3cbaccb3160eb1a7d1d6) --- sys/dev/cxgbe/iw_cxgbe/cm.c | 2 -- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 1 - 2 files changed, 3 deletions(-) diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c index 9f6f5411733c..b83622cc3c65 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -73,8 +73,6 @@ struct cpl_set_tcb_rpl; #include "iw_cxgbe.h" #include #include -#include -#include #include #include #include diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index 5f26eccc1d1b..aa94a40add1e 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C613665F0B5; Sun, 18 Jul 2021 00:36:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cm4BRmz4RJY; Sun, 18 Jul 2021 00:36:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A21B1A3C3; Sun, 18 Jul 2021 00:36:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a6l4048683; Sun, 18 Jul 2021 00:36:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a69E048682; Sun, 18 Jul 2021 00:36:06 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:06 GMT Message-Id: <202107180036.16I0a69E048682@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f752ee737f2f - stable/13 - LinuxKPI/OFED: (re)move inetdevice.h implementation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f752ee737f2f9125d696801723c3c2a65551383a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:10 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f752ee737f2f9125d696801723c3c2a65551383a commit f752ee737f2f9125d696801723c3c2a65551383a Author: Bjoern A. Zeeb AuthorDate: 2021-03-26 17:52:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 LinuxKPI/OFED: (re)move inetdevice.h implementation The two functions in linux/inetdevice.h are highly FreeBSD/ifnet specific. This is a result of struct net_device being mapped to struct ifnet. The only known consumer of these functions are two files in the ofed/infiniband code. As a first step of cleaning up copy linux/inetdevice.h to rdma/ib_addr_freebsd.h. (It stayed a separate file to preserve copyright and license of the original file; otherwise it could be merged into ib_addr.h where more EPOCH/vnet/.. are already used). Slightly rename the function to not conflict with LinuxKPI in the future. Remove the three last, now unneeded includes of inetdevice.h and zap linux/inetdevice.h to an empty header file with only the forward include to netdevice.h remaining. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D29434 (cherry picked from commit 7069b4c6a4e516e1435d8beb7a436d88193156d3) --- .../linuxkpi/common/include/linux/inetdevice.h | 87 -------------------- sys/ofed/drivers/infiniband/core/ib_addr.c | 10 +-- sys/ofed/drivers/infiniband/core/ib_cma.c | 6 +- sys/ofed/include/rdma/ib_addr.h | 1 - sys/ofed/include/rdma/ib_addr_freebsd.h | 95 ++++++++++++++++++++++ 5 files changed, 103 insertions(+), 96 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/inetdevice.h b/sys/compat/linuxkpi/common/include/linux/inetdevice.h index 87c880392b71..41852e8fed81 100644 --- a/sys/compat/linuxkpi/common/include/linux/inetdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/inetdevice.h @@ -1,93 +1,6 @@ -/*- - * Copyright (c) 2010 Isilon Systems, Inc. - * Copyright (c) 2010 iX Systems, Inc. - * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ #ifndef _LINUX_INETDEVICE_H_ #define _LINUX_INETDEVICE_H_ #include -static inline struct net_device * -ip_dev_find(struct vnet *vnet, uint32_t addr) -{ - struct sockaddr_in sin; - struct epoch_tracker et; - struct ifaddr *ifa; - struct ifnet *ifp; - - memset(&sin, 0, sizeof(sin)); - sin.sin_addr.s_addr = addr; - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - NET_EPOCH_ENTER(et); - CURVNET_SET_QUIET(vnet); - ifa = ifa_ifwithaddr((struct sockaddr *)&sin); - CURVNET_RESTORE(); - if (ifa) { - ifp = ifa->ifa_ifp; - if_ref(ifp); - } else { - ifp = NULL; - } - NET_EPOCH_EXIT(et); - return (ifp); -} - -static inline struct net_device * -ip6_dev_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) -{ - struct sockaddr_in6 sin6; - struct epoch_tracker et; - struct ifaddr *ifa; - struct ifnet *ifp; - - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_addr = addr; - sin6.sin6_len = sizeof(sin6); - sin6.sin6_family = AF_INET6; - if (IN6_IS_SCOPE_LINKLOCAL(&addr) || - IN6_IS_ADDR_MC_INTFACELOCAL(&addr)) { - /* embed the IPv6 scope ID */ - sin6.sin6_addr.s6_addr16[1] = htons(scope_id); - } - NET_EPOCH_ENTER(et); - CURVNET_SET_QUIET(vnet); - ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); - CURVNET_RESTORE(); - if (ifa != NULL) { - ifp = ifa->ifa_ifp; - if_ref(ifp); - } else { - ifp = NULL; - } - NET_EPOCH_EXIT(et); - return (ifp); -} - #endif /* _LINUX_INETDEVICE_H_ */ diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index 7d0055032903..f8c1cb180af8 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -47,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -181,13 +181,13 @@ int rdma_translate_ip(const struct sockaddr *addr, } else switch (addr->sa_family) { #ifdef INET case AF_INET: - dev = ip_dev_find(dev_addr->net, + dev = ip_ifp_find(dev_addr->net, ((const struct sockaddr_in *)addr)->sin_addr.s_addr); break; #endif #ifdef INET6 case AF_INET6: - dev = ip6_dev_find(dev_addr->net, + dev = ip6_ifp_find(dev_addr->net, ((const struct sockaddr_in6 *)addr)->sin6_addr, 0); break; #endif @@ -325,7 +325,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, if (addr->bound_dev_if != 0) { ifp = dev_get_by_index(addr->net, addr->bound_dev_if); } else { - ifp = ip_dev_find(addr->net, src_in->sin_addr.s_addr); + ifp = ip_ifp_find(addr->net, src_in->sin_addr.s_addr); } /* check source interface */ @@ -516,7 +516,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, if (addr->bound_dev_if != 0) { ifp = dev_get_by_index(addr->net, addr->bound_dev_if); } else { - ifp = ip6_dev_find(addr->net, src_in->sin6_addr, 0); + ifp = ip6_ifp_find(addr->net, src_in->sin6_addr, 0); } /* check source interface */ diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 215a3c7aae35..717d7c70e9de 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -66,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1364,7 +1364,7 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev, ipv4_is_loopback(saddr)) return false; - dst_dev = ip_dev_find(net_dev->if_vnet, daddr); + dst_dev = ip_ifp_find(net_dev->if_vnet, daddr); if (dst_dev != net_dev) { if (dst_dev != NULL) dev_put(dst_dev); @@ -1402,7 +1402,7 @@ static bool validate_ipv6_net_dev(struct net_device *net_dev, struct nhop_object *nh; bool ret; - dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr, + dst_dev = ip6_ifp_find(net_dev->if_vnet, dst_tmp.sin6_addr, net_dev->if_index); if (dst_dev != net_dev) { if (dst_dev != NULL) diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h index 15d6a937c4db..052fc636f617 100644 --- a/sys/ofed/include/rdma/ib_addr.h +++ b/sys/ofed/include/rdma/ib_addr.h @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include diff --git a/sys/ofed/include/rdma/ib_addr_freebsd.h b/sys/ofed/include/rdma/ib_addr_freebsd.h new file mode 100644 index 000000000000..5ce5f2f8a5ed --- /dev/null +++ b/sys/ofed/include/rdma/ib_addr_freebsd.h @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _RDMA_IB_ADDR_FREEBSD_H +#define _RDMA_IB_ADDR_FREEBSD_H + +#ifdef INET +static inline struct ifnet * +ip_ifp_find(struct vnet *vnet, uint32_t addr) +{ + struct sockaddr_in sin; + struct epoch_tracker et; + struct ifaddr *ifa; + struct ifnet *ifp; + + memset(&sin, 0, sizeof(sin)); + sin.sin_addr.s_addr = addr; + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + NET_EPOCH_ENTER(et); + CURVNET_SET_QUIET(vnet); + ifa = ifa_ifwithaddr((struct sockaddr *)&sin); + CURVNET_RESTORE(); + if (ifa) { + ifp = ifa->ifa_ifp; + if_ref(ifp); + } else { + ifp = NULL; + } + NET_EPOCH_EXIT(et); + return (ifp); +} +#endif + +#ifdef INET6 +static inline struct ifnet * +ip6_ifp_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) +{ + struct sockaddr_in6 sin6; + struct epoch_tracker et; + struct ifaddr *ifa; + struct ifnet *ifp; + + memset(&sin6, 0, sizeof(sin6)); + sin6.sin6_addr = addr; + sin6.sin6_len = sizeof(sin6); + sin6.sin6_family = AF_INET6; + if (IN6_IS_SCOPE_LINKLOCAL(&addr) || + IN6_IS_ADDR_MC_INTFACELOCAL(&addr)) { + /* embed the IPv6 scope ID */ + sin6.sin6_addr.s6_addr16[1] = htons(scope_id); + } + NET_EPOCH_ENTER(et); + CURVNET_SET_QUIET(vnet); + ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); + CURVNET_RESTORE(); + if (ifa != NULL) { + ifp = ifa->ifa_ifp; + if_ref(ifp); + } else { + ifp = NULL; + } + NET_EPOCH_EXIT(et); + return (ifp); +} +#endif + +#endif /* _RDMA_IB_ADDR_FREEBSD_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C7B565F144; Sun, 18 Jul 2021 00:36:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cn30Wpz4RRJ; Sun, 18 Jul 2021 00:36:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA5AB1A68E; Sun, 18 Jul 2021 00:36:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a884048731; Sun, 18 Jul 2021 00:36:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a8Nd048730; Sun, 18 Jul 2021 00:36:08 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:08 GMT Message-Id: <202107180036.16I0a8Nd048730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: bdce1eea714c - stable/13 - LinuxKPI: treat firmware file names more lenient MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bdce1eea714cc6887206cff0fd02c06724390fe4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:11 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bdce1eea714cc6887206cff0fd02c06724390fe4 commit bdce1eea714cc6887206cff0fd02c06724390fe4 Author: Bjoern A. Zeeb AuthorDate: 2021-03-31 15:25:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 LinuxKPI: treat firmware file names more lenient A lot of firmware files have a "-" in the name. That "-" is a problem when dealing with shell variables or loader (e.g., auto-loading .ko). It may thus often be convenient to generate firmware kernel object files with s/-/_/g in the name. In order to automatically find them from drivers using LinuxKPI also substitue the '-' for a '_' like we do for '/' and '.' already. Reviewed by: hselasky, manu (ok) Differential Revision: https://reviews.freebsd.org/D29514 (cherry picked from commit 37c3241a43160dd236bd4767fce46e846cb17227) --- sys/compat/linuxkpi/common/src/linux_firmware.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c index 75147a311827..289779c5246c 100644 --- a/sys/compat/linuxkpi/common/src/linux_firmware.c +++ b/sys/compat/linuxkpi/common/src/linux_firmware.c @@ -85,9 +85,10 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * fwimg = fw_name; fbdfw = firmware_get_flags(fwimg, flags); } - /* (3) Flatten '/' and then '.' to '_' and try with adjusted name. */ + /* (3) Flatten '/', '.' and '-' to '_' and try with adjusted name. */ if (fbdfw == NULL && - (strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL)) { + (strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL || + strchr(fw_name, '-'))) { fwimg = strdup(fw_name, M_LKPI_FW); if (fwimg != NULL) { while ((p = strchr(fwimg, '/')) != NULL) @@ -98,6 +99,11 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * *p = '_'; fbdfw = firmware_get_flags(fwimg, flags); } + if (fbdfw == NULL) { + while ((p = strchr(fwimg, '-')) != NULL) + *p = '_'; + fbdfw = firmware_get_flags(fwimg, flags); + } free(__DECONST(void *, fwimg), M_LKPI_FW); } } From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99ACB65F29A; Sun, 18 Jul 2021 00:36:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cg4FFSz4RLM; Sun, 18 Jul 2021 00:36:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2430A1A68D; Sun, 18 Jul 2021 00:36:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a329048605; Sun, 18 Jul 2021 00:36:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a3p1048604; Sun, 18 Jul 2021 00:36:03 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:03 GMT Message-Id: <202107180036.16I0a3p1048604@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 6040536c43fd - stable/13 - mlx4: remove no longer needed header MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6040536c43fd5e1b47ab73a865ec4e9722bc8746 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:05 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=6040536c43fd5e1b47ab73a865ec4e9722bc8746 commit 6040536c43fd5e1b47ab73a865ec4e9722bc8746 Author: Bjoern A. Zeeb AuthorDate: 2021-03-26 15:28:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 mlx4: remove no longer needed header Remove linux/inetdevice.h as neither of the two inline functions there are used here. Sposored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D29428 (cherry picked from commit 5a461a86cf5bb0ac4ffde3caf03df0386ddad6cc) --- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index 2d628c7868cb..b31744e73be6 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5326A65F404; Sun, 18 Jul 2021 00:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cp4GWZz4RCt; Sun, 18 Jul 2021 00:36:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FA5C1A613; Sun, 18 Jul 2021 00:36:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a9iJ048755; Sun, 18 Jul 2021 00:36:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a9PC048754; Sun, 18 Jul 2021 00:36:09 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:09 GMT Message-Id: <202107180036.16I0a9PC048754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ee0eb6c07c78 - stable/13 - LinuxKPI: add guid_t for ACPI consumers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ee0eb6c07c78d1400ba3ceacd5eb0bb50a3ae8a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:12 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ee0eb6c07c78d1400ba3ceacd5eb0bb50a3ae8a4 commit ee0eb6c07c78d1400ba3ceacd5eb0bb50a3ae8a4 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:50:10 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 LinuxKPI: add guid_t for ACPI consumers. Add a placeholder struct for guid_t which is needed by ACPI consumers in at least one wireless driver. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30439 (cherry picked from commit cae1683120e2bf8e39901d29a17c473401653985) --- sys/compat/linuxkpi/common/include/linux/acpi.h | 1 + sys/compat/linuxkpi/common/include/linux/uuid.h | 40 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/acpi.h b/sys/compat/linuxkpi/common/include/linux/acpi.h index 068e0fe6fb06..b1e65b9afad9 100644 --- a/sys/compat/linuxkpi/common/include/linux/acpi.h +++ b/sys/compat/linuxkpi/common/include/linux/acpi.h @@ -32,6 +32,7 @@ #define _LINUX_ACPI_H_ #include +#include #if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) diff --git a/sys/compat/linuxkpi/common/include/linux/uuid.h b/sys/compat/linuxkpi/common/include/linux/uuid.h new file mode 100644 index 000000000000..f2ff450ee907 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/uuid.h @@ -0,0 +1,40 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_UUID_H +#define __LKPI_LINUX_UUID_H + +typedef struct { + char x[16]; +} guid_t; + +#endif /* __LKPI_LINUX_UUID_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C467C65F40B; Sun, 18 Jul 2021 00:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cs497qz4RJv; Sun, 18 Jul 2021 00:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48A2019E4E; Sun, 18 Jul 2021 00:36:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aCVZ048809; Sun, 18 Jul 2021 00:36:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aCFL048808; Sun, 18 Jul 2021 00:36:12 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:12 GMT Message-Id: <202107180036.16I0aCFL048808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 31b65faae8a2 - stable/13 - LinuxKPI: extract stringify() in their own header file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 31b65faae8a2ff9f93be332d3bfa210c79ae3893 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:14 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=31b65faae8a2ff9f93be332d3bfa210c79ae3893 commit 31b65faae8a2ff9f93be332d3bfa210c79ae3893 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:53:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: extract stringify() in their own header file Add linux/stringify.h as directly included by drivers. Remove the definitions from compiler.h and include the new header in places where the stringify macros are already used without linuxkpi. I have adjusted the Copyright of the new file according to the commit originaly adding the macros (99e690772adbcb78c9e8441bedcf1913d72ea72f). Sposnored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30440 (cherry picked from commit 43b4c00643bacb9d1ba3aa1022648104bc7ff4a2) --- .../linuxkpi/common/include/linux/compiler.h | 2 -- sys/compat/linuxkpi/common/include/linux/kernel.h | 1 + sys/compat/linuxkpi/common/include/linux/module.h | 1 + .../linuxkpi/common/include/linux/stringify.h | 37 ++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/sysfs.h | 1 + 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h index d8aef4fa7988..470e1f151413 100644 --- a/sys/compat/linuxkpi/common/include/linux/compiler.h +++ b/sys/compat/linuxkpi/common/include/linux/compiler.h @@ -60,8 +60,6 @@ #define __percpu #define __weak __weak_symbol #define __malloc -#define ___stringify(...) #__VA_ARGS__ -#define __stringify(...) ___stringify(__VA_ARGS__) #define __attribute_const__ __attribute__((__const__)) #undef __always_inline #define __always_inline inline diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 46b11d89652b..0ac0f9cc964c 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -45,6 +45,7 @@ #include #include +#include #include #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/module.h b/sys/compat/linuxkpi/common/include/linux/module.h index a5a8dd540dd6..cd5366bc52d0 100644 --- a/sys/compat/linuxkpi/common/include/linux/module.h +++ b/sys/compat/linuxkpi/common/include/linux/module.h @@ -37,6 +37,7 @@ #include #include +#include #include #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/stringify.h b/sys/compat/linuxkpi/common/include/linux/stringify.h new file mode 100644 index 000000000000..08fd0d909fae --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/stringify.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies, Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_STRINGIFY_H_ +#define __LKPI_LINUX_STRINGIFY_H_ + +#include + +#define ___stringify(...) #__VA_ARGS__ +#define __stringify(...) ___stringify(__VA_ARGS__) + +#endif /* __LKPI_LINUX_STRINGIFY_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h index c645d9fdf45a..f84790f1b910 100644 --- a/sys/compat/linuxkpi/common/include/linux/sysfs.h +++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h @@ -36,6 +36,7 @@ #include #include +#include struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5644D65EE45; Sun, 18 Jul 2021 00:35:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cW3GdGz4RFS; Sun, 18 Jul 2021 00:35:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3423D1A46A; Sun, 18 Jul 2021 00:35:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0Zt5Y048429; Sun, 18 Jul 2021 00:35:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZtBr048428; Sun, 18 Jul 2021 00:35:55 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:55 GMT Message-Id: <202107180035.16I0ZtBr048428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3fe9c5b2b0a0 - stable/13 - LinuxKPI: if_ether additions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3fe9c5b2b0a06a6418ecf3df5863f420c71f6dfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:56 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3fe9c5b2b0a06a6418ecf3df5863f420c71f6dfb commit 3fe9c5b2b0a06a6418ecf3df5863f420c71f6dfb Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 16:44:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 LinuxKPI: if_ether additions Add various protocol IDs found in various wireless drivers. Also add ETH_FRAME_LEN and struct ethhdr. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D29397 (cherry picked from commit 3cce818c46f58c0089d34a00478c3b7fa3b57c09) --- sys/compat/linuxkpi/common/include/linux/if_ether.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/if_ether.h b/sys/compat/linuxkpi/common/include/linux/if_ether.h index 77e8f1192816..187446c4c591 100644 --- a/sys/compat/linuxkpi/common/include/linux/if_ether.h +++ b/sys/compat/linuxkpi/common/include/linux/if_ether.h @@ -39,17 +39,29 @@ #ifndef ETH_ALEN #define ETH_ALEN ETHER_ADDR_LEN #endif +#define ETH_FRAME_LEN (ETHER_MAX_LEN - ETHER_CRC_LEN) #define ETH_FCS_LEN 4 /* Octets in the FCS */ #define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) * that VLAN requires. */ /* * defined Ethernet Protocol ID's. */ +#define ETH_P_ARP ETHERTYPE_ARP #define ETH_P_IP ETHERTYPE_IP #define ETH_P_IPV6 ETHERTYPE_IPV6 #define ETH_P_MPLS_UC ETHERTYPE_MPLS #define ETH_P_MPLS_MC ETHERTYPE_MPLS_MCAST #define ETH_P_8021Q ETHERTYPE_VLAN #define ETH_P_8021AD ETHERTYPE_QINQ +#define ETH_P_PAE ETHERTYPE_PAE +#define ETH_P_802_2 ETHERTYPE_8023 +#define ETH_P_LINK_CTL 0x886C /* ITU-T G.989.2 */ +#define ETH_P_TDLS 0x890D /* 802.11z-2010, see wpa. */ + +struct ethhdr { + uint8_t h_dest[ETH_ALEN]; + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; +} __packed; #endif /* _LINUX_IF_ETHER_H_ */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:35:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CC9F65F1DD; Sun, 18 Jul 2021 00:35:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cY6BQYz4RJ4; Sun, 18 Jul 2021 00:35:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6586619E4D; Sun, 18 Jul 2021 00:35:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ZvWX048479; Sun, 18 Jul 2021 00:35:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ZvMa048478; Sun, 18 Jul 2021 00:35:57 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:35:57 GMT Message-Id: <202107180035.16I0ZvMa048478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1ebd9dc37266 - stable/13 - LinuxKPI: add lockdep_map MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1ebd9dc372664b744b9000b45e2744e8e573642c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:35:58 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1ebd9dc372664b744b9000b45e2744e8e573642c commit 1ebd9dc372664b744b9000b45e2744e8e573642c Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 16:51:08 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:58 +0000 LinuxKPI: add lockdep_map Add stubs for struct lockdep_map and three accessor functions used by iwlwifi. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D29398 (cherry picked from commit f1069375d97384754a9e8ee8bc21a32d3ad10987) --- sys/compat/linuxkpi/common/include/linux/lockdep.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/lockdep.h b/sys/compat/linuxkpi/common/include/linux/lockdep.h index e270224b0bde..0bcb1fa7b925 100644 --- a/sys/compat/linuxkpi/common/include/linux/lockdep.h +++ b/sys/compat/linuxkpi/common/include/linux/lockdep.h @@ -36,6 +36,8 @@ struct lock_class_key { }; +struct lockdep_map { +}; #define lockdep_set_class(lock, key) #define lockdep_set_subclass(lock, sub) @@ -90,4 +92,8 @@ lockdep_is_held(void *__m) #define lockdep_repin_lock(l,c) do { } while (0) #define lockdep_unpin_lock(l,c) do { } while (0) +#define lock_map_acquire(_map) do { } while (0) +#define lock_map_acquire_read(_map) do { } while (0) +#define lock_map_release(_map) do { } while (0) + #endif /* _LINUX_LOCKDEP_H_ */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B374F65F40A; Sun, 18 Jul 2021 00:36:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cr0wMkz4RNr; Sun, 18 Jul 2021 00:36:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32C471A46C; Sun, 18 Jul 2021 00:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aBk1048781; Sun, 18 Jul 2021 00:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aBHC048780; Sun, 18 Jul 2021 00:36:11 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:11 GMT Message-Id: <202107180036.16I0aBHC048780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 9b3c89bdc8b7 - stable/13 - LinuxKPI: add kernel_ulong_t typedef in linux/kernel.h. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9b3c89bdc8b73b3364a9cf556e1fb93f273e02cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:12 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9b3c89bdc8b73b3364a9cf556e1fb93f273e02cf commit 9b3c89bdc8b73b3364a9cf556e1fb93f273e02cf Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:47:49 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: add kernel_ulong_t typedef in linux/kernel.h. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30438 (cherry picked from commit 5878c7c7b090c8579316ae4479e962684d49a499) --- sys/compat/linuxkpi/common/include/linux/types.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/types.h b/sys/compat/linuxkpi/common/include/linux/types.h index aa3580c81a27..db362c388573 100644 --- a/sys/compat/linuxkpi/common/include/linux/types.h +++ b/sys/compat/linuxkpi/common/include/linux/types.h @@ -72,6 +72,7 @@ typedef unsigned __poll_t; typedef uint64_t phys_addr_t; typedef size_t __kernel_size_t; +typedef unsigned long kernel_ulong_t; #define DECLARE_BITMAP(n, bits) \ unsigned long n[howmany(bits, sizeof(long) * 8)] From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 283FB65F3A6; Sun, 18 Jul 2021 00:36:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cw6N1lz4RRn; Sun, 18 Jul 2021 00:36:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6C6C1A690; Sun, 18 Jul 2021 00:36:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aFeo048881; Sun, 18 Jul 2021 00:36:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aFUF048880; Sun, 18 Jul 2021 00:36:15 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:15 GMT Message-Id: <202107180036.16I0aFUF048880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 17b99aa321ba - stable/13 - LinuxKPI: add prandom_u32() as used by wireless drivers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 17b99aa321babea211652f7799f0fcf7d1e55361 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:18 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=17b99aa321babea211652f7799f0fcf7d1e55361 commit 17b99aa321babea211652f7799f0fcf7d1e55361 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:38:58 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: add prandom_u32() as used by wireless drivers. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30435 (cherry picked from commit 10096cb60619984eefc628471f219d4723867bb1) --- sys/compat/linuxkpi/common/include/linux/random.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/random.h b/sys/compat/linuxkpi/common/include/linux/random.h index 31d8b996aa0b..12de0e12bc5a 100644 --- a/sys/compat/linuxkpi/common/include/linux/random.h +++ b/sys/compat/linuxkpi/common/include/linux/random.h @@ -63,6 +63,15 @@ get_random_long(void) return (val); } +static __inline uint32_t +prandom_u32(void) +{ + uint32_t val; + + get_random_bytes(&val, sizeof(val)); + return (val); +} + static inline u32 prandom_u32_max(u32 max) { From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 206D865F0D0; Sun, 18 Jul 2021 00:36:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5d24s2Dz4RBC; Sun, 18 Jul 2021 00:36:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31C231A491; Sun, 18 Jul 2021 00:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aKXN048983; Sun, 18 Jul 2021 00:36:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aK7h048982; Sun, 18 Jul 2021 00:36:20 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:20 GMT Message-Id: <202107180036.16I0aK7h048982@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 14ff15e4c5bf - stable/13 - LinuxKPI: change BUILD_BUG_ON() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 14ff15e4c5bf92fcae4730dbf4ac23f9afbdee2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:23 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=14ff15e4c5bf92fcae4730dbf4ac23f9afbdee2d commit 14ff15e4c5bf92fcae4730dbf4ac23f9afbdee2d Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:26:41 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: change BUILD_BUG_ON() BUILD_BUG_ON() can be used inside functions where the definition to CTASSERT() (_Static_assert()) seems to not work. Go back to an old-style CTASSERT() implementation but also add a variable dclaration to avoid "unsued typedef" errors and dummy-use the variable to avoid "unusued variable" errors. Given it is all self-contained in a block and not used outside this should be optimised away. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30431 (cherry picked from commit 1082490cd867a4d443862523c37ce947735342d0) --- sys/compat/linuxkpi/common/include/linux/kernel.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 0ac0f9cc964c..aba5896111f7 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -89,8 +89,23 @@ #define S64_C(x) x ## LL #define U64_C(x) x ## ULL +/* + * BUILD_BUG_ON() can happen inside functions where _Static_assert() does not + * seem to work. Use old-schoold-ish CTASSERT from before commit + * a3085588a88fa58eb5b1eaae471999e1995a29cf but also make sure we do not + * end up with an unused typedef or variable. The compiler should optimise + * it away entirely. + */ +#define _O_CTASSERT(x) _O__CTASSERT(x, __LINE__) +#define _O__CTASSERT(x, y) _O___CTASSERT(x, y) +#define _O___CTASSERT(x, y) while (0) { \ + typedef char __assert_line_ ## y[(x) ? 1 : -1]; \ + __assert_line_ ## y _x; \ + _x[0] = '\0'; \ +} + #define BUILD_BUG() do { CTASSERT(0); } while (0) -#define BUILD_BUG_ON(x) CTASSERT(!(x)) +#define BUILD_BUG_ON(x) _O_CTASSERT(!(x)) #define BUILD_BUG_ON_MSG(x, msg) BUILD_BUG_ON(x) #define BUILD_BUG_ON_NOT_POWER_OF_2(x) BUILD_BUG_ON(!powerof2(x)) #define BUILD_BUG_ON_INVALID(expr) while (0) { (void)(expr); } From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2141A65F505; Sun, 18 Jul 2021 00:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cy6rkgz4RMC; Sun, 18 Jul 2021 00:36:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E09F41A490; Sun, 18 Jul 2021 00:36:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aHIh048935; Sun, 18 Jul 2021 00:36:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aHH4048934; Sun, 18 Jul 2021 00:36:17 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:17 GMT Message-Id: <202107180036.16I0aHH4048934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 2b503ba64af0 - stable/13 - LinuxKPI: add LINUXKPI_PARAM_charp() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b503ba64af094f2eaebc2b86ede06c27576a816 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:21 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2b503ba64af094f2eaebc2b86ede06c27576a816 commit 2b503ba64af094f2eaebc2b86ede06c27576a816 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:32:11 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: add LINUXKPI_PARAM_charp() Add yet another version of the various module_param_named() use cases. This one deals with "charp". Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30433 (cherry picked from commit c1661d59e68e29a817c870f421a6871563039dbb) --- sys/compat/linuxkpi/common/include/linux/moduleparam.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/moduleparam.h b/sys/compat/linuxkpi/common/include/linux/moduleparam.h index 3a16c20fd92e..2b48ec1809b7 100644 --- a/sys/compat/linuxkpi/common/include/linux/moduleparam.h +++ b/sys/compat/linuxkpi/common/include/linux/moduleparam.h @@ -102,6 +102,12 @@ LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) +#define LINUXKPI_PARAM_charp(name, var, perm) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_STRING(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + #define module_param_string(name, str, len, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_STRING(LINUXKPI_PARAM_PARENT, OID_AUTO, \ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7532465F22E; Sun, 18 Jul 2021 00:36:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cd2pRcz4RCW; Sun, 18 Jul 2021 00:36:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB4271A612; Sun, 18 Jul 2021 00:36:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a0ZH048557; Sun, 18 Jul 2021 00:36:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a0SP048556; Sun, 18 Jul 2021 00:36:00 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:00 GMT Message-Id: <202107180036.16I0a0SP048556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 834afdc9242d - stable/13 - LinuxKPI: add net_ratelimit() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 834afdc9242db433def9f5aad2a75dc2f558142c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:02 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=834afdc9242db433def9f5aad2a75dc2f558142c commit 834afdc9242db433def9f5aad2a75dc2f558142c Author: Bjoern A. Zeeb AuthorDate: 2021-03-23 17:00:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 LinuxKPI: add net_ratelimit() Add a net_ratelimit() compat implementation based on ppsratecheck(). Add a sysctl to allow tuning of the number of messages. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D29399 (cherry picked from commit bc042266b2bfc3f52f685df7ccdd6e857b4b9da9) --- sys/compat/linuxkpi/common/include/linux/net.h | 10 ++++++++++ sys/compat/linuxkpi/common/src/linux_compat.c | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/net.h b/sys/compat/linuxkpi/common/include/linux/net.h index 282a45d2db32..5365cd0e9552 100644 --- a/sys/compat/linuxkpi/common/include/linux/net.h +++ b/sys/compat/linuxkpi/common/include/linux/net.h @@ -76,4 +76,14 @@ sock_release(struct socket *so) soclose(so); } + +int linuxkpi_net_ratelimit(void); + +static inline int +net_ratelimit(void) +{ + + return (linuxkpi_net_ratelimit()); +} + #endif /* _LINUX_NET_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 4337f1f7bbd7..9dfa5446e0cc 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -99,6 +100,12 @@ int linuxkpi_debug; SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); +static struct timeval lkpi_net_lastlog; +static int lkpi_net_curpps; +static int lkpi_net_maxpps = 99; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, net_ratelimit, CTLFLAG_RWTUN, + &lkpi_net_maxpps, 0, "Limit number of LinuxKPI net messages per second."); + MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat"); #include @@ -2565,6 +2572,14 @@ linux_dump_stack(void) #endif } +int +linuxkpi_net_ratelimit(void) +{ + + return (ppsratecheck(&lkpi_net_lastlog, &lkpi_net_curpps, + lkpi_net_maxpps)); +} + #if defined(__i386__) || defined(__amd64__) bool linux_cpu_has_clflush; #endif From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DE2665F494; Sun, 18 Jul 2021 00:36:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5d10vnyz4RMR; Sun, 18 Jul 2021 00:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F3B61A46D; Sun, 18 Jul 2021 00:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aI50048959; Sun, 18 Jul 2021 00:36:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aIKl048958; Sun, 18 Jul 2021 00:36:18 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:18 GMT Message-Id: <202107180036.16I0aIKl048958@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0a8cab2b6093 - stable/13 - LinuxKPI: add ktime_get_boottime_ns() implementation to ktime.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a8cab2b60936ce34b4aab67e853c2fd672ef79d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:22 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0a8cab2b60936ce34b4aab67e853c2fd672ef79d commit 0a8cab2b60936ce34b4aab67e853c2fd672ef79d Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:30:33 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: add ktime_get_boottime_ns() implementation to ktime.h Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30432 (cherry picked from commit 18d303b05f28acf005dad3f2ffbbec4895181dde) --- sys/compat/linuxkpi/common/include/linux/ktime.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/ktime.h b/sys/compat/linuxkpi/common/include/linux/ktime.h index e480de3181a9..1475674a12e6 100644 --- a/sys/compat/linuxkpi/common/include/linux/ktime.h +++ b/sys/compat/linuxkpi/common/include/linux/ktime.h @@ -220,6 +220,13 @@ ktime_get_boottime(void) return (timespec_to_ktime(ts)); } +static inline uint64_t +ktime_get_boottime_ns(void) +{ + + return (ktime_to_ns(ktime_get_boottime())); +} + static inline ktime_t ktime_get_real(void) { From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D3E465F1E5; Sun, 18 Jul 2021 00:36:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cf449Jz4R7j; Sun, 18 Jul 2021 00:36:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 077971A325; Sun, 18 Jul 2021 00:36:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a1xR048581; Sun, 18 Jul 2021 00:36:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a12W048580; Sun, 18 Jul 2021 00:36:01 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:01 GMT Message-Id: <202107180036.16I0a12W048580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0bb237770e36 - stable/13 - LinuxKPI: netdevice notifier callback argument MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0bb237770e36d93d7f23c22f61d3acb8e37dba43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:03 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0bb237770e36d93d7f23c22f61d3acb8e37dba43 commit 0bb237770e36d93d7f23c22f61d3acb8e37dba43 Author: Bjoern A. Zeeb AuthorDate: 2021-03-21 21:18:34 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 LinuxKPI: netdevice notifier callback argument Introduce struct netdev_notifier_info as a container to pass net_device to the callback functions. Adjust netdev_notifier_info_to_dev() to return the net_device field. Add explicit casts from ifp to ni->dev even though currently struct net_device is defined to struct ifnet. This is needed in preparation for untangling this and improving the net_device compat code. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D29365 (cherry picked from commit fdcfe8a298e23bef9588cafad2672e0c5f48a327) --- .../linuxkpi/common/include/linux/netdevice.h | 27 +++++++++++++--------- sys/compat/linuxkpi/common/src/linux_compat.c | 22 +++++++++++++----- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h index 336215b9f7c5..9ec76d9b90ef 100644 --- a/sys/compat/linuxkpi/common/include/linux/netdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h @@ -88,17 +88,6 @@ netdev_priv(const struct net_device *dev) return (dev->if_softc); } -static inline struct net_device * -netdev_notifier_info_to_dev(void *ifp) -{ - return (ifp); -} - -int register_netdevice_notifier(struct notifier_block *); -int register_inetaddr_notifier(struct notifier_block *); -int unregister_netdevice_notifier(struct notifier_block *); -int unregister_inetaddr_notifier(struct notifier_block *); - #define rtnl_lock() #define rtnl_unlock() @@ -140,4 +129,20 @@ dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly) return -if_addmulti(dev, (struct sockaddr *)&sdl, NULL); } +/* According to linux::ipoib_main.c. */ +struct netdev_notifier_info { + struct net_device *dev; +}; + +static inline struct net_device * +netdev_notifier_info_to_dev(struct netdev_notifier_info *ni) +{ + return (ni->dev); +} + +int register_netdevice_notifier(struct notifier_block *); +int register_inetaddr_notifier(struct notifier_block *); +int unregister_netdevice_notifier(struct notifier_block *); +int unregister_inetaddr_notifier(struct notifier_block *); + #endif /* _LINUX_NETDEVICE_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 9dfa5446e0cc..a8f090ed0bd5 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2310,48 +2310,58 @@ static void linux_handle_ifnet_link_event(void *arg, struct ifnet *ifp, int linkstate) { struct notifier_block *nb; + struct netdev_notifier_info ni; nb = arg; + ni.dev = (struct net_device *)ifp; if (linkstate == LINK_STATE_UP) - nb->notifier_call(nb, NETDEV_UP, ifp); + nb->notifier_call(nb, NETDEV_UP, &ni); else - nb->notifier_call(nb, NETDEV_DOWN, ifp); + nb->notifier_call(nb, NETDEV_DOWN, &ni); } static void linux_handle_ifnet_arrival_event(void *arg, struct ifnet *ifp) { struct notifier_block *nb; + struct netdev_notifier_info ni; nb = arg; - nb->notifier_call(nb, NETDEV_REGISTER, ifp); + ni.dev = (struct net_device *)ifp; + nb->notifier_call(nb, NETDEV_REGISTER, &ni); } static void linux_handle_ifnet_departure_event(void *arg, struct ifnet *ifp) { struct notifier_block *nb; + struct netdev_notifier_info ni; nb = arg; - nb->notifier_call(nb, NETDEV_UNREGISTER, ifp); + ni.dev = (struct net_device *)ifp; + nb->notifier_call(nb, NETDEV_UNREGISTER, &ni); } static void linux_handle_iflladdr_event(void *arg, struct ifnet *ifp) { struct notifier_block *nb; + struct netdev_notifier_info ni; nb = arg; - nb->notifier_call(nb, NETDEV_CHANGEADDR, ifp); + ni.dev = (struct net_device *)ifp; + nb->notifier_call(nb, NETDEV_CHANGEADDR, &ni); } static void linux_handle_ifaddr_event(void *arg, struct ifnet *ifp) { struct notifier_block *nb; + struct netdev_notifier_info ni; nb = arg; - nb->notifier_call(nb, NETDEV_CHANGEIFADDR, ifp); + ni.dev = (struct net_device *)ifp; + nb->notifier_call(nb, NETDEV_CHANGEIFADDR, &ni); } int From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D7D865F25C; Sun, 18 Jul 2021 00:36:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cn2tpKz4R9Z; Sun, 18 Jul 2021 00:36:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADDC51A3C4; Sun, 18 Jul 2021 00:36:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0a7Y6048707; Sun, 18 Jul 2021 00:36:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0a7Tj048706; Sun, 18 Jul 2021 00:36:07 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:07 GMT Message-Id: <202107180036.16I0a7Tj048706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 57d5000e593b - stable/13 - mlx5: remove dependency on ifnet specifics of linux/netdevice.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57d5000e593b73c335aed7dc0db96596a68aa3a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:11 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=57d5000e593b73c335aed7dc0db96596a68aa3a2 commit 57d5000e593b73c335aed7dc0db96596a68aa3a2 Author: Bjoern A. Zeeb AuthorDate: 2021-03-30 15:58:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:34:59 +0000 mlx5: remove dependency on ifnet specifics of linux/netdevice.h Rename the last remaining bits depending on ifnet from linux/netdevice.h instead of using the compat macros. This helps clearing up struct netdevice being struct ifnet from linux/netdevice.h. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D29497 (cherry picked from commit 4ded022d3b8948e92c8f8353364ff2c79d720e68) --- sys/dev/mlx5/mlx5_en/en.h | 1 - sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 3 ++- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 27 ++++++++++++++------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index b990bb754962..2ec47fa96a6d 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index b9828f1da466..0420b294de80 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -627,7 +628,7 @@ struct mlx5_roce { * netdev pointer */ rwlock_t netdev_lock; - struct net_device *netdev; + struct ifnet *netdev; struct notifier_block nb; atomic_t next_port; }; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index f2485d13d791..c2a01b26de1c 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -93,7 +93,7 @@ mlx5_ib_port_link_layer(struct ib_device *device, u8 port_num) return mlx5_port_type_cap_to_rdma_ll(port_type_cap); } -static bool mlx5_netdev_match(struct net_device *ndev, +static bool mlx5_netdev_match(struct ifnet *ndev, struct mlx5_core_dev *mdev, const char *dname) { @@ -107,7 +107,7 @@ static bool mlx5_netdev_match(struct net_device *ndev, static int mlx5_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { - struct net_device *ndev = netdev_notifier_info_to_dev(ptr); + struct ifnet *ndev = netdev_notifier_info_to_dev(ptr); struct mlx5_ib_dev *ibdev = container_of(this, struct mlx5_ib_dev, roce.nb); @@ -124,7 +124,7 @@ static int mlx5_netdev_event(struct notifier_block *this, case NETDEV_UP: case NETDEV_DOWN: { - struct net_device *upper = NULL; + struct ifnet *upper = NULL; if ((upper == ndev || (!upper && ndev == ibdev->roce.netdev)) && ibdev->ib_active) { @@ -146,18 +146,18 @@ static int mlx5_netdev_event(struct notifier_block *this, return NOTIFY_DONE; } -static struct net_device *mlx5_ib_get_netdev(struct ib_device *device, +static struct ifnet *mlx5_ib_get_netdev(struct ib_device *device, u8 port_num) { struct mlx5_ib_dev *ibdev = to_mdev(device); - struct net_device *ndev; + struct ifnet *ndev; - /* Ensure ndev does not disappear before we invoke dev_hold() + /* Ensure ndev does not disappear before we invoke if_ref() */ read_lock(&ibdev->roce.netdev_lock); ndev = ibdev->roce.netdev; if (ndev) - dev_hold(ndev); + if_ref(ndev); read_unlock(&ibdev->roce.netdev_lock); return ndev; @@ -283,7 +283,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, { struct mlx5_ib_dev *dev = to_mdev(device); u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {}; - struct net_device *ndev; + struct ifnet *ndev; enum ib_mtu ndev_ib_mtu; u16 qkey_viol_cntr; u32 eth_prot_oper; @@ -328,14 +328,15 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, if (!ndev) return 0; - if (netif_running(ndev) && netif_carrier_ok(ndev)) { + if (ndev->if_drv_flags & IFF_DRV_RUNNING && + ndev->if_link_state == LINK_STATE_UP) { props->state = IB_PORT_ACTIVE; props->phys_state = 5; } ndev_ib_mtu = iboe_get_mtu(ndev->if_mtu); - dev_put(ndev); + if_rele(ndev); props->active_mtu = min(props->max_mtu, ndev_ib_mtu); return 0; @@ -437,7 +438,7 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num, if (!attr.ndev) return 0; - dev_put(attr.ndev); + if_rele(attr.ndev); if (attr.gid_type != IB_GID_TYPE_ROCE_UDP_ENCAP) return 0; @@ -459,7 +460,7 @@ int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num, if (!attr.ndev) return -ENODEV; - dev_put(attr.ndev); + if_rele(attr.ndev); *gid_type = attr.gid_type; @@ -3060,7 +3061,7 @@ static void mlx5_remove_roce_notifier(struct mlx5_ib_dev *dev) static int mlx5_enable_roce(struct mlx5_ib_dev *dev) { VNET_ITERATOR_DECL(vnet_iter); - struct net_device *idev; + struct ifnet *idev; int err; /* Check if mlx5en net device already exists */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3EA965F4A8; Sun, 18 Jul 2021 00:36:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5d31r7pz4RKX; Sun, 18 Jul 2021 00:36:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 529EA1A1B2; Sun, 18 Jul 2021 00:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aL3M049007; Sun, 18 Jul 2021 00:36:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aLI4049006; Sun, 18 Jul 2021 00:36:21 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:21 GMT Message-Id: <202107180036.16I0aLI4049006@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b7f41005dbb4 - stable/13 - LinuxKPI: add time_is_after_jiffies() definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b7f41005dbb4dcf6a92a1231387fbc3598c7223f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:24 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b7f41005dbb4dcf6a92a1231387fbc3598c7223f commit b7f41005dbb4dcf6a92a1231387fbc3598c7223f Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:24:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: add time_is_after_jiffies() definition This is used by wireless drivers. Use the time_after() macro as done for the "after_eq" version. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30430 (cherry picked from commit 8620fe4c10922b12492155d97b913deb6c5d82c6) --- sys/compat/linuxkpi/common/include/linux/jiffies.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/jiffies.h b/sys/compat/linuxkpi/common/include/linux/jiffies.h index ed2c5f774d23..7d547e6d66cd 100644 --- a/sys/compat/linuxkpi/common/include/linux/jiffies.h +++ b/sys/compat/linuxkpi/common/include/linux/jiffies.h @@ -53,6 +53,7 @@ #define time_in_range(a,b,c) \ (time_after_eq(a,b) && time_before_eq(a,c)) #define time_is_after_eq_jiffies(a) time_after_eq(a, jiffies) +#define time_is_after_jiffies(a) time_after(a, jiffies) #define HZ hz From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1FE665F3BC; Sun, 18 Jul 2021 00:36:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5d4432Jz4RV9; Sun, 18 Jul 2021 00:36:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 824FB1A326; Sun, 18 Jul 2021 00:36:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aMkZ049031; Sun, 18 Jul 2021 00:36:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aMe6049030; Sun, 18 Jul 2021 00:36:22 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:22 GMT Message-Id: <202107180036.16I0aMe6049030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: deb7fa19a7b0 - stable/13 - LinuxKPI: ipv6.h add missing #include MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: deb7fa19a7b0d703dbe9c2d0aa4505f6c46e4e69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:25 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=deb7fa19a7b0d703dbe9c2d0aa4505f6c46e4e69 commit deb7fa19a7b0d703dbe9c2d0aa4505f6c46e4e69 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:21:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: ipv6.h add missing #include Include linux/bitops.h for a definition of BITS_PER_LONG so that this file can be used independently. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30429 (cherry picked from commit 762efb2d6dd67f7b999d40b10d58828efb473236) --- sys/compat/linuxkpi/common/include/net/ipv6.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/net/ipv6.h b/sys/compat/linuxkpi/common/include/net/ipv6.h index 3eb6051035af..37c30ed6e793 100644 --- a/sys/compat/linuxkpi/common/include/net/ipv6.h +++ b/sys/compat/linuxkpi/common/include/net/ipv6.h @@ -34,6 +34,7 @@ #include #include #include +#include #define IPV6_DEFAULT_HOPLIMIT 64 From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 399F565F4BE; Sun, 18 Jul 2021 00:36:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5d76ZmZz4RSc; Sun, 18 Jul 2021 00:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E113A1A46F; Sun, 18 Jul 2021 00:36:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aPxk049109; Sun, 18 Jul 2021 00:36:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aP8l049108; Sun, 18 Jul 2021 00:36:25 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:25 GMT Message-Id: <202107180036.16I0aP8l049108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 15350a10577e - stable/13 - LinuxKPI: net/if_inet6.h add struct inet6_dev { } MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 15350a10577ef7a7528f5b3d43f0d671f82da863 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:28 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=15350a10577ef7a7528f5b3d43f0d671f82da863 commit 15350a10577ef7a7528f5b3d43f0d671f82da863 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:11:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: net/if_inet6.h add struct inet6_dev { } Add a dummy struct inet6_dev {}; to net/if_inet6.h. This is currently not used for anything but in a declaration. Just needs to be there. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30426 (cherry picked from commit ff09f9133f2fb80f705c2c742fc34291b05140af) --- sys/compat/linuxkpi/common/include/net/if_inet6.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/net/if_inet6.h b/sys/compat/linuxkpi/common/include/net/if_inet6.h index bb4df2615186..16f3a9965675 100644 --- a/sys/compat/linuxkpi/common/include/net/if_inet6.h +++ b/sys/compat/linuxkpi/common/include/net/if_inet6.h @@ -36,6 +36,10 @@ #include +struct inet6_dev { + /* XXX currently unused but in a declaration. */ +}; + static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf) { /* From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9984265F369; Sun, 18 Jul 2021 00:36:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dC0Hrjz4RHK; Sun, 18 Jul 2021 00:36:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F06E1A693; Sun, 18 Jul 2021 00:36:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aSr3049157; Sun, 18 Jul 2021 00:36:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aS90049156; Sun, 18 Jul 2021 00:36:28 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:28 GMT Message-Id: <202107180036.16I0aS90049156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 61976d70a6d6 - stable/13 - LinuxKPI: add dev_crit() to linux/device.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 61976d70a6d625419169aab9e80234ac9d3e225d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:31 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=61976d70a6d625419169aab9e80234ac9d3e225d commit 61976d70a6d625419169aab9e80234ac9d3e225d Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:07:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: add dev_crit() to linux/device.h Sponsored by: The FreeBSD Foundation Reviewed by: emaste, hselasky Differential Revision: https://reviews.freebsd.org/D30424 (cherry picked from commit e7a0b685405f8d51597079e3531f313d9e44b4a4) --- sys/compat/linuxkpi/common/include/linux/device.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 5acaa4142d62..4ef35e6abcd3 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -181,6 +181,7 @@ show_class_attr_string(struct class *class, _CLASS_ATTR_STRING(_name, _mode, _str) #define dev_err(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) +#define dev_crit(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) #define dev_warn(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) #define dev_info(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) #define dev_notice(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A282365F4E3; Sun, 18 Jul 2021 00:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dG2mRtz4RQM; Sun, 18 Jul 2021 00:36:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 882071A470; Sun, 18 Jul 2021 00:36:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aUo8049211; Sun, 18 Jul 2021 00:36:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aUgk049210; Sun, 18 Jul 2021 00:36:30 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:30 GMT Message-Id: <202107180036.16I0aUgk049210@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 9028c49c1675 - stable/13 - LinuxKPI: add cpu.h for cpumask_*() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9028c49c16757c32f52d4a7ba6792d3fea79df75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:37 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9028c49c16757c32f52d4a7ba6792d3fea79df75 commit 9028c49c16757c32f52d4a7ba6792d3fea79df75 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:01:59 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: add cpu.h for cpumask_*() Add linux/cpu.h for cpumask_*() functions found in wireless drivers and make sure cpu_online_mask is always initialised. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30421 (cherry picked from commit 5fce802722cd4435a748d89043615324db4efe5e) --- sys/compat/linuxkpi/common/include/linux/cpu.h | 76 ++++++++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_compat.c | 4 ++ 2 files changed, 80 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/cpu.h b/sys/compat/linuxkpi/common/include/linux/cpu.h new file mode 100644 index 000000000000..5be8f3d5a0d5 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/cpu.h @@ -0,0 +1,76 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_CPU_H +#define __LKPI_LINUX_CPU_H + +#include +#include +#include +#include +#include +#include + +typedef cpuset_t cpumask_t; + +extern cpumask_t cpu_online_mask; + +static __inline int +cpumask_next(int cpuid, cpumask_t mask) +{ + + /* + * -1 can be an input to cpuid according to logic in drivers + * but is never a valid cpuid in a set! + */ + KASSERT((cpuid >= -1 && cpuid <= MAXCPU), ("%s: invalid cpuid %d\n", + __func__, cpuid)); + KASSERT(!CPU_EMPTY(&mask), ("%s: empty CPU mask", __func__)); + + do { + cpuid++; +#ifdef SMP + if (cpuid > mp_maxid) +#endif + cpuid = 0; + } while (!CPU_ISSET(cpuid, &mask)); + return (cpuid); +} + +static __inline void +cpumask_set_cpu(int cpu, cpumask_t *mask) +{ + + CPU_SET(cpu, mask); +} + +#endif /* __LKPI_LINUX_CPU_H */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index a8f090ed0bd5..ef570dda542c 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #endif #include +#include #include #include #include @@ -119,6 +120,7 @@ static void linux_destroy_dev(struct linux_cdev *); static void linux_cdev_deref(struct linux_cdev *ldev); static struct vm_area_struct *linux_cdev_handle_find(void *handle); +cpumask_t cpu_online_mask; struct kobject linux_class_root; struct device linux_root_device; struct class linux_class_misc; @@ -2627,6 +2629,8 @@ linux_compat_init(void *arg) LIST_INIT(&vmmaphead[i]); init_waitqueue_head(&linux_bit_waitq); init_waitqueue_head(&linux_var_waitq); + + CPU_COPY(&all_cpus, &cpu_online_mask); } SYSINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_init, NULL); From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F024C65F0F0; Sun, 18 Jul 2021 00:36:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dK1cBnz4RZy; Sun, 18 Jul 2021 00:36:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF0E1A493; Sun, 18 Jul 2021 00:36:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aXmm049283; Sun, 18 Jul 2021 00:36:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aXvo049282; Sun, 18 Jul 2021 00:36:33 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:33 GMT Message-Id: <202107180036.16I0aXvo049282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: d8310b668b25 - stable/13 - LinuxKPI: byteorder.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d8310b668b2545d21708bd36f4bfdb926fa329d3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:38 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d8310b668b2545d21708bd36f4bfdb926fa329d3 commit d8310b668b2545d21708bd36f4bfdb926fa329d3 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:54:16 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 LinuxKPI: byteorder.h Add a few more le_{tp,add}_cpu*() #defines/functions found in wireless drivers. While here fill most of the combinatorics gaps and also add the remaining combinations [1]. Suggested by: emaste [1] (for one part) Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30418 (cherry picked from commit 5aeeab54b0e1042b09dcea43540994c1ce43eebd) --- sys/compat/linuxkpi/common/include/asm/byteorder.h | 138 +++++++++++++++------ 1 file changed, 102 insertions(+), 36 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/asm/byteorder.h b/sys/compat/linuxkpi/common/include/asm/byteorder.h index 0a6c2b039c66..05e39bb52149 100644 --- a/sys/compat/linuxkpi/common/include/asm/byteorder.h +++ b/sys/compat/linuxkpi/common/include/asm/byteorder.h @@ -41,54 +41,120 @@ #define __BIG_ENDIAN #endif -#define cpu_to_le64(x) htole64(x) -#define le64_to_cpu(x) le64toh(x) -#define cpu_to_le32(x) htole32(x) -#define le32_to_cpu(x) le32toh(x) -#define cpu_to_le16(x) htole16(x) -#define le16_to_cpu(x) le16toh(x) -#define cpu_to_be64(x) htobe64(x) -#define be64_to_cpu(x) be64toh(x) -#define cpu_to_be32(x) htobe32(x) -#define be32_to_cpu(x) be32toh(x) -#define cpu_to_be16(x) htobe16(x) -#define be16_to_cpu(x) be16toh(x) +#define __cpu_to_le64(x) htole64(x) +#define cpu_to_le64(x) __cpu_to_le64(x) +#define __le64_to_cpu(x) le64toh(x) +#define le64_to_cpu(x) __le64_to_cpu(x) +#define __cpu_to_le32(x) htole32(x) +#define cpu_to_le32(x) __cpu_to_le32(x) +#define __le32_to_cpu(x) le32toh(x) +#define le32_to_cpu(x) __le32_to_cpu(x) +#define __cpu_to_le16(x) htole16(x) +#define cpu_to_le16(x) __cpu_to_le16(x) +#define __le16_to_cpu(x) le16toh(x) +#define le16_to_cpu(x) __le16_to_cpu(x) +#define __cpu_to_be64(x) htobe64(x) +#define cpu_to_be64(x) __cpu_to_be64(x) +#define __be64_to_cpu(x) be64toh(x) +#define be64_to_cpu(x) __be64_to_cpu(x) +#define __cpu_to_be32(x) htobe32(x) +#define cpu_to_be32(x) __cpu_to_be32(x) +#define __be32_to_cpu(x) be32toh(x) +#define be32_to_cpu(x) __be32_to_cpu(x) +#define __cpu_to_be16(x) htobe16(x) +#define cpu_to_be16(x) __cpu_to_be16(x) #define __be16_to_cpu(x) be16toh(x) +#define be16_to_cpu(x) __be16_to_cpu(x) -#define cpu_to_le64p(x) htole64(*((const uint64_t *)(x))) -#define le64_to_cpup(x) le64toh(*((const uint64_t *)(x))) -#define cpu_to_le32p(x) htole32(*((const uint32_t *)(x))) -#define le32_to_cpup(x) le32toh(*((const uint32_t *)(x))) -#define cpu_to_le16p(x) htole16(*((const uint16_t *)(x))) -#define le16_to_cpup(x) le16toh(*((const uint16_t *)(x))) -#define cpu_to_be64p(x) htobe64(*((const uint64_t *)(x))) -#define be64_to_cpup(x) be64toh(*((const uint64_t *)(x))) -#define cpu_to_be32p(x) htobe32(*((const uint32_t *)(x))) -#define be32_to_cpup(x) be32toh(*((const uint32_t *)(x))) -#define cpu_to_be16p(x) htobe16(*((const uint16_t *)(x))) -#define be16_to_cpup(x) be16toh(*((const uint16_t *)(x))) +#define __cpu_to_le64p(x) htole64(*((const uint64_t *)(x))) +#define cpu_to_le64p(x) __cpu_to_le64p(x) +#define __le64_to_cpup(x) le64toh(*((const uint64_t *)(x))) +#define le64_to_cpup(x) __le64_to_cpup(x) +#define __cpu_to_le32p(x) htole32(*((const uint32_t *)(x))) +#define cpu_to_le32p(x) __cpu_to_le32p(x) +#define __le32_to_cpup(x) le32toh(*((const uint32_t *)(x))) +#define le32_to_cpup(x) __le32_to_cpup(x) +#define __cpu_to_le16p(x) htole16(*((const uint16_t *)(x))) +#define cpu_to_le16p(x) __cpu_to_le16p(x) +#define __le16_to_cpup(x) le16toh(*((const uint16_t *)(x))) +#define le16_to_cpup(x) __le16_to_cpup(x) +#define __cpu_to_be64p(x) htobe64(*((const uint64_t *)(x))) +#define cpu_to_be64p(x) __cpu_to_be64p(x) +#define __be64_to_cpup(x) be64toh(*((const uint64_t *)(x))) +#define be64_to_cpup(x) __be64_to_cpup(x) +#define __cpu_to_be32p(x) htobe32(*((const uint32_t *)(x))) +#define cpu_to_be32p(x) __cpu_to_be32p(x) +#define __be32_to_cpup(x) be32toh(*((const uint32_t *)(x))) +#define be32_to_cpup(x) __be32_to_cpup(x) +#define __cpu_to_be16p(x) htobe16(*((const uint16_t *)(x))) +#define cpu_to_be16p(x) __cpu_to_be16p(x) +#define __be16_to_cpup(x) be16toh(*((const uint16_t *)(x))) +#define be16_to_cpup(x) __be16_to_cpup(x) -#define cpu_to_le64s(x) do { *((uint64_t *)(x)) = cpu_to_le64p((x)); } while (0) -#define le64_to_cpus(x) do { *((uint64_t *)(x)) = le64_to_cpup((x)); } while (0) -#define cpu_to_le32s(x) do { *((uint32_t *)(x)) = cpu_to_le32p((x)); } while (0) -#define le32_to_cpus(x) do { *((uint32_t *)(x)) = le32_to_cpup((x)); } while (0) -#define cpu_to_le16s(x) do { *((uint16_t *)(x)) = cpu_to_le16p((x)); } while (0) -#define le16_to_cpus(x) do { *((uint16_t *)(x)) = le16_to_cpup((x)); } while (0) -#define cpu_to_be64s(x) do { *((uint64_t *)(x)) = cpu_to_be64p((x)); } while (0) -#define be64_to_cpus(x) do { *((uint64_t *)(x)) = be64_to_cpup((x)); } while (0) -#define cpu_to_be32s(x) do { *((uint32_t *)(x)) = cpu_to_be32p((x)); } while (0) -#define be32_to_cpus(x) do { *((uint32_t *)(x)) = be32_to_cpup((x)); } while (0) -#define cpu_to_be16s(x) do { *((uint16_t *)(x)) = cpu_to_be16p((x)); } while (0) -#define be16_to_cpus(x) do { *((uint16_t *)(x)) = be16_to_cpup((x)); } while (0) + +#define __cpu_to_le64s(x) do { *((uint64_t *)(x)) = cpu_to_le64p((x)); } while (0) +#define cpu_to_le64s(x) __cpu_to_le64s(x) +#define __le64_to_cpus(x) do { *((uint64_t *)(x)) = le64_to_cpup((x)); } while (0) +#define le64_to_cpus(x) __le64_to_cpus(x) +#define __cpu_to_le32s(x) do { *((uint32_t *)(x)) = cpu_to_le32p((x)); } while (0) +#define cpu_to_le32s(x) __cpu_to_le32s(x) +#define __le32_to_cpus(x) do { *((uint32_t *)(x)) = le32_to_cpup((x)); } while (0) +#define le32_to_cpus(x) __le32_to_cpus(x) +#define __cpu_to_le16s(x) do { *((uint16_t *)(x)) = cpu_to_le16p((x)); } while (0) +#define cpu_to_le16s(x) __cpu_to_le16s(x) +#define __le16_to_cpus(x) do { *((uint16_t *)(x)) = le16_to_cpup((x)); } while (0) +#define le16_to_cpus(x) __le16_to_cpus(x) +#define __cpu_to_be64s(x) do { *((uint64_t *)(x)) = cpu_to_be64p((x)); } while (0) +#define cpu_to_be64s(x) __cpu_to_be64s(x) +#define __be64_to_cpus(x) do { *((uint64_t *)(x)) = be64_to_cpup((x)); } while (0) +#define be64_to_cpus(x) __be64_to_cpus(x) +#define __cpu_to_be32s(x) do { *((uint32_t *)(x)) = cpu_to_be32p((x)); } while (0) +#define cpu_to_be32s(x) __cpu_to_be32s(x) +#define __be32_to_cpus(x) do { *((uint32_t *)(x)) = be32_to_cpup((x)); } while (0) +#define be32_to_cpus(x) __be32_to_cpus(x) +#define __cpu_to_be16s(x) do { *((uint16_t *)(x)) = cpu_to_be16p((x)); } while (0) +#define cpu_to_be16s(x) __cpu_to_be16s(x) +#define __be16_to_cpus(x) do { *((uint16_t *)(x)) = be16_to_cpup((x)); } while (0) +#define be16_to_cpus(x) __be16_to_cpus(x) #define swab16(x) bswap16(x) #define swab32(x) bswap32(x) #define swab64(x) bswap64(x) +static inline void +be64_add_cpu(uint64_t *var, uint64_t val) +{ + *var = cpu_to_be64(be64_to_cpu(*var) + val); +} + +static inline void +be32_add_cpu(uint32_t *var, uint32_t val) +{ + *var = cpu_to_be32(be32_to_cpu(*var) + val); +} + static inline void be16_add_cpu(uint16_t *var, uint16_t val) { *var = cpu_to_be16(be16_to_cpu(*var) + val); } +static __inline void +le64_add_cpu(uint64_t *var, uint64_t val) +{ + *var = cpu_to_le64(le64_to_cpu(*var) + val); +} + +static __inline void +le32_add_cpu(uint32_t *var, uint32_t val) +{ + *var = cpu_to_le32(le32_to_cpu(*var) + val); +} + +static inline void +le16_add_cpu(uint16_t *var, uint16_t val) +{ + *var = cpu_to_le16(le16_to_cpu(*var) + val); +} + #endif /* _ASM_BYTEORDER_H_ */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3048D65F348; Sun, 18 Jul 2021 00:36:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cw623zz4RRc; Sun, 18 Jul 2021 00:36:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E5F01A68F; Sun, 18 Jul 2021 00:36:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aED4048857; Sun, 18 Jul 2021 00:36:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aENo048856; Sun, 18 Jul 2021 00:36:14 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:14 GMT Message-Id: <202107180036.16I0aENo048856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 89f8a8c30632 - stable/13 - LinuxKPI: add rcu_dereference_check() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 89f8a8c30632c09e15d11456469a32cdc9e06d19 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:18 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=89f8a8c30632c09e15d11456469a32cdc9e06d19 commit 89f8a8c30632c09e15d11456469a32cdc9e06d19 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:40:42 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: add rcu_dereference_check() Add a define for rcu_dereference_check() to rcu_dereference_protected() which ignores the check argument. Our lockdep compat implementation for use cases found in iwlwifi would return 1 anyway. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30436 (cherry picked from commit fa58da02f708a22200a89032b8eaf35e1c8ef4a6) --- sys/compat/linuxkpi/common/include/linux/rcupdate.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/rcupdate.h b/sys/compat/linuxkpi/common/include/linux/rcupdate.h index ea97fecee53b..bd8335216d1d 100644 --- a/sys/compat/linuxkpi/common/include/linux/rcupdate.h +++ b/sys/compat/linuxkpi/common/include/linux/rcupdate.h @@ -87,6 +87,9 @@ #define rcu_dereference(p) \ rcu_dereference_protected(p, 0) +#define rcu_dereference_check(p, c) \ + rcu_dereference_protected(p, c) + #define rcu_dereference_raw(p) \ ((__typeof(*p) *)READ_ONCE(p)) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AC2065F3F6; Sun, 18 Jul 2021 00:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dF4HLVz4RQD; Sun, 18 Jul 2021 00:36:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62F0F1A694; Sun, 18 Jul 2021 00:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aTLJ049187; Sun, 18 Jul 2021 00:36:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aTff049186; Sun, 18 Jul 2021 00:36:29 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:29 GMT Message-Id: <202107180036.16I0aTff049186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1839f0c9ad55 - stable/13 - LinuxKPI: add devcoredump.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1839f0c9ad55e902335e429d9bfe4b0036df36d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:35 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1839f0c9ad55e902335e429d9bfe4b0036df36d5 commit 1839f0c9ad55e902335e429d9bfe4b0036df36d5 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:04:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: add devcoredump.h Add linux/devcoredump.h with stub implementation of dev_coredumpv() and dev_coredumpsg() which only free the passed in SG table as needed for iwlwifi. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30423 (cherry picked from commit 29923fea032a6ac7c0defd74d0b23468b16fda93) --- .../linuxkpi/common/include/linux/devcoredump.h | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/devcoredump.h b/sys/compat/linuxkpi/common/include/linux/devcoredump.h new file mode 100644 index 000000000000..4616fbb5a2ea --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/devcoredump.h @@ -0,0 +1,76 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_DEVCOREDUMP_H +#define __LKPI_LINUX_DEVCOREDUMP_H + +#include +#include +#include + +static inline void +_lkpi_dev_coredumpsg_free(struct scatterlist *table) +{ + struct scatterlist *iter; + struct page *p; + int i; + + iter = table; + for_each_sg(table, iter, sg_nents(table), i) { + p = sg_page(iter); + if (p) + __free_page(p); + } + + /* XXX what about chained tables? */ + kfree(table); +} + +static inline void +dev_coredumpv(struct device *dev __unused, void *data, size_t datalen __unused, + gfp_t gfp __unused) +{ + + /* UNIMPLEMENTED */ + vfree(data); +} + +static inline void +dev_coredumpsg(struct device *dev __unused, struct scatterlist *table, + size_t datalen __unused, gfp_t gfp __unused) +{ + + /* UNIMPLEMENTED */ + _lkpi_dev_coredumpsg_free(table); +} + +#endif /* __LKPI_LINUX_DEVCOREDUMP_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59E7065F411; Sun, 18 Jul 2021 00:36:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5ct4PnNz4RP1; Sun, 18 Jul 2021 00:36:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AFE019E4F; Sun, 18 Jul 2021 00:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aDKU048833; Sun, 18 Jul 2021 00:36:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aDmN048832; Sun, 18 Jul 2021 00:36:13 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:13 GMT Message-Id: <202107180036.16I0aDmN048832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 756728ec1c56 - stable/13 - LinuxKPI: add kfree_sensitive() using zfree(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 756728ec1c56ea22f6ab4a57d45b72368fadc40a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:16 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=756728ec1c56ea22f6ab4a57d45b72368fadc40a commit 756728ec1c56ea22f6ab4a57d45b72368fadc40a Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:43:33 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: add kfree_sensitive() using zfree(). Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30437 (cherry picked from commit abcac97f8202d91b61ae4846794ba60166a56cfe) --- sys/compat/linuxkpi/common/include/linux/slab.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index 9494d458e87c..8d5eb3e85e96 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -198,6 +198,12 @@ kfree(const void *ptr) free(__DECONST(void *, ptr), M_KMALLOC); } +static __inline void +kfree_sensitive(const void *ptr) +{ + zfree(__DECONST(void *, ptr), M_KMALLOC); +} + static inline size_t ksize(const void *ptr) { From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 690BE65F500; Sun, 18 Jul 2021 00:36:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5cx706sz4RK7; Sun, 18 Jul 2021 00:36:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B926B1A48F; Sun, 18 Jul 2021 00:36:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aG9C048905; Sun, 18 Jul 2021 00:36:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aGG3048904; Sun, 18 Jul 2021 00:36:16 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:16 GMT Message-Id: <202107180036.16I0aGG3048904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a2c270c46d6d - stable/13 - LinuxKPI: add more #defines to pci.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a2c270c46d6d7cd089989c98cf50248ab84d44ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:18 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a2c270c46d6d7cd089989c98cf50248ab84d44ef commit a2c270c46d6d7cd089989c98cf50248ab84d44ef Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:36:18 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:00 +0000 LinuxKPI: add more #defines to pci.h Add more definitions for various PCI uses to linux/pci.h. Almost all are defined to their FreeBSD counterparts which are described there. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30434 (cherry picked from commit fc1d840901b1aefe22924d772781e2c835edb096) --- sys/compat/linuxkpi/common/include/linux/pci.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 827fd98facb6..36a82e81b4bc 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -86,8 +86,12 @@ struct pci_device_id { #define PCI_VENDOR_ID PCIR_DEVVENDOR #define PCI_COMMAND PCIR_COMMAND +#define PCI_COMMAND_INTX_DISABLE PCIM_CMD_INTxDIS #define PCI_EXP_DEVCTL PCIER_DEVICE_CTL /* Device Control */ #define PCI_EXP_LNKCTL PCIER_LINK_CTL /* Link Control */ +#define PCI_EXP_LNKCTL_ASPM_L0S PCIEM_LINK_CTL_ASPMC_L0S +#define PCI_EXP_LNKCTL_ASPM_L1 PCIEM_LINK_CTL_ASPMC_L1 +#define PCI_EXP_LNKCTL_CLKREQ_EN PCIEM_LINK_CTL_ECPM /* Enable clock PM */ #define PCI_EXP_FLAGS_TYPE PCIEM_FLAGS_TYPE /* Device/Port type */ #define PCI_EXP_DEVCAP PCIER_DEVICE_CAP /* Device capabilities */ #define PCI_EXP_DEVSTA PCIER_DEVICE_STA /* Device Status */ @@ -101,6 +105,7 @@ struct pci_device_id { #define PCI_EXP_RTSTA PCIER_ROOT_STA /* Root Status */ #define PCI_EXP_DEVCAP2 PCIER_DEVICE_CAP2 /* Device Capabilities 2 */ #define PCI_EXP_DEVCTL2 PCIER_DEVICE_CTL2 /* Device Control 2 */ +#define PCI_EXP_DEVCTL2_LTR_EN PCIEM_CTL2_LTR_ENABLE #define PCI_EXP_LNKCAP2 PCIER_LINK_CAP2 /* Link Capabilities 2 */ #define PCI_EXP_LNKCTL2 PCIER_LINK_CTL2 /* Link Control 2 */ #define PCI_EXP_LNKSTA2 PCIER_LINK_STA2 /* Link Status 2 */ @@ -150,6 +155,10 @@ enum pcie_link_width { PCIE_LNK_WIDTH_UNKNOWN = 0xff, }; +#define PCIE_LINK_STATE_L0S 0x00000001 +#define PCIE_LINK_STATE_L1 0x00000002 +#define PCIE_LINK_STATE_CLKPM 0x00000004 + typedef int pci_power_t; #define PCI_D0 PCI_POWERSTATE_D0 @@ -160,6 +169,11 @@ typedef int pci_power_t; #define PCI_POWER_ERROR PCI_POWERSTATE_UNKNOWN +#define PCI_ERR_ROOT_COMMAND PCIR_AER_ROOTERR_CMD +#define PCI_ERR_ROOT_ERR_SRC PCIR_AER_COR_SOURCE_ID + +#define PCI_EXT_CAP_ID_ERR PCIZ_AER + struct pci_dev; struct pci_driver { From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3799165F5BC; Sun, 18 Jul 2021 00:36:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dM0BtLz4RXf; Sun, 18 Jul 2021 00:36:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 320301A696; Sun, 18 Jul 2021 00:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aZni049313; Sun, 18 Jul 2021 00:36:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aZ2n049312; Sun, 18 Jul 2021 00:36:35 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:35 GMT Message-Id: <202107180036.16I0aZ2n049312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: fe46625be7d9 - stable/13 - LinuxKPI: add linux/bsearch.h for sort(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fe46625be7d98fa0b6fec4d5f9d6999428a8d198 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:40 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fe46625be7d98fa0b6fec4d5f9d6999428a8d198 commit fe46625be7d98fa0b6fec4d5f9d6999428a8d198 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:52:02 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 LinuxKPI: add linux/bsearch.h for sort(9) Add linux/bsearch.h which only includes libkern.h as the sort(9) functions seem to be compatible. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30417 (cherry picked from commit f4a145b136ad88f7a9f38e3f7732bc5a8b5cb517) --- sys/compat/linuxkpi/common/include/linux/bsearch.h | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/bsearch.h b/sys/compat/linuxkpi/common/include/linux/bsearch.h new file mode 100644 index 000000000000..b8cf7b19b467 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/bsearch.h @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_BSEARCH_H +#define __LKPI_LINUX_BSEARCH_H + +#include + +#endif /* __LKPI_LINUX_BSEARCH_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E46E165F479; Sun, 18 Jul 2021 00:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dP3f5cz4RXr; Sun, 18 Jul 2021 00:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 999341A327; Sun, 18 Jul 2021 00:36:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0acpr049385; Sun, 18 Jul 2021 00:36:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0acqE049384; Sun, 18 Jul 2021 00:36:38 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:38 GMT Message-Id: <202107180036.16I0acqE049384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ddecc06c9940 - stable/13 - LinuxKPI/OFED/mlx4: cleanup netdevice.h some more MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ddecc06c9940e1e9b14278c22f605655263a693f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:42 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ddecc06c9940e1e9b14278c22f605655263a693f commit ddecc06c9940e1e9b14278c22f605655263a693f Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 12:27:26 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 LinuxKPI/OFED/mlx4: cleanup netdevice.h some more This removes all unused bits from linux/netdevice.h and migrates two inline functions into the mlx4 and ofed code respectively. This gets the mlx4/ofed (struct ifnet) specific bits down to 7 lines in netdevice.h. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D30461 (cherry picked from commit c35034b338eb4de6fb42fd855865bce21c81a225) --- .../linuxkpi/common/include/linux/netdevice.h | 64 ---------------------- sys/dev/mlx4/mlx4_en/en.h | 6 ++ sys/ofed/drivers/infiniband/core/ib_addr.c | 1 - sys/ofed/drivers/infiniband/core/ib_cma.c | 1 - sys/ofed/include/rdma/ib_addr.h | 2 +- sys/ofed/include/rdma/ib_addr_freebsd.h | 15 +++++ sys/ofed/include/rdma/ib_sa.h | 1 + 7 files changed, 23 insertions(+), 67 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h index 9ec76d9b90ef..07c111cc4fc9 100644 --- a/sys/compat/linuxkpi/common/include/linux/netdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h @@ -40,10 +40,6 @@ #include #include -#include -#include -#include -#include #include #include @@ -57,21 +53,6 @@ #define net_device ifnet -static inline struct ifnet * -dev_get_by_index(struct vnet *vnet, int if_index) -{ - struct epoch_tracker et; - struct ifnet *retval; - - NET_EPOCH_ENTER(et); - CURVNET_SET(vnet); - retval = ifnet_byindex_ref(if_index); - CURVNET_RESTORE(); - NET_EPOCH_EXIT(et); - - return (retval); -} - #define dev_hold(d) if_ref(d) #define dev_put(d) if_rele(d) #define dev_net(d) ((d)->if_vnet) @@ -79,56 +60,11 @@ dev_get_by_index(struct vnet *vnet, int if_index) #define net_eq(a,b) ((a) == (b)) #define netif_running(dev) !!((dev)->if_drv_flags & IFF_DRV_RUNNING) -#define netif_oper_up(dev) !!((dev)->if_flags & IFF_UP) #define netif_carrier_ok(dev) ((dev)->if_link_state == LINK_STATE_UP) -static inline void * -netdev_priv(const struct net_device *dev) -{ - return (dev->if_softc); -} - #define rtnl_lock() #define rtnl_unlock() -static inline int -dev_mc_delete(struct net_device *dev, void *addr, int alen, int all) -{ - struct sockaddr_dl sdl; - - if (alen > sizeof(sdl.sdl_data)) - return (-EINVAL); - memset(&sdl, 0, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - sdl.sdl_alen = alen; - memcpy(&sdl.sdl_data, addr, alen); - - return -if_delmulti(dev, (struct sockaddr *)&sdl); -} - -static inline int -dev_mc_del(struct net_device *dev, void *addr) -{ - return (dev_mc_delete(dev, addr, 6, 0)); -} - -static inline int -dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly) -{ - struct sockaddr_dl sdl; - - if (alen > sizeof(sdl.sdl_data)) - return (-EINVAL); - memset(&sdl, 0, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - sdl.sdl_alen = alen; - memcpy(&sdl.sdl_data, addr, alen); - - return -if_addmulti(dev, (struct sockaddr *)&sdl, NULL); -} - /* According to linux::ipoib_main.c. */ struct netdev_notifier_info { struct net_device *dev; diff --git a/sys/dev/mlx4/mlx4_en/en.h b/sys/dev/mlx4/mlx4_en/en.h index e7a02f02c8b7..e63027bc9dc0 100644 --- a/sys/dev/mlx4/mlx4_en/en.h +++ b/sys/dev/mlx4/mlx4_en/en.h @@ -654,6 +654,12 @@ struct mlx4_mac_entry { u64 reg_id; }; +static inline void * +netdev_priv(const struct net_device *dev) +{ + return (dev->if_softc); +} + static inline struct mlx4_cqe *mlx4_en_get_cqe(u8 *buf, int idx, int cqe_sz) { return (struct mlx4_cqe *)(buf + idx * cqe_sz); diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index f8c1cb180af8..ef5e264577e0 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 717d7c70e9de..7c03841d51d7 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h index 052fc636f617..535e6c2b3b14 100644 --- a/sys/ofed/include/rdma/ib_addr.h +++ b/sys/ofed/include/rdma/ib_addr.h @@ -49,7 +49,7 @@ #include #include #include -#include +#include struct rdma_addr_client { atomic_t refcount; diff --git a/sys/ofed/include/rdma/ib_addr_freebsd.h b/sys/ofed/include/rdma/ib_addr_freebsd.h index 5ce5f2f8a5ed..79b7231875ec 100644 --- a/sys/ofed/include/rdma/ib_addr_freebsd.h +++ b/sys/ofed/include/rdma/ib_addr_freebsd.h @@ -92,4 +92,19 @@ ip6_ifp_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) } #endif +static inline struct ifnet * +dev_get_by_index(struct vnet *vnet, int if_index) +{ + struct epoch_tracker et; + struct ifnet *retval; + + NET_EPOCH_ENTER(et); + CURVNET_SET(vnet); + retval = ifnet_byindex_ref(if_index); + CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); + + return (retval); +} + #endif /* _RDMA_IB_ADDR_FREEBSD_H */ diff --git a/sys/ofed/include/rdma/ib_sa.h b/sys/ofed/include/rdma/ib_sa.h index 28e9a7887cab..beea96a02e1a 100644 --- a/sys/ofed/include/rdma/ib_sa.h +++ b/sys/ofed/include/rdma/ib_sa.h @@ -43,6 +43,7 @@ #include #include +#include #include #include From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53FB865F5B4; Sun, 18 Jul 2021 00:36:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dJ0Vjzz4RQP; Sun, 18 Jul 2021 00:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7A281A471; Sun, 18 Jul 2021 00:36:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aWrq049259; Sun, 18 Jul 2021 00:36:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aWDD049258; Sun, 18 Jul 2021 00:36:32 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:32 GMT Message-Id: <202107180036.16I0aWDD049258@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1a542dd64611 - stable/13 - LinuxKPI: cache.h add SMP_CACHE_BYTES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1a542dd64611701fd3371e9179108307b1cc5da5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:38 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1a542dd64611701fd3371e9179108307b1cc5da5 commit 1a542dd64611701fd3371e9179108307b1cc5da5 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:56:53 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 LinuxKPI: cache.h add SMP_CACHE_BYTES Add a definition for SMP_CACHE_BYTES and while here include sys/param.h for CACHE_LINE_SIZE as otherwise code might not compile standalone. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30419 (cherry picked from commit e21652c13c7c161efac7fd0b247c73914312212a) --- sys/compat/linuxkpi/common/include/linux/cache.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/cache.h b/sys/compat/linuxkpi/common/include/linux/cache.h index a269e55eb90b..4d1d400152ff 100644 --- a/sys/compat/linuxkpi/common/include/linux/cache.h +++ b/sys/compat/linuxkpi/common/include/linux/cache.h @@ -31,7 +31,11 @@ #ifndef _LINUX_CACHE_H_ #define _LINUX_CACHE_H_ +#include + #define cache_line_size() CACHE_LINE_SIZE #define L1_CACHE_BYTES CACHE_LINE_SIZE +#define SMP_CACHE_BYTES L1_CACHE_BYTES + #endif /* _LINUX_CACHE_H_ */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BACF65F4AB; Sun, 18 Jul 2021 00:36:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5d55cN4z4RSV; Sun, 18 Jul 2021 00:36:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C9D81A46E; Sun, 18 Jul 2021 00:36:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aNGZ049061; Sun, 18 Jul 2021 00:36:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aNPK049060; Sun, 18 Jul 2021 00:36:23 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:23 GMT Message-Id: <202107180036.16I0aNPK049060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 397b427b2741 - stable/13 - LinuxKPI: add linux/{ip,tcp,udp}.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 397b427b27419791faf376845f3f71d8ce1c1ebe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:26 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=397b427b27419791faf376845f3f71d8ce1c1ebe commit 397b427b27419791faf376845f3f71d8ce1c1ebe Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:17:30 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: add linux/{ip,tcp,udp}.h Add header files for struct and accessors for IPv4, UDP, and TCP. Only parts of the fields of the structs have been seen while working on wireless drivers. The remaining field names are filled up with the FreeBSD field names for now. If you have insights into their correct naming in Linux, feel free to adjust. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30428 (cherry picked from commit b26fb63f2b96fddf640260dc4a5acd703c7d425c) --- sys/compat/linuxkpi/common/include/linux/ip.h | 74 ++++++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/tcp.h | 72 +++++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/udp.h | 54 +++++++++++++++++++ 3 files changed, 200 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/ip.h b/sys/compat/linuxkpi/common/include/linux/ip.h new file mode 100644 index 000000000000..3507c6fe9b97 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/ip.h @@ -0,0 +1,74 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_IP_H +#define __LKPI_LINUX_IP_H + +#include + +#include +#include + +#include + +/* (u) unconfirmed structure field names; using FreeBSD's meanwhile. */ +struct iphdr { + uint8_t ip_hl:4, ip_ver:4; /* (u) */ + uint8_t ip_tos; /* (u) */ + uint16_t ip_len; /* (u) */ + uint16_t id; + uint16_t ip_off; /* (u) */ + uint8_t ip_ttl; /* (u) */ + uint8_t protocol; + uint16_t check; + uint32_t saddr; + uint32_t daddr; +}; + +static __inline struct iphdr * +ip_hdr(struct sk_buff *skb) +{ + + return (struct iphdr *)skb_network_header(skb); +} + +static __inline void +ip_send_check(struct iphdr *iph) +{ + + /* Clear the checksum before computing! */ + iph->check = 0; + /* An IPv4 header is the same everywhere even if names differ. */ + iph->check = in_cksum_hdr((const void *)iph); +} + +#endif /* __LKPI_LINUX_IP_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/tcp.h b/sys/compat/linuxkpi/common/include/linux/tcp.h new file mode 100644 index 000000000000..1197f38b7898 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/tcp.h @@ -0,0 +1,72 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_TCP_H +#define __LKPI_LINUX_TCP_H + +#include +#include + +/* (u) unconfirmed structure field names; using FreeBSD's meanwhile. */ +struct tcphdr { + uint16_t source; /* (u) */ + uint16_t dest; /* (u) */ + uint32_t th_seq; /* (u) */ + uint32_t th_ack; /* (u) */ +#if BYTE_ORDER == LITTLE_ENDIAN + uint8_t th_x2:4, doff:4; +#elif BYTE_ORDER == BIG_ENDIAN + uint8_t doff:4, th_x2:4; +#endif + uint8_t th_flags; /* (u) */ + uint16_t th_win; /* (u) */ + uint16_t check; + uint16_t th_urg; /* (u) */ +}; + +static __inline struct tcphdr * +tcp_hdr(struct sk_buff *skb) +{ + + return (struct tcphdr *)skb_transport_header(skb); +} + +static __inline uint32_t +tcp_hdrlen(struct sk_buff *skb) +{ + struct tcphdr *th; + + th = tcp_hdr(skb); + return (4 * th->doff); +} + +#endif /* __LKPI_LINUX_TCP_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/udp.h b/sys/compat/linuxkpi/common/include/linux/udp.h new file mode 100644 index 000000000000..259bdbfc1199 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/udp.h @@ -0,0 +1,54 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_UDP_H +#define __LKPI_LINUX_UDP_H + +#include +#include + +/* (u) unconfirmed structure field names. */ +struct udphdr { + uint16_t source; /* (u) */ + uint16_t dest; + uint16_t len; /* (u) */ + uint16_t check; +}; + +static __inline struct udphdr * +udp_hdr(struct sk_buff *skb) +{ + + return (struct udphdr *)skb_transport_header(skb); +} + +#endif /* __LKPI_LINUX_UDP_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F5A565F353; Sun, 18 Jul 2021 00:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5d66bxCz4RDb; Sun, 18 Jul 2021 00:36:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA4251A492; Sun, 18 Jul 2021 00:36:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aOwk049085; Sun, 18 Jul 2021 00:36:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aOWB049084; Sun, 18 Jul 2021 00:36:24 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:24 GMT Message-Id: <202107180036.16I0aOWB049084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 2fc939d71a5f - stable/13 - LinuxKPI: add irq_set_affinity_hint() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2fc939d71a5fe20e84c18cc9a813a1585a8612cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:27 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2fc939d71a5fe20e84c18cc9a813a1585a8612cd commit 2fc939d71a5fe20e84c18cc9a813a1585a8612cd Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:14:37 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: add irq_set_affinity_hint() Add an implementation for irq_set_affinity_hint() to linux/interrupt.h and include linux/hardirq.h for synchronize_irq() as needed by wireless drivers. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30427 (cherry picked from commit 602e4e433d3e7dbb03d4fd30a4720a02cdeca6aa) --- sys/compat/linuxkpi/common/include/linux/interrupt.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index fc1241240b39..90994a2f2315 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -31,12 +31,15 @@ #ifndef _LINUX_INTERRUPT_H_ #define _LINUX_INTERRUPT_H_ +#include #include #include #include +#include #include #include +#include typedef irqreturn_t (*irq_handler_t)(int, void *); @@ -183,6 +186,19 @@ free_irq(unsigned int irq, void *device) kfree(irqe); } +static inline int +irq_set_affinity_hint(int vector, cpumask_t *mask) +{ + int error; + + if (mask != NULL) + error = intr_setaffinity(vector, CPU_WHICH_IRQ, mask); + else + error = intr_setaffinity(vector, CPU_WHICH_IRQ, cpuset_root); + + return (-error); +} + /* * LinuxKPI tasklet support */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D4D265F599; Sun, 18 Jul 2021 00:36:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5d93tDSz4RL1; Sun, 18 Jul 2021 00:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A2241A1B3; Sun, 18 Jul 2021 00:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aRwf049133; Sun, 18 Jul 2021 00:36:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aQDB049132; Sun, 18 Jul 2021 00:36:26 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:26 GMT Message-Id: <202107180036.16I0aQDB049132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 9af6ce636839 - stable/13 - LinuxKPI: add ether_addr_equal_unaligned() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9af6ce636839faecaf2d6357370f8fc811c94775 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:30 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9af6ce636839faecaf2d6357370f8fc811c94775 commit 9af6ce636839faecaf2d6357370f8fc811c94775 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:09:37 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:01 +0000 LinuxKPI: add ether_addr_equal_unaligned() Replace the implementation for ether_addr_equal() with ether_addr_equal_unaligned() and add a define for ether_addr_equal() pointing to the now ether_addr_equal_unaligned() implementation. This way ether_addr_equal_unaligned() cannot be broken by accident [1]. Suggested by: emaste [1] Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30425 (cherry picked from commit 834227ba6e80dc0899d2372ae8986241f5658c4e) --- sys/compat/linuxkpi/common/include/linux/etherdevice.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h index 392f395a5feb..9062cd562347 100644 --- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h @@ -82,10 +82,11 @@ ether_addr_copy(u8 * dst, const u8 * src) } static inline bool -ether_addr_equal(const u8 *pa, const u8 *pb) +ether_addr_equal_unaligned(const u8 *pa, const u8 *pb) { return (memcmp(pa, pb, 6) == 0); } +#define ether_addr_equal(_pa, _pb) ether_addr_equal_unaligned(_pa, _pb) static inline bool ether_addr_equal_64bits(const u8 *pa, const u8 *pb) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09FF665F55B; Sun, 18 Jul 2021 00:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5df0GYNz4RYY; Sun, 18 Jul 2021 00:36:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27D9D1A496; Sun, 18 Jul 2021 00:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ap1x049661; Sun, 18 Jul 2021 00:36:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0apIi049660; Sun, 18 Jul 2021 00:36:51 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:51 GMT Message-Id: <202107180036.16I0apIi049660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1eaaada457d6 - stable/13 - LinuxKPI: enhance the irq KPI for managed and threaded operations. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1eaaada457d6c559188c7abb5c8fc1fa372ec231 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:55 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1eaaada457d6c559188c7abb5c8fc1fa372ec231 commit 1eaaada457d6c559188c7abb5c8fc1fa372ec231 Author: Bjoern A. Zeeb AuthorDate: 2021-05-30 13:54:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 LinuxKPI: enhance the irq KPI for managed and threaded operations. Move request_irq() to an internal function which serves request_irq() and the newly added request_threaded_irq() and devm_request_threaded_irq(). Likewise factor out parts of free_irq() to also be used with devm_free_irq(). Add the storage and call to a thread_handler in case of IRQ_WAKE_THREAD. This is needed for the iwlwifi driver. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30549 (cherry picked from commit d16b6cb17837162d685c960deb28f26f716fa440) --- .../linuxkpi/common/include/linux/interrupt.h | 97 ++++++++++++++++++---- sys/compat/linuxkpi/common/src/linux_compat.c | 31 ++++++- 2 files changed, 110 insertions(+), 18 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index 90994a2f2315..6770adad2293 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -51,10 +52,15 @@ struct irq_ent { struct resource *res; void *arg; irqreturn_t (*handler)(int, void *); + irqreturn_t (*thread_handler)(int, void *); void *tag; unsigned int irq; }; +void linux_irq_handler(void *); +void lkpi_devm_irq_release(struct device *, void *); +void lkpi_irq_release(struct device *, struct irq_ent *); + static inline int linux_irq_rid(struct device *dev, unsigned int irq) { @@ -65,8 +71,6 @@ linux_irq_rid(struct device *dev, unsigned int irq) return (0); } -extern void linux_irq_handler(void *); - static inline struct irq_ent * linux_irq_ent(struct device *dev, unsigned int irq) { @@ -80,8 +84,9 @@ linux_irq_ent(struct device *dev, unsigned int irq) } static inline int -request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, - const char *name, void *arg) +_request_irq(struct device *xdev, unsigned int irq, + irq_handler_t handler, irq_handler_t thread_handler, + unsigned long flags, const char *name, void *arg) { struct resource *res; struct irq_ent *irqe; @@ -92,27 +97,70 @@ request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return -ENXIO; + if (xdev != NULL && xdev != dev) + return -ENXIO; rid = linux_irq_rid(dev, irq); res = bus_alloc_resource_any(dev->bsddev, SYS_RES_IRQ, &rid, flags | RF_ACTIVE); if (res == NULL) return (-ENXIO); - irqe = kmalloc(sizeof(*irqe), GFP_KERNEL); + if (xdev != NULL) + irqe = lkpi_devres_alloc(lkpi_devm_irq_release, sizeof(*irqe), + GFP_KERNEL | __GFP_ZERO); + else + irqe = kzalloc(sizeof(*irqe), GFP_KERNEL); irqe->dev = dev; irqe->res = res; irqe->arg = arg; irqe->handler = handler; + irqe->thread_handler = thread_handler; irqe->irq = irq; + error = bus_setup_intr(dev->bsddev, res, INTR_TYPE_NET | INTR_MPSAFE, NULL, linux_irq_handler, irqe, &irqe->tag); - if (error) { - bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res); - kfree(irqe); - return (-error); - } + if (error) + goto errout; list_add(&irqe->links, &dev->irqents); + if (xdev != NULL) + devres_add(xdev, irqe); return 0; + +errout: + bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res); + if (xdev != NULL) + devres_free(irqe); + else + kfree(irqe); + return (-error); +} + +static inline int +request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, + const char *name, void *arg) +{ + + return (_request_irq(NULL, irq, handler, NULL, flags, name, arg)); +} + +static inline int +request_threaded_irq(int irq, irq_handler_t handler, + irq_handler_t thread_handler, unsigned long flags, + const char *name, void *arg) +{ + + return (_request_irq(NULL, irq, handler, thread_handler, + flags, name, arg)); +} + +static inline int +devm_request_threaded_irq(struct device *dev, int irq, + irq_handler_t handler, irq_handler_t thread_handler, + unsigned long flags, const char *name, void *arg) +{ + + return (_request_irq(dev, irq, handler, thread_handler, + flags, name, arg)); } static inline int @@ -166,26 +214,41 @@ bind_irq_to_cpu(unsigned int irq, int cpu_id) } static inline void -free_irq(unsigned int irq, void *device) +free_irq(unsigned int irq, void *device __unused) { struct irq_ent *irqe; struct device *dev; - int rid; dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return; - rid = linux_irq_rid(dev, irq); irqe = linux_irq_ent(dev, irq); if (irqe == NULL) return; - if (irqe->tag != NULL) - bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); - bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res); - list_del(&irqe->links); + lkpi_irq_release(dev, irqe); kfree(irqe); } +static inline void +devm_free_irq(struct device *xdev, unsigned int irq, void *p) +{ + struct device *dev; + struct irq_ent *irqe; + + dev = linux_pci_find_irq_dev(irq); + if (dev == NULL) + return; + if (xdev != dev) + return; + irqe = linux_irq_ent(dev, irq); + if (irqe == NULL) + return; + lkpi_irq_release(dev, irqe); + lkpi_devres_unlink(dev, irqe); + lkpi_devres_free(irqe); + return; +} + static inline int irq_set_affinity_hint(int vector, cpumask_t *mask) { diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index d4571173f93d..217c4081c603 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2463,6 +2463,30 @@ list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, free(ar, M_KMALLOC); } +void +lkpi_irq_release(struct device *dev, struct irq_ent *irqe) +{ + + if (irqe->tag != NULL) + bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); + if (irqe->res != NULL) + bus_release_resource(dev->bsddev, SYS_RES_IRQ, + rman_get_rid(irqe->res), irqe->res); + list_del(&irqe->links); +} + +void +lkpi_devm_irq_release(struct device *dev, void *p) +{ + struct irq_ent *irqe; + + if (dev == NULL || p == NULL) + return; + + irqe = p; + lkpi_irq_release(dev, irqe); +} + void linux_irq_handler(void *ent) { @@ -2472,7 +2496,12 @@ linux_irq_handler(void *ent) return; irqe = ent; - irqe->handler(irqe->irq, irqe->arg); + if (irqe->handler(irqe->irq, irqe->arg) == IRQ_WAKE_THREAD && + irqe->thread_handler != NULL) { + THREAD_SLEEPING_OK(); + irqe->thread_handler(irqe->irq, irqe->arg); + THREAD_NO_SLEEPING(); + } } #if defined(__i386__) || defined(__amd64__) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CFCD65F83A; Sun, 18 Jul 2021 00:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dd1RYMz4RfL; Sun, 18 Jul 2021 00:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 136C61A476; Sun, 18 Jul 2021 00:36:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0anj0049637; Sun, 18 Jul 2021 00:36:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0anQB049636; Sun, 18 Jul 2021 00:36:49 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:49 GMT Message-Id: <202107180036.16I0anQB049636@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 40a215e38a4d - stable/13 - LinuxKPI: extend pci.h by various functions for wireless driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 40a215e38a4d01037fadc170116e157ad129854d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:55 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=40a215e38a4d01037fadc170116e157ad129854d commit 40a215e38a4d01037fadc170116e157ad129854d Author: Bjoern A. Zeeb AuthorDate: 2021-05-28 11:16:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 LinuxKPI: extend pci.h by various functions for wireless driver Add dummy functions for dealing with "HotPlug" events which we currently do not support. Add pci_dev_get(), pci_find_ext_capability() and pci_pme_capable(). The added pcie_find_root_port() is a bit special as we need to create another linux pci device; for that make lkpinew_pci_dev() public which is also helpful for other cases when we want to use the Linux routines to check for device identifiers only and need a container for the "bsddev" to use natively. This has proven to avoid basic checking code for the sake of rewriting it to native field names elsewhere. Given we cache the newly created "root" we also need to make sure we clean it up. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30521 (cherry picked from commit 8e106c5230c1f0683ffc473db5c2e0d01b2bfeea) --- sys/compat/linuxkpi/common/include/linux/pci.h | 88 ++++++++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_pci.c | 6 +- 2 files changed, 93 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 36a82e81b4bc..b8a801ac9f70 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -221,6 +221,7 @@ struct pci_dev { struct list_head links; struct pci_driver *pdrv; struct pci_bus *bus; + struct pci_dev *root; uint16_t device; uint16_t vendor; uint16_t subsystem_vendor; @@ -236,6 +237,10 @@ struct pci_dev { TAILQ_HEAD(, pci_mmio_region) mmio; }; +/* Internal helper function(s). */ +struct pci_dev *lkpinew_pci_dev(device_t); + + static inline struct resource_list_entry * linux_pci_get_rle(struct pci_dev *pdev, int type, int rid) { @@ -327,6 +332,15 @@ pci_set_drvdata(struct pci_dev *pdev, void *data) dev_set_drvdata(&pdev->dev, data); } +static inline struct pci_dev * +pci_dev_get(struct pci_dev *pdev) +{ + + if (pdev != NULL) + get_device(&pdev->dev); + return (pdev); +} + static __inline void pci_dev_put(struct pci_dev *pdev) { @@ -496,6 +510,48 @@ static inline int pci_pcie_cap(struct pci_dev *dev) return pci_find_capability(dev, PCI_CAP_ID_EXP); } +static inline int +pci_find_ext_capability(struct pci_dev *pdev, int capid) +{ + int reg; + + if (pci_find_extcap(pdev->dev.bsddev, capid, ®)) + return (0); + return (reg); +} + +#define PCIM_PCAP_PME_SHIFT 11 +static __inline bool +pci_pme_capable(struct pci_dev *pdev, uint32_t flag) +{ + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + + if (flag > (PCIM_PCAP_D3PME_COLD >> PCIM_PCAP_PME_SHIFT)) + return (false); + + dinfo = device_get_ivars(pdev->dev.bsddev); + cfg = &dinfo->cfg; + + if (cfg->pp.pp_cap == 0) + return (false); + + if ((cfg->pp.pp_cap & (1 << (PCIM_PCAP_PME_SHIFT + flag))) != 0) + return (true); + + return (false); +} + +static inline int +pci_disable_link_state(struct pci_dev *pdev, uint32_t flags) +{ + + if (!pci_enable_aspm) + return (-EPERM); + + return (-ENXIO); +} + static inline int pci_read_config_byte(struct pci_dev *pdev, int where, u8 *val) { @@ -1052,6 +1108,38 @@ pcie_bandwidth_available(struct pci_dev *pdev, return (nwidth * PCIE_SPEED2MBS_ENC(nspeed)); } +static inline struct pci_dev * +pcie_find_root_port(struct pci_dev *pdev) +{ + device_t root; + + if (pdev->root != NULL) + return (pdev->root); + + root = pci_find_pcie_root_port(pdev->dev.bsddev); + if (root == NULL) + return (NULL); + + pdev->root = lkpinew_pci_dev(root); + return (pdev->root); +} + +/* This is needed when people rip out the device "HotPlug". */ +static inline void +pci_lock_rescan_remove(void) +{ +} + +static inline void +pci_unlock_rescan_remove(void) +{ +} + +static __inline void +pci_stop_and_remove_bus_device(struct pci_dev *pdev) +{ +} + /* * The following functions can be used to attach/detach the LinuxKPI's * PCI device runtime. The pci_driver and pci_device_id pointer is diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 7aa159600faa..030951175a42 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -243,11 +243,13 @@ lkpinew_pci_dev_release(struct device *dev) struct pci_dev *pdev; pdev = to_pci_dev(dev); + if (pdev->root != NULL) + pci_dev_put(pdev->root); free(pdev->bus, M_DEVBUF); free(pdev, M_DEVBUF); } -static struct pci_dev * +struct pci_dev * lkpinew_pci_dev(device_t dev) { struct pci_dev *pdev; @@ -408,6 +410,8 @@ linux_pci_detach_device(struct pci_dev *pdev) if (pdev->pdrv != NULL) pdev->pdrv->remove(pdev); + if (pdev->root != NULL) + pci_dev_put(pdev->root); free(pdev->bus, M_DEVBUF); linux_pdev_dma_uninit(pdev); From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A503B65F842; Sun, 18 Jul 2021 00:36:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dh6N6Tz4Rmv; Sun, 18 Jul 2021 00:36:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 790371A69C; Sun, 18 Jul 2021 00:36:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0asqp049739; Sun, 18 Jul 2021 00:36:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ass2049738; Sun, 18 Jul 2021 00:36:54 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:54 GMT Message-Id: <202107180036.16I0ass2049738@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: d2c8c4d15a6e - stable/13 - LinuxKPI: fix sg_pcopy_from_buffer() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2c8c4d15a6e65657b52b058b38d609e65202ad4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:58 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c8c4d15a6e65657b52b058b38d609e65202ad4 commit d2c8c4d15a6e65657b52b058b38d609e65202ad4 Author: Bjoern A. Zeeb AuthorDate: 2021-06-07 15:00:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:04 +0000 LinuxKPI: fix sg_pcopy_from_buffer() In sg_pcopy_from_buffer() is an error in that skip can underflow and lead to bogus page arithmetics which may lead to memory corruption or more likely panics. Once we found a s/g page to copy into there is nothing to skip anymore so simply set skip to 0. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30676 (cherry picked from commit edfcdffefc1671b7688c8806ae1f59484954dcc7) --- sys/compat/linuxkpi/common/include/linux/scatterlist.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h index ebf0632f6f58..5e42876facd0 100644 --- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h +++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h @@ -520,12 +520,13 @@ sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents, memcpy(p, b, len); sf_buf_free(sf); + /* We copied so nothing more to skip. */ + skip = 0; copied += len; /* Either we exactly filled the page, or we are done. */ buflen -= len; if (buflen == 0) break; - skip -= len; b += len; } sched_unpin(); From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E60E65F0F7; Sun, 18 Jul 2021 00:36:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dM12wMz4Rb5; Sun, 18 Jul 2021 00:36:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E7381A697; Sun, 18 Jul 2021 00:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aaF1049337; Sun, 18 Jul 2021 00:36:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aabq049336; Sun, 18 Jul 2021 00:36:36 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:36 GMT Message-Id: <202107180036.16I0aabq049336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3da0b61e0630 - stable/13 - LinuxKPI: add Exponentially Weighted Moving Average implementation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3da0b61e06301c9a397a8c5463f7aee61de21a0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:40 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3da0b61e06301c9a397a8c5463f7aee61de21a0a commit 3da0b61e06301c9a397a8c5463f7aee61de21a0a Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:42:25 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 LinuxKPI: add Exponentially Weighted Moving Average implementation Add DECLARE_EWMA() which expands to a per-name EWMA implementation as used by multiple wireless drivers. Sposnored by: The FreeBSD Foundation Reviewed by: hselasky, cperciva, dwmalone Differential Revision: https://reviews.freebsd.org/D30415 (cherry picked from commit 32f753f27032849de685c15c471034cbc945a544) --- sys/compat/linuxkpi/common/include/linux/average.h | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/average.h b/sys/compat/linuxkpi/common/include/linux/average.h new file mode 100644 index 000000000000..4291bf2d85be --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/average.h @@ -0,0 +1,92 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_AVERAGE_H +#define __LKPI_LINUX_AVERAGE_H + +#include +#include +#include +#include + +/* EWMA stands for Exponentially Weighted Moving Average. */ +/* + * Z_t = d X_t + (1 - d) * Z_(t-1); 0 < d <= 1, t >= 1; Roberts (1959). + * t : observation number in time. + * d : weight for current observation. + * Xt : observations over time. + * Zt : EWMA value after observation t. + * + * wmba_*_read seems to return up-to [u]long values; have to deal with 32/64bit. + * According to the ath5k.h change log this seems to be a fix-(_p)recision impl. + * assert 2/4 bits for frac. + * Also all (_d) values seem to be pow2 which simplifies maths (shift by + * d = ilog2(_d) instead of doing division (d = 1/_d)). Keep it this way until + * we hit the CTASSERT. + */ + +#define DECLARE_EWMA(_name, _p, _d) \ + \ + CTASSERT((sizeof(unsigned long) <= 4) ? (_p < 30) : (_p < 60)); \ + CTASSERT(_d > 0 && powerof2(_d)); \ + \ + struct ewma_ ## _name { \ + unsigned long zt; \ + }; \ + \ + static __inline void \ + ewma_ ## _name ## _init(struct ewma_ ## _name *ewma) \ + { \ + /* No target (no historical data). */ \ + ewma->zt = 0; \ + } \ + \ + static __inline void \ + ewma_ ## _name ## _add(struct ewma_ ## _name *ewma, unsigned long x) \ + { \ + unsigned long ztm1 = ewma->zt; /* Z_(t-1). */ \ + int d = ilog2(_d); \ + \ + if (ewma->zt == 0) \ + ewma->zt = x << (_p); \ + else \ + ewma->zt = ((x << (_p)) >> d) + \ + (((ztm1 << d) - ztm1) >> d); \ + } \ + \ + static __inline unsigned long \ + ewma_ ## _name ## _read(struct ewma_ ## _name *ewma) \ + { \ + return (ewma->zt >> (_p)); \ + } \ + +#endif /* __LKPI_LINUX_AVERAGE_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8095E65F781; Sun, 18 Jul 2021 00:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dP60WBz4RTJ; Sun, 18 Jul 2021 00:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF57F1A473; Sun, 18 Jul 2021 00:36:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ade5049409; Sun, 18 Jul 2021 00:36:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0adJK049408; Sun, 18 Jul 2021 00:36:39 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:39 GMT Message-Id: <202107180036.16I0adJK049408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 70c9c5431fb7 - stable/13 - mlx4: replace LinuxKPI macros with ifnet functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 70c9c5431fb75653bc12f8ae4476f062baad7aaf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:42 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=70c9c5431fb75653bc12f8ae4476f062baad7aaf commit 70c9c5431fb75653bc12f8ae4476f062baad7aaf Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 17:47:02 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 mlx4: replace LinuxKPI macros with ifnet functions The LinuxKPI net_device actually is an ifnet; in order to further clean that up so we can extend "net_device" replace the few macros inline in mlx4. Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30476 (cherry picked from commit 60afad6fc307815ad2b70a9974d908b6d5d50674) --- sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c | 2 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 21 +++++++++++---------- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c index 76f78a9e2c9d..33c0f9e6b4e2 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c @@ -98,7 +98,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr if (gid_attr.ndev) { vlan_tag = rdma_vlan_dev_vlan_id(gid_attr.ndev); memcpy(ah->av.eth.s_mac, IF_LLADDR(gid_attr.ndev), ETH_ALEN); - dev_put(gid_attr.ndev); + if_rele(gid_attr.ndev); } if (vlan_tag < 0x1000) vlan_tag |= (ah_attr->sl & 7) << 13; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index b31744e73be6..b050272e49d0 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -156,7 +156,7 @@ static struct net_device *mlx4_ib_get_netdev(struct ib_device *device, u8 port_n } #endif if (dev) - dev_hold(dev); + if_ref(dev); rcu_read_unlock(); return dev; @@ -415,7 +415,7 @@ int mlx4_ib_gid_index_to_real_index(struct mlx4_ib_dev *ibdev, return ret; if (attr.ndev) - dev_put(attr.ndev); + if_rele(attr.ndev); if (!memcmp(&gid, &zgid, sizeof(gid))) return -EINVAL; @@ -736,7 +736,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, tmp = iboe_get_mtu(ndev->if_mtu); props->active_mtu = tmp ? min(props->max_mtu, tmp) : IB_MTU_256; - props->state = (netif_running(ndev) && netif_carrier_ok(ndev)) ? + props->state = ((ndev->if_drv_flags & IFF_DRV_RUNNING) != 0 && + ndev->if_link_state == LINK_STATE_UP) ? IB_PORT_ACTIVE : IB_PORT_DOWN; props->phys_state = state_to_phys_state(props->state); out_unlock: @@ -1356,12 +1357,12 @@ int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp, spin_lock_bh(&mdev->iboe.lock); ndev = mdev->iboe.netdevs[mqp->port - 1]; if (ndev) - dev_hold(ndev); + if_ref(ndev); spin_unlock_bh(&mdev->iboe.lock); if (ndev) { ret = 1; - dev_put(ndev); + if_rele(ndev); } return ret; @@ -2002,10 +2003,10 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) spin_lock_bh(&mdev->iboe.lock); ndev = ge->added ? mdev->iboe.netdevs[ge->port - 1] : NULL; if (ndev) - dev_hold(ndev); + if_ref(ndev); spin_unlock_bh(&mdev->iboe.lock); if (ndev) - dev_put(ndev); + if_rele(ndev); list_del(&ge->list); kfree(ge); } else @@ -2372,7 +2373,7 @@ static int mlx4_ib_netdev_event(struct notifier_block *this, struct net_device *dev = netdev_notifier_info_to_dev(ptr); struct mlx4_ib_dev *ibdev; - if (!net_eq(dev_net(dev), &init_net)) + if (dev->if_vnet != &init_net) return NOTIFY_DONE; ibdev = container_of(this, struct mlx4_ib_dev, iboe.nb); @@ -3111,8 +3112,8 @@ static void handle_bonded_port_state_event(struct work_struct *work) continue; curr_port_state = - (netif_running(curr_netdev) && - netif_carrier_ok(curr_netdev)) ? + ((curr_netdev->if_drv_flags & IFF_DRV_RUNNING) != 0 && + curr_netdev->if_link_state == LINK_STATE_UP) ? IB_PORT_ACTIVE : IB_PORT_DOWN; bonded_port_state = (bonded_port_state != IB_PORT_ACTIVE) ? diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index a3bd86b182cb..3b81797b46b0 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -1783,7 +1783,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, if (!status && gid_attr.ndev) { vlan = rdma_vlan_dev_vlan_id(gid_attr.ndev); memcpy(smac, IF_LLADDR(gid_attr.ndev), ETH_ALEN); - dev_put(gid_attr.ndev); + if_rele(gid_attr.ndev); } } if (status) @@ -2471,7 +2471,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr, &gid_attr); if (!err) { if (gid_attr.ndev) - dev_put(gid_attr.ndev); + if_rele(gid_attr.ndev); if (!memcmp(&sgid, &zgid, sizeof(sgid))) err = -ENOENT; } @@ -2962,7 +2962,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, ah->av.ib.gid_index, &gid, &gid_attr)) { if (gid_attr.ndev) - dev_put(gid_attr.ndev); + if_rele(gid_attr.ndev); qp = (gid_attr.gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) ? to_mqp(sqp->roce_v2_gsi) : qp; } else { From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82D7565F7A1; Sun, 18 Jul 2021 00:36:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dV6Y5bz4RQw; Sun, 18 Jul 2021 00:36:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D2171A494; Sun, 18 Jul 2021 00:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ai3f049511; Sun, 18 Jul 2021 00:36:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ai22049510; Sun, 18 Jul 2021 00:36:44 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:44 GMT Message-Id: <202107180036.16I0ai22049510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a30fe52a12f2 - stable/13 - net80211/LinuxKPI: add more radiotap definitions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a30fe52a12f2d99dcc431c291d3451dae06209bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:48 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a30fe52a12f2d99dcc431c291d3451dae06209bd commit a30fe52a12f2d99dcc431c291d3451dae06209bd Author: Bjoern A. Zeeb AuthorDate: 2021-06-04 17:38:38 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 net80211/LinuxKPI: add more radiotap definitions Add more raditap definitions based on "names" found in actual drivers and based on documentation from radiotap.org (where avail). Leave one specific "duplicate" in the LinuxKPI implementation but otherwise manage it all in net80211. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, adrian, sam Differential Revision: https://reviews.freebsd.org/D30641 (cherry picked from commit b5d37e5a20ab1b189499e2824dc269d998c31989) --- .../common/include/net/ieee80211_radiotap.h | 55 +++++++++ sys/net80211/ieee80211_radiotap.h | 134 +++++++++++++++++++++ 2 files changed, 189 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h b/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h new file mode 100644 index 000000000000..9c22e3e06988 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h @@ -0,0 +1,55 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_NET_IEEE80211_RADIOTAP_H +#define __LKPI_NET_IEEE80211_RADIOTAP_H + +/* Any possibly duplicate content is only maintained in one place now. */ +#include + +/* + * This structure deviates from + * 'https://www.radiotap.org/fields/Vendor%20Namespace.html' + * and the net80211::ieee80211_radiotap_vendor_header version. + * We consider it LinuxKPI specific so it stays here. + */ +struct ieee80211_vendor_radiotap { + u32 present; + u8 align; + u8 oui[3]; + u8 subns; + u8 pad; + __le16 len; + u8 data[0]; +}; + +#endif /* __LKPI_NET_IEEE80211_RADIOTAP_H */ diff --git a/sys/net80211/ieee80211_radiotap.h b/sys/net80211/ieee80211_radiotap.h index f6e76e9fe8aa..bee1c633b53c 100644 --- a/sys/net80211/ieee80211_radiotap.h +++ b/sys/net80211/ieee80211_radiotap.h @@ -367,4 +367,138 @@ enum ieee80211_radiotap_type { #define IEEE80211_RADIOTAP_VHT_BW_20UUL 24 #define IEEE80211_RADIOTAP_VHT_BW_20UUU 25 +/* + * These are found in various drivers already so use them rather than + * going by our own names and changing everything. + */ + +/* https://www.radiotap.org/fields/VHT.html */ +#define IEEE80211_RADIOTAP_VHT_KNOWN_STBC 0x0001 /* net80211::IEEE80211_RADIOTAP_VHT_HAVE_STBC */ +#define IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED 0x0020 /* net80211::IEEE80211_RADIOTAP_VHT_HAVE_BF */ + +/* https://www.radiotap.org/fields/0-length-PSDU.html */ +#define IEEE80211_RADIOTAP_ZERO_LEN_PSDU_SOUNDING 0x00 +#define IEEE80211_RADIOTAP_ZERO_LEN_PSDU_NOT_CAPTURED 0x01 +#define IEEE80211_RADIOTAP_ZERO_LEN_PSDU_VENDOR 0xFF + +/* https://www.radiotap.org/fields/HE.html */ +struct ieee80211_radiotap_he { + uint16_t data1, data2, data3, data4, data5, data6; +}; + +#define IEEE80211_RADIOTAP_HE_DATA1_FORMAT_SU 0x0000 +#define IEEE80211_RADIOTAP_HE_DATA1_FORMAT_EXT_SU 0x0001 +#define IEEE80211_RADIOTAP_HE_DATA1_FORMAT_MU 0x0002 +#define IEEE80211_RADIOTAP_HE_DATA1_FORMAT_TRIG 0x0003 +#define IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN 0x0004 +#define IEEE80211_RADIOTAP_HE_DATA1_BEAM_CHANGE_KNOWN 0x0008 +#define IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN 0x0010 +#define IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN 0x0020 +#define IEEE80211_RADIOTAP_HE_DATA1_DATA_DCM_KNOWN 0x0040 +#define IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN 0x0080 +#define IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN 0x0100 +#define IEEE80211_RADIOTAP_HE_DATA1_STBC_KNOWN 0x0200 +#define IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN 0x0400 +#define IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE2_KNOWN 0x0800 +#define IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE3_KNOWN 0x1000 +#define IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE4_KNOWN 0x2000 +#define IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN 0x4000 +#define IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN 0x8000 + +#define IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_KNOWN 0x0001 +#define IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN 0x0002 +#define IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN 0x0004 +#define IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN 0x0008 +#define IEEE80211_RADIOTAP_HE_DATA2_TXBF_KNOWN 0x0010 +#define IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN 0x0020 +#define IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN 0x0040 +/* #define IEEE80211_RADIOTAP_HE_DATA2_ midamble periodicity _KNOWN 0x0080 */ +#define IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET 0x3F00 +#define IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET_KNOWN 0x4000 +#define IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC 0x8000 + +#define IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR 0x003F +#define IEEE80211_RADIOTAP_HE_DATA3_BEAM_CHANGE 0x0040 +#define IEEE80211_RADIOTAP_HE_DATA3_UL_DL 0x0080 +/* #deifne IEEE80211_RADIOTAP_HE_DATA3_data_MCS 0x0F00 */ +/* #define IEEE80211_RADIOTAP_HE_DATA3_data_DCM 0x1000 */ +/* #define IEEE80211_RADIOTAP_HE_DATA3_Coding 0x2000 */ +#define IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG 0x4000 +/* #define IEEE80211_RADIOTAP_HE_DATA3_STBC 0x8000 */ + +#define IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE 0x000F +#define IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE1 0x000F +#define IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE2 0x00F0 +#define IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE3 0x0F00 +#define IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE4 0xF000 + +#define IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE 0x00C0 +#define IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_1X 0x1 +#define IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_2X 0x2 +#define IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_4X 0x3 +#define IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS 0x0700 +#define IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD 0x3000 +#define IEEE80211_RADIOTAP_HE_DATA5_TXBF 0x4000 +#define IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG 0x8000 + +#define IEEE80211_RADIOTAP_HE_DATA6_DOPPLER 0x0010 +/* 0x00e0 (reserved) ; use these for the following undocumented. */ +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN 0x0020 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW 0x00C0 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ 0x0 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ 0x1 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ 0x2 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ 0x3 +#define IEEE80211_RADIOTAP_HE_DATA6_TXOP 0x7F00 + +/* https://www.radiotap.org/fields/HE-MU.html */ +struct ieee80211_radiotap_he_mu { + uint16_t flags1; + uint16_t flags2; + uint8_t ru_ch1[4]; + uint8_t ru_ch2[4]; +}; + +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS 0x000F +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS_KNOWN 0x0010 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM 0x0020 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM_KNOWN 0x0040 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_CTR_26T_RU_KNOWN 0x0080 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_RU_KNOWN 0x0100 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_RU_KNOWN 0x0200 +/* reserved 0x0C00 */ +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU_KNOWN 0x1000 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU 0x2000 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_COMP_KNOWN 0x4000 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_SYMS_USERS_KNOWN 0x8000 + +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW 0x0003 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_20MHZ 0x0000 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_40MHZ 0x0001 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_80MHZ 0x0002 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_160MHZ 0x0003 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN 0x0004 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_COMP 0x0008 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_SYMS_USERS 0x00F0 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW 0x0300 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN 0x0400 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_CH2_CTR_26T_RU 0x0800 + +/* https://www.radiotap.org/fields/L-SIG.html */ +struct ieee80211_radiotap_lsig { + uint16_t data1; + uint16_t data2; +}; +#define IEEE80211_RADIOTAP_LSIG_DATA1_LENGTH_KNOWN 0x0002 + +#define IEEE80211_RADIOTAP_LSIG_DATA2_LENGTH 0xFFF0 + +/* https://www.radiotap.org/fields/MCS.html */ +#define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 +#define IEEE80211_RADIOTAP_MCS_HAVE_STBC 0x20 + +/* https://www.radiotap.org/fields/timestamp.html */ +#define IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US 0x01 +#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ 0x10 + #endif /* !_NET80211_IEEE80211_RADIOTAP_H_ */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14DEF65F0F2; Sun, 18 Jul 2021 00:36:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dJ02Qqz4RNC; Sun, 18 Jul 2021 00:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2D071A3C6; Sun, 18 Jul 2021 00:36:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aVWo049235; Sun, 18 Jul 2021 00:36:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aV8U049234; Sun, 18 Jul 2021 00:36:31 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:31 GMT Message-Id: <202107180036.16I0aV8U049234@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: aa8745df01f6 - stable/13 - LinuxKPI: compiler.h add three more defines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aa8745df01f6cd3712abccb921e42dc3e2493ba1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:38 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=aa8745df01f6cd3712abccb921e42dc3e2493ba1 commit aa8745df01f6cd3712abccb921e42dc3e2493ba1 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:59:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 LinuxKPI: compiler.h add three more defines Add fallthrough, ____cacheline_aligned_in_smp, and smp_mb() to linux/compiler.h. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30420 (cherry picked from commit da717031c9fd914343e19ba87f19c7a9a7006721) --- sys/compat/linuxkpi/common/include/linux/compiler.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h index 470e1f151413..e641b1b096c3 100644 --- a/sys/compat/linuxkpi/common/include/linux/compiler.h +++ b/sys/compat/linuxkpi/common/include/linux/compiler.h @@ -65,6 +65,8 @@ #define __always_inline inline #define noinline __noinline #define ____cacheline_aligned __aligned(CACHE_LINE_SIZE) +#define ____cacheline_aligned_in_smp __aligned(CACHE_LINE_SIZE) +#define fallthrough /* FALLTHROUGH */ do { } while(0) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) @@ -78,6 +80,7 @@ #define __printf(a,b) __printflike(a,b) #define barrier() __asm__ __volatile__("": : :"memory") +#define smp_mb() mb() #define lower_32_bits(n) ((u32)(n)) #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5A5A65F53C; Sun, 18 Jul 2021 00:36:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dN15w4z4Rb6; Sun, 18 Jul 2021 00:36:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 730021A472; Sun, 18 Jul 2021 00:36:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0abmF049361; Sun, 18 Jul 2021 00:36:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0abj9049360; Sun, 18 Jul 2021 00:36:37 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:37 GMT Message-Id: <202107180036.16I0abj9049360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 2b1e0392da82 - stable/13 - LinuxKPI: add addrconf_addr_solict_mult() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b1e0392da8208755e8985eb90d5a823a77572df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:40 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2b1e0392da8208755e8985eb90d5a823a77572df commit 2b1e0392da8208755e8985eb90d5a823a77572df Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:49:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 LinuxKPI: add addrconf_addr_solict_mult() Introduce net/addrconf.h with an implementation to addrconf_addr_solict_mult() used by WiFi drivers. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30416 (cherry picked from commit 095f018e4915bf63447ecd6be3beae0dd1a5ff52) --- sys/compat/linuxkpi/common/include/net/addrconf.h | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/net/addrconf.h b/sys/compat/linuxkpi/common/include/net/addrconf.h new file mode 100644 index 000000000000..32bbaf176336 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/net/addrconf.h @@ -0,0 +1,51 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_NET_ADDRCONF_H +#define __LKPI_NET_ADDRCONF_H + +#include +#include + +static __inline void +addrconf_addr_solict_mult(struct in6_addr *ia6, struct in6_addr *sol) +{ + + sol->s6_addr16[0] = IPV6_ADDR_INT16_MLL; + sol->s6_addr16[1] = 0; + sol->s6_addr32[1] = 0; + sol->s6_addr32[2] = IPV6_ADDR_INT32_ONE; + sol->s6_addr32[3] = ia6->s6_addr32[3]; + sol->s6_addr8[12] = 0xff; +} + +#endif /* __LKPI_NET_ADDRCONF_H */ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81E5D65F70E; Sun, 18 Jul 2021 00:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dQ65CKz4RbL; Sun, 18 Jul 2021 00:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEF581A614; Sun, 18 Jul 2021 00:36:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aetb049439; Sun, 18 Jul 2021 00:36:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aeWc049438; Sun, 18 Jul 2021 00:36:40 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:40 GMT Message-Id: <202107180036.16I0aeWc049438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: cc884fdb2933 - stable/13 - OFED: migrate LinuxKPI net_device/ifnet macros into ofed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cc884fdb2933c3c911620fc66faab157708cf13c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:44 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=cc884fdb2933c3c911620fc66faab157708cf13c commit cc884fdb2933c3c911620fc66faab157708cf13c Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 17:51:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 OFED: migrate LinuxKPI net_device/ifnet macros into ofed The LinuxKPI net_device actually is an ifnet; in order to further clean that up so we can extend "net_device" migrate the few macros left into ofed and make sure the header is included in all files which need access to the macros. Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30477 (cherry picked from commit 825b7d4c9d1d7cb0c79ffe002bc1bd58f28e1a67) --- sys/ofed/drivers/infiniband/core/ib_cache.c | 1 + sys/ofed/drivers/infiniband/core/ib_cm.c | 1 + sys/ofed/drivers/infiniband/core/ib_sysfs.c | 1 + sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 + sys/ofed/include/rdma/ib_addr.h | 7 +++++++ 5 files changed, 11 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cache.c b/sys/ofed/drivers/infiniband/core/ib_cache.c index ac6382f69b95..a5bc498303c6 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cache.c +++ b/sys/ofed/drivers/infiniband/core/ib_cache.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "core_priv.h" diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 28c52c0cb2f2..7d5197cc4a0d 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include "cm_msgs.h" diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index 5f848a7a69db..fb9884a7ea08 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index 27f4da93ccba..1e4358ba0a15 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include MODULE_AUTHOR("Roland Dreier"); diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h index 535e6c2b3b14..cea39f288207 100644 --- a/sys/ofed/include/rdma/ib_addr.h +++ b/sys/ofed/include/rdma/ib_addr.h @@ -51,6 +51,13 @@ #include #include +/* Linux netdevice.h but for working on an ifnet rather than a net_device. */ +#define dev_hold(d) if_ref(d) +#define dev_put(d) if_rele(d) +#define dev_net(d) ((d)->if_vnet) +#define net_eq(a,b) ((a) == (b)) + + struct rdma_addr_client { atomic_t refcount; struct completion comp; From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E35B665F5D7; Sun, 18 Jul 2021 00:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dS3s54z4RkN; Sun, 18 Jul 2021 00:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18C541A3C7; Sun, 18 Jul 2021 00:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0afOo049463; Sun, 18 Jul 2021 00:36:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0afAC049462; Sun, 18 Jul 2021 00:36:41 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:41 GMT Message-Id: <202107180036.16I0afAC049462@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1b9b5de489c2 - stable/13 - LinuxKPI: netdevice.h remove more ifnet operating macros MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b9b5de489c23790c33614e6db3fe6d8984e3a74 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:45 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1b9b5de489c23790c33614e6db3fe6d8984e3a74 commit 1b9b5de489c23790c33614e6db3fe6d8984e3a74 Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 17:55:21 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 LinuxKPI: netdevice.h remove more ifnet operating macros Now that mlx4 and ofed either are operating on ifnet functions directly or have a private copy of these macros, we can remove them from linux/netdevice.h. With this only the #define for net_device to ifnet is left. Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30478 (cherry picked from commit 9b6835f3ab7f05728caeaaa2ade09e80f1c5e825) --- sys/compat/linuxkpi/common/include/linux/netdevice.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h index 07c111cc4fc9..faff2fde5f32 100644 --- a/sys/compat/linuxkpi/common/include/linux/netdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h @@ -53,15 +53,6 @@ #define net_device ifnet -#define dev_hold(d) if_ref(d) -#define dev_put(d) if_rele(d) -#define dev_net(d) ((d)->if_vnet) - -#define net_eq(a,b) ((a) == (b)) - -#define netif_running(dev) !!((dev)->if_drv_flags & IFF_DRV_RUNNING) -#define netif_carrier_ok(dev) ((dev)->if_link_state == LINK_STATE_UP) - #define rtnl_lock() #define rtnl_unlock() From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57E5A65F561; Sun, 18 Jul 2021 00:36:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dg62P7z4Rmt; Sun, 18 Jul 2021 00:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43B981A616; Sun, 18 Jul 2021 00:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aqAa049691; Sun, 18 Jul 2021 00:36:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0aqDb049690; Sun, 18 Jul 2021 00:36:52 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:52 GMT Message-Id: <202107180036.16I0aqDb049690@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: d2127676cd1a - stable/13 - LinuxKPI: fix pci device devres initialisation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2127676cd1a5f46aef793c911005d91774eb966 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:57 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d2127676cd1a5f46aef793c911005d91774eb966 commit d2127676cd1a5f46aef793c911005d91774eb966 Author: Bjoern A. Zeeb AuthorDate: 2021-06-07 17:26:14 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:04 +0000 LinuxKPI: fix pci device devres initialisation Given we are manually setting up the "device" in PCI in some cases, we need to initialise the list and lock for device devres here as well as otherwise we will panic on the uninitialised lock. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30681 (cherry picked from commit c3518147ceb301b01763c3754697731a24410565) --- sys/compat/linuxkpi/common/src/linux_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 030951175a42..9738f9e6f51a 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -235,6 +235,8 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev)); kobject_add(&pdev->dev.kobj, &linux_root_device.kobj, kobject_name(&pdev->dev.kobj)); + spin_lock_init(&pdev->dev.devres_lock); + INIT_LIST_HEAD(&pdev->dev.devres_head); } static void From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C30B65F548; Sun, 18 Jul 2021 00:36:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dT3vKXz4RkX; Sun, 18 Jul 2021 00:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33BCE1A69A; Sun, 18 Jul 2021 00:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ah03049487; Sun, 18 Jul 2021 00:36:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ahrv049486; Sun, 18 Jul 2021 00:36:43 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:43 GMT Message-Id: <202107180036.16I0ahrv049486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b5519f2ce733 - stable/13 - LinuxKPI: add HWEIGHT32() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b5519f2ce733deec02e3fd398fe8a02dc6826899 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:46 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b5519f2ce733deec02e3fd398fe8a02dc6826899 commit b5519f2ce733deec02e3fd398fe8a02dc6826899 Author: Bjoern A. Zeeb AuthorDate: 2021-05-27 13:09:40 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 LinuxKPI: add HWEIGHT32() Add HWEIGHT32() macro needed by iwlwifi and while here add the 8/16/64 variants likewise. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30501 (cherry picked from commit 4cc8a9da491d10f1b4bad6a50730b67dd5e899c7) --- sys/compat/linuxkpi/common/include/linux/bitops.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 0e25fd3cfb1d..49bfc4cc7414 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -63,6 +63,11 @@ #define hweight64(x) bitcount64(x) #define hweight_long(x) bitcountl(x) +#define HWEIGHT8(x) (bitcount8((uint8_t)(x)) + 1) +#define HWEIGHT16(x) (bitcount16(x) + 1) +#define HWEIGHT32(x) (bitcount32(x) + 1) +#define HWEIGHT64(x) (bitcount64(x) + 1) + static inline int __ffs(int mask) { From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C9E765F7B0; Sun, 18 Jul 2021 00:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dY4wBcz4Rc6; Sun, 18 Jul 2021 00:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A55021A475; Sun, 18 Jul 2021 00:36:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0akVu049565; Sun, 18 Jul 2021 00:36:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0akHn049564; Sun, 18 Jul 2021 00:36:46 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:46 GMT Message-Id: <202107180036.16I0akHn049564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b9e51ecb5a47 - stable/13 - mlx4/OFED: replace the struct net_device with struct ifnet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b9e51ecb5a477ed5b0c3e9c67f09472ed6d0a46a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:51 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b9e51ecb5a477ed5b0c3e9c67f09472ed6d0a46a commit b9e51ecb5a477ed5b0c3e9c67f09472ed6d0a46a Author: Bjoern A. Zeeb AuthorDate: 2021-06-04 15:36:08 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 mlx4/OFED: replace the struct net_device with struct ifnet Given all the code does operate on struct ifnet, the last step in this longer series of changes now is to rename struct net_device to struct ifnet (that is what it was defined to in the LinuxKPi code). While mlx4 and OFED are "shared" code the decision was made years ago to not write it based on the netdevice KPI but the native ifnet KPI for most of it. This commit simply spells this out and with that frees "struct netdevice" to be re-done on LinuxKPI to become a more native/mixed implementation over time as needed by, e.g., wireless drivers. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30515 (cherry picked from commit 1411f52facc2b955584f2cb453b912a903e319ed) --- sys/dev/mlx4/mlx4_en/en.h | 30 ++++++------- sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c | 50 +++++++++++----------- sys/dev/mlx4/mlx4_en/mlx4_en_port.c | 4 +- sys/dev/mlx4/mlx4_en/mlx4_en_resources.c | 2 +- sys/dev/mlx4/mlx4_en/mlx4_en_rx.c | 6 +-- sys/dev/mlx4/mlx4_en/mlx4_en_tx.c | 6 +-- sys/dev/mlx4/mlx4_ib/mlx4_ib.h | 2 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 22 +++++----- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 2 +- sys/ofed/drivers/infiniband/core/core_priv.h | 10 ++--- sys/ofed/drivers/infiniband/core/ib_addr.c | 8 ++-- sys/ofed/drivers/infiniband/core/ib_cache.c | 16 +++---- sys/ofed/drivers/infiniband/core/ib_cm.c | 2 +- sys/ofed/drivers/infiniband/core/ib_cma.c | 44 +++++++++---------- sys/ofed/drivers/infiniband/core/ib_device.c | 10 ++--- sys/ofed/drivers/infiniband/core/ib_multicast.c | 2 +- .../drivers/infiniband/core/ib_roce_gid_mgmt.c | 24 +++++------ sys/ofed/drivers/infiniband/core/ib_sa_query.c | 6 +-- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 14 +++--- sys/ofed/include/rdma/ib_addr.h | 12 +++--- sys/ofed/include/rdma/ib_cache.h | 4 +- sys/ofed/include/rdma/ib_sa.h | 4 +- sys/ofed/include/rdma/ib_verbs.h | 10 ++--- 23 files changed, 145 insertions(+), 145 deletions(-) diff --git a/sys/dev/mlx4/mlx4_en/en.h b/sys/dev/mlx4/mlx4_en/en.h index e63027bc9dc0..4a8b4fbd5fd4 100644 --- a/sys/dev/mlx4/mlx4_en/en.h +++ b/sys/dev/mlx4/mlx4_en/en.h @@ -385,7 +385,7 @@ struct mlx4_en_cq { struct mlx4_hwq_resources wqres; int ring; spinlock_t lock; - struct net_device *dev; + struct ifnet *dev; /* Per-core Tx cq processing support */ struct timer_list timer; int size; @@ -445,7 +445,7 @@ struct mlx4_en_dev { struct mlx4_dev *dev; struct pci_dev *pdev; struct mutex state_lock; - struct net_device *pndev[MLX4_MAX_PORTS + 1]; + struct ifnet *pndev[MLX4_MAX_PORTS + 1]; u32 port_cnt; bool device_up; struct mlx4_en_profile profile; @@ -536,7 +536,7 @@ struct en_port { struct mlx4_en_priv { struct mlx4_en_dev *mdev; struct mlx4_en_port_profile *prof; - struct net_device *dev; + struct ifnet *dev; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; struct mlx4_en_port_state port_state; spinlock_t stats_lock; @@ -655,7 +655,7 @@ struct mlx4_mac_entry { }; static inline void * -netdev_priv(const struct net_device *dev) +netdev_priv(const struct ifnet *dev) { return (dev->if_softc); } @@ -709,7 +709,7 @@ static inline bool mlx4_en_cq_lock_poll(struct mlx4_en_cq *cq) int rc = true; spin_lock_bh(&cq->poll_lock); if ((cq->state & MLX4_CQ_LOCKED)) { - struct net_device *dev = cq->dev; + struct ifnet *dev = cq->dev; struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring]; @@ -778,12 +778,12 @@ static inline bool mlx4_en_cq_busy_polling(struct mlx4_en_cq *cq) #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63) -void mlx4_en_destroy_netdev(struct net_device *dev); +void mlx4_en_destroy_netdev(struct ifnet *dev); int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, struct mlx4_en_port_profile *prof); -int mlx4_en_start_port(struct net_device *dev); -void mlx4_en_stop_port(struct net_device *dev); +int mlx4_en_start_port(struct ifnet *dev); +void mlx4_en_stop_port(struct ifnet *dev); void mlx4_en_free_resources(struct mlx4_en_priv *priv); int mlx4_en_alloc_resources(struct mlx4_en_priv *priv); @@ -799,7 +799,7 @@ int mlx4_en_set_cq_moder(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq); int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq); void mlx4_en_tx_irq(struct mlx4_cq *mcq); -u16 mlx4_en_select_queue(struct net_device *dev, struct mbuf *mb); +u16 mlx4_en_select_queue(struct ifnet *dev, struct mbuf *mb); int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp); int mlx4_en_transmit(struct ifnet *dev, struct mbuf *m); @@ -826,7 +826,7 @@ void mlx4_en_rx_que(void *context, int pending); int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring); -int mlx4_en_process_rx_cq(struct net_device *dev, +int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget); void mlx4_en_poll_tx_cq(unsigned long data); @@ -836,7 +836,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event); int mlx4_en_map_buffer(struct mlx4_buf *buf); void mlx4_en_unmap_buffer(struct mlx4_buf *buf); -void mlx4_en_calc_rx_buf(struct net_device *dev); +void mlx4_en_calc_rx_buf(struct ifnet *dev); const u32 *mlx4_en_get_rss_key(struct mlx4_en_priv *priv, u16 *keylen); u8 mlx4_en_get_rss_mask(struct mlx4_en_priv *priv); @@ -844,7 +844,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv); void mlx4_en_release_rss_steer(struct mlx4_en_priv *priv); int mlx4_en_create_drop_qp(struct mlx4_en_priv *priv); void mlx4_en_destroy_drop_qp(struct mlx4_en_priv *priv); -int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring); +int mlx4_en_free_tx_buf(struct ifnet *dev, struct mlx4_en_tx_ring *ring); void mlx4_en_rx_irq(struct mlx4_cq *mcq); int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv); @@ -862,7 +862,7 @@ extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops; extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_pfc_ops; #endif -int mlx4_en_setup_tc(struct net_device *dev, u8 up); +int mlx4_en_setup_tc(struct ifnet *dev, u8 up); #ifdef CONFIG_RFS_ACCEL void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv, @@ -870,7 +870,7 @@ void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv, #endif #define MLX4_EN_NUM_SELF_TEST 5 -void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf); +void mlx4_en_ex_selftest(struct ifnet *dev, u32 *flags, u64 *buf); void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev); /* @@ -882,7 +882,7 @@ void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev); u64 mlx4_en_get_cqe_ts(struct mlx4_cqe *cqe); /* Functions for caching and restoring statistics */ -int mlx4_en_get_sset_count(struct net_device *dev, int sset); +int mlx4_en_get_sset_count(struct ifnet *dev, int sset); void mlx4_en_restore_ethtool_stats(struct mlx4_en_priv *priv, u64 *data); diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c index b36afc66d476..eec620f5b90e 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c @@ -64,7 +64,7 @@ static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv); static int mlx4_en_low_latency_recv(struct napi_struct *napi) { struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); - struct net_device *dev = cq->dev; + struct ifnet *dev = cq->dev; struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring]; int done; @@ -288,7 +288,7 @@ mlx4_en_filter_find(struct mlx4_en_priv *priv, __be32 src_ip, __be32 dst_ip, } static int -mlx4_en_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, +mlx4_en_filter_rfs(struct ifnet *net_dev, const struct sk_buff *skb, u16 rxq_index, u32 flow_id) { struct mlx4_en_priv *priv = netdev_priv(net_dev); @@ -400,7 +400,7 @@ static void mlx4_en_filter_rfs_expire(struct mlx4_en_priv *priv) } #endif -static void mlx4_en_vlan_rx_add_vid(void *arg, struct net_device *dev, u16 vid) +static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -427,7 +427,7 @@ static void mlx4_en_vlan_rx_add_vid(void *arg, struct net_device *dev, u16 vid) } -static void mlx4_en_vlan_rx_kill_vid(void *arg, struct net_device *dev, u16 vid) +static void mlx4_en_vlan_rx_kill_vid(void *arg, struct ifnet *dev, u16 vid) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -606,7 +606,7 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv) } } -static void mlx4_en_clear_uclist(struct net_device *dev) +static void mlx4_en_clear_uclist(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_addr_list *tmp, *uc_to_del; @@ -635,7 +635,7 @@ static u_int mlx4_copy_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) return (1); } -static void mlx4_en_cache_uclist(struct net_device *dev) +static void mlx4_en_cache_uclist(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); @@ -643,7 +643,7 @@ static void mlx4_en_cache_uclist(struct net_device *dev) if_foreach_lladdr(dev, mlx4_copy_addr, priv); } -static void mlx4_en_clear_mclist(struct net_device *dev) +static void mlx4_en_clear_mclist(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_addr_list *tmp, *mc_to_del; @@ -671,7 +671,7 @@ static u_int mlx4_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) return (1); } -static void mlx4_en_cache_mclist(struct net_device *dev) +static void mlx4_en_cache_mclist(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); @@ -728,7 +728,7 @@ static void update_addr_list_flags(struct mlx4_en_priv *priv, } } -static void mlx4_en_set_rx_mode(struct net_device *dev) +static void mlx4_en_set_rx_mode(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); @@ -842,7 +842,7 @@ static void mlx4_en_clear_promisc_mode(struct mlx4_en_priv *priv, } static void mlx4_en_do_multicast(struct mlx4_en_priv *priv, - struct net_device *dev, + struct ifnet *dev, struct mlx4_en_dev *mdev) { struct mlx4_en_addr_list *addr_list, *tmp; @@ -977,7 +977,7 @@ static void mlx4_en_do_multicast(struct mlx4_en_priv *priv, } static void mlx4_en_do_unicast(struct mlx4_en_priv *priv, - struct net_device *dev, + struct ifnet *dev, struct mlx4_en_dev *mdev) { struct mlx4_en_addr_list *addr_list, *tmp; @@ -1011,7 +1011,7 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work) struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, rx_mode_task); struct mlx4_en_dev *mdev = priv->mdev; - struct net_device *dev = priv->dev; + struct ifnet *dev = priv->dev; mutex_lock(&mdev->state_lock); if (!mdev->device_up) { @@ -1258,7 +1258,7 @@ static void mlx4_en_linkstate(struct work_struct *work) } -int mlx4_en_start_port(struct net_device *dev) +int mlx4_en_start_port(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -1451,7 +1451,7 @@ cq_err: } -void mlx4_en_stop_port(struct net_device *dev) +void mlx4_en_stop_port(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -1568,7 +1568,7 @@ static void mlx4_en_restart(struct work_struct *work) struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, watchdog_task); struct mlx4_en_dev *mdev = priv->mdev; - struct net_device *dev = priv->dev; + struct ifnet *dev = priv->dev; struct mlx4_en_tx_ring *ring; int i; @@ -1601,7 +1601,7 @@ reset: mutex_unlock(&mdev->state_lock); } -static void mlx4_en_clear_stats(struct net_device *dev) +static void mlx4_en_clear_stats(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -1635,7 +1635,7 @@ static void mlx4_en_open(void* arg) struct mlx4_en_priv *priv; struct mlx4_en_dev *mdev; - struct net_device *dev; + struct ifnet *dev; int err = 0; priv = arg; @@ -1760,7 +1760,7 @@ struct en_port_attribute en_port_attr_##_name = __ATTR_RO(_name) #define EN_PORT_ATTR(_name, _mode, _show, _store) \ struct en_port_attribute en_port_attr_##_name = __ATTR(_name, _mode, _show, _store) -void mlx4_en_destroy_netdev(struct net_device *dev) +void mlx4_en_destroy_netdev(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -1815,7 +1815,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev) } -static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu) +static int mlx4_en_change_mtu(struct ifnet *dev, int new_mtu) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -2137,7 +2137,7 @@ out: int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, struct mlx4_en_port_profile *prof) { - struct net_device *dev; + struct ifnet *dev; struct mlx4_en_priv *priv; uint8_t dev_addr[ETHER_ADDR_LEN]; int err; @@ -2350,7 +2350,7 @@ out: return err; } -static int mlx4_en_set_ring_size(struct net_device *dev, +static int mlx4_en_set_ring_size(struct ifnet *dev, int rx_size, int tx_size) { struct mlx4_en_priv *priv = netdev_priv(dev); @@ -2424,7 +2424,7 @@ static int mlx4_en_set_tx_ring_size(SYSCTL_HANDLER_ARGS) return (error); } -static int mlx4_en_get_module_info(struct net_device *dev, +static int mlx4_en_get_module_info(struct ifnet *dev, struct ethtool_modinfo *modinfo) { struct mlx4_en_priv *priv = netdev_priv(dev); @@ -2471,7 +2471,7 @@ static int mlx4_en_get_module_info(struct net_device *dev, return 0; } -static int mlx4_en_get_module_eeprom(struct net_device *dev, +static int mlx4_en_get_module_eeprom(struct ifnet *dev, struct ethtool_eeprom *ee, u8 *data) { @@ -2539,7 +2539,7 @@ static int mlx4_en_read_eeprom(SYSCTL_HANDLER_ARGS) int error; int result = 0; struct mlx4_en_priv *priv; - struct net_device *dev; + struct ifnet *dev; struct ethtool_modinfo modinfo; struct ethtool_eeprom ee; @@ -2655,7 +2655,7 @@ static int mlx4_en_set_rx_ppp(SYSCTL_HANDLER_ARGS) static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv) { - struct net_device *dev; + struct ifnet *dev; struct sysctl_ctx_list *ctx; struct sysctl_oid *node; struct sysctl_oid_list *node_list; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_port.c b/sys/dev/mlx4/mlx4_en/mlx4_en_port.c index 7e8d2c1550e4..9a0edac109f4 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_port.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_port.c @@ -149,7 +149,7 @@ static u64 en_stats_adder(__be64 *start, __be64 *next, int num) return ret; } -static void mlx4_en_fold_software_stats(struct net_device *dev) +static void mlx4_en_fold_software_stats(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -187,7 +187,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) struct mlx4_counter tmp_vport_stats; struct mlx4_en_stat_out_mbox *mlx4_en_stats; struct mlx4_en_stat_out_flow_control_mbox *flowstats; - struct net_device *dev = mdev->pndev[port]; + struct ifnet *dev = mdev->pndev[port]; struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats; struct mlx4_cmd_mailbox *mailbox; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c b/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c index db8beb501594..5d5508eebebf 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c @@ -43,7 +43,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, int user_prio, struct mlx4_qp_context *context) { struct mlx4_en_dev *mdev = priv->mdev; - struct net_device *dev = priv->dev; + struct ifnet *dev = priv->dev; memset(context, 0, sizeof *context); context->flags = cpu_to_be32(7 << 16 | rss << MLX4_RSS_QPC_FLAG_OFFSET); diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c index e9f0d2f640e1..9e6f4df107bd 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c @@ -338,7 +338,7 @@ void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev) } } -void mlx4_en_calc_rx_buf(struct net_device *dev) +void mlx4_en_calc_rx_buf(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN + @@ -735,7 +735,7 @@ mlx4_en_rss_hash(__be16 status, int udp_rss) * The following calc ensures that when factor==1, it means we are aligned to 64B * and we get the real cqe data*/ #define CQE_FACTOR_INDEX(index, factor) (((index) << (factor)) + (factor)) -int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int budget) +int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_cqe *cqe; @@ -866,7 +866,7 @@ out: /* Rx CQ polling - called by NAPI */ static int mlx4_en_poll_rx_cq(struct mlx4_en_cq *cq, int budget) { - struct net_device *dev = cq->dev; + struct ifnet *dev = cq->dev; struct epoch_tracker et; int done; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c index e07964f3225e..f3a41a15f8b6 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c @@ -308,7 +308,7 @@ done: return (tx_info->nr_txbb); } -int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring) +int mlx4_en_free_tx_buf(struct ifnet *dev, struct mlx4_en_tx_ring *ring) { struct mlx4_en_priv *priv = netdev_priv(dev); int cnt = 0; @@ -344,7 +344,7 @@ mlx4_en_tx_ring_is_full(struct mlx4_en_tx_ring *ring) return (wqs < (HEADROOM + (2 * MLX4_EN_TX_WQE_MAX_WQEBBS))); } -static int mlx4_en_process_tx_cq(struct net_device *dev, +static int mlx4_en_process_tx_cq(struct ifnet *dev, struct mlx4_en_cq *cq) { struct mlx4_en_priv *priv = netdev_priv(dev); @@ -604,7 +604,7 @@ static void hashrandom_init(void *arg) } SYSINIT(hashrandom_init, SI_SUB_RANDOM, SI_ORDER_ANY, &hashrandom_init, NULL); -u16 mlx4_en_select_queue(struct net_device *dev, struct mbuf *mb) +u16 mlx4_en_select_queue(struct ifnet *dev, struct mbuf *mb) { struct mlx4_en_priv *priv = netdev_priv(dev); u32 rings_p_up = priv->num_tx_rings_p_up; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h index d8926110a7a1..100a06b75af7 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h @@ -500,7 +500,7 @@ struct mlx4_port_gid_table { struct mlx4_ib_iboe { spinlock_t lock; - struct net_device *netdevs[MLX4_MAX_PORTS]; + struct ifnet *netdevs[MLX4_MAX_PORTS]; atomic64_t mac[MLX4_MAX_PORTS]; struct notifier_block nb; struct mlx4_port_gid_table gids[MLX4_MAX_PORTS]; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index b050272e49d0..62956607974b 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -131,10 +131,10 @@ static int num_ib_ports(struct mlx4_dev *dev) return ib_ports; } -static struct net_device *mlx4_ib_get_netdev(struct ib_device *device, u8 port_num) +static struct ifnet *mlx4_ib_get_netdev(struct ib_device *device, u8 port_num) { struct mlx4_ib_dev *ibdev = to_mdev(device); - struct net_device *dev; + struct ifnet *dev; rcu_read_lock(); dev = mlx4_get_protocol_dev(ibdev->dev, MLX4_PROT_ETH, port_num); @@ -142,11 +142,11 @@ static struct net_device *mlx4_ib_get_netdev(struct ib_device *device, u8 port_n #if 0 if (dev) { if (mlx4_is_bonded(ibdev->dev)) { - struct net_device *upper = NULL; + struct ifnet *upper = NULL; upper = netdev_master_upper_dev_get_rcu(dev); if (upper) { - struct net_device *active; + struct ifnet *active; active = bond_option_active_slave_get_rcu(netdev_priv(upper)); if (active) @@ -693,7 +693,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, struct mlx4_ib_dev *mdev = to_mdev(ibdev); struct mlx4_ib_iboe *iboe = &mdev->iboe; - struct net_device *ndev; + struct ifnet *ndev; enum ib_mtu tmp; struct mlx4_cmd_mailbox *mailbox; int err = 0; @@ -1348,7 +1348,7 @@ static void mlx4_ib_delete_counters_table(struct mlx4_ib_dev *ibdev, int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp, union ib_gid *gid) { - struct net_device *ndev; + struct ifnet *ndev; int ret = 0; if (!mqp->port) @@ -1960,7 +1960,7 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) struct mlx4_ib_dev *mdev = to_mdev(ibqp->device); struct mlx4_dev *dev = mdev->dev; struct mlx4_ib_qp *mqp = to_mqp(ibqp); - struct net_device *ndev; + struct ifnet *ndev; struct mlx4_ib_gid_entry *ge; struct mlx4_flow_reg_id reg_id = {0, 0}; enum mlx4_protocol prot = MLX4_PROT_IB_IPV6; @@ -2284,7 +2284,7 @@ static void mlx4_ib_diag_cleanup(struct mlx4_ib_dev *ibdev) #define MLX4_IB_INVALID_MAC ((u64)-1) static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev, - struct net_device *dev, + struct ifnet *dev, int port) { u64 new_smac = 0; @@ -2339,7 +2339,7 @@ unlock: } static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, - struct net_device *dev, + struct ifnet *dev, unsigned long event) { @@ -2370,7 +2370,7 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, static int mlx4_ib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { - struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct ifnet *dev = netdev_notifier_info_to_ifp(ptr); struct mlx4_ib_dev *ibdev; if (dev->if_vnet != &init_net) @@ -3105,7 +3105,7 @@ static void handle_bonded_port_state_event(struct work_struct *work) kfree(ew); spin_lock_bh(&ibdev->iboe.lock); for (i = 0; i < MLX4_MAX_PORTS; ++i) { - struct net_device *curr_netdev = ibdev->iboe.netdevs[i]; + struct ifnet *curr_netdev = ibdev->iboe.netdevs[i]; enum ib_port_state curr_port_state; if (!curr_netdev) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index c2a01b26de1c..68dddeb8f1f1 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -107,7 +107,7 @@ static bool mlx5_netdev_match(struct ifnet *ndev, static int mlx5_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { - struct ifnet *ndev = netdev_notifier_info_to_dev(ptr); + struct ifnet *ndev = netdev_notifier_info_to_ifp(ptr); struct mlx5_ib_dev *ibdev = container_of(this, struct mlx5_ib_dev, roce.nb); diff --git a/sys/ofed/drivers/infiniband/core/core_priv.h b/sys/ofed/drivers/infiniband/core/core_priv.h index 7e3401ddf90a..62772fc2a6c5 100644 --- a/sys/ofed/drivers/infiniband/core/core_priv.h +++ b/sys/ofed/drivers/infiniband/core/core_priv.h @@ -79,10 +79,10 @@ void ib_cache_setup(void); void ib_cache_cleanup(void); typedef void (*roce_netdev_callback)(struct ib_device *device, u8 port, - struct net_device *idev, void *cookie); + struct ifnet *idev, void *cookie); typedef int (*roce_netdev_filter)(struct ib_device *device, u8 port, - struct net_device *idev, void *cookie); + struct ifnet *idev, void *cookie); void ib_enum_roce_netdev(struct ib_device *ib_dev, roce_netdev_filter filter, @@ -104,7 +104,7 @@ int ib_cache_gid_parse_type_str(const char *buf); const char *ib_cache_gid_type_str(enum ib_gid_type gid_type); void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port, - struct net_device *ndev, + struct ifnet *ndev, unsigned long gid_type_mask, enum ib_cache_gid_default_mode mode); @@ -115,8 +115,8 @@ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port, union ib_gid *gid, struct ib_gid_attr *attr); int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port, - struct net_device *ndev); -void ib_cache_gid_del_all_by_netdev(struct net_device *ndev); + struct ifnet *ndev); +void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev); int roce_gid_mgmt_init(void); void roce_gid_mgmt_cleanup(void); diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index ef5e264577e0..a8e951721b8d 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -139,7 +139,7 @@ rdma_copy_addr_sub(u8 *dst, const u8 *src, unsigned min, unsigned max) memset(dst + min, 0, max - min); } -int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, +int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct ifnet *dev, const unsigned char *dst_dev_addr) { /* check for loopback device */ @@ -172,7 +172,7 @@ EXPORT_SYMBOL(rdma_copy_addr); int rdma_translate_ip(const struct sockaddr *addr, struct rdma_dev_addr *dev_addr) { - struct net_device *dev; + struct ifnet *dev; int ret; if (dev_addr->bound_dev_if) { @@ -662,7 +662,7 @@ static int addr_resolve(struct sockaddr *src_in, struct rdma_dev_addr *addr) { struct epoch_tracker et; - struct net_device *ndev = NULL; + struct ifnet *ndev = NULL; u8 edst[MAX_ADDR_LEN]; int ret; @@ -852,7 +852,7 @@ static void resolve_cb(int status, struct sockaddr *src_addr, int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, const union ib_gid *dgid, - u8 *dmac, struct net_device *dev, + u8 *dmac, struct ifnet *dev, int *hoplimit) { int ret = 0; diff --git a/sys/ofed/drivers/infiniband/core/ib_cache.c b/sys/ofed/drivers/infiniband/core/ib_cache.c index a5bc498303c6..3680b97ad2bf 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cache.c +++ b/sys/ofed/drivers/infiniband/core/ib_cache.c @@ -183,7 +183,7 @@ static int write_gid(struct ib_device *ib_dev, u8 port, __releases(&table->rwlock) __acquires(&table->rwlock) { int ret = 0; - struct net_device *old_net_dev; + struct ifnet *old_net_dev; enum ib_gid_type old_gid_type; /* in rdma_cap_roce_gid_table, this funciton should be protected by a @@ -311,7 +311,7 @@ static int find_gid(struct ib_gid_table *table, const union ib_gid *gid, return found; } -static void addrconf_ifid_eui48(u8 *eui, struct net_device *dev) +static void addrconf_ifid_eui48(u8 *eui, struct ifnet *dev) { if (dev->if_addrlen != ETH_ALEN) return; @@ -325,7 +325,7 @@ static void addrconf_ifid_eui48(u8 *eui, struct net_device *dev) eui[0] ^= 2; } -static void make_default_gid(struct net_device *dev, union ib_gid *gid) +static void make_default_gid(struct ifnet *dev, union ib_gid *gid) { gid->global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL); addrconf_ifid_eui48(&gid->raw[8], dev); @@ -400,7 +400,7 @@ out_unlock: } int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port, - struct net_device *ndev) + struct ifnet *ndev) { struct ib_gid_table **ports_table = ib_dev->cache.gid_cache; struct ib_gid_table *table; @@ -490,7 +490,7 @@ static int _ib_cache_gid_table_find(struct ib_device *ib_dev, static int ib_cache_gid_find(struct ib_device *ib_dev, const union ib_gid *gid, enum ib_gid_type gid_type, - struct net_device *ndev, u8 *port, + struct ifnet *ndev, u8 *port, u16 *index) { unsigned long mask = GID_ATTR_FIND_MASK_GID | @@ -507,7 +507,7 @@ static int ib_cache_gid_find(struct ib_device *ib_dev, int ib_find_cached_gid_by_port(struct ib_device *ib_dev, const union ib_gid *gid, enum ib_gid_type gid_type, - u8 port, struct net_device *ndev, + u8 port, struct ifnet *ndev, u16 *index) { int local_index; @@ -672,7 +672,7 @@ static void cleanup_gid_table_port(struct ib_device *ib_dev, u8 port, } void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port, - struct net_device *ndev, + struct ifnet *ndev, unsigned long gid_type_mask, enum ib_cache_gid_default_mode mode) { @@ -899,7 +899,7 @@ EXPORT_SYMBOL(ib_get_cached_gid); int ib_find_cached_gid(struct ib_device *device, const union ib_gid *gid, enum ib_gid_type gid_type, - struct net_device *ndev, + struct ifnet *ndev, u8 *port_num, u16 *index) { diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 7d5197cc4a0d..95b442eb0dd1 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -429,7 +429,7 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av, unsigned long flags; int ret; u8 p; - struct net_device *ndev = ib_get_ndev_from_path(path); + struct ifnet *ndev = ib_get_ndev_from_path(path); read_lock_irqsave(&cm.device_lock, flags); list_for_each_entry(cm_dev, &cm.device_list, list) { diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 7c03841d51d7..829d668dbd05 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -444,7 +444,7 @@ static inline void sdp_set_ip_ver(struct sdp_hh *hh, u8 ip_ver) hh->ipv_cap = (ip_ver << 4) | (hh->ipv_cap & 0xF); } -static int cma_igmp_send(struct net_device *ndev, const union ib_gid *mgid, bool join) +static int cma_igmp_send(struct ifnet *ndev, const union ib_gid *mgid, bool join) { int retval; @@ -586,7 +586,7 @@ static inline int cma_validate_port(struct ib_device *device, u8 port, const struct rdma_dev_addr *dev_addr) { const int dev_type = dev_addr->dev_type; - struct net_device *ndev; + struct ifnet *ndev; int ret = -ENODEV; if ((dev_type == ARPHRD_INFINIBAND) && !rdma_protocol_ib(device, port)) @@ -1346,14 +1346,14 @@ static int cma_save_req_info(const struct ib_cm_event *ib_event, return 0; } -static bool validate_ipv4_net_dev(struct net_device *net_dev, +static bool validate_ipv4_net_dev(struct ifnet *net_dev, const struct sockaddr_in *dst_addr, const struct sockaddr_in *src_addr) { #ifdef INET __be32 daddr = dst_addr->sin_addr.s_addr, saddr = src_addr->sin_addr.s_addr; - struct net_device *dst_dev; + struct ifnet *dst_dev; struct nhop_object *nh; bool ret; @@ -1390,14 +1390,14 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev, #endif } -static bool validate_ipv6_net_dev(struct net_device *net_dev, +static bool validate_ipv6_net_dev(struct ifnet *net_dev, const struct sockaddr_in6 *dst_addr, const struct sockaddr_in6 *src_addr) { #ifdef INET6 struct sockaddr_in6 src_tmp = *src_addr; struct sockaddr_in6 dst_tmp = *dst_addr; - struct net_device *dst_dev; + struct ifnet *dst_dev; struct nhop_object *nh; bool ret; @@ -1444,7 +1444,7 @@ static bool validate_ipv6_net_dev(struct net_device *net_dev, #endif } -static bool validate_net_dev(struct net_device *net_dev, +static bool validate_net_dev(struct ifnet *net_dev, const struct sockaddr *daddr, const struct sockaddr *saddr) { @@ -1467,7 +1467,7 @@ static bool validate_net_dev(struct net_device *net_dev, } } -static struct net_device * +static struct ifnet * roce_get_net_dev_by_cm_event(struct ib_device *device, u8 port_num, const struct ib_cm_event *ib_event) { @@ -1487,13 +1487,13 @@ roce_get_net_dev_by_cm_event(struct ib_device *device, u8 port_num, return (sgid_attr.ndev); } -static struct net_device *cma_get_net_dev(struct ib_cm_event *ib_event, +static struct ifnet *cma_get_net_dev(struct ib_cm_event *ib_event, const struct cma_req_info *req) { struct sockaddr_storage listen_addr_storage, src_addr_storage; struct sockaddr *listen_addr = (struct sockaddr *)&listen_addr_storage, *src_addr = (struct sockaddr *)&src_addr_storage; - struct net_device *net_dev; + struct ifnet *net_dev; const union ib_gid *gid = req->has_gid ? &req->local_gid : NULL; struct epoch_tracker et; int err; @@ -1623,7 +1623,7 @@ static bool cma_protocol_roce(const struct rdma_cm_id *id) } static bool cma_match_net_dev(const struct rdma_cm_id *id, - const struct net_device *net_dev, + const struct ifnet *net_dev, u8 port_num) { const struct rdma_addr *addr = &id->route.addr; @@ -1653,7 +1653,7 @@ static struct rdma_id_private *cma_find_listener( const struct ib_cm_id *cm_id, const struct ib_cm_event *ib_event, const struct cma_req_info *req, - const struct net_device *net_dev) + const struct ifnet *net_dev) { struct rdma_id_private *id_priv, *id_priv_dev; @@ -1680,7 +1680,7 @@ static struct rdma_id_private *cma_find_listener( static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event, - struct net_device **net_dev) + struct ifnet **net_dev) { struct cma_req_info req; struct rdma_bind_list *bind_list; @@ -1813,7 +1813,7 @@ static void cma_leave_mc_groups(struct rdma_id_private *id_priv) if (mc->igmp_joined) { struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; - struct net_device *ndev = NULL; + struct ifnet *ndev = NULL; if (dev_addr->bound_dev_if) ndev = dev_get_by_index(dev_addr->net, @@ -2002,7 +2002,7 @@ out: static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id, struct ib_cm_event *ib_event, - struct net_device *net_dev) + struct ifnet *net_dev) { struct rdma_id_private *id_priv; struct rdma_cm_id *id; @@ -2063,7 +2063,7 @@ err: static struct rdma_id_private *cma_new_udp_id(struct rdma_cm_id *listen_id, struct ib_cm_event *ib_event, - struct net_device *net_dev) + struct ifnet *net_dev) { struct rdma_id_private *id_priv; struct rdma_cm_id *id; @@ -2131,7 +2131,7 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) { struct rdma_id_private *listen_id, *conn_id = NULL; struct rdma_cm_event event; - struct net_device *net_dev; + struct ifnet *net_dev; int offset, ret; listen_id = cma_id_from_event(cm_id, ib_event, &net_dev); @@ -2651,7 +2651,7 @@ static int cma_resolve_iw_route(struct rdma_id_private *id_priv, int timeout_ms) return 0; } -static int iboe_tos_to_sl(struct net_device *ndev, int tos) +static int iboe_tos_to_sl(struct ifnet *ndev, int tos) { /* get service level, SL, from IPv4 type of service, TOS */ int sl = (tos >> 5) & 0x7; @@ -2678,7 +2678,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv) struct rdma_addr *addr = &route->addr; struct cma_work *work; int ret; - struct net_device *ndev = NULL; + struct ifnet *ndev = NULL; work = kzalloc(sizeof *work, GFP_KERNEL); @@ -3999,7 +3999,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) if (!status) { struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; - struct net_device *ndev = + struct ifnet *ndev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if); enum ib_gid_type gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - @@ -4226,7 +4226,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv, struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; int err = 0; struct sockaddr *addr = (struct sockaddr *)&mc->addr; - struct net_device *ndev = NULL; + struct ifnet *ndev = NULL; enum ib_gid_type gid_type; bool send_only; @@ -4372,7 +4372,7 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr) if (mc->igmp_joined) { struct rdma_dev_addr *dev_addr = &id->route.addr.dev_addr; - struct net_device *ndev = NULL; *** 403 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 607C265F89B; Sun, 18 Jul 2021 00:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dc3FX0z4RYS; Sun, 18 Jul 2021 00:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E28E51A495; Sun, 18 Jul 2021 00:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0amFV049613; Sun, 18 Jul 2021 00:36:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0amG1049612; Sun, 18 Jul 2021 00:36:48 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:48 GMT Message-Id: <202107180036.16I0amG1049612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: af13c69522ab - stable/13 - LinuxKPI: add dmam_pool_create() support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af13c69522abc992de9fe652d229de9e71251c0c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:53 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=af13c69522abc992de9fe652d229de9e71251c0c commit af13c69522abc992de9fe652d229de9e71251c0c Author: Bjoern A. Zeeb AuthorDate: 2021-05-28 11:11:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 LinuxKPI: add dmam_pool_create() support dmam_pool_create() is a "managed" version of dma_pool_create() which will cleanup everything left when the device goes away using the devres framework. For that add an internal cleanup function to be called from devres release. This is used by at least one wireless driver. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30520 (cherry picked from commit 2afeed13b58653578c6ce5154afa6fb59f6b47f0) --- sys/compat/linuxkpi/common/include/linux/dmapool.h | 20 ++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_pci.c | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/dmapool.h b/sys/compat/linuxkpi/common/include/linux/dmapool.h index 980d5d74884f..60353ede6a82 100644 --- a/sys/compat/linuxkpi/common/include/linux/dmapool.h +++ b/sys/compat/linuxkpi/common/include/linux/dmapool.h @@ -41,6 +41,7 @@ struct dma_pool; struct dma_pool *linux_dma_pool_create(char *name, struct device *dev, size_t size, size_t align, size_t boundary); void linux_dma_pool_destroy(struct dma_pool *pool); +void lkpi_dmam_pool_destroy(struct device *, void *); void *linux_dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle); void linux_dma_pool_free(struct dma_pool *pool, void *vaddr, @@ -54,6 +55,25 @@ dma_pool_create(char *name, struct device *dev, size_t size, return (linux_dma_pool_create(name, dev, size, align, boundary)); } +static inline struct dma_pool * +dmam_pool_create(/* const */ char *name, struct device *dev, size_t size, + size_t align, size_t boundary) +{ + struct dma_pool **pp; + + pp = devres_alloc(lkpi_dmam_pool_destroy, sizeof(*pp), GFP_KERNEL); + if (pp == NULL) + return (NULL); + *pp = linux_dma_pool_create(name, dev, size, align, boundary); + if (*pp == NULL) { + devres_free(pp); + return (NULL); + } + + devres_add(dev, pp); + return (*pp); +} + static inline void dma_pool_destroy(struct dma_pool *pool) { diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 075df3c2adf7..7aa159600faa 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -997,6 +997,16 @@ linux_dma_pool_destroy(struct dma_pool *pool) kfree(pool); } +void +lkpi_dmam_pool_destroy(struct device *dev, void *p) +{ + struct dma_pool *pool; + + pool = *(struct dma_pool **)p; + LINUX_DMA_PCTRIE_RECLAIM(&pool->pool_ptree); + linux_dma_pool_destroy(pool); +} + void * linux_dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0E1865F5FE; Sun, 18 Jul 2021 00:36:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dg49tWz4RcK; Sun, 18 Jul 2021 00:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DD081A617; Sun, 18 Jul 2021 00:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0ar3h049715; Sun, 18 Jul 2021 00:36:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0arBx049714; Sun, 18 Jul 2021 00:36:53 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:53 GMT Message-Id: <202107180036.16I0arBx049714@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3a606aadf2e7 - stable/13 - LinuxKPI: pci: cleanup some code and add support for "pcim" (managed) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a606aadf2e7e0e9f913fe98910967acf73d1085 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:57 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3a606aadf2e7e0e9f913fe98910967acf73d1085 commit 3a606aadf2e7e0e9f913fe98910967acf73d1085 Author: Bjoern A. Zeeb AuthorDate: 2021-05-30 16:41:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:04 +0000 LinuxKPI: pci: cleanup some code and add support for "pcim" (managed) Restructure some code and add support for various "managed" versions for PCI resource management. This is beyond of what iwlwifi needs but some was found with other wireless drivers and it mostly all goes together. Add one FreeBSD sepcific feature returning the resource rather than the handle to allow us to use bus_*() functions in drivers directly. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30558 (cherry picked from commit d4a4960c6559caa890af0901a21296e75b961210) (cherry picked from commit 5f88df77a6a0c7609700e2f2c35b0dbcb211f1bb) (cherry picked from commit 539228d372fae8c4cc401b7ba4620f27783be5a4) --- sys/compat/linuxkpi/common/include/linux/pci.h | 357 ++++++++++++++++++++++--- sys/compat/linuxkpi/common/src/linux_pci.c | 68 +++++ 2 files changed, 382 insertions(+), 43 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index b8a801ac9f70..85278356dfea 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -4,6 +4,10 @@ * Copyright (c) 2010 Panasas, Inc. * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * Portions of this software were developed by Björn Zeeb + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -209,6 +213,10 @@ extern spinlock_t pci_lock; #define __devexit_p(x) x +/* + * If we find drivers accessing this from multiple KPIs we may have to + * refcount objects of this structure. + */ struct pci_mmio_region { TAILQ_ENTRY(pci_mmio_region) next; struct resource *res; @@ -230,16 +238,47 @@ struct pci_dev { unsigned int devfn; uint32_t class; uint8_t revision; + bool managed; /* devres "pcim_*(). */ + bool want_iomap_res; bool msi_enabled; + bool msix_enabled; phys_addr_t rom; size_t romlen; TAILQ_HEAD(, pci_mmio_region) mmio; }; +/* We need some meta-struct to keep track of these for devres. */ +struct pci_devres { + bool enable_io; + /* PCIR_MAX_BAR_0 + 1 = 6 => BIT(0..5). */ + uint8_t region_mask; + struct resource *region_table[PCIR_MAX_BAR_0 + 1]; /* Not needed. */ +}; +struct pcim_iomap_devres { + void *mmio_table[PCIR_MAX_BAR_0 + 1]; + struct resource *res_table[PCIR_MAX_BAR_0 + 1]; +}; + /* Internal helper function(s). */ struct pci_dev *lkpinew_pci_dev(device_t); +void lkpi_pci_devres_release(struct device *, void *); +void lkpi_pcim_iomap_table_release(struct device *, void *); +static inline int +pci_resource_type(struct pci_dev *pdev, int bar) +{ + struct pci_map *pm; + + pm = pci_find_bar(pdev->dev.bsddev, PCIR_BAR(bar)); + if (!pm) + return (-1); + + if (PCI_BAR_IO(pm->pm_value)) + return (SYS_RES_IOPORT); + else + return (SYS_RES_MEMORY); +} static inline struct resource_list_entry * linux_pci_get_rle(struct pci_dev *pdev, int type, int rid) @@ -255,12 +294,13 @@ linux_pci_get_rle(struct pci_dev *pdev, int type, int rid) static inline struct resource_list_entry * linux_pci_get_bar(struct pci_dev *pdev, int bar) { - struct resource_list_entry *rle; + int type; + type = pci_resource_type(pdev, bar); + if (type < 0) + return (NULL); bar = PCIR_BAR(bar); - if ((rle = linux_pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL) - rle = linux_pci_get_rle(pdev, SYS_RES_IOPORT, bar); - return (rle); + return (linux_pci_get_rle(pdev, type, bar)); } static inline struct device * @@ -282,21 +322,6 @@ linux_pci_find_irq_dev(unsigned int irq) return (found); } -static inline int -pci_resource_type(struct pci_dev *pdev, int bar) -{ - struct pci_map *pm; - - pm = pci_find_bar(pdev->dev.bsddev, PCIR_BAR(bar)); - if (!pm) - return (-1); - - if (PCI_BAR_IO(pm->pm_value)) - return (SYS_RES_IOPORT); - else - return (SYS_RES_MEMORY); -} - /* * All drivers just seem to want to inspect the type not flags. */ @@ -389,9 +414,37 @@ pci_clear_master(struct pci_dev *pdev) return (0); } +static inline struct pci_devres * +lkpi_pci_devres_get_alloc(struct pci_dev *pdev) +{ + struct pci_devres *dr; + + dr = lkpi_devres_find(&pdev->dev, lkpi_pci_devres_release, NULL, NULL); + if (dr == NULL) { + dr = lkpi_devres_alloc(lkpi_pci_devres_release, sizeof(*dr), + GFP_KERNEL | __GFP_ZERO); + if (dr != NULL) + lkpi_devres_add(&pdev->dev, dr); + } + + return (dr); +} +static inline struct pci_devres * +lkpi_pci_devres_find(struct pci_dev *pdev) +{ + + if (!pdev->managed) + return (NULL); + + return (lkpi_pci_devres_get_alloc(pdev)); +} + static inline int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) { + struct resource *res; + struct pci_devres *dr; + struct pci_mmio_region *mmio; int rid; int type; @@ -399,9 +452,34 @@ pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) if (type < 0) return (-ENODEV); rid = PCIR_BAR(bar); - if (bus_alloc_resource_any(pdev->dev.bsddev, type, &rid, - RF_ACTIVE) == NULL) - return (-EINVAL); + res = bus_alloc_resource_any(pdev->dev.bsddev, type, &rid, + RF_ACTIVE|RF_SHAREABLE); + if (res == NULL) { + device_printf(pdev->dev.bsddev, "%s: failed to alloc " + "bar %d type %d rid %d\n", + __func__, bar, type, PCIR_BAR(bar)); + return (-ENODEV); + } + + /* + * It seems there is an implicit devres tracking on these if the device + * is managed; otherwise the resources are not automatiaclly freed on + * FreeBSD/LinuxKPI tough they should be/are expected to be by Linux + * drivers. + */ + dr = lkpi_pci_devres_find(pdev); + if (dr != NULL) { + dr->region_mask |= (1 << bar); + dr->region_table[bar] = res; + } + + /* Even if the device is not managed we need to track it for iomap. */ + mmio = malloc(sizeof(*mmio), M_DEVBUF, M_WAITOK | M_ZERO); + mmio->rid = PCIR_BAR(bar); + mmio->type = type; + mmio->res = res; + TAILQ_INSERT_TAIL(&pdev->mmio, mmio, next); + return (0); } @@ -409,9 +487,32 @@ static inline void pci_release_region(struct pci_dev *pdev, int bar) { struct resource_list_entry *rle; + struct pci_devres *dr; + struct pci_mmio_region *mmio, *p; if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) return; + + /* + * As we implicitly track the requests we also need to clear them on + * release. Do clear before resource release. + */ + dr = lkpi_pci_devres_find(pdev); + if (dr != NULL) { + KASSERT(dr->region_table[bar] == rle->res, ("%s: pdev %p bar %d" + " region_table res %p != rel->res %p\n", __func__, pdev, + bar, dr->region_table[bar], rle->res)); + dr->region_table[bar] = NULL; + dr->region_mask &= ~(1 << bar); + } + + TAILQ_FOREACH_SAFE(mmio, &pdev->mmio, next, p) { + if (rle->res != (void *)rman_get_bushandle(mmio->res)) + continue; + TAILQ_REMOVE(&pdev->mmio, mmio, next); + free(mmio, M_DEVBUF); + } + bus_release_resource(pdev->dev.bsddev, rle->type, rle->rid, rle->res); } @@ -441,7 +542,7 @@ pci_request_regions(struct pci_dev *pdev, const char *res_name) } static inline void -pci_disable_msix(struct pci_dev *pdev) +lkpi_pci_disable_msix(struct pci_dev *pdev) { pci_release_msi(pdev->dev.bsddev); @@ -454,13 +555,13 @@ pci_disable_msix(struct pci_dev *pdev) */ pdev->dev.irq_start = 0; pdev->dev.irq_end = 0; + pdev->msix_enabled = false; } - -#define pci_disable_msi(pdev) \ - linux_pci_disable_msi(pdev) +/* Only for consistency. No conflict on that one. */ +#define pci_disable_msix(pdev) lkpi_pci_disable_msix(pdev) static inline void -linux_pci_disable_msi(struct pci_dev *pdev) +lkpi_pci_disable_msi(struct pci_dev *pdev) { pci_release_msi(pdev->dev.bsddev); @@ -470,9 +571,8 @@ linux_pci_disable_msi(struct pci_dev *pdev) pdev->irq = pdev->dev.irq; pdev->msi_enabled = false; } - -#define pci_free_irq_vectors(pdev) \ - linux_pci_disable_msi(pdev) +#define pci_disable_msi(pdev) lkpi_pci_disable_msi(pdev) +#define pci_free_irq_vectors(pdev) lkpi_pci_disable_msi(pdev) unsigned long pci_resource_start(struct pci_dev *pdev, int bar); unsigned long pci_resource_len(struct pci_dev *pdev, int bar); @@ -653,6 +753,7 @@ pci_enable_msix(struct pci_dev *pdev, struct msix_entry *entries, int nreq) pdev->dev.irq_end = rle->start + avail; for (i = 0; i < nreq; i++) entries[i].vector = pdev->dev.irq_start + i; + pdev->msix_enabled = true; return (0); } @@ -723,36 +824,71 @@ static inline void pci_disable_sriov(struct pci_dev *dev) { } -static inline void * -pci_iomap(struct pci_dev *dev, int mmio_bar, int mmio_size __unused) +static inline struct resource * +_lkpi_pci_iomap(struct pci_dev *pdev, int bar, int mmio_size __unused) { - struct pci_mmio_region *mmio; + struct pci_mmio_region *mmio, *p; + int type; + + type = pci_resource_type(pdev, bar); + if (type < 0) { + device_printf(pdev->dev.bsddev, "%s: bar %d type %d\n", + __func__, bar, type); + return (NULL); + } + + /* + * Check for duplicate mappings. + * This can happen if a driver calls pci_request_region() first. + */ + TAILQ_FOREACH_SAFE(mmio, &pdev->mmio, next, p) { + if (mmio->type == type && mmio->rid == PCIR_BAR(bar)) { + return (mmio->res); + } + } mmio = malloc(sizeof(*mmio), M_DEVBUF, M_WAITOK | M_ZERO); - mmio->rid = PCIR_BAR(mmio_bar); - mmio->type = pci_resource_type(dev, mmio_bar); - mmio->res = bus_alloc_resource_any(dev->dev.bsddev, mmio->type, - &mmio->rid, RF_ACTIVE); + mmio->rid = PCIR_BAR(bar); + mmio->type = type; + mmio->res = bus_alloc_resource_any(pdev->dev.bsddev, mmio->type, + &mmio->rid, RF_ACTIVE|RF_SHAREABLE); if (mmio->res == NULL) { + device_printf(pdev->dev.bsddev, "%s: failed to alloc " + "bar %d type %d rid %d\n", + __func__, bar, type, PCIR_BAR(bar)); free(mmio, M_DEVBUF); return (NULL); } - TAILQ_INSERT_TAIL(&dev->mmio, mmio, next); + TAILQ_INSERT_TAIL(&pdev->mmio, mmio, next); + + return (mmio->res); +} + +static inline void * +pci_iomap(struct pci_dev *pdev, int mmio_bar, int mmio_size) +{ + struct resource *res; - return ((void *)rman_get_bushandle(mmio->res)); + res = _lkpi_pci_iomap(pdev, mmio_bar, mmio_size); + if (res == NULL) + return (NULL); + /* This is a FreeBSD extension so we can use bus_*(). */ + if (pdev->want_iomap_res) + return (res); + return ((void *)rman_get_bushandle(res)); } static inline void -pci_iounmap(struct pci_dev *dev, void *res) +pci_iounmap(struct pci_dev *pdev, void *res) { struct pci_mmio_region *mmio, *p; - TAILQ_FOREACH_SAFE(mmio, &dev->mmio, next, p) { + TAILQ_FOREACH_SAFE(mmio, &pdev->mmio, next, p) { if (res != (void *)rman_get_bushandle(mmio->res)) continue; - bus_release_resource(dev->dev.bsddev, + bus_release_resource(pdev->dev.bsddev, mmio->type, mmio->rid, mmio->res); - TAILQ_REMOVE(&dev->mmio, mmio, next); + TAILQ_REMOVE(&pdev->mmio, mmio, next); free(mmio, M_DEVBUF); return; } @@ -1239,4 +1375,139 @@ pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn, int pos, struct pci_dev *lkpi_pci_get_class(unsigned int class, struct pci_dev *from); #define pci_get_class(class, from) lkpi_pci_get_class(class, from) +/* -------------------------------------------------------------------------- */ + +static inline int +pcim_enable_device(struct pci_dev *pdev) +{ + struct pci_devres *dr; + int error; + + /* Here we cannot run through the pdev->managed check. */ + dr = lkpi_pci_devres_get_alloc(pdev); + if (dr == NULL) + return (-ENOMEM); + + /* If resources were enabled before do not do it again. */ + if (dr->enable_io) + return (0); + + error = pci_enable_device(pdev); + if (error == 0) + dr->enable_io = true; + + /* This device is not managed. */ + pdev->managed = true; + + return (error); +} + +static inline struct pcim_iomap_devres * +lkpi_pcim_iomap_devres_find(struct pci_dev *pdev) +{ + struct pcim_iomap_devres *dr; + + dr = lkpi_devres_find(&pdev->dev, lkpi_pcim_iomap_table_release, + NULL, NULL); + if (dr == NULL) { + dr = lkpi_devres_alloc(lkpi_pcim_iomap_table_release, + sizeof(*dr), GFP_KERNEL | __GFP_ZERO); + if (dr != NULL) + lkpi_devres_add(&pdev->dev, dr); + } + + if (dr == NULL) + device_printf(pdev->dev.bsddev, "%s: NULL\n", __func__); + + return (dr); +} + +static inline void __iomem ** +pcim_iomap_table(struct pci_dev *pdev) +{ + struct pcim_iomap_devres *dr; + + dr = lkpi_pcim_iomap_devres_find(pdev); + if (dr == NULL) + return (NULL); + + /* + * If the driver has manually set a flag to be able to request the + * resource to use bus_read/write_, return the shadow table. + */ + if (pdev->want_iomap_res) + return ((void **)dr->res_table); + + /* This is the Linux default. */ + return (dr->mmio_table); +} + +static inline int +pcim_iomap_regions_request_all(struct pci_dev *pdev, uint32_t mask, char *name) +{ + struct pcim_iomap_devres *dr; + void *res; + uint32_t mappings, requests, req_mask; + int bar, error; + + dr = lkpi_pcim_iomap_devres_find(pdev); + if (dr == NULL) + return (-ENOMEM); + + /* Request all the BARs ("regions") we do not iomap. */ + req_mask = ((1 << (PCIR_MAX_BAR_0 + 1)) - 1) & ~mask; + for (bar = requests = 0; requests != req_mask; bar++) { + if ((req_mask & (1 << bar)) == 0) + continue; + error = pci_request_region(pdev, bar, name); + if (error != 0 && error != -ENODEV) + goto err; + requests |= (1 << bar); + } + + /* Now iomap all the requested (by "mask") ones. */ + for (bar = mappings = 0; mappings != mask; bar++) { + if ((mask & (1 << bar)) == 0) + continue; + + /* Request double is not allowed. */ + if (dr->mmio_table[bar] != NULL) { + device_printf(pdev->dev.bsddev, "%s: bar %d %p\n", + __func__, bar, dr->mmio_table[bar]); + goto err; + } + + res = _lkpi_pci_iomap(pdev, bar, 0); + if (res == NULL) + goto err; + dr->mmio_table[bar] = (void *)rman_get_bushandle(res); + dr->res_table[bar] = res; + + mappings |= (1 << bar); + } + + return (0); + +err: + for (bar = PCIR_MAX_BAR_0; bar >= 0; bar--) { + if ((mappings & (1 << bar)) != 0) { + res = dr->mmio_table[bar]; + if (res == NULL) + continue; + pci_iounmap(pdev, res); + } else if ((requests & (1 << bar)) != 0) { + pci_release_region(pdev, bar); + } + } + + return (-EINVAL); +} + +/* This is a FreeBSD extension so we can use bus_*(). */ +static inline void +linuxkpi_pcim_want_to_use_bus_functions(struct pci_dev *pdev) +{ + pdev->want_iomap_res = true; +} + #endif /* _LINUX_PCI_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 9738f9e6f51a..c35d259a45be 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -1,6 +1,10 @@ /*- * Copyright (c) 2015-2016 Mellanox Technologies, Ltd. * All rights reserved. + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * Portions of this software were developed by Björn Zeeb + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -213,6 +217,14 @@ linux_pci_find(device_t dev, const struct pci_device_id **idp) return (NULL); } +static void +lkpi_pci_dev_release(struct device *dev) +{ + + lkpi_devres_release_free_list(dev); + spin_lock_destroy(&dev->devres_lock); +} + static void lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) { @@ -230,6 +242,7 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) pdev->bus->domain = pci_get_domain(dev); pdev->dev.bsddev = dev; pdev->dev.parent = &linux_root_device; + pdev->dev.release = lkpi_pci_dev_release; INIT_LIST_HEAD(&pdev->dev.irqents); kobject_init(&pdev->dev.kobj, &linux_dev_ktype); kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev)); @@ -425,6 +438,61 @@ linux_pci_detach_device(struct pci_dev *pdev) return (0); } +static int +lkpi_pci_disable_dev(struct device *dev) +{ + + (void) pci_disable_io(dev->bsddev, SYS_RES_MEMORY); + (void) pci_disable_io(dev->bsddev, SYS_RES_IOPORT); + return (0); +} + +void +lkpi_pci_devres_release(struct device *dev, void *p) +{ + struct pci_devres *dr; + struct pci_dev *pdev; + int bar; + + pdev = to_pci_dev(dev); + dr = p; + + if (pdev->msix_enabled) + lkpi_pci_disable_msix(pdev); + if (pdev->msi_enabled) + lkpi_pci_disable_msi(pdev); + + if (dr->enable_io && lkpi_pci_disable_dev(dev) == 0) + dr->enable_io = false; + + if (dr->region_mask == 0) + return; + for (bar = PCIR_MAX_BAR_0; bar >= 0; bar--) { + + if ((dr->region_mask & (1 << bar)) == 0) + continue; + pci_release_region(pdev, bar); + } +} + +void +lkpi_pcim_iomap_table_release(struct device *dev, void *p) +{ + struct pcim_iomap_devres *dr; + struct pci_dev *pdev; + int bar; + + dr = p; + pdev = to_pci_dev(dev); + for (bar = PCIR_MAX_BAR_0; bar >= 0; bar--) { + + if (dr->mmio_table[bar] == NULL) + continue; + + pci_iounmap(pdev, dr->mmio_table[bar]); + } +} + static int linux_pci_suspend(device_t dev) { From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:37:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AE3D65F74C; Sun, 18 Jul 2021 00:37:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dk5CTyz4Rn2; Sun, 18 Jul 2021 00:36:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE6541A497; Sun, 18 Jul 2021 00:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0athx049763; Sun, 18 Jul 2021 00:36:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0atVB049762; Sun, 18 Jul 2021 00:36:55 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:55 GMT Message-Id: <202107180036.16I0atVB049762@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f9fa2908cfac - stable/13 - LinuxKPI: avoid userret: Returning with with pinned thread MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9fa2908cfac967e15c94c8fe4d8cc36e4a0d842 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:37:00 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f9fa2908cfac967e15c94c8fe4d8cc36e4a0d842 commit f9fa2908cfac967e15c94c8fe4d8cc36e4a0d842 Author: Bjoern A. Zeeb AuthorDate: 2021-06-09 18:53:16 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:04 +0000 LinuxKPI: avoid userret: Returning with with pinned thread Some code manually calls local_bh_disable() and spin_lock() but then calls spin_unlock_bh() (or vice versa). Our code then calls local_bh_disable() again from spin_lock() which means we have the thread pin count increased twice and that means we get out of synch and are still pinned when returning to user space. Avoid this by adding the explicit local_bh_{enable,disable}() to the spin_[un]lock_bh() versions. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30711 (cherry picked from commit 46ae23a4024b792c44a2b6c5f80429c40dac120b) --- sys/compat/linuxkpi/common/include/linux/spinlock.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h index 83f45b1a2a40..ca51fd23434c 100644 --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h @@ -66,6 +66,7 @@ typedef struct { #define spin_lock_bh(_l) do { \ spin_lock(_l); \ + local_bh_disable(); \ } while (0) #define spin_lock_irq(_l) do { \ @@ -80,6 +81,7 @@ typedef struct { } while (0) #define spin_unlock_bh(_l) do { \ + local_bh_enable(); \ spin_unlock(_l); \ } while (0) From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C129B65F6CE; Sun, 18 Jul 2021 00:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dX1MwXz4RQy; Sun, 18 Jul 2021 00:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 887EF1A328; Sun, 18 Jul 2021 00:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0aj99049535; Sun, 18 Jul 2021 00:36:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0ajEd049534; Sun, 18 Jul 2021 00:36:45 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:45 GMT Message-Id: <202107180036.16I0ajEd049534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4b2af7db2012 - stable/13 - LinuxKPI: add KPI for netdev_notifier_info returning ifp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4b2af7db20125df4ee1e481e1bf4318cd612e7ed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:49 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4b2af7db20125df4ee1e481e1bf4318cd612e7ed commit 4b2af7db20125df4ee1e481e1bf4318cd612e7ed Author: Bjoern A. Zeeb AuthorDate: 2021-05-28 12:44:16 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 LinuxKPI: add KPI for netdev_notifier_info returning ifp While currently the ifp gets cast to a net_device and then returned and consumers are expecting an ifp again, allow parallel usage now and in the future by extending and also passing the ifp directly back in the netdev_notifier_info. Add a function to return the ifp instead of the net_device. Sponsored by: The FreeBSD Foundation Suggested by: hselasky Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30522 (cherry picked from commit 801cf532e70f6b0ebfb2d536b235f166b2e6f0a4) --- sys/compat/linuxkpi/common/include/linux/netdevice.h | 7 +++++++ sys/compat/linuxkpi/common/src/linux_compat.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h index faff2fde5f32..1de31b3fa156 100644 --- a/sys/compat/linuxkpi/common/include/linux/netdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h @@ -59,6 +59,7 @@ /* According to linux::ipoib_main.c. */ struct netdev_notifier_info { struct net_device *dev; + struct ifnet *ifp; }; static inline struct net_device * @@ -67,6 +68,12 @@ netdev_notifier_info_to_dev(struct netdev_notifier_info *ni) return (ni->dev); } +static inline struct ifnet * +netdev_notifier_info_to_ifp(struct netdev_notifier_info *ni) +{ + return (ni->ifp); +} + int register_netdevice_notifier(struct notifier_block *); int register_inetaddr_notifier(struct notifier_block *); int unregister_netdevice_notifier(struct notifier_block *); diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index ef570dda542c..d4571173f93d 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2315,6 +2315,7 @@ linux_handle_ifnet_link_event(void *arg, struct ifnet *ifp, int linkstate) struct netdev_notifier_info ni; nb = arg; + ni.ifp = ifp; ni.dev = (struct net_device *)ifp; if (linkstate == LINK_STATE_UP) nb->notifier_call(nb, NETDEV_UP, &ni); @@ -2329,6 +2330,7 @@ linux_handle_ifnet_arrival_event(void *arg, struct ifnet *ifp) struct netdev_notifier_info ni; nb = arg; + ni.ifp = ifp; ni.dev = (struct net_device *)ifp; nb->notifier_call(nb, NETDEV_REGISTER, &ni); } @@ -2340,6 +2342,7 @@ linux_handle_ifnet_departure_event(void *arg, struct ifnet *ifp) struct netdev_notifier_info ni; nb = arg; + ni.ifp = ifp; ni.dev = (struct net_device *)ifp; nb->notifier_call(nb, NETDEV_UNREGISTER, &ni); } @@ -2351,6 +2354,7 @@ linux_handle_iflladdr_event(void *arg, struct ifnet *ifp) struct netdev_notifier_info ni; nb = arg; + ni.ifp = ifp; ni.dev = (struct net_device *)ifp; nb->notifier_call(nb, NETDEV_CHANGEADDR, &ni); } @@ -2362,6 +2366,7 @@ linux_handle_ifaddr_event(void *arg, struct ifnet *ifp) struct netdev_notifier_info ni; nb = arg; + ni.ifp = ifp; ni.dev = (struct net_device *)ifp; nb->notifier_call(nb, NETDEV_CHANGEIFADDR, &ni); } From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16FF865F6D6; Sun, 18 Jul 2021 00:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dZ5QKqz4Rf8; Sun, 18 Jul 2021 00:36:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C47761A1B4; Sun, 18 Jul 2021 00:36:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0alL9049589; Sun, 18 Jul 2021 00:36:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0alAI049588; Sun, 18 Jul 2021 00:36:47 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:47 GMT Message-Id: <202107180036.16I0alAI049588@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 05cb0d21ed4b - stable/13 - LinuxKPI: add device_reprobe() and device_release_driver() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 05cb0d21ed4bf7ac5a78a62a10b33b222f3762cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:52 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=05cb0d21ed4bf7ac5a78a62a10b33b222f3762cc commit 05cb0d21ed4bf7ac5a78a62a10b33b222f3762cc Author: Bjoern A. Zeeb AuthorDate: 2021-05-28 11:04:34 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:03 +0000 LinuxKPI: add device_reprobe() and device_release_driver() Add two new (though untested) functions to linux/device.h which are dealing with manually managing the device/driver and are used by at least one wireless driver. We may have to re-fine them in the future. Move the devres declarations further up so they can be used earlier in the file. Sponsored by: The FreeBSD Foundation Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30519 (cherry picked from commit 644b4f117634e3b571031026be87429bea0c30dd) --- sys/compat/linuxkpi/common/include/linux/device.h | 67 ++++++++++++++++------- 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 4ef35e6abcd3..4bdc3b831e58 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -209,6 +209,25 @@ show_class_attr_string(struct class *class, dev_warn(dev, __VA_ARGS__); \ } while (0) +/* Public and LinuxKPI internal devres functions. */ +void *lkpi_devres_alloc(void(*release)(struct device *, void *), size_t, gfp_t); +void lkpi_devres_add(struct device *, void *); +void lkpi_devres_free(void *); +void *lkpi_devres_find(struct device *, void(*release)(struct device *, void *), + int (*match)(struct device *, void *, void *), void *); +int lkpi_devres_destroy(struct device *, void(*release)(struct device *, void *), + int (*match)(struct device *, void *, void *), void *); +#define devres_alloc(_r, _s, _g) lkpi_devres_alloc(_r, _s, _g) +#define devres_add(_d, _p) lkpi_devres_add(_d, _p) +#define devres_free(_p) lkpi_devres_free(_p) +#define devres_find(_d, _rfn, _mfn, _mp) \ + lkpi_devres_find(_d, _rfn, _mfn, _mp) +#define devres_destroy(_d, _rfn, _mfn, _mp) \ + lkpi_devres_destroy(_d, _rfn, _mfn, _mp) +void lkpi_devres_release_free_list(struct device *); +void lkpi_devres_unlink(struct device *, void *); +void lkpi_devm_kmalloc_release(struct device *, void *); + static inline void * dev_get_drvdata(const struct device *dev) { @@ -483,6 +502,34 @@ device_destroy(struct class *class, dev_t devt) device_unregister(device_get_softc(bsddev)); } +static inline void +device_release_driver(struct device *dev) +{ + + /* We also need to cleanup LinuxKPI bits. What else? */ + lkpi_devres_release_free_list(dev); + dev_set_drvdata(dev, NULL); + /* Do not call dev->release! */ + + mtx_lock(&Giant); + if (device_is_attached(dev->bsddev)) + device_detach(dev->bsddev); + mtx_unlock(&Giant); +} + +static inline int +device_reprobe(struct device *dev) +{ + int error; + + device_release_driver(dev); + mtx_lock(&Giant); + error = device_probe_and_attach(dev->bsddev); + mtx_unlock(&Giant); + + return (-error); +} + #define dev_pm_set_driver_flags(dev, flags) do { \ } while (0) @@ -566,26 +613,6 @@ char *lkpi_devm_kasprintf(struct device *, gfp_t, const char *, ...); #define devm_kasprintf(_dev, _gfp, _fmt, ...) \ lkpi_devm_kasprintf(_dev, _gfp, _fmt, ##__VA_ARGS__) -void *lkpi_devres_alloc(void(*release)(struct device *, void *), size_t, gfp_t); -void lkpi_devres_add(struct device *, void *); -void lkpi_devres_free(void *); -void *lkpi_devres_find(struct device *, void(*release)(struct device *, void *), - int (*match)(struct device *, void *, void *), void *); -int lkpi_devres_destroy(struct device *, void(*release)(struct device *, void *), - int (*match)(struct device *, void *, void *), void *); -#define devres_alloc(_r, _s, _g) lkpi_devres_alloc(_r, _s, _g) -#define devres_add(_d, _p) lkpi_devres_add(_d, _p) -#define devres_free(_p) lkpi_devres_free(_p) -#define devres_find(_d, _rfn, _mfn, _mp) \ - lkpi_devres_find(_d, _rfn, _mfn, _mp) -#define devres_destroy(_d, _rfn, _mfn, _mp) \ - lkpi_devres_destroy(_d, _rfn, _mfn, _mp) - -/* LinuxKPI internal functions. */ -void lkpi_devres_release_free_list(struct device *); -void lkpi_devres_unlink(struct device *, void *); -void lkpi_devm_kmalloc_release(struct device *, void *); - static __inline void * devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) { From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:37:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBA6865F6F3; Sun, 18 Jul 2021 00:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dm6gtCz4RWq; Sun, 18 Jul 2021 00:37:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 157DF1A498; Sun, 18 Jul 2021 00:36:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0avdQ049817; Sun, 18 Jul 2021 00:36:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0avat049816; Sun, 18 Jul 2021 00:36:57 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:57 GMT Message-Id: <202107180036.16I0avat049816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f72db34d2295 - stable/13 - Bump __FreeBSD_version to 1300512 for LinuxKPI changes and OFED cleanup from linux netdevice.h. drm-kmod needs rebuilding after this. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f72db34d2295080f57a283858125aa906c0d409e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:37:02 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f72db34d2295080f57a283858125aa906c0d409e commit f72db34d2295080f57a283858125aa906c0d409e Author: Bjoern A. Zeeb AuthorDate: 2021-07-17 21:48:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:04 +0000 Bump __FreeBSD_version to 1300512 for LinuxKPI changes and OFED cleanup from linux netdevice.h. drm-kmod needs rebuilding after this. --- UPDATING | 6 ++++++ sys/sys/param.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index a3fe9b74a245..b780eeb7b887 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,12 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20210718: + Bump __FreeBSD_version to 1300512 after merging LinuxKPI, OFED, + net80211, and driver changes in order to support building + Intel wireless iwlwifi drivers. This is especially needed for + drm-kmod which needs updates after this. + 20210715: The 20210707 awk update brought in a change in behavior. This has been corrected as of d4d252c49976. Between these dates, if you diff --git a/sys/sys/param.h b/sys/sys/param.h index 4c43839c297e..877cdaa74204 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300511 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300512 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:37:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E95265F572; Sun, 18 Jul 2021 00:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dl4xVcz4RlF; Sun, 18 Jul 2021 00:36:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2E091A477; Sun, 18 Jul 2021 00:36:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0auqw049787; Sun, 18 Jul 2021 00:36:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0auIV049786; Sun, 18 Jul 2021 00:36:56 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:56 GMT Message-Id: <202107180036.16I0auIV049786@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f2bd70c674f0 - stable/13 - LinuxKPI: firmware, implement deferred loading for "nowait" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f2bd70c674f0409dc4f1dc5b3ca1142a1456adf6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:37:02 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f2bd70c674f0409dc4f1dc5b3ca1142a1456adf6 commit f2bd70c674f0409dc4f1dc5b3ca1142a1456adf6 Author: Bjoern A. Zeeb AuthorDate: 2021-06-20 13:49:46 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:04 +0000 LinuxKPI: firmware, implement deferred loading for "nowait" Change linuxkpi_request_firmware_nowait() to deferred firmware loading scheduling a task. This changes behaviour in some cases that we return from loading the driver before the driver is finished initialising if the driver does not deal with it (wait). This brings the behaviour one would expect from when this function is called and I implemented it to see if it would help a specific case. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, imp (earlier version) Differential Revision: https://reviews.freebsd.org/D30830 (cherry picked from commit 399da52fff81a33b1f2c0cee3e8574bc3c63166f) --- sys/compat/linuxkpi/common/src/linux_firmware.c | 74 +++++++++++++++++++------ 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c index 289779c5246c..d779b509105e 100644 --- a/sys/compat/linuxkpi/common/src/linux_firmware.c +++ b/sys/compat/linuxkpi/common/src/linux_firmware.c @@ -30,9 +30,13 @@ * $FreeBSD$ */ +#include +#include #include #include #include +#include +#include #include #include @@ -42,6 +46,16 @@ MALLOC_DEFINE(M_LKPI_FW, "lkpifw", "LinuxKPI firmware"); +struct lkpi_fw_task { + /* Task and arguments for the "nowait" callback. */ + struct task fw_task; + gfp_t gfp; + const char *fw_name; + struct device *dev; + void *drv; + void(*cont)(const struct linuxkpi_firmware *, void *); +}; + static int _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware **fw, struct device *dev, gfp_t gfp __unused, bool enoentok, bool warn) @@ -52,8 +66,10 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * char *p; uint32_t flags; - if (fw_name == NULL || fw == NULL || dev == NULL) + if (fw_name == NULL || fw == NULL || dev == NULL) { + *fw = NULL; return (-EINVAL); + } /* Set independent on "warn". To debug, bootverbose is avail. */ flags = FIRMWARE_GET_NOWARN; @@ -129,28 +145,54 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * return (0); } -int -linuxkpi_request_firmware_nowait(struct module *mod __unused, bool _t __unused, - const char *fw_name, struct device *dev, gfp_t gfp, void *drv, - void(*cont)(const struct linuxkpi_firmware *, void *)) +static void +lkpi_fw_task(void *ctx, int pending) { - const struct linuxkpi_firmware *lfw; + struct lkpi_fw_task *lfwt; + const struct linuxkpi_firmware *fw; int error; + KASSERT(ctx != NULL && pending == 1, ("%s: lfwt %p, pending %d\n", + __func__, ctx, pending)); + + lfwt = ctx; + if (lfwt->cont == NULL) + goto out; + + error = _linuxkpi_request_firmware(lfwt->fw_name, &fw, lfwt->dev, + lfwt->gfp, true, true); + /* * Linux seems to run the callback if it cannot find the firmware. - * The fact that this is "_nowait()" and has a callback seems to - * imply that this is run in a deferred conext which we currently - * do not do. Should it become necessary (a driver actually requiring - * it) we would need to implement it here. + * We call it in all cases as it is the only feedback to the requester. */ - error = _linuxkpi_request_firmware(fw_name, &lfw, dev, gfp, true, true); - if (error == -ENOENT) - error = 0; - if (error == 0) - cont(lfw, drv); + lfwt->cont(fw, lfwt->drv); + /* Do not assume fw is still valid! */ - return (error); +out: + free(lfwt, M_LKPI_FW); +} + +int +linuxkpi_request_firmware_nowait(struct module *mod __unused, bool _t __unused, + const char *fw_name, struct device *dev, gfp_t gfp, void *drv, + void(*cont)(const struct linuxkpi_firmware *, void *)) +{ + struct lkpi_fw_task *lfwt; + int error; + + lfwt = malloc(sizeof(*lfwt), M_LKPI_FW, M_WAITOK | M_ZERO); + lfwt->gfp = gfp; + lfwt->fw_name = fw_name; + lfwt->dev = dev; + lfwt->drv = drv; + lfwt->cont = cont; + TASK_INIT(&lfwt->fw_task, 0, lkpi_fw_task, lfwt); + error = taskqueue_enqueue(taskqueue_thread, &lfwt->fw_task); + + if (error) + return (-error); + return (0); } int From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:51:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28FC4661400; Sun, 18 Jul 2021 00:51:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5yr5N7Tz4WXv; Sun, 18 Jul 2021 00:51:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A10AD1A6F7; Sun, 18 Jul 2021 00:51:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0pmj8075798; Sun, 18 Jul 2021 00:51:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0pmR5075797; Sun, 18 Jul 2021 00:51:48 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:51:48 GMT Message-Id: <202107180051.16I0pmR5075797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f40b0295b5c6 - stable/12 - procctl(PROC_ASLR_STATUS): fix vmspace leak MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f40b0295b5c6ef73f1560459b44f39d46ad67e00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:51:49 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f40b0295b5c6ef73f1560459b44f39d46ad67e00 commit f40b0295b5c6ef73f1560459b44f39d46ad67e00 Author: Konstantin Belousov AuthorDate: 2021-07-14 23:40:04 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-18 00:30:31 +0000 procctl(PROC_ASLR_STATUS): fix vmspace leak (cherry picked from commit 0bdb2cbf9d7c4366a0668b4563c8630538a50086) --- sys/kern/kern_procctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 6e841b0fcaaa..c87f2bd060ca 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -463,8 +463,9 @@ aslr_status(struct thread *td, struct proc *p, int *data) _PHOLD(p); PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); - if (vm != NULL && (vm->vm_map.flags & MAP_ASLR) != 0) { - d |= PROC_ASLR_ACTIVE; + if (vm != NULL) { + if ((vm->vm_map.flags & MAP_ASLR) != 0) + d |= PROC_ASLR_ACTIVE; vmspace_free(vm); } PROC_LOCK(p); From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 01:09:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C089661BA5; Sun, 18 Jul 2021 01:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS6M24320z4Yp6; Sun, 18 Jul 2021 01:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F3BE1A8BA; Sun, 18 Jul 2021 01:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I19IZG090977; Sun, 18 Jul 2021 01:09:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I19IXt090976; Sun, 18 Jul 2021 01:09:18 GMT (envelope-from git) Date: Sun, 18 Jul 2021 01:09:18 GMT Message-Id: <202107180109.16I19IXt090976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Neel Chauhan Subject: git: 511bbe502e8a - stable/13 - linuxkpi: Add spin_trylock_irqsave() macro MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 511bbe502e8ad50d7b22feefec7bb7c2534a7571 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 01:09:18 -0000 The branch stable/13 has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=511bbe502e8ad50d7b22feefec7bb7c2534a7571 commit 511bbe502e8ad50d7b22feefec7bb7c2534a7571 Author: Neel Chauhan AuthorDate: 2021-07-15 14:52:42 +0000 Commit: Neel Chauhan CommitDate: 2021-07-18 01:08:06 +0000 linuxkpi: Add spin_trylock_irqsave() macro This is needed by the drm-kmod 5.6 update. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30706 (cherry picked from commit 086cfe4df8ab237f0cf156e95d36657250931981) --- sys/compat/linuxkpi/common/include/linux/spinlock.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h index ca51fd23434c..458d8d9f8da9 100644 --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h @@ -104,6 +104,11 @@ typedef struct { #define spin_trylock_irq(_l) \ spin_trylock(_l) +#define spin_trylock_irqsave(_l, flags) ({ \ + (flags) = 0; \ + spin_trylock(_l); \ +}) + #define spin_lock_nested(_l, _n) do { \ if (SPIN_SKIP()) \ break; \ From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 01:09:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAE8F661A43; Sun, 18 Jul 2021 01:09:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS6M34hg5z4YvH; Sun, 18 Jul 2021 01:09:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 891D21AB57; Sun, 18 Jul 2021 01:09:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I19JnL091005; Sun, 18 Jul 2021 01:09:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I19J6R091004; Sun, 18 Jul 2021 01:09:19 GMT (envelope-from git) Date: Sun, 18 Jul 2021 01:09:19 GMT Message-Id: <202107180109.16I19J6R091004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Neel Chauhan Subject: git: 7accb4a33579 - stable/13 - libkern: import strnstr from libc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7accb4a33579ad18e83e1b93b89248370346649d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 01:09:19 -0000 The branch stable/13 has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7accb4a33579ad18e83e1b93b89248370346649d commit 7accb4a33579ad18e83e1b93b89248370346649d Author: Greg V AuthorDate: 2021-07-15 00:52:32 +0000 Commit: Neel Chauhan CommitDate: 2021-07-18 01:08:24 +0000 libkern: import strnstr from libc Required for drm-kmod 5.6 (amdgpu). Reviewed by: bz, hselasky, nc Differential Revision: https://reviews.freebsd.org/D31131 (cherry picked from commit f39d9c91318569a1ab7507d46e15147f5fef659e) --- sys/conf/files | 1 + sys/sys/libkern.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/conf/files b/sys/conf/files index 161b70880309..0f5944c93c9c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4090,6 +4090,7 @@ libkern/strncat.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/strnlen.c standard +libkern/strnstr.c standard libkern/strrchr.c standard libkern/strsep.c standard libkern/strspn.c standard diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 3f8827de06c5..0c3489d4c206 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -186,6 +186,7 @@ int strncasecmp(const char *, const char *, size_t); int strncmp(const char *, const char *, size_t); char *strncpy(char * __restrict, const char * __restrict, size_t); size_t strnlen(const char *, size_t); +char *strnstr(const char *, const char *, size_t); char *strrchr(const char *, int); char *strsep(char **, const char *delim); size_t strspn(const char *, const char *); From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 01:09:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E364661A44; Sun, 18 Jul 2021 01:09:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS6M46DCQz4Z2c; Sun, 18 Jul 2021 01:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD3D51AC84; Sun, 18 Jul 2021 01:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I19KQ9091032; Sun, 18 Jul 2021 01:09:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I19KCl091031; Sun, 18 Jul 2021 01:09:20 GMT (envelope-from git) Date: Sun, 18 Jul 2021 01:09:20 GMT Message-Id: <202107180109.16I19KCl091031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Neel Chauhan Subject: git: 74ff46ac1724 - stable/13 - Add missing libkern/strnstr.c file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 74ff46ac1724f3b24dc413b85f499c493222e749 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 01:09:21 -0000 The branch stable/13 has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=74ff46ac1724f3b24dc413b85f499c493222e749 commit 74ff46ac1724f3b24dc413b85f499c493222e749 Author: Greg V AuthorDate: 2021-07-15 00:56:03 +0000 Commit: Neel Chauhan CommitDate: 2021-07-18 01:09:03 +0000 Add missing libkern/strnstr.c file Apparently it wasn't picked up by git. Reviewed by: bz, hselasky, nc Differential Revision: https://reviews.freebsd.org/D31131 (cherry picked from commit 4211457e40e07f6f820c4171c7db81f028fd23af) --- sys/libkern/strnstr.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/sys/libkern/strnstr.c b/sys/libkern/strnstr.c new file mode 100644 index 000000000000..9183e2a7017d --- /dev/null +++ b/sys/libkern/strnstr.c @@ -0,0 +1,64 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2001 Mike Barcroft + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +/* + * Find the first occurrence of find in s, where the search is limited to the + * first slen characters of s. + */ +char * +strnstr(const char *s, const char *find, size_t slen) +{ + char c, sc; + size_t len; + + if ((c = *find++) != '\0') { + len = strlen(find); + do { + do { + if (slen-- < 1 || (sc = *s++) == '\0') + return (NULL); + } while (sc != c); + if (len > slen) + return (NULL); + } while (strncmp(s, find, len) != 0); + s--; + } + return (__DECONST(char *, s)); +}