Commit Graph

724 Commits

Author SHA1 Message Date
Sam Leffler
67ce310a5a misc cleanup of wme parameter setting 2009-02-20 21:55:23 +00:00
Sam Leffler
24a07b5b23 use 1/2 and 1/4 rate phy types to simplify txtime calculation 2009-02-19 17:44:23 +00:00
Sam Leffler
6a76ae216e Add modes for 1/2 and 1/4-width channels so we have separate roaming
and xmit parameters.  This makes it possible to use tdma on fractional
channels.
o add IEEE80211_MODE_HALF and IEEE80211_MODE_QUARTER; note these are
  band-agnostic (may need revisiting)
o setup all default rates in ic_sup_rates instead of doing it only
  for active modes; we need these to calculate the default tx parameters
  which are not recalculated after a regulatory update (can't just
  recalculate after installing a new channel list because we might
  clobber user settings)
o remove special case code in ieee80211_get_suprates; this is now
  a candidate for an inline or removal
o add various entries for new modes (roaming+tx params, wme, rate
  mapping, scan set setup, country ie construction, tdma, basic rates)

Note these modes are intentionally not visible through if_media.
2009-02-19 05:21:54 +00:00
Sam Leffler
cbb24c240d o looseen abi dependencies on IEEE80211_MODE_MAX by accepting smaller
parameters for IEEE80211_IOC_ROAM and IEEE80211_IOC_TXPARAMS; this
  lets us add more modes and still have old apps work
o consolidate loops to remote assumptions about mode ordering
2009-02-19 05:03:10 +00:00
Sam Leffler
be0df3e7c0 use c99 initializers 2009-02-19 04:52:03 +00:00
Sam Leffler
047db6b311 o consolidate loops to eliminate assumptions about ordering of modes
o replace 0x80 by IEEE80211_RATE_MCS
2009-02-19 04:46:09 +00:00
Sam Leffler
da92f1598c Change country ie construction to simplify forthcoming changes:
o use c99 initializer for skipflags
o calculate band flags instead of statically listing them in the table
2009-02-19 04:44:18 +00:00
Sam Leffler
59a40225d5 use c99 initializer 2009-02-19 04:40:47 +00:00
Sam Leffler
82c990a4ef simplify setting up the roaming parameters; writing default parameters only
for active modes hasn't turned out to be useful so just define a const table
and copy it in place
2009-02-19 04:37:44 +00:00
Sam Leffler
566d825ba7 check ptr against NULL 2009-02-19 04:34:22 +00:00
Sam Leffler
40432d369a instead of special casing lookups for the 11na/g legacy rate set, just
install the rates once when creating the com structure
2009-02-19 04:33:36 +00:00
Sam Leffler
544347253f add phy types for 1/2 and 1/4-rate modes 2009-02-19 04:19:58 +00:00
Sam Leffler
d3f5f855e8 remove ic_stats; it was intended to accumulate stats from vaps as they
were reaped but was never used and is inaccessible
2009-02-13 05:31:18 +00:00
Sam Leffler
6e05dab14d strip M_FRAG & co mbufs coming down from ip_output, these flags are
re-used within net80211 to mark 802.11 frags so allowing them to
leak through to the driver caused packets to be dropped in ath
2009-02-13 05:26:04 +00:00
Sam Leffler
47a7b0fa21 o replace ieee80211_node_reclaim by individual operations to release the
references to iv_bss and the sta table; this is equivalent and causes
  direct reclaim of the old bss node when any references in packets inflight
  are reclaimed (previously the old node would sit in the bss table until
  the inactivity processing reclaimed it)
o remove ieee80211_node_reclaim now that it's only use is gone

Reviewed by:	avatar, cbzimmer
2009-02-12 23:34:58 +00:00
Andrew Thompson
ae55932e23 Add a ieee80211_waitfor_parent() function that will wait for all deferred
parent interface tasks to complete. This had been added to the ioctl path but
it is also need elsewhere like detach so its safe to teardown.

Reported by:	Hans Petter Selasky
Submitted by:	sam
2009-02-12 18:57:18 +00:00
Sam Leffler
73bac36f82 improve key index map reclaim debug msg 2009-02-11 18:40:09 +00:00
Sam Leffler
965c230342 oops, fix octal escape sequence 2009-02-11 18:39:20 +00:00
Sam Leffler
577a7bcce8 remove bogus reference reclaim on the slave-side bss node on beacon miss 2009-02-11 17:30:36 +00:00
Sam Leffler
5b61057321 fix mis-numbering of IEEE80211_MSG_BITS 2009-02-11 17:26:47 +00:00
Sam Leffler
60d5654464 when operating as a slave, clear neighbor entries and the peer bss node
on beacon miss

while here, remove a stray pointless write of iv_bmiss_count
2009-02-10 23:52:28 +00:00
Sam Leffler
f09cf33f40 clean neighbor entries on beacon miss 2009-02-10 23:51:18 +00:00
Sam Leffler
24a90e6b81 correctly fixup iv_des_chan after installing a new channel table; if the
previous channel is now invalid we must set it to IEEE80211_CHAN_ANYC
2009-02-10 01:37:55 +00:00
Weongyo Jeong
51cec12145 mark M_LASTFRAG at the last fragment.
Reviewed by:	sam
MFC after:	3 weeks
2009-02-09 04:39:16 +00:00
Sam Leffler
30a4e0680d o change _db_show_key to always dump the contents instead of checking
IEEE80211_KEY_DEVKEY
o fix channel power printing (they are signed values)
o add show statab to dump a node table and automatically dump the sta
  table of a com structure with /s
2009-02-05 20:26:53 +00:00
Sam Leffler
f2ce0f5181 o add IEEE80211_KEY_BITS for %b printing of wk_flags
o replace hand-rolled code to print wk_flags
o add display of ni_ucastkey in show sta
o fix \n in _db_show_key
2009-02-05 19:20:34 +00:00
Sam Leffler
c3f10abd7e When crafting a media setting w/ an auto (non-fixed) rate mask out the
turbo option in addition to the mode bits; otherwise if the current
channel is a turbo mode channel we'll form an invalid media setting
and the ifmedia_set operation in vap_attach will panic.

While here use C99-style initialization for an array indexed by mode;
this makes it consistent w/ other usage and avoids breakage if we
should ever change the set of modes.
2009-02-03 22:32:26 +00:00
Sam Leffler
a3dfb736e8 when promoting an 11b channel to 11g do not accept a ``pure G'' (OFDM only)
channel, only accept a real 11g channel; this fixes a problem where we were
wrongly promoting 11b to a Dynamic Turbo G channel which broke scanning on
channel 6
2009-02-01 22:24:08 +00:00
Sam Leffler
800e5ab76a setup default fixed rates for static turbo and 11n;
the 11n rates are pure guess
2009-01-29 23:12:06 +00:00
Sam Leffler
f76cde9515 set ni_txparms for static turbo mode 2009-01-29 23:11:18 +00:00
Sam Leffler
8500d65d94 setup default rate set for static turbo mode 2009-01-29 23:09:12 +00:00
Sam Leffler
f8b1ea1737 add an assert to verify the number of channels returned by ic_getradiocaps
correlates with the size of the channel array passed down

might want to promote this to be always present to catch for driver errors
2009-01-28 18:39:23 +00:00
Sam Leffler
a6f34da70b change null_getradiocaps to return the actual count of channels instead
of the true number; otherwise the caller may use the count to do things
with the data it should not (e.g. sort the channel table)
2009-01-28 18:37:46 +00:00
Sam Leffler
00a7aacaa7 Extend channel definition with:
o max antenna gain
o driver private opaque data

Note this grows the size of a channel to 16 bytes; which makes the
default channel table 4Kbytes (up from 3Kbytes).
2009-01-27 23:48:13 +00:00
Sam Leffler
b83f2cf386 fix comment 2009-01-27 23:43:20 +00:00
Sam Leffler
8658b18b82 Remove assumptions about the max # channels in ioctl's:
o change ioctl's that pass channel lists in/out to handle variable-size
  arrays instead of a fixed (compile-time) value; we do this in a way
  that maintains binary compatibility
