Commit Graph

195653 Commits

Author SHA1 Message Date
Warner Losh
61f26cae7d Where appropriate, use the modern terms for the one true time base
(UTC) rather than the archaic (GMT) in comments. Except where the
comments are making fun of people doing this (and pedants who insist
on the new terms).
2014-12-21 05:07:11 +00:00
Adrian Chadd
1de34f860e Update ieee80211_sta_tim_notify() to do double duty - handle STA sleep
to awake transition as well as handle waking up a VAP in STA powersave
mode if it's in bgscan.

This was a reasonably hairy bug to try and figure out and it became
more obvious because of stuff I've done.

Specifically:

* a NIC would go into bgscan mode - either because of a bgscan timer
  or wpa_supplicant asked it to;
* the AP would indicate there's traffic for the STA by setting the TIM
  bitmap bit for it;
* mindwell would be met during scan, so it'd wake up and break out of
  the scan loop in scan_task(), but
* because the scan wasn't completed, it wouldn't bring the VAP out of
  STA mode powersave (so it wouldn't tell the AP about it and it would
  block VAP TX);
* .. but because we kept seeing the TIM bit set, ic->ic_lastdata was
  being constantly updated, and ..
* bgscancont() would thus never say "yes we can continue a bgscan"
  so the bgscan would hang and never make progress.

Now, I do see this particular state occur on iwn(4) - /however/ -
this NIC has the firmware call ieee80211_scan_next() once the firmware
scan for that channel has completed.  This has the effect of moving
the scan along to the next channel.  I do see the debug that I'm adding
where we see a beacon with a TIM bit set whilst we're in bgscan, so
the condition about waking up to receive traffic is triggering.
It just won't cause a hang.

For other NICs - all of the USB ones and at least ath(4) -
ieee80211_scan_next() / ieee80211_scan_done() isn't called.
So it relies upon the mindwell timer, the beacon receive and the
beacon / probe response -> ieee80211_add_scan() to move along
the scan state.

In the above case, mindwell triggered, there's no beacons triggering
the scan_add code to move things along, and we weren't waking things
up when seeing the TIM set for us.  So it just hung until the interface
was dropped.

So, the short-term fix here is to do what the comment in scan_task()
says - if we are in bgscan mode and we see our TIM bit set, just wake
up the VAP.  If it's already awake then it's a nop.  If we're awake
then we transition to awake and handle the traffic.  Once there's no
TX or RX traffic going on, ic->ic_lastdata won't be updated anymore
and bgscancont() will continue.

This was triggered more often after my initial SLEEP state handling
for software sleep states - because now I update ic->ic_lastdata
upon seeing a TIM bit set, not just the RX of the subsequent traffic.
That's needed so the thing doesn't ping-pong up and down between
seeing the TIM bit set, sending the "I'm awake" NULL data frame, and
starting to receive data from the AP.

I'd like to subsequently split ic_lastdata into two - one for TX and
one for RX - so it becomes easier to use the correct one (or both!)
when making decisions like whether to scan, go to sleep, etc.

I'd appreciate this getting some further testing.

Tested:

* rsu(4), STA mode, bgscan on
* iwn(4), STA mode, bgscan on
2014-12-21 04:58:45 +00:00
Adrian Chadd
3b00b9a60a Break out the unicast/multicast TIM bit setting into "set something
that indicates we have traffic" bit and a "do something if we have
traffic bit."

I'm going to be fleshing out this stuff more over time and it'll make
more sense to have it broken out into two pieces here.
2014-12-21 04:48:54 +00:00
Adrian Chadd
2c6179401b Add more debugging to try and track down this scan hang nonsense. 2014-12-21 01:15:55 +00:00
Adrian Chadd
f13a4d33ef Add some more debugging to the scan cancel methods - I'd like to see
what situations would cause the scan cancel's to not complete.
2014-12-20 23:41:37 +00:00
Gleb Smirnoff
e834a84026 Revert r274494, r274712, r275955 and provide extra comments explaining
why there could appear a zero-sized mbufs in socket buffers.

