Commit Graph

675 Commits

Author SHA1 Message Date
Sam Leffler
9fcf53181b use c99-style initializers 2009-06-07 23:16:10 +00:00
Sam Leffler
e755a73d19 teach ieee80211_classify about ipv6 packets
Reviewed by:	bz, rrs
2009-06-07 22:06:15 +00:00
Sam Leffler
ee5cf10652 add iv_flags_ht and ic_flags_ht 2009-06-07 22:03:25 +00:00
Sam Leffler
2bfc8a91c9 iv_flags_ext is full, make room by moving HT-related flags to a new
iv_flags_ht word
2009-06-07 22:00:22 +00:00
Sam Leffler
5c0aa6182b o add bits for STBC and Greenfield
o fix some comments
2009-06-06 00:32:15 +00:00
Sam Leffler
d0dd594caf reserve node flag bits for a-msdu tx/rx 2009-06-05 23:37:57 +00:00
Sam Leffler
da6e1ed31b reserve ioc's for Greenfield and STBC 2009-06-05 23:36:48 +00:00
Sam Leffler
b8ee2a22a9 correct status code returned for ht capability mismatch on assoc/reassoc 2009-06-05 23:21:29 +00:00
Sam Leffler
1dadcead9d o correct/add action frame categories
o add IEEE80211_STATUS_MISSING_HT_CAPS, added in 11n D3.0 spec
2009-06-05 23:20:41 +00:00
Sam Leffler
ebaf87eb03 add tid param to ieee80211_notify_replay_failure to get the correct rsc 2009-06-05 23:10:30 +00:00
Robert Watson
c27b9cdb83 Fix spelling of MAC check for 8.x version of MAC Framework, not noticed due
to a lack of an opt_mac.h include, which I won't add for now as options MAC
will soon move to opt_global.h.

Spotted by:	pjd
2009-06-05 13:55:33 +00:00
Sam Leffler
c70761e6b5 o station mode channel switch support
o IEEE80211_IOC_CHANSWITCH fixups:
  - restrict to hostap vaps
  - return EOPNOTSUPP instead of EINVAL when applied to !hostap vap
    or to a vap w/o 11h enabled
  - interpret count of 0 to mean cancel the current CSA

Reviewed by:	rpaulo, avatar
2009-06-04 15:57:38 +00:00
Sam Leffler
7131987ded When a channel switch is done to a channel with different operating
characteristics force the stations to re-associate so protocol state
is re-initialized.  Note that for 11h/DFS this is irrelevant as channel
changes are never cross-band.

Reviewed by:	ctlaw
2009-06-03 23:33:09 +00:00
Sam Leffler
4e15098821 After a channel switch mark associated stations so they will immediately
be probed as inactive; this more quickly weeds out stations that don't
follow to the new channel.
2009-06-03 23:30:25 +00:00
Weongyo Jeong
38812f8ee6 calls callout_drain(9) to un-schedule a scan timer to prevent a page
fault in softclock.

Submitted by:	sam
Reviewed by:	jhb, sam (original version), thompsa
2009-06-03 04:10:22 +00:00
Sam Leffler
35f434b2a4 remove another vestige of the null if_softc on detach hack 2009-06-02 20:51:59 +00:00
Sam Leffler
3cdd9880a0 fix typo 2009-06-02 20:48:12 +00:00
Sam Leffler
0a310468af partially fix mode setting; this no longer returns an error but still
needs to handle the case where the vap is up+running

Noticed by:	"Paul B. Mahol" <onemda@gmail.com>
2009-06-02 20:00:43 +00:00
Sam Leffler
5c600a90de move if_detach to the top of ieee80211_ifdetach to close various races
Reviewed by:	jhb
2009-06-02 18:55:27 +00:00
Sam Leffler
1da89db5d6 Remove hack used to deal with ifnet teardown now that if_detach and the
bridge do a better job.
o move ether_ifdetach to the top of ieee80211_detach
o do not clear if_softc at the top of ieee80211_detach; we no longer need
  this because we are safeguarded against calls coming back through if_ioctl
o simplify the bpf tracker now that we don't null if_softc

