Commit Graph

219443 Commits

Author SHA1 Message Date
Alan Somers
3e9662dcb4 Fix build of devd with GCC 4.2
Reported by:	olivier
Pointy-hat-to:	asomers
MFC after:	27 days
X-MFC-with:	312395
Sponsored by:	Spectra Logic Corp
2017-01-19 16:59:55 +00:00
Conrad Meyer
675c187cc4 ffs_vnops: Simplify extattr access
As suggested in r167010, use the structure type and macros to access and
modify UFS2 extended attributes.  Add assertions that pointers are
aligned in places where we now access the data through a structure
pointer, instead of character-by-character.

PR:		216127
Reported by:	dewayne at heuristicsystems.com.au
Reviewed by:	kib@
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9225
2017-01-19 16:46:05 +00:00
Konstantin Belousov
280ffa5ed7 Rename tmpfs_mount member allnode_lock to include namespace prefix.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-01-19 16:01:36 +00:00
Konstantin Belousov
4960d0d453 Protect macro argument.
Requested by:	hselasky
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-01-19 15:06:18 +00:00
Luiz Otavio O Souza
270da772f5 Handle the set capabilities ioctl, letting the hardware checksum be
disabled (Hi netmap!).

Only remove the CRC bytes from packets when the hardware tell us to do so.

Fixes the 'discard frame w/o leading ethernet header' issues.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-19 14:58:55 +00:00
Konstantin Belousov
e7e6c82067 Rework some tmpfs lock assertions.
Remove TMPFS_ASSERT_ELOCKED().  Its claims are already stated by other
asserts nearby and by VFS guarantees.
Change TMPFS_ASSERT_LOCKED() and one inlined place to use
ASSERT_VOP_(E)LOCKED() instead of hand-rolled imprecise asserts.

Tested by:	pho (as part of the larger patch)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-01-19 14:49:55 +00:00
Konstantin Belousov
bba7ed2054 Style fixes and comment updates.
Edit comments which explain no longer relevant details, and add
locking annotations to the struct tmpfs_node members.

Tested by:	pho (as part of the larger patch)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-01-19 14:27:37 +00:00
Luiz Otavio O Souza
b328ce000e The port number and the to_port_en flag are valid only on SOP descriptor.
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-19 14:05:49 +00:00
Konstantin Belousov
9e3ff5c594 Remove unused union member, fifos on tmpfs are implemented in common code.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-01-19 13:35:14 +00:00
Xin LI
805ca1775e Use S_ISREG instead of manual & (also it's better to compare the
result from & and the pattern instead of just assuming it's one bit
value).

Pointed out by Tianjie Mao <tjmao tjmao com>.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4827
2017-01-19 08:01:35 +00:00
Alan Somers
9df99d6ed0 Fix an unchecked return value in zfsd
It's pretty unlikely to actually hit this, but good to check it anyway

Reported by:	Coverity
CID:		1362018
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
2017-01-18 22:10:18 +00:00
Alan Somers
daa0d9dd7e Fix several Coverity CIDs in devd
CID 1362055, 1362054: File descriptor leaks during shutdown
CID 1362013: Potential null-termination fail with long network device names
CID 1362097: Uncaught exception during memory pressure
CID 1362017, 1362016: Unchecked errors, possibly resulting in weird behavior
	if two devd instances start at the same time.
CID 1362015:	Unchecked error that will probably never fail

Reported by:	Coverity
CID:	1362055 1362054 1362013 1362097 1362017 1362016 1362015
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
2017-01-18 20:24:37 +00:00
Conrad Meyer
c9bf814804 restore(8): Handle extended attribute names correctly
UFS2 extended attribute names are not NUL-terminated.  Handle
appropriately.

Correct the EXTATTR_BASE_LENGTH() macro, which handled ea_namelength ==
one (mod eight) extended attributes incorrectly.

PR:		216127
Reported by:	dewayne at heuristicsystems.com.au
Reviewed by:	kib@
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9208
2017-01-18 18:16:57 +00:00
Enji Cooper
4a42ab7dda Use SRCTOP instead of .CURDIR-relative path in .PATH directive
MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-01-18 18:14:50 +00:00
Conrad Meyer
6e02fac9d9 ufs/extattr.h: Fix documentation of ea_name termination
The ea_name string is not nul-terminated.  Correct the documentation.

