]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoAdd support for interrupts, sensors and GPIO for AXP209 PMIC.
manu [Thu, 26 May 2016 21:09:07 +0000 (21:09 +0000)]
Add support for interrupts, sensors and GPIO for AXP209 PMIC.
Pressing the PEK (power enable key) will shutdown the board.
Some events are reported to devd via system "PMU" and subsystem
"Battery", "AC" and "USB" such as connected/disconnected.
Some sensors values (power source voltage/current) are reported via
sysctl (dev.axp209_pmu.X.)
It also expose a gpioc node usable in kernel and userland. Only 3 of
the 4 GPIO are exposed (The GPIO3 is different and mostly unused on
boards). Most popular boards uses GPIO1 as a sense pin for OTG power.
Add a dtsi file that adds gpio-controller capability to the device as
upstream doesn't defined it and include it in our custom DTS.

Reviewed by: jmcneill
Approved by: cognet (mentor)
Differential Revision: https://reviews.freebsd.org/D6135

8 years agoRemove vestigial cloudware-install bits missed in r300767.
gjb [Thu, 26 May 2016 21:08:44 +0000 (21:08 +0000)]
Remove vestigial cloudware-install bits missed in r300767.

Sponsored by: The FreeBSD Foundation

8 years agoLet l64a() properly null terminate its result.
ed [Thu, 26 May 2016 20:55:15 +0000 (20:55 +0000)]
Let l64a() properly null terminate its result.

Though the buffer used by l64a() is initialized with null bytes,
repetetive calls may end up having trailing garbage of previous
invocations because we don't end up terminating the string.

Instead of importing NetBSD's fix, use this opportunity to simplify this
function dramatically, for example by just storing the Base64 character
set in a string. There is also no need to do the bitmasking, as we can
just use the proper integer type from <stdint.h>.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D6511

8 years agoIfndef KERNEL the userspace-only routines in sys/md[45].h
cem [Thu, 26 May 2016 20:37:49 +0000 (20:37 +0000)]
Ifndef KERNEL the userspace-only routines in sys/md[45].h

A follow-up to r300773.  Nothing in the kernel uses those definitions, but
apparently libmd includes the sys/md45 headers.  Fix the build.

Reported by: gjb
Pointy-hat: cem
Sponsored by: EMC / Isilon Storage Division

8 years agocrypto routines: Hint minimum buffer sizes to the compiler
cem [Thu, 26 May 2016 19:29:29 +0000 (19:29 +0000)]
crypto routines: Hint minimum buffer sizes to the compiler

Use the C99 'static' keyword to hint to the compiler IVs and output digest
sizes.  The keyword informs the compiler of the minimum valid size for a given
array.  Obviously not every pointer can be validated (i.e., the compiler can
produce false negative but not false positive reports).

No functional change.  No ABI change.

Sponsored by: EMC / Isilon Storage Division

8 years agoFix style(9).
jkim [Thu, 26 May 2016 19:17:51 +0000 (19:17 +0000)]
Fix style(9).

8 years agoUse bit_count(3) instead of four bitcount32() calls.
jkim [Thu, 26 May 2016 18:57:26 +0000 (18:57 +0000)]
Use bit_count(3) instead of four bitcount32() calls.

Reviewed by: asomers, ngie
Differential Revision: https://reviews.freebsd.org/D6543