o change ifconfig so all channel list data structures are now allocated
  to hold MAXCHAN entries (1536); this, for example, allows the kernel
  to return > IEEE80211_CHAN_MAX entries for calls like IEEE80211_IOC_DEVCAPS
2009-01-27 23:42:14 +00:00
Sam Leffler
5fe9f04492 change ic_getradiocaps driver callback to include the max # channels
so callers know the size of the array passed down
2009-01-27 23:19:36 +00:00
Sam Leffler
84e7c58867 o add country codes from Atheros regulatory; these are not listed in
the ISO tables, mark them accordingly
o add sku's for handling 900MHz cards
o add opaque struct defs and change []'s to *'s so this file can be
  included w/o requiring all of net80211 to be pulled in
o make CTRY_DEBUG and CTRY_DEFAULT public
2009-01-27 23:09:55 +00:00
Sam Leffler
3d13a95516 o make %b msg bit defines public (to user apps too)
o rename IEEE80211_C_CRYPTO_BITS to IEEE80211_CRYPTO_BITS
2009-01-27 23:00:38 +00:00
Sam Leffler
9c2c544d8d fill in ieee channel #'s and max tx power for drivers that work exclusively
with frequencies; this mimics how ieee80211_setregdomain works
2009-01-27 22:48:46 +00:00
Sam Leffler
998c561f7b add new state bit to indicate when interference is observed on the channel 2009-01-27 22:46:34 +00:00
Sam Leffler
f3ab1589e8 change IEEE80211_IS_CHAN_OFDM and IEEE80211_IS_CHAN_CCK to return true
for 11g (dynamic CCK/OFDM)
2009-01-27 22:45:31 +00:00
Sam Leffler
8fed2e0450 define IEEE80211_CHAN_108A and IEEE80211_CHAN_108G in terms of their
non-turbo names to make the relationship more clear
2009-01-27 22:43:32 +00:00
Andrew Thompson
8d9b29f35b If the parent up/down task was queued then sync with it before returning from
the vap ioctl. This means that the parent interface should hopefully be up
before we return to userland, it does not depend on the parent init succeeding,
just that it was run.

This fixes wpa_supplicant with ndis and USB where the parent interfaces can be
slow to init.
2009-01-25 07:31:51 +00:00
Sam Leffler
a5985e8b56 fix regulatory state check for all vaps' being down; it must be done
before calling the ic_setregdomain callback
2009-01-23 18:16:14 +00:00
Sam Leffler
76df237570 add defines for driver-private bits to eliminate use of constants 2009-01-23 18:15:09 +00:00
Sam Leffler
8d092df91a add missing return that broke WPA1+2 support
Submitted by:	"Jared Go" <jared@hobnob.com>
2009-01-11 18:59:14 +00:00
Sam Leffler
10ad9a77f3 TDMA support for long distance point-to-point links using ath devices:
o add net80211 support for a tdma vap that is built on top of the
  existing adhoc-demo support
o add tdma scheduling of frame transmission to the ath driver; it's
  conceivable other devices might be capable of this too in which case
  they can make use of the 802.11 protocol additions etc.
o add minor bits to user tools that need to know: ifconfig to setup and
  configure, new statistics in athstats, and new debug mask bits

While the architecture can support >2 slots in a TDMA BSS the current
design is intended (and tested) for only 2 slots.

Sponsored by:	Intel
2009-01-08 17:12:47 +00:00
Sam Leffler
6ca74c40de only mark an infrastructure node to require an associd for xmit; fixes adhoc
mode sta's that join an existing ibss
2009-01-07 18:17:36 +00:00
Sam Leffler
9094ffdfe3 mark discovered neighbors QoS capable if they advertise wme 2008-12-31 21:29:09 +00:00
Sam Leffler
72fecb4d6c follow prevailing style 2008-12-31 21:21:46 +00:00
Sam Leffler
e2126dec84 convert MALLOC/FREE to malloc/free 2008-12-18 23:00:09 +00:00
Sam Leffler
12c290fe6e fix comment
Submitted by:	Daan Vreeken
2008-12-16 01:17:36 +00:00
Sam Leffler
ca92652af7 Fix ucastkey teardown for drivers that plumb clear keys or similar
(e.g. ath): we must check the key index and not whether the key
points at a cipher other than "undef".  This looks like it's been
broken for a while.  Might be worth adding an explicit clear cipher
at some point though this would require changes to the usage of
IEEE80211_KEY_UNDEFINED.

PR:		125906
2008-12-15 22:50:50 +00:00
Sam Leffler
7946271527 remove extraneous ';' 2008-12-15 22:31:54 +00:00
Sam Leffler
31378b1c87 Fix definition of IEEE80211_CHAN_MAX; it was defined as 255 but
really was meant to be 256.  Adjust usage accordingly and replace
bogus usage of this value in checking IEEE channel #'s.

NB: this causes an ABI change; ifconfig must be recompiled
2008-12-15 01:26:33 +00:00
Sam Leffler
1b999d643c Replace adhoc checks in ieee80211_start with a per-node flag that
indicates if an association id is required before outbound traffic
is permitted.  This cleans up the previous change that broke mcast
traffic "to the stack" in ap mode as a side effect.

Reviewed by:	sephe, thompsa, weongyo
2008-12-15 00:47:24 +00:00
Bjoern A. Zeeb
4b79449e2f Rather than using hidden includes (with cicular dependencies),
directly include only the header files needed. This reduces the
unneeded spamming of various headers into lots of files.

For now, this leaves us with very few modules including vnet.h
and thus needing to depend on opt_route.h.

Reviewed by:	brooks, gnn, des, zec, imp
Sponsored by:	The FreeBSD Foundation
2008-12-02 21:37:28 +00:00
Sam Leffler
f7eb979a5e correct sorting 2008-11-23 01:51:14 +00:00
Kip Macy
aea78d2094 convert calls to IFQ_HANDOFF to if_transmit 2008-11-22 07:35:45 +00:00
Sam Leffler
d6f57961a8 Fix checks for fast frames negotiation. ni_ath_flags holds the
capabilities reported by the ap.  These need to be cross-checked
against the local configuration in the vap.  Previously we were
only checking the ap capabilities which meant that if an ap reported
it was ff-capable but we were not setup to use them we'd try to do
ff aggregation and drop the frame.

There are a number of problems to be fixed here but applying this
fix immediately as the problem causes all traffic to stop (and has
not workaround).

Reported by:	Ashish Shukla
2008-10-30 16:22:04 +00:00
Sam Leffler
e66b0905fc o use the new association callback to notify the driver when joining a bss
in sta and adhoc modes; this should've been done forever ago as most all
  drivers use this hook to set per-station transmit parameters such as for
  tx rate control
o adjust drivers to remove explicit calls to the driver newassoc method
2008-10-27 16:46:50 +00:00
Sam Leffler
5d44f8c024 o re-enable a lock assert
o while here reformat a comment to sync w/ other repot's
2008-10-26 21:59:07 +00:00
Sam Leffler
8f4addc0a8 Fix joining an 11b BSS: scanning is normally done using 11g channels
(unless explicitly locked to mode 11b) so when we join the bss the
channel attached to the scan cache entry may need to be demoted.

o demote to 11b if the ap is advertising 11b rates
o skip the ap if it's 11b but we're locked to 11g (could consider this
  advisory but for now treat it as mandatory)
o handle an odd edge case, if there is a fixed transmit rate for 11g
  then the rate check against the 11b ap will fail, try to demote to
  11b and retry the rate check

