Commit Graph

207061 Commits

Author SHA1 Message Date
Allan Jude
7a3f5d11fb Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.c
cperciva's libmd implementation is 5-30% faster

The same was done for SHA256 previously in r263218

cperciva's implementation was lacking SHA-384 which I implemented, validated against OpenSSL and the NIST documentation

Extend sbin/md5 to create sha384(1)

Chase dependancies on sys/crypto/sha2/sha2.{c,h} and replace them with sha512{c.c,.h}

Reviewed by:	cperciva, des, delphij
Approved by:	secteam, bapt (mentor)
MFC after:	2 weeks
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3929
2015-12-27 17:33:59 +00:00
Allan Jude
1747e1d875 Fix incorrect error message in geom map
If geom_map fails to find the end of a mapped partition based on a search, it would return the incorrect error message, stating it could not parse the START value

Reviewed by:	adrian
Approved by:	bapt (mentor)
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D4187
2015-12-27 17:09:23 +00:00
Dmitry Chagin
3e18d701de Verify that tv_sec value specified in settimeofday() and clock_settime()
(CLOCK_REALTIME case) system calls is non negative.
This commit hides a kernel panic in atrtc_settime() as the clock_ts_to_ct()
does not properly convert negative tv_sec.

ps. in my opinion clock_ts_to_ct() should be rewritten to properly handle
negative tv_sec values.

Differential Revision:	https://reviews.freebsd.org/D4714
Reviewed by:		kib

MFC after:	1 week
2015-12-27 15:37:07 +00:00
Konstantin Belousov
ff64a90ed9 Add missed relpbuf() for a smallfs page-in.
Reported by:	Shawn Webb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2015-12-27 14:42:39 +00:00
Ed Schouten
2747eff128 Replace implementation of hsearch() by one that scales.
Traditionally the hcreate() function creates a hash table that uses
chaining, using a fixed user-provided size. The problem with this
approach is that this often either wastes memory (table too big) or
yields bad performance (table too small). For applications it may not
always be easy to estimate the right hash table size. A fixed number
only increases performance compared to a linked list by a constant
factor.

This problem can be solved easily by dynamically resizing the hash
table. If the size of the hash table is at least doubled, this has no
negative on the running time complexity. If a dynamically sized hash
table is used, we can also switch to using open addressing instead of
chaining, which has the advantage of just using a single allocation for
the entire table, instead of allocating many small objects.

Finally, a problem with the existing implementation is that its
deterministic algorithm for hashing makes it possible to come up with
fixed patterns to trigger an excessive number of collisions. We can
easily solve this by using FNV-1a as a hashing algorithm in combination
with a randomly generated offset basis.

Measurements have shown that this implementation is about 20-25% faster
than the existing implementation (even if the existing implementation is
given an excessive number of buckets). Though it allocates more memory
through malloc() than the old implementation (between 4-8 pointers per
used entry instead of 3), process memory use is similar to the old
implementation as if the estimated size was underestimated by a factor
10. This is due to the fact that malloc() needs to perform less
bookkeeping.

Reviewed by:	jilles, pfg
Obtained from:	https://github.com/NuxiNL/cloudlibc
Differential Revision:	https://reviews.freebsd.org/D4644
2015-12-27 07:50:11 +00:00
Adrian Chadd
50bf167022 Fix missing path conversion from the previous commit to shuffle mdio around.
It turns out the recent work to cut down the number of atheros kernels built
didnt include one with ARGE_MDIO defined..
2015-12-27 07:39:44 +00:00
Alexander Motin
5d084976cb Allocate separate scratch space for scanner purposes.
This space does not require DMA syncing. It reduces lock scope of the DMA
scratch space.  It allows whole DMA scratch space to be used to I/O, so now
we can fetch up to ~1000 ports from SNS.

Due to the last fact, increase maximal number of ports from 256 to 1024.
2015-12-27 06:28:31 +00:00
Alexander Motin
14849e2c85 Split DMA buffers for request, response and ATIO queues. 2015-12-27 06:16:02 +00:00
Konstantin Belousov
d6717e1b51 Typo. 2015-12-27 01:14:42 +00:00
Jamie Gritton
e4e5904ffe Let old-style (shell-based) jail configuration handle jail names that
contain characters not allowed in a shell variable (such as "-").
These will be replaced by an underscore in jail config variables,
e.g. for jail "foo-bar" you would set "jail_foo_bar_hostname".