This also fixes an issue where having a bpf consumer active when a vap
is destroyed would cause a crash because bpf referenced free'd memory.

Reviewed by:	imp
2009-06-02 16:57:27 +00:00
Sam Leffler
e1cfcbcb4e Fix monitor mode vaps to work as intended:
o track # bpf taps on monitor mode vaps instead of # monitor mode vaps
o spam monitor mode taps on tx/rx
o fix ieee80211_radiotap_rx_all to dispatch frames only if the vap is up
o while here print radiotap (and superg) state in show com
2009-06-02 00:33:28 +00:00
Sam Leffler
c3655fa4f2 don't dispatch frames to vap's not running 2009-06-02 00:06:39 +00:00
Sam Leffler
13471c2b32 count packets 2009-06-02 00:04:10 +00:00
Sam Leffler
a43cee7009 pad data structures to enable integration of future features w/o abi breakage 2009-06-01 16:36:28 +00:00
Sam Leffler
a77b10b321 distribute sysctl decls so global variables can be made static 2009-05-30 20:11:23 +00:00
Sam Leffler
39c3faaf70 o assert TDMA_MAXSLOTS is 2 so noone tries to blindly increase it
o add safety belt in vdetach for failed state block allocation
o fix dynamic change to tdma config; ERESTART may not result in
  kicking the state machine so we need to explicitly mark the
  beacon for update

Sponsored by:
2009-05-30 19:57:31 +00:00
Sam Leffler
d0c57ece38 add ieee80211_isratevalid 2009-05-29 23:39:16 +00:00
Sam Leffler
a6c3cf3eca Fix handling of devices w/o radiotap support:
o do not attach DLT_IEEE802_11_RADIO unless both tx and rx headers are
  present; this is assumed in the capture code paths
o verify the above with asserts in ieee80211_radiotap_{rx,tx}
o add missing checks for active taps before calling ieee80211_radiotap_rx
2009-05-25 16:38:47 +00:00
Sam Leffler
ac86de8587 do internal bpf tracking only for radiotap DLT's 2009-05-25 16:35:31 +00:00
Sam Leffler
f6ac50113f Prepare to distribute sysctl code to reduce global definitions:
o expose net.wlan sysctl node
o expose ieee80211_sysctl_msecs_ticks

Reviewed by:	rpaulo, thompsa
2009-05-20 20:18:01 +00:00
Sam Leffler
5463c4a485 Overhaul monitor mode handling:
o replace DLT_IEEE802_11 support in net80211 with DLT_IEEE802_11_RADIO
  and remove explicit bpf support from wireless drivers; drivers now
  use ieee80211_radiotap_attach to setup shared data structures that
  hold the radiotap header for each packet tx/rx
o remove rx timestamp from the rx path; it was used only by the tdma support
  for debugging and was mostly useless due to it being 32-bits and mostly
  unavailable
o track DLT_IEEE80211_RADIO bpf attachments and maintain per-vap and
  per-com state when there are active taps
o track the number of monitor mode vaps
o use bpf tap and monitor mode vap state to decide when to collect radiotap
  state and dispatch frames; drivers no longer explicitly directly check
  bpf state or use bpf calls to tap frames
o handle radiotap state updates on channel change in net80211; drivers
  should not do this (unless they bypass net80211 which is almost always
  a mistake)
o update various drivers to be more consistent/correct in handling radiotap
o update ral to include TSF in radiotap'd frames
o add promisc mode callback to wi

Reviewed by:	cbzimmer, rpaulo, thompsa
2009-05-20 20:00:40 +00:00
Sam Leffler
1fdf2b5058 add block ack frame id 2009-05-18 19:02:55 +00:00
Sam Leffler
95b0b37cfc add missing type for SYSCTL_PROC items; w/o a type you can view the value
but not change it
2009-05-14 16:25:57 +00:00
Sam Leffler
70ca3d6a9f correct handling of ctl frames: the sender's address is always i_addr2 for
frames we should expect to process (old code was trying to handle frames
we should never see--like ACK)

