Commit Graph

223112 Commits

Author SHA1 Message Date
Don Lewis
d196c9ee16 Fix the queue delay estimation in PIE/FQ-PIE when the timestamp
(TS) method is used.  When packet timestamp is used, the "current_qdelay"
keeps storing the last queue delay value calculated in the dequeue
function.  Therefore, when a burst of packets arrives followed by
a pause, the "current_qdelay" will store a high value caused by the
burst and stick to that value during the pause because the queue
delay measurement is done inside the dequeue function.  This causes
the drop probability calculation function to calculate high drop
probability value instead of zero and prevents the burst allowance
mechanism from working properly.  Fix this problem by resetting
"current_qdelay" inside the drop probability calculation function
when the queue length is zero and TS option is used.

Submitted by:	Rasool Al-Saadi <ralsaadi@swin.edu.au>
MFC after:	1 week
2017-05-19 08:38:03 +00:00
Wojciech Macek
22a752b482 Fix boot up on ARMADA38X uniprocessor variant
Marvell Armada 380 is a uni-processor variant of the 38x SoC
family. A function platform_mp_setmaxid() was setting a hardcoded
value, which caused boot fail on A380. Fix this by relying on
the CPU count obtained from device tree nodes.

Submitted by:  Marcin Wojtas <mw@semihalf.com
Obtained from: Semihalf
Sponsored by:  Netgate
Reviewed by:   loos
Differential revision: https://reviews.freebsd.org/D10783
2017-05-19 08:26:41 +00:00
Wojciech Macek
c7a65ae3fe Fix MPIC mask/unmask
Before the fix for single interrupt, both percpu and non-percpu routes
were enabled/disable at the same time.

Submitted by:  Marcin Wojtas <mw@semihalf.com
Obtained from: Semihalf
Sponsored by:  Stormshield, Netgate
Reviewed by:   loos
Differential revision: https://reviews.freebsd.org/D10716
2017-05-19 08:25:40 +00:00
Wojciech Macek
2dd020069e Poll PHY status using internal e6000sw registers
e6000sw family automatically reflects PHY status in each port's registers.
Therefore it is not necessary to do a full PHY polling squence, which
results in much quicker operation and much less significant usage of
the SMI bus.

Care must be taken that the resulting ifmedia_active is identical to
what the PHY will compute, or gratuitous link status changes will
occur whenever the PHYs update function is called.

This patch implements above improvement. On the occasion set a pointer to
the proc structure to be part of software context instead of being
a global variable.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10714
2017-05-19 08:24:23 +00:00
Roger Pau Monné
bf319173f2 xen/netfront: don't drop the ring RX lock with inconsistent ring state
Make sure the RX ring lock is only released when the state of the ring is
consistent, or else concurrent calls to xn_rxeof might get an inconsistent ring
state and thus some packets might be processed twice.

Note that this is not very common, and could only happen when an interrupt is
delivered while in xn_ifinit.

Reported by:	cperciva
Tested by:	cperciva
MFC after:	1 week
Sponsored by:	Citrix Systems R&D
2017-05-19 08:19:51 +00:00
Wojciech Macek
fcb93d7493 Enable proper configuration of CESA MBUS windows
For all Marvell devices, MBUS windows configuration is done
in a common place. Only CESA was an exception, so move its
related code from driver to mv_common.c. This way it uses
same proper DRAM information, same as  all other interfaces
instead of parsing DT /memory node directly.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10723
2017-05-19 08:19:39 +00:00
Wojciech Macek
0a6542a309 Improve busy-wait loop during switch phy access in e6000sw
Hitherto implementation of PHY polling resulted in a risk of an
endless loop and very high occupation of the SMI bus. Improve the
operation by limiting the polling tries and adding sleepable
pause.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10713
2017-05-19 08:16:47 +00:00
Roger Pau Monné
e5d27b37e3 xen/blkfront: correctly detach a disk with active users
Call disk_gone when the backend switches to the "Closing" state and blkfront
still has pending users. This allows the disk to be detached, and will call
into xbd_closing by itself when the geom layout cleanup has finished.