Reviewed by:	sephe, thompsa
2008-10-26 21:56:27 +00:00
Sam Leffler
63092fce49 New ap-side power save implementation; the main change is to allow drivers
to queue frames previously encapsulated on a separate high priority list
that is dispatched before the unencapsulated frames (to preserve order).
2008-10-26 01:04:46 +00:00
Sam Leffler
99f1b25c9f move decl up before first use 2008-10-26 01:01:01 +00:00
Sam Leffler
c1af44bdac introduce M_ENCAP flag to mark packets encapsulated w/ an 802.11 header 2008-10-26 00:55:38 +00:00
Sam Leffler
0e66722d20 fix comment that belonged w/ previous commit 2008-10-26 00:52:26 +00:00
Sam Leffler
16d7cbb108 change ieee80211_send_probereq to supply raw xmit parameters so it can
control how frames are handled by the driver
2008-10-26 00:48:20 +00:00
Sam Leffler
6683931e81 change ieee80211_send_nulldata to send a QoS Null Data frame to a
QoS-enabled station; this makes inactivity handling follow the spec
as previously it would probe inactive stations w/ a Null Data (no QoS)
data frame
2008-10-26 00:46:17 +00:00
Sam Leffler
8ac160cd2e o change ieee80211_mgmt_output to take a raw xmit parameters block so
the net80211 layer has complete control over the handling of mgt frames
  (in particular, the ac, tx rate, and retry count); this also allows us
  to purge the M_LINK0 flag that was attached to mbufs to mark them as
  needing encryption for shared key auth
o change ieee80211_send_setup to take a tid parameter so it can be used
  to setup QoS frames
2008-10-26 00:43:11 +00:00
Sam Leffler
380b865a0d fix old merge botch that causes gaps in the tx seq# space for QoS frames 2008-10-26 00:32:02 +00:00
Sam Leffler
cc71a422ea Sync BAR frame handling with out of tree work:
o correct BAR frame construction for AMPDU
o retransmit BAR frames until ACK'd or timeout (use tunables to
  control behaviour, default is very aggressive)
o defer seq# update until BAR frame is ACK'd
o add BAR response handling callback for driver to interpose and
  push new state to device or push pending aggregates

While here also:
o add backpointer to node in the per-tid tx aggregation data structure
o move ampdu tx state setup/teardown work to separate functions
2008-10-25 23:58:59 +00:00
Sam Leffler
dfcd1f4d0e set erp flag and tx parameter state when joining a bss; this allows
drivers to use ni_txparms
2008-10-25 23:44:25 +00:00
Sam Leffler
ae3f00bbfd honor IEEE80211_CLONE_NOBEACONS for type of vap, not just a sta mode vap 2008-10-25 23:43:08 +00:00
Sam Leffler
be1054ed14 improve inactivity handling debug support 2008-10-25 23:40:48 +00:00
Sam Leffler
52ef06dcfe use a private mgt frame recv handler for ahdemo mode instead of an inline
test in the adhoc mode rx path so classes derived from ahdemo mode can
override the default behaviour
2008-10-25 23:40:29 +00:00
Sam Leffler
887acaadec expand captured ie's before calling match_bss so they can potentially
be used in the process
2008-10-25 23:39:18 +00:00
Sam Leffler
1095925656 change ieee80211_sta_join to take an explicit channel instead of
using the value in the scan parameters; this will be used to fix
issues with 11b operation
2008-10-25 23:32:24 +00:00
Sam Leffler
f945bd7aa9 o add support for ifconfig wlanX mode foo
o yank useless code for setting fixed rate through media opts: this
  mechanism didn't scale to HT rates and couldn't handle multiple bands;
  fixed tx rates are set with the IEEE80211_IOC_TXPARAMS ioctl
2008-10-25 23:31:20 +00:00
Sam Leffler
fad0f46d20 add debug msgs 2008-10-25 23:28:24 +00:00
Sam Leffler
6ff2e10a56 fix associd check for adhoc mode
Reviewed by:	jhay
2008-10-25 23:28:04 +00:00
Sam Leffler
643024a2b1 ignore IEEE80211_ELEMID_PWRCNSTR when parsing beacon/probe response frames
to avoid counting it as an unknown elemid (we often beacon this so it shows
up as a "false positive")
2008-10-25 23:26:57 +00:00
Sam Leffler
d1abf1f411 add 1/2 and 1/4 channel flags to IEEE80211_CHAN_ALL so that operations
like ieee80211_find_channel are more useful
2008-10-25 23:24:49 +00:00
Sam Leffler
07760642a6 add/improve debug msgs 2008-10-25 23:23:41 +00:00
Dag-Erling Smørgrav
c5abbba314 Revert the removal of the MALLOC and FREE macros from the net80211 code.
Requested by:	sam
2008-10-23 19:57:13 +00:00
Dag-Erling Smørgrav
1ede983cc9 Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after:	3 months
2008-10-23 15:53:51 +00:00
Marko Zec
8b615593fc Step 1.5 of importing the network stack virtualization infrastructure
from the vimage project, as per plan established at devsummit 08/08:
http://wiki.freebsd.org/Image/Notes200808DevSummit

Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator
macros, and CURVNET_SET() context setting macros, all currently
resolving to NOPs.

Prepare for virtualization of selected SYSCTL objects by introducing a
family of SYSCTL_V_*() macros, currently resolving to their global
counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT().

Move selected #defines from sys/sys/vimage.h to newly introduced header
files specific to virtualized subsystems (sys/net/vnet.h,
sys/netinet/vinet.h etc.).

All the changes are verified to have zero functional impact at this
point in time by doing MD5 comparision between pre- and post-change
object files(*).

(*) netipsec/keysock.c did not validate depending on compile time options.

Implemented by:	julian, bz, brooks, zec
Reviewed by:	julian, bz, brooks, kris, rwatson, ...
Approved by:	julian (mentor)
Obtained from:	//depot/projects/vimage-commit2/...
X-MFC after:	never
Sponsored by:	NLnet Foundation, The FreeBSD Foundation
2008-10-02 15:37:58 +00:00
Sam Leffler
63c61408ef guard against adhoc_pick_channel returning a NULL channel; this can
happen after a scan cache flush (e.g. in response to ifconfig wlan bssid -)
2008-09-27 21:18:40 +00:00
Sam Leffler
74fdefa7c9 must do a deep copy of mcast packets as they can be modified after dispatch
Submitted by:	"Jared Go" <jared@hobnob.com>
2008-09-25 20:25:25 +00:00
Andrew Thompson
4ea219803e Use db_printsym to lookup and print the function pointers. 2008-09-25 16:46:36 +00:00
Sam Leffler
b9b5f07d1c cleanup bss node setup; syncs w/ p4 state that's been in use for months 2008-09-22 00:22:09 +00:00
Sam Leffler
86c55fc405 cleanup after merge 2008-09-22 00:21:24 +00:00
Sam Leffler
49942a9784 Fix handling of shortgi: use the local configuration (and implicitly
device capabilities) to decide whether to use short gi.  Drivers
inspect ni_flags to decide whether to send a frame w/ short sgi.
2008-09-22 00:14:50 +00:00
Sam Leffler
44f7a6edcf RIFS support; needs driver callback for dynamic state change 2008-09-22 00:10:22 +00:00
Sam Leffler
8c070d69c7 MIMO power save support; still needs callbacks for notifying drivers
of dynamic state change in station mode.
2008-09-21 23:59:14 +00:00
Sam Leffler
fdabd982e7 Revamp ht ie handling:
o change ieee80211_parse_htcap and ieee80211_parse_htinfo to save only
  internal state obtained from the ie's; no dynamic state such as
  ni_chw is altered
o add ieee80211_ht_updateparams to parse ht cap+info ie's and update
  dynamic node state
o change ieee80211_ht_node_init to not take an htcap ie that is parsed;
  instead have the caller make a separate call as one caller wants to
  parse the ie while another wants to parse both cap+info ie's and
  update state so can better do this with ieee80211_ht_updateparams

These changes fix sta mode state handling where the node's channel
width was shifted to ht20/ht40 prematurely.
2008-09-21 23:44:15 +00:00
Sam Leffler
bd985970b6 don't propagate ht bss occupancy changes to legacy vaps;
they won't have an htinfo ie to update
2008-09-21 23:32:48 +00:00
Sam Leffler
c4fe3956fa o widen ni_flags as it's going to be full shortly
o shuffle members to minimize holes
2008-09-21 23:31:17 +00:00
Sam Leffler
01a03542b1 Add current transmit parameters for fixed rate handling so drivers
don't duplicate this.  These are setup according to the role of the
node--the bss node for ap and adhoc modes need to use parameters
that are the least common denomimator of all nodes in the bss;
otherwise we are setting up params for a station joining a bss and
we select those according to the capabilities of the station.