Reviewed by:	thompsa, cbzimmer
2009-05-14 16:23:24 +00:00
Andrew Thompson
b016f58c51 Cancel the scan when going to INIT state. Should do this for other states here
too as once the protocol newstate handler runs the scan has always ended.
2009-05-10 02:21:19 +00:00
Marko Zec
21ca7b57bd Change the curvnet variable from a global const struct vnet *,
previously always pointing to the default vnet context, to a
dynamically changing thread-local one.  The currvnet context
should be set on entry to networking code via CURVNET_SET() macros,
and reverted to previous state via CURVNET_RESTORE().  Recursions
on curvnet are permitted, though strongly discuouraged.

This change should have no functional impact on nooptions VIMAGE
kernel builds, where CURVNET_* macros expand to whitespace.

The curthread->td_vnet (aka curvnet) variable's purpose is to be an
indicator of the vnet context in which the current network-related
operation takes place, in case we cannot deduce the current vnet
context from any other source, such as by looking at mbuf's
m->m_pkthdr.rcvif->if_vnet, sockets's so->so_vnet etc.  Moreover, so
far curvnet has turned out to be an invaluable consistency checking
aid: it helps to catch cases when sockets, ifnets or any other
vnet-aware structures may have leaked from one vnet to another.

The exact placement of the CURVNET_SET() / CURVNET_RESTORE() macros
was a result of an empirical iterative process, whith an aim to
reduce recursions on CURVNET_SET() to a minimum, while still reducing
the scope of CURVNET_SET() to networking only operations - the
alternative would be calling CURVNET_SET() on each system call entry.
In general, curvnet has to be set in three typicall cases: when
processing socket-related requests from userspace or from within the
kernel; when processing inbound traffic flowing from device drivers
to upper layers of the networking stack, and when executing
timer-driven networking functions.

This change also introduces a DDB subcommand to show the list of all
vnet instances.

Approved by:	julian (mentor)
2009-05-05 10:56:12 +00:00
Andrew Thompson
8ee6f90a0c Relax the condition for printing the lost state transition message. The new
state will be set before the EXT_STATEWAIT flag is cleared and its ok to
transition again at that point.
2009-05-03 18:29:04 +00:00
Sam Leffler
86629111ea don't say "ac WME_AC_BE"; remove "ac" 2009-05-02 20:28:55 +00:00
Sam Leffler
dca68715ab promote ieee80211_seq typedef 2009-05-02 20:25:22 +00:00
Sam Leffler
43049c4828 o dump tx/rx seq#'s for qos tid's
o improve check for when to dump rx ampdu state
2009-05-02 20:21:21 +00:00
Sam Leffler
24a599dd50 whitespace 2009-05-02 20:18:18 +00:00
Sam Leffler
04f19fd699 make superg/fast-frames state dynamically-allocated (and indirect off
the com structure instead of embedded); this reduces the overhead when
not configured and reduces visibility of the contents
2009-05-02 20:16:55 +00:00
Andrew Thompson
5efea30f03 Create a taskqueue for each wireless interface which provides a serialised
sleepable context for net80211 driver callbacks. This removes the need for USB
and firmware based drivers to roll their own code to defer the chip programming
for state changes, scan requests, channel changes and mcast/promisc updates.
When a driver callback completes the hardware state is now guaranteed to have
been updated and is in sync with net80211 layer.

This nukes around 1300 lines of code from the wireless device drivers making
them more readable and less race prone.

The net80211 layer has been updated as follows
 - all state/channel changes are serialised on the taskqueue.
 - ieee80211_new_state() always queues and can now be called from any context
 - scanning runs from a single taskq function and executes to completion. driver
   callbacks are synchronous so the channel, phy mode and rx filters are
   guaranteed to be set in hardware before probe request frames are
   transmitted.

Help and contributions from Sam Leffler.