Reported by:		bapt
Tested by:		manu
Reviewed by:		bapt
Sponsored by:		Citrix Systems R&D
MFC after:		1 week
Differential revision:	https://reviews.freebsd.org/D10772
2017-05-19 08:11:15 +00:00
Xin LI
da31cbbca0 Sync qsort.c with userland r318515.
(Note that MIN macro is removed in favor of sys/param.h's version).

PR:		213922
2017-05-19 06:37:16 +00:00
Alexander Motin
c9bcbf3800 Fix time handling in cv_timedwait_hires().
pthread_cond_timedwait() receives absolute time, not relative.  Passing
wrong time there caused two threads of zdb to spin in a tight loop.

MFC after:	1 week
2017-05-19 05:12:58 +00:00
Xin LI
ca1578f0c0 The current qsort(3) implementation ignores the sizes of partitions, and
always perform recursion on the left partition, then use a tail call to
handle the right partition.  In the worst case this could require O(N)
levels of recursions.

Reduce the possible recursion level to log2(N) by always recursing on the
smaller partition instead.

Obtained from:	PostgreSQL 9d6077abf9d6efd992a59f05ef5aba981ea32096
2017-05-19 04:59:12 +00:00
Xin LI
a3f893fc61 Use size_t.
Inspired by:	OpenBSD src/lib/libc/stdlib/qsort.c,v 1.11
2017-05-19 04:44:14 +00:00
Sepherosa Ziehau
ae0669e390 net/vlan: Revert 305177
Miss read the parentheses.

Reported by:	oleg@
Reviewed by:	hps@
MFC after:	3 days
Sponsored by:	Microsoft
2017-05-19 01:42:31 +00:00
Don Lewis
36fb8be630 The result of right shifting a negative signed value is implementation
defined.  On machines without arithmetic shift instructions, zero bits
may be shifted in from the left, giving a large positive result instead
of the desired divide-by power-of-2.  Fix this by operating on the
absolute value and compensating for the possible negation later.

Reverse the order of the underflow/overflow tests and the exponential
decay calculation to avoid the possibility of an erroneous overflow
detection if p is a sufficiently small non-negative value.  Also
check for negative values of prob before doing the exponential decay
to avoid another instance of of right shifting a negative value.

Tested by:	Rasool Al-Saadi <ralsaadi@swin.edu.au>
MFC after:	1 week
2017-05-19 01:23:06 +00:00
Mark Johnston
9ebaf5f802 Remove the EXFAIL annotation for tests which pass as of r309596.
Reported by:	bdrewery
Sponsored by:	Dell EMC Isilon
2017-05-19 00:25:09 +00:00
Jilles Tjoelker
29717eb029 sh: Keep output buffer across builtins.
Allocating and deallocating repeatedly the 1024-byte buffer for stdout from
builtins costs CPU time for little or no benefit.

A simple loop containing builtins that write to a file descriptor, such as
  i=0; while [ "$i" -lt 1000000 ]; do printf .; i=$((i+1)); done >/dev/null
is over 10% faster in a simple benchmark on an amd64 virtual machine.
2017-05-18 22:10:04 +00:00
Jilles Tjoelker
de29cd0869 sh: Ensure memout.bufsize matches allocated buffer, if it exists. 2017-05-18 21:44:14 +00:00
Edward Tomasz Napierala
980e53a299 Language fixes.
Submitted by:	wblock
MFC after:	2 weeks
2017-05-18 19:42:19 +00:00
Mark Johnston
ed67acb779 Don't bother enqueuing a page immediately before freeing it.
No functional change intended.

MFC after:	1 week
2017-05-18 18:37:19 +00:00
Mark Johnston
02fb845bbf Fix a few uses of kern_yield() in the TTM and the LinuxKPI.
kern_yield(0) effectively causes the calling thread to be rescheduled
immediately since it resets the thread's priority to the highest possible
value. This can cause livelocks when the pattern
"while (!trylock()) kern_yield(0);" is used since the thread holding the
lock may linger on the runqueue for the CPU on which the looping thread is
running.

MFC after:	1 week
2017-05-18 18:35:14 +00:00
Mark Johnston
3bd485f968 Avoid open-coding PRI_UNCHANGED.
MFC after:	1 week
2017-05-18 18:24:11 +00:00
Ed Maste
7092a907e5 makefs: drop WARNS back to 2
GCC warns about additional signed comparision issues compared to Clang.
Drop WARNS for now until the underlying issue is fixed.
2017-05-18 17:55:33 +00:00
Piotr Pawel Stefaniak
bd2969a00d indent(1): Support binary integer literals.
This was done by Romain Tartière for PR123553. I initially thought that it would break code like this:
#define b00101010 -1
if (0 b00101010)
...

by joining 0 and b00101010 together. However, the real problem with that patch was that once it saw a 0, it assumed that the number was base 2, 8 or 16, ignoring base 10 floating point numbers. I fixed that.

I didn't copy the diagnostic part of the original patch as it seems out of scope of implementing binary integer literals formatting.

PR:		123553
Submitted by:	romain (original version)
Approved by:	pfg (mentor)
2017-05-18 17:15:58 +00:00
Emmanuel Vadot
d91e611798 makefs: Add soft-updates option
Add the ffs option to enable soft-updates.
The option is only processed is ufs2 has been selected.

Reviewed by:	emaste, bapt (earlier version), allanjude (earlier version)
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D10773
2017-05-18 14:19:06 +00:00
Ed Maste
3afe6a68e0 makefs: clean up signedness warnings and bump WARNS to 3
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10650
2017-05-18 14:05:29 +00:00
Konstantin Belousov
fade31741d Add tests for some cases in r318298.
The first test triggers the out of bounds read of the 'left' array. It
only fails when realpath.c is compiled with '-fsanitize=address'.

The other test checks for ENOENT when running into an empty
symlink. This matches NetBSD's realpath(3) semantics. Previously,
empty symlinks were treated like ".".

Submitted by:	Jan Kokemц╪ller <jan.kokemueller@gmail.com>
PR:	219154
MFC after:	2 weeks
2017-05-18 13:49:53 +00:00
Allan Jude
49dd63a9bd Explain the new fields in top(1) related to ZFS compressed ARC
Reviewed by:	bcr
X-MFC-with:	316314
Differential Revision:	https://reviews.freebsd.org/D10781
2017-05-18 12:55:07 +00:00
Konstantin Belousov
ce9600b12e Update my copyright, note The FreeBSD Foundation involvement.
While tweaking copyright block, switch to use __FBSDID for tag.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-05-18 09:34:26 +00:00
Konstantin Belousov
591986a8da Fix style [1], add static keyword before static function definition.
Noted by:	bapt [1]
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-05-18 09:31:30 +00:00
Edward Tomasz Napierala
6635c8ed2f Fix typo.
MFC after:	2 weeks
2017-05-18 08:25:07 +00:00
Enji Cooper
043b080e33 Conditionally handle the crontab entry for atrun(8)
The default crontab prior to this commit assumes atrun(8) is always
present, which isn't true if MK_AT == no. Move atrun(8) execution
from /etc/crontab to /etc/cron.d/at, and base /etc/cron.d/at's installation
on MK_AT. cron(8) will detect /etc/cron.d/at's presence when the configuration
is loaded and run atrun every 5 minutes like it would prior to this commit.

SHELL and PATH are duplicated between /etc/crontab and /etc/cron.d/at
because atrun(8) executes programs, which may rely on environment
set in the current default /etc/crontab.

Noted by:	bdrewery (in an internal review)
MFC after:	2 months
Relnotes:	yes (may need to add environmental modifications to
		     /etc/cron.d/at)
Sponsored by:	Dell EMC Isilon
2017-05-18 06:33:55 +00:00
Enji Cooper
cb8106ba77 Revert r318441: the commit message was incoherent 2017-05-18 06:27:37 +00:00
Enji Cooper
94af8db1e9 Handle the cron.d entry for MK_AT in cron conditionally
Install /etc/cron.d/at if MK_AT != no, always using it, which tries
to run a non-existent program via cron(8) every 5 minutes with the
default /etc/crontab, prior to this commit.

SHELL and PATH are duplicated between /etc/crontab and /etc/cron.d/at
because atrun(8) executes programs, which may rely on environment
currently set via /etc/crontab.

Noted by:	bdrewery (in an internal review)
MFC after:	2 months
Relnotes:	yes (may need to add environmental modifications to
		     /etc/cron.d/at)
Sponsored by:	Dell EMC Isilon
2017-05-18 06:25:39 +00:00
Enji Cooper
5c63f26129 Normalize SYSDIR on SRCTOP instead of .CURDIR
This is being done to simplify pathing for CFLAGS and source files.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-18 06:15:42 +00:00
Enji Cooper
518613e412 Normalize .PATH on SRCTOP
This will help Jenkins dedupe 9 warnings between the static build and
the module build of ipsec(4).

Missed in SRCTOP conversion in r314651.

MFC with:	r314651
Sponsored by:	Dell EMC Isilon
2017-05-18 06:13:29 +00:00
Enji Cooper
382cc5a494 Revert local changes to find_progenv accidentally committed in r318436
MFC after:	2 weeks
MFC with:	r318436
Sponsored by:	Dell EMC Isilon
2017-05-18 01:46:30 +00:00
Enji Cooper
20d90b10b1 usr.bin/getconf: add some initial tests
Items tested via this commit are:
- Some basic POSIX constants.
- Some valid programming environments with -v.
- Some invalid programming environments via -v.

NOTE: this test makes assumptions about ILP32/LP32 vs LP64 that are
currently not true on all architectures to avoid hardcoding some
architectures in the tests. I'm working on improving getconf(1) to be
more sane about handling ILP32/LP32 vs LP64. Future commits are coming
soon to address this.

MFC after:	2 weeks
Tested with:	amd64, i386
Sponsored by:	Dell EMC Isilon
2017-05-18 01:43:30 +00:00
Enji Cooper
ea64204213 Make the .gperf.c suffix rule depend on fake-gperf.awk
Parameterize out fake-gperf.awk to avoid duplicating the path

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-18 01:35:07 +00:00
Jonathan Anderson
dc902dbd60 Fix some nroff syntax in rtld.1.
When I originally documented the LD_LIBRARY_PATH_FDS environment variable,
I used `.Ev` rather than `.It Ev` to introduce it; this led to the
documentation being embedded in the previous paragraph (LD_LIBRARY_PATH).
2017-05-18 00:32:05 +00:00
Jonathan Anderson
d5a5e50d3b Allow rtld direct-exec to take a file descriptor.
When executing rtld directly, allow a file descriptor to be explicitly
specified rather than opened from the given path. This, together with the
LD_LIBRARY_PATH_FDS environment variable, allows dynamically-linked
applications to be executed from within capability mode.

Also add some rudimentary argument parsing (without pulling in getopt or
the like) to accept this file descriptor, a help (-h) option and a basic
usage string.

Reviewed by:	kib
Sponsored by:	NSERC, RDC
Differential Revision:	https://reviews.freebsd.org/D10751
2017-05-17 22:51:28 +00:00
John Baldwin
5033c43b7a Add a driver for the Chelsio T6 crypto accelerator engine.
The ccr(4) driver supports use of the crypto accelerator engine on
Chelsio T6 NICs in "lookaside" mode via the opencrypto framework.

Currently, the driver supports AES-CBC, AES-CTR, AES-GCM, and AES-XTS
cipher algorithms as well as the SHA1-HMAC, SHA2-256-HMAC, SHA2-384-HMAC,
and SHA2-512-HMAC authentication algorithms.  The driver also supports
chaining one of AES-CBC, AES-CTR, or AES-XTS with an authentication
algorithm for encrypt-then-authenticate operations.

Note that this driver is still under active development and testing and
may not yet be ready for production use.  It does pass the tests in
tests/sys/opencrypto with the exception that the AES-GCM implementation
in the driver does not yet support requests with a zero byte payload.

To use this driver currently, the "uwire" configuration must be used
along with explicitly enabling support for lookaside crypto capabilities
in the cxgbe(4) driver.  These can be done by setting the following
tunables before loading the cxgbe(4) driver:

    hw.cxgbe.config_file=uwire
    hw.cxgbe.cryptocaps_allowed=-1

MFC after:	1 month
Relnotes:	yes
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D10763
2017-05-17 22:13:07 +00:00
Luiz Otavio O Souza
c1212a7a74 Fix the offset for the CPU0 MPIC registers.
Please note that only a subset of CPU0 registers are exported.  CPU1
registers are not touched.

Obtained from:	ARMADA38X Functional Specifications
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-05-17 22:05:07 +00:00
Stephen McConnell
67feec5045 Add tri-mode support (SAS/SATA/PCIe).
This includes NVMe device support and adds support for the following adapters:
    SAS 3408
    SAS 3416
    SAS 3508
    SAS 3516
    SAS 3616
    SAS 3708
    SAS 3716

Reviewed by:    ken, scottl, asomers, mav
Approved by:	ken, scottl, mav
MFC after:      2 weeks
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D10095
2017-05-17 21:33:37 +00:00
Luiz Otavio O Souza
0044ecde83 Use the MACROS to access the Global mpic registers. Makes the code
consistent and easier to read.

While here, remove two unused static functions and fix a unused function
warning when building !INTRNG.

No functional changes.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-05-17 21:14:27 +00:00
Adrian Chadd
f56f89c7a4 [net80211] initial VHT radiotap implementation defines from upstream radiotap. 2017-05-17 19:34:36 +00:00
Ed Maste
366e9e4538 fix sparc64 build by restoring 'register' in pcpu.h
Reported by:	jhb
Sponsored by:	The FreeBSD Foundation
2017-05-17 16:32:24 +00:00
Zbigniew Bodek
9c06c1c42a Add missing unlock in e6000sw driver
This patch adds missing unlock on attach failure.

Submitted by:  Zbigniew Bodek <zbb@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10712
2017-05-17 15:59:45 +00:00
Zbigniew Bodek
7118192a72 Fix broken malloc in e6000sw
Malloc should always return something when M_WAITOK flag is used,
but keep this code and change flag to M_NOWAIT as it is under a lock
(allows for possible future change). Free ifnet structure to avoid
memory leak on failure.

Submitted by:  Zbigniew Bodek <zbb@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10711
2017-05-17 15:58:39 +00:00
Zbigniew Bodek
b488f7aaa5 Fix registration of MPIC driver
Submitted by:  Michal Mazur <mkm@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Netgate
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10717
2017-05-17 15:57:14 +00:00
Zbigniew Bodek
da081cb51d Correct MPIC order of attachment
If MPIC happens to be a slave interrupt controller (as on Armada38x),
it should be attached after primary interrupt controller.
Thus BUS_PASS_ORDER_LATE was added to default BUS_PASS_INTERRUPT.

This change doesn't affect the cases when MPIC is standalone IC.

Submitted by:  Bartosz Szczepanek <bsz@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Stormshield, Netgate
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10715
2017-05-17 15:56:09 +00:00