This stuff needs more work as we do extra work due to having setup
in common code paths shared by nodes using both roles.
2008-09-21 23:25:33 +00:00
Sam Leffler
3c1a492e4a change ieee80211_ampdu_stop to take an explicit reason code 2008-09-21 23:20:04 +00:00
Sam Leffler
af4ec66eb5 simplify debug msg 2008-09-21 23:18:36 +00:00
Sam Leffler
e6e547d57b Crypto api changes:
o don't use the key index to identify when the driver has been
  asked to allocate a key slot, use an explicit flag; allows
  drivers to force s/w fallback for entries in the global table
o change callback api to allocate driver resources for a crypto key:
  - de-const the key parameter so drivers can muck with the flags
  - on callback failure don't automatically try to setup s/w crypto;
    instead the driver must now mark the key entry for s/w crypto and
    the caller will re-attach the cipher module

NB: api change permits drivers more control over fallback to s/w
    crypto (e.g. based on a limited number of h/w key slots)
2008-09-21 23:16:19 +00:00
Sam Leffler
45f856e3ac Cleanup AMPDU handling:
For receive:
o explicitly tag rx frames w/ M_AMPDU instead of passing frames through
  the reorder processing according to the node having HT and the frame
  being QoS data
o relax ieee80211_ampdu_reorder asserts to allow any frame to be passed
  in, unsuitable frames are returned to the caller for normal processing;
  this permits drivers that cannot inspect the PLCP to mark all data
  frames as potential ampdu candidates with only a small penalty
o add M_AMPDU_MPDU to identify frames resubmitted from the reorder q

For transmit:
o tag aggregation candidates with M_AMPDU_MPDU
o fix the QoS ack policy set in ampdu subframes; we only support immediate
  BA streams which should be marked for "normal ack" to get implicit block
  ack behaviour; interestingly certain vendor parts BA'd frames with the
  11e BA ack policy set
o do not assign a sequence # to aggregation candidates; this must be done
  when frames are submitted for transmit (NB: this can/will be handled
  better when aggregation is pulled up to net80211)
2008-09-21 23:00:19 +00:00
Sam Leffler
b69b7fe758 Always update ic_lastnonht so we track overlapping legacy bss
properly; was doing this only on a change in the protection mode
so the advertised protection mode in the beacon would oscillate.

Submitted by:	Chris Zimmermann
2008-09-21 22:24:07 +00:00
Sam Leffler
c5f9511e91 Cleanup starting seq# for tx ampdu:
o use txa_start to form the addba request and purge txa_seqstart
o fill txa_start before calling ic_addba_request to permit drivers
  to override when they handle seq# generation (e.g. mwl)
2008-09-21 22:22:28 +00:00
Sam Leffler
231bb1bc4f o fix spelling of EOSP
o correct SMPS values
2008-09-21 22:09:18 +00:00
Andrew Thompson
cb959fa205 Fix clone destruction, can't use the simple api because that does not remove
the ifnet from cloner's list.  Expose if_clone_destroyif api to do this.

Submitted by:	sam
2008-09-20 19:38:37 +00:00
Sam Leffler
0f52b1c477 make all checks if ni_chw consistent 2008-09-06 17:51:02 +00:00
Sam Leffler
c9f78f45c9 use c99 syntax for initializers; this silences
warnings with picky compiler settings
2008-09-06 17:48:25 +00:00
Sam Leffler
900de99561 only return the negotiated ampdu density for sta mode 2008-09-06 17:43:47 +00:00
Sam Leffler
c54fbb33b9 o kill IEEE80211_NODE_PSUPDATE; it was never used
o kill IEEE80211_NODE_CHWUPDATE; it's use was pointless and it was defined
  wrong (overlap w/ existing flags)
2008-09-06 17:42:51 +00:00
Sam Leffler
c0756f5f2e put back placeholder comment 2008-09-06 17:39:31 +00:00
Sam Leffler
eaff8e2689 o validate the ba policy in addba response
o leave a check for the max ba window disabled; we accept out of range
  values and just truncate them but may want to act differently in the future
2008-09-06 17:38:20 +00:00
Sam Leffler
9c62b7d4ed add IEEE80211_NODE_HT_ALL to collect up all the HT-related node flags 2008-09-06 17:33:46 +00:00
Sam Leffler
1582f2562d don't do ampdu reordering of fragments; they should never happen 2008-09-06 17:31:55 +00:00
Sam Leffler
33b9a974d5 moreve the aggregation q; it's not being used and
there's a better way to do this
2008-09-06 17:29:11 +00:00
Sam Leffler
9d365d36cc o show key indices w/o adjustment
o display all key flags symbolically
2008-09-06 17:18:38 +00:00
Sam Leffler
1cc8822ed7 purge ni_reqcw; not used and never will be 2008-09-06 17:15:55 +00:00
Sam Leffler
8524d591d1 o fix BAR definitions
o add 11e reason codes
2008-09-06 17:14:27 +00:00
Sam Leffler
7705b0838b fix age calculations (yet again); entries in the q have values
relative to the head

MFC after:	3 days
2008-09-06 17:04:44 +00:00
Brooks Davis
d3c4cf45ba Replace a line matching /^ $/ with one matching /^$/.
Obtained from:	//depot/projects/vimage-commit2/...
2008-09-03 20:33:11 +00:00
Weongyo Jeong
b20f0ed118 free ifp allocated at ieee80211_vap_setup.
Reviewed by:	sam, thompsa
2008-09-02 04:49:35 +00:00
Tai-hwa Liang
2bc01c3a32 Fixing INVARIANTS build by adding 'z' format prefix for size_t typed
variable.

Reminded by:	tinderbox
2008-08-29 08:44:51 +00:00
Sam Leffler
02a1ebb4e3 Fix mic calculation when final data is entirely in a trailing mbuf;
it's unclear if this can happen on freebsd but does appear on netbsd.
Identified by Matthias Drochner who came up with an initial change
that we then revised together.

Reviewed by:	thompsa, sephe, avatar
MFC after:	2 weeks
2008-08-29 05:02:10 +00:00
Julian Elischer
7a5ecde3f7 This instance of ifnet got forgotten. 2008-08-25 05:20:29 +00:00
Warner Losh
3dfff737f3 Verify that the WPA flags set are actually compatible with the
driver's set of valid flags.  Otherwise, wpa_supplicant wouldn't
report an error for old wi cards that can't do WPA.

Reviewed by:	sam@
2008-08-09 05:46:01 +00:00
Sam Leffler
ba0c757772 add WPS oui
Submitted by:	"Chuck Tuffli" <chuck@tuffli.net>
MFC after:	3 days
2008-08-06 15:54:59 +00:00
Sam Leffler
d3d6c95298 add missing lock for htinfo update
Submitted by:	Chris Zimmermann
2008-08-02 18:04:09 +00:00
Sam Leffler
6bbdc70146 correct decap of of AppleTalk and IPX frames; don't strip the SNAP
header as they have one natively

Submitted by:	Chris Zimmermann
2008-08-02 18:02:57 +00:00
Sam Leffler
ac5ae6986f add a sysctl to deliver a radar event for testing 2008-08-02 18:00:33 +00:00
Sam Leffler
5c9b0f1d07 schedule the correct timer when receiving a radar event during CAC 2008-08-02 17:58:39 +00:00
Sam Leffler
693e312235 don't deauth a station because it sends a ps-poll w/ a bogus aid in it;
turns out some devices do this and since we otherwise validate the station
is associated and don't use the aid for anything being lenient here allows
them to function

Submitted by:	Chris Zimmermann
MFC after:	2 weeks
2008-07-26 23:50:27 +00:00
Sam Leffler
688fe74d0c reorder RSN/WPA2 ie in beacon and probe response frames to comply
with IEEE802.11-2007 spec

Submitted by:	Chris Zimmermann
2008-07-07 17:24:55 +00:00
Sam Leffler
4d5ed46093 correct construction of delba action frame; don't shift+mask the initiator
argument