Because the subsequent field is padded to 8 bytes, and the padding is
zeroed, the ea_name string will appear to be nul-terminated whenever the
length isn't exactly one (mod eight).

This was introduced in r167010 (2007).

Additionally, mark the length fields as unsigned.  This particularly
matters for the single byte ea_namelength field, which can represent
extended attribute names up to 255 bytes long.

No functional change.

PR:		216127
Reported by:	dewayne at heuristicsystems.com.au
Reviewed by:	kib@
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9206
2017-01-18 17:55:49 +00:00
Mateusz Guzik
c5f61e6f96 sx: reduce lock accesses similarly to r311172
Discussed with:	jhb
Tested by:	pho (previous version)
2017-01-18 17:55:08 +00:00
Mateusz Guzik
3f0a0612e8 rwlock: reduce lock accesses similarly to r311172
Discussed with:     jhb
Tested by:	pho (previous version)
2017-01-18 17:53:57 +00:00
Gleb Smirnoff
f3b3aa83ce Format and sort MSG_* flags, to prevent misedits in future. There is no
functional change.
2017-01-18 17:21:28 +00:00
Gleb Smirnoff
cf66bb8db9 Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME
lead to delayed send of data sent with sendto(MSG_NOSIGNAL).

Submitted by:	rrs
2017-01-18 17:09:22 +00:00
Ruslan Bukin
1c6fccc166 Remove empty ranges property so beri_simplebus can be attached again.
Sponsored by:	DARPA, AFRL
2017-01-18 14:41:59 +00:00
Sean Bruno
5a9c658286 ugh, device_t not device_t *
Reported by:	hps
2017-01-18 14:23:43 +00:00
Sean Bruno
70e316da4f Change device type to unbreak drm-next testing and builds.
Submitted by:	Matt Macy <mmacy@nextbsd.org>
2017-01-18 13:57:29 +00:00
Hans Petter Selasky
f3e7afe2d7 Implement kernel support for hardware rate limited sockets.
- Add RATELIMIT kernel configuration keyword which must be set to
enable the new functionality.

- Add support for hardware driven, Receive Side Scaling, RSS aware, rate
limited sendqueues and expose the functionality through the already
established SO_MAX_PACING_RATE setsockopt(). The API support rates in
the range from 1 to 4Gbytes/s which are suitable for regular TCP and
UDP streams. The setsockopt(2) manual page has been updated.

- Add rate limit function callback API to "struct ifnet" which supports
the following operations: if_snd_tag_alloc(), if_snd_tag_modify(),
if_snd_tag_query() and if_snd_tag_free().

- Add support to ifconfig to view, set and clear the IFCAP_TXRTLMT
flag, which tells if a network driver supports rate limiting or not.

- This patch also adds support for rate limiting through VLAN and LAGG
intermediate network devices.

- How rate limiting works:

1) The userspace application calls setsockopt() after accepting or
making a new connection to set the rate which is then stored in the
socket structure in the kernel. Later on when packets are transmitted
a check is made in the transmit path for rate changes. A rate change
implies a non-blocking ifp->if_snd_tag_alloc() call will be made to the
destination network interface, which then sets up a custom sendqueue
with the given rate limitation parameter. A "struct m_snd_tag" pointer is
returned which serves as a "snd_tag" hint in the m_pkthdr for the
subsequently transmitted mbufs.

2) When the network driver sees the "m->m_pkthdr.snd_tag" different
from NULL, it will move the packets into a designated rate limited sendqueue
given by the snd_tag pointer. It is up to the individual drivers how the rate
limited traffic will be rate limited.

3) Route changes are detected by the NIC drivers in the ifp->if_transmit()
routine when the ifnet pointer in the incoming snd_tag mismatches the
one of the network interface. The network adapter frees the mbuf and
returns EAGAIN which causes the ip_output() to release and clear the send
tag. Upon next ip_output() a new "snd_tag" will be tried allocated.

4) When the PCB is detached the custom sendqueue will be released by a
non-blocking ifp->if_snd_tag_free() call to the currently bound network
interface.

Reviewed by:		wblock (manpages), adrian, gallatin, scottl (network)
Differential Revision:	https://reviews.freebsd.org/D3687
Sponsored by:		Mellanox Technologies
MFC after:		3 months
2017-01-18 13:31:17 +00:00
Andrew Turner
ae69172343 Use the kernel stack in the ARM FBT DTrace provider. This is used to find
the fifth argument to functions being traced, however there was an error
where the userspace stack was being used. This may be invalid leading to
a kernel panic if this address is unmapped.

