Commit Graph

1135 Commits

Author SHA1 Message Date
Bjoern A. Zeeb
2e9090dfbe Revert parts of r299575 in order to make more MIPS kernels build
again hopefully.
Rather than blindly removing a supposedly unused variable as reported by
the Clang Static Analyzer, inspect the code and hide them with proper
#ifdefs as they are used in certain conditional parts of the code.
2016-05-14 08:54:34 +00:00
Andriy Voskoboinyk
601a2543a0 net80211: drop some unused variables / local macros
Most of them left after some commits (r178354, r191544, r287197 etc.);
some were never used.

Found by:	Clang Static Analyzer
2016-05-12 22:17:00 +00:00
Andriy Voskoboinyk
82731f79a3 net80211: restore 'iflladdr_event' event handler.
Now 'ether' argument to ifconfig can be used as an alias to 'wlanaddr'.

PR:		208933
2016-05-06 11:41:49 +00:00
Andriy Voskoboinyk
b134c5824b net80211: do not hardcode size of ic_modecaps field. 2016-05-04 17:22:35 +00:00
Adrian Chadd
ced0a8950a [net80211] add extra debugging around negotiated A-MPDU parameters. 2016-05-04 16:42:53 +00:00
Pedro F. Giffuni
a4641f4eaa sys/net*: minor spelling fixes.
No functional change.
2016-05-03 18:05:43 +00:00
Andriy Voskoboinyk
c6a35ee46c net80211: fix MAC address change via SIOCSIFLLADDR ioctl.
Recheck MAC address on SIOCSIFFLAGS; as a result,
'ifconfig wlan0 ether <addr>' can be used after interface startup.

PR:		208933
2016-05-02 20:46:05 +00:00
Andriy Voskoboinyk
88a755106d net80211: calculate IEEE80211_MODE_BYTES / IEEE80211_CHAN_BYTES
instead of hardcoding it.

Suggested by:	adrian
2016-05-01 20:57:10 +00:00
Andriy Voskoboinyk
a061fea6ee net80211 + drivers: hide size of 'bands' array behind a macro.
Auto-replace 'howmany(IEEE80211_MODE_MAX, 8)' with 'IEEE80211_MODE_BYTES'.
No functional changes.
2016-04-29 22:14:11 +00:00
Andriy Voskoboinyk
355fec4842 net80211: provide a set of ieee80211_add_channel*() functions
This change adds few methods for net80211 channel table setup:

- ieee80211_add_channel()
- ieee80211_add_channel_ht40()
(primarily for drivers, that parse EEPROM to get channel list -
they will allow to hide implementation details).

- ieee80211_add_channel_list_2ghz()
- ieee80211_add_channel_list_5ghz()
(mostly as a replacement for ieee80211_init_channels() - they will allow
to specify non-default channel list; may be used in ic_getradiocaps()).

Tested with wpi(4) (add_channel) and rum(4) (add_channel_list_2ghz).

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D6124
2016-04-29 21:18:14 +00:00
Adrian Chadd
f466fcd2cd [net80211] fix indenting.
Sponsored by:	Eva Automation, Inc.
2016-04-28 20:30:49 +00:00
Adrian Chadd
9b40530293 [net80211] handle action frames in adhoc mode from the node that created the BSS.
We don't have a separate bss node; instead we dup the first node we saw
and turn that into the BSS node.  This means that action frames from
that node would be rejected.

So, check that the node is the bss node /and/ the MAC doesn't match ni_macaddr.
That's the "right" way for now to verify it's an unknown node.

This fixes handling action frames in adhoc mode, which includes negotiating
11n aggregation via ADDBA/DELBA.

This by itself isn't enough to correctly create 11n adhoc networks; but
it is required for aggregation to be negotiated.

Tested:

* AR9380, 11n adhoc mode
* broadcom 11ac adhoc (vendor platform)

Sponsored by:	Eva Automation, Inc.
2016-04-28 20:29:49 +00:00
Adrian Chadd
ec3763bbeb [net80211] add the STBC ioctl support.
This adds configurable STBC TX and RX support.
2016-04-26 01:29:26 +00:00
Adrian Chadd
5706199db6 [net80211] add STBC capability flags to iv_flags_ht.
This is in preparation for exposing configuring STBC flags up to ifconfig
so STBC TX/RX can be configured at runtime.

* Set the FHT_STBC flags for TX/RX if the HT capabilitiex exist
* Clear the RX STBC HT capability flag when creating a HTCAP IE, so
  we only announce it if it's configured in the FHT flags.

Tested:

* AR9331 (carambola2), AP/STA modes
2016-04-26 01:29:03 +00:00
Adrian Chadd
1729922f65 [net80211] add an ioctl for LDPC configuration. 2016-04-26 01:26:11 +00:00
Pedro F. Giffuni
d9c9c81c08 sys: use our roundup2/rounddown2() macros when param.h is available.
rounddown2 tends to produce longer lines than the original code
and when the code has a high indentation level it was not really
advantageous to do the replacement.