Reviewed by:	sam
2009-05-02 15:14:18 +00:00
Sam Leffler
ce7fa847ac revert wip 2009-05-01 21:31:39 +00:00
Sam Leffler
9a841c7fd0 Store the tx seq# of an 802.11 frame in the mbuf pkthdr; this will be
used for s/w retransmit schemes that want to access this information
w/o the overhead of decoding the raw frame.  Note this also allows
drivers to record this information w/o writing the frame when the seq#
is obtained through an out-of-band mechanism (e.g. when a h/w assigned
seq# is reported in a descriptor on tx done notification).

Reviewed by:	sephe, avatar
2009-04-27 17:39:41 +00:00
Sam Leffler
f2a6a13c3b add IEEE80211_FEXT_4ADDR to indicate ieee80211_encap should do 4-address
encapsulation when relaying frames; this reduces the cost of the test and
enables use for situations other than "sta vap + dwds"
2009-04-26 23:11:22 +00:00
Sam Leffler
0510acbded don't depend on includes to get definitions of struct ieee80211_tx_ampdu
and ieee80211_rx_ampdu; these should've been part of r191552
2009-04-26 23:04:35 +00:00
Sam Leffler
168f582e2e hoist ampdu tx aggregation setup from ieee80211_encap to ieee80211_start
where it was meant all along (the code was in encap because ampdu was
implemented pre vaps)
2009-04-26 23:02:17 +00:00
Sam Leffler
51b5aba2d6 allow drivers to hook ampdu rx start/stop 2009-04-26 22:54:51 +00:00
Sam Leffler
7f6a5468a6 improvements:
o formatting
o more rx ampdu state
o tdma state
o show ifnet names
o show auth policy name
2009-04-26 22:49:25 +00:00
Sam Leffler
7ebe9c0e2e stash the node pointer in the mbuf before doing ff aggregration so this
is done in only one place
2009-04-26 22:45:21 +00:00
Sam Leffler
ec4313cb78 whitespace 2009-04-26 22:44:23 +00:00
Sam Leffler
dc7bf546c8 print both fc bytes when hitting a protocol version mismatch 2009-04-26 21:50:21 +00:00
Sam Leffler
49eae5f79e add iv_recv_ctl method to allow hooking rx ctl frame handling 2009-04-26 21:46:04 +00:00
Sam Leffler
e9cfc1f500 don't fragment ampdu aggregates 2009-04-26 21:37:02 +00:00
Sam Leffler
9e80b1df7e uniformly mark mbufs that pass through the tx path with M_MCAST; drivers
can now use this flag instead of inspecting the contents
2009-04-26 21:34:53 +00:00
Sam Leffler
90f8f6d883 o add missing 802.3 bpf tap
o add 802.11 bpf tap to output path now that it's removed from ieee80211_encap
2009-04-26 21:21:48 +00:00
Sam Leffler
dc72796759 add missing DLT_IEEE802_11 tap 2009-04-26 21:21:07 +00:00
Sam Leffler
525ae70f94 add missing part of r191537 that should have read: hoist DLT_IEEE802_11
bpf tap from ieee80211_encap up to ieee80211_start
2009-04-26 21:16:29 +00:00
Sam Leffler
fad788b1dc fix comment 2009-04-26 21:13:18 +00:00
Sam Leffler
77825c77d7 add missing DLT_IEEE802_11 bpf tap in ieee80211_start 2009-04-26 21:12:19 +00:00
Sam Leffler
0e910c9412 fixup ieee80211_output handling:
o correct bpf handling, send 'em to the right tap
o do accouting
o mark mbufs holding multicast frames
2009-04-26 21:11:12 +00:00
Sam Leffler
8bbd3e4119 o use shared code to handle bpf tap and mbuf cleanup
o swap conditional order to put the cheapest first
2009-04-26 21:03:29 +00:00
Sam Leffler
7cd89f6474 correct bssid reporting for wds vaps 2009-04-26 20:55:31 +00:00
Rui Paulo
d4f7b23302 Remove spurious 'or'. 2009-04-23 22:08:44 +00:00
Kip Macy
279aa3d419 Change if_output to take a struct route as its fourth argument in order
to allow passing a cached struct llentry * down to L2

Reviewed by:	rwatson
2009-04-16 20:30:28 +00:00
Sam Leffler
5434ed5af3 setup turboA/G fixed rate parameters too; this is needed, in particular,
for turboG operation
2009-04-13 20:53:12 +00:00
Sam Leffler
baa55e71d4 correct debug printf 2009-04-13 20:50:51 +00:00
Sam Leffler
4477b68344 check correct address for a bssid mtch 2009-04-13 20:50:07 +00:00
Sam Leffler
c5262b82e6 fix txparms setup for 108G sta's: ieee80211_iserp_rateset does not
identify a station operating in turbo-boost mode because it has a
pure ofdm rate set; add an explicit check for the channel type
instead of depending on IEEE80211_NODE_ERP being set
2009-04-13 20:45:29 +00:00
Sam Leffler
9fb0fccb89 o add a capability for drivers that require 802.3 encapsulation of
frames passed down through the transmit path
o mark ndis requiring 802.3 encap'd frames

Reviewed by:	"Paul B. Mahol" <onemda@gmail.com>, thompsa
2009-04-08 16:19:50 +00:00
Sam Leffler
bafb92643e fix whitespace 2009-04-03 20:46:32 +00:00
Sam Leffler
6437e6da3d o update dwds mcast handling after hoisting ieee80211_encap: frames need
to be encapsulated before dispatching to the driver
o eliminate M_WDS now that we call ieee80211_encap directly and can supply
  the wds vap to indicate a 4-address frame should be created
2009-04-03 18:00:19 +00:00
Sam Leffler
339ccfb391 Hoist 802.11 encapsulation up into net80211:
o call ieee80211_encap in ieee80211_start so frames passed down to drivers
  are already encapsulated
o remove ieee80211_encap calls in drivers
o fixup wi so it recreates the 802.3 head it requires from the 802.11
  header contents
o move fast-frame aggregation from ath to net80211 (conditional on
  IEEE80211_SUPPORT_SUPERG):
  - aggregation is now done in ieee80211_start; it is enabled when the
    packets/sec exceeds ieee80211_ffppsmin (net.wlan.ffppsmin) and frames
    are held on a staging queue according to ieee80211_ffagemax
    (net.wlan.ffagemax) to wait for a frame to combine with
  - drivers must call back to age/flush the staging queue (ath does this
    on tx done, at swba, and on rx according to the state of the tx queues
    and/or the contents of the staging queue)
  - remove fast-frame-related data structures from ath
  - add ieee80211_ff_node_init and ieee80211_ff_node_cleanup to handle
    per-node fast-frames state (we reuse 11n tx ampdu state)
o change ieee80211_encap calling convention to include an explicit vap
  so frames coming through a WDS vap are recognized w/o setting M_WDS

With these changes any device able to tx/rx 3Kbyte+ frames can use fast-frames.

Reviewed by:	thompsa, rpaulo, avatar, imp, sephe
2009-03-30 21:53:27 +00:00
Rui Paulo
4f8cb6ff40 Fix typo in comment. 2009-03-30 21:46:50 +00:00
Rui Paulo
8407aa1494 MFP mesh11s:
Add mesh debugging bit replacing the now deprecated RADKEYS.
2009-03-30 21:41:06 +00:00
Sam Leffler
26d39e2c68 o add ic_rt to track the rate table for the current channel; this enables
calculation of packet transmit times to do things like check txop limits
o remove equivalent driver code and convert to use net80211 state
2009-03-29 21:17:08 +00:00
Sam Leffler
97fc5da03e toggling fast-frames requires clocking the state machine 2009-03-29 21:00:27 +00:00
Sam Leffler
29aca94080 Eliminate ic_myaddr so changing the mac address of a device works correctly:
o remove ic_myaddr from ieee80211com
o change ieee80211_ifattach to take the mac address of the physical device
  and use that to setup the lladdr.
o replace all references to ic_myaddr in drivers by IF_LLADDR
o related cleanups (e.g. kill dead code)

PR:		kern/133178
Reviewed by:	thompsa, rpaulo
2009-03-29 17:59:14 +00:00
Sam Leffler
9d90db9307 o move tdma+superg protocol defs out of public view
o add #ifdef _KERNEL to superg+tdma include files so they can be used
  by user code to get the protocol defs
2009-03-26 21:29:03 +00:00
Sam Leffler
4207227c6a Fix enough bits so that fast frames work again:
o include ath ie in beacon frames
o fix probe response check for including ath ie
o add ieee80211_add_athcap shorthand for ap-side ie additions
2009-03-26 19:13:11 +00:00
Sam Leffler
aeab3282fd dynamic turbo mode is only implemented in sta mode; don't enable it
for other operating modes based on the capability
2009-03-26 19:07:56 +00:00
Sam Leffler
d01b3c2603 need to adjust htinfo offset when csa is inserted 2009-03-26 19:06:00 +00:00
Sam Leffler
92e870ed4d adjust tdma ie offset when beacon frame contents changes 2009-03-26 19:04:11 +00:00
Sam Leffler
0cd9c215fa shuffle code so things build w/o INVARIANTS or IEEE80211_SUPPORT_SUPERG
Prodded by:	several
2009-03-25 03:02:03 +00:00
Sam Leffler
694f48d3a7 hide linker set stuff from user space 2009-03-24 21:02:19 +00:00
Sam Leffler
616190d079 split Atheros SuperG support out into it's own file that's included only
with a new IEEE80211_SUPPORT_SUPERG option
2009-03-24 20:39:08 +00:00
Sam Leffler
8c4e758a8b add linker sets for get/set ioctl handlers so optional net80211
code is isolated
2009-03-24 17:57:48 +00:00
Sam Leffler
fffcc698c7 use IEEE80211_SUPPORT_TDMA option to control whether code is
configured; this allows us to remove an #ifdef
2009-03-24 17:22:10 +00:00
Rui Paulo
b75e8a615c Remove leftover comment because we now use a flag to check for associd.
Discussed with:	sam
2009-03-19 18:45:37 +00:00
Rui Paulo
0ce9091af8 Fix typo in comment. 2009-03-19 18:34:58 +00:00
Rui Paulo
df0d214ad3 Use plural in a comment. No functional change. 2009-03-18 21:33:28 +00:00
Sam Leffler
f9b5a72f15 rate limit printfs for invalid tdma ie contents; probably want this to
be less than 1/sec
2009-03-18 19:38:39 +00:00
Sam Leffler
2bc3ce7732 Minor cleanups of tdma protocol handling:
o break out version-related code to simplify rev'ing the protocol
o add parameter validation macros so checks that appear multiple places
  are consistent (and easy to change)
o add protocol version check when looking for a scan candidate
o improve scan debug output format
o rewrite beacon update handling to calculate a bitmask of changed values
  and pass that down through the driver callback so drivers can optimize work
o do slot bounds check before use when parsing received beacons
2009-03-18 19:28:17 +00:00
Sam Leffler
645aa556fb add the desired channel to the scan list if not already present and
compatible with other scan controls
2009-03-04 22:05:25 +00:00
Ed Schouten
802cb57e34 Add memmove() to the kernel, making the kernel compile with Clang.
When copying big structures, LLVM generates calls to memmove(), because
it may not be able to figure out whether structures overlap. This caused
linker errors to occur. memmove() is now implemented using bcopy().
Ideally it would be the other way around, but that can be solved in the
future. On ARM we don't do add anything, because it already has
memmove().

Discussed on:	arch@
Reviewed by:	rdivacky
2009-02-28 16:21:25 +00:00
Bjoern A. Zeeb
33553d6e99 For all files including net/vnet.h directly include opt_route.h and
net/route.h.

Remove the hidden include of opt_route.h and net/route.h from net/vnet.h.

We need to make sure that both opt_route.h and net/route.h are included
before net/vnet.h because of the way MRT figures out the number of FIBs
from the kernel option. If we do not, we end up with the default number
of 1 when including net/vnet.h and array sizes are wrong.

This does not change the list of files which depend on opt_route.h
but we can identify them now more easily.
2009-02-27 14:12:05 +00:00
Sam Leffler
cc3e9fe79c change tdma slave behaviour: if the channel is locked don't do bmiss handling
(so no scanning/roaming)

Reviewed by:	Chris Anderson
2009-02-22 18:48:54 +00:00
Sam Leffler
110a70e3b2 display min/max dwell times in msecs in debug msgs 2009-02-22 18:46:36 +00:00
Sam Leffler
aa68c24fb7 mark nodes created by way of neighbor discovery need to be marked as ERP
so they get the correct tx parameters setup by node_settxparms
2009-02-20 23:05:05 +00:00