Submitted by:	Graeme Jenkinson <graeme.jenkinson@cl.cam.ac.uk>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9229
2017-01-18 13:27:24 +00:00
Toomas Soome
9c1cd3f5c3 loader: efi devpath api usage should be more aware of NULL pointers
As the efi_devpath_last_node() and efi_devpath_trim() can return NULL
pointers, the consumers of this API should check the the NULL pointers.

Same for efinet_dev_init() using calloc().

Reported by:	Robert Mustacchi <rm@joyent.com>
Reviewed by:	jhb, allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9203
2017-01-18 08:18:07 +00:00
Justin Hibbits
18e367f4aa Use the explicit expanded form of cmp.
Clang apparently requires the explicit form of this instruction, and rejects
uses which ignore the optional cmpD register.  This was the only use of the
shorthand form of the instruction, so just fix it up to match the others.

PR:		kern/215681
Submitted by:	Mark Millard
Reported by:	Mark Millard <markmi _AT_ dsl-only.net>
MFC after:	2 weeks
2017-01-18 03:42:21 +00:00
Navdeep Parhar
ff2c4d3f79 cxgbe/tom: Fix a case where do_pass_accept_req wasn't properly restoring
the VNET.  This should have been in r311949.

MFC after:	2 days
2017-01-18 03:35:42 +00:00
Ed Schouten
4423244072 Catch up with changes to structure member names.
Pointer/length pairs are now always named ${name} and ${name}_len.
2017-01-17 22:05:52 +00:00
Ed Schouten
c20537def1 Regenerate sources based on the system call tables. 2017-01-17 22:05:01 +00:00
Ed Schouten
ac7ca49edf Sync in the latest CloudABI generated source files.
Languages like C++17 and Go provide direct support for slice types:
pointer/length pairs. The CloudABI generator now has more complete for
this, meaning that for the C binding, pointer/length pairs now use an
automatic naming scheme of ${name} and ${name}_len.

Apart from this change and some reformatting, the ABI definitions are
identical. Binary compatibility is preserved entirely.
2017-01-17 22:03:08 +00:00
Bryan Drewery
751df7696a Don't compute MPATH during install.
This saves time when building over NFS.  Nothing should be building during
this phase anyhow.

Sponsored by:	Dell EMC Isilon
2017-01-17 21:12:21 +00:00
Alexander Motin
640603fbf6 Remove writing 'residual' field of struct ctl_scsiio.
This field has no practical use and never readed.  Initiators already
receive respective residual size from frontends.  Removed field had
different semantics, which looks useless, and was never passed through
by any frontend.

While there, fix kern_data_resid field support in case of HA, missed in
r312291.

MFC after:	13 days
2017-01-17 18:32:47 +00:00
Luiz Otavio O Souza
a396e10cd9 The write-protect is not wired on uFW, disable it to allow writes to SD
card.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-17 18:04:13 +00:00
Luiz Otavio O Souza
96d2f2694a Set the the wp_disabled flag when asked to.
While here, add the missing new line.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-01-17 17:41:14 +00:00
Sean Bruno
23030355c6 Add 4k quirk for Micron 5100 and Intel S3610 SSDs
Submitted by:	Jason Wolfe <j@nitrology.com>
MFH:		1 week
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D9209
2017-01-17 14:52:48 +00:00
Alexander Motin
a8d32bff70 Improve error message on duplicate iSCSI port.
MFC after:	2 weeks
2017-01-17 14:13:14 +00:00
Andrey V. Elsukov
ce3a6cf06a Initialize IPFW static rules rmlock with RM_RECURSE flag.
This lock was replaced from rwlock in r272840. But unlike rwlock, rmlock
doesn't allow recursion on rm_rlock(), so at this time fix this with
RM_RECURSE flag. Later we need to change ipfw to avoid such recursions.

PR:		216171
Reported by:	Eugene Grosbein
MFC after:	1 week
2017-01-17 10:50:28 +00:00
Hans Petter Selasky
067e471a24 Add USB audio support for S/PDIF output with C-Media CM6206 devices.
Submitted by:		Julien Nadeau <vedge@hypertriton.com>
PR:			216131
MFC after:		1 week
2017-01-17 08:15:10 +00:00
Xin LI
ca6e7a016c MFV r312333: zlib 1.2.11.
MFC after:	1 month
2017-01-17 05:55:47 +00:00
Xin LI
850069632c Vendor import of zlib 1.2.11. 2017-01-17 05:47:05 +00:00
Enji Cooper
a0888761e8 Use SRCTOP where possible and use :H to manipulate .CURDIR to get rid of
unnecessarily long relative path .PATH values with make

