svn commit: r368246 - in head/sys/dev/usb: quirk storage

2020-12-01 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Dec  1 18:24:06 2020
New Revision: 368246
URL: https://svnweb.freebsd.org/changeset/base/368246

Log:
  USB umass: add quirk to not probe
  
  Some USB WLAN devices have "on-board" storage showing up as umass
  and making the root mount wait for a very long time.
  The WLAN drivers know how to deal with that an issue an eject
  command later when attaching themselves.
  Introduce a quirk to not probe these devices as umass and avoid
  hangs and confusion altogether.
  
  Reviewed by:  hselasky, imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D27434

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/quirk/usb_quirk.h
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Tue Dec  1 18:22:34 2020
(r368245)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Tue Dec  1 18:24:06 2020
(r368246)
@@ -539,6 +539,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(QUALCOMMINC, ZTE_MF730M, 0x, 0x, UQ_MSC_NO_GETMAXLUN,
UQ_MSC_NO_INQUIRY, UQ_CFG_INDEX_0),
USB_QUIRK(SMART2, G2MEMKEY, 0x, 0x, UQ_MSC_NO_INQUIRY),
+   USB_QUIRK(RALINK, RT_STOR, 0x0001, 0x0001, UQ_MSC_IGNORE),
/* Non-standard USB MIDI devices */
USB_QUIRK(ROLAND, UM1, 0x, 0x, UQ_AU_VENDOR_CLASS),
USB_QUIRK(ROLAND, SC8850, 0x, 0x, UQ_AU_VENDOR_CLASS),
@@ -642,6 +643,7 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = {
[UQ_MSC_FORCE_PROTO_ATAPI]  = "UQ_MSC_FORCE_PROTO_ATAPI",
[UQ_MSC_FORCE_PROTO_UFI]= "UQ_MSC_FORCE_PROTO_UFI",
[UQ_MSC_FORCE_PROTO_RBC]= "UQ_MSC_FORCE_PROTO_RBC",
+   [UQ_MSC_IGNORE] = "UQ_MSC_IGNORE",
[UQ_MSC_EJECT_HUAWEI]   = "UQ_MSC_EJECT_HUAWEI",
[UQ_MSC_EJECT_SIERRA]   = "UQ_MSC_EJECT_SIERRA",
[UQ_MSC_EJECT_SCSIEJECT]= "UQ_MSC_EJECT_SCSIEJECT",

Modified: head/sys/dev/usb/quirk/usb_quirk.h
==
--- head/sys/dev/usb/quirk/usb_quirk.h  Tue Dec  1 18:22:34 2020
(r368245)
+++ head/sys/dev/usb/quirk/usb_quirk.h  Tue Dec  1 18:24:06 2020
(r368246)
@@ -93,6 +93,7 @@ enum {
UQ_MSC_FORCE_PROTO_ATAPI,   /* force ATAPI command protocol */
UQ_MSC_FORCE_PROTO_UFI, /* force UFI command protocol */
UQ_MSC_FORCE_PROTO_RBC, /* force RBC command protocol */
+   UQ_MSC_IGNORE,  /* device should be ignored by umass */
 
/* Ejection of mass storage (driver disk) */
UQ_MSC_EJECT_HUAWEI,/* ejects after Huawei USB command */

Modified: head/sys/dev/usb/storage/umass.c
==
--- head/sys/dev/usb/storage/umass.cTue Dec  1 18:22:34 2020
(r368245)
+++ head/sys/dev/usb/storage/umass.cTue Dec  1 18:24:06 2020
(r368246)
@@ -784,6 +784,12 @@ umass_probe_proto(device_t dev, struct usb_attach_arg 
memset(, 0, sizeof(ret));
ret.error = BUS_PROBE_GENERIC;
 
+   /* Check if we should deny probing. */
+   if (usb_test_quirk(uaa, UQ_MSC_IGNORE)) {
+   ret.error = ENXIO;
+   goto done;
+   }
+
/* Search for protocol enforcement */
 
if (usb_test_quirk(uaa, UQ_MSC_FORCE_WIRE_BBB)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-30 Thread Bjoern A. Zeeb

On 30 Nov 2020, at 14:53, cglogic wrote:

So you propose to make it dependent on linuxkpi? What have to do a 
user who does not compile linuxkpi, but wants to use if_wg?


If we’d move the implementations into linuxkpi you’d have to compile 
it to use if_wg.

So that this however is only a question.

Effectively you are using parts of linuxkpi now already, just 
copy (duplicated) into local files under if_wg;  for as much as I 
can see for most of that would however not require linuxkpi to be 
loaded, just present at compile time like any other kernel headers.


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


Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-30 Thread Bjoern A. Zeeb

On 30 Nov 2020, at 9:27, Emmanuel Vadot wrote:


On Mon, 30 Nov 2020 01:13:12 +
"Bjoern A. Zeeb"  wrote:


On 29 Nov 2020, at 19:38, Matt Macy wrote:


Author: mmacy
Date: Sun Nov 29 19:38:03 2020
New Revision: 368163
URL: https://svnweb.freebsd.org/changeset/base/368163

Log:
  Import kernel WireGuard support

  Data path largely shared with the OpenBSD implementation by
  Matt Dunwoodie 

  Reviewed by:  gre...@freebsd.org
  MFC after:1 month
  Sponsored by: Rubicon LLC, (Netgate)
  Differential Revision:https://reviews.freebsd.org/D26137

Added:
  head/sbin/ifconfig/ifwg.c   (contents, props changed)
  head/sys/dev/if_wg/
  head/sys/dev/if_wg/include/
  head/sys/dev/if_wg/include/crypto/blake2s.h   (contents, props
changed)
  head/sys/dev/if_wg/include/crypto/curve25519.h   (contents, props
changed)
  head/sys/dev/if_wg/include/crypto/zinc.h   (contents, props 
changed)

  head/sys/dev/if_wg/include/sys/
  head/sys/dev/if_wg/include/sys/if_wg_session.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/if_wg_session_vars.h   (contents,
props changed)
  head/sys/dev/if_wg/include/sys/simd-x86_64.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/support.h   (contents, props 
changed)

  head/sys/dev/if_wg/include/sys/wg_cookie.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/wg_module.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/wg_noise.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/blake2s.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/chacha20.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/chacha20poly1305.h   (contents,
props changed)
  head/sys/dev/if_wg/include/zinc/curve25519.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/poly1305.h   (contents, props
changed)
  head/sys/dev/if_wg/module/
  head/sys/dev/if_wg/module/blake2s.c   (contents, props changed)
  head/sys/dev/if_wg/module/blake2s.h   (contents, props changed)
  head/sys/dev/if_wg/module/chacha20-x86_64.S   (contents, props
changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h   (contents,
props changed)
  head/sys/dev/if_wg/module/curve25519.c   (contents, props changed)
  head/sys/dev/if_wg/module/if_wg_session.c   (contents, props
changed)
  head/sys/dev/if_wg/module/module.c   (contents, props changed)
  head/sys/dev/if_wg/module/poly1305-x86_64.S   (contents, props
changed)
  head/sys/dev/if_wg/module/wg_cookie.c   (contents, props changed)
  head/sys/dev/if_wg/module/wg_noise.c   (contents, props changed)
  head/sys/mod

Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-30 Thread Bjoern A. Zeeb

On 29 Nov 2020, at 19:38, Matt Macy wrote:

Hi,


Author: mmacy
Date: Sun Nov 29 19:38:03 2020
New Revision: 368163
URL: https://svnweb.freebsd.org/changeset/base/368163

Log:
  Import kernel WireGuard support

  Data path largely shared with the OpenBSD implementation by
  Matt Dunwoodie 

  MFC after:1 month

Added:


probably an oversight as all the other files seem at least 
dual-licensed.


This one is GPL-2.0 only:

/* SPDX-License-Identifier: GPL-2.0 */

  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S 
  (contents, props changed)


Seems we don’t actually use most of these non-amd64 files (currently).
Can we remove at least this one please to avoid accidentally compiling 
it in in the future (and then not MFC it please)?



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


Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-29 Thread Bjoern A. Zeeb

On 29 Nov 2020, at 19:38, Matt Macy wrote:


Author: mmacy
Date: Sun Nov 29 19:38:03 2020
New Revision: 368163
URL: https://svnweb.freebsd.org/changeset/base/368163

Log:
  Import kernel WireGuard support

  Data path largely shared with the OpenBSD implementation by
  Matt Dunwoodie 

  Reviewed by:  gre...@freebsd.org
  MFC after:1 month
  Sponsored by: Rubicon LLC, (Netgate)
  Differential Revision:https://reviews.freebsd.org/D26137

Added:
  head/sbin/ifconfig/ifwg.c   (contents, props changed)
  head/sys/dev/if_wg/
  head/sys/dev/if_wg/include/
  head/sys/dev/if_wg/include/crypto/blake2s.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/crypto/curve25519.h   (contents, props 
changed)

  head/sys/dev/if_wg/include/crypto/zinc.h   (contents, props changed)
  head/sys/dev/if_wg/include/sys/
  head/sys/dev/if_wg/include/sys/if_wg_session.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/sys/if_wg_session_vars.h   (contents, 
props changed)
  head/sys/dev/if_wg/include/sys/simd-x86_64.h   (contents, props 
changed)

  head/sys/dev/if_wg/include/sys/support.h   (contents, props changed)
  head/sys/dev/if_wg/include/sys/wg_cookie.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/sys/wg_module.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/sys/wg_noise.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/zinc/blake2s.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/zinc/chacha20.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/zinc/chacha20poly1305.h   (contents, 
props changed)
  head/sys/dev/if_wg/include/zinc/curve25519.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/zinc/poly1305.h   (contents, props 
changed)

  head/sys/dev/if_wg/module/
  head/sys/dev/if_wg/module/blake2s.c   (contents, props changed)
  head/sys/dev/if_wg/module/blake2s.h   (contents, props changed)
  head/sys/dev/if_wg/module/chacha20-x86_64.S   (contents, props 
changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c  
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S 
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c 
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c  
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c 
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h   (contents, 
props changed)

  head/sys/dev/if_wg/module/curve25519.c   (contents, props changed)
  head/sys/dev/if_wg/module/if_wg_session.c   (contents, props 
changed)

  head/sys/dev/if_wg/module/module.c   (contents, props changed)
  head/sys/dev/if_wg/module/poly1305-x86_64.S   (contents, props 
changed)

  head/sys/dev/if_wg/module/wg_cookie.c   (contents, props changed)
  head/sys/dev/if_wg/module/wg_noise.c   (contents, props changed)
  head/sys/modules/if_wg/
  

Re: svn commit: r368045 - in head: . etc/mtree rescue/rescue sbin sbin/ping sbin/ping/tests sbin/ping6 sbin/ping6/tests tools/build/mk

2020-11-27 Thread Bjoern A. Zeeb

On 26 Nov 2020, at 18:51, Alan Somers wrote:


On Thu, Nov 26, 2020 at 2:16 AM Bjoern A. Zeeb <
bzeeb-li...@lists.zabbadoz.net> wrote:


On 26 Nov 2020, at 4:29, Alan Somers wrote:


Author: asomers
Date: Thu Nov 26 04:29:30 2020
New Revision: 368045
URL: https://svnweb.freebsd.org/changeset/base/368045

Log:
  Merge ping6 to ping

  There is now a single ping binary, which chooses to use ICMP or
ICMPv4
  based on the -4 and -6 options, and the format of the address.

  Submitted by:   Ján Sučan 
  Sponsored by:   Google LLC (Google Summer of Code 2019)
  MFC after:  Never
  Differential Revision:  https://reviews.freebsd.org/D21377


I don’t have IPv4 anymore.
I don’t see any WITHOUT_INET or -DINET checks.
How can I compile INET out now?



I don't see any such checks before, either.  Was it ever possible to
exclude ping by building WITHOUT_INET?


No, for various reasons including startup scripts relying on it etc.
I think no one ever bothered to fully find it all.

But it was possible to just ditch the binary (not installing it into 
custom images, or rm -f it post-install along with other things).



Now it’s a “dual-stack handling” binary and those we’ve tried 
with a lot of care to make sure they grow compiling out both ways as you 
cannot throw away the binary anymore.


I don’t know how hard it is to do this now.  I’ll be happy to have a 
look and help if it’s not a 5 minute job for you knowing the code and 
split up.   Would we just have to handle main.c with #ifdefs and the old 
ping[4] files from the Makefile or is ping6 also using shared code from 
the former ping[4]?



/bz


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


Re: svn commit: r368045 - in head: . etc/mtree rescue/rescue sbin sbin/ping sbin/ping/tests sbin/ping6 sbin/ping6/tests tools/build/mk

2020-11-26 Thread Bjoern A. Zeeb

On 26 Nov 2020, at 4:29, Alan Somers wrote:


Author: asomers
Date: Thu Nov 26 04:29:30 2020
New Revision: 368045
URL: https://svnweb.freebsd.org/changeset/base/368045

Log:
  Merge ping6 to ping

  There is now a single ping binary, which chooses to use ICMP or 
ICMPv4

  based on the -4 and -6 options, and the format of the address.

  Submitted by: Ján Sučan 
  Sponsored by: Google LLC (Google Summer of Code 2019)
  MFC after:Never
  Differential Revision:https://reviews.freebsd.org/D21377


I don’t have IPv4 anymore.
I don’t see any WITHOUT_INET or -DINET checks.
How can I compile INET out now?


Also can we please have a ping6 [binary, compat shell script, or 
hardlink] back which defaults to -6 with appropriate option parsing by 
default?
People used that in scripts and whatnot for about 20 years (and 
there’s even still stuff in tools in our own tree referencing it).


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


svn commit: r368031 - in head: libexec/rc sys/netinet6

2020-11-25 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Nov 25 20:58:01 2020
New Revision: 368031
URL: https://svnweb.freebsd.org/changeset/base/368031

Log:
  IPv6: set ifdisabled in the kernel rather than in rc
  
  Enable ND6_IFF_IFDISABLED when the interface is created in the
  kernel before return to user space.
  
  This avoids a race when an interface is create by a program which
  also calls ifconfig IF inet6 -ifdisabled and races with the
  devd -> /etc/pccard_ether -> .. netif start IF -> ifdisabled
  calls (the devd/rc framework disabling IPv6 again after the program
  had enabled it already).
  
  In case the global net.inet6.ip6.accept_rtadv was turned on,
  we also default to enabling IPv6 on the interfaces, rather than
  disabling them.
  
  PR:   248172
  Reported by:  Gert Doering (gert greenie.muc.de)
  Reviewed by:  glebius (, phk)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D27324

Modified:
  head/libexec/rc/network.subr
  head/sys/netinet6/nd6.c

Modified: head/libexec/rc/network.subr
==
--- head/libexec/rc/network.subrWed Nov 25 20:05:05 2020
(r368030)
+++ head/libexec/rc/network.subrWed Nov 25 20:58:01 2020
(r368031)
@@ -134,8 +134,6 @@ ifconfig_up()
if ! noafif $1 && afexists inet6; then
if checkyesno ipv6_activate_all_interfaces; then
_ipv6_opts="-ifdisabled"
-   elif [ "$1" != "lo0" ]; then
-   _ipv6_opts="ifdisabled"
fi
 
# backward compatibility: $ipv6_enable

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Wed Nov 25 20:05:05 2020(r368030)
+++ head/sys/netinet6/nd6.c Wed Nov 25 20:58:01 2020(r368031)
@@ -273,6 +273,10 @@ nd6_ifattach(struct ifnet *ifp)
 
nd->flags = ND6_IFF_PERFORMNUD;
 
+   /* Set IPv6 disabled on all interfaces but loopback by default. */
+   if ((ifp->if_flags & IFF_LOOPBACK) == 0)
+   nd->flags |= ND6_IFF_IFDISABLED;
+
/* A loopback interface always has ND6_IFF_AUTO_LINKLOCAL.
 * XXXHRS: Clear ND6_IFF_AUTO_LINKLOCAL on an IFT_BRIDGE interface by
 * default regardless of the V_ip6_auto_linklocal configuration to
@@ -290,8 +294,11 @@ nd6_ifattach(struct ifnet *ifp)
 */
if (V_ip6_accept_rtadv &&
!(ifp->if_flags & IFF_LOOPBACK) &&
-   (ifp->if_type != IFT_BRIDGE))
+   (ifp->if_type != IFT_BRIDGE)) {
nd->flags |= ND6_IFF_ACCEPT_RTADV;
+   /* If we globally accept rtadv, assume IPv6 on. */
+   nd->flags &= ~ND6_IFF_IFDISABLED;
+   }
if (V_ip6_no_radr && !(ifp->if_flags & IFF_LOOPBACK))
nd->flags |= ND6_IFF_NO_RADR;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367620 - stable/12/sys/arm64/arm64

2020-11-12 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov 12 17:26:19 2020
New Revision: 367620
URL: https://svnweb.freebsd.org/changeset/base/367620

Log:
  MFC r367538:
  
arm64: bs_sr_ take II
  
In r367327 generic_bs_sr_ were derived from mips.  Given we are calling
generic_bs_w_ and no write directly, we do not have to do the address
calculations ourselves as eneric_bs_w_ will do a str val [bsh, offset].
All we actually have to do is increment offset.

Modified:
  stable/12/sys/arm64/arm64/bus_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/bus_machdep.c
==
--- stable/12/sys/arm64/arm64/bus_machdep.c Thu Nov 12 16:44:56 2020
(r367619)
+++ stable/12/sys/arm64/arm64/bus_machdep.c Thu Nov 12 17:26:19 2020
(r367620)
@@ -124,40 +124,36 @@ static void
 generic_bs_sr_1(void *t, bus_space_handle_t bsh,
 bus_size_t offset, uint8_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr++)
-   generic_bs_w_1(t, bsh, addr, value);
+   for (; count != 0; count--, offset++)
+   generic_bs_w_1(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_2(void *t, bus_space_handle_t bsh,
   bus_size_t offset, uint16_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 2)
-   generic_bs_w_2(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 2)
+   generic_bs_w_2(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_4(void *t, bus_space_handle_t bsh,
 bus_size_t offset, uint32_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 4)
-   generic_bs_w_4(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 4)
+   generic_bs_w_4(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
 uint64_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 8)
-   generic_bs_w_8(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 8)
+   generic_bs_w_8(t, bsh, offset, value);
 }
 
 struct bus_space memmap_bus = {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367540 - stable/12/sys/dev/usb

2020-11-09 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Nov  9 23:38:39 2020
New Revision: 367540
URL: https://svnweb.freebsd.org/changeset/base/367540

Log:
  MFC r367435,367539:
  
usb_hub: giving up port reset - device vanished
  
Improve the output of the recently often experienced debug message in order
to gather further data.
  
  PR:   237666

Modified:
  stable/12/sys/dev/usb/usb_hub.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/usb_hub.c
==
--- stable/12/sys/dev/usb/usb_hub.c Mon Nov  9 23:36:51 2020
(r367539)
+++ stable/12/sys/dev/usb/usb_hub.c Mon Nov  9 23:38:39 2020
(r367540)
@@ -756,8 +756,10 @@ repeat:
if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) ||
(!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) {
if (timeout) {
-   DPRINTFN(0, "giving up port reset "
-   "- device vanished\n");
+   DPRINTFN(0, "giving up port %d reset - "
+  "device vanished: change %#x status %#x\n",
+  portno, sc->sc_st.port_change,
+  sc->sc_st.port_status);
goto error;
}
timeout = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367539 - head/sys/dev/usb

2020-11-09 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Nov  9 23:36:51 2020
New Revision: 367539
URL: https://svnweb.freebsd.org/changeset/base/367539

Log:
  usb_hub: fix whitespace
  
  Fix a whitespace "error" introduced in r367435 noticed when
  preparing the MFC.  No functional changes.

Modified:
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Mon Nov  9 23:34:32 2020(r367538)
+++ head/sys/dev/usb/usb_hub.c  Mon Nov  9 23:36:51 2020(r367539)
@@ -720,7 +720,7 @@ repeat:
if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) ||
(!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) {
if (timeout) {
-  DPRINTFN(0, "giving up port %d reset - "
+   DPRINTFN(0, "giving up port %d reset - "
   "device vanished: change %#x status %#x\n",
   portno, sc->sc_st.port_change,
   sc->sc_st.port_status);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367538 - head/sys/arm64/arm64

2020-11-09 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Nov  9 23:34:32 2020
New Revision: 367538
URL: https://svnweb.freebsd.org/changeset/base/367538

Log:
  arm64: bs_sr_ take II
  
  In r367327 generic_bs_sr_ were derived from mips.  Given we are calling
  generic_bs_w_ and no write directly, we do not have to do the address
  calculations ourselves as eneric_bs_w_ will do a str val [bsh, offset].
  All we actually have to do is increment offset.
  
  MFC after:3 days

Modified:
  head/sys/arm64/arm64/bus_machdep.c

Modified: head/sys/arm64/arm64/bus_machdep.c
==
--- head/sys/arm64/arm64/bus_machdep.c  Mon Nov  9 23:05:28 2020
(r367537)
+++ head/sys/arm64/arm64/bus_machdep.c  Mon Nov  9 23:34:32 2020
(r367538)
@@ -136,40 +136,36 @@ static void
 generic_bs_sr_1(void *t, bus_space_handle_t bsh,
 bus_size_t offset, uint8_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr++)
-   generic_bs_w_1(t, bsh, addr, value);
+   for (; count != 0; count--, offset++)
+   generic_bs_w_1(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_2(void *t, bus_space_handle_t bsh,
   bus_size_t offset, uint16_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 2)
-   generic_bs_w_2(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 2)
+   generic_bs_w_2(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_4(void *t, bus_space_handle_t bsh,
 bus_size_t offset, uint32_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 4)
-   generic_bs_w_4(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 4)
+   generic_bs_w_4(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
 uint64_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 8)
-   generic_bs_w_8(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 8)
+   generic_bs_w_8(t, bsh, offset, value);
 }
 
 struct bus_space memmap_bus = {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367451 - stable/12/sys/arm64/arm64

2020-11-07 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Nov  7 16:35:48 2020
New Revision: 367451
URL: https://svnweb.freebsd.org/changeset/base/367451

Log:
  MFC r367327:
  
   arm64: implement bs_sr_
  
Implement the bs_sr_ generic functions based on the generic
mips implementation calling the generic bs_w_ functions in a loop.
  
ral(4) (rt2860.c) panics in RAL_SET_REGION_4() because bs_sr_4()
is NULL.  It seems ral(4) and ti(4) might be the only consumers of
these functions I could find quickly so keeping them in C rather than asm.

Modified:
  stable/12/sys/arm64/arm64/bus_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/bus_machdep.c
==
--- stable/12/sys/arm64/arm64/bus_machdep.c Sat Nov  7 16:34:21 2020
(r367450)
+++ stable/12/sys/arm64/arm64/bus_machdep.c Sat Nov  7 16:35:48 2020
(r367451)
@@ -116,6 +116,50 @@ generic_bs_subregion(void *t, bus_space_handle_t bsh, 
return (0);
 }
 
+/*
+ * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
+ * by tag/handle starting at `offset'.
+ */
+static void
+generic_bs_sr_1(void *t, bus_space_handle_t bsh,
+bus_size_t offset, uint8_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr++)
+   generic_bs_w_1(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_2(void *t, bus_space_handle_t bsh,
+  bus_size_t offset, uint16_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 2)
+   generic_bs_w_2(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_4(void *t, bus_space_handle_t bsh,
+bus_size_t offset, uint32_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 4)
+   generic_bs_w_4(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
+uint64_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 8)
+   generic_bs_w_8(t, bsh, addr, value);
+}
+
 struct bus_space memmap_bus = {
/* cookie */
.bs_cookie = NULL,
@@ -175,10 +219,10 @@ struct bus_space memmap_bus = {
.bs_sm_8 = NULL,
 
/* set region */
-   .bs_sr_1 = NULL,
-   .bs_sr_2 = NULL,
-   .bs_sr_4 = NULL,
-   .bs_sr_8 = NULL,
+   .bs_sr_1 =  generic_bs_sr_1,
+   .bs_sr_2 =  generic_bs_sr_2,
+   .bs_sr_4 =  generic_bs_sr_4,
+   .bs_sr_8 =  generic_bs_sr_8,
 
/* copy */
.bs_c_1 = NULL,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367450 - stable/12/sys/net80211

2020-11-07 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Nov  7 16:34:21 2020
New Revision: 367450
URL: https://svnweb.freebsd.org/changeset/base/367450

Log:
  MFC r367326:
  
   net80211: fix a typo
  
Correct a typo referring to the wrong flags in a comment.
No functional changes.

Modified:
  stable/12/sys/net80211/_ieee80211.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net80211/_ieee80211.h
==
--- stable/12/sys/net80211/_ieee80211.h Sat Nov  7 16:20:37 2020
(r367449)
+++ stable/12/sys/net80211/_ieee80211.h Sat Nov  7 16:34:21 2020
(r367450)
@@ -619,7 +619,7 @@ struct ieee80211_rx_stats {
} evm;
 
/* 32 bits */
-   uint8_t c_phytype;  /* PHY type, FW flags above */
+   uint8_t c_phytype;  /* PHY type, FP flags above */
uint8_t c_vhtnss;   /* VHT - number of spatial streams */
uint8_t c_pad2[2];
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367435 - head/sys/dev/usb

2020-11-06 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Nov  6 22:40:00 2020
New Revision: 367435
URL: https://svnweb.freebsd.org/changeset/base/367435

Log:
  usb_hub: giving up port reset - device vanished
  
  Improve the output of the recently often experienced debug message in order
  to gather further data.
  
  PR:   237666
  Reviewed by:  hselasky
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D27108

Modified:
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Fri Nov  6 22:11:05 2020(r367434)
+++ head/sys/dev/usb/usb_hub.c  Fri Nov  6 22:40:00 2020(r367435)
@@ -720,8 +720,10 @@ repeat:
if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) ||
(!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) {
if (timeout) {
-   DPRINTFN(0, "giving up port reset "
-   "- device vanished\n");
+  DPRINTFN(0, "giving up port %d reset - "
+  "device vanished: change %#x status %#x\n",
+  portno, sc->sc_st.port_change,
+  sc->sc_st.port_status);
goto error;
}
timeout = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367385 - stable/12/sys/dev/rtwn/usb

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 15:27:38 2020
New Revision: 367385
URL: https://svnweb.freebsd.org/changeset/base/367385

Log:
  MFC r366268 (and epoch parts of r357093):
  
   rtwn: narrow the epoch area
  
Rather than placing the epoch around the entire receive loop which
might call into rtwn_rx_frame() and USB and sleep, split the loop
into two and leave us with one unlock/lock cycle as well.
  
  PR:   249925

Modified:
  stable/12/sys/dev/rtwn/usb/rtwn_usb_rx.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/rtwn/usb/rtwn_usb_rx.c
==
--- stable/12/sys/dev/rtwn/usb/rtwn_usb_rx.cThu Nov  5 15:08:56 2020
(r367384)
+++ stable/12/sys/dev/rtwn/usb/rtwn_usb_rx.cThu Nov  5 15:27:38 2020
(r367385)
@@ -363,11 +363,12 @@ rtwn_rx_frame(struct rtwn_softc *sc, struct mbuf *m)
 void
 rtwn_bulk_rx_callback(struct usb_xfer *xfer, usb_error_t error)
 {
+   struct epoch_tracker et;
struct rtwn_usb_softc *uc = usbd_xfer_softc(xfer);
struct rtwn_softc *sc = >uc_sc;
struct ieee80211com *ic = >sc_ic;
struct ieee80211_node *ni;
-   struct mbuf *m = NULL, *next;
+   struct mbuf *m0, *m = NULL, *next;
struct rtwn_data *data;
 
RTWN_ASSERT_LOCKED(sc);
@@ -399,23 +400,31 @@ tr_setup:
 * ieee80211_input() because here is at the end of a USB
 * callback and safe to unlock.
 */
+   m0 = m;
while (m != NULL) {
+   M_ASSERTPKTHDR(m);
+   m->m_pkthdr.PH_loc.ptr = rtwn_rx_frame(sc, m);
+   m = m->m_nextpkt;
+   }
+   NET_EPOCH_ENTER_ET(et);
+   RTWN_UNLOCK(sc);
+   m = m0;
+   while (m != NULL) {
next = m->m_nextpkt;
m->m_nextpkt = NULL;
 
-   ni = rtwn_rx_frame(sc, m);
-
-   RTWN_UNLOCK(sc);
-
+   ni = m->m_pkthdr.PH_loc.ptr;
+   m->m_pkthdr.PH_loc.ptr = NULL;
if (ni != NULL) {
(void)ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni);
} else {
(void)ieee80211_input_mimo_all(ic, m);
}
-   RTWN_LOCK(sc);
m = next;
}
+   RTWN_LOCK(sc);
+   NET_EPOCH_EXIT_ET(et);
break;
default:
/* needs it to the inactive queue due to a error. */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367382 - stable/12/sys/dev/extres/clk

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 13:45:26 2020
New Revision: 367382
URL: https://svnweb.freebsd.org/changeset/base/367382

Log:
  MFC r366799:
  
clk: fix indentation
  
Just fix indentation of an if() clause.
No functional changes intended.

Modified:
  stable/12/sys/dev/extres/clk/clk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/extres/clk/clk.c
==
--- stable/12/sys/dev/extres/clk/clk.c  Thu Nov  5 13:43:06 2020
(r367381)
+++ stable/12/sys/dev/extres/clk/clk.c  Thu Nov  5 13:45:26 2020
(r367382)
@@ -544,7 +544,7 @@ clknode_create(struct clkdom * clkdom, clknode_class_t
CLK_TOPO_SLOCK();
clknode = clknode_find_by_name(def->name);
CLK_TOPO_UNLOCK();
-   if (clknode !=  NULL) {
+   if (clknode !=  NULL) {
if (!(clknode->flags & CLK_NODE_LINKED) &&
def->flags & CLK_NODE_LINKED) {
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367381 - stable/12/sys/netinet

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 13:43:06 2020
New Revision: 367381
URL: https://svnweb.freebsd.org/changeset/base/367381

Log:
  MFC r366623:
  
   ip_mroute: fix the viftable export sysctl
  
It seems that in r354857 I got more than one thing wrong.
Convert the SYSCTL_OPAQUE to a SYSCTL_PROC to properly export the these
days allocated and not longer static per-vnet viftable array.
This fixes a problem with netstat -g which would show bogus information
for the IPv4 Virtual Interface Table.
  
  PR:   246626

Modified:
  stable/12/sys/netinet/ip_mroute.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/ip_mroute.c
==
--- stable/12/sys/netinet/ip_mroute.c   Thu Nov  5 13:38:26 2020
(r367380)
+++ stable/12/sys/netinet/ip_mroute.c   Thu Nov  5 13:43:06 2020
(r367381)
@@ -181,13 +181,6 @@ VNET_DEFINE_STATIC(vifi_t, numvifs);
 #defineV_numvifs   VNET(numvifs)
 VNET_DEFINE_STATIC(struct vif *, viftable);
 #defineV_viftable  VNET(viftable)
-/*
- * No one should be able to "query" this before initialisation happened in 
- * vnet_mroute_init(), so we should still be fine.
- */
-SYSCTL_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_VNET | CTLFLAG_RD,
-_NAME(viftable), sizeof(*V_viftable) * MAXVIFS, "S,vif[MAXVIFS]",
-"IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)");
 
 static struct mtx vif_mtx;
 #defineVIF_LOCK()  mtx_lock(_mtx)
@@ -2803,6 +2796,30 @@ out_locked:
 static SYSCTL_NODE(_net_inet_ip, OID_AUTO, mfctable, CTLFLAG_RD,
 sysctl_mfctable, "IPv4 Multicast Forwarding Table "
 "(struct *mfc[mfchashsize], netinet/ip_mroute.h)");
+
+static int
+sysctl_viflist(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+
+   if (req->newptr)
+   return (EPERM);
+   if (V_viftable == NULL) /* XXX unlocked */
+   return (0);
+   error = sysctl_wire_old_buffer(req, sizeof(*V_viftable) * MAXVIFS);
+   if (error)
+   return (error);
+
+   VIF_LOCK();
+   error = SYSCTL_OUT(req, V_viftable, sizeof(*V_viftable) * MAXVIFS);
+   VIF_UNLOCK();
+   return (error);
+}
+
+SYSCTL_PROC(_net_inet_ip, OID_AUTO, viftable,
+CTLTYPE_OPAQUE | CTLFLAG_VNET | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
+sysctl_viflist, "S,vif[MAXVIFS]",
+"IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)");
 
 static void
 vnet_mroute_init(const void *unused __unused)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367380 - stable/12/sys/compat/linuxkpi/common/include/linux

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 13:38:26 2020
New Revision: 367380
URL: https://svnweb.freebsd.org/changeset/base/367380

Log:
  MFC r366523:
  
  LinuxKPI: add a bitfield.h implementation.
  
This code was iteratively implemented during the work on various WiFi
drivers -- from individual functions to a macro-created implementations
for the various bit sized needed (and then extended to more for
comepleteness). Some of the bit combinations do not seem to make sense
so are left out.
  
The __bf_shf(x) was obtained from D26681 by manu.

Added:
  stable/12/sys/compat/linuxkpi/common/include/linux/bitfield.h
 - copied unchanged from r366523, 
head/sys/compat/linuxkpi/common/include/linux/bitfield.h
Modified:
Directory Properties:
  stable/12/   (props changed)

Copied: stable/12/sys/compat/linuxkpi/common/include/linux/bitfield.h (from 
r366523, head/sys/compat/linuxkpi/common/include/linux/bitfield.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/bitfield.h   Thu Nov 
 5 13:38:26 2020(r367380, copy of r366523, 
head/sys/compat/linuxkpi/common/include/linux/bitfield.h)
@@ -0,0 +1,105 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020 The FreeBSD Foundation
+ *
+ * This software was developed by Björn Zeeb under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef_LINUX_BITFIELD_H
+#define_LINUX_BITFIELD_H
+
+#include 
+#include 
+
+/* Use largest possible type. */
+static inline uint64_t ___lsb(uint64_t f) { return (f & -f); }
+static inline uint64_t ___bitmask(uint64_t f) { return (f / ___lsb(f)); }
+
+#define_uX_get_bits(_n)
\
+   static __inline uint ## _n ## _t\
+   u ## _n ## _get_bits(uint ## _n ## _t v, uint ## _n ## _t f)\
+   {   \
+   return ((v & f) / ___lsb(f));   \
+   }
+
+_uX_get_bits(64)
+_uX_get_bits(32)
+_uX_get_bits(16)
+_uX_get_bits(8)
+
+#define_leX_get_bits(_n)   
\
+   static __inline uint ## _n ## _t\
+   le ## _n ## _get_bits(__le ## _n v, uint ## _n ## _t f) \
+   {   \
+   return ((le ## _n ## _to_cpu(v) & f) / ___lsb(f));  \
+   }
+
+_leX_get_bits(64)
+_leX_get_bits(32)
+_leX_get_bits(16)
+
+#define_uX_encode_bits(_n) 
\
+   static __inline uint ## _n ## _t\
+   u ## _n ## _encode_bits(uint ## _n ## _t v, uint ## _n ## _t f) \
+   {   \
+   return ((v & ___bitmask(f)) * ___lsb(f));   \
+   }
+
+_uX_encode_bits(64)
+_uX_encode_bits(32)
+_uX_encode_bits(16)
+_uX_encode_bits(8)
+
+#define_leX_encode_bits(_n)
\
+   static __inline uint ## _n ## _t\
+   le ## _n ## _encode_bits(__le ## _n v, uint ## _n ## _t f)\
+   {   \
+   return (cpu_to_le ## _n((v & ___bitmask(f)) * ___lsb(f))); \
+   }
+
+_leX_encode_bits(64)
+_leX_encode_bits(32)
+_leX_encode_bits(16)
+
+static __inline void
+le32p_replace_bits(uint32_t *p, 

svn commit: r367378 - stable/12/sys/net80211

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 12:17:50 2020
New Revision: 367378
URL: https://svnweb.freebsd.org/changeset/base/367378

Log:
  MFC r366817:
  
net80211: factor out the priv(9) checks into OS specifc code.
  
Factor out the priv(9) checks into OS specifc code so other OSes can equally
implement them.  This sorts out those XXX in the net80211 code.
We provide 3 arguments (cmd, vap, ifp) where available to the functions, in
order to allow other OSes to use that data but also in case we'd add 
auditing
to these check to have the information available. For now the arguments are
marked __unused.
  
  PR:   249403

Modified:
  stable/12/sys/net80211/ieee80211_freebsd.c
  stable/12/sys/net80211/ieee80211_freebsd.h
  stable/12/sys/net80211/ieee80211_ioctl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net80211/ieee80211_freebsd.c
==
--- stable/12/sys/net80211/ieee80211_freebsd.c  Thu Nov  5 12:16:22 2020
(r367377)
+++ stable/12/sys/net80211/ieee80211_freebsd.c  Thu Nov  5 12:17:50 2020
(r367378)
@@ -72,6 +72,42 @@ SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, 
 static const char wlanname[] = "wlan";
 static struct if_clone *wlan_cloner;
 
+/*
+ * priv(9) NET80211 checks.
+ * Return 0 if operation is allowed, E* (usually EPERM) otherwise.
+ */
+int
+ieee80211_priv_check_vap_getkey(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_GETKEY));
+}
+
+int
+ieee80211_priv_check_vap_manage(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_MANAGE));
+}
+
+int
+ieee80211_priv_check_vap_setmac(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_SETMAC));
+}
+
+int
+ieee80211_priv_check_create_vap(u_long cmd __unused,
+struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_CREATE_VAP));
+}
+
 static int
 wlan_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
@@ -80,7 +116,7 @@ wlan_clone_create(struct if_clone *ifc, int unit, cadd
struct ieee80211com *ic;
int error;
 
-   error = priv_check(curthread, PRIV_NET80211_CREATE_VAP);
+   error = ieee80211_priv_check_create_vap(0, NULL, NULL);
if (error)
return error;
 

Modified: stable/12/sys/net80211/ieee80211_freebsd.h
==
--- stable/12/sys/net80211/ieee80211_freebsd.h  Thu Nov  5 12:16:22 2020
(r367377)
+++ stable/12/sys/net80211/ieee80211_freebsd.h  Thu Nov  5 12:17:50 2020
(r367378)
@@ -41,6 +41,19 @@
 #include 
 
 /*
+ * priv(9) NET80211 checks.
+ */
+struct ieee80211vap;
+int ieee80211_priv_check_vap_getkey(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_vap_manage(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_vap_setmac(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_create_vap(u_long, struct ieee80211vap *,
+struct ifnet *);
+
+/*
  * Common state locking definitions.
  */
 typedef struct {

Modified: stable/12/sys/net80211/ieee80211_ioctl.c
==
--- stable/12/sys/net80211/ieee80211_ioctl.cThu Nov  5 12:16:22 2020
(r367377)
+++ stable/12/sys/net80211/ieee80211_ioctl.cThu Nov  5 12:17:50 2020
(r367378)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -72,7 +71,8 @@ static int ieee80211_scanreq(struct ieee80211vap *,
struct ieee80211_scan_req *);
 
 static int
-ieee80211_ioctl_getkey(struct ieee80211vap *vap, struct ieee80211req *ireq)
+ieee80211_ioctl_getkey(u_long cmd, struct ieee80211vap *vap,
+struct ieee80211req *ireq)
 {
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_node *ni;
@@ -106,8 +106,7 @@ ieee80211_ioctl_getkey(struct ieee80211vap *vap, struc
ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV);
if (wk->wk_keyix == vap->iv_def_txkey)
ik.ik_flags |= IEEE80211_KEY_DEFAULT;
-   /* XXX TODO: move priv check to ieee80211_freebsd.c */
-   if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) {
+   if (ieee80211_priv_check_vap_getkey(cmd, vap, NULL) == 0) {
/* NB: only root can read key data */
ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID];
ik.ik_keytsc = wk->wk_keytsc;
@@ -822,8 +821,7 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l

svn commit: r367377 - in stable/12: sbin/ifconfig sys/net80211

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 12:16:22 2020
New Revision: 367377
URL: https://svnweb.freebsd.org/changeset/base/367377

Log:
  MFC r366800:
  
net80211: update for (more) VHT160 support
  
Implement two macros IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ()
and its 80+80 counter part to check in vhtcaps for appropriate
levels of support and use the macros throughout the code.
  
Add vht160_chan_ranges/is_vht160_valid_freq and handle analogue
to vht80 in various parts of the code.
  
Add ieee80211_add_channel_cbw() which also takes the CBW flag
fields and make the former ieee80211_add_channel() a wrapper to it.
With the CBW flags we can add HT/VHT channels passing them to
getflags() for the 2/5ghz functions.
  
In ifconfig(8) add the regdomain_addchans() support for VHT160
and VHT80P80.
  
With this (+ regdoain.xml updates) VHT160 channels can be
configured, listed, and pass regdomain where appropriate.

Modified:
  stable/12/sbin/ifconfig/ifieee80211.c
  stable/12/sys/net80211/ieee80211.c
  stable/12/sys/net80211/ieee80211.h
  stable/12/sys/net80211/ieee80211_regdomain.c
  stable/12/sys/net80211/ieee80211_var.h
  stable/12/sys/net80211/ieee80211_vht.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ifconfig/ifieee80211.c
==
--- stable/12/sbin/ifconfig/ifieee80211.c   Thu Nov  5 12:14:51 2020
(r367376)
+++ stable/12/sbin/ifconfig/ifieee80211.c   Thu Nov  5 12:16:22 2020
(r367377)
@@ -2405,7 +2405,31 @@ regdomain_makechannels(
>dc_chaninfo);
}
 
-   /* XXX TODO: VHT80P80, VHT160 */
+   /* VHT160 */
+   if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ(
+   dc->dc_vhtcaps)) {
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
+   IEEE80211_CHAN_VHT160,
+   >dc_chaninfo);
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
+   IEEE80211_CHAN_VHT160,
+   >dc_chaninfo);
+   }
+
+   /* VHT80P80 */
+   if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ(
+   dc->dc_vhtcaps)) {
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
+   IEEE80211_CHAN_VHT80P80,
+   >dc_chaninfo);
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
+   IEEE80211_CHAN_VHT80P80,
+   >dc_chaninfo);
+   }
}
 
if (!LIST_EMPTY(>bands_11ng) && dc->dc_htcaps != 0) {

Modified: stable/12/sys/net80211/ieee80211.c
==
--- stable/12/sys/net80211/ieee80211.c  Thu Nov  5 12:14:51 2020
(r367376)
+++ stable/12/sys/net80211/ieee80211.c  Thu Nov  5 12:16:22 2020
(r367377)
@@ -1163,6 +1163,12 @@ struct vht_chan_range vht80_chan_ranges[] = {
{ 0, 0 }
 };
 
+struct vht_chan_range vht160_chan_ranges[] = {
+   { 5170, 5330 },
+   { 5490, 5650 },
+   { 0, 0 }
+};
+
 static int
 set_vht_extchan(struct ieee80211_channel *c)
 {
@@ -1177,8 +1183,24 @@ set_vht_extchan(struct ieee80211_channel *c)
}
 
if (IEEE80211_IS_CHAN_VHT160(c)) {
-   printf("%s: TODO VHT160 channel (ieee=%d, flags=0x%08x)\n",
-   __func__, c->ic_ieee, c->ic_flags);
+   for (i = 0; vht160_chan_ranges[i].freq_start != 0; i++) {
+   if (c->ic_freq >= vht160_chan_ranges[i].freq_start &&
+   c->ic_freq < vht160_chan_ranges[i].freq_end) {
+   int midpoint;
+
+   midpoint = vht160_chan_ranges[i].freq_start + 
80;
+   c->ic_vht_ch_freq1 =
+   ieee80211_mhz2ieee(midpoint, c->ic_flags);
+   c->ic_vht_ch_freq2 = 0;
+#if 0
+   printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, 
freq2=%d\n",
+   __func__, c->ic_ieee, c->ic_freq, midpoint,
+   c->ic_vht_ch_freq1, c->ic_vht_ch_freq2);
+#endif
+   return (1);
+   }
+   }
+ 

svn commit: r367376 - stable/12/sys/net80211

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 12:14:51 2020
New Revision: 367376
URL: https://svnweb.freebsd.org/changeset/base/367376

Log:
  MFC r366525:
  
net80211: whitespace
  
Fix indentation for the multi-line copies of
ieee80211_add_channel_list_5ghz() for the 3 bands.

Modified:
  stable/12/sys/net80211/ieee80211_regdomain.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net80211/ieee80211_regdomain.c
==
--- stable/12/sys/net80211/ieee80211_regdomain.cThu Nov  5 12:12:26 
2020(r367375)
+++ stable/12/sys/net80211/ieee80211_regdomain.cThu Nov  5 12:14:51 
2020(r367376)
@@ -158,14 +158,14 @@ ieee80211_init_channels(struct ieee80211com *ic,
IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2)
cbw_flags |= NET80211_CBW_FLAG_VHT80P80;
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
-  nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
-  bands, cbw_flags);
+   nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
+   bands, cbw_flags);
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
nchans, def_chan_5ghz_band2, nitems(def_chan_5ghz_band2),
-  bands, cbw_flags);
+   bands, cbw_flags);
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
nchans, def_chan_5ghz_band3, nitems(def_chan_5ghz_band3),
-  bands, cbw_flags);
+   bands, cbw_flags);
}
if (rd != NULL)
ic->ic_regdomain = *rd;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367375 - stable/12/sbin/ifconfig

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 12:12:26 2020
New Revision: 367375
URL: https://svnweb.freebsd.org/changeset/base/367375

Log:
  MFC r366524:
  
80211: ifconfig replace MS() with _IEEE80211_MASKSHIFT()
  
As we did in the kernel in r366112 replace the MS() macro with the 
version(s)
added to the kernel: _IEEE80211_MASKSHIFT().  Also provide its counter part.
This will later allow use to use other macros defined in net80211 headers
here in ifconfig.

Modified:
  stable/12/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ifconfig/ifieee80211.c
==
--- stable/12/sbin/ifconfig/ifieee80211.c   Thu Nov  5 12:10:24 2020
(r367374)
+++ stable/12/sbin/ifconfig/ifieee80211.c   Thu Nov  5 12:12:26 2020
(r367375)
@@ -138,6 +138,14 @@
 #defineIEEE80211_FVHT_USEVHT80P80 0x00010  /* CONF: Use VHT 80+80 
*/
 #endif
 
+/* Helper macros unified. */
+#ifndef_IEEE80211_MASKSHIFT
+#define_IEEE80211_MASKSHIFT(_v, _f)(((_v) & _f) >> _f##_S)
+#endif
+#ifndef_IEEE80211_SHIFTMASK
+#define_IEEE80211_SHIFTMASK(_v, _f)(((_v) << _f##_S) & _f)
+#endif
+
 #defineMAXCHAN 1536/* max 1.5K channels */
 
 #defineMAXCOL  78
@@ -2706,7 +2714,6 @@ printie(const char* tag, const uint8_t *ie, size_t iel
 static void
 printwmeparam(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 {
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
static const char *acnames[] = { "BE", "BK", "VO", "VI" };
const struct ieee80211_wme_param *wme =
(const struct ieee80211_wme_param *) ie;
@@ -2721,17 +2728,17 @@ printwmeparam(const char *tag, const u_int8_t *ie, siz
const struct ieee80211_wme_acparams *ac =
>params_acParams[i];
 
-   printf(" %s[%saifsn %u cwmin %u cwmax %u txop %u]"
-   , acnames[i]
-   , MS(ac->acp_aci_aifsn, WME_PARAM_ACM) ? "acm " : ""
-   , MS(ac->acp_aci_aifsn, WME_PARAM_AIFSN)
-   , MS(ac->acp_logcwminmax, WME_PARAM_LOGCWMIN)
-   , MS(ac->acp_logcwminmax, WME_PARAM_LOGCWMAX)
-   , LE_READ_2(>acp_txop)
-   );
+   printf(" %s[%saifsn %u cwmin %u cwmax %u txop %u]", acnames[i],
+   _IEEE80211_MASKSHIFT(ac->acp_aci_aifsn, WME_PARAM_ACM) ?
+   "acm " : "",
+   _IEEE80211_MASKSHIFT(ac->acp_aci_aifsn, WME_PARAM_AIFSN),
+   _IEEE80211_MASKSHIFT(ac->acp_logcwminmax,
+   WME_PARAM_LOGCWMIN),
+   _IEEE80211_MASKSHIFT(ac->acp_logcwminmax,
+   WME_PARAM_LOGCWMAX),
+   LE_READ_2(>acp_txop));
}
printf(">");
-#undef MS
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367374 - in stable/12: lib/lib80211 sbin/ifconfig sys/net80211

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 12:10:24 2020
New Revision: 367374
URL: https://svnweb.freebsd.org/changeset/base/367374

Log:
  MFC r366522:
  
80211: non-functional changes
  
Sort a few VHT160 and 80+80 lines, update some comments, and remove
a superfluous ','.
  
No functional changes intended.

Modified:
  stable/12/lib/lib80211/lib80211_regdomain.c
  stable/12/sbin/ifconfig/ifieee80211.c
  stable/12/sys/net80211/ieee80211.c
  stable/12/sys/net80211/ieee80211_node.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/lib80211/lib80211_regdomain.c
==
--- stable/12/lib/lib80211/lib80211_regdomain.c Thu Nov  5 12:08:04 2020
(r367373)
+++ stable/12/lib/lib80211/lib80211_regdomain.c Thu Nov  5 12:10:24 2020
(r367374)
@@ -191,11 +191,11 @@ decode_flag(struct mystate *mt, const char *p, int len
FLAG(IEEE80211_CHAN_VHT20),
FLAG(IEEE80211_CHAN_VHT40),
FLAG(IEEE80211_CHAN_VHT80),
+   FLAG(IEEE80211_CHAN_VHT160),
/*
 * XXX VHT80P80? This likely should be done by
 * 80MHz chan logic in net80211 / ifconfig.
 */
-   FLAG(IEEE80211_CHAN_VHT160),
FLAG(IEEE80211_CHAN_ST),
FLAG(IEEE80211_CHAN_TURBO),
FLAG(IEEE80211_CHAN_PASSIVE),

Modified: stable/12/sbin/ifconfig/ifieee80211.c
==
--- stable/12/sbin/ifconfig/ifieee80211.c   Thu Nov  5 12:08:04 2020
(r367373)
+++ stable/12/sbin/ifconfig/ifieee80211.c   Thu Nov  5 12:10:24 2020
(r367374)
@@ -2385,8 +2385,7 @@ regdomain_makechannels(
>dc_chaninfo);
}
 
-   /* VHT80 */
-   /* XXX dc_vhtcap? */
+   /* VHT80 is mandatory (and so should be VHT40 above). */
if (1) {
regdomain_addchans(ci, >bands_11ac, reg,
IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |

Modified: stable/12/sys/net80211/ieee80211.c
==
--- stable/12/sys/net80211/ieee80211.c  Thu Nov  5 12:08:04 2020
(r367373)
+++ stable/12/sys/net80211/ieee80211.c  Thu Nov  5 12:10:24 2020
(r367374)
@@ -158,7 +158,7 @@ ieee80211_chan_init(struct ieee80211com *ic)
 
/*
 * Setup the HT40/VHT40 upper/lower bits.
-* The VHT80 math is done elsewhere.
+* The VHT80/... math is done elsewhere.
 */
if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0)
c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq +
@@ -167,8 +167,8 @@ ieee80211_chan_init(struct ieee80211com *ic)
 
/* Update VHT math */
/*
-* XXX VHT again, note that this assumes VHT80 channels
-* are legit already
+* XXX VHT again, note that this assumes VHT80/... channels
+* are legit already.
 */
set_vht_extchan(c);
 
@@ -712,8 +712,8 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_cha
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
-   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
+   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
IEEE80211_UNLOCK(ic);
 
return 1;
@@ -767,8 +767,8 @@ ieee80211_vap_detach(struct ieee80211vap *vap)
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
-   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
+   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
 
/* NB: this handles the bpfdetach done below */
ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF);
@@ -1160,7 +1160,7 @@ struct vht_chan_range vht80_chan_ranges[] = {
{ 5570, 5650 },
{ 5650, 5730 },
{ 5735, 5815 },
-   { 0, 0, }
+   { 0, 0 }
 };
 
 static int

Modified: stable/12/sys/net80211/ieee80211_node.h
==
--- stable/12/sys/net80211/ieee80211_node.h Thu Nov  5 12:08:04 2020
(r367373)
+++ stable/12/sys/net80211/ieee80211_node.h Thu Nov  5 12:10:24 2020
(r367374)
@@ -70,7 +70,7 @@ 

svn commit: r367373 - in stable/12/sys: dev/ath dev/bwn dev/iwn dev/malo dev/mwl net80211

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 12:08:04 2020
New Revision: 367373
URL: https://svnweb.freebsd.org/changeset/base/367373

Log:
  MFC r366112:
  
Provide MS() and SM() macros for 80211 and wireless drivers.
  
We have (two versions) of MS() and SM() macros which we use throughout
the wireless code.  Change all but three places (ath_hal, rtwn, and rsu)
to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
macros.  Also change one internal case using both _S and _M instead of
just _S away from _M (one of the reasons rtwn and rsu were not changed).
  
This was done semi-mechanically.  No functional changes intended.

Modified:
  stable/12/sys/dev/ath/if_ath_tx.c
  stable/12/sys/dev/ath/if_ath_tx_ht.c
  stable/12/sys/dev/bwn/if_bwn.c
  stable/12/sys/dev/iwn/if_iwn.c
  stable/12/sys/dev/malo/if_malo.c
  stable/12/sys/dev/mwl/if_mwl.c
  stable/12/sys/net80211/ieee80211_freebsd.c
  stable/12/sys/net80211/ieee80211_ht.c
  stable/12/sys/net80211/ieee80211_ioctl.c
  stable/12/sys/net80211/ieee80211_output.c
  stable/12/sys/net80211/ieee80211_regdomain.c
  stable/12/sys/net80211/ieee80211_sta.c
  stable/12/sys/net80211/ieee80211_superg.c
  stable/12/sys/net80211/ieee80211_var.h
  stable/12/sys/net80211/ieee80211_vht.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ath/if_ath_tx.c
==
--- stable/12/sys/dev/ath/if_ath_tx.c   Thu Nov  5 12:06:50 2020
(r367372)
+++ stable/12/sys/dev/ath/if_ath_tx.c   Thu Nov  5 12:08:04 2020
(r367373)
@@ -2598,7 +2598,6 @@ ieee80211_is_action(struct ieee80211_frame *wh)
return 1;
 }
 
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
 /*
  * Return an alternate TID for ADDBA request frames.
  *
@@ -2637,11 +2636,10 @@ ath_tx_action_frame_override_queue(struct ath_softc *s
 
/* Extract TID, return it */
baparamset = le16toh(ia->rq_baparamset);
-   *tid = (int) MS(baparamset, IEEE80211_BAPS_TID);
+   *tid = (int) _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_TID);
 
return 1;
 }
-#undef MS
 
 /* Per-node software queue operations */
 

Modified: stable/12/sys/dev/ath/if_ath_tx_ht.c
==
--- stable/12/sys/dev/ath/if_ath_tx_ht.cThu Nov  5 12:06:50 2020
(r367372)
+++ stable/12/sys/dev/ath/if_ath_tx_ht.cThu Nov  5 12:08:04 2020
(r367373)
@@ -406,7 +406,6 @@ static int
 ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf,
 uint16_t pktlen, int is_first)
 {
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
const HAL_RATE_TABLE *rt = sc->sc_currates;
struct ieee80211_node *ni = first_bf->bf_node;
struct ieee80211vap *vap = ni->ni_vap;
@@ -421,7 +420,8 @@ ath_compute_num_delims(struct ath_softc *sc, struct at
/*
 * Get the advertised density from the node.
 */
-   peer_mpdudensity = MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
+   peer_mpdudensity =
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
 
/*
 * vap->iv_ampdu_density is a net80211 value, rather than the actual
@@ -528,7 +528,6 @@ ath_compute_num_delims(struct ath_softc *sc, struct at
__func__, pktlen, minlen, rix, rc, width, half_gi, ndelim);
 
return ndelim;
-#undef MS
 }
 
 /*
@@ -568,7 +567,6 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
 {
struct ieee80211vap *vap = ni->ni_vap;
 
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
int amin = ATH_AGGR_MAXSIZE;
int i;
 
@@ -583,8 +581,8 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
 * Check the HTCAP field for the maximum size the node has
 * negotiated.  If it's smaller than what we have, cap it there.
 */
-   amin = MIN(amin, ath_rx_ampdu_to_byte(MS(ni->ni_htparam,
-   IEEE80211_HTCAP_MAXRXAMPDU)));
+   amin = MIN(amin, ath_rx_ampdu_to_byte(
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU)));
 
for (i = 0; i < ATH_RC_NUM; i++) {
if (bf->bf_state.bfs_rc[i].tries == 0)
@@ -598,11 +596,10 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
__func__,
sc->sc_aggr_limit,
vap->iv_ampdu_limit,
-   MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
amin);
 
return amin;
-#undef MS
 }
 
 /*

Modified: stable/12/sys/dev/bwn/if_bwn.c
==
--- stable/12/sys/dev/bwn/if_bwn.c  Thu Nov  5 12:06:50 2020
(r367372)
+++ stable/12/sys/dev/bwn/if_bwn.c  Thu Nov  5 12:08:04 2020
(r367373)
@@ -2122,7 +2122,6 @@ bwn_stop(struct bwn_softc *sc)
 static void
 

svn commit: r367371 - stable/12/sys/dev/iwm

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 11:56:49 2020
New Revision: 367371
URL: https://svnweb.freebsd.org/changeset/base/367371

Log:
  MFC r365633:
  
iwm: fix regression from r365419 (ieee80211_media_change())
  
In r365419 ieee80211_media_change() callers were updated to not longer
act on the obselete ENETRESET return code.
While in the old days iwm has done a stop/init cycle in these cases,
this was not executed since r193340.
As a consequence simplify iwm code as well by passing 
ieee80211_media_change()
right to ieee80211_vap_attach() as there is no more need for a local
implementation.
  
The actual problem was fixed in stable/12 since r365608;  this just
reduces changes to HEAD.
  
  PR:   248955

Modified:
  stable/12/sys/dev/iwm/if_iwm.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/iwm/if_iwm.c
==
--- stable/12/sys/dev/iwm/if_iwm.c  Thu Nov  5 11:37:14 2020
(r367370)
+++ stable/12/sys/dev/iwm/if_iwm.c  Thu Nov  5 11:56:49 2020
(r367371)
@@ -354,7 +354,6 @@ static struct ieee80211_node *
 static uint8_t iwm_rate_from_ucode_rate(uint32_t);
 static int iwm_rate2ridx(struct iwm_softc *, uint8_t);
 static voidiwm_setrates(struct iwm_softc *, struct iwm_node *, int);
-static int iwm_media_change(struct ifnet *);
 static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidiwm_endscan_cb(void *, int);
 static int iwm_send_bt_init_conf(struct iwm_softc *);
@@ -4412,31 +4411,6 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in
}
 }
 
-static int
-iwm_media_change(struct ifnet *ifp)
-{
-#if 0
-   struct ieee80211vap *vap = ifp->if_softc;
-   struct ieee80211com *ic = vap->iv_ic;
-   struct iwm_softc *sc = ic->ic_softc;
-#endif
-   int error;
-
-   error = ieee80211_media_change(ifp);
-   if (error != 0)
-   return (error);
-
-#if 0
-   IWM_LOCK(sc);
-   if (ic->ic_nrunning > 0) {
-   iwm_stop(sc);
-   iwm_init(sc);
-   }
-   IWM_UNLOCK(sc);
-#endif
-   return (0);
-}
-
 static void
 iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap)
 {
@@ -6431,8 +6405,8 @@ iwm_vap_create(struct ieee80211com *ic, const char nam
 
ieee80211_ratectl_init(vap);
/* Complete setup. */
-   ieee80211_vap_attach(vap, iwm_media_change, ieee80211_media_status,
-   mac);
+   ieee80211_vap_attach(vap, ieee80211_media_change,
+   ieee80211_media_status, mac);
ic->ic_opmode = opmode;
 
return vap;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367370 - stable/12/sys/dev/usb/storage

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 11:37:14 2020
New Revision: 367370
URL: https://svnweb.freebsd.org/changeset/base/367370

Log:
  MFC r365335:
  
umass: enhance debugging
  
Investigating a hang I found having some more error information
available would be helpful, so be more verbose and also tell cam/xpt
status in case of error/panic.

Modified:
  stable/12/sys/dev/usb/storage/umass.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/storage/umass.c
==
--- stable/12/sys/dev/usb/storage/umass.c   Thu Nov  5 11:33:23 2020
(r367369)
+++ stable/12/sys/dev/usb/storage/umass.c   Thu Nov  5 11:37:14 2020
(r367370)
@@ -2074,6 +2074,7 @@ static int
 umass_cam_attach_sim(struct umass_softc *sc)
 {
struct cam_devq *devq;  /* Per device Queue */
+   cam_status status;
 
/*
 * A HBA is attached to the CAM layer.
@@ -2102,11 +2103,12 @@ umass_cam_attach_sim(struct umass_softc *sc)
}
 
mtx_lock(>sc_mtx);
-
-   if (xpt_bus_register(sc->sc_sim, sc->sc_dev,
-   sc->sc_unit) != CAM_SUCCESS) {
+   status = xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit);
+   if (status != CAM_SUCCESS) {
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
mtx_unlock(>sc_mtx);
+   printf("%s: xpt_bus_register failed with status %#x\n",
+   __func__, status);
return (ENOMEM);
}
mtx_unlock(>sc_mtx);
@@ -2132,14 +2134,22 @@ umass_cam_attach(struct umass_softc *sc)
 static void
 umass_cam_detach_sim(struct umass_softc *sc)
 {
+   cam_status status;
+
if (sc->sc_sim != NULL) {
-   if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) {
+   status = xpt_bus_deregister(cam_sim_path(sc->sc_sim));
+   if (status == CAM_REQ_CMP) {
/* accessing the softc is not possible after this */
sc->sc_sim->softc = NULL;
+   DPRINTF(sc, UDMASS_SCSI, "%s: %s:%d:%d caling "
+   "cam_sim_free sim %p refc %u mtx %p\n",
+   __func__, sc->sc_name, cam_sim_path(sc->sc_sim),
+   sc->sc_unit, sc->sc_sim,
+   sc->sc_sim->refcount, sc->sc_sim->mtx);
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
} else {
-   panic("%s: CAM layer is busy\n",
-   sc->sc_name);
+   panic("%s: %s: CAM layer is busy: %#x\n",
+   __func__, sc->sc_name, status);
}
sc->sc_sim = NULL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367369 - stable/12/sys/dev/usb/storage

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 11:33:23 2020
New Revision: 367369
URL: https://svnweb.freebsd.org/changeset/base/367369

Log:
  MFC r365334:
  
umass: fix a cam_sim leak in error case
  
While debugging a hang I noticed that in case of error in
umass_cam_attach_sim() we miss a cam_sim_free() call.
Added that to not leak resources.

Modified:
  stable/12/sys/dev/usb/storage/umass.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/storage/umass.c
==
--- stable/12/sys/dev/usb/storage/umass.c   Thu Nov  5 11:24:45 2020
(r367368)
+++ stable/12/sys/dev/usb/storage/umass.c   Thu Nov  5 11:33:23 2020
(r367369)
@@ -2105,6 +2105,7 @@ umass_cam_attach_sim(struct umass_softc *sc)
 
if (xpt_bus_register(sc->sc_sim, sc->sc_dev,
sc->sc_unit) != CAM_SUCCESS) {
+   cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
mtx_unlock(>sc_mtx);
return (ENOMEM);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367367 - stable/12/sys/cam

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 11:19:31 2020
New Revision: 367367
URL: https://svnweb.freebsd.org/changeset/base/367367

Log:
  MFC r365333:
  
cam_sim: harmonize code related to acquiring a mtx
  
cam_sim_free(), cam_sim_release(), and cam_sim_hold() all assign
a mtx variable during declaration and then if NULL or the mtx is
held may re-asign the variable and/or acquire/release a lock.
  
Harmonize the code, avoiding double assignments and make it look
the same for all three function (with cam_sim_free() not needing
an extra case).
  
No functional changes intended.

Modified:
  stable/12/sys/cam/cam_sim.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/cam_sim.c
==
--- stable/12/sys/cam/cam_sim.c Thu Nov  5 11:11:50 2020(r367366)
+++ stable/12/sys/cam/cam_sim.c Thu Nov  5 11:19:31 2020(r367367)
@@ -103,14 +103,15 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_fun
 void
 cam_sim_free(struct cam_sim *sim, int free_devq)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
int error;
 
-   if (mtx) {
-   mtx_assert(mtx, MA_OWNED);
-   } else {
+   if (sim->mtx == NULL) {
mtx = _sim_free_mtx;
mtx_lock(mtx);
+   } else {
+   mtx = sim->mtx;
+   mtx_assert(mtx, MA_OWNED);
}
sim->refcount--;
if (sim->refcount > 0) {
@@ -118,7 +119,7 @@ cam_sim_free(struct cam_sim *sim, int free_devq)
KASSERT(error == 0, ("invalid error value for msleep(9)"));
}
KASSERT(sim->refcount == 0, ("sim->refcount == 0"));
-   if (sim->mtx == NULL)
+   if (mtx == _sim_free_mtx)   /* sim->mtx == NULL */
mtx_unlock(mtx);
 
if (free_devq)
@@ -129,17 +130,16 @@ cam_sim_free(struct cam_sim *sim, int free_devq)
 void
 cam_sim_release(struct cam_sim *sim)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
 
-   if (mtx) {
-   if (!mtx_owned(mtx))
-   mtx_lock(mtx);
-   else
-   mtx = NULL;
-   } else {
+   if (sim->mtx == NULL)
mtx = _sim_free_mtx;
+   else if (!mtx_owned(sim->mtx))
+   mtx = sim->mtx;
+   else
+   mtx = NULL; /* We hold the lock. */
+   if (mtx)
mtx_lock(mtx);
-   }
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
sim->refcount--;
if (sim->refcount == 0)
@@ -151,17 +151,16 @@ cam_sim_release(struct cam_sim *sim)
 void
 cam_sim_hold(struct cam_sim *sim)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
 
-   if (mtx) {
-   if (!mtx_owned(mtx))
-   mtx_lock(mtx);
-   else
-   mtx = NULL;
-   } else {
+   if (sim->mtx == NULL)
mtx = _sim_free_mtx;
+   else if (!mtx_owned(sim->mtx))
+   mtx = sim->mtx;
+   else
+   mtx = NULL; /* We hold the lock. */
+   if (mtx)
mtx_lock(mtx);
-   }
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
sim->refcount++;
if (mtx)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367366 - stable/12/sys/net

2020-11-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  5 11:11:50 2020
New Revision: 367366
URL: https://svnweb.freebsd.org/changeset/base/367366

Log:
  MFC r364305:
  
For consistency and to avoid any problems getting past the 31bit
boundry change the last two IF_Mbps(2500) and additionally one
IF_Mbps(5000) to ULL as well.

Modified:
  stable/12/sys/net/if_media.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_media.h
==
--- stable/12/sys/net/if_media.hThu Nov  5 09:55:55 2020
(r367365)
+++ stable/12/sys/net/if_media.hThu Nov  5 11:11:50 2020
(r367366)
@@ -807,9 +807,9 @@ struct ifmedia_baudrate {
{ IFM_ETHER | IFM_10G_KR,   IF_Gbps(10ULL) },   \
{ IFM_ETHER | IFM_10G_CR1,  IF_Gbps(10ULL) },   \
{ IFM_ETHER | IFM_20G_KR2,  IF_Gbps(20ULL) },   \
-   { IFM_ETHER | IFM_2500_KX,  IF_Mbps(2500) },\
-   { IFM_ETHER | IFM_2500_T,   IF_Mbps(2500) },\
-   { IFM_ETHER | IFM_5000_T,   IF_Mbps(5000) },\
+   { IFM_ETHER | IFM_2500_KX,  IF_Mbps(2500ULL) }, \
+   { IFM_ETHER | IFM_2500_T,   IF_Mbps(2500ULL) }, \
+   { IFM_ETHER | IFM_5000_T,   IF_Mbps(5000ULL) }, \
{ IFM_ETHER | IFM_50G_PCIE, IF_Gbps(50ULL) },   \
{ IFM_ETHER | IFM_25G_PCIE, IF_Gbps(25ULL) },   \
{ IFM_ETHER | IFM_1000_SGMII,   IF_Mbps(1000) },\
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367327 - head/sys/arm64/arm64

2020-11-04 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Nov  4 12:11:50 2020
New Revision: 367327
URL: https://svnweb.freebsd.org/changeset/base/367327

Log:
  arm64: implement bs_sr_
  
  Implement the bs_sr_ generic functions based on the generic
  mips implementation calling the generic bs_w_ functions in a loop.
  
  ral(4) (rt2860.c) panics in RAL_SET_REGION_4() because bs_sr_4()
  is NULL.  It seems ral(4) and ti(4) might be the only consumers of
  these functions I could find quickly so keeping them in C rather than asm.
  
  Reported by:  Steve Wheeler (https://redmine.pfsense.org/issues/11021)
  Reviewed by:  mmel
  MFC after:3 days

Modified:
  head/sys/arm64/arm64/bus_machdep.c

Modified: head/sys/arm64/arm64/bus_machdep.c
==
--- head/sys/arm64/arm64/bus_machdep.c  Wed Nov  4 12:07:33 2020
(r367326)
+++ head/sys/arm64/arm64/bus_machdep.c  Wed Nov  4 12:11:50 2020
(r367327)
@@ -128,6 +128,50 @@ generic_bs_subregion(void *t, bus_space_handle_t bsh, 
return (0);
 }
 
+/*
+ * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
+ * by tag/handle starting at `offset'.
+ */
+static void
+generic_bs_sr_1(void *t, bus_space_handle_t bsh,
+bus_size_t offset, uint8_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr++)
+   generic_bs_w_1(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_2(void *t, bus_space_handle_t bsh,
+  bus_size_t offset, uint16_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 2)
+   generic_bs_w_2(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_4(void *t, bus_space_handle_t bsh,
+bus_size_t offset, uint32_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 4)
+   generic_bs_w_4(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
+uint64_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 8)
+   generic_bs_w_8(t, bsh, addr, value);
+}
+
 struct bus_space memmap_bus = {
/* cookie */
.bs_cookie = NULL,
@@ -187,10 +231,10 @@ struct bus_space memmap_bus = {
.bs_sm_8 = NULL,
 
/* set region */
-   .bs_sr_1 = NULL,
-   .bs_sr_2 = NULL,
-   .bs_sr_4 = NULL,
-   .bs_sr_8 = NULL,
+   .bs_sr_1 =  generic_bs_sr_1,
+   .bs_sr_2 =  generic_bs_sr_2,
+   .bs_sr_4 =  generic_bs_sr_4,
+   .bs_sr_8 =  generic_bs_sr_8,
 
/* copy */
.bs_c_1 = NULL,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367326 - head/sys/net80211

2020-11-04 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Nov  4 12:07:33 2020
New Revision: 367326
URL: https://svnweb.freebsd.org/changeset/base/367326

Log:
  net80211: fix a typo
  
  Correct a typo referring to the wrong flags in a comment.
  No functional changes.
  
  MFC after:3 days
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net80211/_ieee80211.h

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Wed Nov  4 11:48:08 2020
(r367325)
+++ head/sys/net80211/_ieee80211.h  Wed Nov  4 12:07:33 2020
(r367326)
@@ -619,7 +619,7 @@ struct ieee80211_rx_stats {
} evm;
 
/* 32 bits */
-   uint8_t c_phytype;  /* PHY type, FW flags above */
+   uint8_t c_phytype;  /* PHY type, FP flags above */
uint8_t c_vhtnss;   /* VHT - number of spatial streams */
uint8_t c_pad2[2];
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366817 - head/sys/net80211

2020-10-18 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Oct 18 21:34:04 2020
New Revision: 366817
URL: https://svnweb.freebsd.org/changeset/base/366817

Log:
  net80211: factor out the priv(9) checks into OS specifc code.
  
  Factor out the priv(9) checks into OS specifc code so other OSes can equally
  implement them.  This sorts out those XXX in the net80211 code.
  We provide 3 arguments (cmd, vap, ifp) where available to the functions, in
  order to allow other OSes to use that data but also in case we'd add auditing
  to these check to have the information available. For now the arguments are
  marked __unused.
  
  PR:   249403
  Reported by:  martin(NetBSD)
  Reviewed by:  adrian, martin(NetBSD)
  MFC after:10 days
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26541

Modified:
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_freebsd.h
  head/sys/net80211/ieee80211_ioctl.c

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Sun Oct 18 20:54:15 2020
(r366816)
+++ head/sys/net80211/ieee80211_freebsd.c   Sun Oct 18 21:34:04 2020
(r366817)
@@ -75,6 +75,42 @@ SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, 
 static const char wlanname[] = "wlan";
 static struct if_clone *wlan_cloner;
 
+/*
+ * priv(9) NET80211 checks.
+ * Return 0 if operation is allowed, E* (usually EPERM) otherwise.
+ */
+int
+ieee80211_priv_check_vap_getkey(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_GETKEY));
+}
+
+int
+ieee80211_priv_check_vap_manage(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_MANAGE));
+}
+
+int
+ieee80211_priv_check_vap_setmac(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_SETMAC));
+}
+
+int
+ieee80211_priv_check_create_vap(u_long cmd __unused,
+struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_CREATE_VAP));
+}
+
 static int
 wlan_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
@@ -83,7 +119,7 @@ wlan_clone_create(struct if_clone *ifc, int unit, cadd
struct ieee80211com *ic;
int error;
 
-   error = priv_check(curthread, PRIV_NET80211_CREATE_VAP);
+   error = ieee80211_priv_check_create_vap(0, NULL, NULL);
if (error)
return error;
 

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Sun Oct 18 20:54:15 2020
(r366816)
+++ head/sys/net80211/ieee80211_freebsd.h   Sun Oct 18 21:34:04 2020
(r366817)
@@ -43,6 +43,19 @@
 #include 
 
 /*
+ * priv(9) NET80211 checks.
+ */
+struct ieee80211vap;
+int ieee80211_priv_check_vap_getkey(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_vap_manage(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_vap_setmac(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_create_vap(u_long, struct ieee80211vap *,
+struct ifnet *);
+
+/*
  * Common state locking definitions.
  */
 typedef struct {

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Sun Oct 18 20:54:15 2020
(r366816)
+++ head/sys/net80211/ieee80211_ioctl.c Sun Oct 18 21:34:04 2020
(r366817)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -72,7 +71,8 @@ static int ieee80211_scanreq(struct ieee80211vap *,
struct ieee80211_scan_req *);
 
 static int
-ieee80211_ioctl_getkey(struct ieee80211vap *vap, struct ieee80211req *ireq)
+ieee80211_ioctl_getkey(u_long cmd, struct ieee80211vap *vap,
+struct ieee80211req *ireq)
 {
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_node *ni;
@@ -106,8 +106,7 @@ ieee80211_ioctl_getkey(struct ieee80211vap *vap, struc
ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV);
if (wk->wk_keyix == vap->iv_def_txkey)
ik.ik_flags |= IEEE80211_KEY_DEFAULT;
-   /* XXX TODO: move priv check to ieee80211_freebsd.c */
-   if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) {
+   if (ieee80211_priv_check_vap_getkey(cmd, vap, NULL) == 0) {
/* NB: only root can read key data */
ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID];
ik.ik_keytsc = wk->wk_keytsc;
@@ -822,8 

svn commit: r366800 - in head: sbin/ifconfig sys/net80211

2020-10-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Oct 18 00:27:20 2020
New Revision: 366800
URL: https://svnweb.freebsd.org/changeset/base/366800

Log:
  net80211: update for (more) VHT160 support
  
  Implement two macros IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ()
  and its 80+80 counter part to check in vhtcaps for appropriate
  levels of support and use the macros throughout the code.
  
  Add vht160_chan_ranges/is_vht160_valid_freq and handle analogue
  to vht80 in various parts of the code.
  
  Add ieee80211_add_channel_cbw() which also takes the CBW flag
  fields and make the former ieee80211_add_channel() a wrapper to it.
  With the CBW flags we can add HT/VHT channels passing them to
  getflags() for the 2/5ghz functions.
  
  In ifconfig(8) add the regdomain_addchans() support for VHT160
  and VHT80P80.
  
  With this (+ regdoain.xml updates) VHT160 channels can be
  configured, listed, and pass regdomain where appropriate.
  
  Tested with:  iwlwifi
  Reviewed by:  adrian
  MFC after:10 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26712

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211.h
  head/sys/net80211/ieee80211_regdomain.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cSat Oct 17 23:42:33 2020
(r366799)
+++ head/sbin/ifconfig/ifieee80211.cSun Oct 18 00:27:20 2020
(r366800)
@@ -2405,7 +2405,31 @@ regdomain_makechannels(
>dc_chaninfo);
}
 
-   /* XXX TODO: VHT80P80, VHT160 */
+   /* VHT160 */
+   if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ(
+   dc->dc_vhtcaps)) {
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
+   IEEE80211_CHAN_VHT160,
+   >dc_chaninfo);
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
+   IEEE80211_CHAN_VHT160,
+   >dc_chaninfo);
+   }
+
+   /* VHT80P80 */
+   if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ(
+   dc->dc_vhtcaps)) {
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
+   IEEE80211_CHAN_VHT80P80,
+   >dc_chaninfo);
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
+   IEEE80211_CHAN_VHT80P80,
+   >dc_chaninfo);
+   }
}
 
if (!LIST_EMPTY(>bands_11ng) && dc->dc_htcaps != 0) {

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Sat Oct 17 23:42:33 2020
(r366799)
+++ head/sys/net80211/ieee80211.c   Sun Oct 18 00:27:20 2020
(r366800)
@@ -1163,6 +1163,12 @@ struct vht_chan_range vht80_chan_ranges[] = {
{ 0, 0 }
 };
 
+struct vht_chan_range vht160_chan_ranges[] = {
+   { 5170, 5330 },
+   { 5490, 5650 },
+   { 0, 0 }
+};
+
 static int
 set_vht_extchan(struct ieee80211_channel *c)
 {
@@ -1177,8 +1183,24 @@ set_vht_extchan(struct ieee80211_channel *c)
}
 
if (IEEE80211_IS_CHAN_VHT160(c)) {
-   printf("%s: TODO VHT160 channel (ieee=%d, flags=0x%08x)\n",
-   __func__, c->ic_ieee, c->ic_flags);
+   for (i = 0; vht160_chan_ranges[i].freq_start != 0; i++) {
+   if (c->ic_freq >= vht160_chan_ranges[i].freq_start &&
+   c->ic_freq < vht160_chan_ranges[i].freq_end) {
+   int midpoint;
+
+   midpoint = vht160_chan_ranges[i].freq_start + 
80;
+   c->ic_vht_ch_freq1 =
+   ieee80211_mhz2ieee(midpoint, c->ic_flags);
+   c->ic_vht_ch_freq2 = 0;
+#if 0
+   printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, 
freq2=%d\n",
+   __func__, c->ic_ieee, c->ic_freq, midpoint,
+   c->ic_vht_ch_freq1, c->ic_vht_ch_freq2);
+#endif
+   return (1);
+

svn commit: r366799 - head/sys/dev/extres/clk

2020-10-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Oct 17 23:42:33 2020
New Revision: 366799
URL: https://svnweb.freebsd.org/changeset/base/366799

Log:
  clk: fix indentation
  
  Just fix indentation of an if() clause.
  No functional changes intended.
  
  MFC after:3 days

Modified:
  head/sys/dev/extres/clk/clk.c

Modified: head/sys/dev/extres/clk/clk.c
==
--- head/sys/dev/extres/clk/clk.c   Sat Oct 17 22:47:08 2020
(r366798)
+++ head/sys/dev/extres/clk/clk.c   Sat Oct 17 23:42:33 2020
(r366799)
@@ -544,7 +544,7 @@ clknode_create(struct clkdom * clkdom, clknode_class_t
CLK_TOPO_SLOCK();
clknode = clknode_find_by_name(def->name);
CLK_TOPO_UNLOCK();
-   if (clknode !=  NULL) {
+   if (clknode !=  NULL) {
if (!(clknode->flags & CLK_NODE_LINKED) &&
def->flags & CLK_NODE_LINKED) {
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366798 - head/sys/kern

2020-10-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Oct 17 22:47:08 2020
New Revision: 366798
URL: https://svnweb.freebsd.org/changeset/base/366798

Log:
  ddb: add show sysinit command
  
  Add a show sysinit command to ddb (similar to show vnet_sysinit) which
  proved to be helpful to debug some ordering issues on early-mid kernel
  start panics.

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Sat Oct 17 21:30:46 2020(r366797)
+++ head/sys/kern/init_main.c   Sat Oct 17 22:47:08 2020(r366798)
@@ -47,6 +47,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_ddb.h"
+#include "opt_kdb.h"
 #include "opt_init_path.h"
 #include "opt_verbose_sysinit.h"
 
@@ -838,3 +839,51 @@ kick_init(const void *udata __unused)
sched_add(td, SRQ_BORING);
 }
 SYSINIT(kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE, kick_init, NULL);
+
+/*
+ * DDB(4).
+ */
+#ifdef DDB
+static void
+db_show_print_syinit(struct sysinit *sip, bool ddb)
+{
+   const char *sname, *funcname;
+   c_db_sym_t sym;
+   db_expr_t  offset;
+
+#define xprint(...)\
+   if (ddb)\
+   db_printf(__VA_ARGS__); \
+   else\
+   printf(__VA_ARGS__)
+
+   if (sip == NULL) {
+   xprint("%s: no sysinit * given\n", __func__);
+   return;
+   }
+
+   sym = db_search_symbol((vm_offset_t)sip, DB_STGY_ANY, );
+   db_symbol_values(sym, , NULL);
+   sym = db_search_symbol((vm_offset_t)sip->func, DB_STGY_PROC, );
+   db_symbol_values(sym, , NULL);
+   xprint("%s(%p)\n", (sname != NULL) ? sname : "", sip);
+   xprint("  %#08x %#08x\n", sip->subsystem, sip->order);
+   xprint("  %p(%s)(%p)\n",
+   sip->func, (funcname != NULL) ? funcname : "", sip->udata);
+#undef xprint
+}
+
+DB_SHOW_COMMAND(sysinit, db_show_sysinit)
+{
+   struct sysinit **sipp;
+
+   db_printf("SYSINIT vs Name(Ptr)\n");
+   db_printf("  Subsystem  Order\n");
+   db_printf("  Function(Name)(Arg)\n");
+   for (sipp = sysinit; sipp < sysinit_end; sipp++) {
+   db_show_print_syinit(*sipp, true);
+   if (db_pager_quit)
+   break;
+   }
+}
+#endif /* DDB */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf

2020-10-17 Thread Bjoern A. Zeeb

On 17 Oct 2020, at 20:48, Sean Bruno wrote:


Same buildfailure with GENERIC-NODEBUG.


Seems different.



https://people.freebsd.org/~sbruno/backlight.txt


HEAD with which version of the drm port/package?

/bz


sbruno@alice:~ % pkg info |grep kmod
drm-current-kmod-4.16.g20200320 DRM modules for the linuxkpi-based KMS
components
drm-kmod-g20190710 Metaport of DRM modules for the
linuxkpi-based KMS components
gpu-firmware-kmod-g20200503Firmware modules for the linuxkpi-based
KMS components


You may want to have to update this to recent and try again;  if that 
still breaks I assume either Hans or I will be happy to help until manu 
is back.


I’d assume with more linuxkpi bits implemented in HEAD the conflicts 
in head will stay … and port/package updates will have to happen once 
in a while (*).


https://svnweb.freebsd.org/base?view=revision=366374
https://svnweb.freebsd.org/ports?view=revision=551266

/bz

(*) manu is making sure that after the commit to head the new port keeps 
compiling with older kernels for a while using __FreeBSD_version; I may 
have a partial solution that might allow us to update the port first but 
neither won’t help with old ports like in this case.


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


Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf

2020-10-17 Thread Bjoern A. Zeeb

On 17 Oct 2020, at 20:14, Sean Bruno wrote:


On 2020-10-17 05:27, Alexander V. Chernikov wrote:

02.10.2020, 19:26, "Emmanuel Vadot" :

Author: manu
Date: Fri Oct 2 18:26:41 2020
New Revision: 366372
URL: https://svnweb.freebsd.org/changeset/base/366372

Log:
  linuxkpi: Add backlight support
  
  Add backlight function to linuxkpi.
  Graphics drivers expose the backlight of the panel directly 
so

allow them to use the backlight subsystem so
  user can use backlight(8) to configure them.
  
  Reviewed by: hselasky
  Relnotes: yes
  Differential Revision: The FreeBSD Foundation

Added:
  head/sys/compat/linuxkpi/common/include/linux/backlight.h
(contents, props changed)
Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h
  head/sys/compat/linuxkpi/common/src/linux_kmod.c
  head/sys/compat/linuxkpi/common/src/linux_pci.c
  head/sys/conf/kmod.mk

It breaks the build for me with
 
/usr/home/melifaro/free/head/sys/compat/linuxkpi/common/src/linux_pci.c:70:10:
fatal error: 'backlight_if.h' file not found




Same buildfailure with GENERIC-NODEBUG.


Seems different.



https://people.freebsd.org/~sbruno/backlight.txt


HEAD with which version of the drm port/package?

/bz


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


svn commit: r366623 - head/sys/netinet

2020-10-10 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Oct 11 00:01:00 2020
New Revision: 366623
URL: https://svnweb.freebsd.org/changeset/base/366623

Log:
  ip_mroute: fix the viftable export sysctl
  
  It seems that in r354857 I got more than one thing wrong.
  Convert the SYSCTL_OPAQUE to a SYSCTL_PROC to properly export the these
  days allocated and not longer static per-vnet viftable array.
  This fixes a problem with netstat -g which would show bogus information
  for the IPv4 Virtual Interface Table.
  
  PR:   246626
  Reported by:  Ozkan KIRIK (ozkan.kirik gmail.com)
  MFC after:3 days

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cSat Oct 10 21:52:00 2020
(r366622)
+++ head/sys/netinet/ip_mroute.cSun Oct 11 00:01:00 2020
(r366623)
@@ -181,13 +181,6 @@ VNET_DEFINE_STATIC(vifi_t, numvifs);
 #defineV_numvifs   VNET(numvifs)
 VNET_DEFINE_STATIC(struct vif *, viftable);
 #defineV_viftable  VNET(viftable)
-/*
- * No one should be able to "query" this before initialisation happened in
- * vnet_mroute_init(), so we should still be fine.
- */
-SYSCTL_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_VNET | CTLFLAG_RD,
-_NAME(viftable), sizeof(*V_viftable) * MAXVIFS, "S,vif[MAXVIFS]",
-"IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)");
 
 static struct mtx vif_mtx;
 #defineVIF_LOCK()  mtx_lock(_mtx)
@@ -2805,6 +2798,30 @@ static SYSCTL_NODE(_net_inet_ip, OID_AUTO, mfctable,
 CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_mfctable,
 "IPv4 Multicast Forwarding Table "
 "(struct *mfc[mfchashsize], netinet/ip_mroute.h)");
+
+static int
+sysctl_viflist(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+
+   if (req->newptr)
+   return (EPERM);
+   if (V_viftable == NULL) /* XXX unlocked */
+   return (0);
+   error = sysctl_wire_old_buffer(req, sizeof(*V_viftable) * MAXVIFS);
+   if (error)
+   return (error);
+
+   VIF_LOCK();
+   error = SYSCTL_OUT(req, V_viftable, sizeof(*V_viftable) * MAXVIFS);
+   VIF_UNLOCK();
+   return (error);
+}
+
+SYSCTL_PROC(_net_inet_ip, OID_AUTO, viftable,
+CTLTYPE_OPAQUE | CTLFLAG_VNET | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
+sysctl_viflist, "S,vif[MAXVIFS]",
+"IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)");
 
 static void
 vnet_mroute_init(const void *unused __unused)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366525 - head/sys/net80211

2020-10-07 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct  7 22:52:24 2020
New Revision: 366525
URL: https://svnweb.freebsd.org/changeset/base/366525

Log:
  net80211: whitespace
  
  Fix indentation for the multi-line copies of
  ieee80211_add_channel_list_5ghz() for the 3 bands.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/net80211/ieee80211_regdomain.c

Modified: head/sys/net80211/ieee80211_regdomain.c
==
--- head/sys/net80211/ieee80211_regdomain.c Wed Oct  7 22:29:26 2020
(r366524)
+++ head/sys/net80211/ieee80211_regdomain.c Wed Oct  7 22:52:24 2020
(r366525)
@@ -158,14 +158,14 @@ ieee80211_init_channels(struct ieee80211com *ic,
IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2)
cbw_flags |= NET80211_CBW_FLAG_VHT80P80;
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
-  nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
-  bands, cbw_flags);
+   nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
+   bands, cbw_flags);
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
nchans, def_chan_5ghz_band2, nitems(def_chan_5ghz_band2),
-  bands, cbw_flags);
+   bands, cbw_flags);
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
nchans, def_chan_5ghz_band3, nitems(def_chan_5ghz_band3),
-  bands, cbw_flags);
+   bands, cbw_flags);
}
if (rd != NULL)
ic->ic_regdomain = *rd;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366524 - head/sbin/ifconfig

