Commit Graph

727 Commits

Author SHA1 Message Date
Adrian Chadd
f449ab1c29 .. how'd this compile before I commit it and then not now?
Fixed.
2011-02-11 14:07:27 +00:00
Adrian Chadd
6c9b00e11f The last parameter to ath_computedur_ht() is short-GI, not short-preamble. 2011-02-11 13:05:15 +00:00
Adrian Chadd
191470d361 Expose the 4k transaction workaround hooks to the driver, but don't (yet)
fix the descriptor allocation.
2011-02-09 16:37:29 +00:00
Adrian Chadd
67397d396f Add in the (very!) optional glue to flip the 11n bits for if_ath.
There's still a lot of random issues to sort out with the radio side of
things and AMPDU RX handling (and completely missing AMPDU TX handling!)
but if people wish to give this a go and assist in debugging the
issues, they can define ATH_DO_11N to enable it.

I'm just re-iterating - this is here to allow people to assist in
further 11n development; it is not any indication that the 11n support
is complete and functional.

Important notes:

* This doesn't support 1-stream cards yet - (eg AR9285) - the various bits
  that negotiate TX/RX MCS don't know not to try >1 stream TX or negotiate
  1-stream RX; so don't enable 11n unless you've first taught the rate
  control module and the net80211 stack to negotiate 1-stream stuff;

* The only rate control module minimally 11n aware is ath_rate_sample;

* ath_rate_sample doesn't know about HT/40; so airtime will be incorrectly
  calculated;

* The AR9160 and AR9280 radio code is unreliable at the higher MCS rates for
  some reason; this will definitely impact 11n performance;

* AMPDU-TX isn't yet implemented;

* AMPDU-RX may be a bit buggy still and will definitely suffer from the
  radio unreliability mentioned above (ie, don't expect 150/300mbit
  RX just yet.)
2011-02-09 15:43:38 +00:00
Adrian Chadd
be97670785 Fix the keycache behaviour for multicast keycache search.
The correct bit to set is 0x1 in the high MAC address byte, not 0x80.
The hardware isn't programmed with that bit (which is the multicast
adress bit.)

The linux ath9k keycache code uses that bit in the MAC as a "this is
a multicast key!" and doesn't set the AR_KEYTABLE_VALID bit.
This tells the hardware the MAC isn't to be used for unicast destination
matching but it can be used for multicast bssid traffic.

This fixes some encryption problems in station mode.

PR: kern/154598
2011-02-09 15:23:16 +00:00
Adrian Chadd
00fc87059c net80211 really doesn't want A_MPDU to appear on non-11n station node mbufs.
Revert back to the previous method of doing it for where a node can be
identified and it's an 11n node.

I'll have to do some further research into exactly what is being messed up
with the sequence number matching and I'll then revisit this.
2011-02-08 20:16:43 +00:00
Adrian Chadd
5e9608093f Commit some missing bits to the sample rate module to (more) correctly calculate 802.11n packet duration.
This doesn't yet take into account HT40 packet durations as the node info
(needed to know if it's a HT20 or HT40 node) isn't available everywhere
it needs to be.
2011-02-08 18:31:28 +00:00
Adrian Chadd
bd7ea37bac I missed this commit - enable 4k transaction support for the ar5416+ar9160. 2011-02-08 14:15:46 +00:00
Adrian Chadd
e0e5b8b471 There's apparently a bug with Merlin (AR9280) and later chipsets where
putting descriptors (not buffers) across a 4k page boundary can cause issues.
I've not seen it in production myself but it apparently can cause problems.

So, in preparation for addressing this workaround, (re)-expose the particular
HAL capability bit which marks whether the chipset has support for cross-4k-
boundary transactions or not.

A subsequent commit will modify the descriptor allocation to avoid allocating
descriptor entries that straddle a 4k page boundary.
2011-02-08 12:49:01 +00:00
Adrian Chadd
8f6997190b Add in some AR9280 specific board configuration options.
* The existing radio config code was for the AR5416/AR9160 and missed out
  on some of the AR9280 specific stuff. Include said stuff from ath9k.

* Refactor out the gain control settings into a new function, again pilfered
  from ath9k.

* Use the analog register RMW macro when touching analog registers.

Obtained from:	Linux ath9k
2011-02-07 22:00:31 +00:00
Adrian Chadd
1a506b1a27 Bring over some AR9280-specific v14 additions that exist in ath9k.
Obtained from:	Linux ath9k
2011-02-07 21:48:26 +00:00
Adrian Chadd
806099d3d5 Use analog delay macro for modifying an analog register. 2011-02-07 21:30:56 +00:00
Adrian Chadd
d9a80efdc2 Add a new RMW macro for analog register writes which implements the needed
wait period between operations.
2011-02-07 21:30:13 +00:00
Adrian Chadd
3118fac370 Fix typo in SIFS setup 2011-02-07 17:04:31 +00:00
Adrian Chadd
ec165c61b1 Add in a per phy error sysctl. 2011-02-07 15:09:13 +00:00
Adrian Chadd
a07e9ddb3b Just tag all RX packets as needing reorder processing for now.
This fixes two problems -

* All packets need to be processed here, not just aggregate ones - as any
  received frames (AMPDU or otherwise) in the given TID (traffic class id)
  will update the sequence number and, implied with that, update the window;
* It seems there's situations where packets aren't matching a current node but
  somehow need to be tracked. Thus just tag them all for now; I'll figure out
  the why later.

Whilst I'm here, bump the stats counters whilst I'm at it.

This fixes AMPDU RX in my tests; the main problems now stem from what look
like PHY level error/retransmits which are impeding general throughput, incl.
AMPDU.
2011-02-06 20:11:24 +00:00
Adrian Chadd
f673a81060 Only tag packets with the A-MPDU bit if they were part of an A-MPDU RX.
Whilst I'm here, add a counter to count said packets.
2011-02-06 17:40:27 +00:00
Adrian Chadd
c7ff3cee42 Add a temporary workaround so the 11n rate scenario setup code sets a useful
TX chainmask.

since the upper layers don't (yet) know about the active TX/RX chainmasks,
it can't tell the rate scenario functions what to use. I'll eventually sort
this out; this restores functionality in the meantime.
2011-02-05 22:54:37 +00:00
Adrian Chadd
f6c4b1690f Oops, fix newbie mistake that breaks the normal build. 2011-02-04 00:25:18 +00:00
Adrian Chadd
c1782ce034 Modify the TX path to set and use the 11n rate scenario bits.
This isn't strictly required to TX (at least non-agg and non-HT40,
non-short-GI) frames; but as it needs to be done anyway, just get
it done.

Linux ath9k uses the rate scenario style path for -all- packets,
legacy or otherwise. This code does much the same.

Beacon TX still uses the legacy, non-rate-scenario TX descriptor
setup. Ath9k also does this.

This 11n rate scenario path is only called for chips in the AR5416
HAL; legacy chips use the previous interface for TX'ing.
2011-02-03 20:30:17 +00:00
Adrian Chadd
fe583b84f5 Disable the code I previously added from Rui's 802.11n branch.
A-MPDU RX interferes with packet retransmission/reordering.
In local testing, I was seeing A-MPDU being negotiated and then
not used by the AP sending frames to the STA; the STA would then
treat non A-MPDU frames that are retransmits as out of the window
and get plain confused.

The hardware RX status descriptor has a "I'm part of an aggregate"
bit; so this should eventually be tested and then punted to the
A-MPDU reorder handling only if it has this bit set.
2011-02-03 20:26:26 +00:00
Adrian Chadd
70d2183a7d Call the correct ANI Attach routine. 2011-02-02 03:55:34 +00:00
Adrian Chadd
be96a6d39b Just to be sure, make sure the MCS rates are allowed for TX.
Approved by:	rpaulo@
2011-02-01 15:26:30 +00:00
Adrian Chadd
710c377821 Add a new method to the rate control modules which extract out the
three other rates and try counts.

