Commit Graph

111058 Commits

Author SHA1 Message Date
Bryan Drewery
23ae5cd74e filemon exec: Use imgp->execpath rather than vn_fullpath(9).
This will be more accurate as the actual name is provided if ran
from an absolute path in do_execve().

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-05-26 23:27:08 +00:00
Bryan Drewery
eb9b07bb77 WITH_AUTO_OBJ: Fix crunchgen builds.
Passing MAKEOBJDIRPREFIX to the main prog build (rescue) would confuse
WITH_AUTO_OBJ and cause it to create a recursed object directory that
then broke the actual prog build.  This is normally not a problem since
we do not call 'make -f prog.mk obj' before building anything in it.

Crunchgen(1) also assumes that if -o is not passed then if an object
directory does not already exist then it should build in the source
directories.  The normal buildworld process will have already ran 'make
obj' in each of the component directories so this is not a problem.
With WITH_AUTO_OBJ though this is not the case.  So we must tell
crunchgen(1) that MK_AUTO_OBJ=yes will create the directory and to not
require it be present before generating its Makefile.

Sponsored by:	EMC / Isilon Storage Division
2016-05-26 23:20:36 +00:00
Bryan Drewery
74c5734766 Use netinet/in.h to avoid include/arpa dependency for DIRDEPS_BUILD.
Sponsored by:	EMC / Isilon Storage Division
2016-05-26 23:20:17 +00:00
Bryan Drewery
4977354760 Add some missing .PHONY.
These are relevant for WITH_META_MODE to ensure they are
always reran and don't generate a .meta file.

Sponsored by:	EMC / Isilon Storage Division
2016-05-26 23:20:14 +00:00
Bryan Drewery
016448a507 WITH_META_MODE: Move the kernel support to kern.pre.mk.
This allows using META_MODE directly from the kernel build directory.
This also allows removing a hack from the DIRDEPS_BUILD kernel target.

Sponsored by:	EMC / Isilon Storage Division
2016-05-26 23:20:01 +00:00
Bryan Drewery
1afd78b34d exec: Provide execpath in imgp for the process_exec hook.
This was previously set after the hook and only if auxargs were present.
Now always provide it if possible.

MFC after:	2 weeks
Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D6546
2016-05-26 23:19:39 +00:00
Bryan Drewery
881010f05d exec: Add credential change information into imgp for process_exec hook.
This allows an EVENTHANDLER(process_exec) hook to see if the new image
will cause credentials to change whether due to setgid/setuid or because
of POSIX saved-id semantics.

This adds 3 new fields into image_params:
  struct ucred *newcred		Non-null if the credentials will change.
  bool credential_setid		True if the new image is setuid or setgid.

This will pre-determine the new credentials before invoking the image
activators, where the process_exec hook is called.  The new credentials
will be installed into the process in the same place as before, after
image activators are done handling the image.

