Commit Graph

183 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Diomidis Spinellis
132142c572 Move conditional preprocessing out from the IEEE80211_DPRINTF macro
invocation.  Per C99 6.10.3 paragraph 11 preprocessing directives
appearing as macro arguments yield undefined behavior.
2006-06-01 14:06:32 +00:00
Sam Leffler
ee25b8df01 Ensure outbound data packets in hostap mode are delivered only to
stations that are associated by making ieee80211_find_txnode return
NULL when a unicast frame is to be delivered to an unassociated
station.  This will be handled differently in the future but for
now putting the check here allows all drivers to immediately do
the right thing.

Reviewed by:	avatar
MFC after:	1 week
2006-04-28 19:06:15 +00:00
Sam Leffler
097131fffe when scanning channels marked passive defer probe request until
802.11 traffic is seen; fixes problems with ap's hiding their ssid

Obtained from:	atheros
MFC after:	1 week
2006-03-06 17:23:26 +00:00
Sam Leffler
a1a5050276 bump the scan generation number before iterating so we're guaranteed
to have a value that's not been used before; this fixes the problem
where the first traversal of the scan list did nothing because the
entries were initialized with the current generation number (a
separate issue)

MFC after:	1 week
2006-01-18 19:56:17 +00:00
Sam Leffler
0912bac9b3 update erp information element in the beacon frame to reflect
changes in the bss

Reviewed by:	avatar
Obtained from:	atheros
MFC after:	2 weeks
2006-01-02 16:57:20 +00:00
Sam Leffler
8e292e8ecd When creating neighbor entries for an ahdemo bss apply the local
settings.  In particular this allows us to use QoS frames in a
bss and in turn enables disabling ack's.
2005-12-14 01:18:36 +00:00
Sam Leffler
50d8b493e4 when creating an ahdemo bss use any requested bssid; otherwise use zero
Obtained from:	madwifi
2005-12-14 01:16:22 +00:00
Sam Leffler
1fd2349de8 propagate current bss state on sta join so, in particular, authmode
is set properly in the new bss node

MFC after:	2 weeks
2005-12-12 18:44:27 +00:00
Sam Leffler
1b49e12042 Bandaid ieee80211_set_chan to handle a channel parameter of "any";
this can happen under certain conditions when scanning.  This logic
will eventually go away with the new scanning code.

While here de-inline the routine.

MFC after:	1 week
2005-12-12 18:42:20 +00:00
Sam Leffler
be425a0f40 Adhoc mode fixups:
o plug memory leak in adhoc mode: on rx the sender may be the
  current master so simply checking against ic_bss is not enough
  to identify if the packet comes from an unknown sender; must
  also check the mac address
o split neighbor node creation into two routines and fillin state
  of nodes faked up on xmit when a beacon or probe response frame
  is later received; this ensures important state like the rate set
  and advertised capabilities are correct

Obtained from:	netbsd
MFC after:	1 week
2005-12-04 04:50:27 +00:00
Sam Leffler
5ff8092143 revert 1.64: we cannot use the channel characteristics to decide when to
do 11g erp sta accounting because b/g channels show up as false positives
when operating in 11b.

Noticed by:	Michal Mertl
2005-08-13 17:50:21 +00:00
Sam Leffler
efefac4077 Don't use ic_curmode to decide when to do 11g station accounting,
use the station channel properties.  Fixes assert failure/bogus
operation when an ap is operating in 11a and has associated stations
then switches to 11g.

Noticed by:	Michal Mertl
Reviewed by:	avatar
MFC after:	2 weeks
2005-08-10 17:42:13 +00:00
Sam Leffler
b5c9941514 Clarify/fix handling of the current channel:
o add ic_curchan and use it uniformly for specifying the current
  channel instead of overloading ic->ic_bss->ni_chan (or in some
  drivers ic_ibss_chan)
o add ieee80211_scanparams structure to encapsulate scanning-related
  state captured for rx frames
o move rx beacon+probe response frame handling into separate routines
o change beacon+probe response handling to treat the scan table
  more like a scan cache--look for an existing entry before adding
  a new one; this combined with ic_curchan use corrects handling of
  stations that were previously found at a different channel
o move adhoc neighbor discovery by beacon+probe response frames to
  a new ieee80211_add_neighbor routine