The 11n rate scenario path wants to take a list of rate and tries,
rather than calling setupxtxdesc().
2011-02-01 08:10:18 +00:00
Adrian Chadd
4b44f6f275 Include some preliminary TX HT rate scenario setup code.
The AR5416 and later TX descriptors have new fields for supporting
11n bits (eg 20/40mhz mode, short/long GI) and enabling/disabling
RTS/CTS protection per rate.

These functions will be responsible for initialising the TX descriptors
for the AR5416 and later chips for both HT and legacy frames.

Beacon frames will remain using the non-11n TX descriptor setup for now;
Linux ath9k does much the same.

Note that these functions aren't yet used anywhere; a few more framework
changes are needed before all of the right rate information is available
for TX.
2011-02-01 08:03:01 +00:00
Adrian Chadd
79f02dbfed Refator the common code which calculates the 802.11g protection duration. 2011-02-01 07:50:26 +00:00
Adrian Chadd
81a826882a * Add a rather hacky "does this speak the 11n TX descriptor format"
function; which will be later used by the TX path to determine
  whether to use the extended features or not.

* Break out the descriptor chaining logic into a separate function;
  again so it can be switched out later on for the 11n version when
  needed.

* Refactor out the encryption-swizzling code that's common in the
  raw and normal TX path.
2011-02-01 06:59:44 +00:00
Adrian Chadd
29e9b81e77 Add TX/RX chainmask info to if_ath - this is needed for the 11n TX rate series. 2011-02-01 04:39:15 +00:00
Adrian Chadd
94d748d2a9 Add a new capability which reports the number of spatial streams a device supports.
The higher levels (net80211, if_ath, ath_rate) need this to make correct
choices about what MCS capabilities to advertise and what MCS rates are
able to be TXed.

In summary:

* AR5416 - 2/3 antennas, 2x2 streams
* AR9160 - 2/3 antennas, 2x2 streams
* AR9220 - 2 antennas, 2x2 sstraems
* AR9280 - 2 antennas, 2x2 streams
* AR9285 - 2 antennas but with antenna diversity, 1x1 stream
2011-02-01 03:51:35 +00:00
Adrian Chadd
59d7849bbd Remove the now unneeded XXX. 2011-01-31 22:45:14 +00:00
Adrian Chadd
a83df4d35d Enable AMPDU reorder processing and receiving BAR frames when doing 802.11n.
Obtained from:	rpaulo@
2011-01-31 22:44:28 +00:00
Adrian Chadd
d39a3a978b Don't incorrectly set the burst duration setting in the TX descriptor.
After inspecting the ath9k source, it seems the AR5416 and later MACs
don't take an explicit RTS/CTS duration. A per-scenario (ie, what multi-
rate retry became) rts/cts control flag and packet duration is provided;
the hardware then apparently fills in whatever details are required.
The per-rate sp/lpack duration calculation just isn't used anywhere
in the ath9k TX packet length calculations.

The burst duration register controls something different; it seems to
be involved with RTS/CTS protection of 11n aggregate frames and is set
via a call to ar5416Set11nBurstDuration().

I've done some light testing with rts/cts protected frames and nothing
seems to break; but this may break said RTS/CTS and CTS-to-self protection.
2011-01-31 15:42:42 +00:00
Adrian Chadd
1e918679c6 Avoid writing CCA threshold values for the EXT radios for non-HT40 channels. 2011-01-29 14:36:31 +00:00
Adrian Chadd
c6c9d8c8ed Bring over some NF calibration changes from ath9k.
Each different radio chipset has a different "good" range of CCA
(clear channel access) parameters where, if you write something
out of range, it's possible the radio will go deaf.

Also, since apparently occasionally reading the NF calibration
returns "wrong" values, so enforce those limits on what is being
written into the CCA register.

Write a default value if there's no history available.

This isn't the case right now but it may be later on when "off-channel"
scanning occurs without init'ing or changing the NF history buffer.
(As each channel may have a different noise floor; so scanning or
other off-channel activity shouldn't affect the NF history of
the current channel.)
2011-01-29 14:27:20 +00:00
Adrian Chadd
7c913dea08 Fix some errors introduced w/ the last commit; fix setting RTS/CTS in the 11n rate scenario.
* I messed up a couple of things in if_athvar.h; so fix that.
* Undo some guesswork done in ar5416Set11nRateScenario() and introduce a
  flags parameter which lets the caller set a few things. To begin with,
  this includes whether to do RTS or CTS protection.
* If both RTS and CTS is set, only do RTS. Both RTS and CTS shouldn't be
  set on a frame.
2011-01-29 12:30:13 +00:00
Adrian Chadd
94b61069cc Link in the 11n specific TX methods into the HAL. 2011-01-29 12:16:26 +00:00
Adrian Chadd
b8e788a53a Migrate the TX path code out of if_ath and into a separate source file.
There's two reasons for this:

* the raw and non-raw TX path shares a lot of duplicate code which should be
  refactored;
* the 11n-ready chip TX path needs a little reworking.
2011-01-29 11:35:23 +00:00
Adrian Chadd
7efd41107b Add a check for the AR9285E; I have no idea what this is.
The only other changes in ath9k for the AR9285E revolve around sleep modes
which are not fully implemented here yet.
2011-01-29 08:52:06 +00:00
Adrian Chadd
5bc8125ad3 Break out the debug macros from if_ath.c into if_ath_debug.[ch] .
This is prep work for breaking out the TX path into a separate
set of source files.
2011-01-29 05:08:21 +00:00
Adrian Chadd
a6a308a4df (Mostly) teach ath_rate_sample about MCS rates.
This is just the bare minimum needed to teach ath_rate_sample to try
and handle MCS rates. It doesn't at all attempt to find the best
rate by any means - it doesn't know anything about the MCS rate
relations, TX aggregation or any of the much sexier 11n stuff
that's out there.

It's just enough to transmit 11n frames and handle TX completion.

It shouldn't affect legacy (11abg) behaviour.

Obtained from:	rpaulo@
2011-01-28 08:57:58 +00:00
Adrian Chadd
064e40d0ab Make space for the extended 802.11n MCS rate tables. 2011-01-28 08:45:19 +00:00
Adrian Chadd
d054f3a866 Bring in some 802.11n packet duration calculation functions from a mix of Sam/Rui and linux ath9k .
This will eventually be used by rate control modules and by the TX
code for calculating packet duration when handling rts/cts protection.

Obtained from:	sam@, rpaulo@, linux ath9k
2011-01-28 08:35:55 +00:00
Adrian Chadd
0fafe07ff3 Initialise the chainmask from the EEPROM rather than the hard-coded defaults.
The defaults enabled three chains on the AR5416 even if the card has two
chains. This restores that and ensures that only the correct TX/RX
chainmasks are used.

When HT modes are enabled, all TX chains will be correctly enabled.

This should now enable analog chain swapping with 2-chain cards.
I'm not sure if this is needed for just the AR5416 or whether
it also applies to AR9160, AR9280 and AR9287 (later on); I'll have
to get clarification.
2011-01-27 09:26:37 +00:00
Adrian Chadd
4ceb85596b Add missing getCapability call for AR5416. 2011-01-27 08:42:50 +00:00
Adrian Chadd
51fcc8350c Make a note to re-check whether that particular check is needed. 2011-01-27 07:33:17 +00:00
Adrian Chadd
6ef699a0a6 Writing to the analog registers on the AR9220 (Merlin PCI) seems to require a delay.
This, along with an initval change which will appear in a subsequent commit,
fixes bus panics that I have been seing with the AR9220 on a Routerstation Pro
(AR7161 MIPS board.)

Obtained from: Linux ath9k
PR: kern/154220
2011-01-27 02:56:03 +00:00
Adrian Chadd
f68a9f06e1 Add ar5416RestoreChainMask() which will undo any AR5416 specific chainmask
overriding after calibration.