8 years agoUpdate libc++ to 3.8.0. Excerpted list of fixes (with upstream revision
dim [Thu, 26 May 2016 18:52:49 +0000 (18:52 +0000)]
Update libc++ to 3.8.0.  Excerpted list of fixes (with upstream revision
numbers):

r242679 Implement the plugin-based version of std::search. There are no
        searchers yet; those are coming soon.
r242682 Implement the default searcher for std::experimental::search.
r243728 Add <experimental/any> v2.
r245330 implement more of N4258 - Cleaning up noexcept in the standard
        library. Specifically add new noexcept stuff to vector and
string's move-assignment operations
r245334 Fix PR22606 - Leak pthread_key with static storage duration to
        ensure all of thread-local destructors are called.
r245335 Fix PR23589: std::function doesn't recognize null pointer to
        varargs function.
r247036 Implementation of Boyer-Moore and Boyer-Moore-Horspool
        searchers for the LFTS.
r249325 Implement LWG#2063, and update the issues links to point to the
        github generated pages
r249738 Split <ctype.h> out of <cctype>.
r249739 Split <errno.h> out of <cerrno>.
r249740 Split <float.h> out of <cfloat>.
r249741 Split <inttypes.h> out of <cinttypes>.
r249742 Split <math.h> out of <cmath>.
r249743 Split <setjmp.h> out of <csetjmp>.
r249761 Split <stddef.h> out of <cstddef>.
r249798 Split <stdio.h> out of <cstdio>.
r249800 Split <stdlib.h> out of <cstdlib>.
r249889 Split <wchar.h> out of <cwchar>.
r249890 Split <wctype.h> out of <cwctype>.
r249929 Split <string.h> out of <cstring>.
r250254 ABI versioning macros for libc++.
r251246 Fix LWG#2244: basic_istream::seekg
r251247 Fix LWG#2127: Move-construction with raw_storage_iterator.
r251253 Fix LWG#2476: scoped_allocator_adaptor is not assignable
r251257 Fix LWG#2489: mem_fn() should be noexcept
r251618 Implement P0004R1 'Remove Deprecated iostreams aliases'
r251766 Implement the first part of P0006R0: Adopt Type Traits Variable
        Templates for C++17.
r252195 Implement P0092R1 for C++1z
r252350 Allow deque to handle incomplete types.
r252406 More of P0006R0: type traits variable aliases for C++17.
r252407 Implement LWG#2353: std::next is over-constrained
r252905 Implement P0074: Making owner_less more flexible
r253215 Implement P0013R1: Logical Operator Type Traits.
r253274 Implement P0007: Constant View: A proposal for a std::as_const
        helper function template.
r254119 Add static_assert to set/multiset/map/multimap/forward_list/deque
        that the allocator's value_type match the container's value_type.
r254283 Implement more of P0006; Type Traits Variable Templates.
r255941 LWG2485: get() should be overloaded for const tuple&&.
r256325 Fix LWG Issue #2367 - Fixing std::tuple and std::pair's default
        constructors.
r256652 Fix for ALL undefined behavior in <list>.
r256859 First half of LWG#2354: 'Unnecessary copying when inserting
        into maps with braced-init syntax'

Exp-run: antoine
Relnotes: yes

8 years agoOnly do the touch screen setup when the 'ti,wires' property is present.
loos [Thu, 26 May 2016 18:52:26 +0000 (18:52 +0000)]
Only do the touch screen setup when the 'ti,wires' property is present.

While here fix a typo in a debug message.

8 years agoUpdate a commented line to replace recently-removed images with
gjb [Thu, 26 May 2016 18:50:57 +0000 (18:50 +0000)]
Update a commented line to replace recently-removed images with
images that are published.

Sponsored by: The FreeBSD Foundation

8 years agoRemove the cw*-install target.
gjb [Thu, 26 May 2016 18:48:37 +0000 (18:48 +0000)]
Remove the cw*-install target.

All operations are performed on the original output file,
and nothing is ever done with the copied file (as in, no
modifications and/or publication from the copied file).

Sponsored by: The FreeBSD Foundation

8 years agoDon't reuse the source mbuf in tcp_respond() if it is not writable.
jhb [Thu, 26 May 2016 18:35:37 +0000 (18:35 +0000)]
Don't reuse the source mbuf in tcp_respond() if it is not writable.

Not all mbufs passed up from device drivers are M_WRITABLE().  In
particular, the Chelsio T4/T5 driver uses a feature called "buffer packing"
to receive multiple frames in a single receive buffer.  The mbufs for
these frames all share the same external storage so are treated as
read-only by the rest of the stack when multiple frames are in flight.
Previously tcp_respond() would blindly overwrite read-only mbufs when
INVARIANTS was disabled or panic with an assertion failure if INVARIANTS
was enabled.  Note that the new case is a bit of a mix of the two other
cases in tcp_respond().  The TCP and IP headers must be copied explicitly
into the new mbuf instead of being inherited (similar to the m == NULL
case), but the addresses and ports must be swapped in the reply (similar
to the m != NULL case).

Reviewed by: glebius

8 years agoUpdate default KMODDIR in comment after r299393.
jhb [Thu, 26 May 2016 18:28:10 +0000 (18:28 +0000)]
Update default KMODDIR in comment after r299393.

Submitted by: hselasky

8 years agoDisconnect the OPENSTACK target from the CLOUDWARE list.
gjb [Thu, 26 May 2016 18:26:44 +0000 (18:26 +0000)]
Disconnect the OPENSTACK target from the CLOUDWARE list.

This was reported to not work as expected, and feedback
following the report was never received.  In addition, we
do not publish these anywhere publicly.

The configuration file is not (yet) removed, in hopes that
the remaining details on the original issues can be resolved,
and we can publish the resulting images in the future.

Sponsored by: The FreeBSD Foundation

8 years agoDisconnect the AZURE target from the CLOUDWARE list.
gjb [Thu, 26 May 2016 18:24:00 +0000 (18:24 +0000)]
Disconnect the AZURE target from the CLOUDWARE list.

Microsoft has graciously overtaken publication of FreeBSD
on Azure since 10.3-RELEASE.

Many thanks to Microsoft for their support of FreeBSD on
Azure.

The configuration file and Makefile.azure are not (yet)
planned to be removed, as they may be useful in the future.

Sponsored by: The FreeBSD Foundation

8 years ago[siba] use the generic bus methods where appropriate.
adrian [Thu, 26 May 2016 18:01:03 +0000 (18:01 +0000)]
[siba] use the generic bus methods where appropriate.

Submitted by: jhibbits
Differential Revision: https://reviews.freebsd.org/D802

8 years agoral: add missing ic_getradiocaps() assignment.
avos [Thu, 26 May 2016 17:06:43 +0000 (17:06 +0000)]
ral: add missing ic_getradiocaps() assignment.

8 years agoPrevent parallel object collapses. Both vm_object_collapse_scan() and
kib [Thu, 26 May 2016 16:59:29 +0000 (16:59 +0000)]
Prevent parallel object collapses.  Both vm_object_collapse_scan() and
swap_pager_copy() might unlock the object, which allows the parallel
collapse to execute.  Besides destroying the object, it also might
move the reference from parent to the backing object, firing the
assertion ref_count == 1.

Collapses are prevented by bumping paging_in_progress counters on both
the object and its backing object.

Reported by: cem
Tested by: pho (previous version)
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D6085

8 years agoFix a typo in a comment.
ian [Thu, 26 May 2016 16:53:50 +0000 (16:53 +0000)]
Fix a typo in a comment.

8 years agoStyle changes to some most outrageous violations in vm_object_collapse().
kib [Thu, 26 May 2016 16:51:38 +0000 (16:51 +0000)]
Style changes to some most outrageous violations in vm_object_collapse().

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agobwi: switch to ieee80211_add_channel_list_2ghz().
avos [Thu, 26 May 2016 16:48:20 +0000 (16:48 +0000)]
bwi: switch to ieee80211_add_channel_list_2ghz().

- Use device's channel list instead of default one (from
ieee80211_init_channels()); adds 12 - 14 2GHz channels.
- Add ic_getradiocaps() method.

