Commit Graph

1627 Commits

Author SHA1 Message Date
Adrian Chadd
8a97beff98 [ath_hal] Return failure if noise floor calibration fails.
If we fail noise floor calibration then we may end up with a deaf NIC
which we can't recover without a full chip reset.

Earlier chips seem to get less stuck in this condition versus AR9280/later
and AR9300/later, but whilst here just fix up the AR5212 era chips to also
return NF calibration failures.

This HAL routine would only return failure if the channel was not configured.

This is a no-op until the driver side code for doing resets and the HAL
code for being told about the reset type (and then handling it!) is
implemented.

Tested:

* AR9280, STA mode
* AR2425, STA mode
* AR9380, STA mode
2018-06-08 18:21:57 +00:00
Jung-uk Kim
3d90091d60 MFV: r334448
Import ACPICA 20180531.
2018-06-04 22:26:47 +00:00
Mateusz Guzik
34c538c356 malloc: try to use builtins for zeroing at the callsite
Plenty of allocation sites pass M_ZERO and sizes which are small and known
at compilation time. Handling them internally in malloc loses this information
and results in avoidable calls to memset.

Instead, let the compiler take the advantage of it whenever possible.

Discussed with:	jeff
2018-06-02 22:20:09 +00:00
Adrian Chadd
a861b06b97 [ath_hal] migrate the shared HAL_RESET_* pieces out into ath_hal.
I'm in the process of reworking how the reset path works with an eye
to better recovery when the chips hang and/or go RF/PHY deaf.
This is the first step in a lot of unification and API changes.
2018-05-25 01:27:39 +00:00
Olivier Houchard
d1f3fb2cb4 Import CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b.
This brings us the renaming of fields in ck_queue, so that our own
LIST/SLIST/TAILQ/etc won't accidentally work with them.
2018-05-24 21:38:18 +00:00
Matt Macy
d7c5a620e2 ifnet: Replace if_addr_lock rwlock with epoch + mutex
Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
4.98   0.00   4.42   0.00 4235592     33   83.80 4720653 2149771   1235 247.32
4.73   0.00   4.20   0.00 4025260     33   82.99 4724900 2139833   1204 247.32
4.72   0.00   4.20   0.00 4035252     33   82.14 4719162 2132023   1264 247.32
4.71   0.00   4.21   0.00 4073206     33   83.68 4744973 2123317   1347 247.32
4.72   0.00   4.21   0.00 4061118     33   80.82 4713615 2188091   1490 247.32
4.72   0.00   4.21   0.00 4051675     33   85.29 4727399 2109011   1205 247.32
4.73   0.00   4.21   0.00 4039056     33   84.65 4724735 2102603   1053 247.32

After the patch

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
5.43   0.00   4.20   0.00 3313143     33   84.96 5434214 1900162   2656 245.51
5.43   0.00   4.20   0.00 3308527     33   85.24 5439695 1809382   2521 245.51
5.42   0.00   4.19   0.00 3316778     33   87.54 5416028 1805835   2256 245.51
5.42   0.00   4.19   0.00 3317673     33   90.44 5426044 1763056   2332 245.51
5.42   0.00   4.19   0.00 3314839     33   88.11 5435732 1792218   2499 245.52
5.44   0.00   4.19   0.00 3293228     33   91.84 5426301 1668597   2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by:	gallatin
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15366
2018-05-18 20:13:34 +00:00
Sean Bruno
1696e1f2b8 Quiesce a couple pages of clang warnings with a cast. Duplicates
linux maintainer commit:

627871b71c (diff-8c6ddb4c3ad69a6fb9f289475821db56)

ar9300template_aphrodite.h:575:40: warning: implicit conversion from 'int'
  to 'u_int8_t' (aka 'unsigned char') changes value from 3495 to 167
  [-Wconstant-conversion]
            /* Data[8].ctl_edges[7].bChannel*/FREQ2FBIN(5795, 0)}
                                              ^~~~~~~~~~~~~~~~~~
ar9300eep.h:142:41: note: expanded from macro 'FREQ2FBIN'
    (((y) == HAL_FREQ_BAND_2GHZ) ? ((x) - 2300) : (((x) - 4800) / 5))

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D15476
2018-05-18 17:23:23 +00:00
Matt Macy
4c7d0d925f ck: add support for executing callbacks outside of main poll loop
Pull in change from upstream deca119d14bfffd440770eb67cbdbeaf7b57eb7b