This will get set for other two chain radios, such as AR9280 and later on,
AR9287. It should however be a nul operation.
2011-01-26 10:48:29 +00:00
Adrian Chadd
b868c6d0b1 Add an AR5416 workaround - force a different bias based on 2.4ghz channel frequency.
Obtained from:	Linux ath9k
2011-01-26 10:36:43 +00:00
Adrian Chadd
60a507a514 Break out the chainmask init code into a new function - ar5416InitChainMasks() .
ath9k does a few different things here during config - if it's an early
AR5416 with two chains, it enables all three chains for calibration and
then restores the chainmask to the original values after initial
calibration has completed.

The reason behind this commit is to begin breaking out the chainmask
configuration for this specific reason; follow-up commits will add
the chainmask restore in the ar5416Reset() routine.
2011-01-26 10:08:37 +00:00
Adrian Chadd
5a2def3a5e * fix HAL_DEBUG_INTERRUPT to be a separate bit, it was overlapping with
something else
* add HAL_DEBUG_GPIO, for some GPIO related debugging I'm tinkering with
  at the moment.
2011-01-26 09:37:43 +00:00
Adrian Chadd
3545027dc3 * Re-format the v4k header to be consistent
* Re-do the structure size/component math to make sure the struct matches
  the expected size
* Just to be clear that we care about bitmask ordering, revert my previous
  change and instead define that macro if we're on big-endian.
2011-01-25 07:37:12 +00:00
Adrian Chadd
6468b2baa5 Bring over a fix from ath9k - zero some of the TX descriptors for Kite/AR9285.
Kite doesn't have per-chain control (it has one chain) or antenna control; so
don't try to set those descriptor entries.
2011-01-25 05:47:50 +00:00
Adrian Chadd
2b020858f9 Rename this linux-ism __BIG_ENDIAN_BITFIELD macro to something suitable for FreeBSD.
Warner has pointed out that FreeBSD's bit orders follow byte orders.
2011-01-25 05:41:36 +00:00
Adrian Chadd
d55a8a09e8 Commit updated AR9285 (Kite) v2 initvals from ath9k. 2011-01-25 05:36:29 +00:00
Adrian Chadd
fb14f71662 Fix the Atheros V4K EEPROM definitions to match those in ath9k.
It turns out that the V4K eeprom definitions (used by the AR9285 and
its derivatives) is wrong. These values are at least causing issues
on my AR2427.

With this fix (and initvals in a subsequent commit), the AR2427 behaves
a lot better.

Note - there's still significant drift between the ath9k v4k eeprom
init code (again, used by AR9285 and derivatives) and what's in this
tree. That needs to be investigated and resolved.
2011-01-25 05:35:09 +00:00
Adrian Chadd
514539dcbd Remove an invalid register setup; this is likely a holdover from
the AR5212 code. It doesn't exist in ath9k and I've been told it
doesn't exist in the Atheros internal driver.
2011-01-24 17:03:22 +00:00
Adrian Chadd
d8d0c29db8 Enable the 11n PHY by default whether or not 11n is configured.
The linux ath9k driver and (from what I've been told) the atheros reference
driver does this; it then leaves discarding 11n frames to the 802.11 layer.

Whilst I'm here, merge in a fix from ath9k which maintains a turbo register
setting when enabling the 11n register; and remove an un-needed (duplicate)
flag setting.
2011-01-23 14:49:50 +00:00
Adrian Chadd
69d1f737f8 Update the AR9280v2 inivals to match what is in Linux ath9k.
This repairs the behaviour of my AR9280 - both radio chains now seem
to correctly be receiving.
2011-01-23 14:30:35 +00:00
Adrian Chadd
409daaf37b Fix some typos. 2011-01-21 07:28:48 +00:00
Adrian Chadd
25580e3f63 Add missing getCapability call for AR5416. 2011-01-21 07:26:53 +00:00
Adrian Chadd
a5314ffdf0 Modify the v14/v4k eeprom diag interface to return the whole eeprom.
The v1 and v3 interfaces returned the whole EEPROM but the v14/v4k
interfaces just returned the base header. There's extra information
outside of that which would also be nice to get access to.
2011-01-21 06:42:25 +00:00
Adrian Chadd
a108ab6394 ANI changes #1 - split out the ANI polling from the RxMonitor hook.
The rxmonitor hook is called on each received packet. This can get very,
very busy as the tx/rx/chanbusy registers are thus read each time a packet
is received.

Instead, shuffle out the true per-packet processing which is needed and move
the rest of the ANI processing into a periodic event which runs every 100ms
by default.
2011-01-21 05:21:00 +00:00
Adrian Chadd
1e659efff7 ar9280SetAntennaSwitch() was using the AR5416 chainmasks (3 chains)
rather than the AR9280 chainmasks (2 chains)
2011-01-20 15:09:11 +00:00
Adrian Chadd
c44797fc39 Only enable 11n modes if the chipset suports 11n.
Since the AR2427 doesn't allow 802.11n, it shouldn't have them
configured.
2011-01-20 09:46:18 +00:00
Adrian Chadd
1d6334ce30 Include the device ids for the AR2427.
This is apparently an AR9285 with the 802.11n specific bits disabled.

This code is completely untested; I'm doing this in response to users
who wish to test the functionality out. It's likely as buggy as the
AR9285 support is in FreeBSD at the moment.
2011-01-20 09:37:53 +00:00
Adrian Chadd
204582f2f3 Push the non-AR5416 related stuff into chipset specific directories.
sys/dev/ath/ath_hal/ar5416/ is getting very crowded and further
commits will make it even more crowded. Now is a good time to
shuffle these files out before any more extensive work is done
on them.

Create an ar9003 directory whilst I'm here; ar9003 specific
chipset code will eventually live there.
2011-01-20 09:03:40 +00:00
Adrian Chadd
564e7aea54 Add a comment from my local HAL about what is actually going on here
with these ADC DC Gain/Offset calibrations.

The whole idea is to calibrate a pair of ADCs to compensate for any
differences between them.

The AR5416 returns lots of garbage, so there's no need to do the
calibration there.

The AR9160 returns 0 for secondary ADCs when calibrating 2.4ghz 20mhz
modes. It returns valid data for the secondary ADCs when calibrating
2.4ghz HT/40 and any 5ghz mode.
2011-01-20 08:40:22 +00:00
Adrian Chadd
bd97c52a22 Migrate the sample rate module to the new ath_hal_gettxcompletionrates() API.
This removes the chipset-dependent TX DMA completion descriptor groveling.
It should now be (more) portable to other, later atheros chipsets when the
time comes.
2011-01-20 08:19:23 +00:00
Adrian Chadd
82d2927d95 Add in the public method to access the tx completion rates. 2011-01-20 08:15:46 +00:00
Adrian Chadd
88117a532d Include the initial support for external EEPROMs.
The AR9100 at least doesn't have an external serial EEPROM
attached to the MAC; it instead stores the calibration data
in the normal system flash.

I believe earlier parts can do something similar but I haven't
experienced it first-hand.

This commit introduces an eepromdata pointer into the API but
doesn't at all commit to using it. A future commit will
include the glue needed to allow the AR9100 support code
to use this data pointer as the EEPROM.
2011-01-20 07:56:09 +00:00
Adrian Chadd
c485136b7f Port over another EEPROM option from ath9k - AR_EEP_DAC_HPWR_5G
This will be used by the temperature compensation calibration code
which will shortly make an appearance.
2011-01-20 07:42:39 +00:00
Adrian Chadd
7fbdd9a0e9 Add another HAL function which waits for a register for a configurable amount.
This will be used by some future code.
2011-01-20 07:03:20 +00:00
Adrian Chadd
9ea467445d Add a new HAL method to retrieve the completion schedule. It sets
the completion schedule from the hardware and returns AH_TRUE if
the hardware supports multi-rate retries (AR5212 and above); and
returns AH_FALSE if the hardware doesn't support multi-rate retries.

The sample rate module directly reads the TX completion descriptor
and extracts the TX schedule information from that. It will be
updated in a future commit to instead use this method to determine
the completion schedule.
2011-01-20 05:49:15 +00:00
Adrian Chadd
25c96056ef Use the now-exposed diag code, rather than a hard-coded magic number. 2011-01-20 04:59:11 +00:00
Adrian Chadd
0dbe9289ce Break out the diagnostic codes from ah_internal.h and place them in ah_diagcodes.h.
Since we now have the source code, there's no reason to hide the diag codes
from other areas.

They live in the HAL as they form part of the HAL API and should still be treate
as "potentially flexible; don't publish as a public API." But since they're
already used as a public API (see follow-up commit), we may as well use
them in place of magic constants.
2011-01-20 04:57:26 +00:00
Matthew D Fleming
240577c2a7 Fix up a few more sysctl(9) mis-typing found in various LINT builds. 2011-01-13 18:20:27 +00:00
Matthew D Fleming
6dc7dc9a3e sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.
Commit the rest of the devices.
2011-01-12 19:53:56 +00:00
Adrian Chadd
f70c72aa0c Fix indenting/whitespace issues introduced by me. 2010-08-15 11:40:53 +00:00
Adrian Chadd
5674f4a799 The comment is misleading - that register setting seems to kick off the
initial chip NF cal.
2010-08-15 11:32:05 +00:00
Adrian Chadd
627e7864f1 A local addition, not imported from ath9k.
AR_PHY_CALMODE is explicitly reset on interface reset for other chipsets;
this commit also sets it for the AR9160.
2010-08-14 15:48:18 +00:00
Adrian Chadd
6a0c1a60c0 * Merge in AR9160 initval updates from Linux-2.6.34.
* Grab the AR_PHY_CCA and AR_PHY_EXT_CCA initvals from Linux wireless-testing.

Obtained from: Linux-2.6.34
2010-08-14 15:46:18 +00:00
Adrian Chadd
49d2d79b7a Merge in a fix for the power/(gain?) calculation. Apply it to both
the 5416/9160 and 9285 code paths.

Obtained from:	OpenWRT r22123, 522-ath9k_pwrcal_fix.patch
2010-08-14 15:29:21 +00:00
Adrian Chadd
8f279cf6e7 Fix the calibration logic to correctly clamp the calculated coefficient.
Obtained from:	OpenWRT r22123, 521-ath9k_iqcal_fix.patch
2010-08-14 15:28:15 +00:00
Adrian Chadd
e8dabfbea9 Export ath stats via snmp, rather than requiring a debugging interface
and "athstats".
2010-08-14 14:18:02 +00:00
Adrian Chadd
7ec4e6b83b Add a global counter of missed beacons.
The existing missed beacon count is reset once a beacon isn't missed.
2010-08-14 14:01:12 +00:00
Adrian Chadd
d86cdfe4b0 * Fix indentation
* Restore comment erroneously deleted from the previous commit
2010-08-12 08:39:54 +00:00
Adrian Chadd
52f81b679a Loading the NF CCA values may take longer than expected to occur.
If it does, don't then try reprogramming the NF "cap" values (ie
what values are the "maximum" value the NF can be) - instead,
just leave the current CCA value as the NF cap.