Submitted by:	Marvell
2008-07-05 19:56:47 +00:00
Sam Leffler
38c208f876 Change the calling convention for ic_node_alloc to deal with
some longstanding issues:
o pass the vap since it's now the "coin of the realm" and required
  to do things like set initial tx parameters in private node
  state for use prior to association
o pass the mac address as cards that maintain outboard station
  tables require this to create an entry (e.g. in ibss mode)
o remove the node table reference, we only have one node table
  and it's unlikely this will change so this is not needed to
  find the com structure
2008-06-07 18:38:02 +00:00
Sam Leffler
2dc4d8dc89 Split ieee80211_notify_erp into locked and unlocked variants
and use the locked version to handle the hostap input path
case where the com lock is not already held.

Noticed by:	Jared Go
2008-06-07 17:51:41 +00:00
Sam Leffler
37e9743a00 Fix node cleanup issues when the last reference is held by
the driver (e.g. in the tx q); ni_vap may not be valid, we
must carefully check before using it.
2008-06-07 17:50:24 +00:00
Sam Leffler
13f91245d2 correct code returned in AsssocResp; the previous code is spec'd for use
only in deauth+disassoc frames

Submitted by:	Chris Zimmermann
MFC after:	1 month
2008-06-07 17:43:41 +00:00
Sam Leffler
06b2d888f6 Add ieee80211_crypto_reload_keys to push all keys known
to net80211 back into the device; intended for use on resume
by devices that lose the contents of their h/w key table.
2008-05-28 23:33:29 +00:00
Sam Leffler
71fe06ca7f Add a mac address to the key definition as otherwise we lose the
address specified in the ioctl and for drivers that need the address
to locate a key (e.g. for delete).

Note this changes net80211-private api's but not the driver callback;
may want to change that in the future.

Reviewed by:	sephe, thompsa
2008-05-28 23:32:00 +00:00
Sam Leffler
5c1f7f19b6 Split s/w crypt/mic attributes to allow future hackery; this change
should be a noop.
2008-05-28 23:25:36 +00:00
Sam Leffler
c4810a1bff missing piece of last commit; add RESUME flag bit definition 2008-05-28 23:20:27 +00:00
Sam Leffler
6076cbacea Add ieee80211_suspend_all and ieee80211_resume_all for
brute force suspend/resume handling of vaps.
2008-05-28 23:19:20 +00:00
Sam Leffler
34c9a6c7f0 Don't override the txpower cap installed by ieee80211_alloc_node;
we use ic_txpowlimit (for now) to initialize all new sta entries.
2008-05-28 23:18:17 +00:00
Sam Leffler
aa0fbc732a Simplify some contorted logic that wrongly left ISCAN_DISCARD set
in certain cases causing the current ap to be lost from the scan cache.

Obtained from:	Atheros (original bug)
2008-05-28 23:15:24 +00:00
Sam Leffler
978359b3f6 Revise lock name handling:
o construct a name for the com lock as done for other locks
o pass the device name to IEEE80211_LOCK_INIT so the mtx name
  is constructed as foo_com_lock
o introduce *_LOCK_OBJ macro's to hide the lock contents and
  minimize redundant code
2008-05-28 23:10:53 +00:00
Sam Leffler
a2cfa5b7ee special-case broadcast probe request in ieee80211_find_rxnode; we need
to spam all vaps and this won't happen if the frame comes from a station
that is associated to an ap vap (and so has an entry in the table)

Noticed by:	Jared Go
Reviewed by:	thompsa
2008-05-22 22:22:10 +00:00
Sam Leffler
c448998d5b ignore sw beacon miss while scanning, just reset the beacon count and timer
Reviewed by:	thompsa
2008-05-22 22:17:27 +00:00
Sam Leffler
5f5cf81567 no need to stop the sw beacon miss timer; it's not used with adhoc or wds 2008-05-22 22:14:58 +00:00
Sam Leffler
e8f5c7a839 declare ieee80211_phymode_name with an array size 2008-05-12 00:34:28 +00:00
Sam Leffler
8215d906ff Update PLCP<->rate mapping support:
o correct mapping of CCK rates to PLCP; was using nonstandard Ralink
  values which just happened to also be used by Zydas (so went unnoticed)
o change ieee80211_plcp2rate api to take a phy type instead of a flag
  that indicates ofdm/!ofdm
o update drivers to match (restore per-driver code to map rate->PLCP)

Reviewed by:	sephe, weongyo, thompsa
2008-05-12 00:32:52 +00:00
Sam Leffler
c43feede8b Minor cleanup of vap create work:
o add IEEE80211_C_STA capability to indicate sta mode is supported
  (was previously assumed) and mark drivers as capable
o add ieee80211_opcap array to map an opmode to the equivalent capability bit
o move IEEE80211_C_OPMODE definition to where capabilities are defined so it's
  clear it should be kept in sync (on future additions)
o check device capabilities in clone create before trying to create a vap;
  this makes driver checks unneeded
o make error codes return on failed clone request unique
o temporarily add console printfs on clone request failures to aid in
  debugging; these will move under DIAGNOSTIC or similar before release
2008-05-12 00:15:30 +00:00
Sam Leffler
fb39d28da5 we have a DFS capability now so enable check 2008-05-11 23:36:58 +00:00
Sam Leffler
bb77492f68 use c99-style initialization for ieee80211_phymode_name 2008-05-11 23:33:56 +00:00
Sam Leffler
82fd2577a8 add DFS capability bit and use it to auto-enable DFS support 2008-05-11 23:32:07 +00:00
Sam Leffler
7f5144364e use the current left edge of the BA window when forming ADDBA request
so an existing session is re-established with the correct seq#
2008-05-11 23:27:57 +00:00
Sam Leffler
e5d6bfc3c9 add PLCP service bit definitions 2008-05-11 23:20:26 +00:00
Sam Leffler
f4488925ad move inline keyword to silence compiler complaints 2008-05-11 23:18:11 +00:00
Sam Leffler
92172ed85a fix build w/ IEEE80211_DEBUG_REFCNT enabled 2008-05-01 20:26:25 +00:00
Sam Leffler
a239061a54 re-enable WME by default; after a full day of testing on iwi I see no
issues and the only way we'll identify them is for people to use it
2008-05-01 03:49:59 +00:00
Sam Leffler
bfa82ae8b0 disable default enabling of WME until we resolve driver regressions 2008-04-30 16:05:57 +00:00
Sam Leffler
0095127918 hookup the parent device's if_input and if_output to stub routines
to catch unintended use (one might argue about if_output but it's
behaviour is ill-defined without vap context)

Noticed by:	Paul B. Mahol
2008-04-25 19:45:42 +00:00
Sam Leffler
b032f27c36 Multi-bss (aka vap) support for 802.11 devices.
Note this includes changes to all drivers and moves some device firmware
loading to use firmware(9) and a separate module (e.g. ral).  Also there
no longer are separate wlan_scan* modules; this functionality is now
bundled into the wlan module.

Supported by:	Hobnob and Marvell
Reviewed by:	many
Obtained from:	Atheros (some bits)
2008-04-20 20:35:46 +00:00
Sam Leffler
98fed7a4ab Fix adhoc mode to scan all available channels for a bss to join
while still restricting auto-channel select to only those channels
permitted by regulatory constraints (sorta, we're still missing the
checks to honor radar and noadhoc status on channels).  This somehow
got lost in the initial merge of the revised scanning code.

Reviewed by:	jhay
MFC after:	2 weeks
2008-02-29 04:07:07 +00:00
Sepherosa Ziehau
12c5f8a8e3 - Correctly handle ALTQ in ieee80211_deliver_data()
- Add comment from sam that ALTQ probably does not work well with WME

PR: kern/119548
Approved by: sam (mentor)
2008-02-03 12:00:03 +00:00
Sam Leffler
2d165aedd9 add opaque pointer to tx ampdu state for drivers
MFC after:	3 days
2008-02-02 00:38:02 +00:00
Sam Leffler
ddc5368476 o correct typo that broke check when handling addba response
o add a comment about the ht rates being for 20MHz channels w/ long GI;
  needs a separate fix after more thought

