FreeBSD/src 342021svnadmin/conf approvers

Update the approvers file to share custody of releng/12.0 between
so@ and re@ until re@ is comfortable turning over releng/12.0
entirely.

Approved by:    re (implicit)
Sponsored by:   The FreeBSD Foundation

FreeBSD/src 342020head/sys/arm/mv mv_thermal.c, head/sys/arm64/conf GENERIC

mv_thermal: Add thermal driver for AP806 and CP110 thermal sensor

Sponsored by:   Rubicon Communications, LLC ("Netgate")

FreeBSD/src 342019head/sys/arm/mv mv_cp110_icu.c

arm64: mv_cp110_icu: Fix build

FreeBSD/src 342018head/sys/arm/mv gpio.c

mv_gpio: Since it's also an interrupt controller, attach sooner

Sponsored by:   Rubicon Communications, LLC ("Netgate")

FreeBSD/src 342017head/sys/dev/sdhci sdhci_xenon.c

sdhci_xenon: Add Marvell 8k compatible string

Sponsored by:   Rubicon Communications, LLC ("Netgate")

FreeBSD/src 342016head/sys/arm/mv mv_cp110_icu.c mv_ap806_gicp.c, head/sys/arm64/conf GENERIC

arm64: Add mv_cp110_icu and mv_cp110_gicp

icu is a interrupt concentrator in the CP110 block and gicp
is a gic extension to allow interrupts in the CP block to be turned
into GIC SPI interrupts

Sponsored by:   Rubicon Communications, LLC ("Netgate")

FreeBSD/src 342015head/sys/conf files.arm64, head/sys/dev/iicbus/twsi mv_twsi.c twsi.h

twsi: Clean up marvell part and add support for Marvell 7k/8k

Sponsored by:   Rubicon Communications, LLC ("Netgate")

FreeBSD/src 342014head/sys/arm/mv mv_cp110_clock.c mv_cp110_clock.h, head/sys/conf files.arm64

arm64: marvell: Add cp110 clock controller support

The cp110 clock controller controls the clocks and gate of the CP110
hardware block.

Every clock/gate are implemented except the NAND clock.

Sponsored by:   Rubicon Communications, LLC ("Netgate")

FreeBSD/src 342013head/sys/arm/mv gpio.c, head/sys/arm64/conf GENERIC

arm64: mv_gpio: Add Marvell 8K support

While here put the interrupts setup in it's own function

Sponsored by:   Rubicon Communications, LCC ("Netgate")

FreeBSD/src 342012head/sys/arm/mv mv_ap806_clock.c, head/sys/conf files.arm64

arm64: marvell: Add driver for Marvell Ap806 System Controller

The first two clocks are for the clusters and their frequencies can be
found reading a register. Then a fixed 1200Mhz clock is present and two
fixed clocks, 'mss' which is 1200 / 6 and 'sdio' which is 1200 / 3.

Sponsored by:   Rubicon Communications, LLC ("Netgate")

FreeBSD/src 342011head/sys/arm/mv mvebu_pinctrl.c, head/sys/arm64/conf GENERIC

arm64: mvebu_pinctrl: Add driver for Marvell Pinmux Controller

Add a driver compatible with Marvell mvebu-pinctrl and add ap806-pinctrl
support.

Sponsored by:   Rubicon Communications, LCC ("Netgate")

FreeBSD/src 342010head/sys/arm64/conf GENERIC, head/sys/conf options.arm64

arm64: Add new SoC type MARVELL_8K

Sponsored by:   Rubicon Communications, LLC ("Netgate")

FreeBSD/src 342009head/secure/lib/libcrypto Makefile opensslconf.h.in

Enable devcryptoeng for OpenSSL.

Since OpenSSL 1.1.1, the good old BSD-specific cryptodev engine has been
deprecated in favor of this new engine.  However, this engine is not
throughly tested on FreeBSD because it was originally written for Linux.

http://cryptodev-linux.org/

Also, the author actually meant to enable it by default on BSD platforms but
he failed to do so because there was a bug in the Configure script.

https://github.com/openssl/openssl/pull/7882

Now they found that it was more generic issue.

https://github.com/openssl/openssl/pull/7885

Therefore, we need to enable this engine on head to give it more exposure.

FreeBSD/src 342008head/sys/conf files, head/sys/dev/fdt simple_mfd.c simplebus.c