2020-10-07 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct  7 22:29:26 2020
New Revision: 366524
URL: https://svnweb.freebsd.org/changeset/base/366524

Log:
  80211: ifconfig replace MS() with _IEEE80211_MASKSHIFT()
  
  As we did in the kernel in r366112 replace the MS() macro with the version(s)
  added to the kernel: _IEEE80211_MASKSHIFT().  Also provide its counter part.
  This will later allow use to use other macros defined in net80211 headers
  here in ifconfig.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cWed Oct  7 22:07:26 2020
(r366523)
+++ head/sbin/ifconfig/ifieee80211.cWed Oct  7 22:29:26 2020
(r366524)
@@ -138,6 +138,14 @@
 #defineIEEE80211_FVHT_USEVHT80P80 0x00010  /* CONF: Use VHT 80+80 
*/
 #endif
 
+/* Helper macros unified. */
+#ifndef_IEEE80211_MASKSHIFT
+#define_IEEE80211_MASKSHIFT(_v, _f)(((_v) & _f) >> _f##_S)
+#endif
+#ifndef_IEEE80211_SHIFTMASK
+#define_IEEE80211_SHIFTMASK(_v, _f)(((_v) << _f##_S) & _f)
+#endif
+
 #defineMAXCHAN 1536/* max 1.5K channels */
 
 #defineMAXCOL  78
