Commit Graph

589 Commits

Author SHA1 Message Date
Sam Leffler
9c859a041a add a sysctl to ena/dis frobbing cca 2009-03-05 00:15:43 +00:00
Sam Leffler
869ff02ebe 5416 and later parts mux the gpio outputs; extend the api to include
a signal type that's used to select the appropriate mux
2009-02-24 00:12:16 +00:00
Sam Leffler
498657cff2 print mac+rf part names; drop the printing 2ghz rf stuff (might come back) 2009-02-23 23:41:12 +00:00
Sam Leffler
d497b6a449 remove private support for IEEE80211_MODE_HALF and IEEE80211_MODE_QUARTER
now that net80211 has them
2009-02-19 05:22:40 +00:00
Sam Leffler
3fc21fed93 add SIOCZATHSTATS ioctl to zero driver statistics 2009-02-13 05:38:03 +00:00
Sam Leffler
36c6be9ab4 add driver stat to count tx drops due to insufficient frag buffers 2009-02-13 05:30:22 +00:00
Sam Leffler
59fbb2570a don't do phantom beacon miss checking for s/w beacon miss handling,
this can mistakenly drop events that cause the s/w bmiss timer to
never get re-armed
2009-02-10 23:48:29 +00:00
Sam Leffler
330528331c mark the CLR key installed for open auth stations such that it is reclaimed
when net80211 tears down station state; without this we leak keycache slots
2009-02-10 19:27:50 +00:00
Sam Leffler
a32ac9d3a9 add hw.ath.bstuck to control the stuck beacon threshold 2009-02-10 19:26:42 +00:00
Sam Leffler
054d7b6979 on resume ah_curchan may be NULL if no channel change has been done;
workaround this by passing net80211's channel as we know it'll never
be null

Submitted by:	trasz
2009-02-10 19:25:11 +00:00
Sam Leffler
c2e344594e count stuck beacon events 2009-02-07 05:34:41 +00:00
Sam Leffler
3267a60cbd Minor packet drop improvements:
o change tdma packet drop msg when ack required to ATH_DEBUG_TDMA
  (ATH_DEBUG_XMIT is too noisy)
o add a debug msg for raw packet drop due to interface down/invalid
o add stats for these two cases
o explain how another drop case is handled
2009-02-05 21:02:40 +00:00
Sam Leffler
59efa8b517 Overhaul regulatory support:
o remove HAL_CHANNEL; convert the hal to use net80211 channels; this
  mostly involves mechanical changes to variable names and channel
  attribute macros
o gut HAL_CHANNEL_PRIVATE as most of the contents are now redundant
  with the net80211 channel available
o change api for ath_hal_init_channels: no more reglass id's, no more outdoor
  indication (was a noop), anM contents
o add ath_hal_getchannels to have the hal construct a channel list without
  altering runtime state; this is used to retrieve the calibration list for
  the device in ath_getradiocaps
o add ath_hal_set_channels to take a channel list and regulatory data from
  above and construct internal state to match (maps frequencies for 900MHz
  cards, setup for CTL lookups, etc)