fdt: Add support for simple-mfd bus

Quoting the binding Documentation :

"These devices comprise a nexus for heterogeneous hardware blocks containing
more than one non-unique yet varying hardware functionality."

Reviewed by:    loos
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D17751

FreeBSD/src 342007head/usr.sbin/pwm pwm.c

pwm: Fix some arches by using %ju and casting to uintmax_t

Reported by:    ci.freebsd.org

FreeBSD/src 342006head/sys/dts/arm64/overlays sun50i-a64-pwm.dtso sun50i-a64-rpwm.dtso

arm64: allwinner: Fix pwm dtso

Double patched files ended up in the tree

Reported by:    kevans

FreeBSD/src 342005head/sys/dts/arm64/overlays sun50i-a64-pwm.dtso sun50i-a64-rpwm.dtso, head/sys/modules/dtb/allwinner Makefile

arm64: allwinner: Add DTSO for pwm and r_pwm

Those are both dtso (overlays) for the two pwm controllers found on the A64.

FreeBSD/src 342004head/sys/arm/allwinner aw_pwm.c, head/sys/arm64/conf GENERIC

arm64: allwinner: Add pwm driver

Add a pwm driver for Allwinner PWM
Add pwm and aw_pwm to the GENERIC kernel

FreeBSD/src 342003head/sys/dev/pwm pwmbus.c pwmc.c, head/usr.sbin/pwm pwm.c

Add a pwm subsystem so we can configure pwm controller from kernel and userland.

The pwm subsystem consist of API for PWM controllers, pwmbus to register them
and a pwm(8) utility to talk to them from userland.

Reviewed by:    oshgobo (capsicum), bcr (manpage), 0mp (manpage)
Differential Revision:  https://reviews.freebsd.org/D17938

FreeBSD/src 342002head/sys/conf options

Add NETGRAPH_CHECKSUM.

MFC after:      1 week

FreeBSD/src 342001head/lib/libcapsicum Makefile

libcapsicum: add missing links

Reported by:    manu

FreeBSD/src 342000head/tests/sys/netpfil/pf rdr.sh Makefile

pf tests: Basic rdr test

MFC after:      2 weeks

FreeBSD/src 341999head/tests/sys/netpfil/pf nat.sh Makefile

pf tests: NAT exhaustion test

It's been reported that pf doesn't handle running out of available ports
for NAT correctly. It freezes until a state expires and it can find a
free port.
Test for this, by setting up a situation where only two ports are
available for NAT and then attempting to create three connections.

If successful the third connection will fail immediately. In an
incorrect case the connection attempt will freeze, also freezing all
interaction with pf through pfctl and trigger timeout.

PR:            233867
MFC after:      2 weeks

FreeBSD/src 341998head/sys/netpfil/pf pf_lb.c pf.c

pf: Fix endless loop on NAT exhaustion with sticky-address

When we try to find a source port in pf_get_sport() it's possible that
all available source ports will be in use. In that case we call
pf_map_addr() to try to find a new source IP to try from. If there are
no more available source IPs pf_map_addr() will return 1 and we stop
trying.

However, if sticky-address is set we'll always return the same IP
address, even if we've already tried that one.
We need to check the supplied address, because if that's the one we'd
set it means pf_get_sport() has already tried it, and we should error
out rather than keep trying.

PR:            233867
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D18483

FreeBSD/src 341997head/usr.bin/calendar/calendars calendar.freebsd

Add myself to the calendar

FreeBSD/src 341996head/sys/conf NOTES files

Add NETGRAPH_CHECKSUM.

MFC after:      1 week

FreeBSD/src 341995stable 11, stable/11/release release.sh

MFC r339873:

 Set OPTIONS_UNSET in the argument list to env(1), and add
 AVAHI to the list.  This fixes the textproc/docproj build
 seemingly following FLAVORS being added.

 Specifically, the problem with the dependency chain here is:
 - textproc/docproj depends on print/cups, which sets AVAHI=on
   by default;
 - net/avahi-app depends on devel/gobject-introspection, which
   requires python3+;
 - graphics/netpbm depends on graphics/mesa-libs, which can
   only be built with python2.7;
 - textproc/docproj depends on a number of graphics ports for
   font rendering, etc.

Sponsored by:   The FreeBSD Foundation

FreeBSD/src 341994head/sys/geom/mirror g_mirror.c