@@ -2706,7 +2714,6 @@ printie(const char* tag, const uint8_t *ie, size_t iel
 static void
 printwmeparam(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 {
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
static const char *acnames[] = { "BE", "BK", "VO", "VI" };
const struct ieee80211_wme_param *wme =
(const struct ieee80211_wme_param *) ie;
@@ -2721,17 +2728,17 @@ printwmeparam(const char *tag, const u_int8_t *ie, siz
const struct ieee80211_wme_acparams *ac =
>params_acParams[i];
 
-   printf(" %s[%saifsn %u cwmin %u cwmax %u txop %u]"
-   , acnames[i]
-   , MS(ac->acp_aci_aifsn, WME_PARAM_ACM) ? "acm " : ""
-   , MS(ac->acp_aci_aifsn, WME_PARAM_AIFSN)
-   , MS(ac->acp_logcwminmax, WME_PARAM_LOGCWMIN)
-   , MS(ac->acp_logcwminmax, WME_PARAM_LOGCWMAX)
-   , LE_READ_2(>acp_txop)
-   );
+   printf(" %s[%saifsn %u cwmin %u cwmax %u txop %u]", acnames[i],
+   _IEEE80211_MASKSHIFT(ac->acp_aci_aifsn, WME_PARAM_ACM) ?
+   "acm " : "",
+   _IEEE80211_MASKSHIFT(ac->acp_aci_aifsn, WME_PARAM_AIFSN),
+   _IEEE80211_MASKSHIFT(ac->acp_logcwminmax,
+   WME_PARAM_LOGCWMIN),
+   _IEEE80211_MASKSHIFT(ac->acp_logcwminmax,
+   WME_PARAM_LOGCWMAX),
+   LE_READ_2(>acp_txop));
}
printf(">");
-#undef MS
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366523 - head/sys/compat/linuxkpi/common/include/linux

2020-10-07 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct  7 22:07:26 2020
New Revision: 366523
URL: https://svnweb.freebsd.org/changeset/base/366523

Log:
  LinuxKPI: add a bitfield.h implementation.
  
  This code was iteratively implemented during the work on various WiFi
  drivers -- from individual functions to a macro-created implementations
  for the various bit sized needed (and then extended to more for
  comepleteness). Some of the bit combinations do not seem to make sense
  so are left out.
  
  The __bf_shf(x) was obtained from D26681 [1].
  
  Requested by: manu [1]
  Reviewed by:  hselasky, manu
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26708

Added:
  head/sys/compat/linuxkpi/common/include/linux/bitfield.h   (contents, props 
changed)

Added: head/sys/compat/linuxkpi/common/include/linux/bitfield.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/bitfield.hWed Oct  7 
22:07:26 2020(r366523)
@@ -0,0 +1,105 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020 The FreeBSD Foundation
+ *
+ * This software was developed by Björn Zeeb under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef_LINUX_BITFIELD_H
+#define_LINUX_BITFIELD_H
+
+#include 
+#include 
+
+/* Use largest possible type. */
+static inline uint64_t ___lsb(uint64_t f) { return (f & -f); }
+static inline uint64_t ___bitmask(uint64_t f) { return (f / ___lsb(f)); }
+
+#define_uX_get_bits(_n)
\
+   static __inline uint ## _n ## _t\
+   u ## _n ## _get_bits(uint ## _n ## _t v, uint ## _n ## _t f)\
+   {   \
+   return ((v & f) / ___lsb(f));   \
+   }
+
+_uX_get_bits(64)
+_uX_get_bits(32)
+_uX_get_bits(16)
+_uX_get_bits(8)
+
+#define_leX_get_bits(_n)   
\
+   static __inline uint ## _n ## _t\
+   le ## _n ## _get_bits(__le ## _n v, uint ## _n ## _t f) \
+   {   \
+   return ((le ## _n ## _to_cpu(v) & f) / ___lsb(f));  \
+   }
+
+_leX_get_bits(64)
+_leX_get_bits(32)
+_leX_get_bits(16)
+
+#define_uX_encode_bits(_n) 
\
+   static __inline uint ## _n ## _t\
+   u ## _n ## _encode_bits(uint ## _n ## _t v, uint ## _n ## _t f) \
+   {   \
+   return ((v & ___bitmask(f)) * ___lsb(f));   \
+   }
+
+_uX_encode_bits(64)
+_uX_encode_bits(32)
+_uX_encode_bits(16)
+_uX_encode_bits(8)
+
+#define_leX_encode_bits(_n)
\
+   static __inline uint ## _n ## _t\
+   le ## _n ## _encode_bits(__le ## _n v, uint ## _n ## _t f)\
+   {   \
+   return (cpu_to_le ## _n((v & ___bitmask(f)) * ___lsb(f))); \
+   }
+
+_leX_encode_bits(64)
+_leX_encode_bits(32)
+_leX_encode_bits(16)
+
+static __inline void
+le32p_replace_bits(uint32_t *p, uint32_t v, uint32_t f)
+{
+
+   *p = (*p & ~(cpu_to_le32(v))) | le32_encode_bits(v, f);
+   return;
+}
+

svn commit: r366522 - in head: lib/lib80211 sbin/ifconfig sys/net80211

2020-10-07 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct  7 21:56:58 2020
New Revision: 366522
URL: https://svnweb.freebsd.org/changeset/base/366522

Log:
  80211: non-functional changes
  
  Sort a few VHT160 and 80+80 lines, update some comments, and remove
  a superfluous ','.
  
  No functional changes intended.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/lib80211/lib80211_regdomain.c
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_node.h

Modified: head/lib/lib80211/lib80211_regdomain.c
==
--- head/lib/lib80211/lib80211_regdomain.c  Wed Oct  7 20:31:13 2020
(r366521)
+++ head/lib/lib80211/lib80211_regdomain.c  Wed Oct  7 21:56:58 2020
(r366522)
@@ -191,11 +191,11 @@ decode_flag(struct mystate *mt, const char *p, int len
FLAG(IEEE80211_CHAN_VHT20),
FLAG(IEEE80211_CHAN_VHT40),
FLAG(IEEE80211_CHAN_VHT80),
+   FLAG(IEEE80211_CHAN_VHT160),
/*
 * XXX VHT80P80? This likely should be done by
 * 80MHz chan logic in net80211 / ifconfig.
 */
-   FLAG(IEEE80211_CHAN_VHT160),
FLAG(IEEE80211_CHAN_ST),
FLAG(IEEE80211_CHAN_TURBO),
FLAG(IEEE80211_CHAN_PASSIVE),

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cWed Oct  7 20:31:13 2020
(r366521)
+++ head/sbin/ifconfig/ifieee80211.cWed Oct  7 21:56:58 2020
(r366522)
@@ -2385,8 +2385,7 @@ regdomain_makechannels(
>dc_chaninfo);
}
 
-   /* VHT80 */
-   /* XXX dc_vhtcap? */
+   /* VHT80 is mandatory (and so should be VHT40 above). */
if (1) {
regdomain_addchans(ci, >bands_11ac, reg,
IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Wed Oct  7 20:31:13 2020
(r366521)
+++ head/sys/net80211/ieee80211.c   Wed Oct  7 21:56:58 2020
(r366522)
@@ -158,7 +158,7 @@ ieee80211_chan_init(struct ieee80211com *ic)
 
/*
 * Setup the HT40/VHT40 upper/lower bits.
-* The VHT80 math is done elsewhere.
+* The VHT80/... math is done elsewhere.
 */
if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0)
c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq +
@@ -167,8 +167,8 @@ ieee80211_chan_init(struct ieee80211com *ic)
 
/* Update VHT math */
/*
-* XXX VHT again, note that this assumes VHT80 channels
-* are legit already
+* XXX VHT again, note that this assumes VHT80/... channels
+* are legit already.
 */
set_vht_extchan(c);
 
@@ -712,8 +712,8 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_cha
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
-   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
+   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
IEEE80211_UNLOCK(ic);
 
return 1;
@@ -767,8 +767,8 @@ ieee80211_vap_detach(struct ieee80211vap *vap)
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
-   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
+   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
 
/* NB: this handles the bpfdetach done below */
ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF);
@@ -1160,7 +1160,7 @@ struct vht_chan_range vht80_chan_ranges[] = {
{ 5570, 5650 },
{ 5650, 5730 },
{ 5735, 5815 },
-   { 0, 0, }
+   { 0, 0 }
 };
 
 static int

Modified: head/sys/net80211/ieee80211_node.h
==
--- head/sys/net80211/ieee80211_node.h  Wed Oct  7 20:31:13 2020
(r366521)
+++ head/sys/net80211/ieee80211_node.h  Wed Oct  7 21:56:58 2020
(r366522)
@@ -70,7 +70,7 @@ struct ieee80211vap;
 struct ieee80211_scanparams;
 
 /*
- * Information element 

svn commit: r366268 - head/sys/dev/rtwn/usb

2020-09-29 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Sep 29 20:46:25 2020
New Revision: 366268
URL: https://svnweb.freebsd.org/changeset/base/366268

Log:
  rtwn: narrow the epoch area
  
  Rather than placing the epoch around the entire receive loop which
  might call into rtwn_rx_frame() and USB and sleep, split the loop
  into two[1] and leave us with one unlock/lock cycle as well.
  
  PR:   249925
  Reported by:  thj, (rkoberman gmail.com)
  Tested by:thj
  Suggested by: adrian [1]
  Reviewed by:  adrian
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation (initially, paniced my iwl lab host)
  Differential Revision:https://reviews.freebsd.org/D26554

Modified:
  head/sys/dev/rtwn/usb/rtwn_usb_rx.c

Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c
==
--- head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Sep 29 20:29:07 2020
(r366267)
+++ head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Sep 29 20:46:25 2020
(r366268)
@@ -368,7 +368,7 @@ rtwn_bulk_rx_callback(struct usb_xfer *xfer, usb_error
struct rtwn_softc *sc = >uc_sc;
struct ieee80211com *ic = >sc_ic;
struct ieee80211_node *ni;
-   struct mbuf *m = NULL, *next;
+   struct mbuf *m0, *m = NULL, *next;
struct rtwn_data *data;
 
RTWN_ASSERT_LOCKED(sc);
@@ -400,24 +400,30 @@ tr_setup:
 * ieee80211_input() because here is at the end of a USB
 * callback and safe to unlock.
 */
+   m0 = m;
+   while (m != NULL) {
+   M_ASSERTPKTHDR(m);
+   m->m_pkthdr.PH_loc.ptr = rtwn_rx_frame(sc, m);
+   m = m->m_nextpkt;
+   }
NET_EPOCH_ENTER(et);
+   RTWN_UNLOCK(sc);
+   m = m0;
while (m != NULL) {
next = m->m_nextpkt;
m->m_nextpkt = NULL;
 
-   ni = rtwn_rx_frame(sc, m);
-
-   RTWN_UNLOCK(sc);
-
+   ni = m->m_pkthdr.PH_loc.ptr;
+   m->m_pkthdr.PH_loc.ptr = NULL;
if (ni != NULL) {
(void)ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni);
} else {
(void)ieee80211_input_mimo_all(ic, m);
}
-   RTWN_LOCK(sc);
m = next;
}
+   RTWN_LOCK(sc);
NET_EPOCH_EXIT(et);
break;
default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r366196 - head/sys/arm64/conf

2020-09-27 Thread Bjoern A. Zeeb

On 27 Sep 2020, at 10:15, Michal Meloun wrote:


Author: mmel
Date: Sun Sep 27 10:15:03 2020
New Revision: 366196
URL: https://svnweb.freebsd.org/changeset/base/366196

Log:
  Add LINUX_BOOT_ABI back to arm64 GENERIC kernel.

  It was removed in r355289 but forgot to return it back when new 
u-boot booti
  support was committed.  Although booti is not the preferred method 
of
  booting the kernel, it is very useful for the initial phase of 
porting
  FreeBSD to a new platform or booting the kernel on various embedded 
boards

  in an industrial environment.


Seem this prevents (at least my) kernels to boot from loader.

Removing the option and rebuilding and the kernel booted.

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


svn commit: r366112 - in head/sys: dev/ath dev/bwn dev/iwn dev/malo dev/mwl net80211

2020-09-24 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Sep 24 10:57:39 2020
New Revision: 366112
URL: https://svnweb.freebsd.org/changeset/base/366112

Log:
  Provide MS() and SM() macros for 80211 and wireless drivers.
  
  We have (two versions) of MS() and SM() macros which we use throughout
  the wireless code.  Change all but three places (ath_hal, rtwn, and rsu)
  to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
  macros.  Also change one internal case using both _S and _M instead of
  just _S away from _M (one of the reasons rtwn and rsu were not changed).
  
  This was done semi-mechanically.  No functional changes intended.
  
  Requested by: gnn (D26091)
  Reviewed by:  adrian (pre line wrap)
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26539

Modified:
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx_ht.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/malo/if_malo.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_regdomain.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_superg.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cThu Sep 24 10:42:28 2020
(r366111)
+++ head/sys/dev/ath/if_ath_tx.cThu Sep 24 10:57:39 2020
(r366112)
@@ -2598,7 +2598,6 @@ ieee80211_is_action(struct ieee80211_frame *wh)
return 1;
 }
 
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
 /*
  * Return an alternate TID for ADDBA request frames.
  *
@@ -2637,11 +2636,10 @@ ath_tx_action_frame_override_queue(struct ath_softc *s
 
/* Extract TID, return it */
baparamset = le16toh(ia->rq_baparamset);
-   *tid = (int) MS(baparamset, IEEE80211_BAPS_TID);
+   *tid = (int) _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_TID);
 
return 1;
 }
-#undef MS
 
 /* Per-node software queue operations */
 

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==
--- head/sys/dev/ath/if_ath_tx_ht.c Thu Sep 24 10:42:28 2020
(r366111)
+++ head/sys/dev/ath/if_ath_tx_ht.c Thu Sep 24 10:57:39 2020
(r366112)
@@ -406,7 +406,6 @@ static int
 ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf,
 uint16_t pktlen, int is_first)
 {
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
const HAL_RATE_TABLE *rt = sc->sc_currates;
struct ieee80211_node *ni = first_bf->bf_node;
struct ieee80211vap *vap = ni->ni_vap;
@@ -421,7 +420,8 @@ ath_compute_num_delims(struct ath_softc *sc, struct at
/*
 * Get the advertised density from the node.
 */
-   peer_mpdudensity = MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
+   peer_mpdudensity =
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
 
/*
 * vap->iv_ampdu_density is a net80211 value, rather than the actual
@@ -528,7 +528,6 @@ ath_compute_num_delims(struct ath_softc *sc, struct at
__func__, pktlen, minlen, rix, rc, width, half_gi, ndelim);
 
return ndelim;
-#undef MS
 }
 
 /*
@@ -568,7 +567,6 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
 {
struct ieee80211vap *vap = ni->ni_vap;
 
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
int amin = ATH_AGGR_MAXSIZE;
int i;
 
@@ -583,8 +581,8 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
 * Check the HTCAP field for the maximum size the node has
 * negotiated.  If it's smaller than what we have, cap it there.
 */
-   amin = MIN(amin, ath_rx_ampdu_to_byte(MS(ni->ni_htparam,
-   IEEE80211_HTCAP_MAXRXAMPDU)));
+   amin = MIN(amin, ath_rx_ampdu_to_byte(
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU)));
 
for (i = 0; i < ATH_RC_NUM; i++) {
if (bf->bf_state.bfs_rc[i].tries == 0)
@@ -598,11 +596,10 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
__func__,
sc->sc_aggr_limit,
vap->iv_ampdu_limit,
-   MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
amin);
 
return amin;
-#undef MS
 }
 
 /*

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Thu Sep 24 10:42:28 2020(r366111)
+++ head/sys/dev/bwn/if_bwn.c   Thu Sep 24 10:57:39 2020(r366112)
@@ -2122,7 +2122,6 @@ bwn_stop(struct bwn_softc *sc)
 

Re: svn commit: r366042 - in head/stand: i386/zfsboot libsa

2020-09-23 Thread Bjoern A. Zeeb
On 23 Sep 2020, at 1:04, Warner Losh wrote:

>Ideally, we'd keep the cp /dev/null in the
>   build as a regression test,

Well or at least write a test case so that at least CI catches it.

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


svn commit: r365673 - in releng/12.2: sbin/rtsol usr.sbin/rtsold

2020-09-12 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Sep 12 21:50:25 2020
New Revision: 365673
URL: https://svnweb.freebsd.org/changeset/base/365673

Log:
  MFS r365630 (markj, bz)
  
 - Capsicumize rtsol(8) and rtsold(8).
 - Avoid relying on pollution from libcasper.h.
 - Add script for "M bit".
  
  Approved by:  re (gjb)

Added:
  releng/12.2/usr.sbin/rtsold/cap_llflags.c
 - copied unchanged from r365630, stable/12/usr.sbin/rtsold/cap_llflags.c
  releng/12.2/usr.sbin/rtsold/cap_script.c
 - copied unchanged from r365630, stable/12/usr.sbin/rtsold/cap_script.c
  releng/12.2/usr.sbin/rtsold/cap_sendmsg.c
 - copied unchanged from r365630, stable/12/usr.sbin/rtsold/cap_sendmsg.c
Deleted:
  releng/12.2/usr.sbin/rtsold/probe.c
Modified:
  releng/12.2/sbin/rtsol/Makefile
  releng/12.2/usr.sbin/rtsold/Makefile
  releng/12.2/usr.sbin/rtsold/dump.c
  releng/12.2/usr.sbin/rtsold/if.c
  releng/12.2/usr.sbin/rtsold/rtsock.c
  releng/12.2/usr.sbin/rtsold/rtsol.c
  releng/12.2/usr.sbin/rtsold/rtsold.8
  releng/12.2/usr.sbin/rtsold/rtsold.c
  releng/12.2/usr.sbin/rtsold/rtsold.h
Directory Properties:
  releng/12.2/   (props changed)

Modified: releng/12.2/sbin/rtsol/Makefile
==
--- releng/12.2/sbin/rtsol/Makefile Sat Sep 12 20:20:55 2020
(r365672)
+++ releng/12.2/sbin/rtsol/Makefile Sat Sep 12 21:50:25 2020
(r365673)
@@ -18,10 +18,24 @@
 
 PACKAGE=runtime
 PROG=  rtsol
-SRCS=  rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
+SRCS=  cap_llflags.c \
+   cap_script.c \
+   cap_sendmsg.c \
+   dump.c \
+   if.c \
+   rtsol.c \
+   rtsold.c \
+   rtsock.c
 MAN=
+LIBADD=util
 
-WARNS?=3
-CFLAGS+= -DSMALL
+.include 
+
+.if ${MK_DYNAMICROOT} == "no"
+.warning ${PROG} built without libcasper support
+.elif ${MK_CASPER} != "no" && !defined(RESCUE)
+CFLAGS+= -DWITH_CASPER
+LIBADD+= cap_syslog casper nv
+.endif
 
 .include 

Modified: releng/12.2/usr.sbin/rtsold/Makefile
==
--- releng/12.2/usr.sbin/rtsold/MakefileSat Sep 12 20:20:55 2020
(r365672)
+++ releng/12.2/usr.sbin/rtsold/MakefileSat Sep 12 21:50:25 2020
(r365673)
@@ -17,8 +17,22 @@
 PROG=  rtsold
 MAN=   rtsold.8
 MLINKS=rtsold.8 rtsol.8
-SRCS=  rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
+SRCS=  cap_llflags.c \
+   cap_script.c \
+   cap_sendmsg.c \
+   dump.c \
+   if.c \
+   rtsock.c \
+   rtsol.c \
+   rtsold.c
 
-WARNS?=3
+LIBADD= util
+
+.include 
+
+.if ${MK_CASPER} != "no"
+CFLAGS+= -DWITH_CASPER
+LIBADD+= casper cap_syslog nv
+.endif
 
 .include 

Copied: releng/12.2/usr.sbin/rtsold/cap_llflags.c (from r365630, 
stable/12/usr.sbin/rtsold/cap_llflags.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ releng/12.2/usr.sbin/rtsold/cap_llflags.c   Sat Sep 12 21:50:25 2020
(r365673, copy of r365630, stable/12/usr.sbin/rtsold/cap_llflags.c)
@@ -0,0 +1,158 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 The FreeBSD Foundation
+ *
+ * This software was developed by Mark Johnston under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "rtsold.h"
+
+/*
+ * A service to fetch the flags for the link-local IPv6 address on the 
specified
+ * interface.  This cannot 

svn commit: r365670 - in releng/12.2: lib/lib80211 sbin/ifconfig share/man/man4 sys/contrib/dev/ath/ath_hal/ar9300 sys/dev/an sys/dev/ath sys/dev/ath/ath_dfs/null sys/dev/ath/ath_hal sys/dev/ath/at...

2020-09-12 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Sep 12 19:33:25 2020
New Revision: 365670
URL: https://svnweb.freebsd.org/changeset/base/365670

Log:
  MFS r365608:
  
  Merge WiFi net80211, drivers, and management in order to support better 11n
and upcoming 11ac.
  
This includes an ath(4) update, some run(4) 11n support, 11n for otus(4),
A-MPDU, A-MSDU, A-MPDU+A-MSDU and Fast frames options, scanning fixes,
enhanced PRIV checks for jails, restored parent device name printing,
improvements for upcoming VHT support, lots of under-the-hood infrastructure
improvements, new device ID, debug tools updates, some whitespace changes
(to make future MFCs easier).
  
This does not include (most) epoch(9) related changes as too much other
infrastructure was not merged for that.
  
Tested on:  some ath(4) AP, run(4) STA, and rtwn(4) STA
Discussed with: adrian (extremely briefly)
Sponsored by:   Rubicon Communications, LLC (d/b/a "Netgate") 
[partially]
  
  Approved by:  re (gjb)
  Relnotes: yes

Added:
  releng/12.2/tools/tools/ath/athani/
 - copied from r365608, stable/12/tools/tools/ath/athani/
Modified:
  releng/12.2/lib/lib80211/lib80211_regdomain.c
  releng/12.2/lib/lib80211/lib80211_regdomain.h
  releng/12.2/lib/lib80211/regdomain.xml
  releng/12.2/sbin/ifconfig/ifieee80211.c
  releng/12.2/share/man/man4/ath.4
  releng/12.2/share/man/man4/net80211.4
  releng/12.2/share/man/man4/run.4
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_phy.c
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.c
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_ap121.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_aphrodite.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_cus157.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_generic.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb112.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb116.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_osprey_k31.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_wasp_2.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_xb112.h
  releng/12.2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_xb113.h
  releng/12.2/sys/dev/an/if_an.c
  releng/12.2/sys/dev/ath/ah_osdep.c
  releng/12.2/sys/dev/ath/ah_osdep_ar5210.c
  releng/12.2/sys/dev/ath/ah_osdep_ar5211.c
  releng/12.2/sys/dev/ath/ah_osdep_ar5212.c
  releng/12.2/sys/dev/ath/ah_osdep_ar5416.c
  releng/12.2/sys/dev/ath/ah_osdep_ar9300.c
  releng/12.2/sys/dev/ath/ath_dfs/null/dfs_null.c
  releng/12.2/sys/dev/ath/ath_hal/ah.c
  releng/12.2/sys/dev/ath/ath_hal/ah.h
  releng/12.2/sys/dev/ath/ath_hal/ah_eeprom_9287.c
  releng/12.2/sys/dev/ath/ath_hal/ah_eeprom_9287.h
  releng/12.2/sys/dev/ath/ath_hal/ah_eeprom_v14.c
  releng/12.2/sys/dev/ath/ath_hal/ah_eeprom_v3.c
  releng/12.2/sys/dev/ath/ath_hal/ah_eeprom_v3.h
  releng/12.2/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
  releng/12.2/sys/dev/ath/ath_hal/ah_internal.h
  releng/12.2/sys/dev/ath/ath_hal/ah_regdomain.c
  releng/12.2/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h
  releng/12.2/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_freqbands.h
  releng/12.2/sys/dev/ath/ath_hal/ah_soc.h
  releng/12.2/sys/dev/ath/ath_hal/ar5210/ar5210.h
  releng/12.2/sys/dev/ath/ath_hal/ar5210/ar5210_recv.c
  releng/12.2/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
  releng/12.2/sys/dev/ath/ath_hal/ar5211/ar5211.h
  releng/12.2/sys/dev/ath/ath_hal/ar5211/ar5211_keycache.c
  releng/12.2/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c
  releng/12.2/sys/dev/ath/ath_hal/ar5211/ar5211_phy.c
  releng/12.2/sys/dev/ath/ath_hal/ar5211/ar5211_recv.c
  releng/12.2/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c
  releng/12.2/sys/dev/ath/ath_hal/ar5211/ar5211phy.h
  releng/12.2/sys/dev/ath/ath_hal/ar5211/ar5211reg.h
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar2316.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar2317.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar2413.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar2425.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar5111.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar5112.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar5212.h
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar5212_interrupts.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar5212_keycache.c
  releng/12.2/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
  

svn commit: r365633 - head/sys/dev/iwm

2020-09-11 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep 11 14:18:47 2020
New Revision: 365633
URL: https://svnweb.freebsd.org/changeset/base/365633

Log:
  iwm: fix regression from r365419 (ieee80211_media_change())
  
  In r365419 ieee80211_media_change() callers were updated to not longer
  act on the obselete ENETRESET return code.
  While in the old days iwm has done a stop/init cycle in these cases,
  this was not executed since r193340.
  As a consequence simplify iwm code as well by passing ieee80211_media_change()
  right to ieee80211_vap_attach() as there is no more need for a local
  implementation.
  
  Reported by:  Tomoaki AOKI (junchoon dec.sakura.ne.jp)
  Tested by:Tomoaki AOKI (junchoon dec.sakura.ne.jp)
  MFC after:3 days
  X-MFC:fix is already in stable/12
  PR:   248955

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Fri Sep 11 14:00:10 2020(r365632)
+++ head/sys/dev/iwm/if_iwm.c   Fri Sep 11 14:18:47 2020(r365633)
@@ -354,7 +354,6 @@ static struct ieee80211_node *
 static uint8_t iwm_rate_from_ucode_rate(uint32_t);
 static int iwm_rate2ridx(struct iwm_softc *, uint8_t);
 static voidiwm_setrates(struct iwm_softc *, struct iwm_node *, int);
-static int iwm_media_change(struct ifnet *);
 static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidiwm_endscan_cb(void *, int);
 static int iwm_send_bt_init_conf(struct iwm_softc *);
@@ -4417,27 +4416,6 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in
}
 }
 
-static int
-iwm_media_change(struct ifnet *ifp)
-{
-   struct ieee80211vap *vap = ifp->if_softc;
-   struct ieee80211com *ic = vap->iv_ic;
-   struct iwm_softc *sc = ic->ic_softc;
-   int error;
-
-   error = ieee80211_media_change(ifp);
-   if (error != 0)
-   return (error);
-
-   IWM_LOCK(sc);
-   if (ic->ic_nrunning > 0) {
-   iwm_stop(sc);
-   iwm_init(sc);
-   }
-   IWM_UNLOCK(sc);
-   return (0);
-}
-
 static void
 iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap)
 {
@@ -6432,8 +6410,8 @@ iwm_vap_create(struct ieee80211com *ic, const char nam
 
ieee80211_ratectl_init(vap);
/* Complete setup. */
-   ieee80211_vap_attach(vap, iwm_media_change, ieee80211_media_status,
-   mac);
+   ieee80211_vap_attach(vap, ieee80211_media_change,
+   ieee80211_media_status, mac);
ic->ic_opmode = opmode;
 
return vap;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365630 - in stable/12: sbin/rtsol usr.sbin/rtsold

2020-09-11 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep 11 12:36:05 2020
New Revision: 365630
URL: https://svnweb.freebsd.org/changeset/base/365630

Log:
  MFC r342788,354926,364771 (markj, bz)
  
   - Capsicumize rtsol(8) and rtsold(8).
   - Avoid relying on pollution from libcasper.h.
   - Add script for "M bit".

Added:
  stable/12/usr.sbin/rtsold/cap_llflags.c
 - copied, changed from r342788, head/usr.sbin/rtsold/cap_llflags.c
  stable/12/usr.sbin/rtsold/cap_script.c
 - copied unchanged from r342788, head/usr.sbin/rtsold/cap_script.c
  stable/12/usr.sbin/rtsold/cap_sendmsg.c
 - copied unchanged from r342788, head/usr.sbin/rtsold/cap_sendmsg.c
Deleted:
  stable/12/usr.sbin/rtsold/probe.c
Modified:
  stable/12/sbin/rtsol/Makefile
  stable/12/usr.sbin/rtsold/Makefile
  stable/12/usr.sbin/rtsold/dump.c
  stable/12/usr.sbin/rtsold/if.c
  stable/12/usr.sbin/rtsold/rtsock.c
  stable/12/usr.sbin/rtsold/rtsol.c
  stable/12/usr.sbin/rtsold/rtsold.8
  stable/12/usr.sbin/rtsold/rtsold.c
  stable/12/usr.sbin/rtsold/rtsold.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/rtsol/Makefile
==
--- stable/12/sbin/rtsol/Makefile   Fri Sep 11 10:11:04 2020
(r365629)
+++ stable/12/sbin/rtsol/Makefile   Fri Sep 11 12:36:05 2020
(r365630)
@@ -18,10 +18,24 @@
 
 PACKAGE=runtime
 PROG=  rtsol
-SRCS=  rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
+SRCS=  cap_llflags.c \
+   cap_script.c \
+   cap_sendmsg.c \
+   dump.c \
+   if.c \
+   rtsol.c \
+   rtsold.c \
+   rtsock.c
 MAN=
+LIBADD=util
 
-WARNS?=3
-CFLAGS+= -DSMALL
+.include 
+
+.if ${MK_DYNAMICROOT} == "no"
+.warning ${PROG} built without libcasper support
+.elif ${MK_CASPER} != "no" && !defined(RESCUE)
+CFLAGS+= -DWITH_CASPER
+LIBADD+= cap_syslog casper nv
+.endif
 
 .include 

Modified: stable/12/usr.sbin/rtsold/Makefile
==
--- stable/12/usr.sbin/rtsold/Makefile  Fri Sep 11 10:11:04 2020
(r365629)
+++ stable/12/usr.sbin/rtsold/Makefile  Fri Sep 11 12:36:05 2020
(r365630)
@@ -17,8 +17,22 @@
 PROG=  rtsold
 MAN=   rtsold.8
 MLINKS=rtsold.8 rtsol.8
-SRCS=  rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
+SRCS=  cap_llflags.c \
+   cap_script.c \
+   cap_sendmsg.c \
+   dump.c \
+   if.c \
+   rtsock.c \
+   rtsol.c \
+   rtsold.c
 
-WARNS?=3
+LIBADD= util
+
+.include 
+
+.if ${MK_CASPER} != "no"
+CFLAGS+= -DWITH_CASPER
+LIBADD+= casper cap_syslog nv
+.endif
 
 .include 

Copied and modified: stable/12/usr.sbin/rtsold/cap_llflags.c (from r342788, 
head/usr.sbin/rtsold/cap_llflags.c)
==
--- head/usr.sbin/rtsold/cap_llflags.c  Sat Jan  5 16:05:39 2019
(r342788, copy source)
+++ stable/12/usr.sbin/rtsold/cap_llflags.c Fri Sep 11 12:36:05 2020
(r365630)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Copied: stable/12/usr.sbin/rtsold/cap_script.c (from r342788, 
head/usr.sbin/rtsold/cap_script.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/usr.sbin/rtsold/cap_script.c  Fri Sep 11 12:36:05 2020
(r365630, copy of r342788, head/usr.sbin/rtsold/cap_script.c)
@@ -0,0 +1,236 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 The FreeBSD Foundation
+ *
+ * This software was developed by Mark Johnston under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF 

svn commit: r365608 - in stable/12: lib/lib80211 sbin/ifconfig share/man/man4 sys/contrib/dev/ath/ath_hal/ar9300 sys/dev/an sys/dev/ath sys/dev/ath/ath_dfs/null sys/dev/ath/ath_hal sys/dev/ath/ath_...

2020-09-10 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Sep 10 19:00:17 2020
New Revision: 365608
URL: https://svnweb.freebsd.org/changeset/base/365608

Log:
  MFC r344749-344750,344841-344843,345284,346405,346470,347140-347141,348331,
  349593,351868,353506-353507,353809,353853,353858,353860,356852,359063,
  359158,360819,360888,360950-360951,360953-360954,360998,361009,361025,
  361085,361087,361098,361106-361107,361115,361118,361319-361321,361486,
  361560,361566,361626,361636-361637,361687,361726,361737-361738,361768,
  361778,361811-361813,361819-361822,361825-361826,361834,361863-361864,
  361878,361885-361886,362016,362084-362085,362156-362157,362161-362162,
  362210-362213,362216,362256-362257,362671,362815-362816,363325,
  363327-363328,364011-364012,364299,364301,364303,364312,364315,
  364326-364327,364551,364553,364673,365097,365116,365125-365126,
  365130-365131,365198,365419
by adrian(78), bcran(1), bz(13), cem(1), gavin(1), glebius(6),
   landonf(1), mjg(7)
  
  Merge WiFi net80211, drivers, and management in order to support better 11n
  and upcoming 11ac.
  
  This includes an ath(4) update, some run(4) 11n support, 11n for otus(4),
  A-MPDU, A-MSDU, A-MPDU+A-MSDU and Fast frames options, scanning fixes,
  enahnced PRIV checks for jails, restored parent device name printing,
  improvements for upcoming VHT support, lots of under-the-hood infrastructure
  improvements, new device ID, debug tools updates, some whistespace changes
  (to make future MFCs easier).
  
  This does not include (nost) epoch(9) related changes as too much other
  infrastructure was not merged for that.
  
  Bump __FreeBSD_veresion as this changes the priv(9) names (not know to be
  used externally), and net80211 structures.
  
  Tested on:some ath(4) AP, run(4) STA, and rtwn(4) STA
  Discussed with:   adrian (extremly briefly)
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") [partially]
  Relnotes: yes

Added:
  stable/12/tools/tools/ath/athani/
 - copied from r344842, head/tools/tools/ath/athani/
Modified:
  stable/12/lib/lib80211/lib80211_regdomain.c
  stable/12/lib/lib80211/lib80211_regdomain.h
  stable/12/lib/lib80211/regdomain.xml
  stable/12/sbin/ifconfig/ifieee80211.c
  stable/12/share/man/man4/ath.4
  stable/12/share/man/man4/net80211.4
  stable/12/share/man/man4/run.4
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_phy.c
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.c
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_ap121.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_aphrodite.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_cus157.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_generic.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb112.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb116.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_osprey_k31.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_wasp_2.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_xb112.h
  stable/12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_xb113.h
  stable/12/sys/dev/an/if_an.c
  stable/12/sys/dev/ath/ah_osdep.c
  stable/12/sys/dev/ath/ah_osdep_ar5210.c
  stable/12/sys/dev/ath/ah_osdep_ar5211.c
  stable/12/sys/dev/ath/ah_osdep_ar5212.c
  stable/12/sys/dev/ath/ah_osdep_ar5416.c
  stable/12/sys/dev/ath/ah_osdep_ar9300.c
  stable/12/sys/dev/ath/ath_dfs/null/dfs_null.c
  stable/12/sys/dev/ath/ath_hal/ah.c
  stable/12/sys/dev/ath/ath_hal/ah.h
  stable/12/sys/dev/ath/ath_hal/ah_eeprom_9287.c
  stable/12/sys/dev/ath/ath_hal/ah_eeprom_9287.h
  stable/12/sys/dev/ath/ath_hal/ah_eeprom_v14.c
  stable/12/sys/dev/ath/ath_hal/ah_eeprom_v3.c
  stable/12/sys/dev/ath/ath_hal/ah_eeprom_v3.h
  stable/12/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
  stable/12/sys/dev/ath/ath_hal/ah_internal.h
  stable/12/sys/dev/ath/ath_hal/ah_regdomain.c
  stable/12/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h
  stable/12/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_freqbands.h
  stable/12/sys/dev/ath/ath_hal/ah_soc.h
  stable/12/sys/dev/ath/ath_hal/ar5210/ar5210.h
  stable/12/sys/dev/ath/ath_hal/ar5210/ar5210_recv.c
  stable/12/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c
  stable/12/sys/dev/ath/ath_hal/ar5211/ar5211.h
  stable/12/sys/dev/ath/ath_hal/ar5211/ar5211_keycache.c
  stable/12/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c
  stable/12/sys/dev/ath/ath_hal/ar5211/ar5211_phy.c
  

Re: svn commit: r365445 - head/sys/cam/mmc

2020-09-08 Thread Bjoern A. Zeeb

On 8 Sep 2020, at 7:10, Andriy Gapon wrote:


On 08/09/2020 08:46, Andriy Gapon wrote:

Author: avg
Date: Tue Sep  8 05:46:10 2020
New Revision: 365445
URL: https://svnweb.freebsd.org/changeset/base/365445

Log:
  mmc_da: make sure that part_index is not used uninitialized in 
sddastart

[snip]

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Sep  8 04:44:37 2020(r365444)
+++ head/sys/cam/mmc/mmc_da.c   Tue Sep  8 05:46:10 2020(r365445)
@@ -1808,6 +1808,7 @@ sddastart(struct cam_periph *periph, union ccb 
*start_

}

 	/* Find partition that has outstanding commands.  Prefer current 
partition. */

+   part_index = softc->part_curr;
part = softc->part[softc->part_curr];
bp = bioq_first(>bio_queue);
if (bp == NULL) {



One thing that concerns me is that it was obvious (to a human) that 
part_index

could be used uninitialized if bp was not NULL.
Yet, there was no warning or error from the compiler when I built that 
code for

armv7.

I wonder if we disable some relevant warnings for that architecture.
Or if the compiler (clang 11) could not figure that out.



I had just finished dissecting my hang in g_waitidle on boot on the 
nanopi-m4v2/arm64 this morning and when I saw your commits as I came 
back home .. guess what:


364132  boots
364219  boots
364263  boots
364274  boots
364283  boots
364284  no			<< 
https://svnweb.freebsd.org/base?view=revision=364284  (clang 
merge)

364285  no
364307  no
364482  no
364657  no
365335  no
365364  no
365448  boots

/bz

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


svn commit: r365419 - in head/sys/dev: ath bwi iwm iwn mwl otus usb/wlan wtap

2020-09-07 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Sep  7 15:35:40 2020
New Revision: 365419
URL: https://svnweb.freebsd.org/changeset/base/365419

Log:
  WiFi: fix ieee80211_media_change() callers
  
  In r178354 with the introduction of multi-bss ("vap") support factoring
  out started and with r193340 ieee80211_media_change() no longer returned
  ENETRESET but only 0 or error.
  As ieee80211(9) tells the ieee80211_media_change() function should not
  be called directly but is registered with ieee80211_vap_attach() instead.
  
  Some drivers have not been fully converted.  After fixing the return
  checking some of these functions were simply wrappers between
  ieee80211_vap_attach() and ieee80211_media_change(), so remove the extra
  function, where possible as well.
  
  PR:   248955
  Submitted by: Tong Zhang (ztong0001 gmail.com) (original)
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/otus/if_otus.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/wtap/if_wtap.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/ath/if_ath.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -160,7 +160,6 @@ static int  ath_init(struct ath_softc *);
 static voidath_stop(struct ath_softc *);
 static int ath_reset_vap(struct ieee80211vap *, u_long);
 static int ath_transmit(struct ieee80211com *, struct mbuf *);
-static int ath_media_change(struct ifnet *);
 static voidath_watchdog(void *);
 static voidath_parent(struct ieee80211com *);
 static voidath_fatal_proc(void *, int);
@@ -1766,8 +1765,8 @@ ath_vap_create(struct ieee80211com *ic, const char nam
ATH_UNLOCK(sc);
 
/* complete setup */
-   ieee80211_vap_attach(vap, ath_media_change, ieee80211_media_status,
-   mac);
+   ieee80211_vap_attach(vap, ieee80211_media_change,
+   ieee80211_media_status, mac);
return vap;
 bad2:
reclaim_address(sc, mac);
@@ -3541,14 +3540,6 @@ finish:
ATH_KTR(sc, ATH_KTR_TX, 0, "ath_transmit: finished");
 
return (retval);
-}
-
-static int
-ath_media_change(struct ifnet *ifp)
-{
-   int error = ieee80211_media_change(ifp);
-   /* NB: only the fixed rate can change and that doesn't need a reset */
-   return (error == ENETRESET ? 0 : error);
 }
 
 /*

Modified: head/sys/dev/bwi/if_bwi.c
==
--- head/sys/dev/bwi/if_bwi.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/bwi/if_bwi.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -118,7 +118,6 @@ static void bwi_set_channel(struct ieee80211com *);
 static voidbwi_scan_end(struct ieee80211com *);
 static int bwi_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidbwi_updateslot(struct ieee80211com *);
-static int bwi_media_change(struct ifnet *);
 
 static voidbwi_calibrate(void *);
 
@@ -607,8 +606,8 @@ bwi_vap_create(struct ieee80211com *ic, const char nam
ieee80211_ratectl_init(vap);
 
/* complete setup */
-   ieee80211_vap_attach(vap, bwi_media_change, ieee80211_media_status,
-   mac);
+   ieee80211_vap_attach(vap, ieee80211_media_change,
+   ieee80211_media_status, mac);
ic->ic_opmode = opmode;
return vap;
 }
@@ -1807,14 +1806,6 @@ back:
BWI_UNLOCK(sc);
 
return error;
-}
-
-static int
-bwi_media_change(struct ifnet *ifp)
-{
-   int error = ieee80211_media_change(ifp);
-   /* NB: only the fixed rate can change and that doesn't need a reset */
-   return (error == ENETRESET ? 0 : error);
 }
 
 static int

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/iwm/if_iwm.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -4426,8 +4426,8 @@ iwm_media_change(struct ifnet *ifp)
int error;
 