This tries to strike a balance between readability using the macros
and flexibility of having the expressions, so not everything is
converted.
2016-04-21 19:57:40 +00:00
Andriy Voskoboinyk
8a9508c046 net80211: refresh comments for ieee80211_scan_next() and
ieee80211_scan_done().

Refresh comments that reference scan_next() method
(does not exist since r191746) + fix spelling of 'current'.

Differential Revision:	https://reviews.freebsd.org/D5137
2016-04-21 06:19:33 +00:00
Andriy Voskoboinyk
6459bd2843 net80211: enable promiscuous mode state change for non-monitor/ahdemo modes
- Allow to enable/disable promiscuous mode when:
  * interface is not a member of bridge, or;
  * request was issued by user (ifconfig wlan0 promisc), or;
  * interface is in MONITOR or AHDEMO mode.
- Drop local workarounds in mwl(4) and malo(4).

Tested with:
- Intel 3945BG, STA mode;
- RTL8188CUS, MONITOR mode;

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D5472
2016-04-21 05:47:47 +00:00
Andriy Voskoboinyk
4357a5d1ef net80211: hide subtype mask & shift in function call.
Hide subtype mask/shift (which is used for index calculation
in ieee80211_mgt_subtype_name[] array) in function call.

Tested with RTL8188CUS, STA mode.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D5369
2016-04-20 21:15:55 +00:00
Andriy Voskoboinyk
d72d72d381 net80211: provide descriptions for reason codes
Add text description for deauth/disassoc/etc reason codes
in addition to 'reason: <number>' string.

Reviewed by:	adrian
Obtained from:	IEEE Std 802.11-2012, 8.4.1.7 "Reason Code field"
Differential Revision:	https://reviews.freebsd.org/D5367
2016-04-20 20:30:18 +00:00
Andriy Voskoboinyk
4ba33fd1dc net80211 (trivial, noop): remove duplicate check from hostap_recv_mgmt()
Differential Revision:	https://reviews.freebsd.org/D5483
2016-04-20 18:48:39 +00:00
Andriy Voskoboinyk
31021a2b4e net80211: replace internal LE_READ_*/LE_WRITE_* macro with system
le*dec / le*enc functions.

Replace net80211 specific macros with system-wide bytestream
encoding/decoding functions:
- LE_READ_2 ->  le16dec
- LE_READ_4 ->  le32dec
- LE_WRITE_2 -> le16enc
- LE_WRITE_4 -> le32enc

+ drop ieee80211_input.h include, where it was included for these
operations only.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D6030
2016-04-20 18:29:30 +00:00
Andriy Voskoboinyk
2cd9502778 net80211: do not reschedule scan_curchan_task() if the scan was canceled.
This should fix possible use-after-free in the scheduled task.

PR:		208605
2016-04-19 20:19:21 +00:00
Adrian Chadd
cac0319035 [net80211] put in a comment about the not-quite-correctness of A-MPDU parameters.
Although we correctly (now!) calculate the right A-MPDU parameters, the
ioctl() has some faulty logic for choosing which to display.  The BSS
params are what were advertised to us, and we would have chosen the
lower of theirs/ours when advertising the HT bits back at them.

So, we /should/ track and fix that so we display the correct A-MPDU
density and size.

However, since I'm a forgetful type, and I don't want to have to re-learn
that this is wrong, drop in a comment so I or someone else fixes it.
Or, when I discover this again in 4 years, I don't have to go digging
too much to remember.
2016-04-18 00:26:11 +00:00
Adrian Chadd
b4fb3d6e02 [net80211] correctly (i hope, wow) do a ticks comparison to limit A-MPDU attempts
I was seeing the stack constantly attempt to renegotiate A-MPDU TX
even after 3 failures.  My hunch is that the direct ticks comparison
is failing around the ticks wrap-around point.

This failure shouldn't /really/ happen normally, but it turns out being
the IBSS master node on FreeBSD doesn't quite setup 11n right, so
negotiating A-MPDU TX fails.
2016-04-10 04:16:34 +00:00
Adrian Chadd
6548c62c97 [net80211] unconditionally do A-MPDU RX aging.
It's 2016 and vendors (including us!) still have 802.11n TX/RX sequence
handling bugs.  It's suboptimal, but I'd rather see us default to handling
things in a sensible way.

So, just delete the #ifdef'ed code for now.  I'll leave the option in
so it doesn't break existing configurations.

This all started because I've started getting reports about urtwn not
working after I enabled 802.11n support, and it's because the ARM kernel
configs don't include A-MPDU RX aging.
2016-04-10 03:35:17 +00:00
Adrian Chadd
5cf581e264 [net80211] log the node pointer when calling ht node init/cleanup
This makes it easier to track which node is having what done do it
during normal use.

This is likely the eighth time I've done this since I started doing
net80211 development, so I think it's about time I just committed it.
2016-04-09 22:01:32 +00:00
Adrian Chadd
169c392c43 [net80211] add back in the ff/superg node init call that I accidentally
deleted.