MFC after:	3 days
2008-02-01 21:31:10 +00:00
Sam Leffler
1f0598ffe0 update channel flag defs to match _ieee80211.h so cpp doesn't complain
about redefinitions

MFC after:	1 week
2007-12-13 01:23:40 +00:00
Kip Macy
2de2af32a0 Add padding for anticipated functionality
- vimage
 - TOE
 - multiq
 - host rtentry caching

Rename spare used by 80211 to if_llsoftc

Reviewed by: rwatson, gnn
MFC after: 1 day
2007-12-07 01:46:13 +00:00
Sam Leffler
1a4ae5c45b Be more careful handling off-channel frames: if the driver (wrongly)
sends frames up the stack after changing the current channel then
the lookup by ieee channel number may fail leaving a null ptr in
se_chan; if this happens fallback to the channel recorded when the
frame is processed (curchan).  Since the frame doesn't contribute
to scan results for the sta this is acceptable.

Reviewed by:	thompsa
MFC after:	3 days
2007-11-26 21:28:18 +00:00
Sam Leffler
f4558c9a6f correct WMM packet classification:
o use TID_TO_WME_AC on vlan tag priority
o ignore ECN bits in DSCP when mapping IP TOS and use TID_TO_WME_AC

MFC after:	3 days
2007-11-23 06:24:57 +00:00
Sam Leffler
ce8977dff3 o correct re-association indicator dispatched in node join event
o remove misleading "reassociation" msg on sta join

MFC after:	3 days
2007-11-23 06:23:12 +00:00
Sam Leffler
849b4d998c correct sta mode setup: adopt ap's ampdu density and max ampdu size
instead of using local settings

MFC after:	3 days
2007-11-23 06:14:32 +00:00
Sam Leffler
cb42c5bba6 parse htcap ie early so ampdu density and max rx size are available
for constructing the AssocReq frame

MFC after:	3 days
2007-11-23 06:13:39 +00:00
Sam Leffler
d4a401b619 correct TID_TO_WME_AC handling of BE
MFC after:	3 days
2007-11-23 06:12:46 +00:00
Sam Leffler
8039c240fd use the DSPARMS ie to find the home channel for off-channel frames
Reviewed by:	thompsa
MFC after:	1 week
2007-11-23 05:58:37 +00:00
Sam Leffler
a557c018f5 add ieee80211_find_channel_byieee to lookup a channel by ieee channel #
Reviewed by:	thompsa
MFC after:	1 week
2007-11-23 05:57:20 +00:00
Sam Leffler
727fe7f862 update default wme parameters to latest WiFi test plans
Reviewed by:	Allan Lim
MFC after:	3 days
2007-11-23 05:55:06 +00:00
Sam Leffler
12c1df4bc0 correct MIMO power save action frame format;
this one really is from the D2.04 spec

MFC after:	3 days
2007-11-14 21:28:48 +00:00
Sam Leffler
0c99c16b0f correct termination check doing amsdu de-aggregation
MFC after:	3 days
2007-11-08 17:11:40 +00:00
Sam Leffler
5773d80e69 Correct handling of off-channel frames:
o do not override the home channel recorded for the sta when the frame is
  received off-channel; this fixes a problem where we might think the sta
  was operating on the channel the frame was received on causing association
  requests to be ignored/rejected (likely cause of kern/99036)
o don't include rssi of off-channel frames in the avg rssi used to select
  a bss; this gives us a better estimate of the signal we will see for the
  station when on-channel

PR:		kern/99036
Found by:	Yubin Gong
Reviewed by:	sephe
MFC after:	1 week
2007-11-05 17:24:28 +00:00
Sam Leffler
1b6167d239 sync 11n support with vap code base; many changes based on interop
testing with all major vendors

MFC after:	1 week
2007-11-02 05:22:25 +00:00
Sam Leffler
cd9a2dab49 correct channel flags returned by IEEE80211_IOC_STA_INFO; we need
to return all 32-bits to identify stations operating with HT

MFC after:	1 week
2007-11-02 05:19:14 +00:00
Sam Leffler
8279a8ebf2 don't try to re-associate after a parameter change, too many ap's
don't do this right; instead go to the scan cache so we pass through
auth state (if the cache is warm we can do this w/o an actual scan)

MFC after:	1 week
2007-11-02 05:11:45 +00:00
Sam Leffler
b161c30793 silence complaint about not loading the wlan_scan_monitor module;
it does not exist and is not needed as monitor mode operation has
always required setting the current channel

Reviewed by:	thompsa
MFC after:	1 week
2007-10-24 20:20:41 +00:00
Sam Leffler
ab562eef00 invalidate ic_prevchan when constructing a new channel list
Approved by:	re (blanket wireless)
2007-09-18 21:54:27 +00:00
Sam Leffler
37c8bda5fa honor IEEE80211_C_TXFRAG; drivers should never get fragmented packets
unless they indicate they're able to handle them

Approved by:	re (blanket wireless)
2007-09-18 21:09:26 +00:00
Sam Leffler
bb239ce970 tag mgmt and null data frames w/ a WME priority so drivers can assume
only data frames require classification

Approved by:	re (blanket wireless)
2007-09-18 21:07:41 +00:00
Sam Leffler
2949b58fa7 mgmt subtype 13 is action
Approved by:	re (blanket wireless)
MFC after:	2 weeks
2007-09-18 21:02:23 +00:00
Sam Leffler
5698ab1ad3 Close longstanding race dropping inactive stations; grab a reference
to the node before starting the work, otherwise the node may go
away before a reference is made in ieee80211_send_mgmt.

Approved by:	re (blanket wireless)
Obtained from:	Atheros
2007-09-18 21:01:04 +00:00
Sam Leffler
e5ac9e91bd Safeguard count of stations in power save; don't touch it unless we're
operating in a mode where it should be maintained.

Approved by:	re (blanket wireless)
MFC after:	2 weeks
2007-09-18 20:55:51 +00:00
Sam Leffler
7edb9e0a7f skip IEEE80211_MODE_AUTO in announcing supported rates in ieee80211_announce;
there won't be any

Approved by:	re (blanket wireless)
2007-09-18 20:51:55 +00:00
Sam Leffler
f0ee92d585 o add IEEE80211_RATE_MCS to use instead of naked constant (for marking MCS)
o correct ieee80211_rate2media handling of MCS
o correct rate HT announcements for 11n devices

Approved by:	re (blanket wireless)
2007-09-18 20:46:36 +00:00
Sam Leffler
b337fbc435 o move IEEE80211_NONQOS_TID into a public location
o add IEEE80211_TID_SIZE and replace all the nake constants

Approved by:	re (blanket wireless)
2007-09-18 20:40:21 +00:00
Sam Leffler
95032ab129 remove IFM_IEEE80211_HT40PLUS and IFM_IEEE80211_HT40MINUS; they
never got used so nuke 'em before we branch

Approved by:	re (blanket wireless)
2007-09-18 20:30:40 +00:00
Sam Leffler
b105a06908 Update beacon handling to sync w/ vap code base:
o add driver callback to handle notification of beacon changes;
  this is required for devices that manage beacon frames themselves
  (devices must override the default handler which does nothing)
o move beacon update-related flags from ieee80211com to the beacon
  offsets storage (or handle however a driver wants)
o expand beacon offsets structure with members needed for 11h/dfs
  and appie's
o change calling convention for ieee80211_beacon_alloc and
  ieee80211_beacon_update
o add overlapping bss support for 11g; requires driver to pass
  beacon frames from overlapping bss up to net80211 which is not
  presently done by any driver
o move HT beacon contents update to a routine in the HT code area

Reviewed by:	avatar, thompsa, sephe
Approved by:	re (blanket wireless)
2007-09-17 19:07:24 +00:00
Sam Leffler
5ef9cd6c92 correct netband skip check in constructing a country ie
Approved by:	re (blanket net80211)
2007-09-17 03:48:32 +00:00
Sam Leffler
7595008bb1 oops, add missing bit from last change
Approved by:	re (blanket wireless)
2007-09-06 00:08:02 +00:00
Sam Leffler
c066143c08 Fixup sta inactivity handling:
o reset ni_inact when ni_inact_reload is changed so we're
  assured a valid setting