error = ieee80211_media_change(ifp);
-   if (error != ENETRESET)
-   return error;
+   if (error != 0)
+   return (error);
 
IWM_LOCK(sc);
if (ic->ic_nrunning > 0) {
@@ -4435,7 +4435,7 @@ iwm_media_change(struct ifnet *ifp)
iwm_init(sc);
}
IWM_UNLOCK(sc);
-   return error;
+   return (0);
 }
 
 static void

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/iwn/if_iwn.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -194,7 +194,6 @@ static void iwn_read_eeprom_enhinfo(struct 

svn commit: r365416 - stable/12

2020-09-07 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Sep  7 14:22:27 2020
New Revision: 365416
URL: https://svnweb.freebsd.org/changeset/base/365416

Log:
  MFC r364466:
  
After the clang/llvm version 11 import LLD_VERSION is no longer used
upstream so Version.inc now only defines LLD_VERSION_STRING.
  
This breaks the WANT_LINKER_VERSION magic and might lead to us building
more than needed (e.g., for croos-tools).
  
Change the awk script to parse LLD_VERSION_STRING instead of LLD_VERSION,
which not only unbreaks the current situation but should also be backwards
compatible as dim points out.
  
Merging this before r364284 will ensure that stable/12 won't break.
  
PR: 248818
Reviewed by:emaste, dim (seems right and the way to go)

Modified:
  stable/12/Makefile.inc1
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/Makefile.inc1
==
--- stable/12/Makefile.inc1 Mon Sep  7 13:44:54 2020(r365415)
+++ stable/12/Makefile.inc1 Mon Sep  7 14:22:27 2020(r365416)
@@ -286,7 +286,7 @@ _WANT_LINKER_FREEBSD_VERSION!= \
 WANT_LINKER_FREEBSD_VERSION=${_WANT_LINKER_FREEBSD_VERSION:C/.*-(.*)/\1/}
 WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc
 WANT_LINKER_VERSION!= \
-   awk '$$2 == "LLD_VERSION" {split($$3, a, "."); print a[1] * 1 + 
a[2] * 100 + a[3]}' \
+   awk '$$2 == "LLD_VERSION_STRING" { gsub("\"", "", $$3); split($$3, a, 
"."); print a[1] * 1 + a[2] * 100 + a[3]}' \
${SRCDIR}/${WANT_LINKER_VERSION_FILE} || echo unknown
 .else
 WANT_LINKER_FREEBSD_VERSION_FILE=
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365350 - head/sys/netinet/tcp_stacks

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Sep  5 00:20:32 2020
New Revision: 365350
URL: https://svnweb.freebsd.org/changeset/base/365350

