Commit Graph

220096 Commits

Author SHA1 Message Date
Adrian Chadd
1410ca560d [ath] initial station side quiet IE support.
This implements hardware assisted quiet IE support.  Quiet time is
an optional interval on DFS channels (but doesn't have to be DFS
only channels! sigh) where the station and AP can be quiet in order
to allow for channel utilisation measurements.  Typically that's
stuff like radar detection, spectral scan, other-BSS frame sniffing,
checking how busy the air is, etc.

The hardware implements it as one of the generic timers, which is
supplied a period, offset from the trigger period and duration
to stay quiet.  The AP can announce quiet time configurations which
change, and so this code also tracks that.

Implementation details:

* track the current quiet time IE
* compare the new one against the previous one - if only the TBTT
  counter changes, don't update things
* If tbttcount=1 then program it into the hardware - that is when
  it is easiest to program the correct starting offset (one TBTT +
  configured offset).
* .. later on check to see if it can be done on any tbttcount
* If the IE goes away then remove the quiet timer and clear the
  config
* Upon reset, state change, new beacon - clear quiet time IE
  and just let it resync from the next beacon.

History:

This was work done initially by sibridgetech.com in 2011/2012/2013
as part of some FreeBSD wifi DFS contracting work they had for a
third party.  They implemented the net80211 quiet time IE pieces
and had some test code for the station side which didn't entirely
use the timers correctly.

I figured out how to use the timers correctly without stopping/starting
the transmit DMA engine each time. When done correctly, the timer
just needs to be programmed once and left alone until the next
configuration change.

So, thanks to Himali Patel and Parthiv Shah for their work way
back then.  I finally figured it out and finished it!

TODO:

* Now, I'd rather net80211 did the quiet time IE tracking and parsing,
  pushing configurations into the driver is needed.  I'll look at
  doing that in a subsequent update.

* This doesn't handle multiple quiet time IEs, which will currently
  just mess things up.  I'll look into supporting that in the future
  (at least by only obeying "one" of them, and then ignoring
  subsequent IEs in a beacon/probe frame.)

* This also implements the STA side and not the AP side - the AP
  side will come later, and involves taking various other intervals
  into account (eg the beacon offset for multi-VAP modes, the
  SWBA time, etc, etc) as well as obtaining the configuration when
  a beacon is configured/generated rather than "hearing" an IE.

* .. investigate supporting quiet IE in mesh, tdma, ibss modes

* .. investigate supporting quiet IE for non-DFS channels
  (so this can be done for say, 2GHz channels.)

* Chances are i should commit NULL methods for the ar5210, ar5211 HALs..

Tested:

* AR9380, STA mode - announcing quiet, removing quiet, changing quite
  time config, whilst doing iperf testing;
* AR9380, AP mode.
2017-02-09 23:15:11 +00:00
Alan Somers
6159fb2f9c Fix setting birthtime in ZFS
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
	* In zfs_freebsd_setattr, if the caller wants to set the birthtime,
	  set the bits that zfs_settattr expects

	* In zfs_setattr, if XAT_CREATETIME is set, set xoa_createtime,
	  expected by zfs_xvattr_set.  The two levels of indirection seem
	  excessive, but it minimizes diffs vs OpenZFS.

	* In zfs_setattr, check for overflow of va_birthtime (from delphij)

	* Remove red herring in zfs_getattr

sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h
	* Un-booby-trap some macros

New tests are under review at https://github.com/pjd/pjdfstest/pull/6

Reviewed by:	avg
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9353
2017-02-09 21:30:53 +00:00
Renato Botelho
7814b3b8a1 Cleanup on usr.sbin/arp/arp.c
* 'blackhole' and 'reject' are mutually exclusive, replace printf() by errx()
  when both are selected.
* 'trail' option is no longer supported since first import of arp from 4.4BSD.
  XXX message was added 13 years ago in r128192. I believe it's time to remove
  it.
* Use warnx() to print some informative messages instead of printf()
* Replace strncmp() by strcmp() when validating parameters and exit when invalid
  parameter is found

Reviewed by:	allanjude, vangyzen, cem
Approved by:	allanjude
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
Differential Revision:	https://reviews.freebsd.org/D9504
2017-02-09 19:58:12 +00:00
Andrew Turner
2a3c5de4f7 Add support for the Intel 82572EI back to em(4), it seems it was dropped
when oving to iflib.