8 years agourtwn, rtwn, rsu: switch to ieee80211_add_channel_list_2ghz().
avos [Thu, 26 May 2016 16:39:11 +0000 (16:39 +0000)]
urtwn, rtwn, rsu: switch to ieee80211_add_channel_list_2ghz().

- Use device's channel list instead of default one (from
ieee80211_init_channels()); adds 12 - 14 2GHz channels.
- Add ic_getradiocaps() method.

8 years agourtw: switch to ieee80211_add_channel_list_2ghz().
avos [Thu, 26 May 2016 16:15:10 +0000 (16:15 +0000)]
urtw: switch to ieee80211_add_channel_list_2ghz().

- Use device's channel list instead of default one (from
ieee80211_init_channels()).
- Add ic_getradiocaps() method.

8 years agoral: switch to ieee80211_add_channel_list_*()
avos [Thu, 26 May 2016 16:05:19 +0000 (16:05 +0000)]
ral: switch to ieee80211_add_channel_list_*()

- Use device's channel list instead of default one (from
ieee80211_init_channels()).
- Add ic_getradiocaps() method.

Added channels:
- 2GHz (all): 12, 13, 14.
- 5GHz:
 * rt2661: 165
 * rt2860: 38, 46, 54, 62, 102, 110, 118, 126, 134, 151, 159, 165, 167,
169, 171, 173.

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

8 years agozyd: switch to ieee80211_add_channel_list_*()
avos [Thu, 26 May 2016 15:56:27 +0000 (15:56 +0000)]
zyd: switch to ieee80211_add_channel_list_*()

- Use device's channel list instead of default one (adds 12, 13 and 14
2GHz channels).
- Add ic_getradiocaps() method.

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

8 years agoRename gpiobus_map_pin() to gpiobus_acquire_pin(), to better reflect the
ian [Thu, 26 May 2016 15:45:36 +0000 (15:45 +0000)]
Rename gpiobus_map_pin() to gpiobus_acquire_pin(), to better reflect the
fact that the caller is requesting exclusive use of the pin, and also to
better match the inverse operation which is named gpiobus_release_pin().

8 years agoural: switch to ieee80211_add_channel_list_*()
avos [Thu, 26 May 2016 15:12:54 +0000 (15:12 +0000)]
ural: switch to ieee80211_add_channel_list_*()

- Use device's channel list instead of default one (+ 12, 13 and 14
2GHz channels).
- Add ic_getradiocaps() method.

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

8 years agorun: switch to ieee80211_add_channel_list_*()
avos [Thu, 26 May 2016 15:05:37 +0000 (15:05 +0000)]
run: switch to ieee80211_add_channel_list_*()

- Use device's channel list instead of default one (from
ieee80211_init_channels()).
- Add ic_getradiocaps() method.

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

8 years agormextattr(8) man page clarifications regarding -qq
asomers [Thu, 26 May 2016 14:26:49 +0000 (14:26 +0000)]
rmextattr(8) man page clarifications regarding -qq

Reviewed by: ngie
MFC after: 6 days
X-MFC-With: 299085
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6422

8 years agoDo libxo cleanup even in case of errors.
trasz [Thu, 26 May 2016 14:21:02 +0000 (14:21 +0000)]
Do libxo cleanup even in case of errors.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoMake iscsictl(8) actually report non-zero status on errors. The "failed"
trasz [Thu, 26 May 2016 14:19:24 +0000 (14:19 +0000)]
Make iscsictl(8) actually report non-zero status on errors.  The "failed"
is negative, because the error returned from calls to ioctl(2) is negative.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agortwn: replace hardcoded rate indices with their names (similar to r289758).
avos [Thu, 26 May 2016 14:17:57 +0000 (14:17 +0000)]
rtwn: replace hardcoded rate indices with their names (similar to r289758).

- Use macros to define rate indices; don't hardcode them in code.
- Add method for 'rate' -> 'rate index' conversion
(and array for the opposite).
- Determine if rate is CCK / OFDM via appropriate macro.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D4837

8 years agoMake code compile when basename() is POSIX compliant.
ed [Thu, 26 May 2016 13:49:40 +0000 (13:49 +0000)]
Make code compile when basename() is POSIX compliant.

In addition to the previous change I made to ar.c, pull in another
basename() related fix. This change is similar to the one made to the
ELF Toolchain version of ar, with the difference that the ELF Toolchain
version lacks error handling for the strdup() call.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D6467

8 years agosfxge(4): correct parenthesis location in if coundition
arybchik [Thu, 26 May 2016 13:19:44 +0000 (13:19 +0000)]
sfxge(4): correct parenthesis location in if coundition

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agoifconfig: set by default FCC regulatory domain for wireless interfaces.
avos [Thu, 26 May 2016 13:14:08 +0000 (13:14 +0000)]
ifconfig: set by default FCC regulatory domain for wireless interfaces.

Change default regulatory domain from DEBUG (no limitations;
exposes all device channels) to FCC; as a result, newly created wireless
interface with default settings will have less chances to violate
country-specific regulations.

This change will not affect drivers with pre-initialized regdomain
structure (currentry ath(4) and mwl(4)); in that case, the default
channel list must correspond to the default regdomain / country setting.

You can switch to another regdomain / country via corresponding
ifconfig(8) options; the driver must implement ic_getradiocaps()
method to restore full channel list.

Full country / regdomain list may be obtained via
'ifconfig <iface> list countries' command.

Example: change country to Germany:
ifconfig wlan0 down # all wlans on the device must be down
ifconfig wlan0 country DE
ifconfig wlan0 up
# wpa_supplicant(8), dhclient(8) etc

At the creation time:
ifconfig wlan0 create wlandev wpi0 country DE

To make changes permanent add the following line to the rc.conf(5):
create_args_wlan0="country DE"

Tested with
 - Intel 3945BG (wpi(4)).
 - WUSB54GC (rum(4)).