A proper fix would be to divorce record socket buffers and stream
socket buffers, and divorce pru_send that accepts normal data from
pru_send that accepts control data.
2014-12-20 22:12:04 +00:00
Michael Tuexen
b03b5d729a Fix and harmonize the validation of PR-SCTP policies.
Reported by:	Coverity
CID:		1232044
MFC after:	3 days
2014-12-20 21:17:28 +00:00
Adrian Chadd
e54c8bda3e Remove some hard-coded IE assembly over to use net80211 methods.
PR:		kern/196069
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2014-12-20 20:07:48 +00:00
Neel Natu
d66bcddce4 Emulate writes to the IA32_MISC_ENABLE MSR.
PR:		196093
Reported by:	db
Tested by:	db
Discussed with:	grehan
MFC after:	1 week
2014-12-20 19:47:51 +00:00
Adrian Chadd
92c59ab94f Document where in scan_task the scan state can change, and potentially
deal/log a warning if the scan flags change during one of those race
windows.

It's highly likely that I need to actually sit down and replace this
scan infrastructure at some point.  It has some other side effects too -
the scan task is a blocking task scheduled in the net80211 taskqueue;
so drivers that use this taskqueue have other things not run.  Eek.

If you see this printf happen then please let me know!
2014-12-20 19:41:31 +00:00
Rui Paulo
b9450e431d Driver for CPU frequency/voltage control on the Raspberry Pi.
Differential Revision:	https://reviews.freebsd.org/D1025
Submitted by:	Daisuke Aoyama aoyama@peach.ne.jp
Reviewed by:	ian (earlier version), rpaulo
MFC after:	1 month
Relnotes:	yes
2014-12-20 19:15:10 +00:00
Andrew Turner
9b2655e094 Clean up the style of the CUBIEBOARD2 config file 2014-12-20 18:42:20 +00:00
Andrew Turner
d943b9a337 Clean up to use the standard style of "options \t" and "device\t\t" 2014-12-20 18:15:23 +00:00
Konstantin Belousov
77b14d8df1 Increase allowed size of the microcode blob to 32KB. Some Intel CPU's
updates weight 28KB.

PR:	179523
MFC after:	1 week
2014-12-20 16:40:49 +00:00
Alexander Motin
83c25ce791 Report initiator id in portlist XML in more formalized way.
MFC after:	3 days
2014-12-20 16:39:56 +00:00
Alexander Motin
fcb263a5fc Report XML parsing errors.
MFC after:	3 days
2014-12-20 16:13:31 +00:00
Gleb Smirnoff
b7413232f6 Add to sbappendstream_locked() a check against NULL mbuf, like it is done
in sbappend_locked() and sbappendrecord_locked().

This is a quick fix to the panic introduced by r274712.

A proper solution should be to make sosend_generic() avoid calling
pru_send() with NULL mbuf for the protocols that do not understand
control messages. Those protocols that understand control messages,
should be able to receive NULL mbuf, if control is non-NULL.
2014-12-20 14:19:46 +00:00
Michael Tuexen
ca10a8d944 Cleanup the code.
Reported by:	Coverity
CID:		1232003
2014-12-20 13:47:38 +00:00
Alexander Motin
e7038eb747 Replace ctl_min() macro with MIN().
MFC after:	1 week
2014-12-20 13:33:31 +00:00
Neel Natu
ac721e53ec Various 8259 device model improvements:
- implement 8259 "polled" mode.
- set 'atpic->sfn' if bit 4 in ICW4 is set during master initialization.
- report error if guest tries to enable the "special mask" mode.

Differential Revision:	https://reviews.freebsd.org/D1328
Reviewed by:		tychon
Reported by:		grehan
Tested by:		grehan
MFC after:		1 week
2014-12-20 04:57:45 +00:00
Ian Lepore
dc47198f50 Log mmc and sd command failures. Reporting of routine expected errors,
such as timeouts while probing a bus or testing for a feature, is
squelched.  Also, error reporting is limited to 5 events per second,
because when an sdcard goes bad on a low-end embedded board, flooding
the console at high speed isn't helpful.

Original logging code contributed by Michal Meloun, but then I fancied
it up with squelching and ppsratecheck.
2014-12-20 04:24:40 +00:00
Ian Lepore
61bc42f782 Add a new sdhci quirk, SDHCI_QUIRK_WAITFOR_RESET_ASSERTED, to work around
TI OMAP controllers which will return the reset-in-progress bit as zero if
you read the status register too fast after setting the reset bit.