gmirror: Remove a last-minute INVARIANTS breakage in r341840

I mistakenly added a lock assertion to this routine at the last minute
without confirming it was held during g_mirror_create.  It isn't (it isn't
even initialized yet).  Mea culpa.  Access is exclusive in both callers,
just not always by that particular lock.

Reported by:    lwhsu
X-MFC-With:     r341840, r341674

FreeBSD/src 341993head/share/man/man4 ptnet.4

netmap: add man page for ptnet

Add a man page for ptnet(4), describing the guest driver for netmap passthrough.

Reviewed by:    bcr
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D18518

FreeBSD/src 341992head/sys/dev/netmap netmap_kloop.c

netmap: fix warning in netmap_kloop.c

Reported by:    markj
MFC after:      3 days

FreeBSD/src 341991stable 12, stable/12/contrib/elftoolchain/readelf readelf.c

MFC: r340745, fix CU: output of the --debug-dump=decodedline.

FreeBSD/src 341990head/sys/dev/bwn if_bwn.c

Fix a possible mbuf double free in bwn_dma_tx_start().

If bus_dmamap_load_mbuf() fails following a defrag, the caller of
bwn_dma_tx_start() would free the original mbuf after m_defrag() had
already done so.  Fix this by returning the defragged mbuf to the
caller instead.  Update bwn_pio_tx_start() similarly for consistency.

Reported by:    Ilja Van Sprundel <ivansprundel at ioactive.com>
Reviewed by:    landonf
Tested by:      landonf
MFC after:      3 days
admbug:        820
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D18342

FreeBSD/src 341989head Makefile.inc1

Makefile.inc1: update stale wpa dependency removal statement

Only stale .depend files are removed; do not mention object files.
DeltaFile
+1-1head/Makefile.inc1
+1-11 files

FreeBSD/src 341988head/sys/dev/asmc asmcvar.h asmc.c

asmc: Add Support for Macbook Pro 8,1

PR:            217505
Submitted by:   John O. Brickley <obryan.brickley at gmail.com>, updated by Maciej 
Pasternacki <maciej at pasternacki.net>
Reported by:    John O. Brickley <obryan.brickley at gmail.com>
MFC after:      1 week

FreeBSD/src 341987stable 11, stable/11/sys/dev/mlx4/mlx4_core mlx4.h

MFC r341587:
mlx4/mlx5: Updated driver version to 3.5.0

Sponsored by:   Mellanox Technologies

FreeBSD/src 341986stable 12, stable/12/sys/dev/mlx4/mlx4_core mlx4.h

MFC r341587:
mlx4/mlx5: Updated driver version to 3.5.0

Sponsored by:   Mellanox Technologies

FreeBSD/src 341985stable 12, stable/12/sys/dev/mlx5/mlx5_en mlx5_en_main.c mlx5_en_tx.c

MFC r341586:
mlx5en: Implement backpressure indication.

The backpressure indication is implemented using an unlimited rate type of
mbuf send tag. When the upper layers typically the socket layer has obtained such
a tag, it can then query the destination driver queue for the current
amount of space available in the send queue.

A single mbuf send tag may be referenced multiple times and a refcount has been added
to the mlx5e_priv structure to track its usage. Because the send tag resides
in the mlx5e_channel structure, there is no need to wait for refcounts to reach
zero until the mlx4en(4) driver is detached. The channels structure is persistant
during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed
without any need of synchronization.

The mlx5e_snd_tag structure was extended to contain a type field, because there are now
two different tag types which end up in the driver which need to be distinguished.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341984stable 10, stable/10/sys/dev/mlx5/mlx5_en mlx5_en_ethtool.c mlx5_en_main.c

MFC r341585:
mlx5en: Improve configuration of HW LRO.

In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config
space must be set, and the ifconfig(8) LRO capability must be set. Any other
settings will disable HW LRO.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341983stable 11, stable/11/sys/dev/mlx5/mlx5_en mlx5_en_ethtool.c mlx5_en_main.c

MFC r341585:
mlx5en: Improve configuration of HW LRO.

In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config
space must be set, and the ifconfig(8) LRO capability must be set. Any other
settings will disable HW LRO.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341982stable 12, stable/12/sys/dev/mlx5/mlx5_en mlx5_en_ethtool.c mlx5_en_main.c