|    ck_epoch: introduce ck_epoch_deferred
|
|    Allow for deferral to occur outside epoch poll critical loop (which may access per-CPU structures).
|

Approved by:	sbruno
2018-05-17 18:14:10 +00:00
Hans Petter Selasky
984507528d Add support for setting type of service, TOS, for outgoing RDMA connections
in the krping kernel test utility.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2018-05-15 07:46:24 +00:00
Marcin Wojtas
6461d6a396 Apply fixes in ena-com
* Change ena-com BIT macro to work on unsigned value.
  To make the shifting operations safer, they should be working on
  unsigned values.

* Fix a mutex not owned ASSERT panic in ENA control path.
  A thread calling cv_broadcast()/cv_signal() must hold the mutex used for
  cv_wait(). Fix the ENA control path code that has this problem.

Submitted by:   Krishna Yenduri <kyenduri@brkt.com>
Reviewed by:    Michal Krawczyk <mk@semihalf.com>
Tested by:      Michal Krawczyk <mk@semihalf.com>
2018-05-10 09:25:51 +00:00
Cy Schubert
4273f67609 Fix style error introduced in r333393.
Reported by:	jhb, imp, phk
MFC after:	6 days
X-MFC with:	r333393
2018-05-09 19:05:27 +00:00
Cy Schubert
bb7af25076 Document intentional fallthrough. (CID 976535)
MFC after:	1 week
2018-05-09 02:07:09 +00:00
Cy Schubert
8d3478a26f Fix memory leak. (CID 1199373).
MFC after:	1 week
2018-05-09 02:02:58 +00:00
Jung-uk Kim
e7dfa7d8ab MFV: r333378
Import ACPICA 20180508.
2018-05-08 18:18:27 +00:00
Jung-uk Kim
835b56bfeb MFV: r333077
Merge ACPICA 20180427.
2018-05-01 19:17:38 +00:00
Olivier Houchard
271ce40239 Import CK as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8
It should fix ck_pr_[load|store]_ptr on mips and riscv, make sure no
*fence instructions are used on i386, as older cpus don't support it, and
make sure we don't rely on gcc builtins that can lead to calls to
libatomic when linked with -O0.

MFC after:	1 week
2018-04-02 23:40:50 +00:00
Eitan Adler
6472fa9a9d [iwm] Add support for iwm 3168 cards
```
iwm0@pci0:5:0:0:        class=0x028000 card=0x21108086 chip=0x24fb8086
rev=0x10 hdr=0x00
vendor     = 'Intel Corporation'
device     = 'Dual Band Wireless-AC 3168NGW [Stone Peak]'
class      = network
[94829] iwm0: <Intel(R) Dual Band Wireless AC 3168> mem
0xef700000-0xef701fff at device 0.0 on pci5
[94829] iwm0: hw rev 0x220, fw ver 22.361476.0, address
28:c6:3f:15:43:c5
```

MFC After:	2 weeks
Reviewed by:	ivadasz (over IRC)
PR:		224886
Differential Revision:	https://reviews.freebsd.org/D14865
2018-03-28 07:59:16 +00:00
Conrad Meyer
2cb2ba6df8 MFV: libb2: use native calls for secure memory clearance
Drop our local patch and restore full vanilla upstream code in
contrib/libb2.

No functional change intended.  explicit_bzero() should continue to be used.

Obtained from:	libb2 b4b241a34824b51956a7866606329a065d397525
Sponsored by:	Dell EMC Isilon
2018-03-27 14:55:01 +00:00
Conrad Meyer
19fcbaf142 Update to Zstandard 1.3.4
Includes our local patch to conditionalize use of __builtin_clz(ll) on
Clang's __has_builtin() (which is just defined to false when building with
GCC).

The issue is tracked upstream at https://github.com/facebook/zstd/pull/884 .
Otherwise, these are vanilla Zstandard 1.3.4 files.