The zero is apparently from a stale snapshot of the internal state presented
in the interface register, and leads to a false indication that the reset
is complete when it either hasn't started yet or is in-progress.  The
workaround is to first loop until the bit is seen as asserted, then do the
normal loop waiting to see it de-asserted.

Submitted by:	Michal Meloun <meloun@miracle.cz>
2014-12-20 01:13:13 +00:00
Ian Lepore
7e5866432f When command and data interrupts have been aggregated together, don't do
the data-completed processing if a command-error interrupt is also asserted.

Reviewed by:	Michal Meloun <meloun@miracle.cz>
2014-12-20 00:37:56 +00:00
Warner Losh
cf26c00351 Remove comments relevant to 6.x only. 2014-12-20 00:07:53 +00:00
Warner Losh
0acf08d985 Remove support for FreeBSD 7 and really old FreeBSD 8. The classifiers
have been in the base for a while, so the gymnastics here aren't
needed. In addition, the bugs in subr_disk.c have been fixed since
2009, so there's no need for an identical copy of it in the tree
anymore. There's really no need to binary patch g_io_request, so let's
get rid of the code (not compiled in anymore) lest others think it is
a good idea.
2014-12-20 00:04:01 +00:00
Ian Lepore
a5d3a7fba9 Rewrap long lines; no functional changes.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2014-12-19 23:24:54 +00:00
Ian Lepore
7a8f993664 Add code to set and reset open-drain mode on the bus when requested.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2014-12-19 23:13:46 +00:00
Alexander Motin
0664680536 Constify some static data.
MFC after:	2 weeks
2014-12-19 20:51:54 +00:00
Alexander Motin
9602f43616 Reduce number of places where global control_softc is used.
At some point we may want to have several CTL instances, and that is not
really impossible.

MFC after:	2 weeks
2014-12-19 20:35:06 +00:00
Benno Rice
6d659a5d9b Adjust the test of a KASSERT to better match the intent.
This assertion was added in r246213 as a guard against corrupted mbufs
arriving from drivers, the key distinguishing factor of said mbufs being
that they had a negative length. Given we're in a while loop specifically
designed to skip over zero-length mbufs, panicking on a zero-length mbuf
seems incorrect.

No objection from:	kib
2014-12-19 19:09:22 +00:00
Warner Losh
e808299c02 Bump the largest record we can cope with from 1k to 8k. Other users of
the hints file don't have any real limits, and longer records will
need to be written shortly.
2014-12-19 18:45:52 +00:00
Andrew Turner
30ef1a05c2 Add support for empty ranges properties within the tree, some vendor
device trees have these, for example the ARM AArch64 Foundation Model.

Sponsored by:	The FreeBSD Foundation
2014-12-19 13:07:36 +00:00
Ruslan Bukin
ac4203e2ab Correct the end address of the memory regions.
Pointed out by:	ian
2014-12-19 12:09:29 +00:00
Li-Wen Hsu
cf56c6b846 Fix make depend in sys/modules
Differential Revision:	https://reviews.freebsd.org/D1338
Reviewed by:	delphij
Approved by:	delphij
2014-12-19 06:51:01 +00:00
Xin LI
cfbebadc60 Plug a memory leak.
Obtained from:	DragonFlyBSD (commit 5119ece)
MFC after:	2 weeks
2014-12-19 06:48:47 +00:00
Adrian Chadd
bbd01a4100 Remove a private copy of ieee80211_add_ssid().
PR:		kern/196116
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2014-12-19 01:41:51 +00:00
Adrian Chadd
de981aecde Make ieee80211_add_ssid() public.
Some drivers use private copies of this.

PR:		kern/196116
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2014-12-19 01:39:58 +00:00
Alexander Motin
3f9e1172b7 Slightly polish iSCSI parameters negotiation.
MFC after:	1 week
2014-12-19 01:12:22 +00:00
Xin LI
62722f7d5b Add missing continue: we can't proceed further if the
kernel does not panic with zfs_panic_recover.

Illumos issue:
    5438 zfs_blkptr_verify should continue after zfs_panic_recover