MFC after:	2 weeks
Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D6544
2016-05-26 23:18:54 +00:00
John Baldwin
8f7ada2196 Use a unique error message if we fail to find the simple network protocol.
While here, fix the various net driver callbacks to return early instead
of crashing if this fails.  (The 'init' callback from the netif interface
doesn't return an error if the protocol lookup fails.)

Sponsored by:	Cisco Systems
2016-05-26 23:08:57 +00:00
John Baldwin
72bc6425a9 Apply the printf %S band-aid for efinet.c to fix the arm64 build. 2016-05-26 23:07:20 +00:00
John Baldwin
b4f9242404 Remove second copy of the -Wno-format band-aid for printf %S. 2016-05-26 23:06:36 +00:00
Andriy Voskoboinyk
0676206626 rtwn, urtwn: drop unused structures.
urtwn(4) uses another implementation of command queue; rtwn(4) don't need
it at all.
2016-05-26 22:43:02 +00:00
Ian Lepore
5030d499e7 Add a convenience function to get a gpio pin's capabilties. 2016-05-26 22:35:52 +00:00
Ian Lepore
e3f2d7af0e Add support for triggering interrupts on both rising and falling edges.
Also, EOI a gpio interrupt in the post_ithread routine before re-enabling.
2016-05-26 22:34:25 +00:00
John Baldwin
e06f8144fb Use routines from the recently added devpath.c.
These efipart layer did several devpath related operations inline.  This
just switches it over to using shared code for working with device paths.

Sponsored by:	Cisco Systems
2016-05-26 22:13:40 +00:00
Don Lewis
ef94ebfc88 Include the new AQM files when compiling a kernel with options DUMMYNET.
Reported by:	Nikolay Denev <nike_d AT cytexbg DOT com>
MFC after:	2 weeks (with r300779)
2016-05-26 22:07:09 +00:00
Don Lewis
248c72bfb8 Correct a typo in a comment.
MFC after:	2 weeks (with r300779)
2016-05-26 22:03:28 +00:00
John Baldwin
79ad8397ea Output the device path description for EFI network devices.
Lookup the DEVICE_PATH for each EFI network device handle and output the
string description using printf with '%S'.  To honor the pager, the newline
at the end of each line is still output with pager_output().

Sponsored by:	Cisco Systems
2016-05-26 21:48:39 +00:00
Don Lewis
4e59799e1b Modify BOUND_VAR() macro to wrap all of its arguments in () and tweak
its expression to work on powerpc and sparc64 (gcc compatibility).

Correct a typo in a nearby comment.

MFC after:	2 weeks (with r300779)
2016-05-26 21:44:52 +00:00
John Baldwin
3e5a19be71 Add some routines for working with EFI DEVICE_PATH objects.
- efi_lookup_devpath() uses the DEVICE_PATH_PROTOCOL to obtain the
  DEVICE_PATH for a given EFI handle.
- efi_lookup_image_devpath() uses the LOADED_IMAGE_DEVICE_PATH_PROTOCOL
  to lookup the device path of the device used to load a loaded image.
- efi_devpath_name() uses the DEVICE_PATH_TO_TEXT_PROTOCOL to generate
  a string description of a device path.  The returned string is a CHAR16
  string that can be printed via the recently added '%S' format in
  libstand's printf().  Note that the returned string is returned in
  allocated storage that should be freed by calling
  efi_free_devpath_name().
- efi_devpath_last_node() walks a DEVICE_PATH returning a pointer to the
  final node in the path (not counting the terminating node).  That is,
  it returns a pointer to the last meaninful node in a DEVICE_PATH.
- efi_devpath_trim() generates a new DEVICE_PATH from an existing
  DEVICE_PATH.  The new DEVICE_PATH does not include the last
  non-terminating node in the original path.  If the original DEVICE_PATH
  only contains the terminating node, this function returns NULL.
  The caller is responsible for freeing the returned DEVICE_PATH via
  free().
- efi_devpath_handle() attempts to find a handle that corresponds to a
  given device path.  However, if nodes at the end of the device path do
  not have valid handles associated with them, this function will return
  a handle that matches a node earlier in the device path.  In particular,
  this function returns a handle for the node closest to the end of the
  device path which has a valid handle.

Sponsored by:	Cisco Systems
2016-05-26 21:43:22 +00:00
Don Lewis
91336b403a Import Dummynet AQM version 0.2.1 (CoDel, FQ-CoDel, PIE and FQ-PIE).
Centre for Advanced Internet Architectures

Implementing AQM in FreeBSD

* Overview <http://caia.swin.edu.au/freebsd/aqm/index.html>

* Articles, Papers and Presentations
  <http://caia.swin.edu.au/freebsd/aqm/papers.html>

* Patches and Tools <http://caia.swin.edu.au/freebsd/aqm/downloads.html>

Overview

Recent years have seen a resurgence of interest in better managing
the depth of bottleneck queues in routers, switches and other places
that get congested. Solutions include transport protocol enhancements
at the end-hosts (such as delay-based or hybrid congestion control
schemes) and active queue management (AQM) schemes applied within
bottleneck queues.

The notion of AQM has been around since at least the late 1990s
(e.g. RFC 2309). In recent years the proliferation of oversized
buffers in all sorts of network devices (aka bufferbloat) has
stimulated keen community interest in four new AQM schemes -- CoDel,
FQ-CoDel, PIE and FQ-PIE.

The IETF AQM working group is looking to document these schemes,
and independent implementations are a corner-stone of the IETF's
process for confirming the clarity of publicly available protocol
descriptions. While significant development work on all three schemes
has occured in the Linux kernel, there is very little in FreeBSD.

Project Goals

This project began in late 2015, and aims to design and implement
functionally-correct versions of CoDel, FQ-CoDel, PIE and FQ_PIE
in FreeBSD (with code BSD-licensed as much as practical). We have
chosen to do this as extensions to FreeBSD's ipfw/dummynet firewall
and traffic shaper. Implementation of these AQM schemes in FreeBSD
will:
* Demonstrate whether the publicly available documentation is
  sufficient to enable independent, functionally equivalent implementations

* Provide a broader suite of AQM options for sections the networking
  community that rely on FreeBSD platforms

Program Members:

* Rasool Al Saadi (developer)

* Grenville Armitage (project lead)

Acknowledgements:

This project has been made possible in part by a gift from the
Comcast Innovation Fund.

Submitted by:	Rasool Al-Saadi <ralsaadi@swin.edu.au>
X-No objection:	core
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D6388
2016-05-26 21:40:13 +00:00
Emmanuel Vadot
30068a1de9 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
2016-05-26 21:09:07 +00:00
Conrad Meyer
5f4ea90bbe 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
2016-05-26 20:37:49 +00:00
Conrad Meyer
571ebf7685 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
2016-05-26 19:29:29 +00:00
Jung-uk Kim
ccabe8433f Fix style(9). 2016-05-26 19:17:51 +00:00
Jung-uk Kim
a42aa5facd Use bit_count(3) instead of four bitcount32() calls.
Reviewed by:	asomers, ngie
Differential Revision:	https://reviews.freebsd.org/D6543
2016-05-26 18:57:26 +00:00
Luiz Otavio O Souza
d3dd020425 Only do the touch screen setup when the 'ti,wires' property is present.
While here fix a typo in a debug message.
2016-05-26 18:52:26 +00:00
John Baldwin
052a5418e8 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
2016-05-26 18:35:37 +00:00
Adrian Chadd
dbe3eb98b5 [siba] use the generic bus methods where appropriate.
Submitted by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D802
2016-05-26 18:01:03 +00:00
Andriy Voskoboinyk
c146f2712e ral: add missing ic_getradiocaps() assignment. 2016-05-26 17:06:43 +00:00
Konstantin Belousov
aa9bc3b171 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
2016-05-26 16:59:29 +00:00
Ian Lepore
4cbedf8a36 Fix a typo in a comment. 2016-05-26 16:53:50 +00:00
Konstantin Belousov
98f139daef Style changes to some most outrageous violations in vm_object_collapse().
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-05-26 16:51:38 +00:00
Andriy Voskoboinyk
63b2493fcf 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.
2016-05-26 16:48:20 +00:00
Andriy Voskoboinyk
a7c31fe1e9 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.
2016-05-26 16:39:11 +00:00
Andriy Voskoboinyk
2a06b6b33f 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.
2016-05-26 16:15:10 +00:00
Andriy Voskoboinyk
0a02496f4b 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
2016-05-26 16:05:19 +00:00
Andriy Voskoboinyk
5a62dab132 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
2016-05-26 15:56:27 +00:00
Ian Lepore
c45b842250 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().
2016-05-26 15:45:36 +00:00
Andriy Voskoboinyk
83829b483d 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
2016-05-26 15:12:54 +00:00
Andriy Voskoboinyk
99bb30a9e0 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
2016-05-26 15:05:37 +00:00
Andriy Voskoboinyk
354df9d4eb 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
2016-05-26 14:17:57 +00:00
Andrew Rybchenko
6dd81be2d2 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
2016-05-26 13:19:44 +00:00
Andriy Voskoboinyk
b628bdccce 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
2016-05-26 13:14:08 +00:00
Edward Tomasz Napierala
bcec64bc61 Add a special case for iSER data tranfers.
Obtained from:	Mellanox Technologies
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-26 12:43:15 +00:00
Edward Tomasz Napierala
4686f1a660 Fix crash on removal of an unconnected iSER session.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-26 11:40:07 +00:00
Michael Tuexen
4f3b84b524 Make struct sctp_paddrthlds compliant to RFC 7829. 2016-05-26 11:38:26 +00:00
Andriy Voskoboinyk
1447d404e0 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
2016-05-26 11:12:36 +00:00
Hans Petter Selasky
fc271df341 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
2016-05-26 11:10:31 +00:00
Jared McNeill
627c360fa7 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.
2016-05-26 10:50:39 +00:00
Edward Tomasz Napierala
95c4a39244 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
2016-05-26 10:30:03 +00:00