Reviewed by:	sbruno
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D9511
2017-02-09 17:48:33 +00:00
Conrad Meyer
0ecf59f68f ufs: Use UFS_MAXNAMLEN constant
(like NFS, EXT2FS, SVR4, IBCS2) instead of redefining the MAXNAMLEN
constant.

No functional change.

Reviewed by:	kib@, markj@
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9500
2017-02-09 17:47:01 +00:00
Allan Jude
6053fa9683 Add I2C device hints for Onion Omega
This allows you to control up to 8 relay expansions from FreeBSD

https://github.com/freebsd/freebsd-wifi-build/wiki/Onion-Omega#controlling-the-relay-expansion

Reviewed by:	adrian, mizhka
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D9503
2017-02-09 15:16:08 +00:00
Mateusz Guzik
8eaaf58a5f rwlock: fix r313454
The runlock slow path would update wrong variable before restarting the
loop, in effect corrupting the state.

Reported by:	pho
2017-02-09 13:32:19 +00:00
Mateusz Guzik
3b3cf014fc locks: tidy up unlock fallback paths
Update comments to note these functions are reachable if lockstat is
enabled.

Check if the lock has any bits set before attempting unlock, which saves
an unnecessary atomic operation.
2017-02-09 08:19:30 +00:00
Stanislav Galabov
48f4c9fb04 Set GDMA1 Frames Destination Port to Port 0 (CPU)
Some U-Boot versions do not initialize MT7620's Frame Engine.
Then it is not possible to receive packets from the network.
Setting GDMA1 Frames Destination Port to Port 0 (CPU) in GDM Forwarding
Configuration register solves this issue.

Submitted by:	Hiroki Mori (yamori813@yahoo.co.jp)
Reviewed by:	adrian mizhka (previous version)
Differential Revision:	https://reviews.freebsd.org/D9301
2017-02-09 07:29:07 +00:00
Adrian Chadd
4d3dcce5bb [net80211] quiet IE handling improvements
* on the station side, only call the quiet time IE method if we have a
  quiet IE - otherwise call the NULL method once, and then don't waste
  time calling NULL

* on the beacon generation side - force a beacon regeneration each time
  quiet time is enabled/disabled.  Without this, enabling/disabling quiet
  time IE would cause the beacon contents to be corrupted since none of
  the "move contents around" logic (like for CSA and TIM handling) is implemented.

This changes the size of ieee80211_node so it requires a kernel recompile,
but no userland recompile.

Tested:

* AR9380, AP mode, enabling/disabling quiet time IE
* AR9380, STA mode, with upcoming driver changes.
2017-02-09 04:07:30 +00:00
Konrad Witaszczyk
4b30cd46a5 Don't decrypt a core if a vmcore file already exists by default.
Allow to change this behaviour using the -f flag.

Approved by:	pjd (mentor)
2017-02-08 23:17:23 +00:00
Ed Maste
0bce01b269 lld: Allow arbitrary code alignment in .eh_frame
According to the specification, CIE code alignment factor is an
arbitrary unsigned LEB128 encoded value.

PR:		216908
Reported by:	Wolfgang Meyer
Obtained from:	Upstream LLD r277105
MFC after:	1 week
2017-02-08 20:31:54 +00:00
Renato Botelho
04ae8c6400 Fix style(9)
Reviewed by:	vangyzen, allanjude, cem
Approved by:	allanjude
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
Differential Revision:	https://reviews.freebsd.org/D9494
2017-02-08 20:21:29 +00:00
Mateusz Guzik
834f70f32f sx: implement slock/sunlock fast path
See r313454.
2017-02-08 19:29:34 +00:00
Mateusz Guzik
b0a61642d4 rwlock: implemenet rlock/runlock fast path
This improves singlethreaded throughput on my test machine from ~247 mln
ops/s to ~328 mln.

It is mostly about avoiding the setup cost of lockstat.

Reviewed by:	jhb (previous version)
2017-02-08 19:28:46 +00:00
Mateusz Guzik
3b6f6c2760 Implement LOCKSTAT_OOL_PROFILE_ENABLED
For use in uninlined locking primitives to decide whether lockstat
or profiling needs to be taken care of.
2017-02-08 19:25:58 +00:00
Toomas Soome
6db947347c loader: possible NULL pointer dereference in bcache.c
Coverity detected the possible NULL pointer dereference case.
Also updated comment as was suggested in illumos review.