Log:
  bbr: remove unused static function
  
  bbr_log_type_hrdwtso() is a file local static unused function.
  Remove it to avoid warnings on kernel compiles.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D26331

Modified:
  head/sys/netinet/tcp_stacks/bbr.c

Modified: head/sys/netinet/tcp_stacks/bbr.c
==
--- head/sys/netinet/tcp_stacks/bbr.c   Sat Sep  5 00:19:40 2020
(r365349)
+++ head/sys/netinet/tcp_stacks/bbr.c   Sat Sep  5 00:20:32 2020
(r365350)
@@ -11716,31 +11716,6 @@ done_with_input:
 }
 
 static void
-bbr_log_type_hrdwtso(struct tcpcb *tp, struct tcp_bbr *bbr, int len, int mod, 
int what_we_can_send)
-{
-   if (tp->t_logstate != TCP_LOG_STATE_OFF) {
-   union tcp_log_stackspecific log;
-   struct timeval tv;
-   uint32_t cts;
-
-   cts = tcp_get_usecs();
-   bbr_fill_in_logging_data(bbr, _bbr, cts);
-   log.u_bbr.flex1 = bbr->r_ctl.rc_pace_min_segs;
-   log.u_bbr.flex2 = what_we_can_send;
-   log.u_bbr.flex3 = bbr->r_ctl.rc_pace_max_segs;
-   log.u_bbr.flex4 = len;
-   log.u_bbr.flex5 = 0;
-   log.u_bbr.flex7 = mod;
-   log.u_bbr.flex8 = 1;
-   TCP_LOG_EVENTP(tp, NULL,
-   >t_inpcb->inp_socket->so_rcv,
-   >t_inpcb->inp_socket->so_snd,
-   TCP_HDWR_TLS, 0,
-   0, , false, );
-   }
-}
-
-static void
 bbr_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
 struct tcpcb *tp, int32_t drop_hdrlen, int32_t tlen, uint8_t iptos)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365349 - head/sys/kern

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Sep  5 00:19:40 2020
New Revision: 365349
URL: https://svnweb.freebsd.org/changeset/base/365349

Log:
  uipc_ktls: remove unused static function
  
  m_segments() was added with r363464 but never used. Remove it to
  avoid warnings when compiling kernels.
  
  Reported by:  rmacklem (also says jhb)
  Reviewed by:  gallatin, jhb
  Differential Revision:https://reviews.freebsd.org/D26330

Modified:
  head/sys/kern/uipc_ktls.c

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Fri Sep  4 23:36:43 2020(r365348)
+++ head/sys/kern/uipc_ktls.c   Sat Sep  5 00:19:40 2020(r365349)
@@ -1643,21 +1643,6 @@ out:
return (top);
 }
 
-static int
-m_segments(struct mbuf *m, int skip)
-{
-   int count;
-
-   while (skip >= m->m_len) {
-   skip -= m->m_len;
-   m = m->m_next;
-   }
-
-   for (count = 0; m != NULL; count++)
-   m = m->m_next;
-   return (count);
-}
-
 static void
 ktls_decrypt(struct socket *so)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365335 - head/sys/dev/usb/storage

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep  4 18:29:59 2020
New Revision: 365335
URL: https://svnweb.freebsd.org/changeset/base/365335

Log:
  umass: enhance debugging
  
  Investigating a hang I found having some more error information
  available would be helpful, so be more verbose and also tell cam/xpt
  status in case of error/panic.
  
  Reviewed by:  hselasky
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D26287

Modified:
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/storage/umass.c
==
--- head/sys/dev/usb/storage/umass.cFri Sep  4 18:26:35 2020
(r365334)
+++ head/sys/dev/usb/storage/umass.cFri Sep  4 18:29:59 2020
(r365335)
@@ -2063,6 +2063,7 @@ static int
 umass_cam_attach_sim(struct umass_softc *sc)
 {
struct cam_devq *devq;  /* Per device Queue */
+   cam_status status;
 
/*
 * A HBA is attached to the CAM layer.
@@ -2091,11 +2092,12 @@ umass_cam_attach_sim(struct umass_softc *sc)
}
 
mtx_lock(>sc_mtx);
-
-   if (xpt_bus_register(sc->sc_sim, sc->sc_dev,
-   sc->sc_unit) != CAM_SUCCESS) {
+   status = xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit);
+   if (status != CAM_SUCCESS) {
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
mtx_unlock(>sc_mtx);
+   printf("%s: xpt_bus_register failed with status %#x\n",
+   __func__, status);
return (ENOMEM);
}
mtx_unlock(>sc_mtx);
@@ -2121,14 +2123,22 @@ umass_cam_attach(struct umass_softc *sc)
 static void
 umass_cam_detach_sim(struct umass_softc *sc)
 {
+   cam_status status;
+
if (sc->sc_sim != NULL) {
-   if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) {
+   status = xpt_bus_deregister(cam_sim_path(sc->sc_sim));
+   if (status == CAM_REQ_CMP) {
/* accessing the softc is not possible after this */
sc->sc_sim->softc = NULL;
+   DPRINTF(sc, UDMASS_SCSI, "%s: %s:%d:%d caling "
+   "cam_sim_free sim %p refc %u mtx %p\n",
+   __func__, sc->sc_name, cam_sim_path(sc->sc_sim),
+   sc->sc_unit, sc->sc_sim,
+   sc->sc_sim->refcount, sc->sc_sim->mtx);
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
} else {
-   panic("%s: CAM layer is busy\n",
-   sc->sc_name);
+   panic("%s: %s: CAM layer is busy: %#x\n",
+   __func__, sc->sc_name, status);
}
sc->sc_sim = NULL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365334 - head/sys/dev/usb/storage

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep  4 18:26:35 2020
New Revision: 365334
URL: https://svnweb.freebsd.org/changeset/base/365334

Log:
  umass: fix a cam_sim leak in error case
  
  While debugging a hang I noticed that in case of error in
  umass_cam_attach_sim() we miss a cam_sim_free() call.
  Added that to not leak resources.
  
  Reviewed by:  hselasky
  MFC after:3 days
  Differential Revision:D26287

Modified:
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/storage/umass.c
==
--- head/sys/dev/usb/storage/umass.cFri Sep  4 18:18:05 2020
(r365333)
+++ head/sys/dev/usb/storage/umass.cFri Sep  4 18:26:35 2020
(r365334)
@@ -2094,6 +2094,7 @@ umass_cam_attach_sim(struct umass_softc *sc)
 
if (xpt_bus_register(sc->sc_sim, sc->sc_dev,
sc->sc_unit) != CAM_SUCCESS) {
+   cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
mtx_unlock(>sc_mtx);
return (ENOMEM);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365333 - head/sys/cam

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep  4 18:18:05 2020
New Revision: 365333
URL: https://svnweb.freebsd.org/changeset/base/365333

Log:
  cam_sim: harmonize code related to acquiring a mtx
  
  cam_sim_free(), cam_sim_release(), and cam_sim_hold() all assign
  a mtx variable during declaration and then if NULL or the mtx is
  held may re-asign the variable and/or acquire/release a lock.
  
  Harmonize the code, avoiding double assignments and make it look
  the same for all three function (with cam_sim_free() not needing
  an extra case).
  
  No functional changes intended.
  
  Reviewed by:  imp; no-objections by: mav
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D26286

Modified:
  head/sys/cam/cam_sim.c

Modified: head/sys/cam/cam_sim.c
==
--- head/sys/cam/cam_sim.c  Fri Sep  4 17:37:58 2020(r365332)
+++ head/sys/cam/cam_sim.c  Fri Sep  4 18:18:05 2020(r365333)
@@ -124,14 +124,15 @@ cam_sim_alloc_dev(sim_action_func sim_action, sim_poll
 void
 cam_sim_free(struct cam_sim *sim, int free_devq)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
int error;
 
-   if (mtx) {
-   mtx_assert(mtx, MA_OWNED);
-   } else {
+   if (sim->mtx == NULL) {
mtx = _sim_free_mtx;
mtx_lock(mtx);
+   } else {
+   mtx = sim->mtx;
+   mtx_assert(mtx, MA_OWNED);
}
sim->refcount--;
if (sim->refcount > 0) {
@@ -139,7 +140,7 @@ cam_sim_free(struct cam_sim *sim, int free_devq)
KASSERT(error == 0, ("invalid error value for msleep(9)"));
}
KASSERT(sim->refcount == 0, ("sim->refcount == 0"));
-   if (sim->mtx == NULL)
+   if (mtx == _sim_free_mtx)   /* sim->mtx == NULL */
mtx_unlock(mtx);
 
if (free_devq)
@@ -150,17 +151,16 @@ cam_sim_free(struct cam_sim *sim, int free_devq)
 void
 cam_sim_release(struct cam_sim *sim)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
 
-   if (mtx) {
-   if (!mtx_owned(mtx))
-   mtx_lock(mtx);
-   else
-   mtx = NULL;
-   } else {
+   if (sim->mtx == NULL)
mtx = _sim_free_mtx;
+   else if (!mtx_owned(sim->mtx))
+   mtx = sim->mtx;
+   else
+   mtx = NULL; /* We hold the lock. */
+   if (mtx)
mtx_lock(mtx);
-   }
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
sim->refcount--;
if (sim->refcount == 0)
@@ -172,17 +172,16 @@ cam_sim_release(struct cam_sim *sim)
 void
 cam_sim_hold(struct cam_sim *sim)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
 
-   if (mtx) {
-   if (!mtx_owned(mtx))
-   mtx_lock(mtx);
-   else
-   mtx = NULL;
-   } else {
+   if (sim->mtx == NULL)
mtx = _sim_free_mtx;
+   else if (!mtx_owned(sim->mtx))
+   mtx = sim->mtx;
+   else
+   mtx = NULL; /* We hold the lock. */
+   if (mtx)
mtx_lock(mtx);
-   }
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
sim->refcount++;
if (mtx)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365230 - svnadmin/conf

2020-09-01 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Sep  1 22:36:24 2020
New Revision: 365230
URL: https://svnweb.freebsd.org/changeset/base/365230

Log:
  Release thj from mentorship.

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Tue Sep  1 22:15:02 2020(r365229)
+++ svnadmin/conf/mentors   Tue Sep  1 22:36:24 2020(r365230)
@@ -23,5 +23,4 @@ nick  philip  Co-mentor: kp
 ramken Co-mentor: mav
 rewkevans  Co-mentor: allanjude
 scottphscottl  Co-mentor: emaste, jhb
-thjjtl Co-mentor: bz
 wosch  cem
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365059 - in stable/12/sys: netinet netinet6 sys

2020-09-01 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Sep  1 19:54:43 2020
New Revision: 365059
URL: https://svnweb.freebsd.org/changeset/base/365059

Log:
  MFC r364018:
  
IPV6_PKTINFO support for v4-mapped IPv6 sockets
  
When using v4-mapped IPv6 sockets with IPV6_PKTINFO we do not
respect the given v4-mapped src address on the IPv4 socket.
Implement the needed functionality. This allows single-socket
UDP applications (such as OpenVPN) to work better on FreeBSD.
  
Requested by:   Gert Doering (gert greenie.net), pfsense
Tested by:  Gert Doering (gert greenie.net)

Modified:
  stable/12/sys/netinet/udp_usrreq.c
  stable/12/sys/netinet6/udp6_usrreq.c
  stable/12/sys/sys/protosw.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/udp_usrreq.c
==
--- stable/12/sys/netinet/udp_usrreq.c  Tue Sep  1 19:06:08 2020
(r365058)
+++ stable/12/sys/netinet/udp_usrreq.c  Tue Sep  1 19:54:43 2020
(r365059)
@@ -162,7 +162,7 @@ VNET_PCPUSTAT_SYSUNINIT(udpstat);
 #ifdef INET
 static voidudp_detach(struct socket *so);
 static int udp_output(struct inpcb *, struct mbuf *, struct sockaddr *,
-   struct mbuf *, struct thread *);
+   struct mbuf *, struct thread *, int);
 #endif
 
 static void
@@ -1114,13 +1114,69 @@ udp_ctloutput(struct socket *so, struct sockopt *sopt)
return (error);
 }
 
+#ifdef INET6
+/* The logic here is derived from ip6_setpktopt(). See comments there. */
+static int
+udp_v4mapped_pktinfo(struct cmsghdr *cm, struct sockaddr_in * src,
+struct inpcb *inp, int flags)
+{
+   struct ifnet *ifp;
+   struct in6_pktinfo *pktinfo;
+   struct in_addr ia;
+
+   if ((flags & PRUS_IPV6) == 0)
+   return (0);
+
+   if (cm->cmsg_level != IPPROTO_IPV6)
+   return (0);
+
+   if  (cm->cmsg_type != IPV6_2292PKTINFO &&
+   cm->cmsg_type != IPV6_PKTINFO)
+   return (0);
+
+   if (cm->cmsg_len !=
+   CMSG_LEN(sizeof(struct in6_pktinfo)))
+   return (EINVAL);
+
+   pktinfo = (struct in6_pktinfo *)CMSG_DATA(cm);
+   if (!IN6_IS_ADDR_V4MAPPED(>ipi6_addr) &&
+   !IN6_IS_ADDR_UNSPECIFIED(>ipi6_addr))
+   return (EINVAL);
+
+   /* Validate the interface index if specified. */
+   if (pktinfo->ipi6_ifindex > V_if_index)
+   return (ENXIO);
+
+   ifp = NULL;
+   if (pktinfo->ipi6_ifindex) {
+   ifp = ifnet_byindex(pktinfo->ipi6_ifindex);
+   if (ifp == NULL)
+   return (ENXIO);
+   }
+   if (ifp != NULL && !IN6_IS_ADDR_UNSPECIFIED(>ipi6_addr)) {
+
+   ia.s_addr = pktinfo->ipi6_addr.s6_addr32[3];
+   if (in_ifhasaddr(ifp, ia) == 0)
+   return (EADDRNOTAVAIL);
+   }
+
+   bzero(src, sizeof(*src));
+   src->sin_family = AF_INET;
+   src->sin_len = sizeof(*src);
+   src->sin_port = inp->inp_lport;
+   src->sin_addr.s_addr = pktinfo->ipi6_addr.s6_addr32[3];
+
+   return (0);
+}
+#endif
+
 #ifdef INET
 #defineUH_WLOCKED  2
 #defineUH_RLOCKED  1
 #defineUH_UNLOCKED 0
 static int
 udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
-struct mbuf *control, struct thread *td)
+struct mbuf *control, struct thread *td, int flags)
 {
struct udpiphdr *ui;
int len = m->m_pkthdr.len;
@@ -1201,6 +1257,11 @@ retry:
error = EINVAL;
break;
}
+#ifdef INET6
+   error = udp_v4mapped_pktinfo(cm, , inp, flags);
+   if (error != 0)
+   break;
+#endif
if (cm->cmsg_level != IPPROTO_IP)
continue;
 