Reviewed by:	avatar
Tested by:	avatar, Michal Mertl
MFC after:	2 weeks
2005-08-10 16:22:30 +00:00
Sam Leffler
c1225b52f6 Split crypto tx+rx key indices and add a key index -> node mapping table:
Crypto changes:
o change driver/net80211 key_alloc api to return tx+rx key indices; a
  driver can leave the rx key index set to IEEE80211_KEYIX_NONE or set
  it to be the same as the tx key index (the former disables use of
  the key index in building the keyix->node mapping table and is the
  default setup for naive drivers by null_key_alloc)
o add cs_max_keyid to crypto state to specify the max h/w key index a
  driver will return; this is used to allocate the key index mapping
  table and to bounds check table loookups
o while here introduce ieee80211_keyix (finally) for the type of a h/w
  key index
o change crypto notifiers for rx failures to pass the rx key index up
  as appropriate (michael failure, replay, etc.)

Node table changes:
o optionally allocate a h/w key index to node mapping table for the
  station table using the max key index setting supplied by drivers
  (note the scan table does not get a map)
o defer node table allocation to lateattach so the driver has a chance
  to set the max key id to size the key index map
o while here also defer the aid bitmap allocation
o add new ieee80211_find_rxnode_withkey api to find a sta/node entry
  on frame receive with an optional h/w key index to use in checking
  mapping table; also updates the map if it does a hash lookup and the
  found node has a rx key index set in the unicast key; note this work
  is separated from the old ieee80211_find_rxnode call so drivers do
  not need to be aware of the new mechanism
o move some node table manipulation under the node table lock to close
  a race on node delete
o add ieee80211_node_delucastkey to do the dirty work of deleting
  unicast key state for a node (deletes any key and handles key map
  references)

Ath driver:
o nuke private sc_keyixmap mechansim in favor of net80211 support
o update key alloc api

These changes close several race conditions for the ath driver operating
in ap mode.  Other drivers should see no change.  Station mode operation
for ath no longer uses the key index map but performance tests show no
noticeable change and this will be fixed when the scan table is eliminated
with the new scanning support.

Tested by:	Michal Mertl, avatar, others
Reviewed by:	avatar, others
MFC after:	2 weeks
2005-08-08 18:46:36 +00:00
Sam Leffler
d365f9c760 Cleanup beacon/listen interval handling:
o separate configured beacon interval from listen interval; this
  avoids potential use of one value for the other (e.g. setting
  powersavesleep to 0 clobbers the beacon interval used in hostap
  or ibss mode)
o bounds check the beacon interval received in probe response and
  beacon frames and drop frames with bogus settings; not clear
  if we should instead clamp the value as any alteration would
  result in mismatched sta+ap configuration and probably be more
  confusing (don't want to log to the console but perhaps ok with
  rate limiting)
o while here up max beacon interval to reflect WiFi standard

Noticed by:	Martin <nakal@nurfuerspam.de>
MFC after:	1 week
2005-08-08 03:30:57 +00:00
Sam Leffler
97c973adc4 Fix handling of frames sent prior to a station being authorized
when operating in ap mode.  Previously we allocated a node from the
station table, sent the frame (using the node), then released the
reference that "held the frame in the table".  But while the frame
was in flight the node might be reclaimed which could lead to
problems.  The solution is to add an ieee80211_tmp_node routine
that crafts a node that does exist in a table and so isn't ever
reclaimed; it exists only so long as the associated frame is in flight.

MFC after:	5 days
2005-08-06 04:56:49 +00:00
Sam Leffler
19ad2dd79a close a race between reclaiming a node when a station is inactive
and sending the null data frame used to probe inactive stations

MFC after:	5 days
2005-07-31 06:12:32 +00:00
Sam Leffler
936f15d221 bandaid ni_fails handling so ap's with association failures are
reconsidered after a bit; a proper fix involves more changes to
the scanning infrastructure

Reviewed by:	avatar, David Young
MFC after:	5 days
2005-07-27 02:53:09 +00:00
Sam Leffler
44b666cd0e the AREF flag is only meaningful in ap mode; adhoc neighbors now
are timed out of the sta/neighbor table
2005-07-23 00:16:46 +00:00
Sam Leffler
f66d97f6bc o move inactivity-related debug msgs under IEEE80211_MSG_INACT
o probe inactive neighbors in adhoc mode (they don't have an
  association id so previously were being timed out)

MFC after:	3 days
2005-07-22 23:25:46 +00:00
Sam Leffler
af8418dcb1 split xmit of probe request frame out into a separate routine that
takes explicit parameters; this will be needed when scanning is
decoupled from the state machine to do bg scanning