CID:		1371008
Reported by:	Coverity
Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9496
2017-02-08 18:32:53 +00:00
John Baldwin
3ff519254c Trim trailing whitespace (mostly introduced in r313407).
Sponsored by:	DARPA / AFRL
2017-02-08 17:45:23 +00:00
Renato Botelho
371ce0ebc2 bsdinstall: Make sure chroot filesystems are umounted after use
* DISTDIR_IS_UNIONFS is set every time BSDINSTALL_DISTDIR is mounted inside
  BSDINSTALL_CHROOT. Use this flag to decide if it needs to be umounted
* BSDINSTALL_CHROOT/dev is mounted when 'bsdinstall mount' is called, there is
  no need to mount it again when user goes to shell after installation

Reviewed by:	allanjude
Obtained from:	pfSense
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
Differential Revision:	https://reviews.freebsd.org/D8573
2017-02-08 17:03:52 +00:00
Jonathan T. Looney
19d4720b1e Ensure the idle thread's loop services interrupts in a timely way when
using the ACPI C1/mwait sleep method.

Previously, the mwait instruction would return when an interrupt was
pending; however, the idle loop did not actually enable interrupts when
this occurred. This led to a situation where the idle loop could quickly
spin through the C1/mwait sleep method a number of times when an interrupt
was pending. (Eventually, the situation corrected itself when something
other than an interrupt triggered the idle loop to either enable interrupts
or schedule another thread.)

Reviewed by:	kib, imp (earlier version)
Input from:	jhb
MFC after:	1 week
Sponsored by:	Netflix
2017-02-08 16:46:57 +00:00
Toomas Soome
c7bf8909b1 loader: possible NULL pointer dereference in efipart.c
Fix bugs found by Coverity in efipart.c.

The Issue is that efi_devpath_last_node() can return NULL pointer, and
therefore we should check for it. In real life we really do not
expect to see it to happen, so we will just error out from the test.

CID:		1371004
Reported by:	Coverity
Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9490
2017-02-08 15:52:09 +00:00
Enji Cooper
635f2911b0 Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head
The primary end-goal of this drop is ease future merges with NetBSD and
collaborate further with the NetBSD project.

The goal was (largely, not completely as some items are still oustanding
in the NetBSD GNATS system) achieved by doing the following:
- Pushing as many changes required to port contrib/netbsd-tests
  back to NetBSD as possible, then pull the upstream applied changes
  back in to FreeBSD.
- Diff reduce with upstream where possible by:
-- Improving libnetbsd header, etc compat glue.
-- Using _SED variables to modify test scripts on the fly for items
   that could not be upstreamed to NetBSD.

As a bonus for this work, this change also introduces testcases for
uniq(1).

Many thanks to Christos for working with me to get many of the changes
back into the NetBSD project.

In collaboration with:	Christos Zoulas <christos@netbsd.org>
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-02-08 09:46:15 +00:00
Enji Cooper
12e1a6e990 Clean up trailing and leading whitespace for variables to make it
consistent with the rest of the file and style.Makefile(9) a bit
more

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-02-08 09:24:25 +00:00
Enji Cooper
0a2eff9dd9 Create link from hexdump(3) to sbuf_hexdump(9) as the manpage describes
sbuf_hexdump(9)'s behavior

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-02-08 09:22:35 +00:00
Enji Cooper
696fcb05fb Clarify #includes for hexdump(3) vs sbuf_hexdump(9)
hexdump(3) only requires libutil.h, whereas sbuf_hexdump(9) requires
sys/types.h (for ssize_t) and sys/sbuf.h

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-02-08 09:19:49 +00:00
Enji Cooper
67c58b9926 MFhead@r313433 2017-02-08 08:55:05 +00:00
Adrian Chadd
20724b17b4 [iwm] Remove 1s delay after fw loading. Can't reproduce issues on AC8260.
The 1s delay was added in the update to version 16 fw, where Family 8000
support was added.