Reported by:	allanjude, Yann Collet
Sponsored by:	Dell EMC Isilon
2018-03-26 23:54:59 +00:00
Hans Petter Selasky
87fb59a5cf Exit krping on device removal to avoid endless hang situation.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-03-23 17:03:42 +00:00
Conrad Meyer
0e33efe4e4 Import Blake2 algorithms (blake2b, blake2s) from libb2
The upstream repository is on github BLAKE2/libb2.  Files landed in
sys/contrib/libb2 are the unmodified upstream files, except for one
difference:  secure_zero_memory's contents have been replaced with
explicit_bzero() only because the previous implementation broke powerpc
link.  Preferential use of explicit_bzero() is in progress upstream, so
it is anticipated we will be able to drop this diff in the future.

sys/crypto/blake2 contains the source files needed to port libb2 to our
build system, a wrapped (limited) variant of the algorithm to match the API
of our auth_transform softcrypto abstraction, incorporation into the Open
Crypto Framework (OCF) cryptosoft(4) driver, as well as an x86 SSE/AVX
accelerated OCF driver, blake2(4).

Optimized variants of blake2 are compiled for a number of x86 machines
(anything from SSE2 to AVX + XOP).  On those machines, FPU context will need
to be explicitly saved before using blake2(4)-provided algorithms directly.
Use via cryptodev / OCF saves FPU state automatically, and use via the
auth_transform softcrypto abstraction does not use FPU.

The intent of the OCF driver is mostly to enable testing in userspace via
/dev/crypto.  ATF tests are added with published KAT test vectors to
validate correctness.

Reviewed by:	jhb, markj
Obtained from:	github BLAKE2/libb2
Differential Revision:	https://reviews.freebsd.org/D14662
2018-03-21 16:18:14 +00:00
Conrad Meyer
22aec4de9f lib(private)zstd: Fix riscv build
Link __bswap[ds]i2() intrinsics in to libzstd for riscv, where the C runtime
apparently lacks such intrinsics.

Broken in r330894.

Reported by:	asomers
Sponsored by:	Dell EMC Isilon
2018-03-18 03:42:57 +00:00
Jung-uk Kim
8438a7a80a Merge ACPICA 20180313. 2018-03-14 23:45:48 +00:00
Conrad Meyer
052d3c1290 Update to Zstandard 1.3.3
Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin().
The issue is tracked upstream at https://github.com/facebook/zstd/pull/884 .
Otherwise, these are vanilla Zstandard 1.3.3 files.

Note that the 1.3.4 release should be due out soon.

Sponsored by:	Dell EMC Isilon
2018-03-14 03:00:17 +00:00
Conrad Meyer
af3415f104 MFV: zstd: FIO_addFInfo: Fully initialize output 'total' struct
Silence a Coverity warning about 'windowSize' being uninitialized.
(Yes, nothing that calls this routine actually uses the windowSize
value.  Still, appeasing Coverity is pretty harmless in this case.)

Reported by:	Coverity
Reviewed by:	Yann Collet
Obtained from:	zstd 606374269cf3485972c90b993fbb84dc20da032f
Sponsored by:	Dell EMC Isilon
2018-03-05 20:03:45 +00:00
Anish Gupta
9363000dfe Move the new AMD-Vi IVHD [ACPI_IVRS_HARDWARE_NEW]definitions added in r329360 in contrib ACPI to local files till ACPI code adds new definitions reported by jkim.
Rename ACPI_IVRS_HARDWARE_NEW to ACPI_IVRS_HARDWARE_EFRSUP, since new definitions add Extended Feature Register support.  Use IvrsType to distinguish three types of IVHD - 0x10(legacy), 0x11 and 0x40(with EFR). IVHD 0x40 is also called mixed type since it supports HID device entries.
Fix 2 coverity bugs reported by cem.

Reported by:jkim, cem
Approved by:grehan
Differential Revision://reviews.freebsd.org/D14501
2018-03-05 02:28:25 +00:00
Olivier Houchard
a72c9dc53f Define CK_MD_TSO for the relevant arches (i386, amd64 and sparc64).
Defaulting to CK_MD_RMO has the unfortunate side effect of generating
memory barriers that are useless on those arches, and the even more
unfortunate side effect of generating lfence/sfence/mfence on i386, even
if older CPUs don't support it.
This should fix the panic reported when using IPFW on a Pentium 3.
Note that mfence and sfence might still be used in a few case, but that
shouldn't happen in FreeBSD right now, and should be fixed upstream first.