This was inspired by some similar work from ath9k. It isn't
a 100% complete solution (as there may be some reason where a
high NF CCA/cap is written, causing the baseband to stop thinking it
is able to transmit, leading to stuck beacon and interface reset)
which I'll investigate and look at fixing in a later commit.

Obtained from:	Linux
2010-08-12 06:20:54 +00:00
Adrian Chadd
5215ce1038 Use ar5212IsNFCalInProgress() to check for NF calibration progress. 2010-08-12 06:14:26 +00:00
Adrian Chadd
245f553a78 Fix indentation. 2010-08-12 06:12:39 +00:00
Adrian Chadd
ccf98f5d9d Ensure that the correct rxchainmask is used when doing calibration in the
AR5416 and later chipsets.

ath_hal_calibrateN() calls the HAL calibrateN function with rxchainmask=0x1.
This is not necessarily the case for AR5416 and later chipsets.
2010-08-12 06:11:44 +00:00
Adrian Chadd
43ff2d6aec Internal NF calibration should not occur in parallel with any other
calibration. Ensure that the NF calibration completes before continuing
with the rest of the calibration setup process.
2010-08-12 06:08:36 +00:00
Adrian Chadd
85b035b335 Add a couple of functions to check NF calibration progress / completion. 2010-08-12 06:06:14 +00:00
Adrian Chadd
8197f57e6a Don't delay updating the longcal timer - instead, update the longcal
flag immediately so it's only set once per longcal interval.

Without this, the current AR5416 code will continuously spam NF
calibrations during a periodic calibration if the longcal flag
is set. The longcal flag wouldn't be cleared until the calibration
method indicates that calibrations are "complete".

This drops the rate of NF calibration updates down from "once every
shortcal" (ie, every 100ms) during a periodic calibration, to only
once per "longcal" interval. Spamming NF calibrations every 100ms
caused some potentially horrific issues in noisy environments as
NF calibrations can take longer than 100ms and this spamming can
cause invalid NF calibration results to be read back - leading to
missed beacons, and thus leading to a stuck beacon situation.

Stuck beacons cause interface resets, which restart calibrations.
This means that the longcal calibration runs every 100ms (shortcal)
until all initial calibrations are completed. This spamming can then
cause the above issues which leads to stuck beacons, leading to
interface resets, etc, etc. Quite annoying.
2010-08-10 07:56:56 +00:00
Adrian Chadd
8b9cd503d2 Bring over ar5416 inivals from Linux-2.6.34.
Reviewed by:	rpaulo@
Obtained from:	Linux
2010-08-10 07:48:13 +00:00
Adrian Chadd
329e425acd Re-format the ar5416 inivals to be consistent with what
Linux ath9k uses.
2010-08-10 07:47:43 +00:00
Adrian Chadd
d273f00076 Extend the ath debugging a little to log the interface name.
Some devices have >1 atheros card and the current debug prints
make it impossible to tell which interface is being unhappy.
2010-07-08 14:08:03 +00:00
Rui Paulo
cb3fbd1b92 Fix typo introduced in previous revision. 2010-06-27 10:17:11 +00:00
Rui Paulo
fcfe3ad480 Fix the AR_SREV_MERLIN_20_OR_LATER() check.
Submitted by:	Alex Kozlov <spam at rm-rf.kiev.ua>
MFC after:	2 weeks
2010-06-26 20:59:10 +00:00
Bernhard Schmidt
7041d50cfd sc_lastrs is also used in case the sending station is not known, for
example in a split IBSS scenario. Therefore always assign sc_lastrs.
This removes a hack I committed in r206457.

Approved by:	rpaulo (mentor)
2010-06-14 08:24:00 +00:00
Rui Paulo
20c785f94f Rewrite ar9285SetBoardValues() to match what ath9k does and fix out of
bounds reads.

MFC after:	3 days
2010-06-01 15:47:57 +00:00
Rui Paulo
4f49ef4382 Bring in a couple of fixes from the Linux ath9k related to chip hangs.
While there, try to make the register write pattern look like what's
done by ath9k.

MFC after:	3 days
2010-06-01 15:33:10 +00:00
Rui Paulo
c48585e1c1 Fix an off by one in ar9285SetPowerCalTable().
Found with:	Coverity Prevent(tm)
CID:		3979
MFC after:	3 days
2010-06-01 14:37:11 +00:00
Rui Paulo
bf59e055db Due to the way HALDEBUG() is defined, we need to add curly brackets
when using it as a sole if clause instruction.
While there, fix 'const static' typo.

Submitted by:	Arnaud Lacombe <alc@FreeBSD.org>
MFC after:	1 week
2010-05-29 16:14:02 +00:00
Rui Paulo
3a4a144128 Due to the way HALDEBUG() is defined, we need to add curly brackets when
using it as a sole if clause instruction.

