Commit Graph

1096 Commits

Author SHA1 Message Date
Adrian Chadd
b8e29e065d [net80211] migrate the time_* macros to ieee80211_* namespace.
It turns out that these will clash very annoyingly with the linux
macros in the linuxkpi layer, so let the wookie^Wlinux win.

The only user that I can find is ath(4), so fix it there too.
2016-03-30 00:44:10 +00:00
Adrian Chadd
275b79bd9b [net80211] Add fields to decode uAPSD fields.
It turns out that madwifi actually has the basics for uAPSD implemented
but it was never ported to FreeBSD.  I may eventually port most of the
pieces; I'll see how it goes!

Obtained from:	Madwifi
2016-03-30 00:42:18 +00:00
Andriy Voskoboinyk
9b56252e4d net80211: fix panic for DWDS vaps
Since r248069, TX IC lock must obtained before calling ieee80211_encap()
and/or ieee80211_parent_xmitpkt().

Tested with: Intel 3945BG.
2016-03-26 08:59:56 +00:00
Adrian Chadd
0d66701783 [net80211] add missing static declarations.
Submitted by:	Sascha Wildner <saw@online.de>
Obtained from:	dragonflybsd (https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/822aeeabc8c4c074deea46383f36e6d1cdcd19f5)
2016-03-22 22:07:14 +00:00
Andriy Voskoboinyk
d8c364fbed net80211: enable software beacon miss timer in SLEEP state
Tested with WUSB54GC, STA mode (w/ power saving enabled)

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D5545
2016-03-21 20:52:09 +00:00
Andriy Voskoboinyk
8a54c0614b net80211: add missing SLEEP -> AUTH state transition for station mode.
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D5269
2016-03-21 20:39:45 +00:00
Adrian Chadd
e4d96dcfad [net80211] Add VHT Transmit Power Envelope element - 802.11ac-2013 8.4.2.164
This .. seems inconsistently transmitted from various vendors.
2016-03-19 04:37:33 +00:00
Adrian Chadd
f3e24d74a7 [net80211] IE 127 is not MESHEXTCAP, just EXTCAP.
It's not a mesh extended capabilities; it's just extended capabilities.
This is from 802.11-2012 8.4.2.29 (Extended Capabilities element.)
2016-03-18 04:00:57 +00:00
Adrian Chadd
e426a812db Add initial 802.11ac IEs and fields.
This is a subset of what's in the linux 802.11ac implementation.

I've verified that the bits that mention an 802.11ac draft are
still the same in 802.11ac-2013 and noted it accordingly.

This is for the most part one big no-op.

Obtained from:	802.11ac-2013.pdf
2016-03-18 03:55:00 +00:00
Adrian Chadd
4215404617 [net80211] Add some more missing IEs.
There are a /lot/ more missing; I'll chase these down over time.

Obtained from:	802.11-2012 standard
2016-03-17 01:09:21 +00:00
Adrian Chadd
8abb337a01 Add initial VHT IE's and action codes.
Yes, there's more to 802.11ac than this.
2016-03-16 06:26:50 +00:00
Adrian Chadd
73931706e7 [net80211] Begin implementing rate control module stats.
* Implement a new ratectl method, which defaults to returning nothing;
* Add a top level sysctl (net.wlan.X.rate_stats) to extract it;
* Add ratectl info for the 'amrr' module.

Tested:

* urtwn(4), STA mode

Differential Revision:	https://reviews.freebsd.org/D5630
2016-03-16 02:07:04 +00:00
Adrian Chadd
23ed552b40 class -> i_class. Thanks C++.
Noticed by: jbeich@
2016-03-14 16:52:05 +00:00
Adrian Chadd
523210fbaf [net80211] handle unlisted information elements.
This displays the IE names in ifconfig but it doesn't yet decode things.