MFC after:	1 days
Sponsored by:	Dell EMC Isilon
2017-01-17 03:58:37 +00:00
Gleb Smirnoff
1897a4f168 Fix regression from r310655, which broke operation of bsnmpd if it is bound
to a non-wildcard address.  As documented in ip(4), doing sendmsg(2) with
IP_SENDSRCADDR on a socket that is bound to non-wildcard address is
completely different to using this control message on a wildcard one.

A fix is to add a bool to mark whether we did setsockopt(IP_RECVDSTADDR)
on the socket, and use IP_SENDSRCADDR control message only if we did.

While here, garbage collect absolutely useless udp_recv() function that
establishes some structures on stack to never use them later.
2017-01-17 03:52:57 +00:00
Enji Cooper
489b7fc0a4 Add smilint target to subdir targets so "make smilint" here will run
the smilint target in subdirs

While here, convert a path that's .CURDIR relative to SRCTOP

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-01-17 03:44:45 +00:00
Enji Cooper
0acfb04bce Remove ad hoc smilint targets made standard in bsd.snmpmod.mk in r312328
MFC after:	1 week
X-MFC with:	r312328
Sponsored by:	Dell EMC Isilon
2017-01-17 03:41:23 +00:00
Enji Cooper
c6bd67d9d0 Add a make target (smilint) for running smilint tool against BMIBS
Running smilint against MIB definitions is useful in finding
functional problems with MIB definitions/descriptions.

This is inspired by the smilint targets defined in
usr.sbin/bsnmpd/modules/{snmp_hostres,snmp_mibII}/Makefile

Document all of the variables that are involved in running the
smilint target, as well as all of the prerequisites to running
it.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9099
2017-01-17 03:38:49 +00:00
Andriy Voskoboinyk
5a88d9fd3b Add sys/dev/rtwn/rtl8821a/usb/r21au_dfs.c into sys/conf/files
Reported by:	adrian
2017-01-17 00:48:02 +00:00
Oleksandr Tymoshenko
024fe4e7ea [zynq] Fix panic on USB PHY initialization failure
The Zedboard has a hardware bug where initialization of the USB PHY
occasionally fails on boot-up. Fix regression in -CURRENT when
kernel panics on such occasion. 11-RELEASE branch works fine

PR:		215862
Submitted by:	Thomas Skibo <thoma555-bsd@yahoo.com>
2017-01-17 00:39:09 +00:00
Andriy Voskoboinyk
09606165a0 rtwn: export more stats to net80211
Setup more ieee80211_rx_stats fields for received frames:
 - pktflags:
  * IEEE80211_RX_F_FAIL_FCSCRC;
  * IEEE80211_RX_F_AMPDU;
  * IEEE80211_RX_F_AMPDU_MORE;
  * IEEE80211_RX_F_SHORTGI;
 - rate flags (CCK, OFDM, HT);
 - width;
 - phytype;
 - rate;
 - rx_tsf;
 - rssi;
 - nf;
 - ieee, freq (RTL8188EU only, when ht40 support is disabled).

Tested with:
 - RTL8188CE, RTL8188EU, RTL8821AU (STA / AP modes, i386)
 - (by kevlo) RTL8188EU and RTL8812AU (amd64)

Reviewed by:	adrian (previous version), kevlo
Differential Revision:	https://reviews.freebsd.org/D9021
2017-01-17 00:35:23 +00:00
Toomas Soome
fdb9150ea4 loader: move device path definitions to include/efidevp.h
No functional change, only moving uuid and protocol bits to include/efidevp.h

Reviewed by:	imp, jhb
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D9192
2017-01-16 20:57:01 +00:00
Ed Maste
bf9ebe74e2 disambiguate msleep KASSERT diagnostics
Previously "panic: msleep" could happen for a few different reasons.
Break the KASSERTs out into individual cases to identify the failing
condition. Found during the investigation that resulted in r308288.

Reviewed by:	kib, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8604
2017-01-16 20:34:42 +00:00