Reviewed by: adrian
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D6228

8 years agoAdd a special case for iSER data tranfers.
trasz [Thu, 26 May 2016 12:43:15 +0000 (12:43 +0000)]
Add a special case for iSER data tranfers.

Obtained from: Mellanox Technologies
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agobsdinstall: unbreak static address assignment for wired networks.
avos [Thu, 26 May 2016 11:58:36 +0000 (11:58 +0000)]
bsdinstall: unbreak static address assignment for wired networks.

This fixes regression introduced in r298946 (fixes static address
assignment for wireless networks).

Reported & submitted by: allanjude

8 years agoFix crash on removal of an unconnected iSER session.
trasz [Thu, 26 May 2016 11:40:07 +0000 (11:40 +0000)]
Fix crash on removal of an unconnected iSER session.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoMake struct sctp_paddrthlds compliant to RFC 7829.
tuexen [Thu, 26 May 2016 11:38:26 +0000 (11:38 +0000)]
Make struct sctp_paddrthlds compliant to RFC 7829.

8 years agoiwn: add watchdog for scanning.
avos [Thu, 26 May 2016 11:12:36 +0000 (11:12 +0000)]
iwn: add watchdog for scanning.

Restart device if scanning was not done in time.

Tested by: david@catwhisker.org

PR: 209198
Differential Revision: https://reviews.freebsd.org/D6176

8 years agoUse optimised complexity safe sorting routine instead of the kernel's
hselasky [Thu, 26 May 2016 11:10:31 +0000 (11:10 +0000)]
Use optimised complexity safe sorting routine instead of the kernel's
"qsort()".

The kernel's "qsort()" routine can in worst case spend O(N*N) amount of
comparisons before the input array is sorted. It can also recurse a
significant amount of times using up the kernel's interrupt thread
stack.

The custom sorting routine takes advantage of that the sorting key is
only 64 bits. Based on set and cleared bits in the sorting key it
partitions the array until it is sorted. This process has a recursion
limit of 64 times, due to the number of set and cleared bits which can
occur. Compiled with -O2 the sorting routine was measured to use
64-bytes of stack. Multiplying this by 64 gives a maximum stack
consumption of 4096 bytes for AMD64. The same applies to the execution
time, that the array to be sorted will not be traversed more than 64
times.

When serving roughly 80Gb/s with 80K TCP connections, the old method
consisting of "qsort()" and "tcp_lro_mbuf_compare_header()" used 1.4%
CPU, while the new "tcp_lro_sort()" used 1.1% for LRO related sorting
as measured by Intel Vtune. The testing was done using a sysctl to
toggle between "qsort()" and "tcp_lro_sort()".

Differential Revision: https://reviews.freebsd.org/D6472
Sponsored by: Mellanox Technologies
Tested by: Netflix
Reviewed by: gallatin, rrs, sephe, transport

8 years agowpi: refresh manpage.
avos [Thu, 26 May 2016 10:55:19 +0000 (10:55 +0000)]
wpi: refresh manpage.

Reflect all recent changes in the manpage:
- add adhoc-demo and hostap into list of supported modes;
add few examples for them;
- mention encryption/decryption offload for CCMP cipher;
- extend list of driver messages in the DIAGNOSTICS;
- document hostap mode limitations / powersave instability
in the CAVEATS section.

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

8 years agoEnable USB PHY regulators when requested by the host controller driver.
jmcneill [Thu, 26 May 2016 10:50:39 +0000 (10:50 +0000)]
Enable USB PHY regulators when requested by the host controller driver.

Previously the USB PHY driver would enable all regulators at attach time.
This prevented boards from booting when powered by the USB OTG port, as
it didn't take VBUS presence into consideration.

8 years agoMake iser(4) buildable again by adjusting it for the recent changes
trasz [Thu, 26 May 2016 10:30:03 +0000 (10:30 +0000)]
Make iser(4) buildable again by adjusting it for the recent changes
in ICL interface.

 - the ordering of parameters to icl_conn_task_setup is different, so that
   the "cookie" is last.
 - the icl_conn_connected() method is gone, replaced by much simpler mechanism.
   I'd rather keep the ICL interface as small as possible.
 - I don't really like the s/offload/driver/g.  The "tcp" is not a driver;
   "iser" is not really a driver either.  I'd prefer to leave it as it is.
 - the check for ic_session_type_discovery() in iser_conn_handoff() is gone,
   as handoff cannot happen for discovery sessions.
 - ic_session_login_phase() and ic_session_type_discovery() are gone.  If you
   had your handoff method called - you're no longer in either of those.
 - the way maxtags is passed is different; now it's simply ic->ic_maxtags.
   It's cleaner, and the old way would cause weird things to happen if
   fail_on_disconnection=1 and the user changed the maxtags sysctl before
   reconnecting (basically the CAM idea of maxtags would be different from
   iSER one).
 - icl_hba_misc() is gone; declare support for PIM_UNMAPPED by setting
   ic->ic_unmapped flag.
 - the way we find the "iser" ICL module is rewritten - we have a flag
   for icl_register() that says if the module is iSER-capable or not.
 - icl_conn_release() is gone; iser_conn_release() is called from
   iser_conn_free() (no functional change in this case) and at the beginning
   of icl_conn_connect(), to handle reconnection.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoIncrease the size and alignment of the setjmp buffer.
br [Thu, 26 May 2016 10:03:30 +0000 (10:03 +0000)]
Increase the size and alignment of the setjmp buffer.
This is required for future CPU extentions.