MFC after:	3 days
2005-07-22 21:11:26 +00:00
Sam Leffler
e996233220 simplify ic_newassoc callback
MFC after:	3 days
2005-07-22 17:57:16 +00:00
Sam Leffler
641b4d0b2d simplify ieee80211_ibss_merge api
MFC after:	3 days
2005-07-22 17:54:40 +00:00
Sam Leffler
edfa57d0f0 simplify tim callback api
MFC after:	3 days
2005-07-22 17:45:48 +00:00
Sam Leffler
e4918ecdb9 simplify ieee80211_node_authorize and ieee80211_node_unauthorize api's
MFC after:	3 days
2005-07-22 17:36:12 +00:00
Sam Leffler
f62121ce8e simplifiy ieee80211_send_nulldata api
MFC after:	3 days
2005-07-22 17:31:18 +00:00
Sam Leffler
7d77cd5381 simplify rate set api's by removing ic parameter (implicit in node reference)
MFC after:	3 days
2005-07-22 17:29:03 +00:00
Sam Leffler
ebdda46c84 Fix race condition in handling node reference counts for authenticating
stations in ap mode.  Track when a node's first auth frame is
received and use this to decide whether or not to bump the refcnt.
This insures we only ever bump the refcnt once.

Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-06 01:51:44 +00:00
Sam Leffler
7268fa6483 move AID implementation defines from the protocol definitions to
where they are used
2005-06-10 04:42:34 +00:00
Sam Leffler
f02a0bd2ac Change the MLME ASSOCIATE ioctl to accept either a ssid, a bssid,
or a bssid+ssid. This is needed for later versions of wpa_supplicant
and for forthcoming addons to wpa_supplicant.

Note this is an api change and applications must be rebuilt.
2005-06-07 23:37:49 +00:00
Sam Leffler
6edf09a6e9 avoid potential array index by -1
Noticed by:	Coverity Prevent analysis tool
2005-03-16 20:40:48 +00:00
Sam Leffler
48b0a5be74 honor any desired bssid when creating an ibss
Prodded by:	David Young
Obtained from:	netbsd
2005-03-08 17:04:14 +00:00
Sam Leffler
f9cd9174fa propagate state kept in the bss node when re-creating the node
on state transitions; this is a stopgap measure, need to rethink
how we do management of this state

Identified by:	Divy Le Ray
2005-02-10 16:59:04 +00:00
Sam Leffler
49a152366e update node reference count debug msgs to include the node address
since the mac address may not be sufficient to uniquely identify a node
2005-01-24 20:50:20 +00:00
Sam Leffler
acc4f7f50c statically allocate the station/neighbor node table; the deferred
allocation scheme introduced a race condition during device state
transitions
2005-01-24 19:32:10 +00:00
Sam Leffler
44acc00dda when a station is timed out for inactivity, remove it from the table
so it isn't considered again
2005-01-20 02:59:21 +00:00
Sam Leffler
ce64703289 explicitly avoid timing out ourself due to inactivity; it
can easily happen if the bss is quiet
2005-01-20 02:54:18 +00:00
Sam Leffler
90d0d0366b fix refcnt leak in adhoc mode: entries in the neighbor table
created due to rx'd frames had an extra reference
2005-01-20 02:53:11 +00:00
Sam Leffler
a84679cd18 remove debug msg from ieee80211_iterate_nodes; it makes logs very noisy
as onoe rate control invokes this once a second
2005-01-18 20:35:39 +00:00
Sam Leffler
29d368a780 avoid possible null pointer deref when refcnt debugging is enabled; the
node may be orphaned

Submitted by:	Tai-hwa Liang
2005-01-18 20:34:22 +00:00
Sam Leffler
96acc1b61c Explicitly ignore ibss merge requests when the node is ic_bss. This can
happen on the first management frame received from a neighbor; we assume
any merge candidate will send more frames and those should be processed
with a suitable table entry.

Stepped on by:	Tai-hwa Liang
2005-01-18 20:30:16 +00:00
Sam Leffler
3fcfbbfa76 Simplify the logic for checking the scan candidates at the end of a scan.
Hold a lock on the table instead of futzing with reference counts which
was potentially dangerous except drivers were quiescent while we did this
so the table contents never changed.  Disable the hack logic for removing
scan candidates with multiple association failures; it's never done the
right thing and will be fixed correctly with background scanning goes in.
2005-01-18 20:21:29 +00:00
Sam Leffler
c75ac46947 when scanning is interrupted reset state so table entries go in the station
table and not the scan table