o never let ni_inact go negative
o add a knob to disable hostap sta idle handling (e.g. so it can be done
  by a user application)
o remove bogus reload on associate

Reviewed by:	avatar
Approved by:	re (blanket wireless)
2007-09-06 00:04:36 +00:00
Sam Leffler
14fb6b8fe2 o add 802.11 state machine states for DFS and client-side power save
o fixup drivers to ignore new states

Reviewed by:	avatar (?)
Approved by:	re (blanket wireless)
2007-09-05 21:31:32 +00:00
Sam Leffler
3f87f68e74 Update channel definition:
o add ic_extieee to hold the HT40 extension channel number
o add ic_state to track dynamic channel state for DFS
o add flags to mark regulatory channel requirements
o add state defs for DFS/radar support

Reviewed by:	avatar
Approved by:	re (blanket wireless)
2007-09-05 20:37:39 +00:00
Sam Leffler
eddedabe31 Miscellaneous fixups to 802.11 defs:
o update 11n definitions to D2.0 spec
o add IEEE80211_CAPINFO_SPECTRUM_MGMT for DFS support
o add CSA ie definition for DFS support
o purge some unused definitions
o correct 802.11 reason and status codes
o correct reason code returned when a sta tries to associate to an
  ap operating with WPA/RSN but without a WPA/RSN ie

Reviewed by:	thompsa, avatar
Approved by:	re (blanket wireless)
2007-09-05 20:29:51 +00:00
Sam Leffler
b1acbdbbbb o add M_WEP mbuf flag so drivers can mark frames that are decrypted by the
device and have had the crypto bits stripped from the 802.11 header
o strip mbuf flags in the rx path before passing up the stack

Reviewed by:	thompsa, sephe, avatar
Approved by:	re (blanket wireless)
2007-09-05 20:22:59 +00:00
Sepherosa Ziehau
f05ba5eeed Off-by-one bug in country ie construction, which will make HOSTAP send out
malformatted beacons.

Reviewed by: sam
Approved by: re (bmah), sam (mentor)
2007-08-26 11:34:51 +00:00
Sepherosa Ziehau
98b335504d Fix following nits:
- Per ieee80211com sysctl ctx leakage on detach
- getmgtframe incorrectly adjusts mbuf.m_data

Reviewed by: sam
Approved by: re (bmah), sam (mentor)
2007-08-26 11:32:56 +00:00
Sam Leffler
d72c72537e drop frames marked for encryption when no key is available
Reviewed by:	avatar
Approved by:	re (kensmith)
Obtained from:	madwifi
2007-08-24 15:44:27 +00:00
Sepherosa Ziehau
7f02e579c5 In add_channel(), search 11g channels if mode is AUTO and corresponding
11b channel is not found, e.g. Atheros 5211.

Reported by: matteo
Problem outlined by: thompsa
Reviewed by: sam, thompsa
Approved by: re (kensmith), sam (mentor)
Tested by: matteo (an early version)
2007-07-20 11:38:12 +00:00
Sam Leffler
c4ed2c08ad revert handling of ssid and bssid to be manadatory instead of advisory
Prodded by:	Kevin Gerry
Reviewed by:	thompsa, sephe
Approved by:	re (kensmith)
2007-07-12 17:22:43 +00:00
Andrew Thompson
d4548f0965 Move the XCHANNEL radiotap definition to a free slot. NetBSD defined some
additional values causing a conflict.

Submitted by:	sam
Approved by:	re (kensmith)
2007-07-01 06:59:30 +00:00
Andrew Thompson
d81b3a5588 Fix scanning issues since the new net80211 code went in
- provide dummy routines for ic_scan_curchan and ic_scan_mindwell, we do not support those operations.
- add ieee80211_scan_done() to tell the scanning module that all channels have been scanned.
- pass IEEE80211_S_SCAN state off to net80211 so it can initiate scanning
- fix overflow in the rates array
- scale the rate value passed back from the firmware scan to the units that net80211 uses.

Submitted by:	Token
Reviewed by:	sam, avatar
Approved by:	re (kensmith)
2007-06-30 21:39:21 +00:00
Andrew Thompson
b54b1bab4b Change the channel number in the scan results struct to be a pointer to the
operating channel and use this in the scan cache rather than directly using
ic_curchan. Some firmware cards can only do a full scan and so ic_curchan does
not have the correct value.

Also add IEEE80211_CHAN2IEEE to directly dereference ic_ieee from the channel
to be used in the fast path.

Reviewed by:	sam, sephe
Approved by:	re (kensmith)
2007-06-30 21:23:23 +00:00
Sam Leffler
b038594e17 Correct msecs_to_ticks macro. This fixes problems when hz is not the
default 1000 setting.

Reviewed by:	thompsa, rpaulo
Approved by:	re (bmah)
2007-06-25 03:26:10 +00:00
Sam Leffler
cb8bac4aee Correct state machine handling of AUTH -> AUTH transitions that pass
through wpa_supplcant.  If a sta is deauth'd (e.g. due to inactivity)
with roaming mode set to manual then a subsequent MLME assoc request
will be incorrectly handled and the station will never reauthenticate.
To fix this interpret a reason code of zero as sufficient to send an
auth request frame.
2007-06-16 05:13:48 +00:00
Warner Losh
820d8b5c5d Prefer __packed to __attribute__((__packed__)).
OK'd by sam@ months ago...
2007-06-11 19:34:53 +00:00
Sam Leffler
68e8e04e93 Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
  fully enumerated and uniquely identify the operating characteristics;
  these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
  background scanning and roaming