Reviewed by: brooks
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoDefine ATOMIC_LONG_INIT() in the LinuxKPI.
hselasky [Thu, 26 May 2016 10:03:22 +0000 (10:03 +0000)]
Define ATOMIC_LONG_INIT() in the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoThe taskqueue_enqueue_fast() was removed in r296272.
trasz [Thu, 26 May 2016 09:53:24 +0000 (09:53 +0000)]
The taskqueue_enqueue_fast() was removed in r296272.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoBring in the Mellanox implementation of iSER (iSCSI over RDMA) initiator,
trasz [Thu, 26 May 2016 09:49:29 +0000 (09:49 +0000)]
Bring in the Mellanox implementation of iSER (iSCSI over RDMA) initiator,
written by Sagi Grimberg <sagig at mellanox.com> and Max Gurtovoy
<maxg at mellanox.com>.

This code comes from https://github.com/sagigrimberg/iser-freebsd, branch
iser-rebase-11-current-r291993.  It's not connected to the build just yet;
it still needs some tweaks to adapt to my changes to iSCSI infrastructure.

Big thanks to Mellanox for their support for FreeBSD!

Obtained from: Mellanox Technologies
MFC after: 1 month
Relnotes: yes

8 years agoOnly calibrate ICR read loop when not in x2APIC mode. Run-time
kib [Thu, 26 May 2016 09:09:11 +0000 (09:09 +0000)]
Only calibrate ICR read loop when not in x2APIC mode.  Run-time
switching between LAPIC modes is not supported, and there is no need
to wait for IPI ack in x2APIC mode.  So the calibrated delay is only
needed for !x2APIC.

This saves around a second of boot time on the real hardware for
x2APIC.

Sponsored by: The FreeBSD Foundation

8 years agoAdd support for runtime modifiable module parameters in the LinuxKPI.
hselasky [Thu, 26 May 2016 09:04:14 +0000 (09:04 +0000)]
Add support for runtime modifiable module parameters in the LinuxKPI.

Linux module parameters have a permissions value. If any write bits
are set we are allowed to modify the module parameter runtime. Reflect
this when creating the static SYSCTL nodes.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoAdd more module parameter macros to the LinuxKPI.
hselasky [Thu, 26 May 2016 08:47:06 +0000 (08:47 +0000)]
Add more module parameter macros to the LinuxKPI.

Obtained from: kmacy @
Sponsored by: Mellanox Technologies

8 years agoAdd support for boolean module parameters in the LinuxKPI.
hselasky [Thu, 26 May 2016 08:44:11 +0000 (08:44 +0000)]
Add support for boolean module parameters in the LinuxKPI.

Requested by: kmacy @
Sponsored by: Mellanox Technologies

8 years agoAdd support for boolean sysctl's.
hselasky [Thu, 26 May 2016 08:41:55 +0000 (08:41 +0000)]
Add support for boolean sysctl's.

Because the size of bool can be implementation defined, make a bool
sysctl handler which handle bools. Userspace sees the bools like
unsigned 8-bit integers. Values are filtered to either 1 or 0 upon
read and write, similar to what a compiler would do.

Requested by: kmacy @
Sponsored by: Mellanox Technologies

8 years ago[gpiospi] add initial gpio SPI bit bang driver.
adrian [Thu, 26 May 2016 07:20:33 +0000 (07:20 +0000)]
[gpiospi] add initial gpio SPI bit bang driver.

Submitted by: ray
Obtained from: zrouter

8 years agoThe readme provides a high-level overview of how to upgrade top(1).
ngie [Thu, 26 May 2016 07:09:42 +0000 (07:09 +0000)]
The readme provides a high-level overview of how to upgrade top(1).

Differential Revision: https://reviews.freebsd.org/D6493
MFC after: 1 week
Reviewed By: ngie
Submitted by: Randy Westlund <rwestlun@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years ago[spigen] add initial spigen driver from green@
adrian [Thu, 26 May 2016 07:02:20 +0000 (07:02 +0000)]
[spigen] add initial spigen driver from green@

This is a simple ioctl and mmap API to issue SPI transactions from
userland.  It's useful for simple devices (eg spi temperature sensors,
etc) for experimentation.

TODO:

* Write some documentation!

Submitted by: green

8 years ago[spibus] implement maximum clock frequency lookup from ofw.
adrian [Thu, 26 May 2016 06:37:33 +0000 (06:37 +0000)]
[spibus] implement maximum clock frequency lookup from ofw.

Obtained from: loos

8 years ago[spibus] add missing break.
adrian [Thu, 26 May 2016 06:36:58 +0000 (06:36 +0000)]
[spibus] add missing break.

Pointy hat to: me

8 years ago[spibus] add initial placeholders for transfer mode and frequency.
adrian [Thu, 26 May 2016 06:35:11 +0000 (06:35 +0000)]
[spibus] add initial placeholders for transfer mode and frequency.

This doesn't yet implement it in the controllers or the transfer
calls, but it's a start.

Obtained from: loos (frequency), ray/zrouter (transfer mode)

8 years agoAnother round of changes to add compatibility with the older ESHDC variety
ian [Thu, 26 May 2016 03:55:27 +0000 (03:55 +0000)]
Another round of changes to add compatibility with the older ESHDC variety
of hardware.  Mostly this focuses on the big changes needed for setting the
bus clock, because ESDHC is SDHCI v2.0 and USDHC is 3.0, and the number,
location, and interpretation of clock divisor bits is vastly different
between the two.  This doesn't get the device all the way to functioning
on ESDHC hardware yet, but it's much closer, now getting through all the
card detection and negotiation of capabilties and speed (but it eventually
hangs on what appears to be a missing interrupt).

Another missing chunk of code for handling ESDHC's 32 bit command-and-mode
register using sdhci's pair of 16 bit writes is added.

This also does some leading whitespace cleanups and sorts some softc
struct members by size, and adds some comments (because when do I ever
touch code without adding comments?).

8 years agohyperv: Rework guest id settings according to Hyper-V spec
sephe [Thu, 26 May 2016 03:50:52 +0000 (03:50 +0000)]
hyperv: Rework guest id settings according to Hyper-V spec

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6553

