Re: git: 041b28524a3c - main - release: Add workaround to use SVN for ports

2021-01-20 Thread Yasuhiro Kimura
From: Glen Barber 
Subject: git: 041b28524a3c - main - release: Add workaround to use SVN for ports
Date: Tue, 19 Jan 2021 18:38:50 GMT

> The branch main has been updated by gjb:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=041b28524a3c69ff6e893067df156c3faabcac9a
> 
> commit 041b28524a3c69ff6e893067df156c3faabcac9a
> Author: Glen Barber 
> AuthorDate: 2021-01-19 18:38:33 +
> Commit: Glen Barber 
> CommitDate: 2021-01-19 18:38:33 +
> 
> release: Add workaround to use SVN for ports
> 
> The ports tree is scheduled to be converted from Subversion to Git
> after the currently-scheduled 13.0-RELEASE, so the source of truth
> will be Subversion for the ports tree.
> 
> Implement a hack specifically for this case.

This change results in accessing 'svn://svn.freebsd.org/ports/head/head'
and failing to check out ports tree.

---
Yasuhiro Kimura
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


Re: git: e83b514a9563 - main - cat: depend on Makefile to rebuild when WITH_CASPER changes

2021-01-20 Thread Enji Cooper


> On Jan 17, 2021, at 9:22 AM, Ed Maste  wrote:
> 
> The branch main has been updated by emaste:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=e83b514a9563d5812c9d158ff976f0de96bd90e0
> 
> commit e83b514a9563d5812c9d158ff976f0de96bd90e0
> Author: Ed Maste 
> AuthorDate: 2021-01-17 17:15:40 +
> Commit: Ed Maste 
> CommitDate: 2021-01-17 17:19:00 +
> 
>cat: depend on Makefile to rebuild when WITH_CASPER changes
> 
>We try to ensure building WITHOUT_CLEAN (or -DNO_CLEAN) works on an
>ongoing basis.  b7ab6832cd98 changed cat to build w/o -DWITH_CASPER
>by default; add a cat.o dependency on the Makefile so that it gets
>rebuilt.
> ---
> bin/cat/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/bin/cat/Makefile b/bin/cat/Makefile
> index cce69d8aad9e..06bb071363f8 100644
> --- a/bin/cat/Makefile
> +++ b/bin/cat/Makefile
> @@ -22,5 +22,7 @@ SUBDIR.${MK_TESTS}+= tests
> #LIBADD+=cap_net
> #CFLAGS+=-DWITH_CASPER
> #.endif
> +# Depend on Makefile to rebiuld when WITH_CASPER changes
> +cat.o:   Makefile


Hi Ed,

Could this maybe use ${MAKEFILE} or .MAKE.MAKEFILES, e.g.,  
${.MAKE.MAKEFILES:[0]}, instead?

IIRC meta mode might take care of this automatically, but bdrewery could answer 
this definitively.

Cheers!
-Enji
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: a0e85d0eb5a5 - main - Remove the unnecessary space before the colon

2021-01-20 Thread Mateusz Piotrowski
The branch main has been updated by 0mp (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a0e85d0eb5a5c30d47d6bfb014f59b9fcd32dbe4

commit a0e85d0eb5a5c30d47d6bfb014f59b9fcd32dbe4
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2021-01-20 08:46:15 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2021-01-20 08:46:15 +

Remove the unnecessary space before the colon

MFC after:  3 days
---
 bin/df/df.1 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bin/df/df.1 b/bin/df/df.1
index 8949ab1c71b0..6221f4c43726 100644
--- a/bin/df/df.1
+++ b/bin/df/df.1
@@ -220,8 +220,7 @@ Mounted on
 .Ed
 .Pp
 Show human readable information for the file system containing the file
-.Pa /etc/rc.conf
-:
+.Pa /etc/rc.conf :
 .Bd -literal -offset indent
 $ df -h /etc/rc.conf
 Filesystem SizeUsed   Avail Capacity  Mounted on
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1)

2021-01-20 Thread Ulrich Spörlein
The branch main has been updated by uqs:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a9fc14fbf445cffd18f34f6a602bdba84bb5a867

commit a9fc14fbf445cffd18f34f6a602bdba84bb5a867
Author: Michael Osipov 
AuthorDate: 2021-01-05 10:48:39 +
Commit: Ulrich Spörlein 
CommitDate: 2021-01-20 09:48:27 +

newvers.sh: add support for gitup(1)

gitup writes a .gituprevision file into the shallow clone directory. Read 
that
file and print commit information only.

Submitted by:   Michael Osipov 
Pull Request:   https://github.com/freebsd/freebsd-src/pull/449

While here, drop the redundant branch name from the git output and don't
count commits in shallow clones.

Reported by:Michael Osipov 
MFC after:  2 weeks
---
 sys/conf/newvers.sh | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 2a0ace45f2f6..92c275d19fb9 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -221,6 +221,10 @@ if findvcs .git; then
done
 fi
 
+if findvcs .gituprevision; then
+   gituprevision="${VCSTOP}/.gituprevision"
+fi
+
 if findvcs .hg; then
for dir in /usr/bin /usr/local/bin; do
if [ -x "${dir}/hg" ] ; then
@@ -248,13 +252,11 @@ fi
 
 if [ -n "$git_cmd" ] ; then
git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null)
-   git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null)
-   if [ -n "$git_cnt" ] ; then
-   git="c${git_cnt}-g${git}"
-   fi
-   git_b=$($git_cmd rev-parse --abbrev-ref HEAD)
-   if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then
-   git="${git_b}-${git}"
+   if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then
+   git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null)
+   if [ -n "$git_cnt" ] ; then
+   git="c${git_cnt}-g${git}"
+   fi
fi
if git_tree_modified; then
git="${git}-dirty"
@@ -263,6 +265,10 @@ if [ -n "$git_cmd" ] ; then
git=" ${git}"
 fi
 
+if [ -n "$gituprevision" ] ; then
+   gitup=" $(awk -F: '{print $2}' $gituprevision)"
+fi
+
 if [ -n "$hg_cmd" ] ; then