Noticed by:	Tai-hwa Liang
2005-01-18 19:59:40 +00:00
Sam Leffler
98ff62638d do fixed rate check when considering if a scan candidate is suitable so when
it's time to join the bss we can't get an error
2005-01-18 19:52:36 +00:00
Sam Leffler
ef92bcdc97 Correct scan candidate selection logic for dual-band devices: prefer
candidate on 5Ghz channel to candidate on 2Ghz channel only when the
rssi are comparable (wasn't considering rssi).
2005-01-01 17:48:27 +00:00
Sam Leffler
1f1d781074 bump copyright for 2005 2004-12-31 22:42:38 +00:00
Sam Leffler
2045f69945 fixup inactivity timers:
o ic_inact_auth is a bad name, it's the inactivity threshold
  for being associated but not authorized; use it that way
o reset ni_inact when switching inactivity thresholds to
  minimize the race against the timer (don't want to lock
  for this stuff)
o change the inactivity probe threshold from a one-shot to
  cover a range: when below this threshold but not expired
  send a probe each inactivity interval; should probably
  guard against the interval being turned way down as this
  could cause us to spam the net with probes
2004-12-31 22:05:13 +00:00
Sam Leffler
736b3dc32e compare pointers against NULL 2004-12-31 21:28:41 +00:00
Sam Leffler
b8fcf54640 make ap mode sta association debug msg as informative as sta mode 2004-12-31 21:27:53 +00:00
Sam Leffler
624a1bdb63 do 11g erp station management in turboG mode too 2004-12-31 21:25:28 +00:00
Sam Leffler
3d07392995 check if the node/station table is already present before creating one; this
can happen on an ibss merge
2004-12-31 21:22:12 +00:00
Sam Leffler
3ea67c5431 include phy mode in scan debug msg 2004-12-31 21:19:59 +00:00
Sam Leffler
8a1b9b6ad4 Update 802.11 support; too much new functionality to fully describe
here but it includes completed 802.11g, WPA, 802.11i, 802.1x, WME/WMM,
AP-side power-save, crypto plugin framework, authenticator plugin framework,
and access control plugin frameowrk.
2004-12-08 17:26:47 +00:00
Sam Leffler
32346d607a make malloc tag for ieee80211_node more recognizable 2004-04-05 04:15:55 +00:00
Sam Leffler
750d6d0c60 fix adhoc/ibss operation for drivers that require host support (e.g. ath):
o remove IEEE80211_C_RCVMGT capability
o on transmit craft new nodes as needed using new ieee80211_find_txnode routine
o add ieee80211_find_txnode routine to lookup a node by mac address and
  if not present create one when operating in ibss/ahdemo mode; new nodes
  are dup'd from bss and the driver is told to treat the node as if a new
  association has been created so driver-private state (e.g. rate control
  handling) is setup

Obtained from:	netbsd (basic idea)
2004-04-02 23:25:39 +00:00
Sam Leffler
694dca643b o change ieee80211_dup_bss to inherit explicit data from ic_bss instead of
blindy copying the node contents; this turns out to be a bad idea as we
  add more state in the node for things like WPA
o track node allocation failures in ieee80211_dup_bss instead of the callers

Obtained from:	madwifi
2004-04-02 23:09:24 +00:00
Sam Leffler
c64bfa0f8f track node allocation failure stats in ieee80211_alloc_node instead
of each caller

Obtained from:	madwifi
2004-04-02 23:06:41 +00:00
Sam Leffler
410ca74bb8 replace explicit malloc/free with MALLOC/FREE for portability
Obtained from:	madwifi
2004-04-02 23:02:24 +00:00
Sam Leffler
b4c5a90fee extract node matching logic into new ieee80211_match_bss routine for use
in background/incremental scanning

Obtained from:	madwifi
2004-04-02 23:00:30 +00:00
Sam Leffler
849b898054 diff reduction against madwifi 2004-04-02 22:56:09 +00:00
Sam Leffler
2e79ca9762 o add support for controlling the power of transmitted frames
o add support for controlling the 11g protection mechanism used
  to protect OFDM frames in a mixed 11b/g network

Reviewed by:	imp
2004-03-30 22:57:57 +00:00
Sam Leffler
bca1062ba5 fix typo that broke AP scanning by BSSID
Submitted by:	Len Widra
2003-11-09 23:36:46 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Sam Leffler
1be50176db add statistics for all failures and/or abnormal events; still need
to add per-node statistics
2003-10-17 23:15:30 +00:00
Sam Leffler
1e343b38be parameterize locking to improve portability and possible
change to different locking strategies
2003-10-17 21:41:52 +00:00
Sam Leffler
303ebc3c87 Try yet again to deal with timing out nodes. We cannot hold the
node lock while sending a management frame as this will potentially
result in a LOR with a driver lock.  This doesn't happen for the
Atheros driver but does for the wi driver.  Use a generation number
to help process each node once when scanning the node table and
drop the node lock if we need to timeout a node and send a frame.
2003-09-26 17:00:44 +00:00
Sam Leffler
37c150c4a6 allocate node table entries with a specific malloc type 2003-09-26 16:52:12 +00:00
Sam Leffler
d1e61976a0 Generalize the per-node RSSI data so drivers can do more interesting
things than record a single value.

o add a per-node method for returning the "current RSSI" for a node
o create a default method that returns ni_rssi which is the rssi for
  the last received frame
o use the per-node "get rssi" method to return data for the RID's
  submitted by wicontrol, et. al.

Loosely based on work by Tom Marshall <tommy@home.tig-grr.com> for MADWIFI.
2003-09-15 22:28:07 +00:00
Sam Leffler
0a915fad5d MFp4 changes to fix locking issues and correct reference
count handling of station entries in hostap mode:

Input path:

o driver is now expected to find the node associated with the
  sender of a received frame; use ic_bss if none is located
o driver passes the (referenced) node into ieee80211_input for
  use within the wlan module and is responsible for cleaning up
  on return
o the antenna state is no longer passed up with each frame; this
  is now considered driver-private state and drivers are responsible
  for keeping it in the driver-private part of a node

Output path:

Revamp output path for management frames to eliminate redundant
locking that causes problems and to correct reference counting
bogosity that occurs when stations are timed out due to inactivity
(in AP mode).  On output the refcnt'd node is stashed in the pkthdr's
recvif field (yech) and retrieved by the driver.  This eliminates
an unref/ref scenario and related node table unlock/lock due to the
driver looking up the node.  This is particularly important when
stations are timed out as this causes a lock order reversal that
can result in a deadlock.  As a byproduct we also reduce the overhead
for sending management frames (minimal).  Additional fallout from
this is a change to ieee80211_encap to return a refcn't node for
tieing to the outbound frame.  Node refcnts are not reclaimed until
after a frame is completely processed (e.g. in the tx interrupt
handler).  This is especially important for timed out stations as
this deref will be the final one causing the node entry to be
reclaimed.

Additional semi-related changes:
o replace m_copym use with m_copypacket (optimization)
o add assert to verify ic_bss is never free'd during normal operation
o add comments explaining calling conventions by drivers for frames
  going in each direction
o remove extraneous code that "cannot be executed" (e.g. because
  pointers may never be null)
2003-08-19 22:17:04 +00:00
Sam Leffler
2692bb26d4 Delay creating ic_bss until after the super-class has a chance
to override the method pointers for manipulating nodes; this fixes
a problem where the ic_bss node was not being created properly
for the ath driver causing the driver to scribble on random memory.

Noticed by:	David Young <dyoung@pobox.com>
2003-08-13 22:09:44 +00:00
Sam Leffler
a11c9a5cc2 o change ieee80211_new_state handling to use a proper method that drivers
override in their sub-class; this eliminates the hack of interpreting the
  EINPROGRESS return value to mean "don't do any of the normal work"
o correct active scanning so the first channel is only scanned once and so
  per-channel passive mode is properly honored
o expose 802.11 FSM state names so every driver doesn't keep a private copy
o eliminate node parameter to ieee80211_begin_scan; it was not being used
2003-07-20 21:36:08 +00:00
Sam Leffler
58f40303c4 insure ic_bss always has a "valid" channel; avoids problems where users could
query the state of a card and find a null channel since allocating the node
left ni_chan zero
2003-06-29 20:13:38 +00:00
Sam Leffler
7535e66acd revise copyright notices per discussion with Atsushi Onoe <onoe@sm.sony.co.jp> 2003-06-27 05:13:52 +00:00
Sam Leffler
1a1e1d2157 new 802.11 layer:
o code reorg (relative to old netbsd-derived code) for future growth
o drivers now specify available channels and rates and 802.11 layer handles
  almost all ifmedia actions
o multi-mode support for 11a/b/g devices
o 11g protocol additions (incomplete)
o new element id additions (for other than 11g)
o node/station table redone for proper locking and to eliminate driver
  incestuousness
o split device flags and capabilities to reduce confusion and provide room
  for expansion
o incomplete power management infrastructure (need to revisit)
o incomplete hooks for software retry
o more...
2003-06-23 16:55:01 +00:00