8 years agoAdd a convenience macro that masks all the bits related to clock divisors
ian [Thu, 26 May 2016 02:55:41 +0000 (02:55 +0000)]
Add a convenience macro that masks all the bits related to clock divisors
in all versions of the sdhci spec (the HI bits are just unused reserved
bits in earlier versions).

8 years agoAvoid buffer overflow or truncation when constructing path_zoneinfo_file.
truckman [Thu, 26 May 2016 01:45:04 +0000 (01:45 +0000)]
Avoid buffer overflow or truncation when constructing path_zoneinfo_file.

Reported by: Coverity
CID: 1011160
MFC after: 1 week

8 years agoAvoid buffer overflow when copying the input file name and appending .dat.
truckman [Thu, 26 May 2016 01:33:24 +0000 (01:33 +0000)]
Avoid buffer overflow when copying the input file name and appending .dat.

Check the return value from fread() to be sure that it was successful.

Reported by: Coverity
CID: 10067091009452
MFC after: 1 week

8 years ago[mx25l] add Winbond w25x64 support.
adrian [Thu, 26 May 2016 01:19:13 +0000 (01:19 +0000)]
[mx25l] add Winbond w25x64 support.

PR: https://github.com/freebsd/freebsd/pull/16
Submitted by: https://github.com/epipenau

8 years ago[bhnd] Fix release of uninitialized SPROM shadow in chipc detach.
adrian [Thu, 26 May 2016 00:44:16 +0000 (00:44 +0000)]
[bhnd] Fix release of uninitialized SPROM shadow in chipc detach.

This was triggering a panic on detach; the SPROM shadow is now
maintained by the bhnd_sprom_chipc driver, and should be removed
from chipc.

Submitted by: Landon Fuller <landonf@landonf.org>
Differential Revision: https://reviews.freebsd.org/D6548

8 years ago[bhnd] Integrate bhnd_chipc's BUS_ADD_CHILD() with a child resource mapping table.
adrian [Thu, 26 May 2016 00:43:08 +0000 (00:43 +0000)]
[bhnd] Integrate bhnd_chipc's BUS_ADD_CHILD() with a child resource mapping table.

This adds support for automatically configuring bhnd_chipc bus children
with associated resources, using an internal 'hints' table based directly
on Michael Zhilin's chipc resource mapping work.

The bhnd_sprom_chipc driver has been converted to use DEVICE_IDENTIFY()
with the new resource table.

This should be nearly drop-in compatible with the child device drivers
in D6250.

Submitted by: Landon Fuller <landonf@landonf.org>
Reviewed by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6525

8 years agoDisable alignment faults on armv6, adjust various alignment-related macros
ian [Thu, 26 May 2016 00:03:23 +0000 (00:03 +0000)]
Disable alignment faults on armv6, adjust various alignment-related macros
to match the new state of affairs.  The hardware we support has always been
able to do unaligned accesses, we've just never enabled it until now.

This brings FreeBSD into line with all the other major OSes, and should help
with the growing volume of 3rd-party software that assumes unaligned access
will just work on armv6 and armv7.

8 years agoBoth Clang and GCC cannot generate efficient reserve_pv_entries().
jkim [Wed, 25 May 2016 23:06:52 +0000 (23:06 +0000)]
Both Clang and GCC cannot generate efficient reserve_pv_entries().

http://docs.freebsd.org/cgi/mid.cgi?552BFEB2.8040407

Re-implement it entirely in inline assembly not to let compilers do silly
spilling to memory.  For non-POPCNT case, use newly added bit_count(3).

Reported by: alc
Reviewed by: alc, kib
Differential Revision: https://reviews.freebsd.org/D6541

8 years agoWhen sending in ICMP response to an SCTP packet,
tuexen [Wed, 25 May 2016 22:16:11 +0000 (22:16 +0000)]
When sending in ICMP response to an SCTP packet,
* include the SCTP common header, if possible
* include the first 8 bytes of the INIT chunk, if possible
This provides the necesary information for the receiver of the ICMP
packet to process it.

MFC after: 1 week

8 years agoUpdate to ELF Tool Chain r3477
emaste [Wed, 25 May 2016 20:56:30 +0000 (20:56 +0000)]
Update to ELF Tool Chain r3477

This fixes a EFI/PE header issue that prevented elfcopy-produced .efi
files from working with Secure Boot:

  Make sure section raw size is always padded to multiple of
  FileAlignment from the optional header, as requested by the PE
  specification. This change should reduce the diff between PE image
  generated by Binutils objcopy and elftoolchain elfcopy.

Submitted by: kaiw
Reported by: ambrisko

8 years agoInclude machine/acle-compat.h in cdefs.h on arm if the compiler doesn't
ian [Wed, 25 May 2016 19:44:26 +0000 (19:44 +0000)]
Include machine/acle-compat.h in cdefs.h on arm if the compiler doesn't
have ACLE support built in.  The ACLE (ARM C Language Extensions) defines
a set of standardized symbols which indicate the architecture version and
features available.  ACLE support is built in to modern compilers (both
clang and gcc), but absent from gcc prior to 4.4.

ARM (the company) provides the acle-compat.h header file to define the
right symbols for older versions of gcc.  Basically, acle-compat.h does
for arm about the same thing cdefs.h does for freebsd: defines
standardized macros that work no matter which compiler you use.  If ARM
hadn't provided this file we would have ended up with a big #ifdef __arm__
section in cdefs.h with our own compatibility shims.

Remove #include <machine/acle-compat.h> from the zillion other places (an
ever-growing list) that it appears.  Since style(9) requires sys/types.h
or sys/param.h early in the include list, and both of those lead to
including cdefs.h, only a couple special cases still need to include
acle-compat.h directly.

