]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoShar files may be seen as binary by grep.
bdrewery [Thu, 31 Jan 2019 23:21:18 +0000 (23:21 +0000)]
Shar files may be seen as binary by grep.

Suggest using -a to egrep to properly see executed commands.

This is a minor improvement to the manpage.  A better improvement
would be removal or gigantic warnings.

Sponsored by: Dell EMC
MFC after: 1 week

5 years agoRemove iBCS2: also remove xenix syscall function support.
brooks [Thu, 31 Jan 2019 23:01:12 +0000 (23:01 +0000)]
Remove iBCS2: also remove xenix syscall function support.

Missed in r342243.

5 years agoNew pfil(9) KPI together with newborn pfil API and control utility.
glebius [Thu, 31 Jan 2019 23:01:03 +0000 (23:01 +0000)]
New pfil(9) KPI together with newborn pfil API and control utility.

The KPI have been reviewed and cleansed of features that were planned
back 20 years ago and never implemented.  The pfil(9) internals have
been made opaque to protocols with only returned types and function
declarations exposed. The KPI is made more strict, but at the same time
more extensible, as kernel uses same command structures that userland
ioctl uses.

In nutshell [KA]PI is about declaring filtering points, declaring
filters and linking and unlinking them together.

New [KA]PI makes it possible to reconfigure pfil(9) configuration:
change order of hooks, rehook filter from one filtering point to a
different one, disconnect a hook on output leaving it on input only,
prepend/append a filter to existing list of filters.

Now it possible for a single packet filter to provide multiple rulesets
that may be linked to different points. Think of per-interface ACLs in
Cisco or Juniper. None of existing packet filters yet support that,
however limited usage is already possible, e.g. default ruleset can
be moved to single interface, as soon as interface would pride their
filtering points.

Another future feature is possiblity to create pfil heads, that provide
not an mbuf pointer but just a memory pointer with length. That would
allow filtering at very early stages of a packet lifecycle, e.g. when
packet has just been received by a NIC and no mbuf was yet allocated.

Differential Revision: https://reviews.freebsd.org/D18951

5 years agoRegen after r342190.
brooks [Thu, 31 Jan 2019 22:58:17 +0000 (22:58 +0000)]
Regen after r342190.

Differential Revision: https://reviews.freebsd.org/D18444

5 years agonvdimm: only enumerate present nvdimm devices
kib [Thu, 31 Jan 2019 22:47:04 +0000 (22:47 +0000)]
nvdimm: only enumerate present nvdimm devices

Not all child devices of the NVDIMM root device represent DIMM devices
which are present in the system. The spec says (ACPI 6.2, sec 9.20.2):

    For each NVDIMM present or intended to be supported by platform,
    platform firmware also exposes an NVDIMM device ... under the
    NVDIMM root device.

Present NVDIMM devices are found by walking all of the NFIT table's
SPA ranges, then walking the NVDIMM regions mentioned by those SPA
ranges.

A set of NFIT walking helper functions are introduced to avoid the
need to splat the enumeration logic across several disparate
callbacks.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by: Intel Corporation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18439

5 years agonvdimm: enumerate NVDIMM SPA ranges from the root device
kib [Thu, 31 Jan 2019 22:43:20 +0000 (22:43 +0000)]
nvdimm: enumerate NVDIMM SPA ranges from the root device

Move the enumeration of NVDIMM SPA ranges from the spa GEOM class
initializer into the NVDIMM root device. This will be necessary for a
later change where NVDIMM namespaces require NVDIMM device enumeration
to be reliably ordered before SPA enumeration.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by: Intel Corporation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18734

5 years agoAdd new m_ext type for data for M_NOFREE mbufs, which doesn't actually do
glebius [Thu, 31 Jan 2019 22:37:28 +0000 (22:37 +0000)]
Add new m_ext type for data for M_NOFREE mbufs, which doesn't actually do
anything except several assertions.  This type is going to be used for
temporary on stack mbufs, that point into data in receive ring of a NIC,
that shall not be freed.  Such mbuf can not be stored or reallocated, its
life time is current context.

5 years agoPrevent some kobj memory allocation failures from panicking the system.
markj [Thu, 31 Jan 2019 22:27:39 +0000 (22:27 +0000)]
Prevent some kobj memory allocation failures from panicking the system.

Parts of the kobj(9) KPI assume a non-sleepable context for the purpose
of internal memory allocations, but currently have no way to signal an
allocation failure to the caller, so they just panic in this case.  This
can occur even when kobj_create() is called with M_WAITOK.  Fix some
instances of the problem by plumbing wait flags from kobj_create() through
internal subroutines.  Change kobj_class_compile() to assume a sleepable
context when called externally, since all existing callers use it in a
sleepable context.

To fix the problem fully the kobj_init() KPI must be changed.