hg=$($hg_cmd id 2>/dev/null)
hgsvn=$($hg_cmd svn info 2>/dev/null | \
@@ -277,10 +283,10 @@ fi
 
 [ ${include_metadata} = "if-modified" -a ${modified} = "yes" ] && 
include_metadata=yes
 if [ ${include_metadata} != "yes" ]; then
-   VERINFO="${VERSION}${svn}${git}${hg} ${i}"
+   VERINFO="${VERSION}${svn}${git}${gitup}${hg} ${i}"
VERSTR="${VERINFO}\\n"
 else
-   VERINFO="${VERSION} #${v}${svn}${git}${hg}: ${t}"
+   VERINFO="${VERSION} #${v}${svn}${git}${gitup}${hg}: ${t}"
VERSTR="${VERINFO}\\n${u}@${h}:${d}\\n"
 fi
 
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: db4b5a16a30a - main - Minor simplification of MK_PMC case in usr.sbin/Makefile

2021-01-20 Thread Alex Richardson
The branch main has been updated by arichardson:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=db4b5a16a30a7587fc12812d5c8a018fa7a16ded

commit db4b5a16a30a7587fc12812d5c8a018fa7a16ded
Author: Alex Richardson 
AuthorDate: 2021-01-20 09:52:58 +
Commit: Alex Richardson 
CommitDate: 2021-01-20 09:52:58 +

Minor simplification of MK_PMC case in usr.sbin/Makefile

MK_PMC is already guarded by MK_CXX in src.opts.mk, so we can actually
merge it with the following SUBDIR statement after c1a3d7f20696.

Suggested By:   jrtc27
---
 usr.sbin/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index 2e01b0fcf847..da61617e408b 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -186,8 +186,7 @@ SUBDIR.${MK_NTP}+=  ntp
 SUBDIR.${MK_OPENSSL}+= keyserv
 SUBDIR.${MK_PF}+=  ftp-proxy
 SUBDIR.${MK_PKGBOOTSTRAP}+=pkg
-SUBDIR.${MK_PMC}.${MK_CXX}+=   pmc
-SUBDIR.${MK_PMC}+= pmcannotate pmccontrol pmcstat pmcstudy
+SUBDIR.${MK_PMC}+= pmc pmcannotate pmccontrol pmcstat pmcstudy
 SUBDIR.${MK_PORTSNAP}+=portsnap
 SUBDIR.${MK_PPP}+= ppp
 SUBDIR.${MK_QUOTAS}+=  edquota
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 7e99c034f788 - main - Emit uprintf() output for initproc if there is no controlling terminal

2021-01-20 Thread Alex Richardson
The branch main has been updated by arichardson:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7e99c034f788128c7d168eaf27af9a3acaa06163

commit 7e99c034f788128c7d168eaf27af9a3acaa06163
Author: Alex Richardson 
AuthorDate: 2021-01-20 09:54:46 +
Commit: Alex Richardson 
CommitDate: 2021-01-20 09:54:46 +

Emit uprintf() output for initproc if there is no controlling terminal

This patch helped me debug why /sbin/init was not being loaded after
making changes to the image activator in CheriBSD.

Reviewed By:jhb (earlier version), kib
Differential Revision: https://reviews.freebsd.org/D28121
---
 sys/kern/subr_prf.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 31117c4e3415..b51213a25d0d 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -179,6 +179,14 @@ uprintf(const char *fmt, ...)
if (TD_IS_IDLETHREAD(td))
return (0);
 
+   if (td->td_proc == initproc) {
+   /* Produce output when we fail to load /sbin/init: */
+   va_start(ap, fmt);
+   retval = vprintf(fmt, ap);
+   va_end(ap);
+   return (retval);
+   }
+
sx_slock(&proctree_lock);
p = td->td_proc;
PROC_LOCK(p);
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: cef194271162 - main - libc: Fix null pointer arithmetic warning in mergesort

2021-01-20 Thread Alex Richardson
The branch main has been updated by arichardson:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=cef1942711624c6cf1d237118531cfad9ade05ac

commit cef1942711624c6cf1d237118531cfad9ade05ac
Author: Alex Richardson 
AuthorDate: 2021-01-20 09:56:01 +
Commit: Alex Richardson 
CommitDate: 2021-01-20 09:56:01 +

libc: Fix null pointer arithmetic warning in mergesort

This file has other questionable code and "optimizations" (such as copying
one int at a time) that are probably no longer useful, so it might make
sense to replace it with a different implementation at some point.

Reviewed By:jhb
Differential Revision: https://reviews.freebsd.org/D28134
---
 lib/libc/stdlib/merge.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/libc/stdlib/merge.c b/lib/libc/stdlib/merge.c
index 3a47e424e4da..853d6ae93fcb 100644
--- a/lib/libc/stdlib/merge.c
+++ b/lib/libc/stdlib/merge.c
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
  * (The default is pairwise merging.)
  */
 
-#include 
+#include 
 
 #include 
 #include 
@@ -97,9 +97,7 @@ static void insertionsort(u_char *, size_t, size_t, cmp_t);
  * boundaries.
  */
 /* Assumption: PSIZE is a power of 2. */
-#define EVAL(p) (u_char **)\
-   ((u_char *)0 +  \
-   (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
+#define EVAL(p) (u_char **)roundup2((uintptr_t)p, PSIZE)
 
 #ifdef I_AM_MERGESORT_B
 int mergesort_b(void *, size_t, size_t, cmp_t);
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


Re: git: 041b28524a3c - main - release: Add workaround to use SVN for ports

2021-01-20 Thread Yasuhiro Kimura
From: Yasuhiro Kimura 
Subject: Re: git: 041b28524a3c - main - release: Add workaround to use SVN for 
ports
Date: Wed, 20 Jan 2021 17:29:33 +0900 (JST)

> From: Glen Barber 
> Subject: git: 041b28524a3c - main - release: Add workaround to use SVN for 
> ports
> Date: Tue, 19 Jan 2021 18:38:50 GMT
> 
>> The branch main has been updated by gjb:
>> 
>> URL: 
>> https://cgit.FreeBSD.org/src/commit/?id=041b28524a3c69ff6e893067df156c3faabcac9a
>> 
>> commit 041b28524a3c69ff6e893067df156c3faabcac9a
>> Author: Glen Barber 
>> AuthorDate: 2021-01-19 18:38:33 +
>> Commit: Glen Barber 
>> CommitDate: 2021-01-19 18:38:33 +
>> 
>> release: Add workaround to use SVN for ports
>> 
>> The ports tree is scheduled to be converted from Subversion to Git
>> after the currently-scheduled 13.0-RELEASE, so the source of truth
>> will be Subversion for the ports tree.
>> 
>> Implement a hack specifically for this case.
> 
> This change results in accessing 'svn://svn.freebsd.org/ports/head/head'
> and failing to check out ports tree.

Following patch fixes the problem.

diff --git a/release/release.sh b/release/release.sh
index 60034f12349..fbd64bb8234 100755
--- a/release/release.sh
+++ b/release/release.sh
@@ -147,7 +147,7 @@ env_check() {
SRC="${GITROOT}${GITSRC}"
DOC="${GITROOT}${GITDOC}"
#PORT="${GITROOT}${GITPORTS}"
-   PORT="svn://svn.freebsd.org/ports/${PORTBRANCH}"
+   PORT="svn://svn.freebsd.org/ports/"
 
if [ -n "${EMBEDDEDBUILD}" ]; then
WITH_DVD=

---
Yasuhiro Kimura
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: bc7ee8e5bc55 - main - Address panic with PRR due to missed initialization of recover_fs

2021-01-20 Thread Richard Scheffenegger
The branch main has been updated by rscheff:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bc7ee8e5bc555c246bad8bbb9cdf964fa0a08f41

commit bc7ee8e5bc555c246bad8bbb9cdf964fa0a08f41
Author: Richard Scheffenegger 
AuthorDate: 2021-01-20 11:06:34 +
Commit: Richard Scheffenegger 
CommitDate: 2021-01-20 11:06:34 +

Address panic with PRR due to missed initialization of recover_fs

Summary:
When using the base stack in conjunction with RACK, it appears that
infrequently, ++tp->t_dupacks is instantly larger than tcprexmtthresh.

This leaves the recover flightsize (sackhint.recover_fs) uninitialized,
leading to a div/0 panic.

Address this by properly initializing the variable just prior to first
use, if it is not properly initialized.

In order to prevent stale information from a prior recovery to
negatively impact the PRR calculations in this event, also clear
recover_fs once loss recovery is finished.

Finally, improve the readability of the initialization of recover_fs
when t_dupacks == tcprexmtthresh by adjusting the indentation and
using the max(1, snd_nxt - snd_una) macro.

Reviewers: rrs, kbowling, tuexen, jtl, #transport, gnn!, jmg, manu, 
#manpages

Reviewed By: rrs, kbowling, #transport

Subscribers: bdrewery, andrew, rpokala, ae, emaste, bz, bcran, #linuxkpi, 
imp, melifaro

Differential Revision: https://reviews.freebsd.org/D28114
---
 sys/netinet/tcp_input.c | 20 
 sys/netinet/tcp_subr.c  | 10 ++
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 283d42b594bd..75718352da00 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -510,6 +510,7 @@ cc_post_recovery(struct tcpcb *tp, struct tcphdr *th)
}
/* XXXLAS: EXIT_RECOVERY ? */
tp->t_bytes_acked = 0;
+   tp->sackhint.recover_fs = 0;
 }
 
 /*
@@ -2590,6 +2591,9 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct 
socket *so,

tp->sackhint.sack_bytes_rexmit;
tp->sackhint.prr_delivered += 
del_data;
if (pipe > tp->snd_ssthresh) {
+   if 
(tp->sackhint.recover_fs == 0)
+   
tp->sackhint.recover_fs =
+   max(1, 
tp->snd_nxt - tp->snd_una);
snd_cnt = 
(tp->sackhint.prr_delivered *
tp->snd_ssthresh /

tp->sackhint.recover_fs) +
@@ -2677,14 +2681,14 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, 
struct socket *so,
tcp_timer_activate(tp, TT_REXMT, 0);
tp->t_rtttime = 0;
if (V_tcp_do_prr) {
-   /*
-* snd_ssthresh is already updated 
by
-* cc_cong_signal.
-*/
-   tp->sackhint.prr_delivered = 0;
-   tp->sackhint.sack_bytes_rexmit = 0;
-   if (!(tp->sackhint.recover_fs = 
tp->snd_nxt - tp->snd_una))
-   tp->sackhint.recover_fs = 1;
+   /*
+* snd_ssthresh is already 
updated by
+* cc_cong_signal.
+*/
+   tp->sackhint.prr_delivered = 0;
+   tp->sackhint.sack_bytes_rexmit 
= 0;
+   tp->sackhint.recover_fs = max(1,
+   tp->snd_nxt - tp->snd_una);
}
if (tp->t_flags & TF_SACK_PERMIT) {
TCPSTAT_INC(
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index b39d2b43d3a2..c49ff680d201 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -742,6 +742,16 @@ tcp_default_fb_init(struct tcpcb *tp)
TCPS_HAVEESTABLISHED(tp->t_state) ? TP_KEEPIDLE(tp) :
TP_KEEPINIT(tp));
 
+   /*
+* Make sure critical variables are initialized
+* if transitioning while in Recovery.
+*/
+   if IN_FAST

git: b2649738d46e - stable/12 - Add a missing period and remove a macro from Bl's width argument

2021-01-20 Thread Mateusz Piotrowski
The branch stable/12 has been updated by 0mp (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b2649738d46e18fa118d7f1b0a14c9d4026d9868

commit b2649738d46e18fa118d7f1b0a14c9d4026d9868
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2020-11-12 16:44:56 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2021-01-20 11:44:15 +

Add a missing period and remove a macro from Bl's width argument

(cherry picked from commit 2bbc7e74368c73d198838ee821a4b3dd75a8be6a)
---
 share/man/man9/VOP_RDWR.9 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/share/man/man9/VOP_RDWR.9 b/share/man/man9/VOP_RDWR.9
index eb1af7842073..4719ebabd094 100644
--- a/share/man/man9/VOP_RDWR.9
+++ b/share/man/man9/VOP_RDWR.9
@@ -44,7 +44,7 @@
 .Ft int
 .Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred 
*cred"
 .Sh DESCRIPTION
-These entry points read or write the contents of a file
+These entry points read or write the contents of a file.
 .Pp
 The arguments are:
 .Bl -tag -width ioflag
@@ -66,7 +66,7 @@ read-ahead hint (in units of file system blocks) that the 
file system
 should attempt.
 The low 16 bits are a bit mask which can contain
 the following flags:
-.Bl -tag -width ".Dv IO_NODELOCKED"
+.Bl -tag -width "IO_NODELOCKED"
 .It Dv IO_UNIT
 Do I/O as atomic unit.
 .It Dv IO_APPEND
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 80e0516736c6 - stable/12 - Fix a typo

2021-01-20 Thread Mateusz Piotrowski
The branch stable/12 has been updated by 0mp (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=80e0516736c6d257b39c10357c60502f97370e04

commit 80e0516736c6d257b39c10357c60502f97370e04
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2021-01-07 14:28:29 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2021-01-20 13:22:32 +

Fix a typo

(cherry picked from commit 0199cbf641db5f28d258153014fa8a657ae98ea6)
---
 usr.sbin/certctl/certctl.8 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/certctl/certctl.8 b/usr.sbin/certctl/certctl.8
index 7d4f98995da6..8ca2cd37dee5 100644
--- a/usr.sbin/certctl/certctl.8
+++ b/usr.sbin/certctl/certctl.8
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 20, 2020
+.Dd January 7, 2021
 .Dt CERTCTL 8
 .Os
 .Sh NAME
@@ -65,7 +65,7 @@ Specify the path of the METALOG file (default: 
$DESTDIR/METALOG).
 .It Fl n
 No-Op mode, do not actually perform any actions.
 .It Fl v
-be verbose, print details about actions before performing them.
+Be verbose, print details about actions before performing them.
 .It Fl U
 Unprivileged mode, do not change the ownership of created links.
 Do record the ownership in the METALOG file.
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: e9330580fdeb - stable/12 - Improve readability of the options list

2021-01-20 Thread Mateusz Piotrowski
The branch stable/12 has been updated by 0mp (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e9330580fdebdd3891b9b9dc5a2fcace1fdbff3d

commit e9330580fdebdd3891b9b9dc5a2fcace1fdbff3d
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2021-01-05 14:46:56 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2021-01-20 13:36:00 +

Improve readability of the options list

(cherry picked from commit 225afb6cad9808af42408875baaa243d6d75d92d)
---
 usr.bin/script/script.1 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1
index fc138d83f907..3b67c0341374 100644
--- a/usr.bin/script/script.1
+++ b/usr.bin/script/script.1
@@ -28,7 +28,7 @@
 .\"@(#)script.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd December 4, 2013
+.Dd January 5, 2021
 .Dt SCRIPT 1
 .Os
 .Sh NAME
@@ -66,7 +66,7 @@ will run the specified command with an optional argument 
vector
 instead of an interactive shell.
 .Pp
 The following options are available:
-.Bl -tag -width indent
+.Bl -tag -width "-F pipe"
 .It Fl a
 Append the output to
 .Ar file
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 8c01699f9194 - stable/12 - Add some examples to script.1

2021-01-20 Thread Mateusz Piotrowski
The branch stable/12 has been updated by 0mp (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8c01699f9194cfa3805ac734ae912529a10c063a

commit 8c01699f9194cfa3805ac734ae912529a10c063a
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2021-01-05 15:28:32 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2021-01-20 13:40:13 +

Add some examples to script.1

While here:

- Split synopsis into two parts. The first explains how to record
  sessions, while the second one explains how to replay (some of)
  the recorded sessions.
- Fix the -width argument of the environment variables list.

(cherry picked from commit d41149a8e9cbb76ff89322a3363299f1b93823d2)
---
 usr.bin/script/script.1 | 70 +++--
 1 file changed, 68 insertions(+), 2 deletions(-)

diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1
index 3b67c0341374..d978c2aa2657 100644
--- a/usr.bin/script/script.1
+++ b/usr.bin/script/script.1
@@ -36,10 +36,14 @@
 .Nd make typescript of terminal session
 .Sh SYNOPSIS
 .Nm
-.Op Fl adfkpqr
+.Op Fl afkqr
 .Op Fl F Ar pipe
 .Op Fl t Ar time
 .Op Ar file Op Ar command ...
+.Nm
+.Fl p
+.Op Fl dq
+.Op Ar file
 .Sh DESCRIPTION
 The
 .Nm
@@ -137,7 +141,7 @@ The results are meant to emulate a hardcopy terminal, not 
an addressable one.
 .Sh ENVIRONMENT
 The following environment variables are utilized by
 .Nm :
-.Bl -tag -width SHELL
+.Bl -tag -width SCRIPT
 .It Ev SCRIPT
 The
 .Ev SCRIPT
@@ -163,6 +167,68 @@ is not set, the Bourne shell
 is assumed.
 .Pq Most shells set this variable automatically .
 .El
+.Sh EXAMPLES
+Record a simple
+.Xr csh 1
+session with no additional details like input, output, and timestamping:
+.Bd -literal -offset indent
+$ SHELL=/bin/csh script
+Script started, output file is typescript
+% date
+Tue Jan  5 15:08:10 UTC 2021
+% exit
+exit
+
+Script done, output file is typescript
+.Ed
+.Pp
+Now, replay the session recorded in the previous example:
+.Bd -literal -offset indent
+$ cat ./typescript
+Script started on Tue Jan  5 15:08:08 2021
+% date
+Tue Jan  5 15:08:10 UTC 2021
+% exit
+exit
+
+Script done on Tue Jan  5 15:08:13 2021
+.Ed
+.Pp
+Record a
+.Xr csh 1
+session, but this time with additional details like timestamping:
+.Bd -literal -offset indent
+$ SHELL=/bin/csh script -r
+Script started, output file is typescript
+% date
+Tue Jan  5 15:17:11 UTC 2021
+% exit
+exit
+
+Script done, output file is typescript
+.Ed
+.Pp
+In order to replay a sessions recorded with the
+.Fl r
+flag, it is necessary to specify
+.Fl p
+.Po
+.Xr cat 1
+will not work because of all the aditional information stored in the session 
file
+.Pc .
+Also, let us use
+.Fl d
+to print the whole session at once:
+.Bd -literal -offset indent
+$ script -dp ./typescript
+Script started on Tue Jan  5 15:17:09 2021
+% date
+Tue Jan  5 15:17:11 UTC 2021
+% exit
+exit
+
+Script done on Tue Jan  5 15:17:14 2021
+.Ed
 .Sh SEE ALSO
 .Xr csh 1
 .Po
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: b9fdd1446cda - main - Regenerate src.conf(5) after 7c5a624afae4

2021-01-20 Thread Kyle Evans
The branch main has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b9fdd1446cdaf396a63ef9bf31c55a8aa4a5fa31

commit b9fdd1446cdaf396a63ef9bf31c55a8aa4a5fa31
Author: Kyle Evans 
AuthorDate: 2021-01-20 14:29:16 +
Commit: Kyle Evans 
CommitDate: 2021-01-20 14:29:16 +

Regenerate src.conf(5) after 7c5a624afae4

WITHOUT_CRYPT no longer implies WITHOUT_WIRELESS after the aforementioned
commit.
---
 share/man/man5/src.conf.5 | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index fa44fac74a51..5ff5b31b80be 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 January 7, 2021
+.Dd January 20, 2021
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -400,8 +400,6 @@ When set, it enforces these options:
 .Va WITHOUT_SVNLITE
 .It
 .Va WITHOUT_UNBOUND
-.It
-.Va WITHOUT_WIRELESS
 .El
 .Pp
 When set, these options are also in effect:
@@ -1309,8 +1307,6 @@ When set, it enforces these options:
 .Va WITHOUT_SVNLITE
 .It
 .Va WITHOUT_UNBOUND
-.It
-.Va WITHOUT_WIRELESS
 .El
 .Pp
 When set, these options are also in effect:
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: ef0a241c0ba4 - stable/12 - pf: Split pf_src_node into a kernel and userspace struct

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ef0a241c0ba4c594512fa5e1a243a9eb4c61b0f6

commit ef0a241c0ba4c594512fa5e1a243a9eb4c61b0f6
Author: Kristof Provost 
AuthorDate: 2020-12-23 13:51:52 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:04 +

pf: Split pf_src_node into a kernel and userspace struct

Introduce a kernel version of struct pf_src_node (pf_ksrc_node).

This will allow us to improve the in-kernel data structure without
breaking userspace compatibility.

Reviewed by:philip
MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27707

(cherry picked from commit 17ad7334ca6225e0dc5caca12d1eb5886115f7af)
---
 sys/net/pfvar.h   | 57 +---
 sys/netpfil/pf/pf.c   | 34 
 sys/netpfil/pf/pf.h   | 50 +++
 sys/netpfil/pf/pf_ioctl.c | 67 +++
 sys/netpfil/pf/pf_lb.c|  8 +++---
 5 files changed, 129 insertions(+), 87 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 24faee5d45c6..5ff47c99b457 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -54,21 +54,6 @@
 #include 
 #include 
 
-struct pf_addr {
-   union {
-   struct in_addr  v4;
-   struct in6_addr v6;
-   u_int8_taddr8[16];
-   u_int16_t   addr16[8];
-   u_int32_t   addr32[4];
-   } pfa;  /* 128-bit address */
-#define v4 pfa.v4
-#define v6 pfa.v6
-#define addr8  pfa.addr8
-#define addr16 pfa.addr16
-#define addr32 pfa.addr32
-};
-
 #define PFI_AFLAG_NETWORK  0x01
 #define PFI_AFLAG_BROADCAST0x02
 #define PFI_AFLAG_PEER 0x04
@@ -481,12 +466,6 @@ struct pf_osfp_ioctl {
int fp_getnum;  /* DIOCOSFPGET number */
 };
 
-
-union pf_rule_ptr {
-   struct pf_rule  *ptr;
-   u_int32_tnr;
-};
-
 #definePF_ANCHOR_NAME_SIZE  64
 
 struct pf_rule {
@@ -630,18 +609,9 @@ struct pf_rule {
 #define PFSTATE_ADAPT_START6   /* default adaptive timeout start */
 #define PFSTATE_ADAPT_END  12  /* default adaptive timeout end */
 
-
-struct pf_threshold {
-   u_int32_t   limit;
-#definePF_THRESHOLD_MULT   1000
-#define PF_THRESHOLD_MAX   0x / PF_THRESHOLD_MULT
-   u_int32_t   seconds;
-   u_int32_t   count;
-   u_int32_t   last;
-};
-
-struct pf_src_node {
-   LIST_ENTRY(pf_src_node) entry;
+#ifdef _KERNEL
+struct pf_ksrc_node {
+   LIST_ENTRY(pf_ksrc_node) entry;
struct pf_addr   addr;
struct pf_addr   raddr;
union pf_rule_ptr rule;
@@ -656,8 +626,7 @@ struct pf_src_node {
sa_family_t  af;
u_int8_t ruletype;
 };
-
-#define PFSNODE_HIWAT  1   /* default source node table size */
+#endif
 
 struct pf_state_scrub {
struct timeval  pfss_last;  /* time received last packet*/
@@ -741,8 +710,8 @@ struct pf_state {
struct pf_state_key *key[2];/* addresses stack and wire  */
struct pfi_kif  *kif;
struct pfi_kif  *rt_kif;
-   struct pf_src_node  *src_node;
-   struct pf_src_node  *nat_src_node;
+   struct pf_ksrc_node *src_node;
+   struct pf_ksrc_node *nat_src_node;
counter_u64_tpackets[2];
counter_u64_tbytes[2];
u_int32_tcreation;
@@ -1572,9 +1541,9 @@ struct pf_ifspeed_v1 {
 #endif /* _KERNEL */
 
 #ifdef _KERNEL
-LIST_HEAD(pf_src_node_list, pf_src_node);
+LIST_HEAD(pf_ksrc_node_list, pf_ksrc_node);
 struct pf_srchash {
-   struct pf_src_node_list nodes;
+   struct pf_ksrc_node_listnodes;
struct mtx  lock;
 };
 
@@ -1686,10 +1655,10 @@ pf_release_state(struct pf_state *s)
 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 *,
u_int, int *);
-extern struct pf_src_node  *pf_find_src_node(struct pf_addr *,
+extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *,
struct pf_rule *, sa_family_t, int);
-extern void pf_unlink_src_node(struct pf_src_node *);
-extern u_intpf_free_src_nodes(struct pf_src_node_list *);
+extern void pf_unlink_src_node(struct pf_ksrc_node *);
+extern u_intpf_free_src_nodes(struct pf_ksrc_node_list *);
 extern void pf_print_state(struct pf_state *);
 extern void pf_print_flags(u_int8_t);
 extern u_int16_t

git: e2f0a703ead7 - stable/12 - pf: Migrate pf_rule and related structs to pf.h

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e2f0a703ead7fa174edd63422291a3b841b18384

commit e2f0a703ead7fa174edd63422291a3b841b18384
Author: Kristof Provost 
AuthorDate: 2020-12-03 16:17:39 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:04 +

pf: Migrate pf_rule and related structs to pf.h

As part of the split between user and kernel mode structures we're
moving all user space usable definitions into pf.h.

No functional change intended.

MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27757

(cherry picked from commit dc865dae89c34291467e0ba569a8c78fc7a5d360)
---
 sys/net/pfvar.h | 317 
 sys/netpfil/pf/pf.h | 317 
 2 files changed, 317 insertions(+), 317 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index dd85ac5f7b9f..440110e77298 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -54,31 +54,6 @@
 #include 
 #include 
 
-#define PFI_AFLAG_NETWORK  0x01
-#define PFI_AFLAG_BROADCAST0x02
-#define PFI_AFLAG_PEER 0x04
-#define PFI_AFLAG_MODEMASK 0x07
-#define PFI_AFLAG_NOALIAS  0x08
-
-struct pf_addr_wrap {
-   union {
-   struct {
-   struct pf_addr   addr;
-   struct pf_addr   mask;
-   }a;
-   char ifname[IFNAMSIZ];
-   char tblname[PF_TABLE_NAME_SIZE];
-   }v;
-   union {
-   struct pfi_dynaddr  *dyn;
-   struct pfr_ktable   *tbl;
-   int  dyncnt;
-   int  tblcnt;
-   }p;
-   u_int8_t type;  /* PF_ADDR_* */
-   u_int8_t iflags;/* PFI_AFLAG_* */
-};
-
 #ifdef _KERNEL
 
 SYSCTL_DECL(_net_pf);
@@ -317,298 +292,6 @@ extern struct sx pf_end_lock;
 
 #define PF_ALGNMNT(off) (((off) % 2) == 0)
 
-struct pf_rule_uid {
-   uid_tuid[2];
-   u_int8_t op;
-};
-
-struct pf_rule_gid {
-   uid_tgid[2];
-   u_int8_t op;
-};
-
-struct pf_rule_addr {
-   struct pf_addr_wrap  addr;
-   u_int16_tport[2];
-   u_int8_t neg;
-   u_int8_t port_op;
-};
-
-struct pf_pooladdr {
-   struct pf_addr_wrap  addr;
-   TAILQ_ENTRY(pf_pooladdr) entries;
-   char ifname[IFNAMSIZ];
-   struct pfi_kif  *kif;
-};
-
-TAILQ_HEAD(pf_palist, pf_pooladdr);
-
-struct pf_poolhashkey {
-   union {
-   u_int8_tkey8[16];
-   u_int16_t   key16[8];
-   u_int32_t   key32[4];
-   } pfk;  /* 128-bit hash key */
-#define key8   pfk.key8
-#define key16  pfk.key16
-#define key32  pfk.key32
-};
-
-struct pf_pool {
-   struct pf_palist list;
-   struct pf_pooladdr  *cur;
-   struct pf_poolhashkeykey;
-   struct pf_addr   counter;
-   int  tblidx;
-   u_int16_tproxy_port[2];
-   u_int8_t opts;
-};
-
-
-/* A packed Operating System description for fingerprinting */
-typedef u_int32_t pf_osfp_t;
-#define PF_OSFP_ANY((pf_osfp_t)0)
-#define PF_OSFP_UNKNOWN((pf_osfp_t)-1)
-#define PF_OSFP_NOMATCH((pf_osfp_t)-2)
-
-struct pf_osfp_entry {
-   SLIST_ENTRY(pf_osfp_entry) fp_entry;
-   pf_osfp_t   fp_os;
-   int fp_enflags;
-#define PF_OSFP_EXPANDED   0x001   /* expanded entry */
-#define PF_OSFP_GENERIC0x002   /* generic signature */
-#define PF_OSFP_NODETAIL   0x004   /* no p0f details */
-#define PF_OSFP_LEN32
-   charfp_class_nm[PF_OSFP_LEN];
-   charfp_version_nm[PF_OSFP_LEN];
-   charfp_subtype_nm[PF_OSFP_LEN];
-};
-#define PF_OSFP_ENTRY_EQ(a, b) \
-((a)->fp_os == (b)->fp_os && \
-memcmp((a)->fp_class_nm, (b)->fp_class_nm, PF_OSFP_LEN) == 0 && \
-memcmp((a)->fp_version_nm, (b)->fp_version_nm, PF_OSFP_LEN) == 0 && \
-memcmp((a)->fp_subtype_nm, (b)->fp_subtype_nm, PF_OSFP_LEN) == 0)
-
-/* handle pf_osfp_t packing */
-#define _FP_RESERVED_BIT   1  /* For the special negative #defines */
-#define _FP_UNUSED_BITS1
-#define _FP_CLASS_BITS 10 /* OS Class (Windows, Linux) */
-#define _FP_VERSION_BITS   10 /* OS version (95, 98, NT, 2.4.54, 3.2) */
-#define _FP_SUBTYPE_BITS   10 /* patch level (NT SP4, SP3, ECN patch) */
-#define PF

git: b55dd986a489 - stable/12 - pf: Use counter_u64 in pf_src_node

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b55dd986a4894e0705be24118bcedc1b60120d82

commit b55dd986a4894e0705be24118bcedc1b60120d82
Author: Kristof Provost 
AuthorDate: 2020-11-13 19:31:51 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:04 +

pf: Use counter_u64 in pf_src_node

Reviewd by: philip
MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27756

(cherry picked from commit fbbf270eef271806a0a106e45356d91f5b5e1f55)
---
 sys/net/pfvar.h   |  4 ++--
 sys/netpfil/pf/pf.c   | 50 ++-
 sys/netpfil/pf/pf_ioctl.c |  7 +--
 3 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 5ff47c99b457..dd85ac5f7b9f 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -616,8 +616,8 @@ struct pf_ksrc_node {
struct pf_addr   raddr;
union pf_rule_ptr rule;
struct pfi_kif  *kif;
-   u_int64_tbytes[2];
-   u_int64_tpackets[2];
+   counter_u64_tbytes[2];
+   counter_u64_tpackets[2];
u_int32_tstates;
u_int32_tconn;
struct pf_threshold conn_rate;
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 7b2128da7985..89236817e3e9 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -702,6 +702,19 @@ pf_find_src_node(struct pf_addr *src, struct pf_rule 
*rule, sa_family_t af,
return (n);
 }
 
+static void
+pf_free_src_node(struct pf_ksrc_node *sn)
+{
+
+   for (int i = 0; i < 2; i++) {
+   if (sn->bytes[i])
+   counter_u64_free(sn->bytes[i]);
+   if (sn->packets[i])
+   counter_u64_free(sn->packets[i]);
+   }
+   uma_zfree(V_pf_sources_z, sn);
+}
+
 static int
 pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule,
 struct pf_addr *src, sa_family_t af)
@@ -730,6 +743,17 @@ pf_insert_src_node(struct pf_ksrc_node **sn, struct 
pf_rule *rule,
return (-1);
}
 
+   for (int i = 0; i < 2; i++) {
+   (*sn)->bytes[i] = counter_u64_alloc(M_NOWAIT);
+   (*sn)->packets[i] = counter_u64_alloc(M_NOWAIT);
+
+   if ((*sn)->bytes[i] == NULL || (*sn)->packets[i] == 
NULL) {
+   pf_free_src_node(*sn);
+   PF_HASHROW_UNLOCK(sh);
+   return (-1);
+   }
+   }
+
pf_init_threshold(&(*sn)->conn_rate,
rule->max_src_conn_rate.limit,
rule->max_src_conn_rate.seconds);
@@ -773,7 +797,7 @@ pf_free_src_nodes(struct pf_ksrc_node_list *head)
u_int count = 0;
 
LIST_FOREACH_SAFE(sn, head, entry, tmp) {
-   uma_zfree(V_pf_sources_z, sn);
+   pf_free_src_node(sn);
count++;
}
 
@@ -6322,12 +6346,16 @@ done:
s->nat_rule.ptr->bytes[dirndx] += pd.tot_len;
}
if (s->src_node != NULL) {
-   s->src_node->packets[dirndx]++;
-   s->src_node->bytes[dirndx] += pd.tot_len;
+   counter_u64_add(s->src_node->packets[dirndx],
+   1);
+   counter_u64_add(s->src_node->bytes[dirndx],
+   pd.tot_len);
}
if (s->nat_src_node != NULL) {
-   s->nat_src_node->packets[dirndx]++;
-   s->nat_src_node->bytes[dirndx] += pd.tot_len;
+   
counter_u64_add(s->nat_src_node->packets[dirndx],
+   1);
+   counter_u64_add(s->nat_src_node->bytes[dirndx],
+   pd.tot_len);
}
dirndx = (dir == s->direction) ? 0 : 1;
counter_u64_add(s->packets[dirndx], 1);
@@ -6721,12 +6749,16 @@ done:
s->nat_rule.ptr->bytes[dirndx] += pd.tot_len;
}
if (s->src_node != NULL) {
-   s->src_node->packets[dirndx]++;
-   s->src_node->bytes[dirndx] += pd.tot_len;
+   counter_u64_add(s->src_node->packets[dirndx],
+   1);
+   counter_u64_add(s->src_node->bytes[dirndx],
+   pd.tot_len);
}
if (s->nat_src_node != NULL) {
-   s->nat_

git: 3e4a92026657 - stable/12 - pf: Split pf_rule into kernel and user space versions

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3e4a9202665701d858e6049fe645a2e3d0ff093e

commit 3e4a9202665701d858e6049fe645a2e3d0ff093e
Author: Kristof Provost 
AuthorDate: 2020-12-05 13:32:54 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:04 +

pf: Split pf_rule into kernel and user space versions

No functional change intended.

MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27758

(cherry picked from commit e86bddea9fe62d5093a1942cf21950b3c5ca62e5)
---
 sys/net/pfvar.h | 234 +-
 sys/netpfil/pf/if_pflog.c   |   4 +-
 sys/netpfil/pf/if_pfsync.c  |   2 +-
 sys/netpfil/pf/pf.c | 124 
 sys/netpfil/pf/pf.h |  48 +++
 sys/netpfil/pf/pf_if.c  |   6 +-
 sys/netpfil/pf/pf_ioctl.c   | 337 ++--
 sys/netpfil/pf/pf_lb.c  |  24 ++--
 sys/netpfil/pf/pf_norm.c|  10 +-
 sys/netpfil/pf/pf_ruleset.c | 303 +++
 sys/netpfil/pf/pf_table.c   |  36 ++---
 11 files changed, 857 insertions(+), 271 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 440110e77298..4dd2db1a34b9 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -293,11 +293,115 @@ extern struct sx pf_end_lock;
 #define PF_ALGNMNT(off) (((off) % 2) == 0)
 
 #ifdef _KERNEL
+
+union pf_krule_ptr {
+   struct pf_krule *ptr;
+   u_int32_tnr;
+};
+
+struct pf_krule {
+   struct pf_rule_addr  src;
+   struct pf_rule_addr  dst;
+   union pf_krule_ptr   skip[PF_SKIP_COUNT];
+   char label[PF_RULE_LABEL_SIZE];
+   char ifname[IFNAMSIZ];
+   char qname[PF_QNAME_SIZE];
+   char pqname[PF_QNAME_SIZE];
+   char tagname[PF_TAG_NAME_SIZE];
+   char match_tagname[PF_TAG_NAME_SIZE];
+
+   char overload_tblname[PF_TABLE_NAME_SIZE];
+
+   TAILQ_ENTRY(pf_krule)entries;
+   struct pf_pool   rpool;
+
+   u_int64_tevaluations;
+   u_int64_tpackets[2];
+   u_int64_tbytes[2];
+
+   struct pfi_kif  *kif;
+   struct pf_kanchor   *anchor;
+   struct pfr_ktable   *overload_tbl;
+
+   pf_osfp_tos_fingerprint;
+
+   int  rtableid;
+   u_int32_ttimeout[PFTM_MAX];
+   u_int32_tmax_states;
+   u_int32_tmax_src_nodes;
+   u_int32_tmax_src_states;
+   u_int32_tmax_src_conn;
+   struct {
+   u_int32_t   limit;
+   u_int32_t   seconds;
+   }max_src_conn_rate;
+   u_int32_tqid;
+   u_int32_tpqid;
+   u_int32_trt_listid;
+   u_int32_tnr;
+   u_int32_tprob;
+   uid_tcuid;
+   pid_tcpid;
+
+   counter_u64_tstates_cur;
+   counter_u64_tstates_tot;
+   counter_u64_tsrc_nodes;
+
+   u_int16_treturn_icmp;
+   u_int16_treturn_icmp6;
+   u_int16_tmax_mss;
+   u_int16_ttag;
+   u_int16_tmatch_tag;
+   u_int16_tscrub_flags;
+
+   struct pf_rule_uid   uid;
+   struct pf_rule_gid   gid;
+
+   u_int32_trule_flag;
+   u_int8_t action;
+   u_int8_t direction;
+   u_int8_t log;
+   u_int8_t logif;
+   u_int8_t quick;
+   u_int8_t ifnot;
+   u_int8_t match_tag_not;
+   u_int8_t natpass;
+
+   u_int8_t keep_state;
+   sa_family_t  af;
+   u_int8_t proto;
+   u_int8_t type;
+   u_int8_t code;
+   u_int8_t flags;
+   u_int8_t flagset;
+   u_int8_t min_ttl;
+   u_int8_t allow_opts;
+   u_int8_t rt;
+   u_int8_t return_ttl;
+   u_int8_t tos;
+   u_int8_t set_tos;
+   u_int8_t anchor_relative;
+   u_int8_t anchor_wildcard;
+
+   u_int8_t flush;
+   u_int8_t prio;
+   u_int8_t set_prio[2];
+
+   struct {
+   struct pf_addr  addr;
+   u_int16_t  

git: ce26f0988baf - stable/12 - pf: Allocate and free pfi_kkif in separate functions

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ce26f0988baff60505bfd4eba006abe25ee722bf

commit ce26f0988baff60505bfd4eba006abe25ee722bf
Author: Kristof Provost 
AuthorDate: 2020-12-13 10:36:54 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:05 +

pf: Allocate and free pfi_kkif in separate functions

Factor out allocating and freeing pfi_kkif structures. This will be
useful when we change the counters to be counter_u64, so we don't have
to deal with that complexity in the multiple locations where we allocate
pfi_kkif structures.

No functional change.

MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27762

(cherry picked from commit 26c841e2a402ed43896313d1b3f00facaa9d839f)
---
 sys/net/pfvar.h   |  3 +++
 sys/netpfil/pf/pf_if.c| 37 -
 sys/netpfil/pf/pf_ioctl.c | 16 
 3 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index a58da4e4cc46..a28483fa9814 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1663,6 +1663,9 @@ struct pf_krule   *pf_get_translation(struct 
pf_pdesc *, struct mbuf *,
 struct pf_state_key*pf_state_key_setup(struct pf_pdesc *, struct pf_addr *,
struct pf_addr *, u_int16_t, u_int16_t);
 struct pf_state_key*pf_state_key_clone(struct pf_state_key *);
+
+struct pfi_kkif*pf_kkif_create(int);
+voidpf_kkif_free(struct pfi_kkif *);
 #endif /* _KERNEL */
 
 #endif /* _NET_PFVAR_H_ */
diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c
index a0148395340f..3230a3e424f6 100644
--- a/sys/netpfil/pf/pf_if.c
+++ b/sys/netpfil/pf/pf_if.c
@@ -122,7 +122,7 @@ pfi_initialize_vnet(void)
V_pfi_buffer = malloc(V_pfi_buffer_max * sizeof(*V_pfi_buffer),
PFI_MTYPE, M_WAITOK);
 
-   kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK);
+   kif = pf_kkif_create(M_WAITOK);
PF_RULES_WLOCK();
V_pfi_all = pfi_kkif_attach(kif, IFG_ALL);
PF_RULES_WUNLOCK();
@@ -169,13 +169,13 @@ pfi_cleanup_vnet(void)
if_rele(kif->pfik_ifp);
kif->pfik_ifp->if_pf_kif = NULL;
}
-   free(kif, PFI_MTYPE);
+   pf_kkif_free(kif);
}
 
mtx_lock(&pfi_unlnkdkifs_mtx);
while ((kif = LIST_FIRST(&V_pfi_unlinked_kifs))) {
LIST_REMOVE(kif, pfik_list);
-   free(kif, PFI_MTYPE);
+   pf_kkif_free(kif);
}
mtx_unlock(&pfi_unlnkdkifs_mtx);
 
@@ -194,6 +194,25 @@ pfi_cleanup(void)
EVENTHANDLER_DEREGISTER(ifaddr_event, pfi_ifaddr_event_cookie);
 }
 
+struct pfi_kkif*
+pf_kkif_create(int flags)
+{
+   struct pfi_kkif *kif;
+
+   kif = malloc(sizeof(*kif), PFI_MTYPE, flags);
+
+   return (kif);
+}
+
+void
+pf_kkif_free(struct pfi_kkif *kif)
+{
+   if (! kif)
+   return;
+
+   free(kif, PFI_MTYPE);
+}
+
 struct pfi_kkif *
 pfi_kkif_find(const char *kif_name)
 {
@@ -217,7 +236,7 @@ pfi_kkif_attach(struct pfi_kkif *kif, const char *kif_name)
 
kif1 = pfi_kkif_find(kif_name);
if (kif1 != NULL) {
-   free(kif, PFI_MTYPE);
+   pf_kkif_free(kif);
return (kif1);
}
 
@@ -286,7 +305,7 @@ pfi_kkif_purge(void)
LIST_FOREACH_SAFE(kif, &V_pfi_unlinked_kifs, pfik_list, kif1) {
if (!(kif->pfik_flags & PFI_IFLAG_REFS)) {
LIST_REMOVE(kif, pfik_list);
-   free(kif, PFI_MTYPE);
+   pf_kkif_free(kif);
} else
kif->pfik_flags &= ~PFI_IFLAG_REFS;
}
@@ -403,7 +422,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af)
if ((dyn = malloc(sizeof(*dyn), PFI_MTYPE, M_NOWAIT | M_ZERO)) == NULL)
return (ENOMEM);
 
-   if ((kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT)) == NULL) {
+   if ((kif = pf_kkif_create(M_NOWAIT)) == NULL) {
free(dyn, PFI_MTYPE);
return (ENOMEM);
}
@@ -811,7 +830,7 @@ pfi_set_flags(const char *name, int flags)
 {
struct pfi_kkif *p, *kif;
 
-   kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT);
+   kif = pf_kkif_create(M_NOWAIT);
if (kif == NULL)
return (ENOMEM);
 
@@ -839,7 +858,7 @@ pfi_clear_flags(const char *name, int flags)
p->pfik_flags == 0 && p->pfik_rulerefs == 0) {
/* Delete this kif. */
RB_REMOVE(pfi_ifhead, &V_pfi_ifs, p);
-   free(p, PFI_MTYPE);
+   pf_kkif_free(p);
}
}
return (0);
@@ -933,7 +952,7 @@ pfi_change_group_event(void *arg __unused, char *gname)
 

git: 7ee74e43abb7 - stable/12 - pf: Remove unused fields from pf_krule

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7ee74e43abb78af75cc381bafbc30c9d5340b09d

commit 7ee74e43abb78af75cc381bafbc30c9d5340b09d
Author: Kristof Provost 
AuthorDate: 2020-12-05 13:38:12 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:04 +

pf: Remove unused fields from pf_krule

The u_* counters are used only to communicate with userspace, as
userspace cannot use counter_u64. As pf_krule is not passed to userspace
these fields are now obsolete.

MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27759

(cherry picked from commit c7bdafe2f1b703fdf72489019edc3d6b9e5483da)
---
 sys/net/pfvar.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 4dd2db1a34b9..5b77b0a6c4e2 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -391,10 +391,6 @@ struct pf_krule {
struct pf_addr  addr;
u_int16_t   port;
}   divert;
-
-   uint64_t u_states_cur;
-   uint64_t u_states_tot;
-   uint64_t u_src_nodes;
 };
 
 struct pf_ksrc_node {
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: efd9d47d0b35 - stable/12 - pf: Convert pfi_kkif to use counter_u64

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=efd9d47d0b358c829bfc12fda2cc5826e73e5974

commit efd9d47d0b358c829bfc12fda2cc5826e73e5974
Author: Kristof Provost 
AuthorDate: 2020-12-13 16:20:02 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:05 +

pf: Convert pfi_kkif to use counter_u64

Improve caching behaviour by using counter_u64 rather than variables
shared between cores.

The result of converting all counters to counter(9) (i.e. this full
patch series) is a significant improvement in throughput. As tested by
olivier@, on Intel Xeon E5-2697Av4 (16Cores, 32 threads) hardware with
Mellanox ConnectX-4 MCX416A-CCAT (100GBase-SR4) nics we see:

x FreeBSD 20201223: inet packets-per-second
+ FreeBSD 20201223 with pf patches: inet packets-per-second
+--+
|+ |
| xx + |
|xxx+++|
||A|   |
|   |A||
+--+
N   Min   MaxMedian   AvgStddev
x   5   9216962   9526356   9343902 9371057.6 116720.36
+   5  19427190  19698400  19502922  19546509 109084.92
Difference at 95.0% confidence
1.01755e+07 +/- 164756
108.584% +/- 2.9359%
(Student's t, pooled s = 112967)

Reviewed by:philip
MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27763

(cherry picked from commit 5a3b9507d784aaa6a7ce35432b2111a7eec12cba)
---
 sys/net/pfvar.h|  5 ++--
 sys/netpfil/pf/pf.c| 12 ++
 sys/netpfil/pf/pf_if.c | 65 +-
 3 files changed, 65 insertions(+), 17 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index a28483fa9814..dcc5bf51fdf6 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -879,8 +879,8 @@ struct pfi_kkif {
} _pfik_glue;
 #definepfik_tree   _pfik_glue._pfik_tree
 #definepfik_list   _pfik_glue._pfik_list
-   u_int64_tpfik_packets[2][2][2];
-   u_int64_tpfik_bytes[2][2][2];
+   counter_u64_tpfik_packets[2][2][2];
+   counter_u64_tpfik_bytes[2][2][2];
u_int32_tpfik_tzero;
u_intpfik_flags;
struct ifnet*pfik_ifp;
@@ -1666,6 +1666,7 @@ struct pf_state_key   *pf_state_key_clone(struct 
pf_state_key *);
 
 struct pfi_kkif*pf_kkif_create(int);
 voidpf_kkif_free(struct pfi_kkif *);
+voidpf_kkif_zero(struct pfi_kkif *);
 #endif /* _KERNEL */
 
 #endif /* _NET_PFVAR_H_ */
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index f1c26342577f..d4101aab9332 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -6329,8 +6329,10 @@ done:
(s == NULL));
}
 
-   kif->pfik_bytes[0][dir == PF_OUT][action != PF_PASS] += pd.tot_len;
-   kif->pfik_packets[0][dir == PF_OUT][action != PF_PASS]++;
+   counter_u64_add(kif->pfik_bytes[0][dir == PF_OUT][action != PF_PASS],
+   pd.tot_len);
+   counter_u64_add(kif->pfik_packets[0][dir == PF_OUT][action != PF_PASS],
+   1);
 
if (action == PF_PASS || r->action == PF_DROP) {
dirndx = (dir == PF_OUT);
@@ -6734,8 +6736,10 @@ done:
&pd, (s == NULL));
}
 
-   kif->pfik_bytes[1][dir == PF_OUT][action != PF_PASS] += pd.tot_len;
-   kif->pfik_packets[1][dir == PF_OUT][action != PF_PASS]++;
+   counter_u64_add(kif->pfik_bytes[1][dir == PF_OUT][action != PF_PASS],
+   pd.tot_len);
+   counter_u64_add(kif->pfik_packets[1][dir == PF_OUT][action != PF_PASS],
+   1);
 
if (action == PF_PASS || r->action == PF_DROP) {
dirndx = (dir == PF_OUT);
diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c
index 3230a3e424f6..9ca404174cca 100644
--- a/sys/netpfil/pf/pf_if.c
+++ b/sys/netpfil/pf/pf_if.c
@@ -199,7 +199,26 @@ pf_kkif_create(int flags)
 {
struct pfi_kkif *kif;
 
-   kif = malloc(sizeof(*kif), PFI_MTYPE, flags);
+   kif = malloc(sizeof(*kif), PFI_MTYPE, flags | M_ZERO);
+   if (! kif)
+   return (kif);
+
+   for (int i = 0; i < 2; i++) {
+   for (int j = 0; j < 2; j++) {
+

git: 14d531ad3f58 - stable/12 - pf: Change pf_krule counters to use counter_u64

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=14d531ad3f5880a375c0cab50ff8cc238099c4d6

commit 14d531ad3f5880a375c0cab50ff8cc238099c4d6
Author: Kristof Provost 
AuthorDate: 2020-12-05 20:41:42 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:05 +

pf: Change pf_krule counters to use counter_u64

This improves the cache behaviour of pf and results in improved
throughput.

MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27760

(cherry picked from commit c3adacdad4d72b045058cd932351b94579cdd543)
---
 sys/net/pfvar.h   |  6 ++---
 sys/netpfil/pf/pf.c   | 32 --
 sys/netpfil/pf/pf_ioctl.c | 69 +--
 sys/netpfil/pf/pf_lb.c|  2 +-
 sys/netpfil/pf/pf_norm.c  | 18 ++---
 5 files changed, 86 insertions(+), 41 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 5b77b0a6c4e2..636ea8c5e02c 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -315,9 +315,9 @@ struct pf_krule {
TAILQ_ENTRY(pf_krule)entries;
struct pf_pool   rpool;
 
-   u_int64_tevaluations;
-   u_int64_tpackets[2];
-   u_int64_tbytes[2];
+   counter_u64_tevaluations;
+   counter_u64_tpackets[2];
+   counter_u64_tbytes[2];
 
struct pfi_kif  *kif;
struct pf_kanchor   *anchor;
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 85a6b27d7139..c2cc2ba55196 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -3538,7 +3538,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_state **sm, 
int direction,
}
 
while (r != NULL) {
-   r->evaluations++;
+   counter_u64_add(r->evaluations, 1);
if (pfi_kif_match(r->kif, kif) == r->ifnot)
r = r->skip[PF_SKIP_IFP].ptr;
else if (r->direction && r->direction != direction)
@@ -3977,7 +3977,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, 
struct pfi_kif *kif,
 
r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_FILTER].active.ptr);
while (r != NULL) {
-   r->evaluations++;
+   counter_u64_add(r->evaluations, 1);
if (pfi_kif_match(r->kif, kif) == r->ifnot)
r = r->skip[PF_SKIP_IFP].ptr;
else if (r->direction && r->direction != direction)
@@ -6334,16 +6334,18 @@ done:
 
if (action == PF_PASS || r->action == PF_DROP) {
dirndx = (dir == PF_OUT);
-   r->packets[dirndx]++;
-   r->bytes[dirndx] += pd.tot_len;
+   counter_u64_add(r->packets[dirndx], 1);
+   counter_u64_add(r->bytes[dirndx], pd.tot_len);
if (a != NULL) {
-   a->packets[dirndx]++;
-   a->bytes[dirndx] += pd.tot_len;
+   counter_u64_add(a->packets[dirndx], 1);
+   counter_u64_add(a->bytes[dirndx], pd.tot_len);
}
if (s != NULL) {
if (s->nat_rule.ptr != NULL) {
-   s->nat_rule.ptr->packets[dirndx]++;
-   s->nat_rule.ptr->bytes[dirndx] += pd.tot_len;
+   
counter_u64_add(s->nat_rule.ptr->packets[dirndx],
+   1);
+   counter_u64_add(s->nat_rule.ptr->bytes[dirndx],
+   pd.tot_len);
}
if (s->src_node != NULL) {
counter_u64_add(s->src_node->packets[dirndx],
@@ -6737,16 +6739,18 @@ done:
 
if (action == PF_PASS || r->action == PF_DROP) {
dirndx = (dir == PF_OUT);
-   r->packets[dirndx]++;
-   r->bytes[dirndx] += pd.tot_len;
+   counter_u64_add(r->packets[dirndx], 1);
+   counter_u64_add(r->bytes[dirndx], pd.tot_len);
if (a != NULL) {
-   a->packets[dirndx]++;
-   a->bytes[dirndx] += pd.tot_len;
+   counter_u64_add(a->packets[dirndx], 1);
+   counter_u64_add(a->bytes[dirndx], pd.tot_len);
}
if (s != NULL) {
if (s->nat_rule.ptr != NULL) {
-   s->nat_rule.ptr->packets[dirndx]++;
-   s->nat_rule.ptr->bytes[dirndx] += pd.tot_len;
+   
counter_u64_add(s->nat_rule.ptr->packets[dirndx],
+   1);
+   counter_u64_add(s->nat_rule.ptr->bytes[dirndx],
+   pd.tot_len);
  

git: 051f0103dc19 - stable/12 - pf: Split pfi_kif into a user and kernel space structure

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=051f0103dc196ac29d7ec2e1f1c3f99a295cae64

commit 051f0103dc196ac29d7ec2e1f1c3f99a295cae64
Author: Kristof Provost 
AuthorDate: 2020-12-12 14:14:56 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:05 +

pf: Split pfi_kif into a user and kernel space structure

No functional change.

MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27761

(cherry picked from commit 320c11165b6b1113b34f9e156cbf85b5ed0aa5eb)
---
 sys/net/pfvar.h|  74 ++--
 sys/netpfil/pf/if_pflog.c  |   2 +-
 sys/netpfil/pf/if_pfsync.c |   6 +-
 sys/netpfil/pf/pf.c|  62 ++--
 sys/netpfil/pf/pf.h|  23 
 sys/netpfil/pf/pf_if.c | 138 ++---
 sys/netpfil/pf/pf_ioctl.c  | 113 ++---
 sys/netpfil/pf/pf_lb.c |  12 ++--
 sys/netpfil/pf/pf_norm.c   |  12 ++--
 9 files changed, 260 insertions(+), 182 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 636ea8c5e02c..a58da4e4cc46 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -66,7 +66,7 @@ struct pfi_dynaddr {
struct pf_addr   pfid_addr6;
struct pf_addr   pfid_mask6;
struct pfr_ktable   *pfid_kt;
-   struct pfi_kif  *pfid_kif;
+   struct pfi_kkif *pfid_kif;
int  pfid_net;  /* mask or 128 */
int  pfid_acnt4;/* address count IPv4 */
int  pfid_acnt6;/* address count IPv6 */
@@ -294,6 +294,25 @@ extern struct sx pf_end_lock;
 
 #ifdef _KERNEL
 
+struct pf_kpooladdr {
+   struct pf_addr_wrap  addr;
+   TAILQ_ENTRY(pf_kpooladdr)entries;
+   char ifname[IFNAMSIZ];
+   struct pfi_kkif *kif;
+};
+
+TAILQ_HEAD(pf_kpalist, pf_kpooladdr);
+
+struct pf_kpool {
+   struct pf_kpalistlist;
+   struct pf_kpooladdr *cur;
+   struct pf_poolhashkeykey;
+   struct pf_addr   counter;
+   int  tblidx;
+   u_int16_tproxy_port[2];
+   u_int8_t opts;
+};
+
 union pf_krule_ptr {
struct pf_krule *ptr;
u_int32_tnr;
@@ -313,13 +332,13 @@ struct pf_krule {
char overload_tblname[PF_TABLE_NAME_SIZE];
 
TAILQ_ENTRY(pf_krule)entries;
-   struct pf_pool   rpool;
+   struct pf_kpool  rpool;
 
counter_u64_tevaluations;
counter_u64_tpackets[2];
counter_u64_tbytes[2];
 
-   struct pfi_kif  *kif;
+   struct pfi_kkif *kif;
struct pf_kanchor   *anchor;
struct pfr_ktable   *overload_tbl;
 
@@ -398,7 +417,7 @@ struct pf_ksrc_node {
struct pf_addr   addr;
struct pf_addr   raddr;
union pf_krule_ptr rule;
-   struct pfi_kif  *kif;
+   struct pfi_kkif *kif;
counter_u64_tbytes[2];
counter_u64_tpackets[2];
u_int32_tstates;
@@ -500,8 +519,8 @@ struct pf_state {
union pf_krule_ptr   nat_rule;
struct pf_addr   rt_addr;
struct pf_state_key *key[2];/* addresses stack and wire  */
-   struct pfi_kif  *kif;
-   struct pfi_kif  *rt_kif;
+   struct pfi_kkif *kif;
+   struct pfi_kkif *rt_kif;
struct pf_ksrc_node *src_node;
struct pf_ksrc_node *nat_src_node;
counter_u64_tpackets[2];
@@ -606,7 +625,7 @@ voidpfsync_state_export(struct 
pfsync_state *,
 /* pflog */
 struct pf_kruleset;
 struct pf_pdesc;
-typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t,
+typedef int pflog_packet_t(struct pfi_kkif *, struct mbuf *, sa_family_t,
 u_int8_t, u_int8_t, struct pf_krule *, struct pf_krule *,
 struct pf_kruleset *, struct pf_pdesc *, int);
 extern pflog_packet_t  *pflog_packet_ptr;
@@ -851,16 +870,12 @@ struct pfr_ktable {
 #define pfrkt_tzeropfrkt_kts.pfrkts_tzero
 #endif
 
-/* keep synced with pfi_kif, used in RB_FIND */
-struct pfi_kif_cmp {
-   char pfik_name[IFNAMSIZ];
-};
-
-struct pfi_kif {
+#ifdef _KERNEL
+struct pfi_kkif {
char pfik_name[IFNAMSIZ];
union {
-   RB_ENTRY(pfi_kif)_pfik_tree;
-   LIST_ENTRY(pfi_kif)  _pfik_list;
+   RB_ENTRY(pfi_kkif)   _pfik_tree;
+   LIST_ENTRY(pfi_kkif) _pfik_list;
} _pfik_glue;
 #definepfik_tree   _pfik

git: 6d3ebc9bfcd8 - stable/12 - pf: Copy kif flags to userspace

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6d3ebc9bfcd814be6526237ee28f46228ac6c292

commit 6d3ebc9bfcd814be6526237ee28f46228ac6c292
Author: Kristof Provost 
AuthorDate: 2021-01-07 21:24:38 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:05 +

pf: Copy kif flags to userspace

This was overlooked in the pfi_kkif/pfi_kif splitup and as a result
userspace could no longer tell which interfaces had the skip flag
applied.

MFC after:  2 weeks

(cherry picked from commit 0fcb03fbaca1307175edc96355c867471db309f8)
---
 sys/netpfil/pf/pf_if.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c
index 9ca404174cca..48733d351a24 100644
--- a/sys/netpfil/pf/pf_if.c
+++ b/sys/netpfil/pf/pf_if.c
@@ -815,6 +815,7 @@ pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif 
*kif)
}
}
}
+   kif->pfik_flags = kkif->pfik_flags;
kif->pfik_tzero = kkif->pfik_tzero;
kif->pfik_rulerefs = kkif->pfik_rulerefs;
 }
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 4046f57601ea - stable/12 - pfctl: Fix NOCLEAN build

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4046f57601eaa0bcd1ec8496e1280939b948aa46

commit 4046f57601eaa0bcd1ec8496e1280939b948aa46
Author: Kristof Provost 
AuthorDate: 2021-01-19 12:48:31 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:05 +

pfctl: Fix NOCLEAN build

We've created a new pf_ruleset.c file for pfctl and no longer use the
kernel vrsion, but the build system doesn't handle this dependency
change correctly. Delete the dependency file if it contains the kernel
version of the file.

(modified from commit c38e59ce1b0a6c030a942d0814d581dbd7f67e3c)
---
 Makefile.inc1 | 9 +
 1 file changed, 9 insertions(+)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 5f7462260240..ca842d182af2 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1001,6 +1001,15 @@ _cleanobj_fast_depend_hack: .PHONY
   ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libomp/.depend.${f}.*}; 
\
fi
 .endfor
+# 20201224 2afa221f694 Stop sharing pf_ruleset.c with the kernel
+.for f in pf_ruleset
+   @if [ -e "${OBJTOP}"/sbin/pfctl/.depend.${f}.o ] && \
+   egrep -qw "sys/netpfil/pf/${f}.c" \
+   "${OBJTOP}"/sbin/pfctl/.depend.${f}.o; then
+   echo "Removing old ${f} dependency file"
+   rm -rf "${OBJTOP}"/sbin/pfctl/.depend.${f}.o
+   fi
+.endfor
 
 _worldtmp: .PHONY
@echo
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 34b94d9ebb2d - stable/12 - pfctl: Stop sharing pf_ruleset.c with the kernel

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=34b94d9ebb2d6cb9e97eade82ea5b8ace28a937d

commit 34b94d9ebb2d6cb9e97eade82ea5b8ace28a937d
Author: Kristof Provost 
AuthorDate: 2020-12-24 15:02:04 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:16:05 +

pfctl: Stop sharing pf_ruleset.c with the kernel

Now that we've split up the datastructures used by the kernel and
userspace there's essentually no more overlap between the pf_ruleset.c
code used by userspace and kernelspace.

Copy the userspace bits to the pfctl directory and stop using the kernel
file.

Reviewed by:philip
MFC after:  2 weeks
Sponsored by:   Orange Business Services
Differential Revision:  https://reviews.freebsd.org/D27764

(cherry picked from commit fda7daf06301beef1bdad39891232a12c6925b22)
---
 sbin/pfctl/Makefile |   3 -
 sbin/pfctl/pf_ruleset.c | 343 
 sys/netpfil/pf/pf_ruleset.c | 285 +---
 3 files changed, 348 insertions(+), 283 deletions(-)

diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile
index 8ca3b5d86285..14dc83eb97b0 100644
--- a/sbin/pfctl/Makefile
+++ b/sbin/pfctl/Makefile
@@ -2,9 +2,6 @@
 
 .include 
 
-# pf_ruleset.c is shared between kernel and pfctl
-.PATH: ${SRCTOP}/sys/netpfil/pf
-
 PACKAGE=pf
 CONFS= pf.os
 PROG=  pfctl
diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c
new file mode 100644
index ..7c337d7a2da7
--- /dev/null
+++ b/sbin/pfctl/pf_ruleset.c
@@ -0,0 +1,343 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2001 Daniel Hartmeier
+ * Copyright (c) 2002,2003 Henning Brauer
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *- Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ *- 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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.
+ *
+ * Effort sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F30602-01-2-0537.
+ *
+ * $OpenBSD: pf_ruleset.c,v 1.2 2008/12/18 15:31:37 dhill Exp $
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#ifdef INET6
+#include 
+#endif /* INET6 */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#define rs_malloc(x)calloc(1, x)
+#define rs_free(x)  free(x)
+
+#ifdef PFDEBUG
+#include 
+#define DPFPRINTF(format, x...)fprintf(stderr, format , ##x)
+#else
+#define DPFPRINTF(format, x...)((void)0)
+#endif /* PFDEBUG */
+
+struct pf_anchor_global pf_anchors;
+struct pf_anchorpf_main_anchor;
+#undef V_pf_anchors
+#define V_pf_anchorspf_anchors
+#undef pf_main_ruleset
+#define pf_main_ruleset pf_main_anchor.ruleset
+
+static __inline intpf_anchor_compare(struct pf_anchor *,
+   struct pf_anchor *);
+static struct pf_anchor*pf_find_anchor(const char *);
+
+RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare);
+RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare);
+
+static __inline int
+pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b)
+{
+   int c = strcmp(a->path, b->path);
+
+   return (c ? (c < 0 ? -1 : 1) : 0);
+}
+
+int
+pf_get_ruleset_number(u_int8_t action)
+{
+   switch (action) {
+   case PF_SCRUB:
+   case PF_NOSCRUB:
+   return (PF_RULESET_SCRUB);
+   break;
+   case PF_PASS:
+   case PF_DROP:
+   return (PF_RULESET_FILTER);

Re: git: bd72252aace3 - main - [mips] revert r366664 - flip mips back from -O2 to -O

2021-01-20 Thread Kyle Evans
On Thu, Jan 14, 2021 at 7:26 AM Mateusz Guzik  wrote:
>
> This breaks tinderbox, for example:
>
> make[5]: "/usr/src/share/mk/sys.mk" line 169: Malformed conditional
> (${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc")
> make[5]: Fatal errors encountered -- cannot continue
> make[5]: stopped in /usr/obj/usr/src/mips.mips64/sys/BERI_NETFPGA_MDROOT
>

Adrian, ping. Tinderbox has been broken from this for nearly a full
week now, and it makes it hard to defend mips when we apparently can't
garner up the energy to fix stuff like this in a timely fashion.

sys.mk is way too early for checking COMPILER_TYPE, we should either
revert back to -O2 or to the previous version entirely by dropping the
COMPILER_TYPE check. freebsd-wifi-build can set CFLAGS to override it,
so it's tempting to say we should just revert this and you can
override CFLAGS in freebsd-wifi-build until you can work out why gcc6
vomits at runtime.

Thanks,

Kyle Evans

> On 1/14/21, Adrian Chadd  wrote:
> > The branch main has been updated by adrian:
> >
> > URL:
> > https://cgit.FreeBSD.org/src/commit/?id=bd72252aace382921840ddbceea712b96f4ad242
> >
> > commit bd72252aace382921840ddbceea712b96f4ad242
> > Author: Adrian Chadd 
> > AuthorDate: 2021-01-12 21:13:20 +
> > Commit: Adrian Chadd 
> > CommitDate: 2021-01-14 07:03:53 +
> >
> > [mips] revert r34 - flip mips back from -O2 to -O
> >
> > Now that I have -head fitting in 8MB of flash again, I can test
> > out freebsd-head on my home AP test setup.  Unfortunately,
> > the introduction of -O2 in r34 causes the following infinite
> > loop shortly after boot:
> >
> > --
> >
> > MAP: No valid partition found at map/rootfs.uzip
> > Warning: no time-of-day clock registered, system time will not be set
> > accurately
> > start_init: trying /sbin/init
> > BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x4042c320 got a read
> > fault (type 0x2) at 0x2e3a0
> > Trapframe Register Dump:
> > zero: 0 at: 0   v0: 0   v1: 0
> > a0: 0x1af34 a1: 0   a2: 0   a3: 0x7fffeff0
> > t0: 0   t1: 0   t2: 0   t3: 0
> > t4: 0   t5: 0   t6: 0   t7: 0
> > t8: 0   t9: 0x152e8 s0: 0x7fffee84  s1: 0
> > s2: 0   s3: 0   s4: 0   s5: 0
> > s6: 0   s7: 0   k0: 0   k1: 0
> > gp: 0x362c0 sp: 0x7fffedf0  s8: 0   ra: 0x40417df0
> > sr: 0xf413  mullo: 0mulhi: 0badvaddr:
> > 0x2e3a0
> > cause: 0x8008   pc: 0x4042c31c
> > Page table info for pc address 0x4042c320: pde = 0x80712000, pte =
> > 0xa002065a
> > Dumping 4 words starting at pc address 0x4042c320:
> > 8f9980e0 8082 10400067 00809825
> > Page table info for bad address 0x2e3a0: pde = 0, pte = 0
> >
> > --
> >
> > I'm not yet sure why, but until I figure it out with the mips64/cheri
> > folk this should be reverted.
> >
> > This should only use -O on GCC generated code for MIPS platforms.
> >
> > Tested:
> >
> > * QCA934x (mips74k) - WDR-3600/WDR-4300 APs
> >
> > Differential Revision: https://reviews.freebsd.org/D28122
> > ---
> >  share/mk/sys.mk | 7 +++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/share/mk/sys.mk b/share/mk/sys.mk
> > index 8f456b28593a..72f458397683 100644
> > --- a/share/mk/sys.mk
> > +++ b/share/mk/sys.mk
> > @@ -166,7 +166,14 @@ CC   ?=  c89
> >  CFLAGS   ?=  -O
> >  .else
> >  CC   ?=  cc
> > +.if ${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc"
> > +# Note: there are currently issues generating code gcc-6.x targeting
> > +# code for at least mips32.  The system hits infinite page faults
> > +# when starting /sbin/init if -O2 is used.
> > +CFLAGS   ?=  -O -pipe
> > +.else
> >  CFLAGS   ?=  -O2 -pipe
> > +.endif
> >  .if defined(NO_STRICT_ALIASING)
> >  CFLAGS   +=  -fno-strict-aliasing
> >  .endif
> > ___
> > dev-commits-src-all@freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
> > To unsubscribe, send any mail to
> > "dev-commits-src-all-unsubscr...@freebsd.org"
> >
>
>
> --
> Mateusz Guzik 
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: d70886d06316 - main - wpa_supplicant uses PF_ROUTE to return the routing table in order to determine the length of the routing table buffer. As of 81728a538d24 wpa_supplicant is started before th

2021-01-20 Thread Cy Schubert
The branch main has been updated by cy:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d70886d063166786ded0007af8cdcbf57b7b4827

commit d70886d063166786ded0007af8cdcbf57b7b4827
Author: Cy Schubert 
AuthorDate: 2021-01-20 15:20:22 +
Commit: Cy Schubert 
CommitDate: 2021-01-20 15:45:18 +

wpa_supplicant uses PF_ROUTE to return the routing table in order to
determine the length of the routing table buffer. As of 81728a538d24
wpa_supplicant is started before the routing table has been populated
resulting in the length of zero to be returned. This causes
wpa_supplicant to loop endlessly. (The workaround is to kill and restart
wpa_supplicant as by the time it is restarted the routing table is
populated.)

(Personally, I was not able to reproduce this unless wlan0 was a member of
lagg0. However, others experienced this problem on standalone wlan0.)

PR: 252844
Submitted by:   shu 
Reported by:shu 
Reviewed by:cy
X-MFC with: 81728a538d24f483d0986850fa3f51d5d84d8f26
Differential Revision:  https://reviews.freebsd.org/D28249
---
 contrib/wpa/src/drivers/driver_bsd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/wpa/src/drivers/driver_bsd.c 
b/contrib/wpa/src/drivers/driver_bsd.c
index f99122e477c1..96cf066a7a46 100644
--- a/contrib/wpa/src/drivers/driver_bsd.c
+++ b/contrib/wpa/src/drivers/driver_bsd.c
@@ -648,7 +648,7 @@ rtbuf_len(void)
len = 2048;
}
 
-   return len;
+   return (len == 0) ? 2048 : len;
 }
 
 #ifdef HOSTAPD
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: b84d0aaa4e64 - main - ifconfig: add vlanproto "qiniq" as an alias for "802.1ad"

2021-01-20 Thread Allan Jude
The branch main has been updated by allanjude:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b84d0aaa4e64fb95b105d0d38f6295fec7a82110

commit b84d0aaa4e64fb95b105d0d38f6295fec7a82110
Author: Allan Jude 
AuthorDate: 2021-01-19 23:22:07 +
Commit: Allan Jude 
CommitDate: 2021-01-20 15:50:45 +

ifconfig: add vlanproto "qiniq" as an alias for "802.1ad"

QinQ is better known by this name, so accept it as an alias

Reported-by:Mike Geiger
Reviewed-by:melifaro, hselasky, rpokala
MFC-with:   366917
Sponsored-by:   Klara Inc.
Differential-Revision:  https://reviews.freebsd.org/D28245
---
 sbin/ifconfig/ifconfig.8 | 5 +
 sbin/ifconfig/ifvlan.c   | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index c1ffb6a82ccc..bbaaa00d419b 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -2706,6 +2706,11 @@ and
 .Dq 802.1ad .
 The default encapsulation protocol is
 .Dq 802.1Q .
+The
+.Dq 802.1ad
+protocol is also commonly known as
+.Dq QinQ ;
+either name can be used.
 .It Cm vlanpcp Ar priority_code_point
 Priority code point
 .Pq Dv PCP
diff --git a/sbin/ifconfig/ifvlan.c b/sbin/ifconfig/ifvlan.c
index f316b0404459..60f97338ee27 100644
--- a/sbin/ifconfig/ifvlan.c
+++ b/sbin/ifconfig/ifvlan.c
@@ -68,6 +68,7 @@ static const char rcsid[] =
 
 static const char proto_8021Q[]  = "802.1q";
 static const char proto_8021ad[] = "802.1ad";
+static const char proto_qinq[] = "qinq";
 
 static struct vlanreq params = {
.vlr_tag= NOTAG,
@@ -220,8 +221,8 @@ DECL_CMD_FUNC(setvlanproto, val, d)
if (strncasecmp(proto_8021Q, val,
strlen(proto_8021Q)) == 0) {
params.vlr_proto = ETHERTYPE_VLAN;
-   } else if (strncasecmp(proto_8021ad, val,
-  strlen(proto_8021ad)) == 0) {
+   } else if ((strncasecmp(proto_8021ad, val, strlen(proto_8021ad)) == 0)
+   || (strncasecmp(proto_qinq, val, strlen(proto_qinq)) == 0)) {
params.vlr_proto = ETHERTYPE_QINQ;
} else
errx(1, "invalid value for vlanproto");
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 2247f4894174 - main - aio: micro-optimize the lio_opcode assignments

2021-01-20 Thread Alan Somers
The branch main has been updated by asomers:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2247f48941743cab420394b5ff0fc65ec8c69a99

commit 2247f48941743cab420394b5ff0fc65ec8c69a99
Author: Alan Somers 
AuthorDate: 2021-01-03 04:25:05 +
Commit: Alan Somers 
CommitDate: 2021-01-20 16:02:25 +

aio: micro-optimize the lio_opcode assignments

This allows slightly more efficient opcode testing in-kernel.  It is
transparent to userland, except to applications that sneakily submit
aio fsync or aio mlock operations via lio_listio, which has never been
documented, requires the use of deliberately undefined constants
(LIO_SYNC and LIO_MLOCK), and is arguably a bug.

Reviewed by:jhb
Differential Revision:  https://reviews.freebsd.org/D27942
---
 sys/kern/sys_socket.c |  8 +++-
 sys/kern/vfs_aio.c| 48 ++--
 sys/sys/aio.h | 11 ++-
 3 files changed, 23 insertions(+), 44 deletions(-)

diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 18803b6a5ac0..e53b0367960b 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -775,10 +775,10 @@ soo_aio_cancel(struct kaiocb *job)
 
so = job->fd_file->f_data;
opcode = job->uaiocb.aio_lio_opcode;
-   if (opcode == LIO_READ || opcode == LIO_READV)
+   if (opcode & LIO_READ)
sb = &so->so_rcv;
else {
-   MPASS(opcode == LIO_WRITE || opcode == LIO_WRITEV);
+   MPASS(opcode & LIO_WRITE);
sb = &so->so_snd;
}
 
@@ -808,13 +808,11 @@ soo_aio_queue(struct file *fp, struct kaiocb *job)
if (error == 0)
return (0);
 
-   switch (job->uaiocb.aio_lio_opcode) {
+   switch (job->uaiocb.aio_lio_opcode & (LIO_WRITE | LIO_READ)) {
case LIO_READ:
-   case LIO_READV:
sb = &so->so_rcv;
break;
case LIO_WRITE:
-   case LIO_WRITEV:
sb = &so->so_snd;
break;
default:
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index bc0d7e04c9d5..9b45a06c5f9f 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -817,8 +817,7 @@ aio_process_rw(struct kaiocb *job)
if (error != 0 && job->uiop->uio_resid != cnt) {
if (error == ERESTART || error == EINTR || error == EWOULDBLOCK)
error = 0;
-   if (error == EPIPE &&
-   (opcode == LIO_WRITE || opcode == LIO_WRITEV)) {
+   if (error == EPIPE && (opcode & LIO_WRITE)) {
PROC_LOCK(job->userproc);
kern_psignal(job->userproc, SIGPIPE);
PROC_UNLOCK(job->userproc);
@@ -841,8 +840,7 @@ aio_process_sync(struct kaiocb *job)
struct file *fp = job->fd_file;
int error = 0;
 
-   KASSERT(job->uaiocb.aio_lio_opcode == LIO_SYNC ||
-   job->uaiocb.aio_lio_opcode == LIO_DSYNC,
+   KASSERT(job->uaiocb.aio_lio_opcode & LIO_SYNC,
("%s: opcode %d", __func__, job->uaiocb.aio_lio_opcode));
 
td->td_ucred = job->cred;
@@ -1239,8 +1237,7 @@ aio_qbio(struct proc *p, struct kaiocb *job)
if (vp->v_bufobj.bo_bsize == 0)
return (-1);
 
-   bio_cmd = opcode == LIO_WRITE || opcode == LIO_WRITEV ? BIO_WRITE :
-   BIO_READ;
+   bio_cmd = (opcode & LIO_WRITE) ? BIO_WRITE : BIO_READ;
iovcnt = job->uiop->uio_iovcnt;
if (iovcnt > max_buf_aio)
return (-1);
@@ -1422,7 +1419,7 @@ aiocb_copyin(struct aiocb *ujob, struct kaiocb *kjob, int 
type)
error = copyin(ujob, kcb, sizeof(struct aiocb));
if (error)
return (error);
-   if (type == LIO_READV || type == LIO_WRITEV) {
+   if (type & LIO_VECTORED) {
/* malloc a uio and copy in the iovec */
error = copyinuio(__DEVOLATILE(struct iovec*, kcb->aio_iov),
kcb->aio_iovcnt, &kjob->uiop);
@@ -1609,7 +1606,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct 
aioliojob *lj,
if (error)
goto err3;
 
-   if ((opcode == LIO_SYNC || opcode == LIO_DSYNC) && fp->f_vnode == NULL) 
{
+   if ((opcode & LIO_SYNC) && fp->f_vnode == NULL) {
error = EINVAL;
goto err3;
}
@@ -1669,14 +1666,10 @@ no_kqueue:
job->jobflags = KAIOCB_QUEUEING;
job->lio = lj;
 
-   switch (opcode) {
-   case LIO_READV:
-   case LIO_WRITEV:
+   if (opcode & LIO_VECTORED) {
/* Use the uio copied in by aio_copyin */
MPASS(job->uiop != &job->uio && job->uiop != NULL);
-   break;
-   case LIO_READ:
-   case LIO_WRITE:
+   } else {
/* Setup the inline uio */
job->iov[0].iov_base = (void *)(uintptr_t)job->uaiocb.aio_buf;
job->iov[0].iov_len = job->uaiocb.aio_nbytes

git: c325366474d9 - stable/12 - pf: Don't hold PF_RULES_WLOCK during copyin() on DIOCRCLRTSTATS

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c325366474d9bb82f84c20f521b638a7166d

commit c325366474d9bb82f84c20f521b638a7166d
Author: Kristof Provost 
AuthorDate: 2021-01-13 18:30:01 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:45:52 +

pf: Don't hold PF_RULES_WLOCK during copyin() on DIOCRCLRTSTATS

We cannot hold a non-sleepable lock during copyin(). This means we can't
safely count the table, so instead we fall back to the pf_ioctl_maxcount
used in other ioctls to protect against overly large requests.

Reported by:syzbot+81e380344d4a6c37d...@syzkaller.appspotmail.com
MFC after:  1 week

(cherry picked from commit ea36212bf5711206bbaf5362a23ebb52c7f7e2a4)
---
 sys/netpfil/pf/pf_ioctl.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index 866c4ebfaa3d..48f68fa249e2 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -3368,36 +3368,35 @@ DIOCCHANGEADDR_error:
struct pfioc_table *io = (struct pfioc_table *)addr;
struct pfr_table *pfrts;
size_t totlen;
-   int n;
 
if (io->pfrio_esize != sizeof(struct pfr_table)) {
error = ENODEV;
break;
}
 
-   PF_RULES_WLOCK();
-   n = pfr_table_count(&io->pfrio_table, io->pfrio_flags);
-   if (n < 0) {
-   PF_RULES_WUNLOCK();
-   error = EINVAL;
+   if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) {
+   /* We used to count tables and use the minimum required
+* size, so we didn't fail on overly large requests.
+* Keep doing so. */
+   io->pfrio_size = pf_ioctl_maxcount;
break;
}
-   io->pfrio_size = min(io->pfrio_size, n);
 
totlen = io->pfrio_size * sizeof(struct pfr_table);
pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
M_TEMP, M_NOWAIT);
if (pfrts == NULL) {
error = ENOMEM;
-   PF_RULES_WUNLOCK();
break;
}
error = copyin(io->pfrio_buffer, pfrts, totlen);
if (error) {
free(pfrts, M_TEMP);
-   PF_RULES_WUNLOCK();
break;
}
+
+   PF_RULES_WLOCK();
error = pfr_clr_tstats(pfrts, io->pfrio_size,
&io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL);
PF_RULES_WUNLOCK();
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 2cc2177bca0e - stable/12 - pf tests: pass NULL buffer to DIOCRCLRTSTATS

2021-01-20 Thread Kristof Provost
The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2cc2177bca0eb84a268c9ce36427537dc3c76822

commit 2cc2177bca0eb84a268c9ce36427537dc3c76822
Author: Kristof Provost 
AuthorDate: 2021-01-13 18:41:07 +
Commit: Kristof Provost 
CommitDate: 2021-01-20 14:46:00 +

pf tests: pass NULL buffer to DIOCRCLRTSTATS

As discovered by syzcaller this used to provoke panics.

MFC after:  1 week

(cherry picked from commit 44117554b1ee8edd66d7383c17802d5799fd18f2)
---
 tests/sys/netpfil/pf/ioctl/validation.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tests/sys/netpfil/pf/ioctl/validation.c 
b/tests/sys/netpfil/pf/ioctl/validation.c
index 5b1f61720f66..0d7f7631e91b 100644
--- a/tests/sys/netpfil/pf/ioctl/validation.c
+++ b/tests/sys/netpfil/pf/ioctl/validation.c
@@ -265,6 +265,11 @@ ATF_TC_BODY(clrtstats, tc)
io.pfrio_size = 1 << 24;
if (ioctl(dev, DIOCRCLRTSTATS, &io) != 0)
atf_tc_fail("Request with size 1 << 24 failed");
+
+   io.pfrio_size = sizeof(tbl);
+   io.pfrio_buffer = NULL;
+   if (ioctl(dev, DIOCRCLRTSTATS, &io) == 0)
+   atf_tc_fail("Request with NULL buffer succeeded");
 }
 
 ATF_TC_CLEANUP(clrtstats, tc)
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 5b0914aea27c - main - release: fix PORT variable

2021-01-20 Thread Glen Barber
The branch main has been updated by gjb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5b0914aea27c8227b7d1f42d8a504f048cc3d2ec

commit 5b0914aea27c8227b7d1f42d8a504f048cc3d2ec
Author: Glen Barber 
AuthorDate: 2021-01-20 17:15:13 +
Commit: Glen Barber 
CommitDate: 2021-01-20 17:15:13 +

release: fix PORT variable

Reported by:Yasuhiro Kimura (yasu xat utahime dot org)
Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 release/release.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/release/release.sh b/release/release.sh
index 60034f123490..fbd64bb8234d 100755
--- a/release/release.sh
+++ b/release/release.sh
@@ -147,7 +147,7 @@ env_check() {
SRC="${GITROOT}${GITSRC}"
DOC="${GITROOT}${GITDOC}"
#PORT="${GITROOT}${GITPORTS}"
-   PORT="svn://svn.freebsd.org/ports/${PORTBRANCH}"
+   PORT="svn://svn.freebsd.org/ports/"
 
if [ -n "${EMBEDDEDBUILD}" ]; then
WITH_DVD=
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


Re: git: 041b28524a3c - main - release: Add workaround to use SVN for ports

2021-01-20 Thread Glen Barber
On Wed, Jan 20, 2021 at 07:46:46PM +0900, Yasuhiro Kimura wrote:
> From: Yasuhiro Kimura 
> Subject: Re: git: 041b28524a3c - main - release: Add workaround to use SVN 
> for ports
> Date: Wed, 20 Jan 2021 17:29:33 +0900 (JST)
> 
> > From: Glen Barber 
> > Subject: git: 041b28524a3c - main - release: Add workaround to use SVN for 
> > ports
> > Date: Tue, 19 Jan 2021 18:38:50 GMT
> > 
> >> The branch main has been updated by gjb:
> >> 
> >> URL: 
> >> https://cgit.FreeBSD.org/src/commit/?id=041b28524a3c69ff6e893067df156c3faabcac9a
> >> 
> >> commit 041b28524a3c69ff6e893067df156c3faabcac9a
> >> Author: Glen Barber 
> >> AuthorDate: 2021-01-19 18:38:33 +
> >> Commit: Glen Barber 
> >> CommitDate: 2021-01-19 18:38:33 +
> >> 
> >> release: Add workaround to use SVN for ports
> >> 
> >> The ports tree is scheduled to be converted from Subversion to Git
> >> after the currently-scheduled 13.0-RELEASE, so the source of truth
> >> will be Subversion for the ports tree.
> >> 
> >> Implement a hack specifically for this case.
> > 
> > This change results in accessing 'svn://svn.freebsd.org/ports/head/head'
> > and failing to check out ports tree.
> 
> Following patch fixes the problem.
> 
> diff --git a/release/release.sh b/release/release.sh
> index 60034f12349..fbd64bb8234 100755
> --- a/release/release.sh
> +++ b/release/release.sh
> @@ -147,7 +147,7 @@ env_check() {
>   SRC="${GITROOT}${GITSRC}"
>   DOC="${GITROOT}${GITDOC}"
>   #PORT="${GITROOT}${GITPORTS}"
> - PORT="svn://svn.freebsd.org/ports/${PORTBRANCH}"
> + PORT="svn://svn.freebsd.org/ports/"
>  
>   if [ -n "${EMBEDDEDBUILD}" ]; then
>   WITH_DVD=
> 

Thank you very much.  Committed as 5b0914aea27.

Sorry for the breakage.

Glen



signature.asc
Description: PGP signature


git: 0614d7396798 - main - cat: style nits

2021-01-20 Thread Mariusz Zaborski
The branch main has been updated by oshogbo:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0614d7396798a268bd9efb103dffdeb0ad4a066c

commit 0614d7396798a268bd9efb103dffdeb0ad4a066c
Author: Mariusz Zaborski 
AuthorDate: 2021-01-20 17:46:26 +
Commit: Mariusz Zaborski 
CommitDate: 2021-01-20 17:46:26 +

cat: style nits

Pointed out by: jhb
---
 bin/cat/cat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/cat/cat.c b/bin/cat/cat.c
index 764c97c7ad43..5a1fab0c26a0 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -428,7 +428,7 @@ udom_open(const char *path, int flags)
 {
struct addrinfo hints, *res, *res0;
char rpath[PATH_MAX];
-   int fd, error, serrno;
+   int error, fd, serrno;
cap_rights_t rights;
 
/*
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support

2021-01-20 Thread Gordon Bergling
On Tue, Jan 05, 2021 at 01:02:04PM +, Baptiste Daroussin wrote:
> The branch main has been updated by bapt:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07
> 
> commit 821aa63a09402935da0a73abf20ba0441562aa07
> Author: Baptiste Daroussin 
> AuthorDate: 2021-01-04 16:29:40 +
> Commit: Baptiste Daroussin 
> CommitDate: 2021-01-05 13:01:32 +
> 
> ncurses: only keep the version with widechar support
> 
> Only keep the widechar version of ncurses as libncursesw.so.9
> 
> Keep the old name to avoid breaking the ABI compatibility (the non
> widechar version libncurses.so.9 is not binary compatible with
> libncursesw.so.9) since all ports and base are already only linking
> against the widechar version we can simply remove libncurses.so.9
> 
> Since the .9 version only lived in the dev branch and never ended in a
> release, it is simply removed and not added to any binary compat
> package.
> 
> Add symlinks to keep build time compatibility for anyone linking against
> -lncurses

Hi Baptiste,

thanks for the cleanup. It would be nice if you could send a HEADS UP to 
current@
before such changes. This change rendered my login shell on arm64 useless and it
took me about 8 hours on a saturday to get the shell working againg, by using a
FreeBSD livesystem, booted on my MacBook, while hurderling with pwd_mkdb(8).

--Gordon
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: f6f0b849fb26 - main - Reuse the amd64 loader relocation code on arm64

2021-01-20 Thread Andrew Turner
The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f6f0b849fb2683feebf2416a793964be0bd05cc5

commit f6f0b849fb2683feebf2416a793964be0bd05cc5
Author: Andrew Turner 
AuthorDate: 2021-01-17 18:11:11 +
Commit: Andrew Turner 
CommitDate: 2021-01-20 17:59:38 +

Reuse the amd64 loader relocation code on arm64

There is no need to keep multiple copies of the relocation code. The
amd64 code works on arm64 with a few small changes to relocation types.

Sponsored by:   Innovate UK
Differential Revision:  https://reviews.freebsd.org/D28213
---
 stand/common/reloc_elf.c | 35 ++-
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/stand/common/reloc_elf.c b/stand/common/reloc_elf.c
index 56b661dc21bd..262091b9f6c6 100644
--- a/stand/common/reloc_elf.c
+++ b/stand/common/reloc_elf.c
@@ -52,7 +52,8 @@ int
 __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
 int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len)
 {
-#if (defined(__i386__) || defined(__amd64__)) && __ELF_WORD_SIZE == 64
+#if (defined(__aarch64__) || defined(__amd64__) || defined(__i386__)) && \
+__ELF_WORD_SIZE == 64
Elf64_Addr *where, val;
Elf_Addr addend, addr;
Elf_Size rtype, symidx;
@@ -87,12 +88,29 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, 
const void *reldata,
if (reltype == ELF_RELOC_REL)
addend = *where;
 
+#if defined(__aarch64__)
+#defineRELOC_RELATIVE  R_AARCH64_RELATIVE
+#defineRELOC_IRELATIVE R_AARCH64_IRELATIVE
+#elif defined(__amd64__) || defined(__i386__)
 /* XXX, definitions not available on i386. */
 #defineR_X86_64_64 1
 #defineR_X86_64_RELATIVE   8
 #defineR_X86_64_IRELATIVE  37
 
+#defineRELOC_RELATIVE  R_X86_64_RELATIVE
+#defineRELOC_IRELATIVE R_X86_64_IRELATIVE
+#endif
+
switch (rtype) {
+   case RELOC_RELATIVE:
+   addr = (Elf_Addr)addend + relbase;
+   val = addr;
+   memcpy(where, &val, sizeof(val));
+   break;
+   case RELOC_IRELATIVE:
+   /* leave it to kernel */
+   break;
+#if defined(__amd64__) || defined(__i386__)
case R_X86_64_64:   /* S + A */
addr = symaddr(ef, symidx);
if (addr == 0)
@@ -100,14 +118,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, 
const void *reldata,
val = addr + addend;
*where = val;
break;
-   case R_X86_64_RELATIVE:
-   addr = (Elf_Addr)addend + relbase;
-   val = addr;
-   *where = val;
-   break;
-   case R_X86_64_IRELATIVE:
-   /* leave it to kernel */
-   break;
+#endif
default:
printf("\nunhandled relocation type %u\n", (u_int)rtype);
return (EFTYPE);
@@ -175,7 +186,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, 
const void *reldata,
}
 
return (0);
-#elif defined(__aarch64__) || defined(__powerpc__) || defined(__riscv)
+#elif defined(__powerpc__) || defined(__riscv)
Elf_Size w;
const Elf_Rela *rela;
 
@@ -185,9 +196,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, 
const void *reldata,
if (relbase + rela->r_offset >= dataaddr &&
relbase + rela->r_offset < dataaddr + len) {
switch (ELF_R_TYPE(rela->r_info)) {
-#if defined(__aarch64__)
-   case R_AARCH64_RELATIVE:
-#elif defined(__powerpc__)
+#if defined(__powerpc__)
case R_PPC_RELATIVE:
 #elif defined(__riscv)
case R_RISCV_RELATIVE:
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 8e67b9389df1 - main - Handle arm64 undefied instructions on msr exceptions

2021-01-20 Thread Andrew Turner
The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8e67b9389df12d36ef4bc6bf2a7f2e60e3bcd94a

commit 8e67b9389df12d36ef4bc6bf2a7f2e60e3bcd94a
Author: Andrew Turner 
AuthorDate: 2021-01-20 09:56:47 +
Commit: Andrew Turner 
CommitDate: 2021-01-20 17:59:38 +

Handle arm64 undefied instructions on msr exceptions

When userspace tries to access a special register that it doesn't have
access to the kernel receives an exception. On most cores this exception
has been observed to be the undefined instruction exception, however on
the Apple M1 under a QEMU based hypervisor it can be the MSR exception.

Handle this second case by also running the undefined exception handler
on these exceptions.

Sponsored by:   Innovate UK
---
 sys/arm64/arm64/trap.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c
index 12d10ff1d261..0b2d4760cea3 100644
--- a/sys/arm64/arm64/trap.c
+++ b/sys/arm64/arm64/trap.c
@@ -535,8 +535,14 @@ do_el0_sync(struct thread *td, struct trapframe *frame)
userret(td, frame);
break;
case EXCP_MSR:
-   call_trapsignal(td, SIGILL, ILL_PRVOPC, (void *)frame->tf_elr,
-   exception);
+   /*
+* The CPU can raise EXCP_MSR when userspace executes an mrs
+* instruction to access a special register userspace doesn't
+* have access to.
+*/
+   if (!undef_insn(0, frame))
+   call_trapsignal(td, SIGILL, ILL_PRVOPC,
+   (void *)frame->tf_elr, exception);
userret(td, frame);
break;
case EXCP_SOFTSTP_EL0:
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: fa656aefe43b - main - hconf(4): Do not fetch report before writing new usage values back.

2021-01-20 Thread Vladimir Kondratyev
The branch main has been updated by wulf:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fa656aefe43b91a06191d4a99e11876998a50c46

commit fa656aefe43b91a06191d4a99e11876998a50c46
Author: Vladimir Kondratyev 
AuthorDate: 2021-01-20 20:10:06 +
Commit: Vladimir Kondratyev 
CommitDate: 2021-01-20 20:10:06 +

hconf(4): Do not fetch report before writing new usage values back.

There is a report that reading of surface/button switch feature report
causes SYN1B7D touchpad malfunction.  As specs does not require it to
be readable assume that report usages have default value on attach and
last written value during operation. Do not apply default usage values
on attachment and resume.
While here fix manpage typos and add avg@ to copyright header.

Reported by:Jakob Alvermark 
Reviewed by:avg
Differential revision:  https://reviews.freebsd.org/D28196
---
 share/man/man4/hconf.4 |  8 +++
 sys/dev/hid/hconf.c| 57 --
 2 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/share/man/man4/hconf.4 b/share/man/man4/hconf.4
index 4d595e9f1c6c..944f3376b187 100644
--- a/share/man/man4/hconf.4
+++ b/share/man/man4/hconf.4
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 14, 2020
+.Dd January 18, 2021
 .Dt HCONF 4
 .Os
 .Sh NAME
@@ -61,11 +61,11 @@ Debug parameter is available as
 .Xr loader 8
 tunable as well.
 .Bl -tag -width indent
-.It Va dev.hmt.*.input_mode
+.It Va dev.hconf.*.input_mode
 HID device input mode: 0 = mouse, 3 = touchpad.
-.It Va dev.hmt.*.surface_switch
+.It Va dev.hconf.*.surface_switch
 Enable / disable switch for surface: 1 = on, 0 = off.
-.It Va dev.hmt.*.buttons_switch
+.It Va dev.hconf.*.buttons_switch
 Enable / disable switch for buttons: 1 = on, 0 = off.
 .It Va hw.hid.hconf.debug
 Debug output level, where 0 is debugging disabled and larger values increase
diff --git a/sys/dev/hid/hconf.c b/sys/dev/hid/hconf.c
index 71650421ee33..cb0465e71b3e 100644
--- a/sys/dev/hid/hconf.c
+++ b/sys/dev/hid/hconf.c
@@ -2,6 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2019 Vladimir Kondratyev 
+ * Copyright (c) 2020 Andriy Gapon 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -69,21 +70,25 @@ struct feature_control_descr {
const char  *name;
const char  *descr;
uint16_tusage;
+   u_int   value;
 } feature_control_descrs[] = {
[INPUT_MODE] = {
.name = "input_mode",
.descr = "HID device input mode: 0 = mouse, 3 = touchpad",
-   .usage = HUD_INPUT_MODE
+   .usage = HUD_INPUT_MODE,
+   .value = HCONF_INPUT_MODE_MOUSE,
},
[SURFACE_SWITCH] = {
.name = "surface_switch",
.descr = "Enable / disable switch for surface: 1 = on, 0 = off",
-   .usage = HUD_SURFACE_SWITCH
+   .usage = HUD_SURFACE_SWITCH,
+   .value = 1,
},
[BUTTONS_SWITCH] = {
.name = "buttons_switch",
.descr = "Enable / disable switch for buttons: 1 = on, 0 = off",
-   .usage = HUD_BUTTONS_SWITCH
+   .usage = HUD_BUTTONS_SWITCH,
+   .value = 1,
},
 };
 
@@ -145,35 +150,25 @@ hconf_set_feature_control(struct hconf_softc *sc, int 
ctrl_id, u_int val)
fbuf = malloc(fc->rlen, M_TEMP, M_WAITOK | M_ZERO);
sx_xlock(&sc->lock);
 
-   /* Reports are not strictly required to be readable */
-   error = hid_get_report(sc->dev, fbuf, fc->rlen, NULL,
-   HID_FEATURE_REPORT, fc->rid);
-
/*
-* If the report is write-only, then we have to check for other controls
-* that may share the same report and set their bits as well.
+* Assume the report is write-only. Then we have to check for other
+* controls that may share the same report and set their bits as well.
 */
-   if (error != 0) {
-   bzero(fbuf + 1, fc->rlen - 1);
-   for (i = 0; i < nitems(sc->feature_controls); i++) {
-   struct feature_control *ofc = &sc->feature_controls[i];
-
-   /* Skip unrelated report IDs. */
-   if (ofc->rid != fc->rid)
-   continue;
-   /* Skip self. */
-   if (ofc == fc)
-   continue;
-   KASSERT(fc->rlen == ofc->rlen,
-   ("different lengths for report %d: %d vs %d\n",
-   fc->rid, fc->rlen, ofc->rlen));
-   hid_put_udata(fbuf + 1, ofc->rlen - 1, &ofc->loc,
-   ofc->val);
-   }
+   bzero(fbuf + 1, fc->rlen - 1);
+   for (i = 0;

git: 5cc21ab9949a - main - hmt: Allow I2C sampling mode support to be compiled out.

2021-01-20 Thread Vladimir Kondratyev
The branch main has been updated by wulf:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5cc21ab9949a189c809285823dbb6eadde6c6864

commit 5cc21ab9949a189c809285823dbb6eadde6c6864
Author: Vladimir Kondratyev 
AuthorDate: 2021-01-20 20:10:07 +
Commit: Vladimir Kondratyev 
CommitDate: 2021-01-20 20:10:07 +

hmt: Allow I2C sampling mode support to be compiled out.
---
 sys/dev/hid/hmt.c| 10 ++
 sys/modules/hid/hmt/Makefile |  1 +
 2 files changed, 11 insertions(+)

diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c
index 6cfe43157e64..fd50ea4de829 100644
--- a/sys/dev/hid/hmt.c
+++ b/sys/dev/hid/hmt.c
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
  * https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt
  */
 
+#include "opt_hid.h"
+
 #include 
 #include 
 #include 
@@ -207,7 +209,9 @@ struct hmt_softc {
boolhas_int_button;
boolis_clickpad;
booldo_timestamps;
+#ifdef IICHID_SAMPLING
booliichid_sampling;
+#endif
 
struct hid_location cont_max_loc;
uint32_tcont_max_rlen;
@@ -372,8 +376,10 @@ hmt_attach(device_t dev)
 
if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps)
sc->do_timestamps = true;
+#ifdef IICHID_SAMPLING
if (hid_test_quirk(hw, HQ_IICHID_SAMPLING))
sc->iichid_sampling = true;
+#endif
 
hidbus_set_intr(dev, hmt_intr, sc);
 
@@ -404,8 +410,10 @@ hmt_attach(device_t dev)
evdev_support_event(sc->evdev, EV_MSC);
evdev_support_msc(sc->evdev, MSC_TIMESTAMP);
}
+#ifdef IICHID_SAMPLING
if (sc->iichid_sampling)
evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_AUTOREL);
+#endif
nbuttons = 0;
if (sc->max_button != 0 || sc->has_int_button) {
evdev_support_event(sc->evdev, EV_KEY);
@@ -476,6 +484,7 @@ hmt_intr(void *context, void *buf, hid_size_t len)
int32_t delta;
uint8_t id;
 
+#ifdef IICHID_SAMPLING
/*
 * Special packet of zero length is generated by iichid driver running
 * in polling mode at the start of inactivity period to workaround
@@ -492,6 +501,7 @@ hmt_intr(void *context, void *buf, hid_size_t len)
evdev_sync(sc->evdev);
return;
}
+#endif
 
/* Ignore irrelevant reports */
id = sc->report_id != 0 ? *(uint8_t *)buf : 0;
diff --git a/sys/modules/hid/hmt/Makefile b/sys/modules/hid/hmt/Makefile
index f6bed08d439d..975c94fa0b88 100644
--- a/sys/modules/hid/hmt/Makefile
+++ b/sys/modules/hid/hmt/Makefile
@@ -4,6 +4,7 @@
 
 KMOD=  hmt
 SRCS=  hmt.c
+SRCS+= opt_hid.h
 SRCS+= bus_if.h device_if.h
 
 .include 
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 7a810290b8f6 - main - evdev: Make variable-size ioctls return actual length of copyouted data

2021-01-20 Thread Vladimir Kondratyev
The branch main has been updated by wulf:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7a810290b8f6c6885fdb9917cf590d46fa270a61

commit 7a810290b8f6c6885fdb9917cf590d46fa270a61
Author: Vladimir Kondratyev 
AuthorDate: 2021-01-20 20:10:07 +
Commit: Vladimir Kondratyev 
CommitDate: 2021-01-20 20:10:07 +

evdev: Make variable-size ioctls return actual length of copyouted data

on success instead of 0 to match Linux.
Imprivata binary depends on this.

Submitted by:   Shunchao Hu 
Reviewed by:wulf
Differential revision:  https://reviews.freebsd.org/D28218
---
 sys/dev/evdev/cdev.c | 29 +++--
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c
index 91536c119fb4..66d00ad16aee 100644
--- a/sys/dev/evdev/cdev.c
+++ b/sys/dev/evdev/cdev.c
@@ -78,7 +78,8 @@ static d_kqfilter_t   evdev_kqfilter;
 static int evdev_kqread(struct knote *kn, long hint);
 static void evdev_kqdetach(struct knote *kn);
 static void evdev_dtor(void *);
-static int evdev_ioctl_eviocgbit(struct evdev_dev *, int, int, caddr_t);
+static int evdev_ioctl_eviocgbit(struct evdev_dev *, int, int, caddr_t,
+struct thread *);
 static void evdev_client_filter_queue(struct evdev_client *, uint16_t);
 
 static struct cdevsw evdev_cdevsw = {
@@ -576,29 +577,38 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, 
int fflag,
/* evdev variable-length ioctls handling */
switch (IOCBASECMD(cmd)) {
case EVIOCGNAME(0):
-   strlcpy(data, evdev->ev_name, len);
+   /* Linux evdev does not terminate truncated strings with 0 */
+   limit = MIN(strlen(evdev->ev_name) + 1, len);
+   memcpy(data, evdev->ev_name, limit);
+   td->td_retval[0] = limit;
return (0);
 
case EVIOCGPHYS(0):
if (evdev->ev_shortname[0] == 0)
return (ENOENT);
 
-   strlcpy(data, evdev->ev_shortname, len);
+   limit = MIN(strlen(evdev->ev_shortname) + 1, len);
+   memcpy(data, evdev->ev_shortname, limit);
+   td->td_retval[0] = limit;
return (0);
 
case EVIOCGUNIQ(0):
if (evdev->ev_serial[0] == 0)
return (ENOENT);
 
-   strlcpy(data, evdev->ev_serial, len);
+   limit = MIN(strlen(evdev->ev_serial) + 1, len);
+   memcpy(data, evdev->ev_serial, limit);
+   td->td_retval[0] = limit;
return (0);
 
case EVIOCGPROP(0):
limit = MIN(len, bitstr_size(INPUT_PROP_CNT));
memcpy(data, evdev->ev_prop_flags, limit);
+   td->td_retval[0] = limit;
return (0);
 
case EVIOCGMTSLOTS(0):
+   /* EVIOCGMTSLOTS always returns 0 on success */
if (evdev->ev_mt == NULL)
return (EINVAL);
if (len < sizeof(uint32_t))
@@ -620,6 +630,7 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int 
fflag,
evdev_client_filter_queue(client, EV_KEY);
memcpy(data, evdev->ev_key_states, limit);
EVDEV_UNLOCK(evdev);
+   td->td_retval[0] = limit;
return (0);
 
case EVIOCGLED(0):
@@ -628,6 +639,7 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int 
fflag,
evdev_client_filter_queue(client, EV_LED);
memcpy(data, evdev->ev_led_states, limit);
EVDEV_UNLOCK(evdev);
+   td->td_retval[0] = limit;
return (0);
 
case EVIOCGSND(0):
@@ -636,6 +648,7 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int 
fflag,
evdev_client_filter_queue(client, EV_SND);
memcpy(data, evdev->ev_snd_states, limit);
EVDEV_UNLOCK(evdev);
+   td->td_retval[0] = limit;
return (0);
 
case EVIOCGSW(0):
@@ -644,20 +657,22 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, 
int fflag,
evdev_client_filter_queue(client, EV_SW);
memcpy(data, evdev->ev_sw_states, limit);
EVDEV_UNLOCK(evdev);
+   td->td_retval[0] = limit;
return (0);
 
case EVIOCGBIT(0, 0) ... EVIOCGBIT(EV_MAX, 0):
type_num = IOCBASECMD(cmd) - EVIOCGBIT(0, 0);
debugf(client, "EVIOCGBIT(%d): data=%p, len=%d", type_num,
data, len);
-   return (evdev_ioctl_eviocgbit(evdev, type_num, len, data));
+   return (evdev_ioctl_eviocgbit(evdev, type_num, len, data, td));
}
 
return (EINVAL);
 }
 
 static int
-evdev_ioctl_eviocgbit(struct evdev_dev *evdev, int type, int len, caddr_t data)
+evdev_ioctl_eviocgbit(struct evdev_dev *evdev, int type, int len, caddr_t data,
+struct 

git: 3e954a8bc64e - main - hms: Workaround idle mouse drift in I2C sampling mode.

2021-01-20 Thread Vladimir Kondratyev
The branch main has been updated by wulf:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3e954a8bc64ebc21893eedba0f2f1159c242c9b6

commit 3e954a8bc64ebc21893eedba0f2f1159c242c9b6
Author: Vladimir Kondratyev 
AuthorDate: 2021-01-20 20:10:07 +
Commit: Vladimir Kondratyev 
CommitDate: 2021-01-20 20:10:07 +

hms: Workaround idle mouse drift in I2C sampling mode.

Many I2C "compatibility" mouse devices found on touchpads continue to
return last report data in sampling mode after touch has been ended.
That results in cursor drift.  Filter out such a reports with comparing
content of current report with content of previous one.

Reported by:many
Tested by:  omatsuda, gllb (github.com)
Obtained from:  sysutils/iichid
---
 sys/dev/hid/hms.c| 71 +++-
 sys/modules/hid/hms/Makefile |  1 +
 2 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/sys/dev/hid/hms.c b/sys/dev/hid/hms.c
index 7f3455ff2725..94267b3fcd52 100644
--- a/sys/dev/hid/hms.c
+++ b/sys/dev/hid/hms.c
@@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$");
  * HID spec: https://www.usb.org/sites/default/files/documents/hid1_11.pdf
  */
 
+#include "opt_hid.h"
+
 #include 
 #include 
 #include 
@@ -65,6 +67,9 @@ enum {
 };
 
 static hidmap_cb_t hms_final_cb;
+#ifdef IICHID_SAMPLING
+static hid_intr_t  hms_intr;
+#endif
 
 #define HMS_MAP_BUT_RG(usage_from, usage_to, code) \
{ HIDMAP_KEY_RANGE(HUP_BUTTON, usage_from, usage_to, code) }
@@ -110,8 +115,46 @@ static const struct hid_device_id hms_devs[] = {
 struct hms_softc {
struct hidmap   hm;
HIDMAP_CAPS(caps, hms_map);
+#ifdef IICHID_SAMPLING
+   booliichid_sampling;
+   void*last_ir;
+   hid_size_t  last_irsize;
+   hid_size_t  isize;
+   uint32_tdrift_cnt;
+   uint32_tdrift_thresh;
+#endif
 };
 
+#ifdef IICHID_SAMPLING
+static void
+hms_intr(void *context, void *buf, hid_size_t len)
+{
+   struct hidmap *hm = context;
+   struct hms_softc *sc = device_get_softc(hm->dev);
+
+   if (len > sc->isize)
+   len = sc->isize;
+
+   /*
+* Many I2C "compatibility" mouse devices found on touchpads continue
+* to return last report data in sampling mode even after touch has
+* been ended.  That results in cursor drift.  Filter out such a
+* reports through comparing with previous one.
+*/
+   if (len == sc->last_irsize && memcmp(buf, sc->last_ir, len) == 0) {
+   sc->drift_cnt++;
+   if (sc->drift_thresh != 0 && sc->drift_cnt >= sc->drift_thresh)
+   return;
+   } else {
+   sc->drift_cnt = 0;
+   sc->last_irsize = len;
+   bcopy(buf, sc->last_ir, len);
+   }
+
+   hidmap_intr(context, buf, len);
+}
+#endif
+
 static int
 hms_final_cb(HIDMAP_CB_ARGS)
 {
@@ -124,6 +167,11 @@ hms_final_cb(HIDMAP_CB_ARGS)
evdev_support_prop(evdev, INPUT_PROP_DIRECT);
else
evdev_support_prop(evdev, INPUT_PROP_POINTER);
+#ifdef IICHID_SAMPLING
+   /* Overload interrupt handler to skip identical reports */
+   if (sc->iichid_sampling)
+   hidbus_set_intr(sc->hm.dev, hms_intr, &sc->hm);
+#endif
}
 
/* Do not execute callback at interrupt handler and detach */
@@ -212,6 +260,21 @@ hms_attach(device_t dev)
else
HIDMAP_ADD_MAP(&sc->hm, hms_map_wheel, cap_wheel);
 
+#ifdef IICHID_SAMPLING
+   if (hid_test_quirk(hw, HQ_IICHID_SAMPLING) &&
+   hidmap_test_cap(sc->caps, HMS_REL_X) &&
+   hidmap_test_cap(sc->caps, HMS_REL_Y)) {
+   sc->iichid_sampling = true;
+   sc->isize = hid_report_size_max(d_ptr, d_len, hid_input, NULL);
+   sc->last_ir = malloc(sc->isize, M_DEVBUF, M_WAITOK | M_ZERO);
+   sc->drift_thresh = 2;
+   SYSCTL_ADD_U32(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+   "drift_thresh", CTLFLAG_RW, &sc->drift_thresh, 0,
+   "drift detection threshhold");
+   }
+#endif
+
error = hidmap_attach(&sc->hm);
if (error)
return (error);
@@ -243,8 +306,14 @@ static int
 hms_detach(device_t dev)
 {
struct hms_softc *sc = device_get_softc(dev);
+   int error;
 
-   return (hidmap_detach(&sc->hm));
+   error = hidmap_detach(&sc->hm);
+#ifdef IICHID_SAMPLING
+   if (error == 0)
+   free(sc->last_ir, M_DEVBUF);
+#endif
+   return (error);
 }
 
 static devclass_t hms_devclass;
diff --git a/sys/modules/hid/hms/Makefile b/sys/modules/hid/hms/Makefile
index 71fbd2a77b89..29514b86385b 100644
--- a/sys/modules/hid/hms/Makefile
+++ b/sys/

git: 84ab9074d4c1 - main - pms: quiet -Wunused-variable

2021-01-20 Thread Ryan Libby
The branch main has been updated by rlibby:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=84ab9074d4c17203977205b1fb33ed70723e4f89

commit 84ab9074d4c17203977205b1fb33ed70723e4f89
Author: Ryan Libby 
AuthorDate: 2021-01-20 21:59:49 +
Commit: Ryan Libby 
CommitDate: 2021-01-20 21:59:49 +

pms: quiet -Wunused-variable

Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D27994
---
 sys/dev/pms/freebsd/driver/common/lxcommon.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/pms/freebsd/driver/common/lxcommon.h 
b/sys/dev/pms/freebsd/driver/common/lxcommon.h
index 71ce230c3812..bbe33cf1fef7 100644
--- a/sys/dev/pms/freebsd/driver/common/lxcommon.h
+++ b/sys/dev/pms/freebsd/driver/common/lxcommon.h
@@ -313,7 +313,7 @@ ag_card_id_t ag_card_type[] = {
 #endif   //AGTIAPI_SA
 };
 
-static const char *ag_card_names[] = {
+static char const * const ag_card_names[] = {
   "Unknown",
   "iSCSI DiXL Card",
   "iSCSI iDX1 Card",
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: e54a1d575180 - main - pms: handle maximum size IO with any alignment

2021-01-20 Thread Ryan Libby
The branch main has been updated by rlibby:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e54a1d5751805714bf6ea5e2e99887388110f9f0

commit e54a1d5751805714bf6ea5e2e99887388110f9f0
Author: Ryan Libby 
AuthorDate: 2021-01-20 21:59:49 +
Commit: Ryan Libby 
CommitDate: 2021-01-20 21:59:49 +

pms: handle maximum size IO with any alignment

Define the maximum numbers of segments to allow for non-page alignment
at the beginning and end of a maxphys size transfer.  Also set
ccb_pathinq.maxio consistent with maxphys.

Reviewed by:imp
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D28043
---
 sys/dev/pms/freebsd/driver/ini/src/agdef.h   | 2 +-
 sys/dev/pms/freebsd/driver/ini/src/agtiapi.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/dev/pms/freebsd/driver/ini/src/agdef.h 
b/sys/dev/pms/freebsd/driver/ini/src/agdef.h
index cabcafc1819c..4c2ba2867f5f 100644
--- a/sys/dev/pms/freebsd/driver/ini/src/agdef.h
+++ b/sys/dev/pms/freebsd/driver/ini/src/agdef.h
@@ -62,7 +62,7 @@ EW 09-17-2004 1.0.0 Constant definitions
 #define AGTIAPI_MAX_DEVICE_7H   256 /*Max devices per channel in 7H */
 #define AGTIAPI_MAX_DEVICE_8H   512 /*Max devices per channel in 8H*/
 #define AGTIAPI_MAX_CAM_Q_DEPTH 1024
-#define AGTIAPI_NSEGS   (maxphys / PAGE_SIZE)
+#define AGTIAPI_NSEGS   (btoc(maxphys) + 1)
 /*
 ** Adapter specific defines 
 */
diff --git a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c 
b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
index 7738e1216907..69f488c4199b 100644
--- a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
+++ b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
@@ -1833,7 +1833,8 @@ static void agtiapi_cam_action( struct cam_sim *sim, 
union ccb * ccb )
 cpi->hba_eng_cnt = 0;
 cpi->max_target = maxTargets - 1;
 cpi->max_lun = AGTIAPI_MAX_LUN;
-cpi->maxio = 1024 *1024; /* Max supported I/O size, in bytes. */
+/* Max supported I/O size, in bytes. */
+cpi->maxio = ulmin(1024 * 1024, maxphys);
 cpi->initiator_id = 255;
 strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
 strlcpy(cpi->hba_vid, "PMC", HBA_IDLEN);
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: e3dd8ed77b4e - main - devinfo sysctl handler: Do not write zero-length strings in to sbuf twice

2021-01-20 Thread Vladimir Kondratyev
The branch main has been updated by wulf:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e3dd8ed77b4e7d8fda12ec80b91d89e8460b64f8

commit e3dd8ed77b4e7d8fda12ec80b91d89e8460b64f8
Author: Vladimir Kondratyev 
AuthorDate: 2021-01-20 23:06:16 +
Commit: Vladimir Kondratyev 
CommitDate: 2021-01-20 23:06:16 +

devinfo sysctl handler: Do not write zero-length strings in to sbuf twice

This fixes missing PnPinfo and location strings in devinfo(8) output
for devices with no attached drivers.
---
 sys/kern/subr_bus.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 78d07796659c..ecd6c9685e36 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -5528,18 +5528,12 @@ sysctl_devices(SYSCTL_HANDLER_ARGS)
sbuf_new(&sb, udev->dv_fields, sizeof(udev->dv_fields), SBUF_FIXEDLEN);
if (dev->nameunit != NULL)
sbuf_cat(&sb, dev->nameunit);
-   else
-   sbuf_putc(&sb, '\0');
sbuf_putc(&sb, '\0');
if (dev->desc != NULL)
sbuf_cat(&sb, dev->desc);
-   else
-   sbuf_putc(&sb, '\0');
sbuf_putc(&sb, '\0');
if (dev->driver != NULL)
sbuf_cat(&sb, dev->driver->name);
-   else
-   sbuf_putc(&sb, '\0');
sbuf_putc(&sb, '\0');
bus_child_pnpinfo_sb(dev, &sb);
sbuf_putc(&sb, '\0');
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 6754ae2572eb - main - jail: Use refcount(9) for prison references.

2021-01-20 Thread Jamie Gritton
The branch main has been updated by jamie:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6754ae2572eb20dbc23d2452b5e8fe4e07125f93

commit 6754ae2572eb20dbc23d2452b5e8fe4e07125f93
Author: Jamie Gritton 
AuthorDate: 2021-01-20 23:08:27 +
Commit: Jamie Gritton 
CommitDate: 2021-01-20 23:08:27 +

jail: Use refcount(9) for prison references.

Use refcount(9) for both pr_ref and pr_uref in struct prison.  This
allows prisons to held and freed without requiring the prison mutex.
An exception to this is that dropping the last reference will still
lock the prison, to keep the guarantee that a locked prison remains
valid and alive (provided it was at the time it was locked).

Among other things, this honors the promise made in a comment in
crcopy(9), that it will not block, which hasn't been true for two
decades.
---
 sys/kern/kern_jail.c | 145 ++-
 sys/sys/jail.h   |   9 ++--
 2 files changed, 91 insertions(+), 63 deletions(-)

diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 757b8bd06b89..e869bafc96b8 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -1116,7 +1116,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int 
flags)
  name_again:
deadpr = NULL;
FOREACH_PRISON_CHILD(ppr, tpr) {
-   if (tpr != pr && tpr->pr_ref > 0 &&
+   if (tpr != pr &&
!strcmp(tpr->pr_name + pnamelen, namelc)) {
mtx_lock(&tpr->pr_mtx);
if (prison_isalive(tpr)) {
@@ -1199,8 +1199,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int 
flags)
prison_name(mypr, ppr));
goto done_deref;
}
-   ppr->pr_ref++;
-   ppr->pr_uref++;
+   prison_hold(ppr);
+   refcount_acquire(&ppr->pr_uref);
mtx_unlock(&ppr->pr_mtx);
 
if (jid == 0 && (jid = get_next_prid(&inspr)) == 0) {
@@ -1315,7 +1315,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int 
flags)
 * Grab a reference for existing prisons, to ensure they
 * continue to exist for the duration of the call.
 */
-   pr->pr_ref++;
+   prison_hold(pr);
drflags |= PD_DEREF;
 #if defined(VIMAGE) && (defined(INET) || defined(INET6))
if ((pr->pr_flags & PR_VNET) &&
@@ -1434,7 +1434,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int 
flags)
 #ifdef VIMAGE
(tpr != tppr && (tpr->pr_flags & PR_VNET)) ||
 #endif
-   tpr->pr_uref == 0) {
+   refcount_load(&tpr->pr_uref) == 0) {
descend = 0;
continue;
}
@@ -1502,7 +1502,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int 
flags)
 #ifdef VIMAGE
(tpr != tppr && (tpr->pr_flags & PR_VNET)) ||
 #endif
-   tpr->pr_uref == 0) {
+   refcount_load(&tpr->pr_uref) == 0) {
descend = 0;
continue;
}
@@ -1738,11 +1738,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, 
int flags)
born = !prison_isalive(pr);
if (!created && (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags))) {
if (pr_flags & PR_PERSIST) {
-   pr->pr_ref++;
-   pr->pr_uref++;
+   prison_hold(pr);
+   refcount_acquire(&pr->pr_uref);
} else {
-   pr->pr_ref--;
-   pr->pr_uref--;
+   refcount_release(&pr->pr_uref);
+   refcount_release(&pr->pr_ref);
}
}
pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags;
@@ -1857,8 +1857,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int 
flags)
if (pr_flags & PR_PERSIST) {
mtx_lock(&pr->pr_mtx);
drflags |= PD_LOCKED;
-   pr->pr_ref++;
-   pr->pr_uref++;
+   refcount_acquire(&pr->pr_ref);
+   refcount_acquire(&pr->pr_uref);
} else {
/* Non-persistent jails need no further changes. */
pr = NULL;
@@ -1933,7 +1933,8 @@ get_next_prid(struct prison **insprp)
TAILQ_FOREACH(inspr, &allprison, pr_list) {
if (inspr->pr_id < jid)
continue;
-   if

git: d86d3194955c - main - Simplify dynamic ipfilter sysctls.

2021-01-20 Thread John Baldwin
The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d86d3194955c3063baeed27de4bc84dfe7a7187d

commit d86d3194955c3063baeed27de4bc84dfe7a7187d
Author: John Baldwin 
AuthorDate: 2021-01-21 00:33:34 +
Commit: John Baldwin 
CommitDate: 2021-01-21 00:34:25 +

Simplify dynamic ipfilter sysctls.

Pass the structure offset in arg2 instead of arg1.  This avoids
having to undo the pointer arithmetic on arg1.  Instead arg2 can
be used directly as an offset relative to the desired structure.

Reviewed by:cy
Obtained from:  CheriBSD
Sponsored by:   DARPA
Differential Revision:  https://reviews.freebsd.org/D27961
---
 sys/contrib/ipfilter/netinet/mlfk_ipl.c | 86 -
 1 file changed, 30 insertions(+), 56 deletions(-)

diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c 
b/sys/contrib/ipfilter/netinet/mlfk_ipl.c
index e593eafd500f..f6f6d2ce6d64 100644
--- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c
+++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c
@@ -367,77 +367,51 @@ sysctl_error:
 }
 
 /*
- * In the VIMAGE case kern_sysctl.c already adds the vnet base address given
- * we set CTLFLAG_VNET to get proper access checks.  Have to undo this.
- * Then we add the given offset to the specific malloced struct hanging off
- * virtualized ipmain struct.
+ * arg2 holds the offset of the relevant member in the virtualized
+ * ipfmain structure.
  */
 static int
 sysctl_ipf_int_nat ( SYSCTL_HANDLER_ARGS )
 {
+   ipf_nat_softc_t *nat_softc;
 
-   if (arg1) {
-   ipf_nat_softc_t *nat_softc;
+   nat_softc = V_ipfmain.ipf_nat_soft;
+   arg1 = (void *)((uintptr_t)nat_softc + arg2);
 
-   nat_softc = V_ipfmain.ipf_nat_soft;
-#ifdef VIMAGE
-   arg1 = (void *)((uintptr_t)arg1 - curvnet->vnet_data_base);
-#endif
-   arg1 = (void *)((uintptr_t)nat_softc + (uintptr_t)arg1);
-   }
-
-   return (sysctl_ipf_int(oidp, arg1, arg2, req));
+   return (sysctl_ipf_int(oidp, arg1, 0, req));
 }
 
 static int
 sysctl_ipf_int_state ( SYSCTL_HANDLER_ARGS )
 {
+   ipf_state_softc_t *state_softc;
 
-   if (arg1) {
-   ipf_state_softc_t *state_softc;
-
-   state_softc = V_ipfmain.ipf_state_soft;
-#ifdef VIMAGE
-   arg1 = (void *)((uintptr_t)arg1 - curvnet->vnet_data_base);
-#endif
-   arg1 = (void *)((uintptr_t)state_softc + (uintptr_t)arg1);
-   }
+   state_softc = V_ipfmain.ipf_state_soft;
+   arg1 = (void *)((uintptr_t)state_softc + arg2);
 
-   return (sysctl_ipf_int(oidp, arg1, arg2, req));
+   return (sysctl_ipf_int(oidp, arg1, 0, req));
 }
 
 static int
 sysctl_ipf_int_auth ( SYSCTL_HANDLER_ARGS )
 {
+   ipf_auth_softc_t *auth_softc;
 
-   if (arg1) {
-   ipf_auth_softc_t *auth_softc;
+   auth_softc = V_ipfmain.ipf_auth_soft;
+   arg1 = (void *)((uintptr_t)auth_softc + arg2);
 
-   auth_softc = V_ipfmain.ipf_auth_soft;
-#ifdef VIMAGE
-   arg1 = (void *)((uintptr_t)arg1 - curvnet->vnet_data_base);
-#endif
-   arg1 = (void *)((uintptr_t)auth_softc + (uintptr_t)arg1);
-   }
-
-   return (sysctl_ipf_int(oidp, arg1, arg2, req));
+   return (sysctl_ipf_int(oidp, arg1, 0, req));
 }
 
 static int
 sysctl_ipf_int_frag ( SYSCTL_HANDLER_ARGS )
 {
+   ipf_frag_softc_t *frag_softc;
 
-   if (arg1) {
-   ipf_frag_softc_t *frag_softc;
-
-   frag_softc = V_ipfmain.ipf_frag_soft;
-#ifdef VIMAGE
-   arg1 = (void *)((uintptr_t)arg1 - curvnet->vnet_data_base);
-#endif
-   arg1 = (void *)((uintptr_t)frag_softc + (uintptr_t)arg1);
-   }
+   frag_softc = V_ipfmain.ipf_frag_soft;
+   arg1 = (void *)((uintptr_t)frag_softc + arg2);
 
-   return (sysctl_ipf_int(oidp, arg1, arg2, req));
+   return (sysctl_ipf_int(oidp, arg1, 0, req));
 }
 #endif
 
@@ -645,29 +619,29 @@ ipf_fbsd_sysctl_create(void)
sysctl_ctx_init(&ipf_clist);
 
SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, "fr_defnatage", CTLFLAG_RWO,
-   (void *)offsetof(ipf_nat_softc_t, ipf_nat_defage), 0, "");
+   NULL, offsetof(ipf_nat_softc_t, ipf_nat_defage), "");
SYSCTL_DYN_IPF_STATE(_net_inet_ipf, OID_AUTO, "fr_statesize", 
CTLFLAG_RWO,
-   (void *)offsetof(ipf_state_softc_t, ipf_state_size), 0, "");
+   NULL, offsetof(ipf_state_softc_t, ipf_state_size), "");
SYSCTL_DYN_IPF_STATE(_net_inet_ipf, OID_AUTO, "fr_statemax", 
CTLFLAG_RWO,
-   (void *)offsetof(ipf_state_softc_t, ipf_state_max), 0, "");
+   NULL, offsetof(ipf_state_softc_t, ipf_state_max), "");
SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, "ipf_nattable_max", 
CTLFLAG_RWO,
-   (void *)offsetof(ipf_nat_softc_t, ipf_nat_table_max), 0, "");
+   NULL, offsetof(ipf_nat_softc_t, ipf_nat_table_max), "");
SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, 

git: 4a6cd37b755c - main - Restructure the crypto(7) manpage and add authentication algorithms.

2021-01-20 Thread John Baldwin
The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4a6cd37b755c404122453a82263f15323ecce56b

commit 4a6cd37b755c404122453a82263f15323ecce56b
Author: John Baldwin 
AuthorDate: 2021-01-21 00:37:55 +
Commit: John Baldwin 
CommitDate: 2021-01-21 00:40:03 +

Restructure the crypto(7) manpage and add authentication algorithms.

Add separate sections for authentication algorithms, block ciphers,
stream ciphers, and AEAD algorithms.  Describe properties commmon to
algorithms in each section to avoid duplication.

Use flat tables to list algorithm properties rather than nested
tables.

List implemented authentication algorithms.

Reviewed by:gbe (manpages)
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D27833
---
 share/man/man7/crypto.7 | 230 +++-
 1 file changed, 112 insertions(+), 118 deletions(-)

diff --git a/share/man/man7/crypto.7 b/share/man/man7/crypto.7
index 609eb574995e..d6cae1e39819 100644
--- a/share/man/man7/crypto.7
+++ b/share/man/man7/crypto.7
@@ -27,144 +27,140 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 4, 2020
+.Dd January 20, 2021
 .Dt CRYPTO 7
 .Os
 .Sh NAME
 .Nm crypto
 .Nd OpenCrypto algorithms
-.Sh SYNOPSIS
-In the kernel configuration file:
-.Cd "device crypto"
-.Pp
-Or load the crypto.ko module.
 .Sh DESCRIPTION
-The following cryptographic algorithms that are part of the OpenCrypto
-framework have the following requirements.
-.Pp
-Cipher algorithms:
-.Bl -tag -width "CRYPTO_AES_NIST_GCM_16"
-.It Dv CRYPTO_AES_CBC
-.Bl -tag -width "Block size :" -compact -offset indent
-.It IV size :
-16
-.It Block size :
-16
-.It Key size :
-16, 24 or 32
+The in-kernel OpenCrypto framework supports several different encryption
+and authentication algorithms.
+This document describes the parameters and requirements of these algorithms.
+Unless otherwise noted, all sizes listed below are in bytes.
+.Ss Authenticators
+Authenticators compute a value (also known as a digest, hash, or tag)
+over an input of bytes.
+In-kernel requests can either compute the value for a given input,
+or verify if a given tag matches the computed tag for a given input.
+The following authentication algorithms are supported:
+.Bl -column "CRYPTO_AES_CCM_CBC_MAC" "XXX" "16, 24, 32" "Digest"
+.It Sy Name Ta Sy Nonce Ta Sy Key Sizes Ta Sy Digest Ta Sy Description
+.It Dv CRYPTO_AES_CCM_CBC_MAC Ta 12 Ta 16, 24, 32 Ta 16 Ta
+Authentication-only mode of AES-CCM
+.It Dv CRYPTO_AES_NIST_GMAC Ta 12 Ta 16, 24, 32 Ta 16 Ta
+Galois message authentication code
+.It Dv CRYPTO_BLAKE2B Ta Ta 0, 64 Ta 64 Ta
+Blake2b
+.It Dv CRYPTO_BLAKE2S Ta Ta 0, 32 Ta 32 Ta
+Blake2s
+.It Dv CRYPTO_NULL_HMAC Ta Ta Ta 12 Ta
+IPsec NULL HMAC
+.It Dv CRYPTO_POLY1305 Ta Ta 32 Ta 16 Ta
+Poly1305 authenticator
+.It Dv CRYPTO_RIPEMD160 Ta Ta Ta 20 Ta
+RIPE Message Digest-160
+.It Dv CRYPTO_RIPEMD160_HMAC Ta Ta 64 Ta 20 Ta
+RIPE Message Digest-160 HMAC
+.It Dv CRYPTO_SHA1 Ta Ta Ta 20 Ta
+SHA-1
+.It Dv CRYPTO_SHA1_HMAC Ta Ta 64 Ta 20 Ta
+SHA-1 HMAC
+.It Dv CRYPTO_SHA2_224 Ta Ta Ta 28 Ta
+SHA-2 224
+.It Dv CRYPTO_SHA2_224_HMAC Ta Ta 64 Ta 28 Ta
+SHA-2 224 HMAC
+.It Dv CRYPTO_SHA2_256 Ta Ta Ta 32 Ta
+SHA-2 256
+.It Dv CRYPTO_SHA2_256_HMAC Ta Ta 64 Ta 32 Ta
+SHA-2 256 HMAC
+.It Dv CRYPTO_SHA2_384 Ta Ta Ta 48 Ta
+SHA-2 384
+.It Dv CRYPTO_SHA2_384_HMAC Ta Ta 128 Ta 48 Ta
+SHA-2 384 HMAC
+.It Dv CRYPTO_SHA2_512 Ta Ta Ta 64 Ta
+SHA-2 512
+.It Dv CRYPTO_SHA2_512_HMAC Ta Ta 128 Ta 64 Ta
+SHA-2 512 HMAC
 .El
-.Pp
-This algorithm implements Cipher Block Chaining.
-.It Dv CRYPTO_AES_CCM_16
-.Bl -tag -width "Block size :" -compact -offset indent
-.It IV size :
-12
-.It Block size :
-16
-.It Key size :
-16, 24 or 32
-.It Digest size :
-16
+.Ss Block Ciphers
+Block ciphers in OCF can only operate on messages whose length is an
+exact multiple of the cipher's block size.
+OCF supports the following block ciphers:
+.Bl -column "CRYPTO_CAMELLIA_CBC" "IV Size" "Block Size" "16, 24, 32"
+.It Sy Name Ta Sy IV Size Ta Sy Block Size Ta Sy Key Sizes Ta Sy Description
+.It Dv CRYPTO_AES_CBC Ta 16 Ta 16 Ta 16, 24, 32 Ta
+AES-CBC
+.It Dv CRYPTO_AES_XTS Ta 8 Ta 16 Ta 32, 64 Ta
+AES-XTS
+.It Dv CRYPTO_CAMELLIA_CBC Ta 16 Ta 16 Ta 16, 24, 32 Ta
+Camellia CBC
+.It Dv CRYPTO_NULL_CBC Ta 0 Ta 4 Ta 0-256 Ta
+IPsec NULL cipher
 .El
 .Pp
-This algorithm implements Counter with CBC-MAC Mode.
-This cipher uses AEAD
-.Pq Authenticated Encryption with Associated Data
-mode.
-.Pp
-The authentication tag will be read from or written to the offset
-.Va crp_digest_start
-specified in the request.
+.Dv CRYPTO_AES_XTS
+implements XEX Tweakable Block Cipher with Ciphertext Stealing
+as defined in NIST SP 800-38E.
+OCF consumers provide the first 8 bytes of the IV.
+The remaining 8 bytes are defined to be a block counter beginning at 0.
 .Pp
-Note: The nonce for each request must be provided in
-.Fa crp_iv
-via the
-.Dv CRYPTO_F_IV_SEPARATE

git: 5bd565855a92 - main - Tidy some crypto-related lines in sys/conf/files.

2021-01-20 Thread John Baldwin
The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5bd565855a92eff19883143be986a8045ca13cf9

commit 5bd565855a92eff19883143be986a8045ca13cf9
Author: John Baldwin 
AuthorDate: 2021-01-21 00:39:04 +
Commit: John Baldwin 
CommitDate: 2021-01-21 00:40:05 +

Tidy some crypto-related lines in sys/conf/files.

Reviewed by:cem (earlier version)
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D27835
---
 sys/conf/files | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index fe017a2537b7..552c496e922a 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -4908,6 +4908,7 @@ dev/mlx5/mlx5_en/mlx5_en_port_buffer.c
optional mlx5en pci inet inet6  \
compile-with "${OFED_C}"
 
 # crypto support
+opencrypto/cbc_mac.c   optional crypto
 opencrypto/criov.c optional crypto | ipsec | ipsec_support
 opencrypto/crypto.coptional crypto | ipsec | ipsec_support
 opencrypto/cryptodev.c optional cryptodev
@@ -4918,6 +4919,7 @@ opencrypto/gmac.c optional crypto | ipsec | 
ipsec_support
 opencrypto/gfmult.coptional crypto | ipsec | ipsec_support
 opencrypto/rmd160.coptional crypto | ipsec | ipsec_support
 opencrypto/xform.c optional crypto | ipsec | ipsec_support
+opencrypto/xform_cbc_mac.c optional crypto
 opencrypto/xform_poly1305.coptional crypto \
compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include 
-I$S/crypto/libsodium"
 
contrib/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c
 \
@@ -4949,9 +4951,6 @@ 
contrib/libsodium/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchach
optional crypto \
compile-with "${NORMAL_C} 
-I$S/contrib/libsodium/src/libsodium/include/sodium -I$S/crypto/libsodium"
 
-
-opencrypto/cbc_mac.c   optional crypto
-opencrypto/xform_cbc_mac.c optional crypto
 rpc/auth_none.coptional krpc | nfslockd | nfscl | nfsd
 rpc/auth_unix.coptional krpc | nfslockd | nfscl | nfsd
 rpc/authunix_prot.coptional krpc | nfslockd | nfscl | nfsd
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 0e72f2c54186 - main - virtio_mmio: Fix a style(9) issue

2021-01-20 Thread Jessica Clarke
The branch main has been updated by jrtc27:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0e72f2c54186aaf2f36d96a64f36d9a94627a03f

commit 0e72f2c54186aaf2f36d96a64f36d9a94627a03f
Author: Jessica Clarke 
AuthorDate: 2021-01-21 01:02:30 +
Commit: Jessica Clarke 
CommitDate: 2021-01-21 01:05:20 +

virtio_mmio: Fix a style(9) issue
---
 sys/dev/virtio/mmio/virtio_mmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/virtio/mmio/virtio_mmio.c 
b/sys/dev/virtio/mmio/virtio_mmio.c
index 694d2a232fdd..c16ecd40a250 100644
--- a/sys/dev/virtio/mmio/virtio_mmio.c
+++ b/sys/dev/virtio/mmio/virtio_mmio.c
@@ -219,7 +219,7 @@ vtmmio_attach(device_t dev)
rid = 0;
sc->res[0] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
-   if (!sc->res[0]) {
+   if (sc->res[0] == NULL) {
device_printf(dev, "Cannot allocate memory window.\n");
return (ENXIO);
}
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: be79a2c60fec - main - virtio_mmio: Fix V1 device probing spec conformance (section 4.2.3.1.1)

2021-01-20 Thread Jessica Clarke
The branch main has been updated by jrtc27:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=be79a2c60fec0b4ead6369e6ce420a664a0dfa9d

commit be79a2c60fec0b4ead6369e6ce420a664a0dfa9d
Author: Jessica Clarke 
AuthorDate: 2021-01-21 01:03:44 +
Commit: Jessica Clarke 
CommitDate: 2021-01-21 01:05:21 +

virtio_mmio: Fix V1 device probing spec conformance (section 4.2.3.1.1)

We must check MagicValue not just Version before anything else, and then
we must check DeviceID and immediately abort if zero (and this must not
be an error).

Do all this when probing rather than at the start of attaching as that's
where this belongs, and provides a clear boundary between the device
detection and device initialisation parts of the specified driver
initialisation process. This also means we don't create empty device
instances for placeholder devices, reducing clutter on systems that
pre-allocate a large number, such as QEMU's AArch64 virt machine (which
provides 32).

Reviewed by:bryanv
Differential Revision:  https://reviews.freebsd.org/D28070
---
 sys/dev/virtio/mmio/virtio_mmio.c  | 50 --
 sys/dev/virtio/mmio/virtio_mmio.h  |  2 ++
 sys/dev/virtio/mmio/virtio_mmio_acpi.c |  3 +-
 sys/dev/virtio/mmio/virtio_mmio_fdt.c  |  3 +-
 4 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/sys/dev/virtio/mmio/virtio_mmio.c 
b/sys/dev/virtio/mmio/virtio_mmio.c
index c16ecd40a250..862272b917df 100644
--- a/sys/dev/virtio/mmio/virtio_mmio.c
+++ b/sys/dev/virtio/mmio/virtio_mmio.c
@@ -171,6 +171,48 @@ DEFINE_CLASS_0(virtio_mmio, vtmmio_driver, vtmmio_methods,
 
 MODULE_VERSION(virtio_mmio, 1);
 
+int
+vtmmio_probe(device_t dev)
+{
+   struct vtmmio_softc *sc;
+   int rid;
+   uint32_t magic, version;
+
+   sc = device_get_softc(dev);
+
+   rid = 0;
+   sc->res[0] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
+   RF_ACTIVE);
+   if (sc->res[0] == NULL) {
+   device_printf(dev, "Cannot allocate memory window.\n");
+   return (ENXIO);
+   }
+
+   magic = vtmmio_read_config_4(sc, VIRTIO_MMIO_MAGIC_VALUE);
+   if (magic != VIRTIO_MMIO_MAGIC_VIRT) {
+   device_printf(dev, "Bad magic value %#x\n", magic);
+   bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->res[0]);
+   return (ENXIO);
+   }
+
+   version = vtmmio_read_config_4(sc, VIRTIO_MMIO_VERSION);
+   if (version < 1 || version > 2) {
+   device_printf(dev, "Unsupported version: %#x\n", version);
+   bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->res[0]);
+   return (ENXIO);
+   }
+
+   if (vtmmio_read_config_4(sc, VIRTIO_MMIO_DEVICE_ID) == 0) {
+   bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->res[0]);
+   return (ENXIO);
+   }
+
+   bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->res[0]);
+
+   device_set_desc(dev, "VirtIO MMIO adapter");
+   return (BUS_PROBE_DEFAULT);
+}
+
 static int
 vtmmio_setup_intr(device_t dev, enum intr_type type)
 {
@@ -225,14 +267,6 @@ vtmmio_attach(device_t dev)
}
 
sc->vtmmio_version = vtmmio_read_config_4(sc, VIRTIO_MMIO_VERSION);
-   if (sc->vtmmio_version < 1 || sc->vtmmio_version > 2) {
-   device_printf(dev, "Unsupported version: %x\n",
-   sc->vtmmio_version);
-   bus_release_resource(dev, SYS_RES_MEMORY, 0,
-   sc->res[0]);
-   sc->res[0] = NULL;
-   return (ENXIO);
-   }
 
vtmmio_reset(sc);
 
diff --git a/sys/dev/virtio/mmio/virtio_mmio.h 
b/sys/dev/virtio/mmio/virtio_mmio.h
index ce60cd4fa173..5eb56d860780 100644
--- a/sys/dev/virtio/mmio/virtio_mmio.h
+++ b/sys/dev/virtio/mmio/virtio_mmio.h
@@ -55,6 +55,7 @@ struct vtmmio_softc {
void*ih;
 };
 
+int vtmmio_probe(device_t);
 int vtmmio_attach(device_t);
 
 #defineVIRTIO_MMIO_MAGIC_VALUE 0x000
@@ -84,6 +85,7 @@ int vtmmio_attach(device_t);
 #defineVIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4   /* requires version 2 */
 #defineVIRTIO_MMIO_CONFIG_GENERATION   0x100   /* requires version 2 */
 #defineVIRTIO_MMIO_CONFIG  0x100
+#defineVIRTIO_MMIO_MAGIC_VIRT  0x74726976
 #defineVIRTIO_MMIO_INT_VRING   (1 << 0)
 #defineVIRTIO_MMIO_INT_CONFIG  (1 << 1)
 #defineVIRTIO_MMIO_VRING_ALIGN 4096
diff --git a/sys/dev/virtio/mmio/virtio_mmio_acpi.c 
b/sys/dev/virtio/mmio/virtio_mmio_acpi.c
index bd737a6e53db..0cb34f5aa873 100644
--- a/sys/dev/virtio/mmio/virtio_mmio_acpi.c
+++ b/sys/dev/virtio/mmio/virtio_mmio_acpi.c
@@ -81,6 +81,5 @@ vtmmio_acpi_probe(device_t dev)
if (!acpi_MatchHid(h, "LNRO0005"))
return (ENXIO);
 
-   device_set_desc(dev, "VirtIO MMIO adapter");
-   return (

git: 633218ee4615 - main - virtio: Reduce boilerplate for device driver module definitions

2021-01-20 Thread Jessica Clarke
The branch main has been updated by jrtc27:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=633218ee4615854702fea05ba6e17c2a1876bb6b

commit 633218ee4615854702fea05ba6e17c2a1876bb6b
Author: Jessica Clarke 
AuthorDate: 2021-01-21 01:07:23 +
Commit: Jessica Clarke 
CommitDate: 2021-01-21 01:07:23 +

virtio: Reduce boilerplate for device driver module definitions

Rather than have every device register itself for both virtio_pci and
virtio_mmio, provide a VIRTIO_DRIVER_MODULE wrapper to declare both,
merge VIRTIO_SIMPLE_PNPTABLE with VIRTIO_SIMPLE_PNPINFO and make the
latter register for both buses. This also has the benefit of abstracting
away the available transports and their names.

Reviewed by:bryanv
Differential Revision:  https://reviews.freebsd.org/D28073
---
 sys/dev/virtio/balloon/virtio_balloon.c |  8 ++--
 sys/dev/virtio/block/virtio_blk.c   |  8 ++--
 sys/dev/virtio/console/virtio_console.c |  8 ++--
 sys/dev/virtio/network/if_vtnet.c   |  8 ++--
 sys/dev/virtio/random/virtio_random.c   |  8 ++--
 sys/dev/virtio/scsi/virtio_scsi.c   |  8 ++--
 sys/dev/virtio/virtio.h | 13 +
 7 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/sys/dev/virtio/balloon/virtio_balloon.c 
b/sys/dev/virtio/balloon/virtio_balloon.c
index 848dd4e9a7f5..3e2d967dd9af 100644
--- a/sys/dev/virtio/balloon/virtio_balloon.c
+++ b/sys/dev/virtio/balloon/virtio_balloon.c
@@ -158,17 +158,13 @@ static driver_t vtballoon_driver = {
 };
 static devclass_t vtballoon_devclass;
 
-DRIVER_MODULE(virtio_balloon, virtio_mmio, vtballoon_driver,
-vtballoon_devclass, 0, 0);
-DRIVER_MODULE(virtio_balloon, virtio_pci, vtballoon_driver,
+VIRTIO_DRIVER_MODULE(virtio_balloon, vtballoon_driver,
 vtballoon_devclass, 0, 0);
 MODULE_VERSION(virtio_balloon, 1);
 MODULE_DEPEND(virtio_balloon, virtio, 1, 1, 1);
 
-VIRTIO_SIMPLE_PNPTABLE(virtio_balloon, VIRTIO_ID_BALLOON,
+VIRTIO_SIMPLE_PNPINFO(virtio_balloon, VIRTIO_ID_BALLOON,
 "VirtIO Balloon Adapter");
-VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_balloon);
-VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_balloon);
 
 static int
 vtballoon_probe(device_t dev)
diff --git a/sys/dev/virtio/block/virtio_blk.c 
b/sys/dev/virtio/block/virtio_blk.c
index 6056771e3735..50642fb0b009 100644
--- a/sys/dev/virtio/block/virtio_blk.c
+++ b/sys/dev/virtio/block/virtio_blk.c
@@ -267,16 +267,12 @@ static driver_t vtblk_driver = {
 };
 static devclass_t vtblk_devclass;
 
-DRIVER_MODULE(virtio_blk, virtio_mmio, vtblk_driver, vtblk_devclass,
-vtblk_modevent, 0);
-DRIVER_MODULE(virtio_blk, virtio_pci, vtblk_driver, vtblk_devclass,
+VIRTIO_DRIVER_MODULE(virtio_blk, vtblk_driver, vtblk_devclass,
 vtblk_modevent, 0);
 MODULE_VERSION(virtio_blk, 1);
 MODULE_DEPEND(virtio_blk, virtio, 1, 1, 1);
 
-VIRTIO_SIMPLE_PNPTABLE(virtio_blk, VIRTIO_ID_BLOCK, "VirtIO Block Adapter");
-VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_blk);
-VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_blk);
+VIRTIO_SIMPLE_PNPINFO(virtio_blk, VIRTIO_ID_BLOCK, "VirtIO Block Adapter");
 
 static int
 vtblk_modevent(module_t mod, int type, void *unused)
diff --git a/sys/dev/virtio/console/virtio_console.c 
b/sys/dev/virtio/console/virtio_console.c
index 315eb59716b4..b65935303b21 100644
--- a/sys/dev/virtio/console/virtio_console.c
+++ b/sys/dev/virtio/console/virtio_console.c
@@ -263,17 +263,13 @@ static driver_t vtcon_driver = {
 };
 static devclass_t vtcon_devclass;
 
-DRIVER_MODULE(virtio_console, virtio_mmio, vtcon_driver, vtcon_devclass,
-vtcon_modevent, 0);
-DRIVER_MODULE(virtio_console, virtio_pci, vtcon_driver, vtcon_devclass,
+VIRTIO_DRIVER_MODULE(virtio_console, vtcon_driver, vtcon_devclass,
 vtcon_modevent, 0);
 MODULE_VERSION(virtio_console, 1);
 MODULE_DEPEND(virtio_console, virtio, 1, 1, 1);
 
-VIRTIO_SIMPLE_PNPTABLE(virtio_console, VIRTIO_ID_CONSOLE,
+VIRTIO_SIMPLE_PNPINFO(virtio_console, VIRTIO_ID_CONSOLE,
 "VirtIO Console Adapter");
-VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_console);
-VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_console);
 
 static int
 vtcon_modevent(module_t mod, int type, void *unused)
diff --git a/sys/dev/virtio/network/if_vtnet.c 
b/sys/dev/virtio/network/if_vtnet.c
index 8d0770f5ac2d..e64b7de113c8 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -362,9 +362,7 @@ static driver_t vtnet_driver = {
 };
 static devclass_t vtnet_devclass;
 
-DRIVER_MODULE(vtnet, virtio_mmio, vtnet_driver, vtnet_devclass,
-vtnet_modevent, 0);
-DRIVER_MODULE(vtnet, virtio_pci, vtnet_driver, vtnet_devclass,
+VIRTIO_DRIVER_MODULE(vtnet, vtnet_driver, vtnet_devclass,
 vtnet_modevent, 0);
 MODULE_VERSION(vtnet, 1);
 MODULE_DEPEND(vtnet, virtio, 1, 1, 1);
@@ -372,9 +370,7 @@ MODULE_DEPEND(vtnet, virtio, 1, 1, 1);
 MODULE_DEPEND(vtnet, netmap, 1, 1, 1);
 #endif
 
-VIRTIO_SIMPLE_PNPTABLE(vtnet, VIRTIO_ID_NETWORK, "VirtIO Networking Adapter");
-VIRTIO_SIMPLE_PNPI

git: 32cb85d0f1e8 - main - Build VirtIO modules on all architectures

2021-01-20 Thread Jessica Clarke
The branch main has been updated by jrtc27:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=32cb85d0f1e806ac2147fefff6b6e3bd107ba4c1

commit 32cb85d0f1e806ac2147fefff6b6e3bd107ba4c1
Author: Jessica Clarke 
AuthorDate: 2021-01-21 01:21:35 +
Commit: Jessica Clarke 
CommitDate: 2021-01-21 01:21:35 +

Build VirtIO modules on all architectures

Currently only amd64, i386 and powerpc build VirtIO modules, yet all other
architectures have at least one kernel configuration that includes the
transport drivers, and so they lack drivers for all the devices they don't
statically compile into the kernel. Instead, enable the build everywhere so 
all
architectures have the full set of device drivers available.

Reviewed by:bryanv (earlier version), imp (earlier version)
Differential Revision:  https://reviews.freebsd.org/D28058
---
 share/man/man4/Makefile | 32 
 sys/modules/Makefile|  4 +---
 2 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index fa2af9d32aea..ffc7a08292e9 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -564,12 +564,12 @@ MAN=  aac.4 \
vge.4 \
viapm.4 \
${_viawd.4} \
-   ${_virtio.4} \
-   ${_virtio_balloon.4} \
-   ${_virtio_blk.4} \
-   ${_virtio_console.4} \
-   ${_virtio_random.4} \
-   ${_virtio_scsi.4} \
+   virtio.4 \
+   virtio_balloon.4 \
+   virtio_blk.4 \
+   virtio_console.4 \
+   virtio_random.4 \
+   virtio_scsi.4 \
${_vmci.4} \
vkbd.4 \
vlan.4 \
@@ -580,7 +580,7 @@ MAN=aac.4 \
vr.4 \
vt.4 \
vte.4 \
-   ${_vtnet.4} \
+   vtnet.4 \
watchdog.4 \
${_wbwd.4} \
witness.4 \
@@ -764,7 +764,7 @@ MLINKS+=vxlan.4 if_vxlan.4
 MLINKS+=${_vmx.4} ${_if_vmx.4}
 MLINKS+=vr.4 if_vr.4
 MLINKS+=vte.4 if_vte.4
-MLINKS+=${_vtnet.4} ${_if_vtnet.4}
+MLINKS+=vtnet.4 if_vtnet.4
 MLINKS+=watchdog.4 SW_WATCHDOG.4
 MLINKS+=${_wpi.4} ${_if_wpi.4}
 MLINKS+=xl.4 if_xl.4
@@ -818,7 +818,6 @@ _if_ndis.4= if_ndis.4
 _if_nfe.4= if_nfe.4
 _if_urtw.4=if_urtw.4
 _if_vmx.4= if_vmx.4
-_if_vtnet.4=   if_vtnet.4
 _if_wpi.4= if_wpi.4
 _imcsmb.4= imcsmb.4
 _ipmi.4=   ipmi.4
@@ -849,15 +848,8 @@ _superio.4=superio.4
 _tpm.4=tpm.4
 _urtw.4=   urtw.4
 _viawd.4=  viawd.4
-_virtio.4= virtio.4
-_virtio_balloon.4=virtio_balloon.4
-_virtio_blk.4= virtio_blk.4
-_virtio_console.4=virtio_console.4
-_virtio_random.4= virtio_random.4
-_virtio_scsi.4= virtio_scsi.4
 _vmci.4=   vmci.4
 _vmx.4=vmx.4
-_vtnet.4=  vtnet.4
 _wbwd.4=   wbwd.4
 _wpi.4=wpi.4
 _xen.4=xen.4
@@ -895,16 +887,8 @@ _nvram2env.4=  nvram2env.4
 .endif
 
 .if ${MACHINE_CPUARCH} == "powerpc"
-_if_vtnet.4=if_vtnet.4
 _nvd.4=nvd.4
 _nvme.4=   nvme.4
-_virtio.4= virtio.4
-_virtio_balloon.4=virtio_balloon.4
-_virtio_blk.4= virtio_blk.4
-_virtio_console.4=virtio_console.4
-_virtio_random.4= virtio_random.4
-_virtio_scsi.4=virtio_scsi.4
-_vtnet.4=  vtnet.4
 .endif
 
 .if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "aarch64" || \
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 320f4002f817..f5dd13527f08 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -376,7 +376,7 @@ SUBDIR= \
unionfs \
usb \
${_vesa} \
-   ${_virtio} \
+   virtio \
vge \
${_viawd} \
videomode \
@@ -722,7 +722,6 @@ _tpm=   tpm
 _twa=  twa
 _vesa= vesa
 _viawd=viawd
-_virtio=   virtio
 _wpi=  wpi
 .if ${MK_SOURCELESS_UCODE} != "no"
 _wpifw=wpifw
@@ -794,7 +793,6 @@ _ffec=  ffec
 _nvd=  nvd
 _nvme= nvme
 _pccard=   pccard
-_virtio=   virtio
 .endif
 
 .if ${MACHINE_ARCH:Mpowerpc64*} != ""
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 5faeda903753 - main - Rename i386's Linux ELF to Linux ELF32

2021-01-20 Thread Jessica Clarke
The branch main has been updated by jrtc27:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5faeda903753d20a7a857167a68713d1659474e1

commit 5faeda903753d20a7a857167a68713d1659474e1
Author: Jessica Clarke 
AuthorDate: 2021-01-21 01:54:12 +
Commit: Jessica Clarke 
CommitDate: 2021-01-21 01:54:12 +

Rename i386's Linux ELF to Linux ELF32

This is what amd64 calls the i386 Linux ABI in order to distinguish it
from the amd64 Linux ABI, and matches the nomenclature used for the
FreeBSD ABIs where they always have the size suffix in the name.

Reviewed by:trasz
Differential Revision:  https://reviews.freebsd.org/D27647
---
 sys/i386/linux/linux_sysvec.c | 2 +-
 usr.bin/truss/setup.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 7bd1102e48a0..10229d8af57e 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -882,7 +882,7 @@ struct sysentvec elf_linux_sysvec = {
.sv_sendsig = linux_sendsig,
.sv_sigcode = &_binary_linux_locore_o_start,
.sv_szsigcode   = &linux_szsigcode,
-   .sv_name= "Linux ELF",
+   .sv_name= "Linux ELF32",
.sv_coredump= elf32_coredump,
.sv_imgact_try  = linux_exec_imgact_try,
.sv_minsigstksz = LINUX_MINSIGSTKSZ,
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index 172d7d5d366c..d21ec133f483 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -141,7 +141,7 @@ static struct procabi_table abis[] = {
{ "Linux ELF64", &linux },
{ "Linux ELF32", &linux32 },
 #else
-   { "Linux ELF", &linux },
+   { "Linux ELF32", &linux },
 #endif
 };
 
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 513c5cd8276c - main - linux64: Don't pass unnecessary -S and -g to objcopy

2021-01-20 Thread Jessica Clarke
The branch main has been updated by jrtc27:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=513c5cd8276c262e4f81e5d3a717f3725a835d56

commit 513c5cd8276c262e4f81e5d3a717f3725a835d56
Author: Jessica Clarke 
AuthorDate: 2021-01-21 01:54:52 +
Commit: Jessica Clarke 
CommitDate: 2021-01-21 01:54:52 +

linux64: Don't pass unnecessary -S and -g to objcopy

Since we use --input-type binary these options are rather meaningless. Both
binutils and elftoolchain ignore the option in this case, but LLVM does not,
and instead strips all symbols from the output file, causing missing 
symbols at
run time if building with llvm-objcopy. Thus simply remove the options; the
linux module has never included them for building its VDSO (added in 
r283407),
but for some reason the original commit of linux64 (r283424) added them.

These should however eventually be changed to use template assembly files 
as is
now done for firmware and MFS_IMAGE.

Reviewed by:emaste, trasz
Differential Revision:  https://reviews.freebsd.org/D27740
---
 sys/modules/linux64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile
index 91b419558d82..ebc69168bd4a 100644
--- a/sys/modules/linux64/Makefile
+++ b/sys/modules/linux64/Makefile
@@ -50,7 +50,7 @@ OBJCOPY_TARGET=--output-target elf64-x86-64 
--binary-architecture i386:x86-64
 .error ${MACHINE_CPUARCH} not yet supported by linux64
 .endif
 ${VDSO}.so: linux_locore.o
-   ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \
+   ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \
linux_locore.o ${.TARGET}
${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET}
 
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 85ad7f8da19f - main - virtio_mmio: Delete a stale #if 0'ed debug print

2021-01-20 Thread Jessica Clarke
The branch main has been updated by jrtc27:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=85ad7f8da19fbd5985690d4ccfcc45952713dd1b

commit 85ad7f8da19fbd5985690d4ccfcc45952713dd1b
Author: Jessica Clarke 
AuthorDate: 2021-01-21 02:14:41 +
Commit: Jessica Clarke 
CommitDate: 2021-01-21 02:14:41 +

virtio_mmio: Delete a stale #if 0'ed debug print

This was blindly moved in r360722 but the variable being printed is not
yet initialised. It's of little use and can easily be added back in the
right place if needed by someone debugging, so just delete it.

Reported by:bryanv
---
 sys/dev/virtio/mmio/virtio_mmio.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sys/dev/virtio/mmio/virtio_mmio.c 
b/sys/dev/virtio/mmio/virtio_mmio.c
index 862272b917df..5672a6f0f69c 100644
--- a/sys/dev/virtio/mmio/virtio_mmio.c
+++ b/sys/dev/virtio/mmio/virtio_mmio.c
@@ -478,10 +478,7 @@ vtmmio_set_virtqueue(struct vtmmio_softc *sc, struct 
virtqueue *vq,
vm_paddr_t paddr;
 
vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_NUM, size);
-#if 0
-   device_printf(dev, "virtqueue paddr 0x%08lx\n",
-   (uint64_t)paddr);
-#endif
+
if (sc->vtmmio_version == 1) {
vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_ALIGN,
VIRTIO_MMIO_VRING_ALIGN);
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: 26490d9b74f0 - main - pkgbase: allow update-packages for first-run of packaging

2021-01-20 Thread Kyle Evans
The branch main has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=26490d9b74f0bdefbb9df74dcd285ecd08e0a961

commit 26490d9b74f0bdefbb9df74dcd285ecd08e0a961
Author: Kyle Evans 
AuthorDate: 2021-01-18 20:11:58 +
Commit: Kyle Evans 
CommitDate: 2021-01-21 03:58:30 +

pkgbase: allow update-packages for first-run of packaging

If ${REPODIR}/${PKG_ABI} does not exist when we begin real-update-packages,
skip the comparison with the non-existent previous repository and just
finish the repo off. This allows external scripts to just assume they can
run `update-packages` rather than figuring out if they'd previously run
`packages` for this Version/Arch combo.

PKG_VERSION_FROM_DIR was added so that we could perhaps detect the three
distinct cases:

1.) If the repo has not yet been created, PKG_VERSION_FROM_DIR will be
  empty.
2.) If the repo is in some intermediate state between created and fully
  initialized, PKG_VERSION_FROM_DIR may point to the ABI directory.
3.) If the repo is fully initialized, then PKG_VERSION_FROM_DIR points to
  the latest build to compare to.

Option #2 is explicitly unhandled at the moment, but this is no different
than it was before.

Reviewed-by:manu
Differential-Revision:  https://reviews.freebsd.org/D28229
---
 Makefile.inc1 | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 969e3d67cd05..d9ef01eefde5 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1876,7 +1876,13 @@ PKG_ABI!=${PKG_CMD} -o 
ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI
 
 .if !defined(PKG_VERSION_FROM) && make(real-update-packages)
 .if defined(PKG_ABI)
+.if exists(${REPODIR}/${PKG_ABI})
 PKG_VERSION_FROM!=/usr/bin/readlink ${REPODIR}/${PKG_ABI}/latest
+PKG_VERSION_FROM_DIR=  ${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM}
+.else
+PKG_VERSION_FROM=
+PKG_VERSION_FROM_DIR=
+.endif
 .endif
 .endif
 
@@ -1900,8 +1906,11 @@ real-packages:   stage-packages create-packages 
sign-packages .PHONY
 
 real-update-packages: stage-packages .PHONY
${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} create-packages
+.if empty(PKG_VERSION_FROM_DIR)
+   @echo "==> Bootstrapping repository, not checking for new packages"
+.else
@echo "==> Checking for new packages (comparing ${PKG_VERSION} to 
${PKG_VERSION_FROM})"
-   @for pkg in 
${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM}/${PKG_NAME_PREFIX}-*; do \
+   @for pkg in ${PKG_VERSION_FROM_DIR}/${PKG_NAME_PREFIX}-*; do \
  pkgname=$$(pkg query -F $${pkg} '%n' | sed 
's/${PKG_NAME_PREFIX}-\(.*\)/\1/') ; \
  
newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.${PKG_FORMAT} ; \
  oldsum=$$(pkg query -F $${pkg} '%X') ; \
@@ -1917,6 +1926,7 @@ real-update-packages: stage-packages .PHONY
echo "==> New package $${newpkgname}" ; \
  fi ; \
done
+.endif
${_+_}@cd ${.CURDIR}; \
${MAKE} -f Makefile.inc1 PKG_VERSION=${PKG_VERSION} 
sign-packages
 
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"


git: ff751ee05c93 - main - Remove FirstBurstLength limit for software iSCSI.

2021-01-20 Thread Alexander Motin
The branch main has been updated by mav:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ff751ee05c939eceab25c26ad60b1d56f989aec9

commit ff751ee05c939eceab25c26ad60b1d56f989aec9
Author: Alexander Motin 
AuthorDate: 2021-01-21 02:33:14 +
Commit: Alexander Motin 
CommitDate: 2021-01-21 04:17:12 +

Remove FirstBurstLength limit for software iSCSI.

For hardware offload solicited data may potentially be handled more
efficiently than unsolicited due to direct data placement.  Or there
can be some unsolicited write buffering limitations.  It may create
situations where FirstBurstLength limit is really useful.

Software driver though has no those factors, having to do memcopy()
any way and having no so hard limit on the temporary storage.  Same
time more active use of unsolicited transfers allows to avoid some
of Ready To Transfer (R2T) PDU round-trip times and processing.

This change effectively doubles from 64KB to 128KB the maximum size
of write command that can be transferred within one link RTT.  Tests
of (64KB, 128KB] QD1 writes mixed with simultaneous QD8 reads over
the same connection, increasing RTT, shows almost double write speed
and half latency, while we should be able to afford few megabytes of
RAM for additional buffering on a target these days.

MFC after:  2 weeks
Sponsored by:   iXsystems, Inc.
---
 sys/dev/iscsi/icl_soft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c
index bd4d9db81bb0..41d20b4abf69 100644
--- a/sys/dev/iscsi/icl_soft.c
+++ b/sys/dev/iscsi/icl_soft.c
@@ -1523,7 +1523,7 @@ icl_soft_limits(struct icl_drv_limits *idl)
idl->idl_max_recv_data_segment_length = 128 * 1024;
idl->idl_max_send_data_segment_length = 128 * 1024;
idl->idl_max_burst_length = 262144;
-   idl->idl_first_burst_length = 65536;
+   idl->idl_first_burst_length = idl->idl_max_burst_length;
 
return (0);
 }
___
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"