Obtained from:	DragonflyBSD commit bb480ca679a7ea530bdca6e41082d5755e9751dc
2017-02-08 07:09:10 +00:00
Adrian Chadd
4b7f1242ad [iwm] SCAN_ABORT_UMAC response doesn't use a wide id
Obtained from:	DragonflyBSD commit cef47a9cbb0a3ce5f18369fed9403d2764884bc2
2017-02-08 07:08:13 +00:00
Adrian Chadd
ab6c171afa [iwm] back this out to version 16 for now.
Since I'm manually playing the dragonflybsd iwm/iwmfw commits forward, I'm ..
well, this.  This right here.
2017-02-08 07:07:23 +00:00
Adrian Chadd
00da819945 [iwm] Recognize the IWM_UCODE_TLV_FW_MEM_SEG firmware section type.
* Will be needed for loading version 22 of 7265D firmware.

Obtained from:	DragonflyBSD commit 1d244c8133cf15d00d46836bc48958188cf9f510
2017-02-08 07:05:56 +00:00
Adrian Chadd
8aee678701 [iwm] bump firmware to version 17. 2017-02-08 07:04:06 +00:00
Adrian Chadd
36b9ae3a05 [iwm] add version 17 firmware. 2017-02-08 07:03:52 +00:00
Adrian Chadd
95b861f576 [iwm] add this 3 megabyte firmware image. 2017-02-08 07:03:09 +00:00
Adrian Chadd
e438d74cd5 [iwm] add version 17 firmware. 2017-02-08 07:02:09 +00:00
Adrian Chadd
df510c9beb [iwm] add version 17 firmware. 2017-02-08 07:01:58 +00:00
Adrian Chadd
738de8f5de [iwm] add version 17 firmware. 2017-02-08 07:01:31 +00:00
Adrian Chadd
4329ac6227 [iwm] Recognize IWM_DTS_MEASUREMENT_NOTIF_WIDE notification.
* Add the command groups enum, and the iwm_phy_ops_subcmd_ids enum
  to if_iwmreg.h definitions.

* The IWM_DTS_MEASUREMENT_NOTIF_WIDE notification will be generated by
  version 17 firmware.

Taken-From: Linux iwlwifi

Obtained from:	DragonflyBSD commit 4d8d6f9def2ffb60aaf2d88f72f069a96c0b4e3f
2017-02-08 06:57:21 +00:00
Adrian Chadd
a717dd3a7f [iwm] Very basic DTS thermal sensor support (prints temp as debug msg).
* Adds IWM_DEBUG_TEMP debug message type, for printing messages related
  to temperature sensors and thermal/TDP infos.

* The firmware regularly sends us DTS measurement notifications, so just
  print the temperature value as a debugging message.