This is separate from the current code that changes the jail names
if they contain "." or "/".  It also doesn't apply to jails defined
in a jail.conf file.

PR:		191181
MFC after:	5 days
2015-12-26 23:01:34 +00:00
Jilles Tjoelker
cf1330bef9 sh: Add tests for #/##/%/%% on $* and $@.
Although POSIX leaves things like ${*#X} unspecified, it occasionally occurs
in practice. Add some tests that seem to work sensibly.
2015-12-26 22:27:48 +00:00
Allan Jude
b5e81ea6b0 Fix includes in usr.sbin/fstyp/zfs.c
Approved by:	bapt (mentor)
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D4710
2015-12-26 19:48:36 +00:00
Adrian Chadd
6075c2fc6a Disable the firwmare licence check for rsu and urtwn.
The licence grant says something exactly the same as the atheros patent
grant, which is "As long as you use this firmware on our chips, everything
is totally okay."  Now, I'm pretty sure if that we /have/ to have this,
we're going to have to have it for every other firmware for every other
device in the tree.

So, I'll flip this off in -HEAD for now so people stop asking about
why rsu/urtwn don't work out of the box, and I'll kick off a larger
discussion about this in the new year.
2015-12-26 19:14:24 +00:00
Ian Lepore
630c9dba7a Enhance rc.d/netwait script to wait for late-attaching interfaces such as
USB NICs.

USB network hardware may not be enumerated and available when the rc.d
networking scripts run. Eventually the USB attachment completes and devd
events cause the network initialization to happen, but by then other rc.d
scripts have already failed, because services which depend on NETWORKING
(such as mountcritremote) may end up running before the network is actually
ready.

There is an existing netwait script, but because it is dependent on
NETWORKING it runs too late to prevent failure of some other rc
scripts. This change flips the order so that NETWORKING depends on netwait,
and netwait now depends on devd and routing (the former is needed to make
interfaces appear, and the latter is needed to run the ping tests in
netwait).

The netwait script used to be oriented primarily towards "as soon as any
host is reachable the network is fully functional", so you gave it a list of
IPs to try and you could optionally name an interface and it would wait for
carrier on that interface. That functionality still works the same, but now
you can provide a list of interfaces to wait for and it waits until each one
of them is available. The ping logic still completes as soon as the first IP
on the list responds.

These changes were submitted by Brenden Molloy <brendan+freebsd@bbqsrc.net>
in PR 205186, and lightly modified by me to allow a list of interfaces
instead of just one.

PR:		205186
Differential Revision:	https://reviews.freebsd.org/D4608 (timeout w/o review)
2015-12-26 18:21:32 +00:00
Bjoern A. Zeeb
376760cc96 Add missing #ifdef INET after r292674 to allow NOIP and NOINET kernels
to build.
2015-12-26 17:27:48 +00:00
Adrian Chadd
e2db1d1f11 [mdio] Add MDIO support for "extended" registers as defined by IEEE 802.3 Clause 45.
IEEE 802.3 Clause 45 added backwards-compatible support for 2^16 PHY registers
through the addition of an additional device address frame.

Clause 45 addressing is used in 10Gbe PHYs, 802.3az EEE registers, etc. It may
make sense to provide a similar extension to the miibus interface, but I've
refrained from unilaterally doing so here.

Submitted by:	Landon Fuller <landon@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D4607
2015-12-26 17:22:02 +00:00
Konstantin Belousov
1899507706 Do not substitute interpeter if the brand interpreter path is
different from the interpreter path requested by the binary.

Before this change, it is impossible to activate non-default
interpreter for 32bit image on amd64, when /libexec/ld-elf32.so.1 file
exists.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-12-26 15:40:12 +00:00
Baptiste Daroussin
4a19ae21ae procfs(5) is not required by ps(1) and w(1) anymore
Remove references of those tools in procfs(5)
2015-12-26 14:23:35 +00:00
Alexander Motin
7d191fdb97 Use single DMA tag for scratch areas of all virtual ports. 2015-12-26 09:16:05 +00:00
Dmitry Chagin
bfb5568a3c Return EINVAL in case of incorrect sigev_signo value specified instead of panicing. 2015-12-26 09:09:49 +00:00
Dmitry Chagin
6e5549717a Do not allow access to emuldata for non Linux processes.
Pointed out by:	mjg@
Security:	https://admbugs.freebsd.org/show_bug.cgi?id=679
2015-12-26 09:04:47 +00:00
Alexander Motin
9d8b002160 Make port logins asynchronous, following r292739 logic.
This is even more important since it involves more network operations and
more prone to delays and timeouts.
2015-12-26 06:13:01 +00:00
Navdeep Parhar
e3148e46b2 cxgbei: Hardware accelerated iSCSI target and initiator for TOE capable
cards supported by cxgbe(4).

On the host side this driver interfaces with the storage stack via the
ICL (iSCSI Common Layer) in the kernel.  On the wire the traffic is
standard iSCSI (SCSI over TCP as per RFC 3720/7143 etc.) that
interoperates with all other standards compliant implementations.  The
driver is layered on top of the TOE driver (t4_tom) and promotes
connections being handled by t4_tom to iSCSI ULP (Upper Layer Protocol)
mode.  Hardware assistance in this mode includes:

- Full TCP processing.
- iSCSI PDU identification and recovery within the TCP stream.
- Header and/or data digest insertion (tx) and verification (rx).
- Zero copy (both tx and rx).

Man page will follow in a separate commit in a couple of weeks.

Relnotes:	Yes
Sponsored by:	Chelsio Communications
2015-12-26 06:05:21 +00:00
Alexander Motin
66e979f15c Make virtual ports control asynchronous.
Before this change virtual ports control IOCBs were executed synchronously
via Execute IOCB mailbox command.  It required exclusive use of scratch
space of driver and mailbox registers of the hardware.  Because of that
shared resources use this code could not really sleep, having to spin for
completion, blocking any other operation.

This change introduces new asynchronous design, sending the IOCBs directly
on request queue and gracefully waiting for their return on response queue.
Returned IOCBs are identified with unified handle space from r292725.
2015-12-26 04:26:32 +00:00
Adrian Chadd
71e8eac4fd [mdio] migrate mdiobus out of etherswitch and into a top-level device of its own.
The mdio driver interface is generally useful for devices that require
MDIO without the full MII bus interface. This lifts the driver/interface
out of etherswitch(4), and adds a mdio(4) man page.

Submitted by:	Landon Fuller <landon@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D4606
2015-12-26 02:31:39 +00:00
Navdeep Parhar
9eb533d3b4 cxgbe(4): Updates to the base NIC driver and t4_tom to support the iSCSI
offload driver.  These changes come from projects/cxl_iscsi.
2015-12-26 00:26:02 +00:00
Dimitry Andric
9a4b31181f Upgrade our copies of clang and llvm to 3.7.1 release. This is a
bugfix-only release, with no new features.

Please note that from 3.5.0 onwards, clang and llvm require C++11
support to build; see UPDATING for more information.
2015-12-25 21:39:45 +00:00
Michael Tuexen
1672adc7b1 Don't implicitly terminate a user message when moving it to the
send_queue and the socket is closed. This results in strange
race conditions for the application.
While there, remove a stray character.

MFC after: 3 days
2015-12-25 18:11:40 +00:00
Simon J. Gerraty
6e05054094 Merge bmake-20151220
Fixed clearing suffixes impact on null suffix
2015-12-25 16:19:21 +00:00
Kevin Lo
ddb1359877 Fix typo (s/harware/hardware/) 2015-12-25 14:51:36 +00:00
Dimitry Andric
7e86edd64b Import clang 3.7.1 release (r255217). 2015-12-25 14:26:58 +00:00
Dimitry Andric
2fe5752e3a Import llvm 3.7.1 release (r255217). 2015-12-25 14:25:49 +00:00
Alexander Motin
970ceb2fd5 Unify handles allocation for initiator and target IOCBs.
I am not sure why this was split long ago, but I see no reason for it.
At this point this unification just slightly reduces memory usage, but
as next step I plan to reuse shared handle space for other IOCB types.
2015-12-25 13:03:18 +00:00
Colin Percival
f051a5b324 Make libxnet.so a symlink to libc.so. This makes -lxnet a no-op, as
POSIX requires for the c99 compiler.

(In fact, our c99(1) already ignores -lxnet; but our make(1) doesn't set
${CC} correctly, and our cc(1) treats xnet like any other library.)

Reviewed by:	kib
2015-12-25 11:29:18 +00:00
Hajimu UMEMOTO
831f2b3974 Remove _gethostbynisname() and _gethostbynisaddr(). These functions
used to be called from getipnodebyname().

MFC after:	1 week
2015-12-25 10:49:40 +00:00
Colin Percival
6729297833 Document that make's .POSIX: handling is broken. In fact, it has been
broken ever since it was added in November 1996.
2015-12-25 10:08:42 +00:00
Simon J. Gerraty
6c770d664f Import bmake-20151220 2015-12-25 08:09:48 +00:00
Alexander Motin
a4f43c01c0 Clear virtual port's port database when disabling it.
Previously it was done only on full chip reinit, that caused old ports
resurrect in case of virtual port reenabling.
2015-12-25 03:44:29 +00:00
Adrian Chadd
d5c2c0134b Add initial configuration files for the MT7620 and RT5350 SoCs.
These are all works in progress.  Notably - no wifi support just yet!

I've booted the MT7620 on a TP-Link Archer C2 via tftpboot.

Submitted by:	Stanislav Galabov <sgalabov@gmail.com>
2015-12-25 00:58:41 +00:00
Adrian Chadd
43747185a0 Add missing device rename. 2015-12-24 22:27:00 +00:00
Enji Cooper
30dfa264d0 Remove unused function act_getkernstring
This fixes a clang -Wunused warning

Differential Revision: https://reviews.freebsd.org/D4697
MFC after: 1 week
Reported by: Jenkins
Reviewed by: araujo, bapt
Sponsored by: EMC / Isilon Storage Division
2015-12-24 22:22:02 +00:00
Konstantin Belousov
66fa67c7f7 Do not compile ARMv6 instructions on ARMv4/v5. Although clang is fine
with mrrc, gcc is not.  The disabled code is not executed on ARMv4
anyway.

Reported and reviewed by:	ian
Sponsored by:	The FreeBSD Foundation
2015-12-24 22:13:52 +00:00
Patrick Kelsey
281a0fd4f9 Implementation of server-side TCP Fast Open (TFO) [RFC7413].
TFO is disabled by default in the kernel build.  See the top comment
in sys/netinet/tcp_fastopen.c for implementation particulars.

Reviewed by:	gnn, jch, stas
MFC after:	3 days
Sponsored by:	Verisign, Inc.
Differential Revision:	https://reviews.freebsd.org/D4350
2015-12-24 19:09:48 +00:00
Ed Maste
18010b98c2 rtld: remove old XXX comment missed in r35529
Sponsored by:	The FreeBSD Foundation
2015-12-24 18:53:17 +00:00
Adrian Chadd
dec1abaec3 [rt] add support for the RT5350 and MT7620 SoCs.
This is a work in progress; bringing the interface down stops further
use.  It only happens on RT5350/MT7620.

This is based on work by Alexander A. Mityaev <sansan@adm.ua>.

Submitted by:	Stanislav Galabov <galabov@gmail.com>
2015-12-24 18:41:16 +00:00
Adrian Chadd
ba1ae59a17 [rt305x] Add initial RT5350 and MT7620 glue.
* Add in chipset awareness to the obio bus layout (ie, which devices are
  where);
* Add in some USB OTG changes to be aware of the newer stuff;
* Add in a configurable primary console - some chips use the normal UART,
  some use UARTLITE.

Tested (by Stanislav);

* RT3050 (NFS)
* RT5350 (NFS, MFS)
* MT7620 (USB)

Submitted by:	Stanislav Galabov <sgalabov@gmail.com>
2015-12-24 18:40:10 +00:00
Adrian Chadd
f9133e1d31 [MT7620] add ehci/ohci USB support.
The newer chips don't use OTG; they're more traditional USB.

Submitted by:	Stanislav Galabov <sgalabov@gmail.com>
2015-12-24 18:36:08 +00:00
Adrian Chadd
0f4da49e43 [MT7620] add SPI device support.
Submitted by:	Alexander A. Mityaev <sansan@adm.ua>
2015-12-24 18:34:46 +00:00
Adrian Chadd
f3213f44b2 [rt305x] add PCI bus / resource allocation code for the MT7620.
This is based on the sys/arm/mv/ pci resource/allocation code.

Submitted by:	Stanislav Galabov <galabov@gmail.com>
2015-12-24 18:33:08 +00:00
Adrian Chadd
c40db2e376 [rt305x] add register space definitions for later generation chips.
This adds definitions for the MT5350 and MT7620 SoCs.

Submitted by:	Stanislav Galabov <galabov@gmail.com>
2015-12-24 18:31:55 +00:00