Loves it:     imp

8 years agoClose the input FILE * in read_file() and the output FILE * in write_file()
truckman [Wed, 25 May 2016 18:38:30 +0000 (18:38 +0000)]
Close the input FILE * in read_file() and the output FILE * in write_file()
if read_stream() or write_stream() fails to avoid leaking the FILE.

Reported by: Coverity
CID: 977702
Reviewed by: pfg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6554

8 years agoFix issues found by Coverity in the rtld-elf.c:gethints().
kib [Wed, 25 May 2016 18:10:44 +0000 (18:10 +0000)]
Fix issues found by Coverity in the rtld-elf.c:gethints().

Check that the dirlist path string specification does not cause
overflow and is fully contained in the hints file.
Check that the dirlist string is nul-terminated.
Make 'hdr' static variable, so that hdr.dirlistlen is available when
hints cached value is used on next function calls.  Reset hdr.dirlistlen
to zero if error was detected, so that allocations use reasonable size.
Use 'hints', and not 'p' in the body, since p is only initialized on the
first call.

Reported and reviewed by: truckman (previous version)
Sponsored by: The FreeBSD Foundation
CIDs: 10065031006504100667610084881007263
MFC after: 2 weeks

8 years agoDo not generate code for sbrk syscall -- sbrk support was removed.
br [Wed, 25 May 2016 16:38:10 +0000 (16:38 +0000)]
Do not generate code for sbrk syscall -- sbrk support was removed.

Pointed out by: andrew

8 years agoSend an ICMP packet indicating destination unreachable/protocol
tuexen [Wed, 25 May 2016 15:54:21 +0000 (15:54 +0000)]
Send an ICMP packet indicating destination unreachable/protocol
unreachable if we don't handle the packet in the kernel and not
in userspace.

MFC after: 1 week

8 years agoFix a couple of Coverity Unintended sign extension sign extension
truckman [Wed, 25 May 2016 15:49:29 +0000 (15:49 +0000)]
Fix a couple of Coverity Unintended sign extension sign extension
defects.  When shifting an unsigned byte into the upper 8 bits of
an int and the resulting value is greater than 0x7FFFFFF, the result
will be sign extended when converting to a 64 bit unsigned long.
Fix by casting to (uint64_t) before the shift.

Reported by: Coverity
CID: 13560441356045
Reviewed by: ken

8 years agoFix a couple of new instances of a false positive Coverity buffer
truckman [Wed, 25 May 2016 15:43:01 +0000 (15:43 +0000)]
Fix a couple of new instances of a false positive Coverity buffer
overflow defect.  Use the new CCB_CLEAR_ALL_EXCEPT_HDR() macro
instead of the calling bzero() on the pointer to the header used
as an array and indexed by 1.

Don't leak a buffer after executing "goto restart_report" by
overwriting its pointer with the results of another calloc().
Be sure to clear the buffer before reusing it.  (CID 1356042)

Reported by: Coverity
CID: 13560221356034135602313560351356042
Reviewed by: ken

8 years agosed: convert sed to use REG_STARTEND more explicitly.
pfg [Wed, 25 May 2016 15:42:39 +0000 (15:42 +0000)]
sed: convert sed to use REG_STARTEND more explicitly.

Summarizing the findings in the OpenBSD list:

This solves a reproduceable issue with very recent Mesa where REG_NOTBOL
combined with a match at the begin of the string causes our regex library
to treat the word as not begin of word.

Thanks to Martijn van Duren and Ingo Schwarze for taking the time to
solve this in the least invasive way.

PR: 209352, 209387
Taken from:     openbsd-tech (Martijn van Duren)
MFC after: 1 month

8 years agolibc: regexec(3) adjustment.
pfg [Wed, 25 May 2016 15:35:23 +0000 (15:35 +0000)]
libc: regexec(3) adjustment.

Change the behavior of when REG_STARTEND is combined with REG_NOTBOL.

From the original posting[1]:

"Enable the assumption that pmatch[0].rm_so is a continuation offset
to  a string and allows us to do a proper assessment of the character
in  regards to it's word position ('^' or '\<'), without risking going
into unallocated memory."

This change makes us similar to how glibc handles REG_STARTEND |
REG_NOTBOL, and is closely related to a soon-to-land fix to sed.

Special thanks to Martijn van Duren and Ingo Schwarze for working
out some consistent behaviour.

Differential Revision: https://reviews.freebsd.org/D6257
Taken from: openbsd-tech 2016-05-24 [1]  (Martijn van Duren)
Relnotes: yes
MFC after: 1 month

8 years agoRemove legacy brk and sbrk from RISC-V.
br [Wed, 25 May 2016 14:08:21 +0000 (14:08 +0000)]
Remove legacy brk and sbrk from RISC-V.

Discussed with: andrew
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoCount packets as not being delivered only if they are neither
tuexen [Wed, 25 May 2016 13:48:26 +0000 (13:48 +0000)]
Count packets as not being delivered only if they are neither
processed by a kernel handler nor by a raw socket.

MFC after: 1 week

8 years agoSend whois queries for gov.uk names to JANET.
fanf [Wed, 25 May 2016 13:09:06 +0000 (13:09 +0000)]
Send whois queries for gov.uk names to JANET.

8 years agoImplement Linux module parameters as read-only tunable SYSCTLs.
hselasky [Wed, 25 May 2016 12:12:14 +0000 (12:12 +0000)]
Implement Linux module parameters as read-only tunable SYSCTLs.

Bool module parameters are no longer supported, because there is no
equivalent in FreeBSD.

There are two macros available which control the behaviour of the
LinuxKPI module parameters:

- LINUXKPI_PARAM_PARENT allows the consumer to set the SYSCTL parent
where the modules parameters will be created.