@@ -1816,7 +1877,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m,
 
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("udp_send: inp == NULL"));
-   return (udp_output(inp, m, addr, control, td));
+   return (udp_output(inp, m, addr, control, td, flags));
 }
 #endif /* INET */
 

Modified: stable/12/sys/netinet6/udp6_usrreq.c
==
--- stable/12/sys/netinet6/udp6_usrreq.cTue Sep  1 19:06:08 2020
(r365058)
+++ stable/12/sys/netinet6/udp6_usrreq.cTue Sep  1 19:54:43 2020
(r365059)
@@ -804,7 +804,7 @@ retry:
in6_sin6_2_sin_in_sock((struct sockaddr *)sin6);
pru = inetsw[ip_protox[nxt]].pr_usrreqs;
/* addr will just be freed in sendit(). */
-   return ((*pru->pru_send)(so, flags_arg, m,
+   return ((*pru->pru_send)(so, flags_arg | PRUS_IPV6, m,
(struct sockaddr *)sin6, 

svn commit: r364771 - head/usr.sbin/rtsold

2020-08-25 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Aug 25 16:09:23 2020
New Revision: 364771
URL: https://svnweb.freebsd.org/changeset/base/364771

Log:
  rtsol(d): add script for "M bit"
  
  While we do support the "O bit" running a script (usually to start a
  dhcpv6 client) we have no options for setups which set the "M bit" for,
  e.g., static address assignment as in EC2.
  
  Duplicate most of the "O bit" logic to also start a script for the
  "M bit" with the one difference: if the "M bit" is set we will not
  start the script for the "O bit" as well (per RFC 4861, Section 4.2).
  
  Reviewed by:  hrs, markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D26099

Modified:
  head/usr.sbin/rtsold/dump.c
  head/usr.sbin/rtsold/rtsol.c
  head/usr.sbin/rtsold/rtsold.8
  head/usr.sbin/rtsold/rtsold.c
  head/usr.sbin/rtsold/rtsold.h

Modified: head/usr.sbin/rtsold/dump.c
==
--- head/usr.sbin/rtsold/dump.c Tue Aug 25 15:19:45 2020(r364770)
+++ head/usr.sbin/rtsold/dump.c Tue Aug 25 16:09:23 2020(r364771)
@@ -84,6 +84,8 @@ rtsold_dump(FILE *fp)
}
fprintf(fp, "  interface status: %s\n",
ifi->active > 0 ? "active" : "inactive");
+   fprintf(fp, "  managed config: %s\n",
+   ifi->managedconfig ? "on" : "off");
fprintf(fp, "  other config: %s\n",
ifi->otherconfig ? "on" : "off");
fprintf(fp, "  rtsold status: %s\n", ifstatstr[ifi->state]);

Modified: head/usr.sbin/rtsold/rtsol.c
==
--- head/usr.sbin/rtsold/rtsol.cTue Aug 25 15:19:45 2020
(r364770)
+++ head/usr.sbin/rtsold/rtsol.cTue Aug 25 16:09:23 2020
(r364771)
@@ -79,6 +79,7 @@ static int ra_opt_rdnss_dispatch(struct ifinfo *, stru
 struct script_msg_head_t *, struct script_msg_head_t *);
 static char *make_rsid(const char *, const char *, struct rainfo *);
 
+#define_ARGS_MANAGED   managedconf_script, ifi->ifname
 #define_ARGS_OTHER otherconf_script, ifi->ifname
 #define_ARGS_RESADDresolvconf_script, "-a", rsid
 #define_ARGS_RESDELresolvconf_script, "-d", rsid
@@ -291,18 +292,36 @@ rtsol_input(int sock)
nd_ra = (struct nd_router_advert *)icp;
 
/*
+* Process the "M bit."
+* If the value of ManagedConfigFlag changes from FALSE to TRUE, the
+* host should invoke the stateful autoconfiguration protocol,
+* requesting information.
+* [RFC 4861 Section 4.2]
+* XXX ??? [draft-ietf-v6ops-dhcpv6-slaac-problem-07]
+*/
+   if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_MANAGED) &&
+   !ifi->managedconfig) {
+   warnmsg(LOG_DEBUG, __func__,
+   "ManagedConfigFlag on %s is turned on", ifi->ifname);
+   ifi->managedconfig = 1;
+   CALL_SCRIPT(MANAGED, NULL);
+   }
+
+   /*
 * Process the "O bit."
 * If the value of OtherConfigFlag changes from FALSE to TRUE, the
 * host should invoke the stateful autoconfiguration protocol,
-* requesting information.
-* [RFC 2462 Section 5.5.3]
+* requesting information unless the "M bit" was set as well in
+* which case the "O bit" is redundant.
+* [RFC 4861 Section 4.2]
 */
if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_OTHER) &&
!ifi->otherconfig) {
warnmsg(LOG_DEBUG, __func__,
"OtherConfigFlag on %s is turned on", ifi->ifname);
ifi->otherconfig = 1;
-   CALL_SCRIPT(OTHER, NULL);
+   if (!ifi->managedconfig)
+   CALL_SCRIPT(OTHER, NULL);
}
clock_gettime(CLOCK_MONOTONIC_FAST, );
newent_rai = 0;

Modified: head/usr.sbin/rtsold/rtsold.8
==
--- head/usr.sbin/rtsold/rtsold.8   Tue Aug 25 15:19:45 2020
(r364770)
+++ head/usr.sbin/rtsold/rtsold.8   Tue Aug 25 16:09:23 2020
(r364771)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 14, 2011
+.Dd August 19, 2020
 .Dt RTSOLD 8
 .Os
 .\"
@@ -40,23 +40,27 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl dDfFmu1
+.Op Fl M Ar script-name
 .Op Fl O Ar script-name
 .Op Fl p Ar pidfile
 .Op Fl R Ar script-name
 .Ar interface ...
 .Nm
 .Op Fl dDfFmu1
+.Op Fl M Ar script-name
 .Op Fl O Ar script-name
 .Op Fl p Ar pidfile
 .Op Fl R Ar script-name
 .Fl a
 .Nm rtsol
 .Op Fl dDu
+.Op Fl M Ar script-name
 .Op Fl O Ar script-name
 .Op Fl R Ar script-name
 .Ar interface ...
 .Nm rtsol
 .Op Fl dDu
+.Op Fl M Ar script-name
 .Op Fl O Ar script-name
 .Op Fl R Ar script-name
 .Fl a
@@ -208,6 +212,20 @@ Transmit Router Solicitation packets until at least on
 Advertisement packet has arrived on each
 

svn commit: r364673 - in head/sys: dev/rtwn dev/usb/wlan net80211

2020-08-24 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 24 13:15:08 2020
New Revision: 364673
URL: https://svnweb.freebsd.org/changeset/base/364673

Log:
  net80211: enhance getflags*() and ieee80211_add_channel*()
  
  For ieee80211_add_channel+*() we are passing in an int flag for
  ht40 and in some cases another int flag for vht80 where we'd only
  need two bits really.
  Convert these variables to a bitflag and fold them together into one.
  This also allows for VHT160 and VHT80P80 and whatever may come to
  be considered. Define the various options currently needed.
  
  Change the drivers (rtwn and rsu) which actually set this bit to non-0.
  For convenience the "1" currently used for HT40 is preserved.
  
  Enahnce getflags_5ghz() to handle the full set of VHT flags based
  on the input flags from the the driver.
  
  Update the regdomain implementation as well to make use of the new
  flags and deal with higher [V]HT bandwidths.
  
  ieee80211_add_channel() specifically did not take flags so it will
  not support naything beyond 20Mhz channels.
  
  Note: I am not entirely happy with the "cbw_flag[s]" name, but we
  do use chan_flags elsewhere already.
  
  MFC after:2 weeks
  Reviewed by:  adrian, gnn
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential revision:https://reviews.freebsd.org/D26091

Modified:
  head/sys/dev/rtwn/if_rtwn.c
  head/sys/dev/usb/wlan/if_rsu.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_regdomain.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/rtwn/if_rtwn.c
==
--- head/sys/dev/rtwn/if_rtwn.c Mon Aug 24 13:14:38 2020(r364672)
+++ head/sys/dev/rtwn/if_rtwn.c Mon Aug 24 13:15:08 2020(r364673)
@@ -1525,25 +1525,29 @@ rtwn_getradiocaps(struct ieee80211com *ic,
 {
struct rtwn_softc *sc = ic->ic_softc;
uint8_t bands[IEEE80211_MODE_BYTES];
-   int i;
+   int cbw_flags, i;
 
+   cbw_flags = (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) ?
+   NET80211_CBW_FLAG_HT40 : 0;
+
memset(bands, 0, sizeof(bands));
setbit(bands, IEEE80211_MODE_11B);
setbit(bands, IEEE80211_MODE_11G);
setbit(bands, IEEE80211_MODE_11NG);
ieee80211_add_channels_default_2ghz(chans, maxchans, nchans,
-   bands, !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40));
+   bands, cbw_flags);
 
/* XXX workaround add_channel_list() limitations */
setbit(bands, IEEE80211_MODE_11A);
setbit(bands, IEEE80211_MODE_11NA);
for (i = 0; i < nitems(sc->chan_num_5ghz); i++) {
+
if (sc->chan_num_5ghz[i] == 0)
continue;
 
ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
sc->chan_list_5ghz[i], sc->chan_num_5ghz[i], bands,
-   !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40));
+   cbw_flags);
}
 }
 