o compact the private channel table: we keep one private channel
  per frequency instead of one per HAL_CHANNEL; this gives a big
  space savings and potentially improves ani and calibration by
  sharing state (to be seen; didn't see anything in testing); a new config
  option AH_MAXCHAN controls the table size (default to 96 which
  was chosen to be ~3x the largest expected size)
o shrink ani state and change to mirror private channel table (one entry per
  frequency indexed by ic_devdata)
o move ani state flags to private channel state
o remove country codes; use net80211 definitions instead
o remove GSM regulatory support; it's no longer needed now that we
  pass in channel lists from above
o consolidate ADHOC_NO_11A attribute with DISALLOW_ADHOC_11A
o simplify initial channel list construction based on the EEPROM contents;
  we preserve country code support for now but may want to just fallback
  to a WWR sku and dispatch the discovered country code up to user space
  so the channel list can be constructed using the master regdomain tables
o defer to net80211 for max antenna gain
o eliminate sorting of internal channel table; now that we use ic_devdata
  as an index, table lookups are O(1)
o remove internal copy of the country code; the public one is sufficient
o remove AH_SUPPORT_11D conditional compilation; we always support 11d
o remove ath_hal_ispublicsafetysku; not needed any more
o remove ath_hal_isgsmsku; no more GSM stuff
o move Conformance Test Limit (CTL) state from private channel to a lookup
  using per-band pointers cached in the private state block
o remove regulatory class id support; was unused and belongs in net80211
o fix channel list construction to set IEEE80211_CHAN_NOADHOC,
  IEEE80211_CHAN_NOHOSTAP, and IEEE80211_CHAN_4MSXMIT
o remove private channel flags CHANNEL_DFS and CHANNEL_4MS_LIMIT; these are
  now set in the constructed net80211 channel
o store CHANNEL_NFCREQUIRED (Noise Floor Required) channel attribute in one
  of the driver-private flag bits of the net80211 channel
o move 900MHz frequency mapping into the hal; the mapped frequency is stored
  in the private channel and used throughout the hal (no more mapping in the
  driver and/or net80211)
o remove ath_hal_mhz2ieee; it's no longer needed as net80211 does the
  calculation and available in the net80211 channel
o change noise floor calibration logic to work with compacted private channel
  table setup; this may require revisiting as we no longer can distinguish
  channel attributes (e.g. 11b vs 11g vs turbo) but since the data is used
  only to calculate status data we can live with it for now
o change ah_getChipPowerLimits internal method to operate on a single channel
  instead of all channels in the private channel table
o add ath_hal_gethwchannel to map a net80211 channel to a h/w frequency
  (always the same except for 900MHz channels)
o add HAL_EEBADREG and HAL_EEBADCC status codes to better identify regulatory
  problems
o remove CTRY_DEBUG and CTRY_DEFAULT enum's; these come from net80211 now
o change ath_hal_getwirelessmodes to really return wireless modes supported
  by the hardware (was previously applying regulatory constraints)
o return channel interference status with IEEE80211_CHANSTATE_CWINT (should
  change to a callback so hal api's can take const pointers)
o remove some #define's no longer needed with the inclusion of
  <net80211/_ieee80211.h>

Sponsored by:   Carlson Wireless
2009-01-28 18:00:22 +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
8d91de92ee don't run the calibration code if scanning, we won't be on the home channel 2009-01-23 03:15:28 +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
9d6b29a668 honor IEEE80211_BPF_CRYPTO for raw xmit; fixes shared key auth in sta mode
PR:		kern/129022
2008-12-07 19:29:11 +00:00
Sam Leffler
2dc7fcc48f New periodic calibration scheme needed for 11n parts that have
multiple algorithms and potentially collect multiple samples.
Instead of a single calibration interval we now have short and long
intervals; the long interval roughly corresponds to the previous
single interval.  The short interval is used to speedup collection
of samples and happens much quicker.  We make calls using the short
interval until we're told the calibration work is complete at which
point we fallback to the long interval.  In addition there is a
much longer reset interval used to flush all calibration state and
cause everthing to start anew.

With these changes you can also disable calibration entirely by
setting the long interval to zero.
2008-12-07 19:26:34 +00:00
Sam Leffler
3364462355 Switch to ath hal source code. Note this removes the ath_hal
module; the ath module now brings in the hal support.  Kernel
config files are almost backwards compatible; supplying

device ath_hal

gives you the same chip support that the binary hal did but you
must also include

options AH_SUPPORT_AR5416

to enable the extended format descriptors used by 11n parts.
It is now possible to control the chip support included in a
build by specifying exactly which chips are to be supported
in the config file; consult ath_hal(4) for information.
2008-12-01 16:53:01 +00:00
Sam Leffler
a7ace8438c sync w/ p4 branch 2008-11-30 18:56:41 +00:00
Sam Leffler
459bc4f0dd some of the 11n parts can hang under certain conditions without
necessary workarounds, add code to detect these hangs and distinguish
them from other events; note this code is only invoked for anomalous
conditions and (at the moment) is a noop because the hang detection
code is in a new hal that's coming shortly
2008-11-30 18:34:27 +00:00
Sam Leffler
1b15625c19 add frequency mapping for the Zcomax GZ-901 2008-11-30 18:27:10 +00:00
Sam Leffler
6902009e2a print the extended tx/rx descriptor for 5416 and later parts 2008-11-24 01:34:56 +00:00
Sam Leffler
9c4fc1e8a2 nuke special handling of RXORN interrupt; the hal marks the FATAL
bit in the interrupt status when RXORN is hit and the chip requires
a reset so our special handling was causing useless resets
2008-11-24 01:31:10 +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
411373ebc6 prepare for a new hal 2008-10-27 18:30:33 +00:00
Sam Leffler
46d4d74c94 o With the addition of HT rates the set of h/w codes has a much wider range
making the use of sc_hwmap to do direct mapping impractical.  Switch to
  indexing by the rate index instead of the rate code and adjust associated
  state and logic appropriately.  This has several benefits including
  simplification of the led code.
o fix radiotap capture of HT rates
o fix conditional compilation of HT radiotap support to be based on the
  hal having 5416 support; not the ABI version as hal builds may or may
  not include 5416 support
2008-10-27 18:22:44 +00:00
Sam Leffler
26041a143b prefer #define to naked constant 2008-10-27 18:05:26 +00:00
Sam Leffler
180f268d4d fix handling of HT rates; these overlap legacy rates and need to be
marked as MCS in the inverse mapping table
2008-10-27 18:02:47 +00:00
Sam Leffler
dd2a574e16 add hack to deal with Ubiquiti XR9 cards, they have a different mapping
between 900MHz and 2.4GHz frequencies than SR9 cards; they are distinguished
by different country codes
2008-10-27 18:00:43 +00:00
Sam Leffler
7b916f8948 install bssid for ahdemo mode too 2008-10-27 17:54:17 +00:00
Sam Leffler
5d61b5e8f0 fix comment 2008-10-27 17:53:34 +00:00
Sam Leffler
74eca0c26f correct callback status parameter; only indicate success when an ACK was
received
2008-10-27 17:52:41 +00:00
Sam Leffler
84784be1ae Fixup statistics:
o update tx rssi data only when an ACK was received
o return tx rssi from sampled data instead of the last frame
o track noise floor
o return rx rssi and noise floor (was broken)
2008-10-27 17:51:24 +00:00
Sam Leffler
ad80c0aa34 update the sta inactivity timer only if we actually received an ACK 2008-10-27 17:43:23 +00:00
Sam Leffler
96abcb94d7 Regdomain fixups:
o pass country code, outdoor indication, and ecm mode into the hal
  when requesting a channel list
o add a console msg when regulatory setup fails
o add placeholder code to map between Atheros sku's and 802.11 sku's
  that handles only the debug country code used to unlock the full
  channel list (to be used only for debugging)
o fix multiple instances of mismapping the 802.11 location to the
  outdoor indication (anywhere may be outdoor also)
2008-10-27 17:41:32 +00:00
Sam Leffler
033022a93b add regdomain debug msgs 2008-10-27 17:35:09 +00:00
Sam Leffler
577eaa6032 add sys.dev.ath.X.intmit knob to enable/disable ANI
(the intmit name is historical)
2008-10-27 17:22:46 +00:00
Sam Leffler
3297be131d shuffle debug setup to simplify debugging events during attach 2008-10-27 17:19:39 +00:00
Sam Leffler
80c07f2369 rename bf_flags to bf_txflags in preparation for the addition of flags
separate from the tx descriptor flags currently recorded
2008-10-27 17:16:46 +00:00
Sam Leffler
47db982fc9 use the ic's opmode instead of our hal equivalent to check for adhoc mode;
they are always the same
2008-10-27 17:14:39 +00:00
Sam Leffler
4b54a23144 intercept IEEE80211_IOC_TXPOWER and service tx power changes immediately 2008-10-27 17:12:41 +00:00
Sam Leffler
c62362cbec remove driver-private equivalent of ni_txparms; it's now superfluous 2008-10-27 17:03:24 +00:00
Sam Leffler
1eb911a5cc now that the new association callback is used when joining a bss we can
eliminate the ath_rate_newassoc callback and associated code
2008-10-27 16:58:06 +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
1e63cecbbc fix static key wep; r183248 caused drivers to be called for keys to be
assigned to slots in the global key table but ath_key_alloc was not
updated to handle that
2008-10-19 21:34:49 +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
3627e32112 fix compilation on 64-bit platform w/ ATH_DEBUG 2008-09-21 00:30:33 +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
e387d629b8 correct rx radiotap channel flags construction for 11n frames 2008-05-29 00:14:35 +00:00
Sam Leffler
d3ac945bb4 Cleanup power handling and fix suspend/resume:
o do not put the chip into full sleep in ath_stop as it gains
  nothing and causes many parts to hang in ath_detach because we
  may touch the chip during vap teardown; this may also fix issues
  with unloading the module
o add a note in ath_detach to explain ath_hal_detach puts the
  chip in low power mode; this is useful to know as it means
  unloading the module will place a pci device in the lowest
  possible power state
o leave an #ifdef notyet marker for powering down the chip when
  a device is marked down; we can't do that until we handle all
  the ways the driver may be entered and touch the chip
o fix resume by reloading the h/w key cache as it's been clobbered
  (for pci) by the socket being powered off; for station mode we
  directly stop+init the chip and then simulate a beacon miss to
  get the upper layers sync'd up; for other configs we must brute
  force stop+start the vaps so they go through the state machine
2008-05-29 00:10:48 +00:00
Sam Leffler
71b8507770 close a race on detach by reordering bpfdetach and taskqueue_free 2008-05-28 23:55:11 +00:00
Sam Leffler
4df6277969 send EAPOL frames at the same rate used for mgt frames 2008-05-28 23:41:40 +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
72d9df0aa4 o unbreak handling of TKIP tx-only keys for splitmic chips
o yank compat support for hal's older than 0.9.20.3; leave a
  CTASSERT in place just in case
2008-05-03 21:55:02 +00:00
Sam Leffler
ca8769184c add back sysctl's to display the regdomain and country code from eeprom;
useful for debugging
2008-05-03 21:52:05 +00:00
Andrew Thompson
31a8c1edd8 Unify all the wifi *_ioctl routines
- Limit grabbing the lock to SIOCSIFFLAGS.
 - Move ieee80211_start_all() to SIOCSIFFLAGS.
 - Remove SIOCSIFMEDIA as it is not useful.
 - Limit ether_ioctl to only SIOCGIFADDR. SIOCSIFADDR and SIOCSIFMTU have no
   affect as there is no input/output path in the vap parent.  The vap code
   will handle the reinit of the mac address changes.
 - Split off ndis_ioctl_80211 as it was getting too different to wired devices.

This fixes a copyout while locked and a lock recursion.

Reviewed by:		sam
2008-05-01 04:55:00 +00:00
Sam Leffler
00389c7060 remove old code to handle mcast address changes; this is all done through
net80211 and pushed into the driver through non-ioctl callbacks
2008-04-30 17:00:32 +00:00
Sam Leffler
7de3bc26a5 restore the hal's channel list when doing getradiocaps so it's in sync with
the 802.11 layer's list
2008-04-27 22:03:56 +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
c28953b424 (finally) add the hal status to the diagnostic generated after
a failed ath_hal_reset call

MFC after:	3 days
2008-03-22 16:27:47 +00:00
Sam Leffler
eeb76a1889 promote ath_defrag to m_collapse (and retire private+unused
m_collapse from cxgb)

Reviewed by:	pyun, jhb, kmacy
MFC after:	2 weeks
2008-01-17 21:25:09 +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
0e8c5adf21 bandaid Dynamic Turbo A operation with old hal's: HAL_MODE_108A
does not have a rate table in older hal's so if we scan such a
channel the driver will hit an assertion or crash; for old hal's
fallback to using the static turbo rate table for this mode
(not correct but good enough for now given none of the rate
control algorithms understand how to switch between base+boost)

Approved by:	re (blanket wireless)
2007-09-17 05:16:38 +00:00
Sam Leffler
77d5e06852 fix led blinking in RUN state: the addition of the CAC state moved
IEEE80211_S_RUN and broke the array lookup used to find the LED flags

Approved by:	re (blanket wireless)
2007-09-17 05:12:19 +00:00
Sam Leffler
2b9411e29f Add missing bits that made bg scanning lame:
o update ic_lastdata to reflect time of last outbound frame
o outbound traffic must preempt/cancel bg scanning to avoid delays

This stuff was somehow missed in the initial import.

Reviewed by:	thompsa, avatar, sephe (earlier version)
Approved by:	re (blanket wireless)
2007-09-05 23:00:27 +00:00
Robert Watson
0bf686c125 Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which
previously conditionally acquired Giant based on debug.mpsafenet.  As that
has now been removed, they are no longer required.  Removing them
significantly simplifies error-handling in the socket layer, eliminated
quite a bit of unwinding of locking in error cases.

While here clean up the now unneeded opt_net.h, which previously was used
for the NET_WITH_GIANT kernel option.  Clean up some related gotos for
consistency.

Reviewed by:	bz, csjp
Tested by:	kris
Approved by:	re (kensmith)
2007-08-06 14:26:03 +00:00
Sam Leffler
d50ea6acfa Process tx callbacks when draining the tx q; this fixes a problem
where a device timeout that occurs with a mgt frame on the tx q
will leave the net80211 layer w/o any way to make progress.

Reviewed by:	thompsa, sephe
Approved by:	re (hrs)
2007-06-24 01:57:20 +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
515d617e8d update copyrights to 2007 and convert to be 2-clause bsd-only 2007-06-06 15:49:16 +00:00
Sam Leffler
6a1d2520e3 disable taskqueue_drain calls on transition to INIT state; we need to
find another way to do this as we cannot hold the softc mtx across
these calls
2007-06-03 02:16:48 +00:00
Sam Leffler
58769f5837 Drain task q items when transitioning to INIT state; this closes a
race seen on smp laptops when suspending where the rx task can be
entered after the interface is detach'd.

NB: use of taskqueue_drain while holding the softc mutex is problematic

Submitted by:	ambrisko
MFC after:	1 month
2007-05-29 16:13:59 +00:00
Sam Leffler
ee7d684055 silence some compiler complaints 2007-05-27 05:38:44 +00:00
Sam Leffler
b298baf298 make dev.ath.N.ledpin have an immediate effect
PR:		kern/111810
Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk>
MFC after:	1 week
2007-04-23 05:57:06 +00:00
Sepherosa Ziehau
b03cfe2396 - Fix mbuf/node leakage in drivers' raw_xmit().
- For ural(4):
  o  Fix node leakage in ural_start(), if ural_tx_mgt() fails.
  o  Fix mbuf leakage in ural_tx_{mgt,data}(), if usbd_transfer() fails.
  o  In ural_tx_{mgt,data}(), set ural_tx_data.{m,ni} to NULL, if
     usbd_transfer() fails, so they will not be freed again in ural_stop().

Approved by:	sam (mentor)
2007-04-19 13:09:57 +00:00
Sam Leffler
1fba0fdc15 Change mtx's to use the formulated name as type so witness does not
complain on nested tx q lock acquisitions when processing the cab q.

MFC after:	2 weeks
2007-03-05 21:56:33 +00:00
Sam Leffler
cd196bb2d5 Kick tx after processing rx'd frames; this fixes latency issues
for processing frames from the power save queue when operating
in ap mode.  This is especially noticeable for realtime data going
to devices like voip phones.

Submitted by:	"J.R. Oldroyd" <jr@opal.com>
MFC after:	2 weeks
2007-03-05 21:53:49 +00:00
Sam Leffler
16d84e0140 don't call ath_reset when processing sysctl's before the device
is marked running; we don't have all the needed state in place

Noticed by:	Hugo Silva <hugo@barafranca.com>
MFC after:	1 week
2007-02-24 23:23:29 +00:00
Sam Leffler
8debcae44f set the antenna switch when fixing the tx antenna using the
dev.ath.X.txantenna sysctl; this is typically what folks
want but beware this has the side effect of disabling rx
diversity

MFC after:	2 weeks
2007-02-24 23:12:58 +00:00
Marius Strobl
c2175ff5ca Change the remainder of the drivers for DMA'ing devices enabled in the
sparc64 GENERIC and the sound device drivers known working on sparc64
to use bus_get_dma_tag() to obtain the parent DMA tag so we can get rid
of the sparc64_root_dma_tag kludge eventually. Except for ath(4), sk(4),
stge(4) and ti(4) these changes are runtime tested (unless I booted up
the wrong kernels again...).
2007-01-21 19:32:51 +00:00
Sam Leffler
724c193aed Add initial support for 900MHz cards like the Ubiquiti SR9:
o eliminate assumptions that half/quarter rate channels on exist in 11a
o handle frequency mapping between hal and net80211; hal gives us freq's
  in the range 2422..2437 that we remap

MFC after:	1 month
2007-01-15 01:15:57 +00:00
Sam Leffler
aaa70f2f6f Add half/quarter rate 11a channel support:
o change handling of regdomain-related mib knobs so they can be set
  post-attach: regdomain, countrycode, outdoor, and xchanmode; the
  hal will not permit changing the regdomain but we expose it for now
o on regdomain/countrycode change recalculate the channel list and
  push it to the net80211 layer (NB: looks to need more tweaking)
o setup rate tables for half/quarter rate channels
o honor half/quarter rate channel configs when changing channels
o honor half/quarter rate channel configs when setting the slot time
o use hack/nonstandard channel numbering scheme for the public safety
  band to avoid overlapping 2.4G channels on dual-band cards
o remove setup of ic_sup_rates; the net80211 layer can do this for us
  and it simplifies handling of half/quarter rate channels

Tested only in Public Safety Band with cards that have RF5112.
2006-12-27 19:07:09 +00:00
Sam Leffler
65f9edeee1 Track v0.9.20.3 hal:
o no more ds_vdata in tx/rx descriptors
o split h/w tx/rx descriptor from s/w status
o as part of the descriptor split change the rate control module api
  so the ath_buf is passed in to the module so it can fetch both
  descriptor and status information as needed
o add some const poisoning

Also for sample rate control algorithm:

o split debug msgs (node, rate, any)
o uniformly bounds check rate indices (and in some cases correct checks)
o move array index ops to after bounds checking
o use final tsi from the status block instead of the h/w descriptor
o replace h/w descriptor struct's with proper mask+shift defs (this
  doesn't belong here; everything is known by the driver and should
  just be sent down so there's no h/w-specific knowledge)

MFC after:	1 month
2006-12-13 19:34:35 +00:00
Sam Leffler
0553a01f53 mark tx/rx descriptors COHERENT; we do not sync changes so on
architectures like arm this is necessary

MFC after:	1 month
2006-11-24 22:45:26 +00:00
Sam Leffler
5901d2d38a Add support for newer parts that do not require separate keycache
entries for tx+rx mic keys.  This requires a newer hal, but works
fine with the current hal in cvs.

MFC after:	2 weeks
2006-09-18 16:26:19 +00:00
Sam Leffler
a7ee023101 remove stub radar support; it's never been used and future
hal's will not include the calls (due to redesign)

MFC after:	1 week
2006-09-18 16:16:02 +00:00
Sam Leffler
6bf62dd1de o add noise floor to stats
o include current tx rate in stats so athstats gets a consistent
  snapshot and doesn't have to make an extra ioctl
o record tx rate for raw frames

MFC after:	3 weeks
2006-08-10 16:31:37 +00:00
Sam Leffler
05680ab622 check return value of ath_tx_dmasetup
Noticed by:	yongari
2006-08-08 16:42:01 +00:00
Sam Leffler
664443d053 raw 802.11 packet transmit support
Joint work with:	Andrea Bittau <a.bittau@cs.ucl.ac.uk>
2006-08-05 05:07:17 +00:00
Sam Leffler
f3af83f7cf check tim is present in the beacon before defer'ing the mcast buffer bit;
insures we don't do this when operating in adhoc mode

Submitted by:	avatar@
MFC after:	1 week
2006-07-26 03:48:41 +00:00
Sam Leffler
6f48c95642 enable rx of control frames when in monitor mode
Submitted by:	Andrea Bittau <a.bittau@cs.ucl.ac.uk>
MFC after:	1 week
2006-06-26 04:31:36 +00:00
Sam Leffler
622b3fd21c Close race in handling mcast traffic when operating as an ap with
stations in power save: add a new q where mcast frames are stashed
and on beacon update (at DTIM) move frames from the mcast q to the
cabq and start it.  This ensures the cabq is only manipulated in
one place.

Sponsored by:	Hobnob
MFC after:	2 weeks
2006-06-26 03:10:45 +00:00
Sam Leffler
f9fc583f17 move hal bus+tag externalization to the bus glue code where it belongs;
this is a noop on all current freebsd architectures

MFC after:	1 month
2006-06-05 17:51:20 +00:00
Sam Leffler
ff046a6c6b add missed calls to bpf_peers_present 2006-06-02 23:14:40 +00:00
Christian S.J. Peron
16d878cc99 Fix the following bpf(4) race condition which can result in a panic:
(1) bpf peer attaches to interface netif0
	(2) Packet is received by netif0
	(3) ifp->if_bpf pointer is checked and handed off to bpf
	(4) bpf peer detaches from netif0 resulting in ifp->if_bpf being
	    initialized to NULL.
	(5) ifp->if_bpf is dereferenced by bpf machinery
	(6) Kaboom

This race condition likely explains the various different kernel panics
reported around sending SIGINT to tcpdump or dhclient processes. But really
this race can result in kernel panics anywhere you have frequent bpf attach
and detach operations with high packet per second load.

Summary of changes:

- Remove the bpf interface's "driverp" member
- When we attach bpf interfaces, we now set the ifp->if_bpf member to the
  bpf interface structure. Once this is done, ifp->if_bpf should never be
  NULL. [1]
- Introduce bpf_peers_present function, an inline operation which will do
  a lockless read bpf peer list associated with the interface. It should
  be noted that the bpf code will pickup the bpf_interface lock before adding
  or removing bpf peers. This should serialize the access to the bpf descriptor
  list, removing the race.
- Expose the bpf_if structure in bpf.h so that the bpf_peers_present function
  can use it. This also removes the struct bpf_if; hack that was there.
- Adjust all consumers of the raw if_bpf structure to use bpf_peers_present

Now what happens is:

	(1) Packet is received by netif0
	(2) Check to see if bpf descriptor list is empty
	(3) Pickup the bpf interface lock
	(4) Hand packet off to process

From the attach/detach side:

	(1) Pickup the bpf interface lock
	(2) Add/remove from bpf descriptor list

Now that we are storing the bpf interface structure with the ifnet, there is
is no need to walk the bpf interface list to locate the correct bpf interface.
We now simply look up the interface, and initialize the pointer. This has a
nice side effect of changing a bpf interface attach operation from O(N) (where
N is the number of bpf interfaces), to O(1).

[1] From now on, we can no longer check ifp->if_bpf to tell us whether or
    not we have any bpf peers that might be interested in receiving packets.

In collaboration with:	sam@
MFC after:	1 month
2006-06-02 19:59:33 +00:00
Sam Leffler
6ccb8ea780 quiet tindexbox complaints about passing BUS_SPACE_MAXADDR as
a bus_size_t to bus_dma_tag_create; when PAE is enabled this
does not work

Cluebat by:	scottl
MFC after:	2 weeks
2006-05-08 20:11:09 +00:00
Sam Leffler
34e2d6230c force type coercion for bus tag+handle when calling ath_hal_attach
to ensure we match the type signature; we cannot assume HAL_BUS_TAG
and HAL_BUS_HANDLE correspond to bus_space_tag_t and bus_space_handle_t
(should probably do this for HAL_SOFTC too but leave that for now)

MFC after:	1 month
2006-05-06 23:23:39 +00:00
Sam Leffler
ae2734b68c intercept public safety channels and do explicit mapping of freq->ieee
channel number since we're not ready at the net80211 layer to deal with them;
note this mapping has to match what's done in ieee80211_mhz2ieee

MFC after:	3 days
2006-04-26 16:02:36 +00:00
Sam Leffler
df4d04af01 honor fixed tx antenna when sending beacon frames
Submitted by:	Michael Stevens (from netbsd)
MFC after:	1 week
2006-04-25 22:52:28 +00:00
Sam Leffler
4a3ac3fc61 Improve ath_draintxq debug info: dump the packet as well
as the descriptor and handle the beacon q like other q's

MFC after:	1 month
2006-04-16 18:24:27 +00:00
Sam Leffler
2af90c547b Unbreak cabq handling: check the s/w q, not the h/w q as the frames
have not been passed to the h/w yet.  This remedies watchdog timeout
of buffered multicast frames in hostap mode.

While here eliminate an extraneous check; ieee80211_beacon_update sets
the tim bit based on ncabq != 0 so there's no reason to check it too.

Noticed by:	Christophe Prevotaux
2006-04-16 18:14:01 +00:00
Sam Leffler
a585a9a1bc o add opt_ath.h enable tweaking various config parameters for the driver
without modifying the source code
o default debug msgs and diag support to off

MFC after:	3 days
2006-04-03 18:14:02 +00:00
Sam Leffler
ebecf80294 backout 1.136 until we can resolve report that it causes output to stall 2006-02-27 17:20:23 +00:00
Sam Leffler
8fe92b6cf6 fix a race whereby a tx descriptor might get reused before the hardware
is finished with it; this may only occur when the tx queue is setup as
dba-gated but since the fix is cheap apply it to all queues

while here make the queue depth signed for use in assertions

Reviewed by:	apatti
MFC after:	2 weeks
2006-02-24 23:10:08 +00:00
Sam Leffler
1d89d44f74 drop softc lock around copyin/copyout
MFC after:	2 weeks
2006-02-15 18:36:52 +00:00
Sam Leffler
d2f6ed153d fix build w/o AR_DEBUG
MFC after:	2 weeks
2006-02-15 18:35:09 +00:00
Sam Leffler
7a4c5ed92c improve tx/rx buf printing routines
MFC after:	2 weeks
2006-02-15 18:31:04 +00:00
Sam Leffler
9760f8aeb9 add missing bit from 1.130 2006-02-15 18:24:22 +00:00
Sam Leffler
16c8acaab5 o handle fatal errors directly instead of via the task queue
o temporarily dump some h/w state for diagnosis; this will be
  removed once some issues are resolved

MFC after:	2 weeks
2006-02-15 18:23:03 +00:00
Sam Leffler
e2815d6951 use ath_hal_gettxintrtxqs so we only process h/w tx
queues that have an interrupt pending

MFC after:	2 weeks
2006-02-15 18:17:53 +00:00
Sam Leffler
c66c48cba2 fixup comments 2006-02-15 18:15:49 +00:00
Sam Leffler
1539af1ef5 close race between ath_tx_start and ath_tx_processq
Reviewed by:	apatti
MFC after:	1 week
2006-02-15 18:12:24 +00:00
Sam Leffler
fdb05e3c89 fix merge botch (duplicate processing of cabq for old cards) 2006-02-13 18:23:32 +00:00
Sam Leffler
bd5a9920c2 Update for rev 0.9.16.16 hal:
o add dfs+radar hooks; DFS is presently disabled in the hal
o channel and mode handling changes
o various api changes
o be more aggressive about iq calibration settling so ap mode
  operation is better immediately after startup
o rfkill/rfsilent sysctl support
o tpc ack/cts sysctl support

MFC after:	2 weeks
2006-02-10 19:07:08 +00:00
Sam Leffler
f9748b9d0d Minor tx path cleanups:
o assume all data frames have been classified so there's no need
  to check if QoS is being used, just fetch the wme priority from
  the mbuf
o fix double counting of noack frames
o fix nearby comment

MFC after:	2 weeks
2006-02-09 22:34:34 +00:00
Sam Leffler
b2792ff681 correct handling of mbuf allocation failure when replenishing the rx list
(leave a printf for the moment, need to make a debug msg)

Obtained from:	atheros
MFC after:	2 weeks
2006-02-09 22:29:23 +00:00
Sam Leffler
80d939bfba Beacon timer setup fixes:
o pull nexttbtt forward in adhoc mode too
o resync beacon timers on joining a bss or ibss as the tstamp we
  collected while scanning is almost certainly out of date

Note we may need to refine the ibss mode check in ath_recv_mgmt.

Reviewed by:	avatar, dyoung
Obtained from:	atheros
MFC after:	2 weeks
2006-02-09 22:21:53 +00:00
Sam Leffler
2c27b2f635 only start the cab queue if there are frames to send
MFC after:	2 weeks
2006-02-09 22:14:11 +00:00
Sam Leffler
370572d951 debug fixups: reduce noise msgs, report channel flags on reset failure,
mark data+link fields in descriptor dumps

MFC after:	2 weeks
2006-02-09 22:12:28 +00:00
Sam Leffler
d7736e139e Phantom beacon miss workaround: track the tsf of the last received
frame and if we get a beacon miss interrupt ignore it if we've received
a frame within the beacon miss interval.  This should never trigger
and the handling at the net80211 layer should likewise deal with this
but it doesn't hurt and can suppress extranous probe request frames.
Note that we can legtimately get a bmiss when under heavy load.

MFC after:	2 weeks
2006-02-09 22:03:26 +00:00
Sam Leffler
0bbf544158 use a private task queue thread
MFC after:	2 weeks
2006-02-09 21:48:51 +00:00
Sam Leffler
7a04dc27c1 add adhoc demo mode support
MFC after:	2 weeks
2006-02-09 21:42:53 +00:00
Sam Leffler
17f3f177e4 make regdomain sysctl r/w in case it's possible to do this in the future
MFC after:	2 weeks
2006-02-09 21:36:00 +00:00
Sam Leffler
6c4612b94d cleanup rate setup
MFC after:	2 weeks
2006-02-09 21:31:48 +00:00
Sam Leffler
86e07743eb add tx99 hooks
MFC after:	2 weeks
2006-02-09 21:28:11 +00:00
Sam Leffler
ffa2cab632 move hal statistics to softc; the per-node stats are overkill, they're
only used when operating in station mode

MFC after:	2 weeks
2006-02-09 21:23:44 +00:00
Sam Leffler
913a1ba103 lookup the protection tx rate index in the rate tables
instead of using a known value

MFC after:	2 weeks
2006-02-09 21:17:28 +00:00
Sam Leffler
8b5341de05 honor net80211 mcast tx rate
MFC after:	2 weeks
2006-02-09 21:15:36 +00:00
Sam Leffler
e2d787fa61 allow the size of tx+rx buffer pools to be tuned
MFC after:	2 weeks
2006-02-09 21:03:25 +00:00
Sam Leffler
be61348037 lower try count on mgt (and ctl) frames to avoid clogging the tx queue
and loading the bss when operating in ap mode under load; adjust recognition
of multi-rate retry to match

MFC after:	2 weeks
2006-02-09 20:57:48 +00:00
Sam Leffler
55f63772e8 move mgt frame tx rate responsibility from the rate control modules
to the driver; this avoids redundant logic and will be necessary
for future additions

MFC after:	2 weeks
2006-02-09 20:49:55 +00:00
Sam Leffler
b99190971f track bmiss threshold change from time to frame count 2006-01-23 20:58:05 +00:00
Sam Leffler
7b0c77eca9 Update monitoring support:
o record tsf in tx+rx frames
o switch from raw rssi to dbm for signal data and record both
  signal and noise floor data (hacked for now to assume a fixed
  noise floor; is correct with new hal)
o add monpass sysctl to control which rx'd frames are passed
  up with errors; especially useful to see frames with CRC errors
o mark 'd packets w/ a CRC error with radiotap's BADFCS flag

Also add placeholder code for calibrating the noise floor when
using newer hals.

Reviewed by:	avatar
MFC after:	1 week
2006-01-09 17:13:20 +00:00
Sam Leffler
de66ac4427 nuke special handling to extend cts when bursting; it was race prone
MFC after:	7 days
2005-11-15 05:49:02 +00:00
Ruslan Ermilov
4a0d6638b3 - Store pointer to the link-level address right in "struct ifnet"
rather than in ifindex_table[]; all (except one) accesses are
  through ifp anyway.  IF_LLADDR() works faster, and all (except
  one) ifaddr_byindex() users were converted to use ifp->if_addr.

- Stop storing a (pointer to) Ethernet address in "struct arpcom",
  and drop the IFP2ENADDR() macro; all users have been converted
  to use IF_LLADDR() instead.
2005-11-11 16:04:59 +00:00
Ruslan Ermilov
c4c6f08f68 Fix "struct ifnet" leak on detach. 2005-09-16 10:09:23 +00:00
Sam Leffler
6ee571b27a correct CTS duration calculation; SIFS+ACK should use the xmit rate not
the rate for CTS

MFC after:	3 days
Obtained from:	Atheros
2005-08-12 23:11:44 +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
Robert Watson
13f4c340ae Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags.  Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags.  This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by:	pjd, bz
MFC after:	7 days
2005-08-09 10:20:02 +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
Robert Watson
13b203d0d7 Modify device drivers supporting multicast addresses to lock if_addr_mtx
over iteration of their multicast address lists when synchronizing the
hardware address filter with the network stack-maintained list.

Problem reported by:	Ed Maste (emaste at phaedrus dot sandvine dot ca>
MFC after:		1 week
2005-08-03 00:18:35 +00:00
Sam Leffler
c59005e9c8 o fix setup of sc_diversity; the hal does not give us reliable
status after attach, only after a reset
o when setting diversity via the sysctl don't update sc_diversity
  until we know the hal requested worked
o while here eliminate sc_hasdiversity and sc_hastpc; just query
  the hal each time since these are the only places we need to know

MFC after:	3 days
2005-07-24 05:11:39 +00:00
Sam Leffler
4866e6c248 o move ath_sysctlattach down so variables it depends on are setup
o use any fixed tx antenna for beacons transmitted in adhoc mode

Submitted by:	David Young
MFC after:	3 days
2005-07-23 05:34:29 +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
8f40943151 only invoke ath_rate_tx_complete to update rate control state when the
frame being sent is to be ack'd and hasn't been filtered by the h/w;
this insures we don't pass in tx descriptors that have no meaningful
state (e.g. mcast/bcast frames are not acked and so have no tx retry
counts)

Approved by:	re (scottl)
Obtained from:	Atheros
2005-07-07 00:04:50 +00:00
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Sam Leffler
8371372b25 Change station mode beacon timer setup to insure the calculated
nextTbtt is always ahead of the h/w TSF.

Reviewed by:	avatar
2005-06-09 04:10:01 +00:00
Sam Leffler
0f2e86fb2a Set the correct IFS parameters for the beacon tx queue
when operating in ap and adhoc modes.
2005-06-07 00:12:40 +00:00
Sam Leffler
e8fd88a37b Misc keycache changes:
o purge ath_initkeytable; it's not needed
o add multicast key search support for supporting multiple group keys
  (disabled for now; requires updated hal)
o create keycache entry for stations using open auth so they get h/w
  antenna management support
o add keycache -> node mapping table; eliminates mac-based lookup in
  the net80211 layer
2005-06-06 16:39:21 +00:00
Sam Leffler
b50c8bde99 restore led state on resume
Submitted by:	markus
2005-06-02 03:18:55 +00:00
Sam Leffler
8ca623d734 honor new IEEE80211_KEY_GROUP key flag
Reviewed by:	Tai-hwa Liang
2005-04-12 17:56:43 +00:00
Sam Leffler
31640eb774 use frame type returned by ieee80211_input to drive softled code
instead of monitoring the input packet count
2005-04-04 02:34:15 +00:00
Sam Leffler
fe234894e5 reclaim mbufs in failure cases
Submitted by:	Tai-hwa Liang
2005-03-31 16:39:18 +00:00
Sam Leffler
a8d7e0f6ab close unlikely race
Submitted by:	Michael Wong
2005-03-30 20:30:48 +00:00
Sam Leffler
a7073e8b96 correct comment 2005-03-30 20:29:02 +00:00
Sam Leffler
22233301a3 rev rate control api to pass the both the first+last tx descriptors
to the rate control module for tx complete processing; this enables
rate control algorithms to extract the packet length for xmits that
require multiple descriptors
2005-03-30 20:17:18 +00:00
Sam Leffler
c4c3cb462d o extend cts to cover packet burst when operating in 11g w/ protection
o check current channel parameters, not shadow state, for acm policy
  on data frames
2005-03-30 20:13:08 +00:00
Tai-hwa Liang
33d7d80c82 Fixing kernel build on amd64 machines.
Reviewed by:	sam (mentor)
2005-03-30 02:33:33 +00:00
Sam Leffler
03ed599a2a extend the timestamp from the rx descriptor to calculate the tsf to
use when checking for an ibss merge
2005-03-29 22:16:49 +00:00
Sam Leffler
019b966921 forgot to merge this bit from p4 2005-03-29 21:06:28 +00:00
Sam Leffler
99d258fdc5 replace m_defrag with something more suitable 2005-03-29 20:54:31 +00:00
Sam Leffler
0c97ab9691 reclaim mbuf chain when ieee80211_crypto_encap fails
Noticed by:	David Young
2005-03-08 17:01:03 +00:00
Sam Leffler
d3be6f5b0c Fixup radiotap handling of FCS and QoS frames per discussion with David Young:
o mark rx frames including FCS in the payload with the
  IEEE80211_RADIOTAP_F_FCS flag
o remove hack to copy 802.11 headers with padding out of line; instead mark
  the frames with IEEE80211_RADIOTAP_F_DATAPAD and require applications to
  do the work
o split precalculated radiotap flags into tx+rx now that they can be different

Note the full usefulness of these changes depends on updates to applications
that process radiotap data.
2005-01-24 20:31:24 +00:00
Sam Leffler
f818612b1b beacon handling fixups for adhoc mode:
o don't reclaim any previous beacon state in ath_beacon_alloc; do it
  explicitly in ath_newstate
o reference count the node held in the beacon frame state block
o process ibss merge more intelligently; let the state machine do the
  right thing instead of explicitly setting the new bssi id
o explicitly stop tx dma before doing beacon setup to handle the ibss
  merge case
2005-01-24 20:05:03 +00:00
Sam Leffler
f9e6219b15 switch to use bus_dmamap_load_mbuf_sg 2005-01-24 19:51:59 +00:00
Sam Leffler
4bacf7c1f3 o correct beacon interval calculation; the internal setting is in TU's not ms
o replace the private macro to convert MS->TU with the common one
2005-01-24 19:45:59 +00:00
Sam Leffler
aab26fb481 add missing statistic 2005-01-18 19:33:06 +00:00
Sam Leffler
4c24deac20 disable interrupts when transitioning to INIT state so we don't rx frames 2005-01-18 19:31:31 +00:00
Sam Leffler
f6b8ec160d replace hand-rolled code to compact an mbuf chain with m_defrag; this is
suboptimal but needed for fast frames which won't fit in a single cluster
2005-01-18 19:28:49 +00:00
Sam Leffler
80d2765fe2 setup the beacon xmit queue to not interrupt; we don't use them and
they make the led's flash unnecessarily in adhoc mode
2005-01-18 19:10:17 +00:00
Sam Leffler
3e50ec2c95 better led blinking 2005-01-18 19:03:04 +00:00
Sam Leffler
0a1b94c44c add paren's so we can supply a|b as a debug mask 2005-01-18 18:11:04 +00:00
Sam Leffler
1f1d781074 bump copyright for 2005 2004-12-31 22:42:38 +00:00
Sam Leffler
a614e0762d correct some typos
Submitted by:	Tai-hwa Liang
2004-12-31 20:35:05 +00:00
Sam Leffler
16b4851a16 Radiotap fixups:
o catch one place where we were not using ath_chan_change to
  switch channels; this fixes a problem where the channel
  settings were not being correctly reported in captured packets
o return unique channel identification in the channel flags;
  ethereal gets confused if you return merged flags (e.g. ofdm,
  cck, and 2Ghz) (this is workaround and should be removed if
  we can ever cleanup radiotap consumers)
o correct short/long preamble flag state for rx and treat tx
  the same--use a new hwflags array that gives us the data
  based on the h/w rate index/cookie
o add gross hack to handle radiotap capture of frames that
  come in with hardware padding; should be replaced by a
  flag in the radiotap header and more smarts in the apps
  that decode radiotap data
2004-12-31 20:32:40 +00:00
Sam Leffler
0ab4040a27 for parts that require split keycache entries report the
the index of the first entry on a mic error so we're
consistent with parts that don't have split keycache
2004-12-31 20:21:31 +00:00
Sam Leffler
a6c992f43c Correct beacon timer setup logic:
o lintval is in ms; must convert to TU's for passing to the hal
o roundup to calculate nexttbtt (should look at current tsf and pull the
  calculated nextbtt forward but this'll do for now)
o don't or- in HAL_BEACON_RESET_TSF when doing station timer setup; this
  is not needed and messes up the sleep timer calcs, though it's unclear
  if it mattered as the hal masks these values before use

Submitted by:	Thorsten von Eicken
2004-12-31 20:20:02 +00:00
Sam Leffler
0eb68df4c5 no need to sweep the tx q's for node references in ath_node_free; we know
there are none since we're only called when the ref count goes to zero
2004-12-31 20:13:58 +00:00
Sam Leffler
d77367bf5a cleanup some assertions 2004-12-31 20:11:23 +00:00
Peter Wemm
6891c875c2 Make this amd64-clean. sizeof is long on amd64, so things that do a printf
of a sizeof, need to use %z to get the correct type on all our platforms.
Also, convert integers<->pointers via uintptr_t.

(I think Sam's instructions were for me to commit this.  If I
 misunderstood, then I apologize in advance.)
2004-12-15 02:25:21 +00:00
Sam Leffler
c42a7b7e25 Update with last year of work. 2004-12-08 17:34:36 +00:00
Sam Leffler
e383b24041 Add missing bit of last if_start workaround: mark scan callout
MPSAFE only debug_mpsafenet is 1 so callbacks to send management
frames hold Giant; this is another bandaid on the path to removing Giant.
2004-08-08 17:10:54 +00:00
Sam Leffler
b5f4adb32e Pickup Giant in ath_rx_proc and when handling a beacon miss in order to
satisfy the assertion in if_start.
2004-08-07 00:45:05 +00:00
Max Laier
154b8df2ed Second part of ALTQ driver modifications, covering:
an(4), ath(4), hme(4), ndis(4), vr(4) and wi(4)

Please help testing: http://people.freebsd.org/~mlaier/ALTQ_driver/

Tested by:	Vaidas Damosevicius (an, ath, wi)
		Roman Divacky (vr)
Submitted by:	yongari (hme)
2004-08-01 23:58:04 +00:00
Sam Leffler
710da3ec44 use correct malloc type to allocate struct ieee80211_node's
Noticed by:	phk
2004-04-05 04:42:42 +00:00
Sam Leffler
1e77407972 do proper subclassing of node free+copy; the previous hack falls apart when
the 802.11 layer does useful work

Obtained from:	madwifi
2004-04-03 00:06:23 +00:00
Sam Leffler
babe2453bd transmit beacon frames directly instead of defering them to a swi; there
was too much delay

Obtained from:	madwifi
2004-04-03 00:02:17 +00:00
Sam Leffler
cb344d958a update copyright notice for 2004 2004-04-02 23:57:10 +00:00
Sam Leffler
fdd758d4d1 check more quickly (and directly) if an interrupt is pending; this reduces
work done in ath_intr when the irq is shared

Obtained from:	madwifi
2004-04-02 23:49:15 +00:00
Sam Leffler
b28b465391 cleanup descriptor allocation if attach fails
Obtained from:	madwifi
2004-04-02 23:47:39 +00:00
Sam Leffler
01e7e035e0 remove use IEEE80211_C_RCVMGT 2004-04-02 23:37:00 +00:00
Sam Leffler
2f1ad18b34 radiotap updates:
o force little-endian byte order for header
o pad header to 32-bit boundary to guard against applications that assume
  packet data alignment
2004-04-01 00:38:45 +00:00
Matthew N. Dodd
f7f2bd753e Don't announce MAC addresses twice.
(ieee80211_ifattach() calls ether_ifattach().)
2004-03-20 19:57:47 +00:00
Peter Wemm
3031063498 Make this compile on amd64.
"I'll cope" by:  sam
2004-02-06 00:10:54 +00:00
Sam Leffler
23428eafa0 When draining the tx queue reclaim any node references held in packets.
This fixes a problem when operating as an AP where clients would get
stuck in the node table because the reference count never went to zero.
2004-01-07 19:16:49 +00:00
Sam Leffler
a9c0425768 When ath_hal_stoptxdma returns an error dma is still likely stopped
so don't just stop trying to send a beacon frame or we'll be more likely
to lose sync.  This only seems to happen on some older chips.
2004-01-07 19:11:11 +00:00
Sam Leffler
7bbf937701 use ath_reset instead of ath_init when recovering from a watchdog timeout:
resetting the hardware is sufficient, no need to reset the 802.11 fsm
2004-01-07 19:07:41 +00:00
Sam Leffler
f3be79561f make hw.ath.debug a tunable 2004-01-07 19:05:35 +00:00
Sam Leffler
8c0370b75d make hw.ath.outdoor and hw.ath.countrycode tunables 2004-01-07 19:04:42 +00:00
Sam Leffler
e325e53069 split debugging messages up into classes;
ah_debug is now treated as a bit vector
2004-01-07 18:57:38 +00:00
Sam Leffler
eb2cdcb127 update radiotap support to reflect recent changes:
o move tx taps from ath_start to ath_tx_start so lots more
  state is available to tap
o add tx flags
o add tx rate
o add tx power (constant for the moment)
o add tx antenna state
2003-12-28 07:00:32 +00:00
Sam Leffler
437ffe1823 o eliminate widespread on-stack mbuf use for bpf by introducing
a new bpf_mtap2 routine that does the right thing for an mbuf
  and a variable-length chunk of data that should be prepended.
o while we're sweeping the drivers, use u_int32_t uniformly when
  when prepending the address family (several places were assuming
  sizeof(int) was 4)
o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated
  mbufs have been eliminated; this may better be moved to the bpf
  routines

Reviewed by:	arch@ and several others
2003-12-28 03:56:00 +00:00
Sam Leffler
8cec0ab9a8 o track API change for HAL v0.9.6.1
o fix race condition when processing rx descriptors: because we use
  a self-linked descriptor at the end of the rx descriptor list to
  avoid rx overruns (which can easily happen for 5212 parts that enable
  PHY errors) we must carefully check that a descriptor is "done" by
  looking ahead to the next descriptor before believing the done bit
  in the current descriptor (this is all handled in the HAL since the
  rx descriptor format is chip-specific so we need to pass in two
  additional parameters--the physical address of the current descriptor
  and the virtual address of the next descriptor in the list)
o check copyout return status for SIOCGATHSTATS ioctl

Approved by:	re (scottl)
2003-11-29 01:23:59 +00:00
Sam Leffler
68025aeb6a move rate control change messages under ath_debug 2003-11-17 19:15:09 +00:00
Sam Leffler
f6dbcc4910 o fix WEP use in hostap mode; need to reset the pointer to the
802.11 packet header after stripping the WEP header on input
2003-11-17 19:12:52 +00:00
Sam Leffler
e585d188b0 on a beacon miss try to reassociate before starting a scan
Submitted by:	Henry Qian
2003-11-17 19:02:18 +00:00
Sam Leffler
85643802a4 Don't count PHY errors as input errors. This is important for
5212-based devices because PHY errors are used to collect data
on environmental noise that and doesn't truly reflect the state
of the communications media.  The result is confused users.
Folks that want to watch PHY errors can still get the statistics
through the device ioctl (used by athstats).
2003-11-13 05:35:07 +00:00
Sam Leffler
85bdc65a80 o check hal ABI version to catch driver-HAL mismatches
o print MAC, PHY, and radio h/w revisions at attach
2003-11-01 03:37:33 +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
04e22a026d terminate the rx descriptor list with a self-linked entry
so high phy error rates on a 5212 don't cause rx overruns
2003-10-22 04:37:34 +00:00
Sam Leffler
4bc0e754ee o consolidate rx filter calculations in one place
o enable beacon reception when operating in adhoc mode
  so the 802.11 layer can use them to create nodes for peers
2003-10-17 21:58:39 +00:00
Sam Leffler
fe32c3ef01 indicate device receives all management frames 2003-10-17 21:55:53 +00:00
Sam Leffler
00a12f3ae7 o correct handling of a frame that has too many segments to fit in the
tx descriptor array
o while here fix a whitespace nit

Obtained from:	NetBSD
2003-10-16 16:13:11 +00:00
Sam Leffler
f0b2a0beb6 o convert mutex calls to #defines for portability, etc.
o destroy mutex's on detach (was missing)
2003-10-14 22:51:45 +00:00
Sam Leffler
7d4bf9ccb1 remove dangling mtx_unlock orphaned by rev 1.21 change 2003-10-13 04:57:31 +00:00
Sam Leffler
91101a2af3 Reduce per-packet overhead when using WEP by using an advancing IV
seeded with arc4random rather than calling arc4random for each
packet.  Note this is the same algorithm used to select the IV when
doing WEP on the host.
2003-10-13 03:42:53 +00:00
Sam Leffler
167ecdca8c Must reset the pointer to the 802.11 header after prepending
for WEP in case the prepend addes a new mbuf.  This fixes WEP.
2003-10-13 03:41:32 +00:00
Sam Leffler
2075afba8d MFp4:
o don't grab the mutex at the top of ath_detach; it does nothing
  useful
o deal with entry to ath_ioctl during detach to disable promiscuous
  mode as a result of calling bpfdetach2: cannot call ath_init when
  the device is marked invalid as the code isn't prepared to deal
  with it (in particular by that time the hal reference may have
  been yanked)
2003-10-13 03:39:38 +00:00
Sam Leffler
310e4a4ae6 MFp4:
change ath_rate_ctl_reset to handle transition from station
mode to adhoc mode; was not resetting the initial xmit rate
causing outbound frames to be dicarded
2003-10-13 03:37:38 +00:00
Sam Leffler
abb62a415d include the DS element in beacons 2003-10-06 00:45:25 +00:00
Sam Leffler
de5af70460 Maintain a history of data associated with received frames and use this to
calculate smoothed signal quality data for each node.

o add a 16-deep history buffer to each driver-private node storage that
  holds rssi and antenna info for received frames
o override the default per-node "get rssi" method to return an average
  rssi value based on samples collected over the last second
o enable beacon reception so even idle systems maintain a running history
  of signal quality

This data may also be useful for improving the rate control algorithm.
Based on work by Tom Marshall <tommy@home.tig-grr.com> for MADWIFI.
2003-09-15 22:34:46 +00:00
Sam Leffler
ecddff40a0 o do not filter received frames based on type or length; pass 'em all up
to the 802.11 layer if they are at least IEEE80211_MIN_LEN
o mask off interrupt status bits that we don't care about so we don't do
  the wrong thing; this fixes a problem where the beacon miss interrupt status
  bit is delivered together with other status bits when operating in monitor
  mode (we would post a beacon miss swi and then do the wrong thing)
2003-09-15 19:41:54 +00:00
Sam Leffler
3065b96e25 must also check for 5Ghz channels when marking short preamble capability in
the beacon frames

Reminded by:	Stephane Laroche <stephane.laroche@colubris.com>
2003-09-14 22:53:41 +00:00
Sam Leffler
f6aa038bbe o mark the device capable of short preamble (meaningless for the 5210 but
safe since the 802.11 layer does the right thing for 11a operation)
o select short preamble operation based on the negotiated capabilities; not
  just the local state/capability
o fillin the duration field in the 802.11 header as appropriate
o remove detection of 11g support; no longer needed

Obtained from:	MADWIFI (with modifications)
2003-09-14 22:39:19 +00:00
Sam Leffler
73454c7385 Add support for the experimental radiotap capture format. With this
we no longer need the debugging code to dump packets.
2003-09-05 22:22:49 +00:00
Sam Leffler
f07a6d989f Explicitly enable probe request frame reception when not in station mode;
this is needed for the 5212 which a separate filter bit for these frames.

Submitted by:   Stephane Laroche <stephane.laroche@colubris.com>
2003-09-01 03:12:19 +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
d1d0cf62fe o pass control frames up the stack when in monitor mode (the 802.11 layer will
quietly discard them; this just permits them to be collected with bpf)
o add a counter for the number of rate control frames discarded when not in
  monitor mode
o move the rx "too short" statistic in the stat structure so non-error rx stats
  are together (NB: ABI change to apps that collect stats via driver ioctl)
2003-08-19 21:35:08 +00:00
Sam Leffler
9cccabebd7 o correct beacon frame length calculation and add an assert to catch any future
mistakes (this mistake was not an issue because the length is only used to
  decide whether or not to allocate a cluster)
o while here, move a beacon length comment to the "right place"
2003-08-19 21:28:45 +00:00
Sam Leffler
1b1a8e411e maintain a table for mapping hardware rate codes to 802.11 rates for
calculating the rate for each rx'd frame
2003-08-19 21:24:16 +00:00
Sam Leffler
2274d8c885 mark the scan and calibrate callouts MPSAFE 2003-08-19 21:05:47 +00:00
Sam Leffler
91a2b886de remove unneeded include files 2003-08-19 21:03:30 +00:00
Sam Leffler
b58b38031d Close a race where ath_intr is installed and may be called before
the HAL is setup: use sc_invalid to discard such entries into
ath_intr.  This can easily happen if the device is assigned a shared IRQ.
2003-08-13 21:29:35 +00:00
Sam Leffler
6b59f5e3d0 o remove bmisshack no longer needed with the BSSID fix in v0.9.5.2 of the hal
o add monitor mode support
o fix short preamble handling in beacon setup (noop)
o correct resume handling
2003-08-02 06:14:15 +00:00
Sam Leffler
45bbf62fb5 track changes to 802.11 code:
o override new_state method per new model
o use ieee80211_state_name instead of private copy
2003-07-20 21:38:20 +00:00
Sam Leffler
45cabbdc58 o add read-only sysctls to view regulatory domain, country code, and
outdoor use controls
o use sysctl-visible values in setting up channel list
2003-07-13 17:07:25 +00:00
Sam Leffler
5f3721d5ca acknowledge the contribution of Atsushi Onoe 2003-06-30 04:51:11 +00:00
Sam Leffler
5591b2131a Atheros 802.11 driver. Requires Atheros Hardware Access Lay (HAL).
Supported by:	Atheros Comunications
2003-06-23 17:01:19 +00:00