- LINUXKPI_PARAM_PREFIX defines a parameter name prefix, which is
  added to all created module parameters.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoPrepare for activation of LinuxKPI module parameters as read-only
hselasky [Wed, 25 May 2016 12:03:21 +0000 (12:03 +0000)]
Prepare for activation of LinuxKPI module parameters as read-only
tunable SYSCTL's. Linux module parameters are associated with the
module they belong to. FreeBSD does not share this concept of a parent
module. Instead add macros which define the prefix to use for the
module parameters in the LinuxKPI consumers.

While at it convert all "bool" LinuxKPI module parameters to "byte"
type, because we don't have a "bool" type of SYSCTL in FreeBSD.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoAdd relocation support for RISC-V.
br [Wed, 25 May 2016 11:58:55 +0000 (11:58 +0000)]
Add relocation support for RISC-V.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D6559

8 years agoAdd more info about the issue fixed in r298460. Rephrase some sentences
skra [Wed, 25 May 2016 10:09:23 +0000 (10:09 +0000)]
Add more info about the issue fixed in r298460. Rephrase some sentences
and fix grammar.

No functional change.

Suggested by: alc
Reviewed by: alc

8 years agoAdd checks for SCHEDULER_STOPPED() so that code using the LinuxKPI can
hselasky [Wed, 25 May 2016 09:04:06 +0000 (09:04 +0000)]
Add checks for SCHEDULER_STOPPED() so that code using the LinuxKPI can
run after a panic(). This for example allows a LinuxKPI based graphics
stack to receive prints during a panic.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoChange net.link.log_promisc_mode_change to a read-only tunable
n_hibma [Wed, 25 May 2016 09:00:05 +0000 (09:00 +0000)]
Change net.link.log_promisc_mode_change to a read-only tunable

PR: 166255
Submitted by: eugen.grosbein.net
Obtained from: hselasky
MFC after: 3 days

8 years agoMake code compile when basename() is POSIX compliant.
ed [Wed, 25 May 2016 08:45:03 +0000 (08:45 +0000)]
Make code compile when basename() is POSIX compliant.

The POSIX basename() function is allowed to modify its input buffer,
which means its argument is "char *". Pull a copy of the input string
before computing the base.

Reviewed by: jtl
Differential Revision: https://reviews.freebsd.org/D6465

8 years agoCheck for signals when locking the USB enumeration thread from
hselasky [Wed, 25 May 2016 07:48:36 +0000 (07:48 +0000)]
Check for signals when locking the USB enumeration thread from
userspace, so that USB applications can be killed if an enumeration
thread should be stuck for various reasons.

MFC after: 1 week

8 years agoCall closedir() before returning from fetchListFile() to avoid a leak.
truckman [Wed, 25 May 2016 07:43:32 +0000 (07:43 +0000)]
Call closedir() before returning from fetchListFile() to avoid a leak.

Reported by: Coverity
CID: 1016697
MFC after: 1 week

8 years agoDon't leak addrinfo in fetch_bind()
truckman [Wed, 25 May 2016 07:39:48 +0000 (07:39 +0000)]
Don't leak addrinfo in fetch_bind()

Reported by: Coverity
CID: 1225038
MFC after: 1 week

8 years agoFix Coverity CID 978183 Resource leak in rexec().
truckman [Wed, 25 May 2016 07:26:22 +0000 (07:26 +0000)]
Fix Coverity CID 978183 Resource leak in rexec().

Close the socket if connect() fails to avoid leaking it.

Reported by: Coverity
CID: 978183
MFC after: 1 week

8 years agoFix Coverity CID 1016714 Resource leak in process_file_actions_entry()
truckman [Wed, 25 May 2016 07:13:53 +0000 (07:13 +0000)]
Fix Coverity CID 1016714 Resource leak in process_file_actions_entry()

Don't leak a file descriptor of _dup2() fails (shouldn't happen).

Reported by: Coverity
CID: 1016714
MFC after: 1 week

8 years agoFix 1016718 Resource leak.
truckman [Wed, 25 May 2016 06:55:53 +0000 (06:55 +0000)]
Fix 1016718 Resource leak.

Don't leak a file descriptor if fchdir() fails.

Reported by: Coverity
CID: 1016718
MFC after: 1 week

8 years agoBuild etherswitch support for appropriate Ralink/Mediatek SoCs
sgalabov [Wed, 25 May 2016 06:47:28 +0000 (06:47 +0000)]
Build etherswitch support for appropriate Ralink/Mediatek SoCs

Etherswitch support is built by default on all SoCs except RT3662/RT3883
as they have no built-in switch and their configurations with external
switches are not yet supported.

Sponsored by: Smartcom - Bulgaria AD

8 years agoBring ralink/mediatek DTS files in sync with LEDE
sgalabov [Wed, 25 May 2016 06:39:48 +0000 (06:39 +0000)]
Bring ralink/mediatek DTS files in sync with LEDE

This is the last sync with LEDE Project dts files before 11.0.

Obtained from: LEDE Project
Sponsored by: Smartcom - Bulgaria AD

8 years agoAlign radiotap structures in ral(4)
sgalabov [Wed, 25 May 2016 06:29:23 +0000 (06:29 +0000)]
Align radiotap structures in ral(4)

Currently all radiotap structures in ral(4) are packed, but are not
aligned, which causes ral based devices to crash when one does
'ifconfig wlan0 up' for a wlan interface with a ral wlandev on arches
that care about structure alignment (e.g., MIPS).

Adding an aligned attribute helps fix this problem and ral devices
can be properly brought up.

Reviewed by: adrian
Sponsored by: Smartcom - Bulgaria AD

8 years agohyperv: Preserve required bits when disable Hypercall
sephe [Wed, 25 May 2016 06:01:47 +0000 (06:01 +0000)]
hyperv: Preserve required bits when disable Hypercall

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6530