Submitted by: Idwer Vollering <vidwer@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3782
2016-03-14 04:39:35 +00:00
Andriy Voskoboinyk
5a6b5f3c69 net80211: fix possible overflow in IEEE80211_TU_TO_TICKS()
For hz=1000 any number, greater than 4194 causes integer overflow;
this change casts the number to uint64_t before operating with it.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5268
2016-03-04 21:22:11 +00:00
Andriy Voskoboinyk
467f437b43 net80211: drop <smth> -> INIT state transition warning (STA mode only)
This warning is irrelevant, since user can execute
'ifconfig wlan0 down' (or turn off card via rfkill switch) at any time.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5511
2016-03-03 19:53:46 +00:00
Mark Johnston
f6ed0a3918 Use m_catpkt(9) to avoid a possible use-after-free in ieee80211_defrag().
m is not guaranteed to be valid after m_cat() returns. The effects of this
are most noticeable when INVARIANTS is enabled, since m's header length
field is given a value of 0xdeadc0de by the trash dtor.

Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D5497
2016-03-02 05:01:58 +00:00
Andriy Voskoboinyk
1ffa8d7ef1 net80211: eliminate copy-paste nearby ieee80211_check_rxseq()
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4043
2016-03-01 06:47:21 +00:00
Gleb Smirnoff
e7c563ed4a Fix !IEEE80211_DEBUG build. 2016-02-29 23:09:31 +00:00
Andriy Voskoboinyk
13fe5bad1f net80211: do not enforce promiscuous mode for AP scan
Drivers should set their own filters via ic_scan_start()/ic_scan_end()
callbacks; and we don't need frames other than beacons or probe responses.

(Note: this was a noop since r287197 due to promiscuous mode with bridge
workaround)

Tested with Intel 3945BG, RTL8188EU and WUSB54GC in HOSTAP mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5474
2016-02-29 21:17:39 +00:00
Andriy Voskoboinyk
d13806f4a9 net80211: fix scanning after D5145 (PR 197498 related)
- In case, when we are doing <smth> -> INIT (FEXT_REINIT) -> <smth2>
state transition, cancel_scan() may be called in the first transition.
Reenqueue second state transition, so things will be executed in order.
- Discard any AUTH+ state transition request when INIT -> SCAN
transition is not done.
- Allow to track discarded state transitions via 'state' debugging
category.

Tested with:
 * RTL8188EU, HOSTAP mode.
 * RTL8188CUS, STA mode.
 * Intel 3945BG, IBSS and STA modes.

PR:		197498
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5482
2016-02-29 21:09:09 +00:00
Andriy Voskoboinyk
61ffca6c0a net80211: cleanup ieee80211_scan_sw.c
Make it look more consistently.
No functional changes.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5152
2016-02-29 21:03:54 +00:00
Andriy Voskoboinyk
f4f4f6a197 net80211: refactor scan_signal()
- Pass scan state and additional internal flags as a parameters.
- Add locked version.

Tested with:
 * Intel 3945BG, STA mode.
 * RTL8188EU, STA mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5148
2016-02-29 21:00:10 +00:00
Andriy Voskoboinyk
9f82bedaa1 net80211: wakeup scan_start() task when null data frame was actually
transmitted

- Use M_TXCB mechanism to report about null data frame transmission.
- Increase timeout from 1 to 10 ms (the previous one may be not enough
for non-empty queue).

Tested with:
 * Intel 3945BG, STA mode.
 * RTL8188CUS, STA mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5147
2016-02-29 20:56:02 +00:00
Andriy Voskoboinyk
551f27f37a net80211: split scan_task() (#3) (into scan_start() and
scan_curchan_task() functions)