Modified: head/sys/dev/usb/wlan/if_rsu.c
==
--- head/sys/dev/usb/wlan/if_rsu.c  Mon Aug 24 13:14:38 2020
(r364672)
+++ head/sys/dev/usb/wlan/if_rsu.c  Mon Aug 24 13:15:08 2020
(r364673)
@@ -779,7 +779,8 @@ rsu_getradiocaps(struct ieee80211com *ic,
if (sc->sc_ht)
setbit(bands, IEEE80211_MODE_11NG);
ieee80211_add_channels_default_2ghz(chans, maxchans, nchans,
-   bands, (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) != 0);
+   bands, (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) ?
+   NET80211_CBW_FLAG_HT40 : 0);
 }
 
 static void

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Mon Aug 24 13:14:38 2020
(r364672)
+++ head/sys/net80211/ieee80211.c   Mon Aug 24 13:15:08 2020
(r364673)
@@ -1301,7 +1301,7 @@ copychan_prev(struct ieee80211_channel chans[], int ma
  * XXX VHT-2GHz
  */
 static void
-getflags_2ghz(const uint8_t bands[], uint32_t flags[], int ht40)
+getflags_2ghz(const uint8_t bands[], uint32_t flags[], int cbw_flags)
 {
int nmodes;
 
@@ -1312,7 +1312,7 @@ getflags_2ghz(const uint8_t bands[], uint32_t flags[],
flags[nmodes++] = IEEE80211_CHAN_G;
if (isset(bands, IEEE80211_MODE_11NG))
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT20;
-   if (ht40) {
+   if (cbw_flags & NET80211_CBW_FLAG_HT40) {
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U;
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D;
}
@@ -1320,12 +1320,12 @@ getflags_2ghz(const uint8_t bands[], uint32_t flags[],
 }
 
 static void
-getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80)
+getflags_5ghz(const uint8_t bands[], uint32_t flags[], int cbw_flags)
 {
int nmodes;
 
/*
-  

svn commit: r364553 - head/sys/net80211

2020-08-23 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Aug 23 21:42:23 2020
New Revision: 364553
URL: https://svnweb.freebsd.org/changeset/base/364553

Log:
  net80211: improve media information for VHT5GHZ
  
  Improve ieee80211_media_setup(), media2mode(), and
  ieee80211_rate2media() for VHT5GHZ at least.
  
  Reviewed by:  adrian, gnn
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26089

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Sun Aug 23 21:38:48 2020
(r364552)
+++ head/sys/net80211/ieee80211.c   Sun Aug 23 21:42:23 2020
(r364553)
@@ -1920,12 +1920,18 @@ ieee80211_media_setup(struct ieee80211com *ic,
 
/*
 * Add VHT media.
+* XXX-BZ skip "VHT_2GHZ" for now.
 */
-   for (; mode <= IEEE80211_MODE_VHT_5GHZ; mode++) {
+   for (mode = IEEE80211_MODE_VHT_5GHZ; mode <= IEEE80211_MODE_VHT_5GHZ;
+   mode++) {
if (isclr(ic->ic_modecaps, mode))
continue;
addmedia(media, caps, addsta, mode, IFM_AUTO);
addmedia(media, caps, addsta, mode, IFM_IEEE80211_VHT);
+   }
+   if (isset(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ)) {
+  addmedia(media, caps, addsta,
+  IEEE80211_MODE_AUTO, IFM_IEEE80211_VHT);
 
/* XXX TODO: VHT maxrate */
}
@@ -2044,6 +2050,12 @@ media2mode(const struct ifmedia_entry *ime, uint32_t f
case IFM_IEEE80211_11NG:
*mode = IEEE80211_MODE_11NG;
break;
+   case IFM_IEEE80211_VHT2G:
+   *mode = IEEE80211_MODE_VHT_2GHZ;
+   break;
+   case IFM_IEEE80211_VHT5G:
+   *mode = IEEE80211_MODE_VHT_5GHZ;
+   break;
case IFM_AUTO:
*mode = IEEE80211_MODE_AUTO;
break;
@@ -2387,12 +2399,36 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate
{  75, IFM_IEEE80211_MCS },
{  76, IFM_IEEE80211_MCS },
};
+   static const struct ratemedia vhtrates[] = {
+   {   0, IFM_IEEE80211_VHT },
+   {   1, IFM_IEEE80211_VHT },
+   {   2, IFM_IEEE80211_VHT },
+   {   3, IFM_IEEE80211_VHT },
+   {   4, IFM_IEEE80211_VHT },
+   {   5, IFM_IEEE80211_VHT },
+   {   6, IFM_IEEE80211_VHT },
+   {   7, IFM_IEEE80211_VHT },
+   {   8, IFM_IEEE80211_VHT }, /* Optional. */
+   {   9, IFM_IEEE80211_VHT }, /* Optional. */
+#if 0
+   /* Some QCA and BRCM seem to support this; offspec. */
+   {  10, IFM_IEEE80211_VHT },
+   {  11, IFM_IEEE80211_VHT },
+#endif
+   };
int m;
 
/*
-* Check 11n rates first for match as an MCS.
+* Check 11ac/11n rates first for match as an MCS.
 */
-   if (mode == IEEE80211_MODE_11NA) {
+   if (mode == IEEE80211_MODE_VHT_5GHZ) {
+   if (rate & IFM_IEEE80211_VHT) {
+   rate &= ~IFM_IEEE80211_VHT;
+   m = findmedia(vhtrates, nitems(vhtrates), rate);
+   if (m != IFM_AUTO)
+   return (m | IFM_IEEE80211_VHT);
+   }
+   } else if (mode == IEEE80211_MODE_11NA) {
if (rate & IEEE80211_RATE_MCS) {
rate &= ~IEEE80211_RATE_MCS;
m = findmedia(htrates, nitems(htrates), rate);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364551 - head/sys/net80211

2020-08-23 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Aug 23 21:37:20 2020
New Revision: 364551
URL: https://svnweb.freebsd.org/changeset/base/364551

Log:
  net80211: set_vht_extchan() reverse order to always return best
  
  In set_vht_extchan() the checks are performed in the order of VHT20/40/80.
  That means if a channel has a lower and higheer VHT flag set we would
  return the lower first.
  We normally do not set more than one VHT flag so this change is supposed
  to be a NOP but follows the logical thinking order of returning the best
  first. Also we nowhere assert a single VHT flag so make sure we'll not
  be stuck with VHT20 when we could do more.
  
  While here add the debugging printfs for VHT160 and VHT80P80 which still
  need doing once we deal with a driver at that level.
  
  Reviewed by:  adrian, gnn
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26088

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Sun Aug 23 21:35:23 2020
(r364550)
+++ head/sys/net80211/ieee80211.c   Sun Aug 23 21:37:20 2020
(r364551)
@@ -1168,23 +1168,17 @@ set_vht_extchan(struct ieee80211_channel *c)
 {
int i;
 
-   if (! IEEE80211_IS_CHAN_VHT(c)) {
+   if (! IEEE80211_IS_CHAN_VHT(c))
return (0);
-   }
 
-   if (IEEE80211_IS_CHAN_VHT20(c)) {
-   c->ic_vht_ch_freq1 = c->ic_ieee;
-   return (1);
+   if (IEEE80211_IS_CHAN_VHT80P80(c)) {
+   printf("%s: TODO VHT80+80 channel (ieee=%d, flags=0x%08x)\n",
+   __func__, c->ic_ieee, c->ic_flags);
}
 
-   if (IEEE80211_IS_CHAN_VHT40(c)) {
-   if (IEEE80211_IS_CHAN_HT40U(c))
-   c->ic_vht_ch_freq1 = c->ic_ieee + 2;
-   else if (IEEE80211_IS_CHAN_HT40D(c))
-   c->ic_vht_ch_freq1 = c->ic_ieee - 2;
-   else
-   return (0);
-   return (1);
+   if (IEEE80211_IS_CHAN_VHT160(c)) {
+   printf("%s: TODO VHT160 channel (ieee=%d, flags=0x%08x)\n",
+   __func__, c->ic_ieee, c->ic_flags);
}
 
if (IEEE80211_IS_CHAN_VHT80(c)) {
@@ -1206,6 +1200,21 @@ set_vht_extchan(struct ieee80211_channel *c)
}
}
return (0);
+   }
+
+   if (IEEE80211_IS_CHAN_VHT40(c)) {
+   if (IEEE80211_IS_CHAN_HT40U(c))
+   c->ic_vht_ch_freq1 = c->ic_ieee + 2;
+   else if (IEEE80211_IS_CHAN_HT40D(c))
+   c->ic_vht_ch_freq1 = c->ic_ieee - 2;
+   else
+   return (0);
+   return (1);
+   }
+
+   if (IEEE80211_IS_CHAN_VHT20(c)) {
+   c->ic_vht_ch_freq1 = c->ic_ieee;
+   return (1);
}
 
printf("%s: unknown VHT channel type (ieee=%d, flags=0x%08x)\n",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364466 - head

2020-08-21 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug 21 22:31:45 2020
New Revision: 364466
URL: https://svnweb.freebsd.org/changeset/base/364466

Log:
  After the clang/llvm version 11 import LLD_VERSION is no longer used
  upstream so Version.inc now only defines LLD_VERSION_STRING.
  
  This breaks the WANT_LINKER_VERSION magic and might lead to us building
  more than needed (e.g., for croos-tools).
  
  Change the awk script to parse LLD_VERSION_STRING instead of LLD_VERSION,
  which not only unbreaks the current situation but should also be backwards
  compatible as dim points out.
  
  PR:   248818
  Reviewed by:  emaste, dim (seems right and the way to go)
  MFC after:4 weeks
  X-MFC before: 364284

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Aug 21 21:34:52 2020(r364465)
+++ head/Makefile.inc1  Fri Aug 21 22:31:45 2020(r364466)
@@ -264,7 +264,7 @@ _WANT_LINKER_FREEBSD_VERSION!= \
 WANT_LINKER_FREEBSD_VERSION=${_WANT_LINKER_FREEBSD_VERSION:C/.*-(.*)/\1/}
 WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc
 WANT_LINKER_VERSION!= \
-   awk '$$2 == "LLD_VERSION" {split($$3, a, "."); print a[1] * 1 + 
a[2] * 100 + a[3]}' \
+   awk '$$2 == "LLD_VERSION_STRING" { gsub("\"", "", $$3); split($$3, a, 
"."); print a[1] * 1 + a[2] * 100 + a[3]}' \
${SRCDIR}/${WANT_LINKER_VERSION_FILE} || echo unknown
 .else
 WANT_LINKER_FREEBSD_VERSION_FILE=
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364327 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 20:18:01 2020
New Revision: 364327
URL: https://svnweb.freebsd.org/changeset/base/364327

Log:
  net80211: replace magic number by define
  
  Rather than coding an array size of [4] replace the number with
  WME_NUM_AC.
  
  MFC after:2 weeks
  Reviewed by:  adrian
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26090

Modified:
  head/sys/net80211/ieee80211_proto.h

Modified: head/sys/net80211/ieee80211_proto.h
==
--- head/sys/net80211/ieee80211_proto.h Mon Aug 17 20:16:33 2020
(r364326)
+++ head/sys/net80211/ieee80211_proto.h Mon Aug 17 20:18:01 2020
(r364327)
@@ -286,7 +286,7 @@ struct ieee80211_wme_state {
u_int   wme_hipri_switch_thresh;/* aggressive mode switch thresh */
u_int   wme_hipri_switch_hysteresis;/* aggressive mode switch 
hysteresis */
 
-   struct wmeParams wme_params[4]; /* from assoc resp for each AC*/
+   struct wmeParams wme_params[WME_NUM_AC]; /* from assoc resp for each AC 
*/
struct chanAccParams wme_wmeChanParams; /* WME params applied to self */
struct chanAccParams wme_wmeBssChanParams;/* WME params bcast to 
stations */
struct chanAccParams wme_chanParams;/* params applied to self */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364326 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 20:16:33 2020
New Revision: 364326
URL: https://svnweb.freebsd.org/changeset/base/364326

Log:
  net80211: VHT correct NSS Set loop boundary
  
  For the  tuple, NSS is 1..8 (or in our loop case 0..7
  but not 0..6). Correct the boundry to check for < 8 and not < 7.
  
  MFC after:2 weeks
  Reviewed by:  adrian
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26087

Modified:
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/net80211/ieee80211_vht.c
==
--- head/sys/net80211/ieee80211_vht.c   Mon Aug 17 20:11:43 2020
(r364325)
+++ head/sys/net80211/ieee80211_vht.c   Mon Aug 17 20:16:33 2020
(r364326)
@@ -218,7 +218,7 @@ ieee80211_vht_announce(struct ieee80211com *ic)
IEEE80211_VHTCAP_BITS);
 
/* For now, just 5GHz VHT.  Worry about 2GHz VHT later */
-   for (i = 0; i < 7; i++) {
+   for (i = 0; i < 8; i++) {
/* Each stream is 2 bits */
tx = (ic->ic_vht_mcsinfo.tx_mcs_map >> (2*i)) & 0x3;
rx = (ic->ic_vht_mcsinfo.rx_mcs_map >> (2*i)) & 0x3;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364324 - head/sys/dev/mmc/host

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 20:07:14 2020
New Revision: 364324
URL: https://svnweb.freebsd.org/changeset/base/364324

Log:
  dwmmc: remove printf even under bootverbose
  
  Remove two debugging printfs, even if hidden under boot -v.
  They seemed to be of debug nature and always spit onto the
  console when running camcontrol devlist -v.
  
  Reviewed by:  manu
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25962

Modified:
  head/sys/dev/mmc/host/dwmmc.c

Modified: head/sys/dev/mmc/host/dwmmc.c
==
--- head/sys/dev/mmc/host/dwmmc.c   Mon Aug 17 19:17:54 2020
(r364323)
+++ head/sys/dev/mmc/host/dwmmc.c   Mon Aug 17 20:07:14 2020
(r364324)
@@ -1461,9 +1461,6 @@ dwmmc_cam_action(struct cam_sim *sim, union ccb *ccb)
{
struct ccb_trans_settings *cts = >cts;
 
-   if (bootverbose)
-   device_printf(sc->dev, "Got XPT_GET_TRAN_SETTINGS\n");
-
cts->protocol = PROTO_MMCSD;
cts->protocol_version = 1;
cts->transport = XPORT_MMCSD;
@@ -1481,8 +1478,7 @@ dwmmc_cam_action(struct cam_sim *sim, union ccb *ccb)
}
case XPT_SET_TRAN_SETTINGS:
{
-   if (bootverbose)
-   device_printf(sc->dev, "Got XPT_SET_TRAN_SETTINGS\n");
+
dwmmc_cam_settran_settings(sc, ccb);
ccb->ccb_h.status = CAM_REQ_CMP;
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364315 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 16:51:21 2020
New Revision: 364315
URL: https://svnweb.freebsd.org/changeset/base/364315

Log:
  net80211: return 80P80 before 160
  
  In ieee80211_vht_get_chwidth_ie() we need to return 80P80 (3) before
  VHT160 (2) as otherwise we'll never use 80P80.  Fix the order.
  
  MFC after:2 weeks
  X-MFC with:   r364303 (which missed this)
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/net80211/ieee80211_vht.c
==
--- head/sys/net80211/ieee80211_vht.c   Mon Aug 17 16:37:46 2020
(r364314)
+++ head/sys/net80211/ieee80211_vht.c   Mon Aug 17 16:51:21 2020
(r364315)
@@ -693,10 +693,10 @@ ieee80211_vht_get_chwidth_ie(struct ieee80211_channel 
 * well?
 */
 
-   if (IEEE80211_IS_CHAN_VHT160(c))
-   return IEEE80211_VHT_CHANWIDTH_160MHZ;
if (IEEE80211_IS_CHAN_VHT80P80(c))
return IEEE80211_VHT_CHANWIDTH_80P80MHZ;
+   if (IEEE80211_IS_CHAN_VHT160(c))
+   return IEEE80211_VHT_CHANWIDTH_160MHZ;
if (IEEE80211_IS_CHAN_VHT80(c))
return IEEE80211_VHT_CHANWIDTH_80MHZ;
if (IEEE80211_IS_CHAN_VHT40(c))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r364312 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb

On 17 Aug 2020, at 16:42, Oliver Pinter wrote:


On Monday, August 17, 2020, Bjoern A. Zeeb  wrote:


Author: bz
Date: Mon Aug 17 16:28:59 2020
New Revision: 364312
URL: https://svnweb.freebsd.org/changeset/base/364312

Log:
  net80211: remove vertical whitespace

  No functional changes.

  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/net80211/ieee80211_ioctl.c

==
--- head/sys/net80211/ieee80211_ioctl.c Mon Aug 17 16:27:02 2020
(r364311)
+++ head/sys/net80211/ieee80211_ioctl.c Mon Aug 17 16:28:59 2020
(r364312)
@@ -1159,12 +1159,9 @@ ieee80211_ioctl_get80211(struct ieee80211vap 
*vap,

u_l
if (vap->iv_flags_ext & IEEE80211_FEXT_UAPSD)
ireq->i_val = 1;
break;
-
-   /* VHT */


Removed comment.


case IEEE80211_IOC_VHTCONF:
ireq->i_val = vap->iv_flags_vht & 
IEEE80211_FVHT_MASK;

break;
-
default:
error = ieee80211_ioctl_getdefault(vap, ireq);
break;



Yes. We don’t do comments on any of the other cases and this one did 
not say much anyway.


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


svn commit: r364312 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 16:28:59 2020
New Revision: 364312
URL: https://svnweb.freebsd.org/changeset/base/364312

Log:
  net80211: remove vertical whitespace
  
  No functional changes.
  
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Mon Aug 17 16:27:02 2020
(r364311)
+++ head/sys/net80211/ieee80211.c   Mon Aug 17 16:28:59 2020
(r364312)
@@ -529,8 +529,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ie
 
ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
-   ic_printf(ic, "%s: unable to allocate ifnet\n",
-   __func__);
+   ic_printf(ic, "%s: unable to allocate ifnet\n", __func__);
return ENOMEM;
}
if_initname(ifp, name, unit);
@@ -1210,9 +1209,7 @@ set_vht_extchan(struct ieee80211_channel *c)
}
 
printf("%s: unknown VHT channel type (ieee=%d, flags=0x%08x)\n",
-   __func__,
-   c->ic_ieee,
-   c->ic_flags);
+   __func__, c->ic_ieee, c->ic_flags);
 
return (0);
 }
@@ -1247,11 +1244,7 @@ addchan(struct ieee80211_channel chans[], int maxchans
 
 #if 0
printf("%s: %d: ieee=%d, freq=%d, flags=0x%08x\n",
-   __func__,
-   *nchans,
-   ieee,
-   freq,
-   flags);
+   __func__, *nchans, ieee, freq, flags);
 #endif
 
c = [(*nchans)++];
@@ -1281,9 +1274,7 @@ copychan_prev(struct ieee80211_channel chans[], int ma
 
 #if 0
printf("%s: %d: flags=0x%08x\n",
-   __func__,
-   *nchans,
-   flags);
+   __func__, *nchans, flags);
 #endif
 
c = [(*nchans)++];
@@ -1779,11 +1770,7 @@ ieee80211_lookup_channel_rxstatus(struct ieee80211vap 
 
IEEE80211_DPRINTF(vap, IEEE80211_MSG_INPUT,
"%s: freq=%d, ieee=%d, flags=0x%08x; c=%p\n",
-   __func__,
-   (int) rxs->c_freq,
-   (int) rxs->c_ieee,
-   flags,
-   c);
+   __func__, (int) rxs->c_freq, (int) rxs->c_ieee, flags, c);
 
return (c);
 }

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Mon Aug 17 16:27:02 2020
(r364311)
+++ head/sys/net80211/ieee80211_ioctl.c Mon Aug 17 16:28:59 2020
(r364312)
@@ -1159,12 +1159,9 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l
if (vap->iv_flags_ext & IEEE80211_FEXT_UAPSD)
ireq->i_val = 1;
break;
-
-   /* VHT */
case IEEE80211_IOC_VHTCONF:
ireq->i_val = vap->iv_flags_vht & IEEE80211_FVHT_MASK;
break;
-
default:
error = ieee80211_ioctl_getdefault(vap, ireq);
break;

Modified: head/sys/net80211/ieee80211_vht.c
==
--- head/sys/net80211/ieee80211_vht.c   Mon Aug 17 16:27:02 2020
(r364311)
+++ head/sys/net80211/ieee80211_vht.c   Mon Aug 17 16:28:59 2020
(r364312)
@@ -93,9 +93,7 @@ vht_recv_action_placeholder(struct ieee80211_node *ni,
 
 #ifdef IEEE80211_DEBUG
ieee80211_note(ni->ni_vap, "%s: called; fc=0x%.2x/0x%.2x",
-   __func__,
-   wh->i_fc[0],
-   wh->i_fc[1]);
+   __func__, wh->i_fc[0], wh->i_fc[1]);
 #endif
return (0);
 }
@@ -107,9 +105,7 @@ vht_send_action_placeholder(struct ieee80211_node *ni,
 
 #ifdef IEEE80211_DEBUG
ieee80211_note(ni->ni_vap, "%s: called; category=%d, action=%d",
-   __func__,
-   category,
-   action);
+   __func__, category, action);
 #endif
return (EINVAL);
 }
@@ -229,9 +225,7 @@ ieee80211_vht_announce(struct ieee80211com *ic)
if (tx == 3 && rx == 3)
continue;
ic_printf(ic, "[VHT] NSS %d: TX MCS 0..%d, RX MCS 0..%d\n",
-   i + 1,
-   vht_mcs_to_num(tx),
-   vht_mcs_to_num(rx));
+   i + 1, vht_mcs_to_num(tx), vht_mcs_to_num(rx));
}
 }
 
@@ -269,10 +263,7 @@ ieee80211_parse_vhtopmode(struct ieee80211_node *ni, c
 
 #if 0
printf("%s: chan1=%d, chan2=%d, chanwidth=%d, basicmcs=0x%04x\n",
-   __func__,
-   ni->ni_vht_chan1,
-   ni->ni_vht_chan2,
-   ni->ni_vht_chanwidth,
+   __func__, ni->ni_vht_chan1, ni->ni_vht_chan2, ni->ni_vht_chanwidth,
ni->ni_vht_basicmcs);
 #endif
 }
@@ -702,27 +693,20 @@ ieee80211_vht_get_chwidth_ie(struct ieee80211_channel 
 * well?
 */
 
-   if 

svn commit: r364305 - head/sys/net

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 13:51:25 2020
New Revision: 364305
URL: https://svnweb.freebsd.org/changeset/base/364305

Log:
  For consistency and to avoid any problems getting past the 31bit
  boundry change the last two IF_Mbps(2500) and additionally one
  IF_Mbps(5000) to ULL as well.
  
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net/if_media.h

Modified: head/sys/net/if_media.h
==
--- head/sys/net/if_media.h Mon Aug 17 13:08:04 2020(r364304)
+++ head/sys/net/if_media.h Mon Aug 17 13:51:25 2020(r364305)
@@ -807,9 +807,9 @@ struct ifmedia_baudrate {
{ IFM_ETHER | IFM_10G_KR,   IF_Gbps(10ULL) },   \
{ IFM_ETHER | IFM_10G_CR1,  IF_Gbps(10ULL) },   \
{ IFM_ETHER | IFM_20G_KR2,  IF_Gbps(20ULL) },   \
-   { IFM_ETHER | IFM_2500_KX,  IF_Mbps(2500) },\
-   { IFM_ETHER | IFM_2500_T,   IF_Mbps(2500) },\
-   { IFM_ETHER | IFM_5000_T,   IF_Mbps(5000) },\
+   { IFM_ETHER | IFM_2500_KX,  IF_Mbps(2500ULL) }, \
+   { IFM_ETHER | IFM_2500_T,   IF_Mbps(2500ULL) }, \
+   { IFM_ETHER | IFM_5000_T,   IF_Mbps(5000ULL) }, \
{ IFM_ETHER | IFM_50G_PCIE, IF_Gbps(50ULL) },   \
{ IFM_ETHER | IFM_25G_PCIE, IF_Gbps(25ULL) },   \
{ IFM_ETHER | IFM_1000_SGMII,   IF_Mbps(1000) },\
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364303 - in head: sbin/ifconfig sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 13:04:18 2020
New Revision: 364303
URL: https://svnweb.freebsd.org/changeset/base/364303

Log:
  80211: consistently order 160 and 80+80
  
  For flags and checks the order goes VHT160 and then VHT80P80 unless
  checks are in reverse order ("more comes first") in which case we
  deal with VHT80P80 first.
  The one reverse order to pick out is where we check channel
  prefernences.  While it may seem that VHT160 is better, finding
  two "free" channels (VHT 80+80) is more likely so we do prefer that.
  
  While dealing with VHT160 and VHT80P80 add extra clauses previously
  missing or marked TODO in a few places.
  
  Reviewed by:  adrian, gnn
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26002

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/_ieee80211.h
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_vht.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cMon Aug 17 13:02:01 2020
(r364302)
+++ head/sbin/ifconfig/ifieee80211.cMon Aug 17 13:04:18 2020
(r364303)
@@ -2176,8 +2176,6 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
 
/*
 * VHT first - HT is a subset.
-*
-* XXX TODO: VHT80P80, VHT160 is not yet done.
 */
if (flags & IEEE80211_CHAN_VHT) {
if ((chanFlags & IEEE80211_CHAN_VHT20) &&
@@ -2201,7 +2199,20 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
"VHT80 channel\n", freq);
continue;
}
-
+   if ((chanFlags & IEEE80211_CHAN_VHT160) &&
+   (flags & IEEE80211_CHAN_VHT160) == 0) {
+   if (verbose)
+   printf("%u: skip, not a "
+   "VHT160 channel\n", freq);
+   continue;
+   }
+   if ((chanFlags & IEEE80211_CHAN_VHT80P80) &&
+   (flags & IEEE80211_CHAN_VHT80P80) == 0) {
+   if (verbose)
+   printf("%u: skip, not a "
+   "VHT80+80 channel\n", freq);
+   continue;
+   }
flags &= ~IEEE80211_CHAN_VHT;
flags |= chanFlags & IEEE80211_CHAN_VHT;
}
@@ -3958,8 +3969,11 @@ get_chaninfo(const struct ieee80211_channel *c, int pr
if (IEEE80211_IS_CHAN_TURBO(c))
strlcat(buf, " Turbo", bsize);
if (precise) {
-   /* XXX should make VHT80U, VHT80D */
-   if (IEEE80211_IS_CHAN_VHT80(c) &&
+   if (IEEE80211_IS_CHAN_VHT80P80(c))
+   strlcat(buf, " vht/80p80", bsize);
+   else if (IEEE80211_IS_CHAN_VHT160(c))
+   strlcat(buf, " vht/160", bsize);
+   else if (IEEE80211_IS_CHAN_VHT80(c) &&
IEEE80211_IS_CHAN_HT40D(c))
strlcat(buf, " vht/80-", bsize);
else if (IEEE80211_IS_CHAN_VHT80(c) &&
@@ -4013,10 +4027,11 @@ print_chaninfo(const struct ieee80211_channel *c, int 
 static int
 chanpref(const struct ieee80211_channel *c)
 {
+
+   if (IEEE80211_IS_CHAN_VHT80P80(c))
+   return 90;
if (IEEE80211_IS_CHAN_VHT160(c))
return 80;
-   if (IEEE80211_IS_CHAN_VHT80P80(c))
-   return 75;
if (IEEE80211_IS_CHAN_VHT80(c))
return 70;
if (IEEE80211_IS_CHAN_VHT40(c))

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Mon Aug 17 13:02:01 2020
(r364302)
+++ head/sys/net80211/_ieee80211.h  Mon Aug 17 13:04:18 2020
(r364303)
@@ -157,7 +157,7 @@ struct ieee80211_channel {
 /*
  * Note: for VHT operation we will need significantly more than
  * IEEE80211_CHAN_MAX channels because of the combinations of
- * VHT20, VHT40, VHT80, VHT80+80 and VHT160.
+ * VHT20, VHT40, VHT80, VHT160, and VHT80+80.
  */
 #defineIEEE80211_CHAN_MAX  1024
 #defineIEEE80211_CHAN_BYTEShowmany(IEEE80211_CHAN_MAX, NBBY)
@@ -194,8 +194,8 @@ struct ieee80211_channel {
 #defineIEEE80211_CHAN_VHT40U   0x0200 /* VHT40 channel, ext above 
*/
 #define

svn commit: r364301 - in head: lib/lib80211 sbin/ifconfig sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 12:52:57 2020
New Revision: 364301
URL: https://svnweb.freebsd.org/changeset/base/364301

Log:
  80211: consistently spell 80P80
  
  The standard uses 80+80 and 80p80 but nowhere 80_80.
  Switch the latter to 80P80 for all the macros and comments refering
  to #defined flags which I could find.
  The only place we leave as 80p80 is the ifconfig command line arguments
  as we spell them all in lower case.
  Ideally we would use 80+80 for any interactions with the user and
  80P80 for anything internal but let us not confuse parsers and
  hence avoid the '+' in either case.
  
  Reviewed by:  adrian, gnn
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26001

Modified:
  head/lib/lib80211/lib80211_regdomain.c
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/_ieee80211.h
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/lib/lib80211/lib80211_regdomain.c
==
--- head/lib/lib80211/lib80211_regdomain.c  Mon Aug 17 12:47:08 2020
(r364300)
+++ head/lib/lib80211/lib80211_regdomain.c  Mon Aug 17 12:52:57 2020
(r364301)
@@ -192,7 +192,7 @@ decode_flag(struct mystate *mt, const char *p, int len
FLAG(IEEE80211_CHAN_VHT40),
FLAG(IEEE80211_CHAN_VHT80),
/*
-* XXX VHT80_80? This likely should be done by
+* XXX VHT80P80? This likely should be done by
 * 80MHz chan logic in net80211 / ifconfig.
 */
FLAG(IEEE80211_CHAN_VHT160),

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cMon Aug 17 12:47:08 2020
(r364300)
+++ head/sbin/ifconfig/ifieee80211.cMon Aug 17 12:52:57 2020
(r364301)
@@ -2177,7 +2177,7 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
/*
 * VHT first - HT is a subset.
 *
-* XXX TODO: VHT80p80, VHT160 is not yet done.
+* XXX TODO: VHT80P80, VHT160 is not yet done.
 */
if (flags & IEEE80211_CHAN_VHT) {
if ((chanFlags & IEEE80211_CHAN_VHT20) &&
@@ -2387,7 +2387,7 @@ regdomain_makechannels(
>dc_chaninfo);
}
 
-   /* XXX TODO: VHT80_80, VHT160 */
+   /* XXX TODO: VHT80P80, VHT160 */
}
 
if (!LIST_EMPTY(>bands_11ng) && dc->dc_htcaps != 0) {
@@ -4015,7 +4015,7 @@ chanpref(const struct ieee80211_channel *c)
 {
if (IEEE80211_IS_CHAN_VHT160(c))
return 80;
-   if (IEEE80211_IS_CHAN_VHT80_80(c))
+   if (IEEE80211_IS_CHAN_VHT80P80(c))
return 75;
if (IEEE80211_IS_CHAN_VHT80(c))
return 70;

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Mon Aug 17 12:47:08 2020
(r364300)
+++ head/sys/net80211/_ieee80211.h  Mon Aug 17 12:52:57 2020
(r364301)
@@ -194,7 +194,7 @@ struct ieee80211_channel {
 #defineIEEE80211_CHAN_VHT40U   0x0200 /* VHT40 channel, ext above 
*/
 #defineIEEE80211_CHAN_VHT40D   0x0400 /* VHT40 channel, ext below 
*/
 #defineIEEE80211_CHAN_VHT800x0800 /* VHT80 channel */
-#defineIEEE80211_CHAN_VHT80_80 0x1000 /* VHT80+80 channel */
+#defineIEEE80211_CHAN_VHT80P80 0x1000 /* VHT80+80 channel */
 #defineIEEE80211_CHAN_VHT160   0x2000 /* VHT160 channel */
 /* XXX note: 0x8000 is used in src/sbin/ifconfig/ifieee80211.c :( */
 
@@ -203,14 +203,14 @@ struct ieee80211_channel {
 
 #defineIEEE80211_CHAN_VHT40(IEEE80211_CHAN_VHT40U | 
IEEE80211_CHAN_VHT40D)
 #defineIEEE80211_CHAN_VHT  (IEEE80211_CHAN_VHT20 | 
IEEE80211_CHAN_VHT40 \
-   | IEEE80211_CHAN_VHT80 | 
IEEE80211_CHAN_VHT80_80 \
+   | IEEE80211_CHAN_VHT80 | 
IEEE80211_CHAN_VHT80P80 \
| IEEE80211_CHAN_VHT160)
 
 #defineIEEE80211_CHAN_BITS \
"\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \
"\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \
"\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D" \
-   "\031VHT20\032VHT40U\033VHT40D\034VHT80\035VHT80_80\036VHT160"
+   "\031VHT20\032VHT40U\033VHT40D\034VHT80\035VHT80P80\036VHT160"
 
 /*
  * Useful combinations of channel characteristics.
@@ -337,8 +337,8 @@ struct 

svn commit: r364299 - in head: sbin/ifconfig sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 12:43:07 2020
New Revision: 364299
URL: https://svnweb.freebsd.org/changeset/base/364299

Log:
  net80211 / ifconfig: cleanup the use of IEEE80211_FVHT_USEVHT*
  
  Rather then using magic numbers duplicate IEEE80211_FVHT_VHT* in
  ifconfig (cleanup of these and other flags used and not exposed by
  net80211 should happen later) and use those.
  In the kernel this simplifies one ioctl path (the other one currently
  relies on individual bit flags being passed in).
  We also re-order the 80P80 and 160 flag for 160 to come before 80+80
  and more clearly leave the flags as TODO in one of the 160/80+80 cases.
  
  Reviewed by:  adrian
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26000

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cMon Aug 17 12:38:35 2020
(r364298)
+++ head/sbin/ifconfig/ifieee80211.cMon Aug 17 12:43:07 2020
(r364299)
@@ -129,6 +129,15 @@
 #defineIEEE80211_NODE_UAPSD0x40/* UAPSD enabled */
 #endif
 
+/* XXX should also figure out where to put these for k/u-space sharing. */
+#ifndef IEEE80211_FVHT_VHT
+#defineIEEE80211_FVHT_VHT  0x1 /* CONF: VHT supported 
*/
+#defineIEEE80211_FVHT_USEVHT40 0x2 /* CONF: Use VHT40 */
+#defineIEEE80211_FVHT_USEVHT80 0x4 /* CONF: Use VHT80 */
+#defineIEEE80211_FVHT_USEVHT160 0x8/* CONF: Use VHT160 */
+#defineIEEE80211_FVHT_USEVHT80P80 0x00010  /* CONF: Use VHT 80+80 
*/
+#endif
+
 #defineMAXCHAN 1536/* max 1.5K channels */
 
 #defineMAXCOL  78
@@ -5331,26 +5340,26 @@ end:
 
if (IEEE80211_IS_CHAN_VHT(c) || verbose) {
getvhtconf(s);
-   if (vhtconf & 0x1)
+   if (vhtconf & IEEE80211_FVHT_VHT)
LINE_CHECK("vht");
else
LINE_CHECK("-vht");
-   if (vhtconf & 0x2)
+   if (vhtconf & IEEE80211_FVHT_USEVHT40)
LINE_CHECK("vht40");
else
LINE_CHECK("-vht40");
-   if (vhtconf & 0x4)
+   if (vhtconf & IEEE80211_FVHT_USEVHT80)
LINE_CHECK("vht80");
else
LINE_CHECK("-vht80");
-   if (vhtconf & 0x8)
-   LINE_CHECK("vht80p80");
-   else
-   LINE_CHECK("-vht80p80");
-   if (vhtconf & 0x10)
+   if (vhtconf & IEEE80211_FVHT_USEVHT160)
LINE_CHECK("vht160");
else
LINE_CHECK("-vht160");
+   if (vhtconf & IEEE80211_FVHT_USEVHT80P80)
+   LINE_CHECK("vht80p80");
+   else
+   LINE_CHECK("-vht80p80");
}
 
if (get80211val(s, IEEE80211_IOC_WME, ) != -1) {
@@ -5951,16 +5960,16 @@ static struct cmd ieee80211_cmds[] = {
DEF_CMD("-ht40",0,  set80211htconf),
DEF_CMD("ht",   3,  set80211htconf),/* NB: 20+40 */
DEF_CMD("-ht",  0,  set80211htconf),
-   DEF_CMD("vht",  1,  set80211vhtconf),
-   DEF_CMD("-vht", 0,  set80211vhtconf),
-   DEF_CMD("vht40",2,  set80211vhtconf),
-   DEF_CMD("-vht40",   -2, set80211vhtconf),
-   DEF_CMD("vht80",4,  set80211vhtconf),
-   DEF_CMD("-vht80",   -4, set80211vhtconf),
-   DEF_CMD("vht80p80", 8,  set80211vhtconf),
-   DEF_CMD("-vht80p80",-8, set80211vhtconf),
-   DEF_CMD("vht160",   16, set80211vhtconf),
-   DEF_CMD("-vht160",  -16,set80211vhtconf),
+   DEF_CMD("vht",  IEEE80211_FVHT_VHT, 
set80211vhtconf),
+   DEF_CMD("-vht", 0,  
set80211vhtconf),
+   DEF_CMD("vht40",IEEE80211_FVHT_USEVHT40,
set80211vhtconf),
+   DEF_CMD("-vht40",   -IEEE80211_FVHT_USEVHT40,   
set80211vhtconf),
+   DEF_CMD("vht80",IEEE80211_FVHT_USEVHT80,
set80211vhtconf),
+   DEF_CMD("-vht80",   -IEEE80211_FVHT_USEVHT80,   
set80211vhtconf),
+   DEF_CMD("vht160",   IEEE80211_FVHT_USEVHT160,   
set80211vhtconf),
+   DEF_CMD("-vht160",  -IEEE80211_FVHT_USEVHT160,  
set80211vhtconf),
+   DEF_CMD("vht80p80", IEEE80211_FVHT_USEVHT80P80, 
set80211vhtconf),
+   DEF_CMD("-vht80p80",

svn commit: r364075 - in head/sys: netinet netinet6

2020-08-10 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 10 10:58:43 2020
New Revision: 364075
URL: https://svnweb.freebsd.org/changeset/base/364075

Log:
  MC: add a note with reference to the discussion and history as-to why we
  are where we are now.  The main thing is to try to get rid of the delayed
  freeing to avoid blocking on the taskq when shutting down vnets.
  
  X-Timeout:if you still see this before 14-RELEASE remove it.

Modified:
  head/sys/netinet/in_mcast.c
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Mon Aug 10 10:52:54 2020(r364074)
+++ head/sys/netinet/in_mcast.c Mon Aug 10 10:58:43 2020(r364075)
@@ -251,6 +251,7 @@ inm_release_wait(void *arg __unused)
taskqueue_drain(taskqueue_inm_free, _free_task);
 }
 #ifdef VIMAGE
+/* XXX-BZ FIXME, see D24914. */
 VNET_SYSUNINIT(inm_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, 
inm_release_wait, NULL);
 #endif
 

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Mon Aug 10 10:52:54 2020
(r364074)
+++ head/sys/netinet6/in6_mcast.c   Mon Aug 10 10:58:43 2020
(r364075)
@@ -549,6 +549,7 @@ in6m_release_wait(void *arg __unused)
taskqueue_drain_all(taskqueue_in6m_free);
 }
 #ifdef VIMAGE
+/* XXX-BZ FIXME, see D24914. */
 VNET_SYSUNINIT(in6m_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, 
in6m_release_wait, NULL);
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364043 - head/sys/cam/mmc

2020-08-07 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug  7 19:58:16 2020
New Revision: 364043
URL: https://svnweb.freebsd.org/changeset/base/364043

Log:
  mmc_da: fix memory leak in sddaregister()
  
  In case we are failing to allocate mmcdata, we are returning with
  a softc allocated but not attached to anything and thus leak the
  memory.
  
  Reviewed by:  scottl
  MFC after:2 weeks
  X-MFC:only if we also mfc other mmccam changes?
  Differential Revision:https://reviews.freebsd.org/D25987

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Fri Aug  7 19:36:08 2020(r364042)
+++ head/sys/cam/mmc/mmc_da.c   Fri Aug  7 19:58:16 2020(r364043)
@@ -789,7 +789,6 @@ sddaregister(struct cam_periph *periph, void *arg)
 
softc = (struct sdda_softc *)malloc(sizeof(*softc), M_DEVBUF,
M_NOWAIT|M_ZERO);
-
if (softc == NULL) {
printf("sddaregister: Unable to probe new device. "
"Unable to allocate softc\n");
@@ -802,6 +801,7 @@ sddaregister(struct cam_periph *periph, void *arg)
if (softc->mmcdata == NULL) {
printf("sddaregister: Unable to probe new device. "
"Unable to allocate mmcdata\n");
+   free(softc, M_DEVBUF);
return (CAM_REQ_CMP_ERR);
}
periph->softc = softc;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364018 - in head/sys: netinet netinet6 sys

2020-08-07 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug  7 15:13:53 2020
New Revision: 364018
URL: https://svnweb.freebsd.org/changeset/base/364018

Log:
  IPV6_PKTINFO support for v4-mapped IPv6 sockets
  
  When using v4-mapped IPv6 sockets with IPV6_PKTINFO we do not
  respect the given v4-mapped src address on the IPv4 socket.
  Implement the needed functionality. This allows single-socket
  UDP applications (such as OpenVPN) to work better on FreeBSD.
  
  Requested by: Gert Doering (gert greenie.net), pfsense
  Tested by:Gert Doering (gert greenie.net)
  Reviewed by:  melifaro
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24135

Modified:
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/udp6_usrreq.c
  head/sys/sys/protosw.h

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Fri Aug  7 15:11:27 2020
(r364017)
+++ head/sys/netinet/udp_usrreq.c   Fri Aug  7 15:13:53 2020
(r364018)
@@ -163,7 +163,7 @@ VNET_PCPUSTAT_SYSUNINIT(udpstat);
 #ifdef INET
 static voidudp_detach(struct socket *so);
 static int udp_output(struct inpcb *, struct mbuf *, struct sockaddr *,
-   struct mbuf *, struct thread *);
+   struct mbuf *, struct thread *, int);
 #endif
 
 static void
@@ -1083,9 +1083,65 @@ udp_ctloutput(struct socket *so, struct sockopt *sopt)
 }
 
 #ifdef INET
+#ifdef INET6
+/* The logic here is derived from ip6_setpktopt(). See comments there. */
 static int
+udp_v4mapped_pktinfo(struct cmsghdr *cm, struct sockaddr_in * src,
+struct inpcb *inp, int flags)
+{
+   struct ifnet *ifp;
+   struct in6_pktinfo *pktinfo;
+   struct in_addr ia;
+
+   if ((flags & PRUS_IPV6) == 0)
+   return (0);
+
+   if (cm->cmsg_level != IPPROTO_IPV6)
+   return (0);
+
+   if  (cm->cmsg_type != IPV6_2292PKTINFO &&
+   cm->cmsg_type != IPV6_PKTINFO)
+   return (0);
+
+   if (cm->cmsg_len !=
+   CMSG_LEN(sizeof(struct in6_pktinfo)))
+   return (EINVAL);
+
+   pktinfo = (struct in6_pktinfo *)CMSG_DATA(cm);
+   if (!IN6_IS_ADDR_V4MAPPED(>ipi6_addr) &&
+   !IN6_IS_ADDR_UNSPECIFIED(>ipi6_addr))
+   return (EINVAL);
+
+   /* Validate the interface index if specified. */
+   if (pktinfo->ipi6_ifindex > V_if_index)
+   return (ENXIO);
+
+   ifp = NULL;
+   if (pktinfo->ipi6_ifindex) {
+   ifp = ifnet_byindex(pktinfo->ipi6_ifindex);
+   if (ifp == NULL)
+   return (ENXIO);
+   }
+   if (ifp != NULL && !IN6_IS_ADDR_UNSPECIFIED(>ipi6_addr)) {
+
+   ia.s_addr = pktinfo->ipi6_addr.s6_addr32[3];
+   if (in_ifhasaddr(ifp, ia) == 0)
+   return (EADDRNOTAVAIL);
+   }
+
+   bzero(src, sizeof(*src));
+   src->sin_family = AF_INET;
+   src->sin_len = sizeof(*src);
+   src->sin_port = inp->inp_lport;
+   src->sin_addr.s_addr = pktinfo->ipi6_addr.s6_addr32[3];
+
+   return (0);
+}
+#endif
+
+static int
 udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
-struct mbuf *control, struct thread *td)
+struct mbuf *control, struct thread *td, int flags)
 {
struct udpiphdr *ui;
int len = m->m_pkthdr.len;
@@ -1149,6 +1205,11 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
error = EINVAL;
break;
}
+#ifdef INET6
+   error = udp_v4mapped_pktinfo(cm, , inp, flags);
+   if (error != 0)
+   break;
+#endif
if (cm->cmsg_level != IPPROTO_IP)
continue;
 
@@ -1696,7 +1757,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m,
 
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("udp_send: inp == NULL"));
-   return (udp_output(inp, m, addr, control, td));
+   return (udp_output(inp, m, addr, control, td, flags));
 }
 #endif /* INET */
 

Modified: head/sys/netinet6/udp6_usrreq.c
==
--- head/sys/netinet6/udp6_usrreq.c Fri Aug  7 15:11:27 2020
(r364017)
+++ head/sys/netinet6/udp6_usrreq.c Fri Aug  7 15:13:53 2020
(r364018)
@@ -784,7 +784,7 @@ udp6_output(struct socket *so, int flags_arg, struct m
in6_sin6_2_sin_in_sock((struct sockaddr *)sin6);
pru = inetsw[ip_protox[nxt]].pr_usrreqs;
/* addr will just be freed in sendit(). */
-   return ((*pru->pru_send)(so, flags_arg, m,
+   return ((*pru->pru_send)(so, flags_arg | PRUS_IPV6, m,
(struct sockaddr *)sin6, control, td));
}
} 

svn commit: r364012 - head/lib/lib80211

2020-08-07 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug  7 12:47:00 2020
New Revision: 364012
URL: https://svnweb.freebsd.org/changeset/base/364012

Log:
  lib80211: fix indentation of comments for some netbands.
  
  Whitespace only; no functional changes.
  
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/lib/lib80211/lib80211_regdomain.h

Modified: head/lib/lib80211/lib80211_regdomain.h
==
--- head/lib/lib80211/lib80211_regdomain.h  Fri Aug  7 12:24:23 2020
(r364011)
+++ head/lib/lib80211/lib80211_regdomain.h  Fri Aug  7 12:47:00 2020
(r364012)
@@ -73,10 +73,10 @@ struct regdomain {
netband_head bands_11b; /* 11b operation */
netband_head bands_11g; /* 11g operation */
netband_head bands_11a; /* 11a operation */
-   netband_head bands_11ng;/* 11ng operation */
-   netband_head bands_11na;/* 11na operation */
-   netband_head bands_11ac;/* 11ac 5GHz operation */
-   netband_head bands_11acg;/* 11ac 2GHz operation */
+   netband_head bands_11ng;/* 11ng operation */
+   netband_head bands_11na;/* 11na operation */
+   netband_head bands_11ac;/* 11ac 5GHz operation */
+   netband_head bands_11acg;   /* 11ac 2GHz operation */
 
LIST_ENTRY(regdomain)   next;
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364011 - in head: sbin/ifconfig share/man/man4 sys/net80211

2020-08-07 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug  7 12:24:23 2020
New Revision: 364011
URL: https://svnweb.freebsd.org/changeset/base/364011

Log:
  net80211/ifconfig: print hardware device name for wlan interfaces
  
  Add IEEE80211_IOC_IC_NAME to query the ic_name field and in ifconfig
  to print the parent interface again. This functionality was lost
  around r287197. It helps in case of multiple wlan interfaces and
  multiple underlying hardware devices to keep track which wlan
  interface belongs to which physical device.
  
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Reviewed by:  adrian, Idwer Vollering
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25832

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/share/man/man4/net80211.4
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_ioctl.h

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cFri Aug  7 12:19:21 2020
(r364010)
+++ head/sbin/ifconfig/ifieee80211.cFri Aug  7 12:24:23 2020
(r364011)
@@ -4779,6 +4779,23 @@ getid(int s, int ix, void *data, size_t len, int *plen
return 0;
 }
 
+static int
+getdevicename(int s, void *data, size_t len, int *plen)
+{
+   struct ieee80211req ireq;
+
+   (void) memset(, 0, sizeof(ireq));
+   (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name));
+   ireq.i_type = IEEE80211_IOC_IC_NAME;
+   ireq.i_val = -1;
+   ireq.i_data = data;
+   ireq.i_len = len;
+   if (ioctl(s, SIOCG80211, ) < 0)
+   return (-1);
+   *plen = ireq.i_len;
+   return (0);
+}
+
 static void
 ieee80211_status(int s)
 {
@@ -5501,6 +5518,12 @@ end:
LINE_CHECK("hwmpmaxhops %u", val);
}
}
+
+   LINE_BREAK();
+
+   if (getdevicename(s, data, sizeof(data), ) < 0)
+   return;
+   LINE_CHECK("parent interface: %s", data);
 
LINE_BREAK();
 }

Modified: head/share/man/man4/net80211.4
==
--- head/share/man/man4/net80211.4  Fri Aug  7 12:19:21 2020
(r364010)
+++ head/share/man/man4/net80211.4  Fri Aug  7 12:24:23 2020
(r364011)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 10, 2009
+.Dd August 7, 2020
 .Dt NET80211 4
 .Os
 .Sh NAME
@@ -393,6 +393,16 @@ Valid values are:
 and
 .Dv IEEE80211_HWMP_ROOTMODE_RANN
 (send broadcast Root Announcement (RANN) frames).
+.It Dv IEEE80211_IOC_IC_NAME
+Return the underlying hardware
+.Xr device 9
+name in the buffer pointed to by
+.Va i_data
+and the name length including terminating NUL character in
+.Va i_len .
+If the buffer length is too small to hold the full name
+.Er EINVAL
+will be returned.
 .It Dv IEEE80211_IOC_INACTIVITY
 Return whether or not the system handles inactivity processing in
 .Va i_val .

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Fri Aug  7 12:19:21 2020
(r364010)
+++ head/sys/net80211/ieee80211_ioctl.c Fri Aug  7 12:24:23 2020
(r364011)
@@ -785,6 +785,13 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l
int error = 0;
 
switch (ireq->i_type) {
+   case IEEE80211_IOC_IC_NAME:
+   len = strlen(ic->ic_name) + 1;
+   if (len > ireq->i_len)
+   return (EINVAL);
+   ireq->i_len = len;
+   error = copyout(ic->ic_name, ireq->i_data, ireq->i_len);
+   break;
case IEEE80211_IOC_SSID:
switch (vap->iv_state) {
case IEEE80211_S_INIT:

Modified: head/sys/net80211/ieee80211_ioctl.h
==
--- head/sys/net80211/ieee80211_ioctl.h Fri Aug  7 12:19:21 2020
(r364010)
+++ head/sys/net80211/ieee80211_ioctl.h Fri Aug  7 12:24:23 2020
(r364011)
@@ -743,6 +743,9 @@ struct ieee80211req {
 #defineIEEE80211_IOC_QUIET_OFFSET  207 /* Quiet Offset */
 #defineIEEE80211_IOC_QUIET_DUR 208 /* Quiet Duration */
 #defineIEEE80211_IOC_QUIET_COUNT   209 /* Quiet Count */
+
+#defineIEEE80211_IOC_IC_NAME   210 /* HW device name. */
+
 /*
  * Parameters for controlling a scan requested with
  * IEEE80211_IOC_SCAN_REQ.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r363862 - head/sys/cam/mmc

2020-08-05 Thread Bjoern A. Zeeb

On 4 Aug 2020, at 20:04, Emmanuel Vadot wrote:


Author: manu
Date: Tue Aug  4 20:04:00 2020
New Revision: 363862
URL: https://svnweb.freebsd.org/changeset/base/363862

Log:
  mmccam: Hold the periph during init

  We need to sleep during this routine so acquire the cam hold too.


Turns out that with this my /dev/sddaX.. device nodes are never created.
Reverting this and things work a lot better again.




  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D25946

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Aug  4 20:02:23 2020(r363861)
+++ head/sys/cam/mmc/mmc_da.c   Tue Aug  4 20:04:00 2020(r363862)
@@ -1109,7 +1109,9 @@ sdda_start_init_task(void *context, int pending) 
{

  CAM_PRIORITY_NONE);

cam_periph_lock(periph);
+   cam_periph_hold(periph, PRIBIO|PCATCH);
sdda_start_init(context, new_ccb);
+   cam_periph_unhold(periph);
cam_periph_unlock(periph);
xpt_free_ccb(new_ccb);
 }

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


Re: svn commit: r363489 - head/sys/dev/mmc/host

2020-07-24 Thread Bjoern A. Zeeb
On 24 Jul 2020, at 19:52, Emmanuel Vadot wrote:

> Author: manu
> Date: Fri Jul 24 19:52:52 2020
> New Revision: 363489
> URL: https://svnweb.freebsd.org/changeset/base/363489
>
> Log:
>   dwmmc: Add MMCCAM part
>
>   Add support for MMCCAM for dwmmc
>
>   Submitted by:   kibab
>   Tested On:  Rock64, RockPro64

And nanopc-t4.

Thank you both for all the work!!!

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


Re: svn commit: r363061 - in head/usr.sbin/wpa: hostapd wpa_supplicant

2020-07-10 Thread Bjoern A. Zeeb
On 9 Jul 2020, at 23:01, Cy Schubert wrote:

> Author: cy
> Date: Thu Jul  9 23:01:36 2020
> New Revision: 363061
> URL: https://svnweb.freebsd.org/changeset/base/363061
>
> Log:
>   Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
>   hostapd and wpa_supplicant.

Thank you for also doing wpa_supplicant.


>   Submitted by:   bz
>   MFC after:  2 weeks
>   Relnotes:   yes
>   Sponsored by:   Rubicon Communications, LLC (d/b/a "Netgate")
>
> Modified:
>   head/usr.sbin/wpa/hostapd/Makefile
>   head/usr.sbin/wpa/wpa_supplicant/Makefile
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r362815 - head/sys/net80211

2020-07-01 Thread Bjoern A. Zeeb

On 1 Jul 2020, at 0:23, Adrian Chadd wrote:


Author: adrian
Date: Wed Jul  1 00:23:49 2020
New Revision: 362815
URL: https://svnweb.freebsd.org/changeset/base/362815

Log:
  [net80211] Migrate HT/legacy protection mode and preamble 
calculation to per-VAP flags


can you please put these changes into Phabricator with adequate time to 
get the reviewed in the future?



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


svn commit: r362494 - stable/12/sys/netinet

2020-06-22 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Jun 22 10:52:30 2020
New Revision: 362494
URL: https://svnweb.freebsd.org/changeset/base/362494

Log:
  MFC r362472:
  
Rather than zeroing MAXVIFS times size of pointer [r362289] (still better 
than
sizeof pointer before [r354857]), we need to zero MAXVIFS times the size of
the struct.  All good things come in threes; I hope this is it on this one.
  
  PR:   246629, 206583
  Reported by:  kib

Modified:
  stable/12/sys/netinet/ip_mroute.c

Modified: stable/12/sys/netinet/ip_mroute.c
==
--- stable/12/sys/netinet/ip_mroute.c   Mon Jun 22 10:49:50 2020
(r362493)
+++ stable/12/sys/netinet/ip_mroute.c   Mon Jun 22 10:52:30 2020
(r362494)
@@ -739,7 +739,7 @@ X_ip_mrouter_done(void)
if_allmulti(ifp, 0);
}
 }
-bzero((caddr_t)V_viftable, sizeof(V_viftable) * MAXVIFS);
+bzero((caddr_t)V_viftable, sizeof(*V_viftable) * MAXVIFS);
 V_numvifs = 0;
 V_pim_assert_enabled = 0;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362472 - head/sys/netinet

2020-06-21 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Jun 21 22:09:30 2020
New Revision: 362472
URL: https://svnweb.freebsd.org/changeset/base/362472

Log:
  Rather than zeroing MAXVIFS times size of pointer [r362289] (still better than
  sizeof pointer before [r354857]), we need to zero MAXVIFS times the size of
  the struct.  All good things come in threes; I hope this is it on this one.
  
  PR:   246629, 206583
  Reported by:  kib
  MFC after:ASAP

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cSun Jun 21 22:02:49 2020
(r362471)
+++ head/sys/netinet/ip_mroute.cSun Jun 21 22:09:30 2020
(r362472)
@@ -740,7 +740,7 @@ X_ip_mrouter_done(void)
if_allmulti(ifp, 0);
}
 }
-bzero((caddr_t)V_viftable, sizeof(V_viftable) * MAXVIFS);
+bzero((caddr_t)V_viftable, sizeof(*V_viftable) * MAXVIFS);
 V_numvifs = 0;
 V_pim_assert_enabled = 0;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362465 - stable/12/sys/netinet

2020-06-21 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Jun 21 11:48:55 2020
New Revision: 362465
URL: https://svnweb.freebsd.org/changeset/base/362465

Log:
  MFC r362289:
  
When converting the static arrays to mallocarray() in r356621 I missed
one place where we now need to multiply the size of the struct with the
number of entries.  This lead to problems when restarting user space
daemons, as the cleanup was never properly done, resulting in MRT_ADD_VIF
EADDRINUSE.
Properly zero all array elements to avoid this problem.
  
  PR:   246629, 206583

Modified:
  stable/12/sys/netinet/ip_mroute.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/ip_mroute.c
==
--- stable/12/sys/netinet/ip_mroute.c   Sun Jun 21 11:42:49 2020
(r362464)
+++ stable/12/sys/netinet/ip_mroute.c   Sun Jun 21 11:48:55 2020
(r362465)
@@ -739,7 +739,7 @@ X_ip_mrouter_done(void)
if_allmulti(ifp, 0);
}
 }
-bzero((caddr_t)V_viftable, sizeof(V_viftable));
+bzero((caddr_t)V_viftable, sizeof(V_viftable) * MAXVIFS);
 V_numvifs = 0;
 V_pim_assert_enabled = 0;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362289 - head/sys/netinet

2020-06-17 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Jun 17 21:04:38 2020
New Revision: 362289
URL: https://svnweb.freebsd.org/changeset/base/362289

Log:
  When converting the static arrays to mallocarray() in r356621 I missed
  one place where we now need to multiply the size of the struct with the
  number of entries.  This lead to problems when restarting user space
  daemons, as the cleanup was never properly done, resulting in MRT_ADD_VIF
  EADDRINUSE.
  Properly zero all array elements to avoid this problem.
  
  PR:   246629, 206583
  Reported by:  (many)
  MFC after:4 days
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cWed Jun 17 20:58:37 2020
(r362288)
+++ head/sys/netinet/ip_mroute.cWed Jun 17 21:04:38 2020
(r362289)
@@ -740,7 +740,7 @@ X_ip_mrouter_done(void)
if_allmulti(ifp, 0);
}
 }
-bzero((caddr_t)V_viftable, sizeof(V_viftable));
+bzero((caddr_t)V_viftable, sizeof(V_viftable) * MAXVIFS);
 V_numvifs = 0;
 V_pim_assert_enabled = 0;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362288 - head/sys/netinet

2020-06-17 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Jun 17 20:58:37 2020
New Revision: 362288
URL: https://svnweb.freebsd.org/changeset/base/362288

Log:
  The call into ifa_ifwithaddr() needs to be epoch protected; ortherwise
  we'll panic on an assertion.
  While here, leave a comment that the ifp was never protected and stable
  (as glebius pointed out) and this needs to be fixed properly.
  
  Discovered while working on:  PR 246629
  Reviewed by:  glebius
  MFC after:4 days
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cWed Jun 17 19:57:59 2020
(r362287)
+++ head/sys/netinet/ip_mroute.cWed Jun 17 20:58:37 2020
(r362288)
@@ -879,13 +879,19 @@ add_vif(struct vifctl *vifcp)
 */
ifp = NULL;
 } else {
+   struct epoch_tracker et;
+
sin.sin_addr = vifcp->vifc_lcl_addr;
+   NET_EPOCH_ENTER(et);
ifa = ifa_ifwithaddr((struct sockaddr *));
if (ifa == NULL) {
+   NET_EPOCH_EXIT(et);
VIF_UNLOCK();
return EADDRNOTAVAIL;
}
ifp = ifa->ifa_ifp;
+   /* XXX FIXME we need to take a ref on ifp and cleanup properly! */
+   NET_EPOCH_EXIT(et);
 }
 
 if ((vifcp->vifc_flags & VIFF_TUNNEL) != 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Bjoern A. Zeeb

On 2 Jun 2020, at 10:36, Emmanuel Vadot wrote:


 Hello Hans,

On Tue, 2 Jun 2020 10:19:45 + (UTC)
Hans Petter Selasky  wrote:


Author: hselasky
Date: Tue Jun  2 10:19:45 2020
New Revision: 361723
URL: https://svnweb.freebsd.org/changeset/base/361723

Log:
  Implement struct_size() function macro in the LinuxKPI.

  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h	Tue Jun  2 
09:45:43 2020	(r361722)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h	Tue Jun  2 
10:19:45 2020	(r361723)

@@ -555,4 +555,10 @@ linux_ratelimited(linux_ratelimit_t *rl)
return (ppsratecheck(>lasttime, >counter, 1));
 }

+#definestruct_size(ptr, field, num) ({ \
+   const size_t __size = offsetof(__typeof(*(ptr)), field); \
+	const size_t __max = (SIZE_MAX - __size) / sizeof((ptr)->field[0]); 
\
+	((num) > __max) ? SIZE_MAX : (__size + sizeof((ptr)->field[0]) * 
(num)); \

+})
+
 #endif /* _LINUX_KERNEL_H_ */


 Can you bump FreeBSD_version so I can fix
https://github.com/freebsd/drm-kmod/ and update the
graphics/drm-devel-kmod port please ?


I almost wonder if we want a “linuxkkpi version” to check instead.
If there’s a lot more “work” on the linuxkpi we might not want to 
bump __FreeBSD_version for every change which can conflict/affect 
external code?


/bz

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


svn commit: r361444 - svnadmin/conf

2020-05-25 Thread Bjoern A. Zeeb
Author: bz
Date: Mon May 25 09:52:44 2020
New Revision: 361444
URL: https://svnweb.freebsd.org/changeset/base/361444

Log:
  Release Peter Grehan (grehan) from "mentor ship".
  He can surf on his own again.

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Mon May 25 07:18:47 2020(r361443)
+++ svnadmin/conf/mentors   Mon May 25 09:52:44 2020(r361444)
@@ -17,7 +17,6 @@ brd   allanjude   Co-mentor: bapt
 chsimp
 freqlabs   mav Co-mentor: mmacy
 gordon delphij Co-mentor: emaste
-grehan bz
 jceel  trasz
 jkhrwatson
 johalunimp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359630 - svnadmin/conf

2020-04-04 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Apr  4 11:11:27 2020
New Revision: 359630
URL: https://svnweb.freebsd.org/changeset/base/359630

Log:
  Welcome Peter Grehan (grehan) back (see r334992) as a source committer.
  I'll be "mentoring".
  
  Approved by:  core (core-secretary)

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessSat Apr  4 07:43:47 2020(r359629)
+++ svnadmin/conf/accessSat Apr  4 11:11:27 2020(r359630)
@@ -86,6 +86,7 @@ glebius
 gnn
 gonzo
 gordon
+grehan
 grog
 gshapiro   freebsd-cvs-committ...@g.gshapiro.net
 harti

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Sat Apr  4 07:43:47 2020(r359629)
+++ svnadmin/conf/mentors   Sat Apr  4 11:11:27 2020(r359630)
@@ -17,6 +17,7 @@ brd   allanjude   Co-mentor: bapt
 chsimp
 freqlabs   mav Co-mentor: mmacy
 gordon delphij Co-mentor: emaste
+grehan bz
 jceel  trasz
 jkhrwatson
 johalunimp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359020 - stable/11/sys/kern

2020-03-16 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Mar 16 21:12:32 2020
New Revision: 359020
URL: https://svnweb.freebsd.org/changeset/base/359020

Log:
  MFC r358992:
  
kern_jail: missing \0 termination check on osrelease parameter
  
If a user spplies a non-\0 terminated osrelease parameter reading it back
may disclose kernel memory.
This is a problem in case of nested jails (children.max > 0, which is not
the default).  Otherwise root outside the jail has access to kernel memory
by other means and root inside a jail cannot create a child jail.
  
Add the proper \0 check at the end of a supplied osrelease parameter and
make sure any copies of the field will be \0-terminated.
  
Submitted by:   Hans Christian Woithe (chwoithe yahoo.com)

Modified:
  stable/11/sys/kern/kern_jail.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_jail.c
==
--- stable/11/sys/kern/kern_jail.c  Mon Mar 16 19:33:50 2020
(r359019)
+++ stable/11/sys/kern/kern_jail.c  Mon Mar 16 21:12:32 2020
(r359020)
@@ -881,8 +881,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
"osrelease cannot be changed after creation");
goto done_errmsg;
}
-   if (len == 0 || len >= OSRELEASELEN) {
+   if (len == 0 || osrelstr[len - 1] != '\0') {
error = EINVAL;
+   goto done_free;
+   }
+   if (len >= OSRELEASELEN) {
+   error = ENAMETOOLONG;
vfs_opterror(opts,
"osrelease string must be 1-%d bytes long",
OSRELEASELEN - 1);
@@ -1272,9 +1276,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
 
pr->pr_osreldate = osreldt ? osreldt : ppr->pr_osreldate;
if (osrelstr == NULL)
-   strcpy(pr->pr_osrelease, ppr->pr_osrelease);
+   strlcpy(pr->pr_osrelease, ppr->pr_osrelease,
+   sizeof(pr->pr_osrelease));
else
-   strcpy(pr->pr_osrelease, osrelstr);
+   strlcpy(pr->pr_osrelease, osrelstr,
+   sizeof(pr->pr_osrelease));
 
LIST_INIT(>pr_children);
mtx_init(>pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359021 - stable/12/sys/kern

2020-03-16 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Mar 16 21:12:46 2020
New Revision: 359021
URL: https://svnweb.freebsd.org/changeset/base/359021

Log:
  MFC r358992:
  
kern_jail: missing \0 termination check on osrelease parameter
  
If a user spplies a non-\0 terminated osrelease parameter reading it back
may disclose kernel memory.
This is a problem in case of nested jails (children.max > 0, which is not
the default).  Otherwise root outside the jail has access to kernel memory
by other means and root inside a jail cannot create a child jail.
  
Add the proper \0 check at the end of a supplied osrelease parameter and
make sure any copies of the field will be \0-terminated.
  
Submitted by:   Hans Christian Woithe (chwoithe yahoo.com)

Modified:
  stable/12/sys/kern/kern_jail.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_jail.c
==
--- stable/12/sys/kern/kern_jail.c  Mon Mar 16 21:12:32 2020
(r359020)
+++ stable/12/sys/kern/kern_jail.c  Mon Mar 16 21:12:46 2020
(r359021)
@@ -862,8 +862,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
"osrelease cannot be changed after creation");
goto done_errmsg;
}
-   if (len == 0 || len >= OSRELEASELEN) {
+   if (len == 0 || osrelstr[len - 1] != '\0') {
error = EINVAL;
+   goto done_free;
+   }
+   if (len >= OSRELEASELEN) {
+   error = ENAMETOOLONG;
vfs_opterror(opts,
"osrelease string must be 1-%d bytes long",
OSRELEASELEN - 1);
@@ -1253,9 +1257,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
 
pr->pr_osreldate = osreldt ? osreldt : ppr->pr_osreldate;
if (osrelstr == NULL)
-   strcpy(pr->pr_osrelease, ppr->pr_osrelease);
+   strlcpy(pr->pr_osrelease, ppr->pr_osrelease,
+   sizeof(pr->pr_osrelease));
else
-   strcpy(pr->pr_osrelease, osrelstr);
+   strlcpy(pr->pr_osrelease, osrelstr,
+   sizeof(pr->pr_osrelease));
 
LIST_INIT(>pr_children);
mtx_init(>pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358992 - head/sys/kern

2020-03-14 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 14 14:04:55 2020
New Revision: 358992
URL: https://svnweb.freebsd.org/changeset/base/358992

Log:
  kern_jail: missing \0 termination check on osrelease parameter
  
  If a user spplies a non-\0 terminated osrelease parameter reading it back
  may disclose kernel memory.
  This is a problem in case of nested jails (children.max > 0, which is not
  the default).  Otherwise root outside the jail has access to kernel memory
  by other means and root inside a jail cannot create a child jail.
  
  Add the proper \0 check at the end of a supplied osrelease parameter and
  make sure any copies of the field will be \0-terminated.
  
  Submitted by: Hans Christian Woithe (chwoithe yahoo.com)
  MFC after:3 days

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Sat Mar 14 11:55:27 2020(r358991)
+++ head/sys/kern/kern_jail.c   Sat Mar 14 14:04:55 2020(r358992)
@@ -865,8 +865,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
"osrelease cannot be changed after creation");
goto done_errmsg;
}
-   if (len == 0 || len >= OSRELEASELEN) {
+   if (len == 0 || osrelstr[len - 1] != '\0') {
error = EINVAL;
+   goto done_free;
+   }
+   if (len >= OSRELEASELEN) {
+   error = ENAMETOOLONG;
vfs_opterror(opts,
"osrelease string must be 1-%d bytes long",
OSRELEASELEN - 1);
@@ -1241,9 +1245,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
 
pr->pr_osreldate = osreldt ? osreldt : ppr->pr_osreldate;
if (osrelstr == NULL)
-   strcpy(pr->pr_osrelease, ppr->pr_osrelease);
+   strlcpy(pr->pr_osrelease, ppr->pr_osrelease,
+   sizeof(pr->pr_osrelease));
else
-   strcpy(pr->pr_osrelease, osrelstr);
+   strlcpy(pr->pr_osrelease, osrelstr,
+   sizeof(pr->pr_osrelease));
 
LIST_INIT(>pr_children);
mtx_init(>pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358897 - head/share/man/man4

2020-03-11 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Mar 11 20:23:36 2020
New Revision: 358897
URL: https://svnweb.freebsd.org/changeset/base/358897

Log:
  Correctly spell TUNABLES.

Modified:
  head/share/man/man4/liquidio.4

Modified: head/share/man/man4/liquidio.4
==
--- head/share/man/man4/liquidio.4  Wed Mar 11 20:20:21 2020
(r358896)
+++ head/share/man/man4/liquidio.4  Wed Mar 11 20:23:36 2020
(r358897)
@@ -77,7 +77,7 @@ LiquidIO II CN2350 210SV/225SV
 .It
 LiquidIO II CN2360 210SV/225SV
 .El
-.Sh LOADER TUBABLES
+.Sh LOADER TUNABLES
 Tunables can be set at the
 .Xr loader 8
 prompt before booting the kernel or stored in
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358625 - head/sys/net

2020-03-04 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Mar  4 17:17:02 2020
New Revision: 358625
URL: https://svnweb.freebsd.org/changeset/base/358625

Log:
  Implement optional table entry limits for if_llatbl.
  
  Implement counting of table entries linked on a per-table base
  with an optional (if set > 0) limit of the maximum number of table
  entries.
  
  For that the public lltable_link_entry() and lltable_unlink_entry()
  functions as well as the internal function pointers change from void
  to having an int return type.
  
  Given no consumer currently sets the new llt_maxentries this can be
  committed on its own.  The moment we make use of the table limits,
  the callers of the link function must check the return value as
  it can change and entries might not be added.
  
  Adjustments for IPv6 (and possibly IPv4) will follow.
  
  Sponsored by: Netflix (originally)
  Reviewed by:  melifaro
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D22713

Modified:
  head/sys/net/if_llatbl.c
  head/sys/net/if_llatbl.h

Modified: head/sys/net/if_llatbl.c
==
--- head/sys/net/if_llatbl.cWed Mar  4 17:13:35 2020(r358624)
+++ head/sys/net/if_llatbl.cWed Mar  4 17:17:02 2020(r358625)
@@ -153,17 +153,29 @@ htable_foreach_lle(struct lltable *llt, llt_foreach_cb
return (error);
 }
 
-static void
+/*
+ * The htable_[un]link_entry() functions return:
+ * 0 if the entry was (un)linked already and nothing changed,
+ * 1 if the entry was added/removed to/from the table, and
+ * -1 on error (e.g., not being able to add the entry due to limits reached).
+ * While the "unlink" operation should never error, callers of
+ * lltable_link_entry() need to check for errors and handle them.
+ */
+static int
 htable_link_entry(struct lltable *llt, struct llentry *lle)
 {
struct llentries *lleh;
uint32_t hashidx;
 
if ((lle->la_flags & LLE_LINKED) != 0)
-   return;
+   return (0);
 
IF_AFDATA_WLOCK_ASSERT(llt->llt_ifp);
 
+   if (llt->llt_maxentries > 0 &&
+   llt->llt_entries >= llt->llt_maxentries)
+   return (-1);
+
hashidx = llt->llt_hash(lle, llt->llt_hsize);
lleh = >lle_head[hashidx];
 
@@ -171,22 +183,33 @@ htable_link_entry(struct lltable *llt, struct llentry 
lle->lle_head = lleh;
lle->la_flags |= LLE_LINKED;
CK_LIST_INSERT_HEAD(lleh, lle, lle_next);
+   llt->llt_entries++;
+
+   return (1);
 }
 
-static void
+static int
 htable_unlink_entry(struct llentry *lle)
 {
+   struct lltable *llt;
 
if ((lle->la_flags & LLE_LINKED) == 0)
-   return;
+   return (0);
 
-   IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp);
+   llt = lle->lle_tbl;
+   IF_AFDATA_WLOCK_ASSERT(llt->llt_ifp);
+   KASSERT(llt->llt_entries > 0, ("%s: lltable %p (%s) entries %d <= 0",
+   __func__, llt, if_name(llt->llt_ifp), llt->llt_entries));
+
CK_LIST_REMOVE(lle, lle_next);
lle->la_flags &= ~(LLE_VALID | LLE_LINKED);
 #if 0
lle->lle_tbl = NULL;
lle->lle_head = NULL;
 #endif
+   llt->llt_entries--;
+
+   return (1);
 }
 
 struct prefix_match_data {
@@ -483,6 +506,9 @@ lltable_free(struct lltable *llt)
llentry_free(lle);
}
 
+   KASSERT(llt->llt_entries == 0, ("%s: lltable %p (%s) entires not 0: %d",
+   __func__, llt, llt->llt_ifp->if_xname, llt->llt_entries));
+
llt->llt_free_tbl(llt);
 }
 
@@ -608,18 +634,18 @@ lltable_free_entry(struct lltable *llt, struct llentry
llt->llt_free_entry(llt, lle);
 }
 
-void
+int
 lltable_link_entry(struct lltable *llt, struct llentry *lle)
 {
 
-   llt->llt_link_entry(llt, lle);
+   return (llt->llt_link_entry(llt, lle));
 }
 
-void
+int
 lltable_unlink_entry(struct lltable *llt, struct llentry *lle)
 {
 
-   llt->llt_unlink_entry(lle);
+   return (llt->llt_unlink_entry(lle));
 }
 
 void

Modified: head/sys/net/if_llatbl.h
==
--- head/sys/net/if_llatbl.hWed Mar  4 17:13:35 2020(r358624)
+++ head/sys/net/if_llatbl.hWed Mar  4 17:17:02 2020(r358625)
@@ -151,8 +151,8 @@ typedef int (llt_match_prefix_t)(const struct sockaddr
 typedef void (llt_free_entry_t)(struct lltable *, struct llentry *);
 typedef void (llt_fill_sa_entry_t)(const struct llentry *, struct sockaddr *);
 typedef void (llt_free_tbl_t)(struct lltable *);
-typedef void (llt_link_entry_t)(struct lltable *, struct llentry *);
-typedef void (llt_unlink_entry_t)(struct llentry *);
+typedef int (llt_link_entry_t)(struct lltable *, struct llentry *);
+typedef int (llt_unlink_entry_t)(struct llentry *);
 typedef void (llt_mark_used_t)(struct llentry *);
 
 typedef int (llt_foreach_cb_t)(struct lltable *, struct llentry *, void *);
@@ -162,6 +162,8 @@ struct lltable {

svn commit: r358620 - in head: sys/netinet usr.bin/netstat

2020-03-04 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Mar  4 16:20:59 2020
New Revision: 358620
URL: https://svnweb.freebsd.org/changeset/base/358620

Log:
  Add new ICMPv6 counters for Anti-DoS limits.
  
  Add four new counters for ND6 related Anti-DoS measures.
  We split these out into a separate upfront commit so that we only
  change the struct size one time.  Implementations using them will
  follow.
  
  PR:   157410
  Reviewed by:  melifaro
  MFC after:2 weeks
  X-MFC:cannot really MFC this without breaking netstat
  Sponsored by: Netflix (initially)
  Differential Revision:https://reviews.freebsd.org/D22711

Modified:
  head/sys/netinet/icmp6.h
  head/usr.bin/netstat/inet6.c

Modified: head/sys/netinet/icmp6.h
==
--- head/sys/netinet/icmp6.hWed Mar  4 14:56:32 2020(r358619)
+++ head/sys/netinet/icmp6.hWed Mar  4 16:20:59 2020(r358620)
@@ -635,6 +635,10 @@ struct icmp6stat {
uint64_t icp6s_badrs;   /* bad router solicitation */
uint64_t icp6s_badra;   /* bad router advertisement */
uint64_t icp6s_badredirect; /* bad redirect message */
+   uint64_t icp6s_overflowdefrtr;  /* Too many default routers. */
+   uint64_t icp6s_overflowprfx;/* Too many prefixes. */
+   uint64_t icp6s_overflownndp;/* Too many neighbour entries. */
+   uint64_t icp6s_overflowredirect;/* Too many redirects. */
 };
 
 #ifdef _KERNEL

Modified: head/usr.bin/netstat/inet6.c
==
--- head/usr.bin/netstat/inet6.cWed Mar  4 14:56:32 2020
(r358619)
+++ head/usr.bin/netstat/inet6.cWed Mar  4 16:20:59 2020
(r358620)
@@ -1055,6 +1055,14 @@ icmp6_stats(u_long off, const char *name, int af1 __un
"{N:/bad router advertisement message%s}\n");
p(icp6s_badredirect, "\t{:bad-redirect/%ju} "
"{N:/bad redirect message%s}\n");
+   p(icp6s_overflowdefrtr, "\t{:default-routers-overflows/%ju} "
+   "{N:/default routers overflow%s}\n");
+   p(icp6s_overflowprfx, "\t{:prefixes-overflows/%ju} "
+   "{N:/prefix overflow%s}\n");
+   p(icp6s_overflownndp, "\t{:neighbour-entries-overflows/%ju} "
+   "{N:/neighbour entries overflow%s}\n");
+   p(icp6s_overflowredirect, "\t{:redirect-overflows/%ju} "
+   "{N:/redirect overflow%s}\n");
xo_close_container("errors");
p(icp6s_pmtuchg, "\t{:path-mtu-changes/%ju} {N:/path MTU change%s}\n");
 #undef p
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   3   4   5   6   7   8   9   10   >