(Adrian's addition):

* Eventually this can be used by the driver to limit transmit rate / power to
  try and do some thermal throttling.

Obtained from:	DragonflyBSD commit efb7d4eb5c3140889a8880e12fd83c7bbfd0059d
2017-02-08 06:56:28 +00:00
Adrian Chadd
d5722aae84 [iwm] Only for family 7000 power-down busmaster DMA clocks when stopping.
Taken-From: Linux iwlwifi

Obtained from:	DragonflyBSD commit 4c45994fcc77373ae2fb0901db15368c9731f641
2017-02-08 06:54:08 +00:00
Adrian Chadd
99baf303e7 [iwm] Implement apmg_wake_up_wa workaround properly for 7000 family.
* Add iwm_pcie_set_cmd_in_flight() and iwm_pcie_clear_cmd_in_flight()
  helper methods.

* Use ring->queued tracking in the command queue to set/clear the
  cmd_hold_nic_awake bit at the right points.

Taken-From: Linux iwlwifi

Obtained from:	DragonflyBSD commit ce43f57f5308b579ea21e8a5a29969114ba2247d
2017-02-08 06:53:23 +00:00
Adrian Chadd
82ba706cba [iwm] Use iwm_mvm_scan_stop_wait to properly abort scans.
* Add IWM_FLAG_SCAN_RUNNING to sc->sc_flags to track whether the firmware
  is currently running a scan, in order to decide wheter iwm_scan_end
  needs to abort a running scan.

* In iwm_scan_end, if the scan is still running, we now abort it, in order
  to keep the firmware scanning state in sync.

* Try to make things a bit simpler, by reacting on the
  IWM_SCAN_OFFLOAD_COMPLETE and IWM_SCAN_COMPLETE_UMAC notifications,
  instead of IWM_SCAN_ITERATION_COMPLETE and
  IWM_SCAN_ITERATION_COMPLETE_UMAC. This should be fine since we always
  only tell the firmware to do a single scan iteration anyway.

Obtained from:	DragonflyBSD commit 1f249c981c4e89e7cde1836a75b61cac36dc7ac5
2017-02-08 06:50:59 +00:00
Adrian Chadd
4b17c18882 [iwm] Add scan abort functions, to properly cancel a running scan.
* Uses the notification wait api to wait for the corresponding scan
  complete notification after sending the abort command.

Taken-From: Linux iwlwifi

Obtained from:	DragonflyBSD commit b484d09d54301740f036ddf02008117f563960c2
2017-02-08 06:44:50 +00:00
Adrian Chadd
760f56b7b8 [iwm] Get rid of iwm_disable_rx_dma, just use iwm_pcie_rx_stop directly.
* This also fixes one of many small nic lock handling bugs, and matches
  iwlwifi's code.

Obtained from:	DragonflyBSD git 50787d03cd0a0366c9cc4a055bb6977e5f65c85d
2017-02-08 06:43:02 +00:00
Justin Hibbits
9569e13dce Add elf*-powerpc-freebsd targets to the elftoolchain target list
FreeBSD uses the full target triple when generating embedded rootfs images
(MFS_IMAGE= make option).  Without this change objcopy errors out with:

objcopy: elf64-poewrpc-freebsd: invalid target name

MFC after:	2 weeks
2017-02-08 03:21:29 +00:00
Ravi Pokala
0ee82391df Fix indentation (only line in file w/ 8-space indent rather than hard-tab).
MFH:		1 week
2017-02-08 00:02:54 +00:00
John Baldwin
dcbe5188da Defer startup of gjournal switcher kproc.
Don't start switcher kproc until the first GEOM is created.

Reviewed by:	pjd
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8576
2017-02-07 22:45:59 +00:00
John Baldwin
885f13dc96 Copy the e_machine and e_flags fields from the binary into an ELF core dump.
In the kernel, cache the machine and flags fields from ELF header to use in
the ELF header of a core dump. For gcore, the copy these fields over from
the ELF header in the binary.

This matters for platforms which encode ABI information in the flags field
(such as o32 vs n32 on MIPS).

Reviewed by:	kib
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D9392
2017-02-07 20:34:03 +00:00
Enji Cooper
9ddd071605 MFhead@r313404 2017-02-07 19:47:30 +00:00
Enji Cooper
da9813b9ea Remove placeholder compat header for stdio.h
In the end, dealing with fparseln was more bikeshed worthy than I
anticipated, and polling stdio.h with libutil.h caused me more
grief than necessary. Keeping the compat header around for no
reason other than include_next'ing the stdio.h header in FreeBSD
makes no sense.
2017-02-07 19:47:04 +00:00
Enji Cooper
e0f389edab Improve libnetbsd compatibility with NetBSD
This change is being made to diff reduce/reduce duplication in
contrib/netbsd-tests and to facilitate further porting of software from
NetBSD

Add the following headers:
- sys/event.h:
-- sys/types.h is required for kqueue on FreeBSD, but not NetBSD.
- sys/types.h:
-- NBBY is defined in sys/param.h on FreeBSD, not sys/types.h like on NetBSD.
   Pull in sys/param.h to have parity with NetBSD.
- sys/wait.h:
-- Define wrusage as __wrusage for parity with NetBSD typedef.
- glob.h
-- Define __gl_stat_t as "struct stat" for parity with NetBSD typedef.
- pthread.h:
-- Pull in pthread_np.h for _np functions defined separately on FreeBSD.

Improve compatibility with NetBSD in the following headers:

- sha1.h:
-- define SHA1_CTX as SHA_CTX
-- define SHA1Final as SHA1_Final
- sha2.h:
-- #include sha384 to pick up all of the SHA 384 bit macros and definitions.
- util.h:
-- Add sys/types.h to util.h to pollute the header for types used in
   flags_to_string and string_to_flags (u_long) as NetBSD doesn't require them
   for the functions.

MFC after:      2 weeks
Sponsored by:   Dell EMC Isilon
2017-02-07 19:42:41 +00:00