o move scanning support into loadable modules based on the operating
  mode to enable different policies and reduce the memory footprint
  on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
  mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
  we use a simple algorithm to trigger a roam: we threshold the rssi
  and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
  drivers but is incomplete; it's included now to establish a baseline
  for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
  prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
  encapsulation (note this can be used with any card that can tx+rx
  large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
  authentication and association failures
o enable the addition of sta mode power save support for drivers that need
  net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
  results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
  index into the rate set; this needs to be extended to deal with
  multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing

Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
       dynamic turbo (lightly tested), 11n (sniffing only and needs
       new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
       rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested

This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others.  Much of the scanning work was supported by
Atheros.  The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
Sam Leffler
ae8b733312 copyright updates:
o update to include 2007
o switch back to a 2-clause bsd-only license

Reviewed by:	onoe
2007-06-06 04:56:04 +00:00
Sepherosa Ziehau
63afe606f8 - Nuke unnecessary header.
- Make wlan_amrr depend on wlan, so that it can find various symbols in
  wlan module if wlan is not compiled into kernel.

Approved by:	sam (mentor)
Tested by:	kevlo
2007-05-05 11:07:52 +00:00
Sam Leffler
6dbd16f1cc change ic_modecaps to a bit vector and use setbit, et. al. 2007-03-11 22:37:32 +00:00
Sam Leffler
c6303b231f Update to reflect correct usage:
o leave IEEE80211_RADIOTAP_HDRLEN for portability to other systems but
  correct comment about radiotap headers being padded to 64-bytes
  (hasn't been true for many years)
o remove reference to IEEE80211_RADIOTAP_FCS; it was never used, instead
  the flags are marked with IEEE80211_RADIOTAP_F_FCS to indicate whether
  or not FCS is present

Might be better to just remove IEEE80211_RADIOTAP_HDRLEN so drivers
don't bogusly pad.

MFC after:	2 weeks
2007-03-11 07:42:02 +00:00
Sam Leffler
70e28b9a2d change ieee80211_fix_rate to take a rate set instead of using
ni_rates; this lets us re-use the code to check 11n HT rates

MFC after:	2 weeks
2007-03-11 07:22:21 +00:00
Sam Leffler
a000d7c202 expose IEEE80211_DISCARD, IEEE80211_DISCARD_IE, and IEEE80211_DISCARD_MAC
so they can be used within net80211 but outside ieee80211_input.c

MFC after:	2 weeks
2007-03-11 07:15:38 +00:00
Sam Leffler
ca700860df improve debug msg for ie's that are too short
MFC after:	2 weeks
2007-03-11 07:08:04 +00:00
Sam Leffler
801df4a58c keep tx/rx seq #'s for non-QoS traffic separate from QoS; stations
aren't supposed mix traffic but if they did frames might be mis-handled

Obtained from:	Atheros
MFC after:	2 weeks
2007-03-11 07:06:08 +00:00
Sam Leffler
0adf0a3b3e split check for rate set mismatch on assoc req away from check
for pure 11g mode so we can give meaningful diagnostic msgs

MFC after:	2 weeks
2007-03-11 06:55:59 +00:00
Sam Leffler
9672f0230f disallow re-associate with a slot time mismatch
Obtained from:	Atheros
MFC after:	2 weeks
2007-03-11 06:52:22 +00:00
Sam Leffler
f597faba37 move __inline before type to appease gcc 4.x
Obtained from:	netbsd
2007-03-11 06:44:51 +00:00
Sam Leffler
7835d71cde white space diff reduction 2007-03-11 06:38:26 +00:00
Sam Leffler
cda15ce18b add IEEE80211_KEY_UNDEFINED and use it instead of local defs
Obtained from:	netbsd
2007-03-11 06:36:10 +00:00
Sam Leffler
b265ac32c2 discard deauth+disassoc frames that are not destined for us; these
can be received when the interface is in promisc mode

Reviewed by:	sephe
Obtained from:	netbsd
2007-03-11 06:35:27 +00:00
Sam Leffler
11df4239a6 change ieee80211_mhz2ieee to use the PSB mapping when the frequency
falls in the proper place, not when we're handed a 1/2 or 1/4-rate channel

MFC after:	2 weeks
2007-03-11 06:24:26 +00:00
Sam Leffler
3c419c1bb5 When dispatching frames saved on the power save queue to a
station exiting power save mode prepend them to the driver's
send q instead of appending them.  This insures the packets
are not misordered wrt any packets already q'd for the station.

This corrects a problem noticed when using a VoIP phone talking
to an ath card in ap mode; the misordered packets caused noise.

Submitted by:	"J.R. Oldroyd" <jr@opal.com>
MFC after:	2 weeks
2007-03-07 04:42:22 +00:00
Sam Leffler
49aa47d6c7 add ieee80211_opmode_name array for mapping the opmode to a string
for printing diagnostic msgs

MFC after:	2 weeks
2007-03-07 04:35:07 +00:00
Sam Leffler
fe49f061b4 when starting up an ibss master use a random address for
the bssid; this is required for wifi alliance compliance

Obtained from:	Atheros
MFC after:	2 weeks
2007-03-07 04:31:49 +00:00
Sam Leffler
89f0549d37 correct inital bounds check on returning scan results; this does not
paper over catching an error as the case was already handled, albeit
in a somewhat surprising way (the caller received zero'd data)

Submitted by:	sephe
MFC after:	2 weeks
2007-03-05 19:12:25 +00:00
Sam Leffler
f48ad55ef5 correct conversions between TU and ms/ticks; these are not used
by any code in the tree[1] and are close enough for common values
that this change is a noop

[1] ath uses one macro to calculate a value that is not used
Submitted by:	sephe
MFC after:	1 week
2007-03-05 18:52:35 +00:00
Sam Leffler
f3b179a4b1 clear/reclaim challenge text when switching auth mode and operating as an ap
Obtained from:	Atheros
2007-02-04 05:49:16 +00:00
Sam Leffler
d9ff043726 add IEEE80211_IS_CHAN_PASSIVE
MFC after:	1 week
2007-02-02 02:45:33 +00:00
Sam Leffler
ca4ac7ae14 Add initial support for 900MHz cards like the Ubiquiti SR9:
o add channel flag to enable freq <-> ieee channel # mapping (can
  go away in the future when ieee number is precomputed)
o add mapping between 900mhz freq's and channel #'s that gives a
  unique channel # for each half/quarter/full width channel
o remove assumptions that half/quarter rate channels on happen in 11a
o remove assumptions that all 11g channels are full width
o ensure ic_curchan is reset on mode change so changing the channel
  list (e.g. on countrycode change) doesn't leave curchan set to an
  invalid channel

There is still an issue with switching rate sets; to be fixed separately.

MFC after:	1 month
2007-01-15 01:12:28 +00:00
Sam Leffler
5675bedd40 reduce user-visible namespace to just what is needed
MFC after:	2 weeks
2007-01-09 04:37:05 +00:00
Sam Leffler
37c970e41e bandaid to unbreak build (user code includes this file) 2007-01-09 00:33:10 +00:00
Sam Leffler
915f1482a9 Fix potential node refcnt leak. If mbufs are q'd on ic_mgtq when
the state machine clocks to INIT, node references are not reclaimed.
Add a new routine ieee80211_drain_ifq that does this and use it
instead of IF_DRAIN.

Submitted by:	Sepherosa Ziehau
Obtained from:	DragonFly
MFC after:	1 month
2007-01-08 18:23:43 +00:00
Sam Leffler
79edaebfe4 Correct several issues with rate set negotiation:
o add IEEE80211_F_JOIN flag to ieee80211_fix_rate to indicate a station
  is joining a BSS; this is used to control whether or not we over-write
  the basic rate bit in the calculated rate set
o fix ieee80211_fix_rate to honor IEEE80211_F_DODEL when IEEE80211_F_DONEGO
  is not specified (e.g. when joining an ibss network)
o on sta join always delete unusable rates from the negotiated rate set,
  this was being done only ibss networks but is also needed for 11g bss
  with mixed stations
o on sta join delete unusable rates from the bss node's rate set, not the
  scan table entry's rate set
o when calculating a rate set for new neighbors in an ibss caculate a
  negotiated rate set so drivers are not presented with rates they should
  not use

Submitted by:	Sepherosa Ziehau (w/ modifications)
Obtained from:	DragonFly
MFC after:	1 month
2007-01-08 17:24:51 +00:00
Matt Jacob
38da14963f Fix compile error. 2007-01-06 05:38:18 +00:00
Kip Macy
fe1903bcff fix declaration / definition mismatch with ieee80211_chan2ieee 2007-01-06 02:56:41 +00:00
Sam Leffler
45fa8b0e9a o unbreak rate set defaulting
o mark 11g mode support on finding 11g or pure 11g (OFDM-only)
  channels; was requiring pure 11g which caused some contortions
  in drivers that manually setup their channel lists
2006-12-28 01:31:26 +00:00
Sam Leffler
41b3c790eb First cut at half/quarter-rate 11a channel support (e.g. for use
in the Public Safety Band):
o add channel flags to identify half/quarter-rate operation
o add rate sets (need to check spec on 4Mb/s in 1/4 rate)
o add if_media definitions for new rates
o split net80211 channel setup out into ieee80211_chan_init
o fixup ieee80211_mhz2ieee and ieee80211_ieee2mhz to understand half/quarter
  rate channels: note we temporarily use a nonstandard/hack numbering that
  avoids overlap with 2.4G channels because we don't (yet) have enough
  state to identify and/or map overlapping channel sets
o fixup ieee80211_ifmedia_init so it can be called post attach and will
  recalculate the channel list and associated state; this enables changing
  channel-related state like the regulatory domain after attach (will be
  needed for 802.11d support too)
o add ieee80211_get_suprates to return a reference to the supported rate
  set for a given channel
o add 3, 4.5, and 27 MB/s tx rates to rate <-> media conversion routines
o const-poison channel arg to ieee80211_chan2mode
2006-12-27 18:46:18 +00:00
Warner Losh
f4fcdb0eb5 Fix packing on the country band descriptor. No real change since this
is unused.

Reviewed by: sam
2006-12-01 18:40:51 +00:00
Sam Leffler
ab96db105f back out use of LLC_SNAPFRAMELEN now that sizeof(struct llc) isn't
padded on arm
2006-12-01 17:58:33 +00:00
Sam Leffler
8c86f43df4 sizeof(struct llc) includes padding on arm; use LLC_SNAPFRAMELEN for now
Submitted by:	jhay
MFC after:	2 weeks
2006-12-01 05:48:35 +00:00