It's mostly a no-op right now, so it shouldn't have changed behaviour.
2016-04-09 21:57:34 +00:00
Bjoern A. Zeeb
c89e0d151c Try to unbreak the build: the 'vap' variable is only used if ieee80211
debugging compile is on.
2016-04-09 09:31:28 +00:00
Adrian Chadd
2b8b8ae8e7 [net80211] print out the channel type (eg a, b, g, n) when creating
an IBSS network.
2016-04-09 04:57:25 +00:00
Adrian Chadd
adad5b4564 [net8021] Pull out the ibss check code into a public function.
The ath(4) driver now sees beacons and management frames for different
BSSIDs in IBSS mode, which is a problem when you're in a very busy
IBSS environment.

So, expose this function so drivers can use it to check if the current
RX node is actually for a BSS we need to pay attention to or not.

PR:		kern/208644
Sponsored by:	Eva Automation. Inc.
2016-04-09 00:55:55 +00:00
Adrian Chadd
6966317aba [net80211] revert part of r282405 in order to restore IBSS behaviour.
This prevents nodes being created for peers on BSSes that are not our own.
(Ie, same channel, IBSS, but different BSS.)

The "IBSS merge" thing was fixed by me enabling "see all beacons" in
the ath(4) driver a few months ago.  Trouble is, we now need the filtering
again.

Tested:

* ath(4), IBSS, on a very busy IBSS channel with lots (> 15) IBSS networks.

PR:		kern/208643
Sponsored by:	Eva Automation, Inc.
2016-04-09 00:54:02 +00:00
Adrian Chadd
0e6cbef2d4 [net80211] missed commit from last one - always cleanup superg state. 2016-04-06 01:22:20 +00:00
Adrian Chadd
1c7b0c8456 [net80211] Initial A-MSDU support for testing / evaluation
A-MSDU is another 11n aggregation mechanism where multiple ethernet
frames get LLC encapsulated (so they have a length field), padded,
and put in a single MPDU (802.11 MAC frame.)  This means it gets sent
out as a single frame, with a single seqno, it's acked as one frame, etc.

It turns out that, hah, atheros fast frames is almost but not quite
like this, so I'm reusing all of the current superg/fast-frames stuff
in order to actually transmit A-MSDU.  Yes, this means that A-MSDU
frames are also only aggregated two at a time, so it's not necessarily
a huge win, but it's better than nothing.

This doesn't do anything by default - the driver needs to say it does
A-MSDU as well as set the AMSDU software TX capability so this code path
gets exercised.

For now, the only driver that enables this is urtwn.  I'll enable it
for rsu at some point soon.
Tested:

* Add an amsdu encap path to aggregate two frames, same as the
  fast-frames path.

* Always do the superg init/teardown and node init/teardown stuff,
  regardless of whether the nodes are doing fast-frames (the ATH
  capability stuff.)  That way we can reuse it for amsdu.

* Don't do AMSDU for multicast/broadcast and EAPOL frames.

* If we're doing A-MPDU, then don't bother doing FF/A-MSDU.
  We can likely do both together, but I don't want to change
  behaviour.

* Teach the fast frames approx txtime logic to support the 11n
  rates.  But, since we don't currently have a full "current rate"
  support, assume it's HT20, long-gi, etc.  That way we overshoot
  on the TX time estimation, so we're always inside the requirements.
  (And we only aggregate two frames for now, so we're not really
  going to exceed that.)

* Drop the maximum FF age default down to 2ms, otherwise we end up
  with some very annoyingly large latencies.

TODO:

* We only aggregate two ethernet frames, so I'm not checking the max
  A-MSDU size.  But when it comes time to support >2 frames, we should
  obey that.

Tested:

* urtwn(4)
2016-04-06 01:21:51 +00:00
Adrian Chadd
57f78a351e [net80211] rename 11n rate macros into a useful spot
* begin moving the 11n macros out of ieee80211_phy.c and
  into a header so they can be used elsewhere.

* rename some of them into the IEEE80211_* namespace.

* convert HT_RC_2_MCS() to work with three-stream rates.
2016-04-05 22:01:56 +00:00
Adrian Chadd
22e6904e8f [net80211] note that M_FF will soon mean "fast-frames" or "A-MSDU." 2016-04-05 21:54:42 +00:00
Adrian Chadd
1b866afdc6 [net80211] Add a new capability flag to indicate that the stack should
do software A-MSDU encapsulation.

Right now there's AMSDU TX/RX capability bits and they're mostly
unused, however I'd like to maintain those as the general configuration,
not also "please software encap AMSDU."  For platforms that can do
A-MSDU in firmware (iwn, iwm, etc) then their init paths can read
this flag to configure A-MSDU.
2016-04-05 21:54:07 +00:00
Andriy Voskoboinyk
1d47c76c8c net80211: copy MAC address into iv_myaddr[] instead of aliasing it.
Since IF_LLADDR() returns a non-constant pointer to the MAC address
preserve a copy of it in iv_myaddr.

PR:		208505
2016-04-05 21:29:11 +00:00
Adrian Chadd
ef860a9193 [net80211] add amsdu and fast frames encap failure counters in the ioctl
definition.

The code to set these will come in a subsequent commit (when I start
fleshing out A-MSDU support.)
2016-04-04 20:32:31 +00:00
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