MFC after:	1 week
2018-02-16 17:50:06 +00:00
Anish Gupta
0b37d3d90e This change fixes duplicate detection of same IOMMU/AMD-Vi device for Ryzen with EFR support.
IVRS can have entry of type legacy and non-legacy present at same time for same AMD-Vi device. ivhd driver will ignore legacy if new IVHD type is present as specified in AMD-Vi specification. Earlier both of IVHD entries used and two ivhd devices were created.
Add support for new IVHD type 0x11 and 0x40 in ACPI. Create new struct of type acpi_ivrs_hardware_new for these new type of IVHDs. Legacy type 0x10 will continue to use acpi_ivrs_hardware.

Reviewed by:	avg
Approved by:	grehan
Differential Revision:https://reviews.freebsd.org/D13160
2018-02-16 05:17:00 +00:00
Mark Johnston
b9625b0d3b Move zstd malloc()/free()/calloc() macros to stdlib.h.
The definitions otherwise leak into anything that includes zstd.h,
which is not desirable for native FreeBSD code.

Reviewed by:	allanjude, cem, imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D14352
2018-02-13 19:18:00 +00:00
Jung-uk Kim
ff879b0799 MFV: r329072
Merge ACPICA 20180209.
2018-02-09 21:49:38 +00:00
Kyle Evans
1a4529b5e5 MFV r328490: Update libfdt to github:f1879e1
Pulls in a patch, now upstreamed, from nwhitehorn to add limited read-only
support for older (v2 and v3) FDT blobs.

MFC after:	1 week
2018-01-27 21:25:45 +00:00
Mariusz Zaborski
1acf348551 Add SPDX tags for nv(9).
MFC after:	2 weeks
2018-01-27 12:58:21 +00:00
Conrad Meyer
222daa421f style: Remove remaining deprecated MALLOC/FREE macros
Mechanically replace uses of MALLOC/FREE with appropriate invocations of
malloc(9) / free(9) (a series of sed expressions).  Something like:

* MALLOC(a, b, ... -> a = malloc(...
* FREE( -> free(
* free((caddr_t) -> free(

No functional change.

For now, punt on modifying contrib ipfilter code, leaving a definition of
the macro in its KMALLOC().

Reported by:	jhb
Reviewed by:	cy, imp, markj, rmacklem
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D14035
2018-01-25 22:25:13 +00:00
Pedro F. Giffuni
7326b4e68c libnv: Use mallocarray(9) for the nv_calloc. 2018-01-19 14:50:53 +00:00
Kyle Evans
6780e684d4 libfdt: Update to 1.4.6, switch to using libfdt for overlay support
libfdt highlights since 1.4.3:

- fdt_property_placeholder added to create a property without specifying its
value at creation time
- stringlist helper functions added to libfdt
- Improved overlay support
- Various internal cleanup

Also switch stand/fdt over to using libfdt for overlay support with this
update. Our current overlay implementation works only for limited use cases
with overlays generated only by some specific versions of our dtc(1). Swap
it out for the libfdt implementation, which supports any properly generated
overlay being applied to a properly generated base.

This will be followed up fairly soon with an update to dtc(1) in tree to
properly generate overlays.

MFC note: the <stdlib.h> include this update introduces in libfdt_env.h is
apparently not necessary in the context we use this in. It's not immediately
clear to me the motivation for it being introduced, but it came in with
overlay support. I've left it in for the sake of accuracy and because it's
not harmful here on HEAD, but MFC'ing this to stable/11 will require
wrapping the #include in an `#ifndef _STANDALONE` block or else it will
cause build failures.

Tested on:	Banana Pi-M3 (ARMv7)
Tested on:	Pine64 (aarch64)
Tested on:	PowerPC [nwhitehorn]
Reviewed by:	manu, nwhitehorn
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D13893
2018-01-18 04:39:09 +00:00
Pedro F. Giffuni
86446f5610 zstd: Use mallocarray(9) for calloc macro.
This is in contrib code but since we only have mallocarray(9) in current
we will not upstream this.

This effectively brings back r327934, which was reverted to correct the
log message.
2018-01-13 19:02:51 +00:00
Pedro F. Giffuni
8c3720bfc1 Revert r327934 to fix the log message. 2018-01-13 18:56:42 +00:00
Pedro F. Giffuni
d195572171 zstd: Use memalloc(9) for calloc macro.
This is in contrib code but since we only have memalloc(9) in current we
will not upstream this.
2018-01-13 18:09:09 +00:00
Cy Schubert
b23dbcb8ae Remove redundant variable.
MFC after:	1 week
2018-01-13 08:28:46 +00:00
Cy Schubert
282f39b0a1 Though this block of code is not used by FreeBSD, correct a call to
sprintf() with a macro call to SNPRINTF similar to other calls to
SNPRINTF within this same block.

MFC after:	1 week
2018-01-13 08:16:10 +00:00
Conrad Meyer
8fb95dc265 Zstd: Add bswap intrinsics for small MIPS systems (e.g., Onion Omega)
Reported by:	mizhka
Sponsored by:	Dell EMC Isilon
2018-01-11 06:30:50 +00:00
Conrad Meyer
8038068a2a Finally, fix Zstd kernel build on MIPS and RISC-V
Add an implementation of the intrinsics invoked by __builtin_ctz{,ll} and
__builtin_clz{,ll}, and include this compilation unit on platforms that lack
assembly intrinsics for those builtins (MIPS and RISC-V).

Future cleanup work might involve bringing these into a mini libcompiler-rt
for the standalone kernel environment.  Or cleaning up the approach upstream
takes for builtins in standalone environments (or just FreeBSD).  For now,
at least this builds, and doesn't require modifying the vendor code.

Reported by:	jeff, markj, mizhka
Reviewed by:	jhb (earlier version), rpokala (comment text earlier version)
Sponsored by:	Dell EMC Isilon
2018-01-10 06:30:59 +00:00
Cy Schubert
bdb0c28072 When growing the state, also grow the seed array. Otherwise memory
that was not allocated will be accessed.

This necessitated refactoring state seed allocation from
ipf_state_soft_init() into a new common ipf_state_seed_alloc() function
as it is now also used by ipf_state_rehash() when changing the size of
the state hash table in addition to by ipf_state_soft_init() during
initialization.

According to Christos Zoulas <christos@NetBSD.org>:

The bug was encountered by a NetBSD vendor who's customer machines had
large ipfilter states. The bug was reliably triggered by resizing the
state variables using "ipf -T".

Submitted by:	Christos Zoulas <christos@NetBSD.org>
Reviewed by:	delphij, rgrimes
Obtained from:	NetBSD ip_state.c CVS revs r1.9 and r1.10
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13755
2018-01-09 06:43:58 +00:00
Conrad Meyer
d3692a4dee Integrate zstd into the kernel
Mock userspace headers and include mocked headers first in compilation
command to inject kernel headers and override e.g., malloc(3) with
malloc(9).

Submitted by:	allanjude
Reviewed by:	imp (earlier version), bapt (earlier version)
Differential Revision:	https://reviews.freebsd.org/D10407
2018-01-08 20:14:16 +00:00
Kristof Provost
5cf32a6e95 vchiq: Use mallocarray() to provide kcalloc()
This means we now also provide integer overflow protection, like the
Linux kcalloc().
2018-01-07 13:41:06 +00:00
Jung-uk Kim
6c30ff135c Fix a header inclusion missed in the previous commit.
Reported by:	Michael Butler (imb at protected-networks dot net)
2018-01-06 03:41:35 +00:00
Jung-uk Kim
32ac401671 Merge ACPICA 20180105. 2018-01-05 23:21:47 +00:00
Cy Schubert
77ba0dab06 Correct function name in description block.
MFC after:	3 days
2018-01-04 04:11:40 +00:00
Jung-uk Kim
f1db5ef7aa MFC: r326864
Merge ACPICA 20171214.
2017-12-14 23:21:31 +00:00
Baptiste Daroussin
1ad8ac7a1d Revert local changes made to make zstd(1) frontend behave like gzip(1) and friends
This change was made to allow zstd(1) to be a dropin replacement for gzip(1) and
friends, allowing easy integration, in particular with newsyslog(8). At the
price of having a zstd(1) command which by default behaves differently than what
upstream default, confusing users.

newsyslog(8) has been adapted to now be more flexible in what it accepts as
compression program, so we can switch back zstd(1) to its default behaviour

Reported by:	many
2017-12-06 09:53:10 +00:00