MFC r341585:
mlx5en: Improve configuration of HW LRO.

In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config
space must be set, and the ifconfig(8) LRO capability must be set. Any other
settings will disable HW LRO.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341981stable 11, stable/11/sys/dev/mlx5/mlx5_en en.h mlx5_en_tx.c

MFC r341584:
mlx5en: Count all transmitted and received bytes.

Add counter for all transmitted and received bytes. Currently only all
transmitted and received packets were counted. Fix description of RX LRO
counters while at it.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341980stable 12, stable/12/sys/dev/mlx5/mlx5_en en.h mlx5_en_tx.c

MFC r341584:
mlx5en: Count all transmitted and received bytes.

Add counter for all transmitted and received bytes. Currently only all
transmitted and received packets were counted. Fix description of RX LRO
counters while at it.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341979stable 11, stable/11/sys/dev/mlx5/mlx5_en mlx5_en_main.c mlx5_en_tx.c

MFC r341583:
mlx5en: Statically allocate and free the channel structure(s).

By allocating the worst case size channel structure array
at attach time we can eliminate various NULL checks in the
fast path. And also reduce the chance for use-after-free
issues in the transmit fast path.

This change is also a requirement for implementing
backpressure support.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341978stable 12, stable/12/sys/dev/mlx5/mlx5_en mlx5_en_main.c mlx5_en_tx.c

MFC r341583:
mlx5en: Statically allocate and free the channel structure(s).

By allocating the worst case size channel structure array
at attach time we can eliminate various NULL checks in the
fast path. And also reduce the chance for use-after-free
issues in the transmit fast path.

This change is also a requirement for implementing
backpressure support.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341977stable 11, stable/11/sys/dev/mlx5/mlx5_en mlx5_en_ethtool.c mlx5_en_main.c

MFC r341582:
mlx5en: Fix race in mlx5e_ethtool_debug_stats().

Writing to the debug stats variable must be locked,
else serialization will be lost which might cause
various kernel panics due to creating and destroying
sysctls out of order.

Make sure the sysctl context is initialized after freeing
the sysctl nodes, else they can be freed twice.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341976stable 12, stable/12/sys/dev/mlx5/mlx5_en mlx5_en_ethtool.c mlx5_en_main.c

MFC r341582:
mlx5en: Fix race in mlx5e_ethtool_debug_stats().

Writing to the debug stats variable must be locked,
else serialization will be lost which might cause
various kernel panics due to creating and destroying
sysctls out of order.

Make sure the sysctl context is initialized after freeing
the sysctl nodes, else they can be freed twice.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341975stable 11, stable/11/sys/dev/mlx5 mlx5_ifc.h port.h

MFC r341581:
mlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types.

Inspect the ethernet compliance code to figure out actual cable type by reading
the PDDR module info register.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341974stable 12, stable/12/sys/dev/mlx5 mlx5_ifc.h port.h

MFC r341581:
mlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types.

Inspect the ethernet compliance code to figure out actual cable type by reading
the PDDR module info register.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341973stable 12, stable/12/sys/dev/mlx5/mlx5_en mlx5_en_rl.c

MFC r341580:
mlx5en: Don't set rate on SQs when the SQ is already stopped.

This can happen when connections are short lived and leads to
a firmware error printout in dmesg, syndrome 0x51cfb0, because
the SQ is in the wrong state.

Sponsored by:   Mellanox Technologies

FreeBSD/src 341972stable/11/sys/dev/mlx5 vport.h, stable/11/sys/dev/mlx5/mlx5_core mlx5_vport.c

MFC r341579:
mlx5en: Fix for inlining issues in transmit path

1) Don't exceed the drivers own hardcoded TX inline limit.

The blueflame register size can be much greater than the hardcoded limit
for inlining. Make sure we don't exceed the drivers own limit, because this
also means that the maximum number of TX fragments becomes invalid and
then memory size assumptions in the TX path no longer hold up.

2) Make sure the mlx5_query_min_inline() function returns an error code.

3) Header inlining is required when using TSO.

4) Catch failure to compute inline header size for TSO.

5) Add support for UDP when computing inline header size.

6) Fix for inlining issues with regards to DSCP.

Make sure we inline 4 bytes beyond the ethernet and/or
VLAN header to workaround a hardware bug extracting
the DSCP field from the IPv4/v6 header.

Sponsored by:   Mellanox Technologies