(This part should fix the problem, described in
https://lists.freebsd.org/pipermail/freebsd-wireless/2016-January/006420.html)

- Rename ss_scan_task into ss_scan_start (better describes it's
current purpose)
- Utilize taskqueue_*_timeout() functions instead of current mechanism:
 * reschedule scan_curchan_task() via taskqueue_enqueue_timeout()
for every 'maxdwell' msecs (will replace infinite loop + sleeping
for 'maxdwell' period via cv_wait());
 * rerun the task immediately when an external event occurs
(instead of waking it up via cv_signal())

Also, use mtx_sleep() to wait for null frame transmission
(allows to drop conditional variable).

Tested with:
 * Intel 3945BG, STA mode;
 * RTL8188EU, STA mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5145
2016-02-29 20:53:27 +00:00
Andriy Voskoboinyk
01606a7103 net80211: split scan_task() (#2) (add scan_end() function)
Tested with:
 * Intel 3945BG, STA mode.
 * RTL8188EU, IBSS mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5143
2016-02-29 20:47:07 +00:00
Andriy Voskoboinyk
2113f707fa net80211: split scan_task() (#1) (replace 'done' label with scan_done()
function)

Tested with:
 * Intel 3945BG, STA mode.
 * RTL8188EU, IBSS mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5142
2016-02-29 20:44:59 +00:00
Andriy Voskoboinyk
53f521ef1c net80211: utilize ss_scanend variable from scan_state structure
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5140
2016-02-29 20:41:10 +00:00
Andriy Voskoboinyk
cafdaf03d9 net80211: reduce code verbosity in scan_task() (ieee80211_scan_sw.c)
Add local *ss_priv variable (no functional changes)

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5139
2016-02-29 20:39:04 +00:00
Andriy Voskoboinyk
04f91953f3 net80211: reduce code duplication between ieee80211_swscan_cancel_scan()
and ieee80211_swscan_cancel_anyscan()

Tested with:
 * Intel 3945BG, STA mode.
 * RTL8188EU, HOSTAP mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5133
2016-02-29 20:36:00 +00:00
Andriy Voskoboinyk
f10bbaa78c net80211: fix a comment for TX lock
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5476
2016-02-28 23:52:33 +00:00
Andriy Voskoboinyk
c6427be92b net80211: remove redundant locking.
All callers of ieee80211_promisc()/ieee80211_allmulti()
(ieee80211_vap_detach(), ieee80211_ioctl(), ap_start() and ap_end())
already hold the com_lock while calling them.

Tested with RTL8188EU, STA mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5475
2016-02-28 23:48:34 +00:00
Andriy Voskoboinyk
60d75eb64c net80211: fix 'taskqueue_drain with non-sleepable locks held' warning
Do not run ieee80211_waitfor_parent() when it's not needed.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5446
2016-02-28 23:35:03 +00:00
Andriy Voskoboinyk
f09a089ee6 net80211: fix 'uma_zalloc_arg: zone "32" with non-sleepable locks held'
when 'sysctl net.wlan.devices' is executed.

PR:		207497
Submitted by:	glebius
Approved by:	adrian (mentor)
2016-02-26 20:47:08 +00:00
Andriy Voskoboinyk
ffadb4acda net80211: fix TIM cleanup.
Remove duplicate 'ni->ni_associd = 0' assignment from
ieee80211_node_leave(), since it breaks iv_set_tim() in
ic->ic_node_cleanup() (associd is cleared right after this call).

Tested with RTL8188EU (HOSTAP mode) and
WUSB54GC (STA mode, with powersaving enabled).

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5398
2016-02-23 21:11:42 +00:00
Andriy Voskoboinyk
665d5ae9a2 net80211: add few missing subtype names.
- Add definitions for Timing Advertisement and Control Wrapper frames.
- Refresh ieee80211_mgt_subtype_name and ieee80211_ctl_subtype_name
arrays.
- Count Timing Advertisement frames as discarded management frames in all
modes.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5331
2016-02-19 05:59:38 +00:00
Gleb Smirnoff
8ec07310fa These files were getting sys/malloc.h and vm/uma.h with header pollution
via sys/mbuf.h
2016-02-01 17:41:21 +00:00
Andriy Voskoboinyk
74bdb73190 net80211: reduce stack usage for ieee80211_ioctl*() methods.
Use malloc(9) for
 - struct ieee80211req_wpaie2 (518 bytes, used in
ieee80211_ioctl_getwpaie())
 - struct ieee80211_scan_req (128 bytes, used in setmlme_assoc_adhoc()
and ieee80211_ioctl_scanreq())

Also, drop __noinline workarounds; stack overflow is not reproducible
with recent compilers.

Tested with Clang 3.7.1, GCC 4.2.1 (from 9.3-RELEASE) and 4.9.4
(with -fstack-usage flag)

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5041
2016-01-24 23:35:20 +00:00
Andriy Voskoboinyk
536e056030 net80211: reduce code duplication
Do not duplicate code between IEEE80211_IOC_WPAIE and IEEE80211_IOC_WPAIE2
switch cases.

Approved by:	adrian (mentor)
Differential Revision:	D5041 (part)
2016-01-24 23:28:14 +00:00
Alexander V. Chernikov
ea8d14925c Remove sys/eventhandler.h from net/route.h
Reviewed by:	ae
2016-01-09 09:34:39 +00:00
Adrian Chadd
098b3fe173 [net80211] fix duration field; it's unsigned, but not long.
Submitted by:	Imre Vadasz <imre@vdsz.com>
Obtained from:	DragonflyBSD
2016-01-04 17:17:06 +00:00
Adrian Chadd
80d653987b [net80211] document the (not completely complete) set of places where
we're assuming hz=1000 and not gracefully handling when it isn't.

The math involved will return 0 for hz < 1000, which it is on some
platforms and on DragonflyBSD.

This doesn't fix it, it:

* converts one manual use over to use the macro, and
* comments where it needs some thought/fixing.

I'll think about this a bit more before fixing it.

Submitted by:	imre@vdsz.com
2016-01-01 00:21:07 +00:00
Andriy Voskoboinyk
bdfff33ff6 net80211: remove hardcoded slot time durations from drivers
- Add IEEE80211_GET_SLOTTIME(ic) macro.
- Use predefined macroses to set slot time.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4044
2015-12-13 20:48:24 +00:00
Adrian Chadd
913565851c [net80211] decode WPA cipher config '0' as "clear cipher config".
wpa_supplicant actually calls the wpa ioctl with cipher 0 as part
of the teardown process and this returns an ioctl error.

It's required as part of the (hopefully!) upcoming encrypted
IBSS support which does indeed do the above as part of interface
setup and then exits ungracefully when it gets an ioctl error.

(I'll fix wpa_supplicant in a later commit as part of other work.)
2015-11-26 01:54:58 +00:00
Adrian Chadd
75426752f5 [net80211] log the A-MPDU setup attempt count as part of debugging.
I've seen some cases where we get stuck in a loop constantly trying to
negotiate A-MPDU TX which is definitely not supposed to happen.
This will let me see if it's something funky with the retry count or
not.
2015-11-25 18:16:42 +00:00
Andriy Voskoboinyk
4061c639f0 net80211: add ieee80211_restart_all() call.
This call may be used when device cannot continue to operate normally
(e.g., throws firmware error, watchdog timer expires)
and need to be restarted.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D3998
2015-10-27 20:40:57 +00:00
Adrian Chadd
d957a93abe net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ieee80211_raw_output().
This doesn't free the mbuf upon error; the driver ic_raw_xmit method is still
doing that.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3774
2015-10-12 04:55:20 +00:00
Adrian Chadd
d3a4ade3b8 net80211: free node reference in the ieee80211_parent_xmitpkt() when error happened.
Move error handling into ieee80211_parent_xmitpkt() instead of spreading it
between functions.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3772
2015-10-12 04:30:38 +00:00
Adrian Chadd
d07be335a0 net80211: separate mbuf cleanup from ieee80211_fragment()
* Create ieee80211_free_mbuf() which frees a list of mbufs.
* Use it in the fragment transmit path and ath / uath transmit paths.
* Call it in xmit_pkt() if the transmission fails; otherwise fragments
  may be leaked.

This should be a big no-op.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3769
2015-10-12 03:27:08 +00:00
Adrian Chadd
fa46d9db82 net80211: reduce code duplication in the ieee80211_ioctl_setwmeparam() + fix comments.
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3701
2015-10-03 22:38:08 +00:00