Reported by:	Coverity
CID:		1232014
2014-12-19 00:20:29 +00:00
Xin LI
7d073f8411 MFV r275914:
As of r270383, the dbuf_compare comparator compares the dbuf
attributes in the following order:

	db_level (indirect level)
	db_blkid (block number)
	db_state (current state)
	the address of the element

Because db_state is being considered before the element's state,
changing of db_state would affect balancedness of the AVL tree,
even when the address of element compares differently.  For
instance, in dbuf_create, db_state may be altered after the
node is inserted into the AVL tree and may break AVL tree
balancedness.

Instead of using db_state as a comparision critera (introduced
in r270383), consider it only when we are doing a lookup, that
is one of the two dbuf pointers contains DB_SEARCH.

Illumos issue:
    5422 preserve AVL invariants in dn_dbufs

MFC after:	2 weeks
2014-12-18 23:45:26 +00:00
Alexander Motin
cb8727e23a Pass real optimal transfer size supported by backend.
For files and ZVOLs that is 1MB now, not 128K.

MFC after:	1 week
2014-12-18 22:32:22 +00:00
Xin LI
bf855dd342 Sync with NetBSD, mainly address NetBSD bug #43355:
Fix valid_format() to be more careful about allowing only valid
printf formats.

Obtained from:	NetBSD
MFC after:	2 weeks
2014-12-18 20:23:19 +00:00
Ed Maste
17eee5222e Include section name in strip warning message 2014-12-18 19:09:59 +00:00
Xin LI
cce363922b 5422 preserve AVL invariants in dn_dbufs
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alex Reece <alex@delphix.com>

illumos/illumos-gate@a846f19d27
2014-12-18 18:59:26 +00:00
Enji Cooper
9e7d291e9a Fix accidental MK_DEBUG_FILES=no addition to NXBMAKE in r275909
X-MFC with: r275909
Sponsored by: EMC / Isilon Storage Division
2014-12-18 18:30:33 +00:00
Enji Cooper
c8ed1da7c3 Don't build full clang toolchain or clang extras in stages 1-3 of buildworld
MFC after: 1 week
Reviewed by: dim (as part of a "larger" diff)
Phabric: D1336
Sponsored by: EMC / Isilon Storage Division
2014-12-18 18:26:10 +00:00
Enji Cooper
3547290f1d Document STRIP_CMD in build(7) and note its importance with LOCAL_ITOOLS
MFC after: 1 week
Phabric: D1335
Reviewed by: brueffer
Sponsored by: EMC / Isilon Storage Division
2014-12-18 18:20:33 +00:00
Enji Cooper
f703589ef4 Fix building/installing tests when TESTSBASE != /usr/tests
The work in r258233 hardcoded the assumption that tests was the last component
of the tests tree by pushing tests as an explicit prefix for the paths in
BSD.tests.dist and /usr was the prefix for all tests, per BSD.usr.dist and all
of the mtree calls used in Makefile.inc1. This assumption breaks if/when one
provides a custom TESTSBASE "prefix", e.g. TESTSBASE=/mytests .

One thing that r258233 did properly though was remove "/usr/tests" creation
from BSD.usr.dist -- that should have not been there in the first place. That
was an "oops" on my part for the work that was originally committed in r241823

MFC after: 2 weeks
Phabric: D1301
Reviewed by: imp
Sponsored by: EMC / Isilon Storage Division
2014-12-18 18:16:00 +00:00
Jamie Gritton
eb28afe422 Setgid before running a command as a specified user. Previously only
initgroups(3) was called, what isn't quite enough.  This brings jail(8)
in line with jexec(8), which was already doing the right thing.

PR:		195984
MFC after:	1 week
2014-12-18 18:10:39 +00:00
Warner Losh
b9a2a3f1cf Don't deselect the card too soon. To set the block size or switch the
function parameters, the card has to be in transfer state. If it is in
the idle state, the commands are ignored. This caused us not to set
the proper parameters that we later assume to be present, leading to
downstream failures of the card / interface as our state machine
mismatches the card's.

Submitted by: Svatopluk Kraus <onwahe at gmail.com>, Michal Meloun
<meloun at miracle.cz>
2014-12-18 16:57:22 +00:00