Submitted by:	Arnaud Lacombe <alc@FreeBSD.org>
MFC after:	1 week
2010-05-29 16:11:51 +00:00
Rui Paulo
efe604e56b Don't shadow the global variable 'version'.
Submitted by:	Arnaud Lacombe <alc@NetBSD.org>
MFC after:	1 week
2010-05-29 16:10:07 +00:00
Maxim Sobolev
e50d35e6c6 Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after:	1 month
2010-05-03 07:32:50 +00:00
Warner Losh
bc391cb2ce The Atheros AR71xx CPUs, when paired with the AR5212 parts, has a bug
that generates a fatal bus trap.  Normally, the chips are setup to do
128 byte DMA bursts, but when on this CPU, they can only safely due
4-byte DMA bursts due to this bug.  Details of the exact nature of the
bug are sketchy, but some can be found at
https://forum.openwrt.org/viewtopic.php?pid=70060 on pages 4, 5 and 6.
There's a small performance penalty associated with this workaround,
so it is only enabled when needed on the Atheros AR71xx platforms.

Unfortunately, this condition is impossible to detect at runtime
without MIPS specific ifdefs.  Rather than cast an overly-broad net
like Linux/OpenWRT dues (which enables this workaround all the time on
MIPS32 platforms), we put this option in the kernel for just the
affected machines.  Sam didn't like this aspect of the patch when he
reviewed it, and I'd love to hear sane proposals on how to fix it :)

Reviewed by:	sam@
2010-05-01 16:36:14 +00:00
Rui Paulo
e6d4e3c661 Remove svn:executable prop. 2010-04-12 13:46:20 +00:00
Bernhard Schmidt
632ee7e3a4 Add WPA-None support:
* WPA-None requires ap_scan=2:
  The major difference between ap_scan=1 (default) and 2 is, that no
  IEEE80211_IOC_SCAN* ioctls/functions are called, though, there is a
  dependency on those. For example the call to wpa_driver_bsd_scan()
  sets the interface UP, this never happens, therefore the interface
  must be marked up in wpa_driver_bsd_associate(). IEEE80211_IOC_SSID
  also is not called, which means that the SSID has not been set prior
  to the IEEE80211_MLME_ASSOC call.
* WPA-None has no support for sequence number updates, it doesn't make
  sense to check for replay violations..
* I had some crashes right after the switch to RUN state, issue is
  that sc->sc_lastrs was not yet defined.

Approved by:	rpaulo (mentor)
MFC after:	3 weeks
2010-04-10 13:54:00 +00:00
Rui Paulo
a1d99827dd Setup the correct RX/TX chainmask when we play with the antenna
settings.

MFC after:	1 week
Sponsored by:	iXsystems, inc
2010-04-09 13:58:54 +00:00
Rui Paulo
d4aef82b99 Introduce ath_hal_setInterrupts(), a macro for ah_setInterrupts().
Pointed out by:	sam
2010-03-03 17:42:39 +00:00
Rui Paulo
3e9c59558d Replace Id keyword with FreeBSD keyword and set the svn props correctly.
No functional change.
2010-03-03 17:32:32 +00:00
Rui Paulo
256796db58 Couple of suggestions from Sam regarding latest commit:
o rename the new variables to comply with the naming scheme
o move the new variables to an AR5212 specific struct
o use ahp when available
o revert to previous ts_flags check
2010-03-02 12:59:42 +00:00
Rui Paulo
9425e26b82 Properly setup the TX FIFO threshold for AR5416 based chipsets,
including the AR9285. This seems to fix some users's problems.

Submitted by:	Jorge Boncompte [DTI2] <jorge at dti2.net>
2010-03-01 17:04:19 +00:00
Daniel Eischen
4fa8d4eff4 Correct spelling of reseting (found while researching the "bb hang detected"
messages that are plaguing me).  While I'm here, delete trailing whitespace.
2010-02-19 18:23:45 +00:00
Rui Paulo
8c53f2f83c Fix Kite and Merlin version check. 2010-02-16 12:43:55 +00:00
Rui Paulo
1480515a8b Fix KITE version check.
Obtained from:	//depot/user/rpaulo/80211n/...
2010-02-15 18:47:42 +00:00
Rui Paulo
7d4f72b39d Bring back AR9285 support. This fixes most of the issues and should be
pretty usable.

MFC after:	1 month
2010-02-15 17:49:49 +00:00
Rui Paulo
12fefae25c Revert part of the 9285 support because it breaks the 9280 support. I'll
try to do the 9285 support without interfering with any other chipset
revisions support.
2010-02-14 16:26:32 +00:00
Rui Paulo
1ac5dac214 Fix typo in comment.
Pointed out by:	danfe
2010-02-10 11:12:39 +00:00
Rui Paulo
24b509868d 't' stands for Turbo and is a valid mode, so fix previous commit.
Pointed out by:	sam
2010-02-10 11:11:37 +00:00
Tai-hwa Liang
4a97e4f030 Fixing compilation bustage by removing a stray comment fragment. 2010-02-09 04:07:39 +00:00
Rui Paulo
9ac01d39ad Add multicast key search support. This fixes corrupted mcast packets
when we have more than one hostap vap.

Submitted by:	Russell Yount <russell.yount at gmail.com>
MFC after:	2 weeks
2010-02-08 20:23:20 +00:00
Rui Paulo
21d18f0e20 Fix TX power problems with AR9285. 2010-02-08 20:12:01 +00:00
Rui Paulo
b605438031 Fix typo in comment. 2010-02-08 20:04:02 +00:00
Rui Paulo
f3d3bf8731 Add support for the AR9285 chipset, which is found on many netbooks
available today.