Reported and tested by: pho
Reviewed by: kib (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19023

5 years agoix(4),ixv(4): Fix TSO offloads when TXCSUM is disabled
erj [Thu, 31 Jan 2019 21:53:03 +0000 (21:53 +0000)]
ix(4),ixv(4): Fix TSO offloads when TXCSUM is disabled

This patch and commit message are based on r340256 created by Jacob Keller:

The iflib stack does not disable TSO automatically when TXCSUM is
disabled, instead assuming that the driver will correctly handle TSOs
even when CSUM_IP is not set.

This results in iflib calling ixgbe_isc_txd_encap with packets which have
CSUM_IP_TSO, but do not have CSUM_IP or CSUM_IP_TCP set. Because of
this, ixgbe_tx_ctx_setup will not setup the IPv4 checksum offloading.

This results in bad TSO packets being sent if a user disables TXCSUM
without disabling TSO.

Fix this by updating the ixgbe_tx_ctx_setup function to check both
CSUM_IP and CSUM_IP_TSO when deciding whether to enable checksums.

Once this is corrected, another issue for TSO packets is revealed. The
driver sets IFLIB_NEED_ZERO_CSUM in order to enable a work around that
causes the ip->sum field to be zero'd. This is necessary for ix
hardware to correctly perform TSOs.

However, if TXCSUM is disabled, then the work around is not enabled, as
CSUM_IP will not be set when the iflib stack checks to see if it should
clear the sum field.

Fix this by adding IFLIB_TSO_INIT_IP to the iflib flags for the ix and
ixv interface files.

Once both of these changes are made, the ix and ixv drivers should
correctly offload TSO packets when TSO offload is enabled, regardless
of whether TXCSUM is enabled or disabled.

Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: IntelNetworking
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18470

5 years agoix(4): Run {mod,msf,mbx,fdir,phy}_task in if_update_admin_status
erj [Thu, 31 Jan 2019 21:44:33 +0000 (21:44 +0000)]
ix(4): Run {mod,msf,mbx,fdir,phy}_task in if_update_admin_status

From Piotr:

This patch introduces adapter->task_requests register responsible for
recording requests for mod_task, msf_task, mbx_task, fdir_task and
phy_task calls. Instead of enqueueing these tasks with
GROUPTASK_ENQUEUE, handlers will be called directly from
ixgbe_if_update_admin_status() while holding ctx lock.

SIOCGIFXMEDIA ioctl() call reads adapter->media list. The list is
deleted and rewritten in ixgbe_handle_msf() task without holding ctx
lock. This change is needed to maintain data coherency when sharing
adapter info via ioctl() calls.

Patch co-authored by Krzysztof Galazka <krzysztof.galazka@intel.com>.

PR: 221317
Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: sbruno@, IntelNetworking
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18468

5 years agoDon't set IFCAP_TXRTLMT during lagg_clone_create().
jhb [Thu, 31 Jan 2019 21:35:37 +0000 (21:35 +0000)]
Don't set IFCAP_TXRTLMT during lagg_clone_create().

lagg_capabilities() will set the capability once interfaces supporting
the feature are added to the lagg.  Setting it on a lagg without any
interfaces is pointless as the if_snd_tag_alloc call will always fail
in that case.

Reviewed by: hselasky, gallatin
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19040

5 years agoRevert r316461: Remove "IPFW static rules" rmlock, and use pfil's global lock.
glebius [Thu, 31 Jan 2019 21:04:50 +0000 (21:04 +0000)]
Revert r316461: Remove "IPFW static rules" rmlock, and use pfil's global lock.

The pfil(9) system is about to be converted to epoch(9) synchronization, so
we need [temporarily] go back with ipfw internal locking.

Discussed with: ae

5 years agoMake iflib a loadable module: add seemingly missed header.
kib [Thu, 31 Jan 2019 20:04:18 +0000 (20:04 +0000)]
Make iflib a loadable module: add seemingly missed header.

Reported by: CI (i.e. it is not reproducable in my local builds)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

5 years agoMake iflib a loadable module.
kib [Thu, 31 Jan 2019 19:05:56 +0000 (19:05 +0000)]
Make iflib a loadable module.

iflib is already a module, but it is unconditionally compiled into the
kernel.  There are drivers which do not need iflib(4), and there are
situations where somebody might not want iflib in kernel because of
using the corresponding driver as module.

Reviewed by: marius
Discussed with: erj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D19041

5 years agoIn zone_alloc_bucket() max argument was calculated based on uz_count.
glebius [Thu, 31 Jan 2019 17:52:48 +0000 (17:52 +0000)]
In zone_alloc_bucket() max argument was calculated based on uz_count.
Then bucket_alloc() also selects bucket size based on uz_count. However,
since zone lock is dropped, uz_count may reduce. In this case max may
be greater than ub_entries and that would yield into writing beyond end
of the allocation.

Reported by: pho

5 years agoreadelf: dump elf note data
emaste [Thu, 31 Jan 2019 17:04:55 +0000 (17:04 +0000)]
readelf: dump elf note data

Output format is compatible with GNU readelf's handling of unknown note
types (modulo a GNU char signedness bug); future changes will add type-
specific decoding.

Reviewed by: kib
MFC after: 1 week
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

5 years agoelfdump: use designated array initialization for note types
emaste [Thu, 31 Jan 2019 16:49:06 +0000 (16:49 +0000)]
elfdump: use designated array initialization for note types

This ensures the note type name is in the correct slot.

PR: 228290
Submitted by: kib
MFC with: 343610
Sponsored by: The FreeBSD Foundation

5 years agoelfdump: fix build after r343610
emaste [Thu, 31 Jan 2019 16:21:09 +0000 (16:21 +0000)]
elfdump: fix build after r343610

One patch hunk did not survive the trip from git to svn.

PR: 228290
MFC with: r343610

5 years agoelfdump: include note type names
emaste [Thu, 31 Jan 2019 16:19:04 +0000 (16:19 +0000)]
elfdump: include note type names

Based on a patch submitted by Dan McGregor.

PR: 228290
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoelfdump: whitespace fixup in advance of other changes
emaste [Thu, 31 Jan 2019 16:11:15 +0000 (16:11 +0000)]
elfdump: whitespace fixup in advance of other changes

5 years agoregen src.conf.5 after r343606
emaste [Thu, 31 Jan 2019 15:50:11 +0000 (15:50 +0000)]
regen src.conf.5 after r343606

5 years agoReserve a bit in the FreeBSD feature control note for marking the
kib [Thu, 31 Jan 2019 15:44:49 +0000 (15:44 +0000)]
Reserve a bit in the FreeBSD feature control note for marking the
image as not compatible with ASLR.

Requested by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D5603

5 years agoEnable lld as the system linker by default on i386
emaste [Thu, 31 Jan 2019 15:07:32 +0000 (15:07 +0000)]
Enable lld as the system linker by default on i386

The migration to LLVM's lld linker has been in progress for quite some
time - I opened an LLVM tracking bug (23214) in April 2015 to track
issues using lld as FreeBSD's linker, and requested the first exp-run
using lld as /usr/bin/ld in November 2016.

In 12.0 LLD is the system linker on amd64, arm64, and armv7.  i386 was
not switched initially as there were additional ports failures not found
on amd64.  Those have largely been addressed now, although there are a
small number of issues that are still being worked on.  In some of these
cases having lld as the system linker makes it easier for developers and
third parties to investigate failures.

Thanks to antoine@ for handling the exp-runs and to everyone in the
FreeBSD and LLVM communites who have fixed issues with lld to get us to
this point.

PR: 214864
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

5 years agobwn(4): reuse ieee80211_tx_complete function.
avos [Thu, 31 Jan 2019 11:12:31 +0000 (11:12 +0000)]
bwn(4): reuse ieee80211_tx_complete function.

MFC after: 1 week

5 years agoipw(4): reuse ieee80211_tx_complete function
avos [Thu, 31 Jan 2019 10:44:00 +0000 (10:44 +0000)]
ipw(4): reuse ieee80211_tx_complete function

This should partially fix 'netstat -b -I wlan0' output

MFC after: 1 week

5 years agoinstall(1): Fix relative path calculation with partial common dest/src
kevans [Thu, 31 Jan 2019 05:20:11 +0000 (05:20 +0000)]
install(1): Fix relative path calculation with partial common dest/src

For example, from the referenced PR [1]:

$ mkdir /tmp/lib/ /tmp/libexec
$ touch /tmp/lib/foo.so
$ install -lrs /tmp/lib/foo.so /tmp/libexec/

The common path identification bits terminate src at /tmp/lib/ and the
destination at /tmp/libe. The subsequent backtracking is then incorrect, as
it traverses the destination and backtraces exactly one level while eating
the 'libexec' because it was previously (falsely) identified as common with
'lib'.

The obvious fix would be to make sure we've actually terminated just after
directory separators and rewind a character if we haven't. In the above
example, we would end up rewinding to /tmp/ and subsequently doing the right
thing.

Test case added.

PR: 235330 [1]
MFC after: 1 week

5 years agoDocument the instance context pointer.
cy [Thu, 31 Jan 2019 04:16:52 +0000 (04:16 +0000)]
Document the instance context pointer.

MFC after: 3 days

5 years agolibc/tests: Add test case for jemalloc/libthr bug fixed in r343566
kevans [Thu, 31 Jan 2019 02:49:24 +0000 (02:49 +0000)]
libc/tests: Add test case for jemalloc/libthr bug fixed in r343566

Submitted by: Andrew Gierth (original reproducer; kevans massaged for atf)
Reviewed by: kib
MFC after: 2 weeks
X-MFC-with: r343566 (or after)
Differential Revision: https://reviews.freebsd.org/D19027

5 years agoAdd RDMA (iWARP and RoCEv1) support
davidcs [Thu, 31 Jan 2019 00:09:38 +0000 (00:09 +0000)]
Add RDMA (iWARP and RoCEv1) support

David Somayajulu (davidcs): Overall RDMA Driver infrastructure and iWARP
Anand Khoje (akhoje@marvell.com): RoCEv1 verbs implementation

MFC after:5 days

5 years agoreadelf: fix i386 build
emaste [Wed, 30 Jan 2019 21:46:12 +0000 (21:46 +0000)]
readelf: fix i386 build

Use %jx and (uintmax_t) cast.

PR: 232983
MFC with: r343592
Sponsored by: The FreeBSD Foundation

5 years agoreadelf: decode flag bits in DT_FLAGS/DT_FLAGS_1
emaste [Wed, 30 Jan 2019 20:44:51 +0000 (20:44 +0000)]
readelf: decode flag bits in DT_FLAGS/DT_FLAGS_1

Decode d_val when the tag is DT_FLAGS or DT_FLAGS_1 based on the
information at:

https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-42444.html

PR: 232983
Submitted by: Bora Ozarslan borako.ozarslan@gmail.com
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18784

5 years agoDo not obtain an already held read lock. This causes a witness panic when
cy [Wed, 30 Jan 2019 20:23:16 +0000 (20:23 +0000)]
Do not obtain an already held read lock. This causes a witness panic when
ipfs is invoked. This is the second of two panics resolving PR 235110.

PR: 235110
Reported by: David.Boyd49@twc.com
MFC after: 2 weeks

5 years agoWhen copying a NAT rule struct to userland for save by ipfs, use the
cy [Wed, 30 Jan 2019 20:22:33 +0000 (20:22 +0000)]
When copying a NAT rule struct to userland for save by ipfs, use the
length of the struct in memmove() rather than an unintialized variable.
This fixes the first of two kernel page faults when ipfs is invoked.

PR: 235110
Reported by: David.Boyd49@twc.com
MFC after: 2 weeks

5 years agofreebsd-update: regenerate man page database after update
emaste [Wed, 30 Jan 2019 19:19:14 +0000 (19:19 +0000)]
freebsd-update: regenerate man page database after update

These are currently not reproducible because they're built by the
makewhatis on the freebsd-update build host, not the one in the tree.
Regenerate after update, and later we can avoid including it in
freebsd-update data.

PR: 214545, 217389
Reviewed by: delphij
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10482

5 years agoRemove stale now comment, forgotten in r343582.
mav [Wed, 30 Jan 2019 18:56:45 +0000 (18:56 +0000)]
Remove stale now comment, forgotten in r343582.

MFC after: 2 weeks

5 years agoAdd a simple port filter to SIFTR.
brooks [Wed, 30 Jan 2019 17:44:30 +0000 (17:44 +0000)]
Add a simple port filter to SIFTR.

SIFTR does not allow any kind of filtering, but captures every packet
processed by the TCP stack.
Often, only a specific session or service is of interest, and doing the
filtering in post-processing of the log adds to the overhead of SIFTR.

This adds a new sysctl net.inet.siftr.port_filter. When set to zero, all
packets get captured as previously. If set to any other value, only
packets where either the source or the destination ports match, are
captured in the log file.

Submitted by: Richard Scheffenegger
Reviewed by: Cheng Cui
Differential Revision: https://reviews.freebsd.org/D18897

5 years agoRemove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.
mav [Wed, 30 Jan 2019 17:39:44 +0000 (17:39 +0000)]
Remove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.

In all cases where ZFS sends BIO_FLUSH, it first waits for all related
writes to complete, so its BIO_FLUSH does not care about strict ordering.
Removal of one makes life much easier at least for NVMe driver, which
hardware has no concept of request ordering, relying completely on software.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoOnly sort requests of types that have concept of offset.
mav [Wed, 30 Jan 2019 17:24:50 +0000 (17:24 +0000)]
Only sort requests of types that have concept of offset.

Other types, such as BIO_FLUSH or BIO_ZONE, or especially new/unknown ones,
may imply some degree of ordering even if strict ordering is not requested
explicitly.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoExport vendor specific USB MIDI device list to PnP info.
hselasky [Wed, 30 Jan 2019 17:11:08 +0000 (17:11 +0000)]
Export vendor specific USB MIDI device list to PnP info.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoRemove unecessary "All rights reserved" from files under my or Panasas's
rpokala [Wed, 30 Jan 2019 16:55:00 +0000 (16:55 +0000)]
Remove unecessary "All rights reserved" from files under my or Panasas's
copyright.

When all member nations of the Buenos Aires Convention adopted the Berne
Convention, the phrase "All rights reserved" became unnecessary to assert
copyright. Remove it from files under my or Panasas's copyright. The files
related to jedec_dimm(4) also bear avg@'s copyright; he has approved this
change.

Approved by: avg
Sponsored by: Panasas

5 years agoRelax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.
mav [Wed, 30 Jan 2019 16:50:53 +0000 (16:50 +0000)]
Relax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.

r212160 tightened this from always using MSG_SIMPLE_Q_TAG to always
MSG_ORDERED_Q_TAG.  Since it also marked all BIO_FLUSH requests with
BIO_ORDERED, this commit changes nothing immediately, but it returns
BIO_FLUSH callers ability to actually specify ordering they really
need, alike to other request types.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoRemove duplicate declarations.
kib [Wed, 30 Jan 2019 16:29:15 +0000 (16:29 +0000)]
Remove duplicate declarations.

Submitted by: bde
MFC after: 2 months

5 years agoRename rtld-elf/malloc.c to rtld-elf/rtld_malloc.c.
kib [Wed, 30 Jan 2019 16:28:27 +0000 (16:28 +0000)]
Rename rtld-elf/malloc.c to rtld-elf/rtld_malloc.c.

Then malloc.c file name is too generic to use it for libthr.a.

Sponsored by: The FreeBSD Foundation
MFC after: 13 days

5 years agonetmap: fix lock order reversal related to kqueue usage
vmaffione [Wed, 30 Jan 2019 15:51:55 +0000 (15:51 +0000)]
netmap: fix lock order reversal related to kqueue usage

When using poll(), select() or kevent() on netmap file descriptors,
netmap executes the equivalent of NIOCTXSYNC and NIOCRXSYNC commands,
before collecting the events that are ready. In other words, the
poll/kevent callback has side effects. This is done to avoid the
overhead of two system call per iteration (e.g., poll() + ioctl(NIOC*XSYNC)).

When the kqueue subsystem invokes the kqueue(9) f_event callback
(netmap_knrw), it holds the lock of the struct knlist object associated
to the netmap port (the lock is provided at initialization, by calling
knlist_init_mtx).
However, netmap_knrw() may need to wake up another netmap port (or even
the same one), which means that it may need to call knote().
Since knote() needs the lock of the struct knlist object associated to
the to-be-wake-up netmap port, it is possible to have a lock order reversal
problem (AB/BA deadlock).

This change prevents the deadlock by executing the knote() call in a
per-selinfo taskqueue, where it is possible to hold a mutex.

Reviewed by: aleksandr.fedorov_itglobal.com
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18956

5 years ago- Stop iflib(4) from leaking MSI messages on detachment by calling
marius [Wed, 30 Jan 2019 13:21:26 +0000 (13:21 +0000)]
- Stop iflib(4) from leaking MSI messages on detachment by calling
  bus_teardown_intr(9) before pci_release_msi(9).
- Ensure that iflib(4) and associated drivers pass correct RIDs to
  bus_release_resource(9) by obtaining the RIDs via rman_get_rid(9)
  on the corresponding resources instead of using the RIDs initially
  passed to bus_alloc_resource_any(9) as the latter function may
  change those RIDs. Solely em(4) for the ioport resource (but not
  others) and bnxt(4) were using the correct RIDs by caching the ones
  returned by bus_alloc_resource_any(9).
- Change the logic of iflib_msix_init() around to only map the MSI-X
  BAR if MSI-X is actually supported, i. e. pci_msix_count(9) returns
  > 0. Otherwise the "Unable to map MSIX table " message triggers for
  devices that simply don't support MSI-X and the user may think that
  something is wrong while in fact everything works as expected.
- Put some (mostly redundant) debug messages emitted by iflib(4)
  and em(4) during attachment under bootverbose. The non-verbose
  output of em(4) seen during attachment now is close to the one
  prior to the conversion to iflib(4).
- Replace various variants of spelling "MSI-X" (several in messages)
  with "MSI-X" as used in the PCI specifications.
- Remove some trailing whitespace from messages emitted by iflib(4)
  and change them to consistently start with uppercase.
- Remove some obsolete comments about releasing interrupts from
  drivers and correct a few others.

Reviewed by: erj, Jacob Keller, shurd
Differential Revision: https://reviews.freebsd.org/D18980

5 years agorsu(4): add support for ifconfig(8) 'maxretry' option.
avos [Wed, 30 Jan 2019 13:19:05 +0000 (13:19 +0000)]
rsu(4): add support for ifconfig(8) 'maxretry' option.

Tested with Asus USB-N10, STA mode; maxretry 0 / 1 / 6 / 12
Checked with RTL8188EE, MONITOR mode.

MFC after: 1 week

5 years agondiscvt(8): abort if no IDs were found during conversion.
avos [Wed, 30 Jan 2019 12:32:47 +0000 (12:32 +0000)]
ndiscvt(8): abort if no IDs were found during conversion.

Checked with Broadcom driver mentioned in PR 179285.

PR: 69268
Submitted by: <darius@dons.net.au>
MFC after: 5 days

5 years agoFix compilation with 'option NDISAPI + device ndis' and
avos [Wed, 30 Jan 2019 11:40:12 +0000 (11:40 +0000)]
Fix compilation with 'option NDISAPI + device ndis' and
without 'device pccard' in the kernel config file.

PR: 171532
Reported by: Robert Bonomi <bonomi@host128.r-bonomi.com>
MFC after: 1 week

5 years agoxen: introduce a new way to setup event channel upcall
royger [Wed, 30 Jan 2019 11:34:52 +0000 (11:34 +0000)]
xen: introduce a new way to setup event channel upcall

The main differences with the currently implemented method are:

 - Requires a local APIC EOI, since it doesn't bypass the local APIC
   as the previous method used to do.
 - Can be set to use different IDT vectors on each vCPU. Note that
   FreeBSD doesn't make use of this feature since the event channel
   IDT vector is reserved system wide.

Note that the old method of setting the event channel upcall is
not removed, and will be used as a fallback if this newly introduced
method is not available.

MFC after: 1 month
Sponsored by: Citrix Systems R&D

5 years agoAdd support for Audio Sink and Audio Source profiles to sdpd(8).
hselasky [Wed, 30 Jan 2019 09:44:54 +0000 (09:44 +0000)]
Add support for Audio Sink and Audio Source profiles to sdpd(8).

This allows user-space programs like virtual_oss(8) to act
as a Bluetooth speaker device.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agocxgbe/iw_cxgbe: Fix an address calculation in the memory registration code that
np [Wed, 30 Jan 2019 05:39:47 +0000 (05:39 +0000)]
cxgbe/iw_cxgbe: Fix an address calculation in the memory registration code that
was added in r342266.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

5 years agoi386: Merge PAE and non-PAE pmaps into same kernel.
kib [Wed, 30 Jan 2019 02:07:13 +0000 (02:07 +0000)]
i386: Merge PAE and non-PAE pmaps into same kernel.

Effectively all i386 kernels now have two pmaps compiled in: one
managing PAE pagetables, and another non-PAE. The implementation is
selected at cold time depending on the CPU features. The vm_paddr_t is
always 64bit now. As result, nx bit can be used on all capable CPUs.

Option PAE only affects the bus_addr_t: it is still 32bit for non-PAE
configs, for drivers compatibility. Kernel layout, esp. max kernel
address, low memory PDEs and max user address (same as trampoline
start) are now same for PAE and for non-PAE regardless of the type of
page tables used.

Non-PAE kernel (when using PAE pagetables) can handle physical memory
up to 24G now, larger memory requires re-tuning the KVA consumers and
instead the code caps the maximum at 24G. Unfortunately, a lot of
drivers do not use busdma(9) properly so by default even 4G barrier is
not easy. There are two tunables added: hw.above4g_allow and
hw.above24g_allow, the first one is kept enabled for now to evaluate
the status on HEAD, second is only for dev use.

i386 now creates three freelists if there is any memory above 4G, to
allow proper bounce pages allocation. Also, VM_KMEM_SIZE_SCALE changed
from 3 to 1.

The PAE_TABLES kernel config option is retired.

In collaboarion with: pho
Discussed with: emaste
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18894

5 years agoUntangle jemalloc and mutexes initialization.
kib [Tue, 29 Jan 2019 22:46:44 +0000 (22:46 +0000)]
Untangle jemalloc and mutexes initialization.

The need to use libc malloc(3) from some places in libthr always
caused issues.  For instance, per-thread key allocation was switched to
use plain mmap(2) to get storage, because some third party mallocs
used keys for implementation of calloc(3).

Even more important, libthr calls calloc(3) during initialization of
pthread mutexes, and jemalloc uses pthread mutexes.  Jemalloc provides
some way to both postpone the initialization, and to make
initialization to use specialized allocator, but this is very fragile
and often breaks.  See the referenced PR for another example.

Add the small malloc implementation used by rtld, to libthr. Use it in
thr_spec.c and for mutexes initialization. This avoids the issues with
mutual dependencies between malloc and libthr in principle.  The
drawback is that some more allocations are not interceptable for
alternate malloc implementations.  There should be not too much memory
use from this allocator, and the alternative, direct use of mmap(2) is
obviously worse.

PR: 235211
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18988

5 years agoAdd header file missed in r343564.
kib [Tue, 29 Jan 2019 22:45:24 +0000 (22:45 +0000)]
Add header file missed in r343564.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18988

5 years agoAdjust posix symbols from rtld-elf/malloc.c with the __crt_ prefix.
kib [Tue, 29 Jan 2019 22:40:42 +0000 (22:40 +0000)]
Adjust posix symbols from rtld-elf/malloc.c with the __crt_ prefix.

This allows to reuse the allocator in other environments that get
malloc(3) and related functions from libc or interposer.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18988

5 years agoFix GCC build, failed due to false integer overflow in r343562.
mav [Tue, 29 Jan 2019 20:50:29 +0000 (20:50 +0000)]
Fix GCC build, failed due to false integer overflow in r343562.

MFC after: 2 weeks

5 years agoReimplement BIO_ORDERED handling in nvd(4).
mav [Tue, 29 Jan 2019 20:35:09 +0000 (20:35 +0000)]
Reimplement BIO_ORDERED handling in nvd(4).

This fixes BIO_ORDERED semantics while also improving performance by:
 - sleeping also before BIO_ORDERED bio, as defined, not only after;
 - not queueing BIO_ORDERED bio to taskqueue if no other bios running;
 - waking up sleeping taskqueue explicitly rather then rely on polling.

On Samsung SSD 970 PRO this shows sync write latency, measured with
`diskinfo -wS`, reduction from ~2ms to ~1.1ms by not sleeping without
reason till next HZ tick.

On the same device ZFS pool with 8 ZVOLs synchronously writing 4KB blocks
shows ~950 IOPS instead of ~750 IOPS before.  I suspect ZFS does not need
BIO_ORDERED on BIO_FLUSH at all, but that will be next question.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoFollow arm[32] and sparc64 KAPI and provide the FreeBSD standard spelling
obrien [Tue, 29 Jan 2019 20:10:27 +0000 (20:10 +0000)]
Follow arm[32] and sparc64 KAPI and provide the FreeBSD standard spelling
across all architectures for this header.

Reviewed by: stevek
Obtained from: Juniper Networks

5 years agocalendar(1): Fix Aschermittwoch date for Austrian calendar
gonzo [Tue, 29 Jan 2019 19:54:37 +0000 (19:54 +0000)]
calendar(1): Fix Aschermittwoch date for Austrian calendar

PR: 165516
Submitted by: jhs@berklix.com
MFC after: 1 week

5 years agovtnet: fix typo in vtnet_free_taskqueues
vmaffione [Tue, 29 Jan 2019 14:31:41 +0000 (14:31 +0000)]
vtnet: fix typo in vtnet_free_taskqueues

Because of a typo, the code was mistakenly resetting the
vtnrx_vq pointer rather than vtntx_tq.

Reviewed by: bryanv
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D19015

5 years agoFix the bug introduced in r342908, that causes problems with dynamic
ae [Tue, 29 Jan 2019 11:18:41 +0000 (11:18 +0000)]
Fix the bug introduced in r342908, that causes problems with dynamic
handling for protocols without ports numbers.

Since port numbers were uninitialized for protocols like ICMP/ICMPv6,
ipfw_chk() used some non-zero values to create dynamic states, and due
this it failed to match replies with created states.

Reported by: Oliver Hartmann, Boris Lytochkin
Obtained from: Yandex LLC
X-MFC after: r342908

5 years agoExtract the coverage sanitizer KPI to a new file.
andrew [Tue, 29 Jan 2019 11:04:17 +0000 (11:04 +0000)]
Extract the coverage sanitizer KPI to a new file.

This will allow multiple consumers of the coverage data to be compiled
into the kernel together. The only requirement is only one can be
registered at a given point in time, however it is expected they will
only register when the coverage data is needed.

A new kernel conflig option COVERAGE is added. This will allow kcov to
become a module that can be loaded as needed, or compiled into the
kernel.

While here clean up the #include style a little.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18955

5 years agonetmap: add notifications on kloop stop
vmaffione [Tue, 29 Jan 2019 10:28:50 +0000 (10:28 +0000)]
netmap: add notifications on kloop stop

On sync-kloop stop, send a wake-up signal to the kloop, so that
waiting for the timeout is not needed.
Also, improve logging in netmap_freebsd.c.

MFC after: 3 days

5 years agoAllow dashes as a valid character in UFS labels.
marck [Tue, 29 Jan 2019 10:21:41 +0000 (10:21 +0000)]
Allow dashes as a valid character in UFS labels.

Reviewed by: mckusick, imp, 0mp
MFC after: 2 weeks
Differential Revision: D18991

5 years agoUpdate pci_vendors to 2019.01.29
bapt [Tue, 29 Jan 2019 08:07:14 +0000 (08:07 +0000)]
Update pci_vendors to 2019.01.29

MFC after: 2 days

5 years agobectl(8) test: Force destroy the zpool in cleanup
kevans [Tue, 29 Jan 2019 04:08:49 +0000 (04:08 +0000)]
bectl(8) test: Force destroy the zpool in cleanup

This is a wild guess as to why bectl tests failed once upon a time in CI,
given no apparent way to see a transcript of cleanup routines with Kyua. The
bectl tests construct a new, clean zpool for every test. The failure
indicated was because of a mount that was leftover from a previous test, but
the previous test had succeeded so it's not clear how the mount remained
leftover unless the `zpool get health ${pool}` had somehow failed.

MFC after: 1 week

5 years agoupgt(4): unbreak build with UPGT_DEBUG
avos [Tue, 29 Jan 2019 03:31:36 +0000 (03:31 +0000)]
upgt(4): unbreak build with UPGT_DEBUG

MFC after: 1 week

5 years agoDrop some unneeded includes from wireless USB drivers.
avos [Tue, 29 Jan 2019 03:28:47 +0000 (03:28 +0000)]
Drop some unneeded includes from wireless USB drivers.

MFC after: 1 week

5 years agocxgbe(4): Add adapter information to messages logged by the OS-agnostic
np [Tue, 29 Jan 2019 00:49:12 +0000 (00:49 +0000)]
cxgbe(4): Add adapter information to messages logged by the OS-agnostic
code in t4_hw.c.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoThis bug was introduced with the change to use softdep_bp_to_mp() in
mckusick [Mon, 28 Jan 2019 21:36:45 +0000 (21:36 +0000)]
This bug was introduced with the change to use softdep_bp_to_mp() in
January 2018 changes -r327723 and -r327821. The softdep_bp_to_mp()
function failed to include VFIFO as one of the valid cases.

Although fifo's do not allocate blocks in the filesystem, they will
allocate blocks if they use extended attributes (such as ACLs). Thus,
softdep_bp_to_mp() needs to return a non-NULL mount pointer when
presented with a fifo vnode so that the soft updates write complete
will properly process the soft updates structures associated with the
extended attribute blocks. It was the failure to process these soft
updates structures, thus leaving them hanging off the buffer, which
lead to the "panic: softdep_deallocate_dependencies: dangling deps"
when trying to clean up the buffer after it was written.

PR:           230962
Reported by:  2t8mr7kx9f@protonmail.com
Reviewed by:  kib
Tested by:    Peter Holm
MFC after:    1 week
Sponsored by: Netflix

5 years agoSpeed up non-status operations applied to a single interface
pkelsey [Mon, 28 Jan 2019 20:30:04 +0000 (20:30 +0000)]
Speed up non-status operations applied to a single interface

When performing a non-status operation on a single interface, it is
not necessary for ifconfig to build a list of all addresses in the
system, sort them, then iterate through them looking for the entry for
the single interface of interest. Doing so becomes increasingly
expensive as the number of interfaces in the system grows (e.g., in a
system with 1000+ vlan(4) interfaces).

Reviewed by: ae, kp
MFC after: 1 week
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18919

5 years agoDon't re-evaluate ALTQ kernel configuration due to events on non-ALTQ interfaces
pkelsey [Mon, 28 Jan 2019 20:26:09 +0000 (20:26 +0000)]
Don't re-evaluate ALTQ kernel configuration due to events on non-ALTQ interfaces

Re-evaluating the ALTQ kernel configuration can be expensive,
particularly when there are a large number (hundreds or thousands) of
queues, and is wholly unnecessary in response to events on interfaces
that do not support ALTQ as such interfaces cannot be part of an ALTQ
configuration.

Reviewed by: kp
MFC after: 1 week
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18918

5 years ago[usb] Add UQ_KBD_BOOTPROTO quirk for Corsair K68 keyboard
gonzo [Mon, 28 Jan 2019 20:22:17 +0000 (20:22 +0000)]
[usb] Add UQ_KBD_BOOTPROTO quirk for Corsair K68 keyboard

PR: 222114
Submitted by: Zane C. Bowers-Hadley <vvelox@vvelox.net>
MFC after: 1 week

5 years agoA few corrections and clarifications to r343406.
bcr [Mon, 28 Jan 2019 19:54:58 +0000 (19:54 +0000)]
A few corrections and clarifications to r343406.

- Use "in" instead of "on" when referring to directory and UFS partition.
- Switch from hw.physmem to hw.realmem and add a description to
distinguish the two.
- Explain why the "df" command is having trouble displaying ZFS sizes
correctly. Add a bit more descriptive text to help why the output of
"zfs list -o space" should be used.
- Switch to vmstat instead of iostat display for systat(1) as it shows
more information on one screen. Describe what is displayed based on the
text of the man page. Change the list of the other values accordingly.
- Sort the flags to "zfs destroy" alphabetically.

Reviewed by: rgrimes
Approved by: rgrimes
MFC after: 8 days
Differential Revision: https://reviews.freebsd.org/D18993

5 years agoifconfig: fix endianness bug displaying pfsync interfaces
asomers [Mon, 28 Jan 2019 18:34:04 +0000 (18:34 +0000)]
ifconfig: fix endianness bug displaying pfsync interfaces

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19005

5 years agoRemove a redundant test.
markj [Mon, 28 Jan 2019 16:23:56 +0000 (16:23 +0000)]
Remove a redundant test.

The existence of a PV entry for a mapping guarantees that the mapping
exists, so we should not need to test for that.

Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18866

5 years agoFix the detection of ECN-setup SYN-ACK packets.
tuexen [Mon, 28 Jan 2019 12:45:31 +0000 (12:45 +0000)]
Fix the detection of ECN-setup SYN-ACK packets.

RFC 3168 defines an ECN-setup SYN-ACK packet as on with the ECE flags
set and the CWR flags not set. The code was only checking if ECE flag
is set. This patch adds the check to verify that the CWR flags is not
set.

Submitted by: Richard Scheffenegger
Reviewed by: tuexen@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18996

5 years agorsu(4): do not ignore mgmtrate / mcastrate / ucastrate.
avos [Mon, 28 Jan 2019 11:39:54 +0000 (11:39 +0000)]
rsu(4): do not ignore mgmtrate / mcastrate / ucastrate.

Enforce net80211 rates for control / management / multicast / EAPOL frames
and allow to override rate for unicast frames via ifconfig(8) 'ucastrate'
option; by default it still uses f/w rate adaptation for unicast frames.

MFC after: 1 week

5 years agopfctl: Point users to net.pf.request_maxcount if large requests are rejected
kp [Mon, 28 Jan 2019 08:36:10 +0000 (08:36 +0000)]
pfctl: Point users to net.pf.request_maxcount if large requests are rejected

The kernel will reject very large tables to avoid resource exhaustion
attacks. Some users run into this limit with legitimate table
configurations.

The error message in this case was not very clear:

    pf.conf:1: cannot define table nets: Invalid argument
    pfctl: Syntax error in config file: pf rules not loaded

If a table definition fails we now check the request_maxcount sysctl,
and if we've tried to create more than that point the user at
net.pf.request_maxcount:

    pf.conf:1: cannot define table nets: too many elements.
    Consider increasing net.pf.request_maxcount.
    pfctl: Syntax error in config file: pf rules not loaded

PR: 235076
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18909

5 years agortwn_usb(4): add new USB id.
avos [Mon, 28 Jan 2019 02:15:41 +0000 (02:15 +0000)]
rtwn_usb(4): add new USB id.

Submitted by: <yklaxds@gmail.com>
Github issue: https://github.com/s3erios/rtwn/issues/4
MFC after: 5 days

5 years agoFix whiteout support in find(1)
gonzo [Mon, 28 Jan 2019 02:00:39 +0000 (02:00 +0000)]
Fix whiteout support in find(1)

find(1) ignores -type w passed to it. With this patch find(1) properly
identifies and prints whiteouts.

PR: 126384, 156703
Submitted by: oleg@mamontov.net
MFC after: 1 week

5 years agoRemove RADIUS-related files when WITHOUT_RADIUS_SUPPORT=true is set
avos [Sun, 27 Jan 2019 18:53:36 +0000 (18:53 +0000)]
Remove RADIUS-related files when WITHOUT_RADIUS_SUPPORT=true is set
in src.conf(5)

PR: 234041
MFC after: 5 days

5 years agoAdd NO_6_BYTE / NO_SYNC_CACHE quirks for (C|D|E).* Olympus digital cameras
avos [Sun, 27 Jan 2019 17:51:49 +0000 (17:51 +0000)]
Add NO_6_BYTE / NO_SYNC_CACHE quirks for (C|D|E).* Olympus digital cameras

PR: 97472
Submitted by: Fabio Luis Girardi <papelhigienico@gmail.com>
Reviewed by: imp
MFC after: 3 weeks

5 years agom_getm2: correct a comment.
avos [Sun, 27 Jan 2019 16:44:27 +0000 (16:44 +0000)]
m_getm2: correct a comment.

The comment states that function always return a top of allocated mbuf;
however, the function actually return the overall mbuf chain top pointer.

Since there are already existing users of it (via m_getm(4) macro),
rephrase the comment and leave behavior unchanged.

PR: 134335
MFC after: 12 days

5 years agorc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used
avos [Sun, 27 Jan 2019 15:55:31 +0000 (15:55 +0000)]
rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used

They will stop it automatically ('Interface wlan0 is down,
dhclient exiting'); use /etc/rc.d/dhclient stop command only when
none of them is used.

MFC after: 5 days

5 years agoProperly define and declare phynode_topo_lock,
mmel [Sun, 27 Jan 2019 15:50:36 +0000 (15:50 +0000)]
Properly define and declare phynode_topo_lock,
it should be single global variable.

X-MFC with: r340845
Noticed by: phynode_topo_lock

5 years agodevd.conf(5): simplify regex
avos [Sun, 27 Jan 2019 15:29:58 +0000 (15:29 +0000)]
devd.conf(5): simplify regex

Submitted by: Helge Oldach <freebsd@oldach.net>
MFC after: 5 days

5 years agopcf(4): fix parentheses in if condition
avos [Sun, 27 Jan 2019 15:19:28 +0000 (15:19 +0000)]
pcf(4): fix parentheses in if condition

PR: 210709
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 5 days

5 years agowlan.4: improve wording
avos [Sun, 27 Jan 2019 15:10:20 +0000 (15:10 +0000)]
wlan.4: improve wording

PR: 218075
Submitted by: Aaron Taylor <halfnote1004@gmail.com>
MFC after: 5 days

5 years agoFix a typo.
cy [Sun, 27 Jan 2019 02:31:42 +0000 (02:31 +0000)]
Fix a typo.

MFC after: 3 days

5 years agoBump SPECNAMELEN to MAXNAMLEN.
kib [Sun, 27 Jan 2019 00:46:06 +0000 (00:46 +0000)]
Bump SPECNAMELEN to MAXNAMLEN.

This includes the bump for cdevsw d_version.  Otherwise, the impact on
the ABI (not KBI) is surprisingly low.  The most important affected
interface is devname(3) and ttyname(3) which already correctly handle
long names (and ttyname(3) should not be affected at all).

Still, due to the d_version bump, I argue that the change is not MFC-able.

Requested by: mmacy
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18932

5 years agoRemove now redundand ifunc relocation code which should have been
kib [Sun, 27 Jan 2019 00:37:52 +0000 (00:37 +0000)]
Remove now redundand ifunc relocation code which should have been
removed as part of r341441.

This call to reloc_non_plt() may crash if ifunc resolvers use the
needed libraries symbols since the pass over the needed libs
relocation is not yet done.  The change in r341441 ensures the right
relocation order otherwise.

Submitted by: theraven
MFC after: 1 week
Discussed in: https://reviews.freebsd.org/D17529

5 years agoUpdate tunefs and newfs error messages for the -L (volume label) option
mckusick [Sat, 26 Jan 2019 22:27:12 +0000 (22:27 +0000)]
Update tunefs and newfs error messages for the -L (volume label) option
to note that underscores are valid.

PR:           235182
Reported by:  Rodney W. Grimes (rgrimes@)
Sponsored by: Netflix

5 years agoSlightly improve previous commit that silenced a Clang Scan warning.
se [Sat, 26 Jan 2019 22:24:15 +0000 (22:24 +0000)]
Slightly improve previous commit that silenced a Clang Scan warning.

The strdup() call does not take advantage of the known length of the
source string. Replace by malloc() and memcpy() utilizimng the pre-
calculated string length.

Submitted by: cperciva
Reported by: rgrimes
MFC after: 2 weeks

5 years ago- In _iflib_fl_refill(), don't mark an RX buffer as available in the
marius [Sat, 26 Jan 2019 21:35:51 +0000 (21:35 +0000)]
- In _iflib_fl_refill(), don't mark an RX buffer as available in the
  corresponding bitmap before adding an mbuf has actually succeeded.
  Previously, m_gethdr(M_NOWAIT, ...) failing caused a "hole" in the
  RX ring but not in its bitmap. One implication of such a hole was
  that in a subsequent call to _iflib_fl_refill() with the RX buffer
  accounting still indicating another reclaimable buffer, bit_ffc(3)
  nevertheless returned -1 in frag_idx which in turn caused havoc
  when used as an index. Thus, additionally assert that frag_idx is
  0 or greater.
  Another possible consequence of a hole in the RX ring was a NULL-
  dereference when trying to use the unallocated mbuf, for example
  in iflib_rxd_pkt_get().

  While at it, make the variable declarations in _iflib_fl_refill()
  conform to style(9) and remove redundant checks already performed
  by bit_ffc{,_at}(3).

- In iflib_queues_alloc(), don't pass redundant M_ZERO to bit_alloc(3).

Reported and tested by: pho

5 years agoSilence Clang Scan warning about potentially unsafe use of strcpy.
se [Sat, 26 Jan 2019 21:30:26 +0000 (21:30 +0000)]
Silence Clang Scan warning about potentially unsafe use of strcpy.

While this is a false positive, the use of strdup() simplifies the code.

MFC after: 2 weeks

5 years agoFix potential buffer overflow and undefined behavior.
se [Sat, 26 Jan 2019 20:43:28 +0000 (20:43 +0000)]
Fix potential buffer overflow and undefined behavior.

The buffer allocated in read_chat() could be 1 element too short, if the
chatstr parameter passed in is 1 or 3 charachters long (e.g. "a" or "a b").
The allocation of the pointer array does not account for the terminating
NULL pointer in that case.

Overlapping source and destination strings are undefined in strcpy().
Instead of moving a string to the left by one character just increment the
char pointer before it is assigned to the results array.

MFC after: 2 weeks

5 years agoCatch up with some years of driver development.
netchild [Sat, 26 Jan 2019 18:23:19 +0000 (18:23 +0000)]
Catch up with some years of driver development.
Most impressive in terms of doxygen stuff are the isci and
ocs_fc drivers.

5 years agoFix logic errors in iwm_pcie_load_firmware_chunk introduced in r314065.
bz [Sat, 26 Jan 2019 17:52:12 +0000 (17:52 +0000)]
Fix logic errors in iwm_pcie_load_firmware_chunk introduced in r314065.

 * There's no reason to have a while() loop here, because:
    - if msleep returns 0, that means we were woken up by the interrupt handler,
      and we are going to exit immediately as sc_fw_chunk_done will now be 1
      (there is nothing else that sleeps on sc_fw.)
    - if msleep doesn't return 0 (i.e. it returned ETIMEDOUT) then we will
      exit immediately because of the if-test.
   So, just use a single msleep() and then check sc_fw_chunk_done as before.
 * The comment said we were sleeping for 5 seconds, but the msleep was only
   for 1. Before r314065, this was 1 second and so was the comment,
   and in that commit the comment was changed and the function call wasn't.

Possibly fixes failures to initialize uCode on certain devices.

Submitted by: Augustin Cavalier (waddlesplash gmail.com)
Obtained from: Haiku 132990ecdcb072f2ce597b5d497ff3e5b1f09c20
MFC after: 10 days

5 years agoObsoleteFiles.inc: remove adv(4) / adw(4) man pages after r339567
avos [Sat, 26 Jan 2019 17:27:12 +0000 (17:27 +0000)]
ObsoleteFiles.inc: remove adv(4) / adw(4) man pages after r339567