This card is a low power 802.11bgn that only does 11n rates up to MCS 7
(that's 65 Mbps in 20Mhz mode and 135 in 40Mhz mode).
802.11n is  not yet supported, but will be in the future.

The driver still has a problem regarding to the setting of txpower on
the card, so don't expect good performance yet. After fixing this
problem, an MFC is possible.

Special thanks to iXsystems and S Smirnov <tonve at yandex.ru> for help
with the purchase of a netbook with this card.

Sponsored by:	iXsystems, Inc.
2010-01-29 10:10:14 +00:00
Rui Paulo
b0a5caf4f2 Replace Id keyword with the FreeBSD keyword. 2010-01-29 10:07:17 +00:00
Rui Paulo
ed72d9a70b Replace Id keyword with the FreeBSD keyword. 2010-01-29 10:02:50 +00:00
Gavin Atkinson
7964930201 Spell "Hz" correctly wherever it is user-visible.
PR:		bin/142566
Submitted by:	N.J. Mann   njm njm.me.uk
Approved by:	ed (mentor)
MFC after:	2 weeks
2010-01-12 17:59:58 +00:00
Martin Blapp
c2ede4b379 Remove extraneous semicolons, no functional changes.
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	1 week
2010-01-07 21:01:37 +00:00
Warner Losh
f29b8b7f41 cardbus -> CardBus 2010-01-03 23:31:58 +00:00
Rui Paulo
9c9dad53b0 Add WorldB SKU.
Reviewed by:	sam
MFC after:	1 week
2009-11-18 18:48:18 +00:00
John Baldwin
e1b17582f4 Take a step towards removing if_watchdog/if_timer. Don't explicitly set
if_watchdog/if_timer to NULL/0 when initializing an ifnet.  if_alloc()
sets those members to NULL/0 already.
2009-11-06 14:55:01 +00:00
Rui Paulo
4eaee90e39 Atheros EEPROM version 4K. This version is mostly based on version 1.4.
This is needed by the upcoming AR9285 support.
Information on the layout gathered from Linux ath9k.

Not yet connected to the build.

Tested by:	Eugeny Dzhurinsky
2009-10-10 22:29:34 +00:00
Poul-Henning Kamp
6778431478 Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.
2009-09-08 13:19:05 +00:00
Poul-Henning Kamp
b34421bf9c Add necessary include. 2009-09-08 13:16:55 +00:00
Sam Leffler
2ef29b4c33 remove extranous return
Submitted by:	phk
MFC after:	1 week
2009-09-07 16:18:16 +00:00
Sam Leffler
d5c613bdb2 fix extraneous return that can cause a memory leak
Submitted by:	phk
MFC after:	1 week
2009-09-07 16:12:07 +00:00
Sam Leffler
518de5f837 correct typo that was a noop on 32-bit machines but a bug on 64-bit machines
Submitted by:	phk
2009-09-07 16:08:21 +00:00
Sam Leffler
394f34a579 On resume in sta mode program the beacon timers so when roaming (and
the previous ap is no longer in range) the device will deliver bmiss
interrupts and trigger the state machine.  Also arrange to sync the
beacon timers on the next received beacon frame so that when we don't
roam we re-synchronize with the ap.

Tested by:	trasz
MFC after:	1 week
2009-08-31 21:25:49 +00:00
Sam Leffler
c1d8b5aadd change default regdomain for thailand
Obtained from:	linux-wireless@kernel.org
2009-08-27 17:42:37 +00:00
Sam Leffler
82cadd5aa0 Fix handling of AR_RX_FILTER_BSSID: write the shadow value for AR_MISC_MODE
so other register writes preserve the setting of AR_MISC_MODE_BSSID_MATCH_FORCE.

Reviewed by:	rpaulo
Approved by:	re (kib)
2009-07-21 19:23:34 +00:00
Sam Leffler
fe0dd78965 track whether any mesh vaps are present to correctly setup the rx filter
when, for example, an ap vap is created first

Reviewed by:	rpaulo
Approved by:	re (kib)
2009-07-21 19:01:04 +00:00
Rui Paulo
7d26189145 Fix something bogus deletion that got it during mesh commit.
Approved by:	re (implicit)
2009-07-11 16:02:06 +00:00
Rui Paulo
59aa14a91d Implementation of the upcoming Wireless Mesh standard, 802.11s, on the
net80211 wireless stack. This work is based on the March 2009 D3.0 draft
standard. This standard is expected to become final next year.
This includes two main net80211 modules, ieee80211_mesh.c
which deals with peer link management, link metric calculation,
routing table control and mesh configuration and ieee80211_hwmp.c
which deals with the actually routing process on the mesh network.
HWMP is the mandatory routing protocol on by the mesh standard, but
others, such as RA-OLSR, can be implemented.

Authentication and encryption are not implemented.

There are several scripts under tools/tools/net80211/scripts that can be
used to test different mesh network topologies and they also teach you
how to setup a mesh vap (for the impatient: ifconfig wlan0 create
wlandev ... wlanmode mesh).

A new build option is available: IEEE80211_SUPPORT_MESH and it's enabled
by default on GENERIC kernels for i386, amd64, sparc64 and pc98.

Drivers that support mesh networks right now are: ath, ral and mwl.

More information at: http://wiki.freebsd.org/WifiMesh

Please note that this work is experimental. Also, please note that
bridging a mesh vap with another network interface is not yet supported.

Many thanks to the FreeBSD Foundation for sponsoring this project and to
Sam Leffler for his support.
Also, I would like to thank Gateworks Corporation for sending me a
Cambria board which was used during the development of this project.

Reviewed by:	sam
Approved by:	re (kensmith)
Obtained from:	projects/mesh11s
2009-07-11 15:02:45 +00:00
Sam Leffler
6552698302 Fix ar5416 and later parts on big-endian platforms: setup the h/w byte
swizzler using the same technique used everywhere else.

Approved by:	re (kib)
2009-07-07 18:11:05 +00:00
Sam Leffler
69ad6b3450 Fix AR5416 and later parts when building with AH_DEBUG or similar defined:
always define OS_REG_UNSWAPPED and use it in ath_hal_reg_{read,write}.

Approved by:	re (kib)
2009-07-06 20:51:54 +00:00
Poul-Henning Kamp
f5d7126306 Revert a local change that should not have been in the last commit.
Approved by:	re (kib)
2009-06-28 11:32:52 +00:00
Poul-Henning Kamp
bb520069ca There are a number of ways an application can check if there are
inbound data waiting on a filedescriptor, such as a pipe or a socket,
for instance by using select(2), poll(2), kqueue(2), ioctl(FIONREAD)
etc.

But we have no way of finding out if written data have yet to be
disposed of, for instance, transmitted (and ack'ed!) to some remote
host, or read by the applicantion at the far end of the pipe.

The closest we get, is calling shutdown(2) on a TCP socket in
non-blocking mode, but this has the undesirable sideeffect of
preventing future communication.

Add a complement to FIONREAD, called FIONWRITE, which returns the
number of bytes not yet properly disposed of.  Implement it for
all sockets.

Background:

A HTTP server will want to time out connections, if no new request
arrives within a certain period after the last transmitted response
has actually been sent (and ack'ed).

For a busy HTTP server, this timeout can be subsecond duration.

In order to signal to a load-balancer that the connection is truly
dead, TCP_RST will be the preferred method, as this avoids the need
for a RTT delay for FIN handshaking, with a client which, surprisingly
often, no longer at the remote IP number.

If a slow, distant client is being served a response which is big
enough to fill the window, but small enough to fit in the socket
buffer, the write(2) call will return immediately.

If the session timeout is armed at that time, all bytes in the
response may not have been transmitted by the time it fires.

FIONWRITE allows the timeout to check that no data is outstanding
on the connection, before it TCP_RST's it.

Input & Idea from: rwatson
Approved by:	re (kib)
2009-06-28 11:28:14 +00:00
Sam Leffler
3c3e9d336d Add HAL_RX_FILTER_BSSID support (to disable bssid match):
o add HAL_CAP_BSSIDMATCH to identify parts that have the support for
  disabling bssid match
o honor capability for set/get rx filter
o use HAL_CAP_BSSIDMATCH in driver to decide whether to use the bssid
  match disable or fall back to promisc mode

Reviewed by:	rpaulo
Approved by:	re (rwatson)
2009-06-27 20:06:56 +00:00
Robert Watson
eb956cd041 Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs.  This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by:	re (kib)
MFC after:	6 weeks
2009-06-26 11:45:06 +00:00
Sam Leffler
f6cbf16a0f purge HAL_TXSTAT_ALTRATE; you can figure this out by checking ts_finaltsi
and it cannot be used with MCS rate codes
2009-06-13 23:36:54 +00:00
Sam Leffler
309a3e4521 treat IEEE80211_S_CSA as a "running state"; this fixes
ap mode 11h channel switch announcements
2009-06-03 17:25:19 +00:00
Sam Leffler
3050678410 improve raw xmit failure handling 2009-06-02 21:17:56 +00:00
Sam Leffler
9cb930760c count frag tx failures as an ifnet error 2009-06-02 21:13:57 +00:00
Sam Leffler
09be6601b5 fix comment 2009-06-02 21:12:07 +00:00
Sam Leffler
c89b957a1c restart tdma beacons after vap destroy 2009-06-02 21:11:26 +00:00
Sam Leffler
5463c4a485 Overhaul monitor mode handling:
o replace DLT_IEEE802_11 support in net80211 with DLT_IEEE802_11_RADIO
  and remove explicit bpf support from wireless drivers; drivers now
  use ieee80211_radiotap_attach to setup shared data structures that
  hold the radiotap header for each packet tx/rx
o remove rx timestamp from the rx path; it was used only by the tdma support
  for debugging and was mostly useless due to it being 32-bits and mostly
  unavailable
o track DLT_IEEE80211_RADIO bpf attachments and maintain per-vap and
  per-com state when there are active taps
o track the number of monitor mode vaps
o use bpf tap and monitor mode vap state to decide when to collect radiotap
  state and dispatch frames; drivers no longer explicitly directly check
  bpf state or use bpf calls to tap frames
o handle radiotap state updates on channel change in net80211; drivers
  should not do this (unless they bypass net80211 which is almost always
  a mistake)
o update various drivers to be more consistent/correct in handling radiotap
o update ral to include TSF in radiotap'd frames
o add promisc mode callback to wi

Reviewed by:	cbzimmer, rpaulo, thompsa
2009-05-20 20:00:40 +00:00
Sam Leffler
3f51a18229 correct HAL_INT_BNR comment, this bit is mapped directly the h/w now 2009-05-19 17:54:32 +00:00
Sam Leffler
210411e0f1 add TBTT interrupt support; this was added in Griffin so consumers should
check HAL_CAP_INTRMASK before using it

NB: didn't test 11n parts yet so supported only for 5212-class parts
2009-05-19 17:53:53 +00:00
Sam Leffler
00e602a997 minor cleanup 2009-05-19 17:43:31 +00:00
Sam Leffler
88608a2211 remove special handling for BNR; it is direct mapped to the harwdare so
can be added to HAL_INT_COMMON except on the 5210 where it doesn't exist
2009-05-19 17:35:15 +00:00
Sam Leffler
683f31342d add HAL_CAP_INTRMASK to return the set of interrupts supported by the device 2009-05-19 17:30:13 +00:00
Warner Losh
b8f5836a3c The module name convention is foo, not if_foo. 2009-05-15 17:02:11 +00:00
Sam Leffler
b4307a77d2 kill more portability functions that are no longer useful 2009-05-08 00:23:00 +00:00
Sam Leffler
8ab663f305 kill unused OS_GETUPTIME 2009-05-08 00:15:27 +00:00
Sam Leffler
ab06fdf2a5 optimize ath_tx_findrix: there's no need to walk the rates table as
sc_rixmap is an inverse map

NB: could eliminate the check for an invalid rate by filling in 0 for
    invalid entries but the rate control modules use it to identify
    bogus rates so leave it for now
2009-05-07 00:35:32 +00:00
Sam Leffler
a8962181ad o cleanup checks for which vap combinations are permitted and what to
use for ic_opmode
o fixes the case where creating ahdemo+wds vaps caused ic_opmode to be
  set to hostap
2009-05-06 23:49:55 +00:00
Sam Leffler
a00b852cab add support for the Beacon Not Ready (BNR) interrupt
(available on 5211 and later)
2009-05-06 23:09:26 +00:00
Sam Leffler
04f19fd699 make superg/fast-frames state dynamically-allocated (and indirect off
the com structure instead of embedded); this reduces the overhead when
not configured and reduces visibility of the contents
2009-05-02 20:16:55 +00:00
Sam Leffler
19ea87c42b o eliminate a << in calculating the tx time for turbo mode by pre-multiplying
data in the phy tables
o correct the ctrl rate indices in the 5212 turbog phy table
2009-04-13 21:01:08 +00:00
Sam Leffler
e40b6ab1cf don't use caddr_t to match ieee80211_dump_pkt type; supplying the correct
one costs nothing
2009-04-13 20:58:47 +00:00
Sam Leffler
040972a18b o fix dynamic slave-side tdma slot length updating: we need to re-setup the
burst length in the tx q's
o remove re-config of the beaconq on update; it's not needed
2009-04-13 20:57:34 +00:00
Sam Leffler
5e86169a67 add a debug msg for when a fixed transmit rate is not applied because
it's not found in the sta's negotiated rate set
2009-04-13 20:54:08 +00:00
Sam Leffler
89047529ac remove reference to sc_tdmabintcnt; it was removed in r190848 2009-04-13 03:20:21 +00:00
Sam Leffler
dd015656a7 check the method pointer before invoking ah_eepromDetach as it can
be null if attach work fails before hooking up the eeprom support

Obtained from:	madwifi
2009-04-09 16:53:59 +00:00
Sam Leffler
293d484820 remove unused struct member 2009-04-08 16:12:28 +00:00
Sam Leffler
339ccfb391 Hoist 802.11 encapsulation up into net80211:
o call ieee80211_encap in ieee80211_start so frames passed down to drivers
  are already encapsulated
o remove ieee80211_encap calls in drivers
o fixup wi so it recreates the 802.3 head it requires from the 802.11
  header contents
o move fast-frame aggregation from ath to net80211 (conditional on
  IEEE80211_SUPPORT_SUPERG):
  - aggregation is now done in ieee80211_start; it is enabled when the
    packets/sec exceeds ieee80211_ffppsmin (net.wlan.ffppsmin) and frames
    are held on a staging queue according to ieee80211_ffagemax
    (net.wlan.ffagemax) to wait for a frame to combine with
  - drivers must call back to age/flush the staging queue (ath does this
    on tx done, at swba, and on rx according to the state of the tx queues
    and/or the contents of the staging queue)
  - remove fast-frame-related data structures from ath
  - add ieee80211_ff_node_init and ieee80211_ff_node_cleanup to handle
    per-node fast-frames state (we reuse 11n tx ampdu state)
o change ieee80211_encap calling convention to include an explicit vap
  so frames coming through a WDS vap are recognized w/o setting M_WDS

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

Reviewed by:	thompsa, rpaulo, avatar, imp, sephe
2009-03-30 21:53:27 +00:00
Sam Leffler
584f7327f1 Remove ATH_SUPPORT_TDMA and use IEEE80211_SUPPORT_TDMA instead. It
doesn't make much sense to configure driver support w/o net80211.
Note this means ath now depends on opt_wlan.h.
2009-03-30 19:23:49 +00:00
Sam Leffler
29aca94080 Eliminate ic_myaddr so changing the mac address of a device works correctly:
o remove ic_myaddr from ieee80211com
o change ieee80211_ifattach to take the mac address of the physical device
  and use that to setup the lladdr.
o replace all references to ic_myaddr in drivers by IF_LLADDR
o related cleanups (e.g. kill dead code)

PR:		kern/133178
Reviewed by:	thompsa, rpaulo
2009-03-29 17:59:14 +00:00
Sam Leffler
aa28501a67 fix build w/ AH_DEBUG 2009-03-24 00:09:35 +00:00
Sam Leffler
c4d3fad2ec purge hal abi support; now that the hal is merged w/ the driver
we cannot be out of sync

MFC after:	1 week
2009-03-19 19:29:10 +00:00
Sam Leffler
2bc3ce7732 Minor cleanups of tdma protocol handling:
o break out version-related code to simplify rev'ing the protocol
o add parameter validation macros so checks that appear multiple places
  are consistent (and easy to change)
o add protocol version check when looking for a scan candidate
o improve scan debug output format
o rewrite beacon update handling to calculate a bitmask of changed values
  and pass that down through the driver callback so drivers can optimize work
o do slot bounds check before use when parsing received beacons
2009-03-18 19:28:17 +00:00
Sam Leffler
4a948799c2 preliminary ar9280 support:
o add 9280 attach that sets up ini, cal, etc.
o new rf backend for 9280 and later parts
o split ini setup and spur mitigation support out to methods
  and provide 9280-specific support
o minor fixups to shared code to handle 9280-specific work

Obtained from:	Atheros (ini values and some code)
2009-03-12 18:18:28 +00:00
Sam Leffler
d9bde68623 add asserts 2009-03-12 00:09:29 +00:00
Sam Leffler
2e986da5f1 replace if_watchdog w/ private callout; probably can merge this with the
calibration work sometime in the future
2009-03-09 23:10:19 +00:00
Sam Leffler
dfc86af7d7 remove ar9160Detach; it does nothing 2009-03-09 23:04:06 +00:00
Warner Losh
155a83e87a remove now-redunant cardbus attachment. 2009-03-09 13:23:54 +00:00
Sam Leffler
9c859a041a add a sysctl to ena/dis frobbing cca 2009-03-05 00:15:43 +00:00
Sam Leffler
92a0357875 fix typo's 2009-02-24 15:43:42 +00:00
Sam Leffler
811b1001aa move attach debug msg to the rf backend 2009-02-24 01:16:40 +00:00
Sam Leffler
44834ea4f7 Add PCIE power control api:
o add ah_configPCIE and ah_disablePCIE for drivers to configure PCIE
  power save operation (modeled after ath9k, may need changes)
o add private state flag to indicate if device is PCIE (replaces private
  hack in 5212 code)
o add serdes programming ini bits for 5416 and later parts and setup
  for each part (5416 and 9160 logic hand-crafted from existing routines);
  5212 remains open-coded but is now hooked in via ah_configPCIE
o add PCIE workaround gunk
o add ar5416AttachPCIE for iodomatic code used by 5416 and later parts
2009-02-24 01:07:06 +00:00
Sam Leffler
40ce424605 Fill in gpio support for 5416 and later parts:
o add output mux support
o gpio pin count is chip-dependent
o 9280 and 9285 do input handling different
o hookup gpio interrupts
o no need to save/restore soft led state around reset
2009-02-24 00:33:08 +00:00
Sam Leffler
a0a2aa7916 misc fixups, mostly for code not compiled yet 2009-02-24 00:29:32 +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
f396f37ed1 move eeprom attach above first reset as the reset code checks the
eeprom contents for 9280 and later parts
2009-02-24 00:03:14 +00:00
Sam Leffler
d61d829fd6 attach methods don't need to be public, make 'em static 2009-02-23 23:58:37 +00:00
Sam Leffler
3f1c613044 5416 and later parts get the radio rev differently; add ar5416GetRadioRev
to do it the right way
2009-02-23 23:54:08 +00:00
Sam Leffler
0f5578c15d remove private copies of gpio methods that were needed when the hal
was an independent entity
2009-02-23 23:48:17 +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
dc6592f82e correct SIFS setting; there is a 2usec adjustment between the calculated
value and what the hardware requires (based on inspection of INI values)

Submitted by:	Jiri Fojtasek <jiri.fojtasek@hlohovec.net>
2009-02-20 22:06:58 +00:00
Sam Leffler
9731c399d5 don't adjust core clk conversions for 1/2 and 1/4 rate channels; the
mac runs at full speed so doing this breaks conversion for ifs parameters

Submitted by:	Felix Fietkau <nbd@openwrt.org>
2009-02-20 22:05:08 +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
17e45e1934 Cleanup ath_hal_computetxtime's handling of 1/2 and 1/4-width channels:
o mark phy type to indicate 1/2 or 1/4-rate operation
o use phy type instead of channel attributes to identify 1/2 and 1/4-rate
  operation
o general cleanup of code including move phy constants to ah_internal.h

Eventually this code should go away and we should use the net0211 equivalents.
2009-02-19 04:24:22 +00:00
Sam Leffler
1a15e29ab4 add HAL_DIAG_SETREGS to write registers via the diag api 2009-02-19 04:15:14 +00:00
Sam Leffler
86b3d17f30 whitespace 2009-02-19 04:10:51 +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
a4f7ec0929 Recognize AR5212_AR2317_REV2 in ar5312Probe()
Submitted by:	Pavel Roskin <proski@gnu.org>
2009-02-13 01:50:04 +00:00
Sam Leffler
4a7019252b fix both instances of name
Pointy hat:	sam
2009-02-11 22:34:22 +00:00
Sam Leffler
d34b671cda fix typo in AH_CHIP definition
Submitted by:	Pavel Roskin <proski@gnu.org>
2009-02-11 22:18:03 +00:00
Sam Leffler
71a3564e5f gcc 4.3.2 examines getLowerUpperIndex() and concludes that it's not
guaranteed to initialize its two last arguments.  Therefore, there is a
warning in the subsequent caller ar5416FillVpdTable(), which doesn't
initialize those arguments.

Change getLowerUpperIndex() to assign values to indexL and indexR even
in the case of assertion failure.

Submitted by:	Pavel Roskin <proski@gnu.org>
2009-02-11 22:15:37 +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
41576ce6db consolidate conditional code 2009-02-10 19:23:25 +00:00
Sam Leffler
c2e344594e count stuck beacon events 2009-02-07 05:34:41 +00:00
Sam Leffler
b2e73ce955 fix 11n channel construction 2009-02-07 01:54:57 +00:00
Sam Leffler
58ae70168f add macro for future regulatory mods 2009-02-07 01:53:44 +00:00
Sam Leffler
506c6a3a3d add PSB channels to the calibration list 2009-02-06 00:48:56 +00:00
Sam Leffler
e25b0c1528 eliminate gainFCorrection; just have ar5212GetGainFCorrection return
the calculated value as it's only used in one place
2009-02-05 21:13:31 +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
5b1e30afaa improve IQ cal debug msgs; in particular don't scare people by screaming
"MISGATED IQ CAL!" when it's not
2009-02-05 20:56:33 +00:00
Sam Leffler
4d5c4f2a67 fill in ar5212ResetCalValid; reset the IQ valid flag on the channel
so IQ calibration will be started on the next periodic cal
2009-02-05 20:51:53 +00:00
Sam Leffler
3b00bfe121 style 2009-02-05 20:49:13 +00:00
Sam Leffler
5c5b75f94f replace r/w idiom with OS_REG_SET_BIT (to match other code) 2009-02-05 20:48:30 +00:00
Sam Leffler
50d5ad0e42 fix compilation w/ AH_DEBUG 2009-02-03 19:00:56 +00:00
Sam Leffler
8216b39e2b o make SAVE_CCK slightly less error prone by always writing the _flag
value used later by RESTORE_CCK
o swap arg order in RESTORE_CCK to slightly reduce cost
2009-02-02 16:56:58 +00:00
Sam Leffler
55a2313ad2 restore variable initialization removed in r187831; this broke
the horrible SAVE/RESTORE_CCK macros used by swan/nala cards to
implement 11b using 11g
2009-02-02 16:55:57 +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
8698ea65aa fix return status handling by ar5XXXReset; this is the reason the
driver sometimes reports reset failed w/ status 0
2009-01-23 05:33:48 +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
b2edeea7fb correct typo that left programmed sifs time in the slot time
(to be applied on subsequent resets)

Submitted by:	Jiri Fojtasek <jiri.fojtasek@hlohovec.net>
2009-01-21 02:53:00 +00:00
Sam Leffler
5e36f05822 export PSB frequencies 2009-01-16 20:44:45 +00:00
Sam Leffler
694be3e533 On some platforms touching the bb registers when the phy is powered
down will cause a fault.  Check the phy power state before possibly
reading from the bb, this can happen as ar5212Reset intentionally
calls ar5212GetRfgain before bringing the bb out of reset (but we
do it here and not in the caller to guard against other possible uses).
2009-01-13 05:50:22 +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
5f82a460f8 correct fixed rate handling; the rixmap was changed a while back
to be indexed by the ieee rate code
2009-01-07 23:30:26 +00:00
Sam Leffler
50666d87db remove the ath_rate module dependency; it's all bundled 2009-01-06 01:58:45 +00:00
Sam Leffler
34b8d7d479 remove module glue, it's not used any more 2009-01-06 01:36:36 +00:00
Sam Leffler
af945736cf Correct 5212 ani support so that max noise immunity, spur immunity, and
step levels are used.

Noticed by:	Jiri Fojtasek <jiri.fojtasek@hlohovec.net>
Reviewed by:	rpaulo
2008-12-19 18:33:53 +00:00
Sam Leffler
0f1a6e3482 fix ini setup
Submitted by:	Jiri Fojtasek <jiri.fojtasek@hlohovec.net>
2008-12-15 00:29:26 +00:00
Sam Leffler
7978748b83 o remove dead code
o fix AH_RF macro expansion to be as intended (worked before unintentionally)

Obtained from:	netbsd
2008-12-13 03:50:31 +00:00
Sam Leffler
dc798229e4 remove dead code
Obtained from:	netbsd
2008-12-13 03:49:01 +00:00
Sam Leffler
aed75e9d0a add const
Obtained from:	netbsd
2008-12-13 03:48:33 +00:00
Sam Leffler
128ae9780b fix static const order
Obtained from:	netbsd
2008-12-13 03:47:42 +00:00
Sam Leffler
009e2f111c fix static const order
Obtained from:	netbsd
2008-12-13 03:45:54 +00:00
Sam Leffler
0a39558b33 remove duplicate case
Obtained from:	netbsd
2008-12-13 03:45:00 +00:00
Sam Leffler
995172ec6c remove conflicting decl
Obtained from:	netbsd
2008-12-13 03:44:44 +00:00