Commit graph

173389 commits

Author SHA1 Message Date
Lennert Buytenhek
aa21d0f69a mwl8k: post per-vif firmware commands as per-vif commands
SET_BEACON, SET_MAC_ADDR, BSS_START and SET_NEW_STN are the currently
supported firmware commands that are actually per-vif commands.  Use
mwl8k_post_pervif_cmd() for these commands, so that the macid of the
vif they operate on gets passed down into the firmware.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:21 -05:00
Lennert Buytenhek
f57ca9c1af mwl8k: prepare for posting per-vif firmware commands
One of the bytes in the mwl8k firmware command header is the 'macid'
byte, which for per-vif commands indicates which of the BSSes this
command is intended for.  (For commands that are not per-vif commands,
this byte can just be 0.)

This patch adds mwl8k_post_pervif_cmd(), which will take the macid
assigned to this interface (to be done in ->add_interface()), copy it
into the command packet macid field, and post the command as usual.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:20 -05:00
Lennert Buytenhek
f5bb87cfba mwl8k: convert the priv->vif pointer to a list of vifs
To prepare for adding multi-BSS support.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:19 -05:00
Lennert Buytenhek
06953235f4 mwl8k: use firmware capability field to decide which bands to register
Make the decision about whether to register the 2.4 and 5 GHz bands
with mac80211 by looking at the capability field in GET_HW_SPEC (STA
firmware only for now).  This enables 5 GHz STA operation.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:18 -05:00
Lennert Buytenhek
42574ea227 mwl8k: allow selecting 5 GHz channels
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:17 -05:00
Lennert Buytenhek
8707d02625 mwl8k: handle 5 GHz legacy rate bitmaps in firmware commands
Whenever mac80211 gives us a legacy rate bitmap in the context of the
5 GHz band, we need to remember to shift the bitmap left by 5 positions
before giving it to the firmware, as the firmware follows the bitmap
bit assignment of the 2.4 GHz rate table even if we're on the 5 GHz
band, and the 2.4 GHz rate table includes five non-OFDM rates at the
start that are not valid in the 5 GHz band.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:16 -05:00
Lennert Buytenhek
854783444b mwl8k: properly set receive status rate index on 5 GHz receive
The mwl8k firmware uses indices into the 2.4 GHz band rate table for
the receive descriptor channel field even if the packet was received
on a 5 GHz channel, while mac80211 expects an index into the 5 GHz
band rate table when packets are received on the 5 GHz band, which
presents a mismatch as the 5 GHz band rate table lacks the five
non-OFDM rates that the 2.4 GHz rate table starts with.

To handle this properly, we need to substract 5 from the rate index
field if the packet was received on a 5 GHz channel (and was not
received at an MCS rate).

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:15 -05:00
Lennert Buytenhek
4eae9edd38 mwl8k: add 5 GHz band channels and rates
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:14 -05:00
Lennert Buytenhek
1349ad2f06 mwl8k: move responsibility for initialising wiphy bands to GET_HW_SPEC
So that we can make 2.4 GHz and 5 GHz band registration conditional
on the capability bitmask returned by the firmware.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:13 -05:00
Lennert Buytenhek
777ad375d5 mwl8k: rename 2.4 GHz band/channels/rates related variables from FOO to FOO_24
To prepare for adding 5 GHz band/channels/rates.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:12 -05:00
Lennert Buytenhek
ca66527c60 mwl8k: add another 88w8366 PCI ID
0x2a43 is a single-band (2.4GHz only) 88w8366 mini-PCIe card.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:11 -05:00
Lennert Buytenhek
657232b625 mwl8k: simplify sequence number assignment
By storing the sequence counter in << 4 format, like other drivers do.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:10 -05:00
Lennert Buytenhek
c97470dd25 mwl8k: don't call SET_AID if we're not associated
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:09 -05:00
Lennert Buytenhek
9189c10087 mwl8k: remove (mostly) write-only variable priv->current_channel
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:08 -05:00
Lennert Buytenhek
c92d4edecf mwl8k: update MODULE_FIRMWARE tags
Add MODULE_FIRMWARE tags for the mwl8k firmware images that don't
have them yet, and move them to where the firmware image names are
declared.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:07 -05:00
Kalle Valo
4ff6ffa107 wl1251: add U-APSD support
wl1251 firmware supports U-APSD just with a simple queue configuration
change so enable it.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:06 -05:00
Kalle Valo
8f8ff91652 wl1251: create qos null data template
The qos null data template is needed for U-APSD.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:04 -05:00
Kalle Valo
558a6669d7 ieee80211: add struct ieee80211_hdr_qos
The header can be used to create qos nullfunc frames, for example.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:03 -05:00
Kalle Valo
0c74211d19 mac80211: check uapsd state for dynamic power save
To make U-APSD client mode effective, we must not wake up from dynamic power
save when transmitting frames. So if dynamic power save is enabled, it needs
check the queue the transmitted packet is in and decide if we need to wake
up or not.

In a perfect world, where all packets would have correct QoS tags, U-APSD
enabled queues should not trigger wakeup from power save. But in the real
world, where very few packets have correct QoS tags, this won't work. For
example, if only voip class has U-APSD enabled and we send a packet in voip
class, but the packets we receive are in best effort class, we would receive
the packets with the legacy power save method. And that would increase
latencies too much from a voip application point of view.

The workaround is to enable U-APSD for all qeueus and still use dynamic ps
wakeup for all other queues except voip. That way we can still save power
with a voip application and not sacrifice latency. Normal traffic (in
background, best effort or video class) would still trigger wakeup from
dynamic power save.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:02 -05:00
Kalle Valo
5c1b98a52c mac80211: create tx handler for dynamic ps
Currently dynamic ps check is in ieee80211_xmit(), but it's cleaner
to have a separate tx handler for this. Also this is a prerequisite for
U-APSD client mode which needs to know the queue frame is in.

Also need_dynamic_ps() function is embedded to the tx handler.

No functional changes expect that the code is run in a later phase than
originally.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:01 -05:00
Kalle Valo
50ae0cf15c mac80211: add debugfs interface for U-APSD queue configuration
Because it's not yet decided how to configure which queues are U-APSD
enabled, add a debugfs interface for testing purposes.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:21:00 -05:00
Kalle Valo
ab13315af9 mac80211: add U-APSD client support
Add Unscheduled Automatic Power-Save Delivery (U-APSD) client support. The
idea is that the data frames from the client trigger AP to send the buffered
frames with ACs which have U-APSD enabled. This decreases latency and makes it
possible to save even more power.

Driver needs to use IEEE80211_HW_UAPSD to enable the feature. The current
implementation assumes that firmware takes care of the wakeup and
hardware needing IEEE80211_HW_PS_NULLFUNC_STACK is not yet supported.

Tested with wl1251 on a Nokia N900 and Cisco Aironet 1231G AP and running
various test traffic with ping.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:20:58 -05:00
Johannes Berg
2d46d7c121 mac80211: remove unused type argument
The type argument to DEBUGFS_ADD() isn't used
and can be removed, it's around from before
the conversion to debugfs_remove_recursive().

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:20:57 -05:00
Lennert Buytenhek
678f415fdc mac80211: flush workqueue before calling driver ->stop() method
Since commit "mwl8k: handle station database update for AP's sta entry
via ->sta_notify()", mwl8k every now and then gets a command timeout
when ifconfig'ing a STA interface down.  This turns out to be due to
mwl8k_stop() being called while the work queue item that was scheduled
by mwl8k_sta_notify() to remove the STA entry for the associated AP is
still queued, and the former disables interrupts so that when the
latter eventually runs, a command completion interrupt is never seen.

Fix this by changing ieee80211_stop_device() so that the workqueue is
flushed before drv_stop() is called, instead of doing it the other way
around as is done now.  (As ->stop() is allowed to sleep, there isn't
any reason for drivers to queue work from within it.)

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:20:56 -05:00
Joe Perches
5e124bd5e0 net/mac80211/mlme.c: Remove unnecessary semicolons
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:20:55 -05:00
H Hartley Sweeten
28f63a4bb7 iwl-debugfs.c: remove unnecessary casts of void *
void pointers do not need to be cast to other pointer types.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Zhu Yi <yi.zhu@intel.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:20:45 -05:00
Wey-Yi Guy
8ce1ef4a91 iwlwifi: fix bug in tx byte count table
When setting invalid byte count in txq byte count table, read pointer
should be used instead of write pointer.

Reported-by: Guo, Chaohong <chaohong.guo@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:12 -05:00
Wey-Yi Guy
c15867f15f iwlwifi: remove obsoleted host command
"RADAR_NOTIFICATION" host command is not used and not supported by uCode,
remove it from driver code.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:11 -05:00
Wey-Yi Guy
f0118a4575 iwlwifi: ucode statistics data structure update
Update data structure to match latest statistics report from uCode.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:11 -05:00
Wey-Yi Guy
f05279711b iwlwifi: add IEEE80211_AMPDU_TX_OPERATIONAL
mac80211 do not check the return code now, what if mac80211 does start
using the return code? IEEE80211_AMPDU_TX_OPERATIONAL is a valid action,
just iwlwifi driver do not need to take any action for it; so instead of
return "-EINVAL", it is a good program practice to return "-EOPNOTSUPP"
to make sure mac80211 will not get wrong impression.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:11 -05:00
Johannes Berg
90be561b11 mac80211: fix return from ieee80211_assoc_success
sparse pointed out that I made a mistake converting
the return value of ieee80211_assoc_success to bool,
this place should return false instead of one of the
enum values (which would be true).

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:11 -05:00
Lennert Buytenhek
67e2eb2795 mwl8k: move receive processing to tasklet
Like how TX reclaim is done in a tasklet, move receive processing
to tasklet context as well.  This can have nice benefits for CPU
utilisation and throughput, especially at 3-stream rates.

(Use the same CLEAR_SEL trick as the TX reclaim tasklet does, to
avoid having to touch the interrupt mask registers.)

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:10 -05:00
Lennert Buytenhek
1e9f9de3b1 mwl8k: keep TX_DONE interrupt masked while transmit reclaim is running
By making use of the CLEAR_SEL feature of the mwl8k host interface
interrupt controller, we can keep the TX_DONE interrupt source masked
while the transmit reclaim tasklet is running (NAPI style) without
having to touch the interrupt controller's interrupt mask register
when entering or exiting polling mode, and without having to do any
more register reads/writes than we do now.

When CLEAR_SEL is enabled on the TX_DONE interrupt source, reading
the interrupt status register will clear the TX_DONE status bit if
it was set, allowing it to be set again if a new TX_DONE event arrives
while we are running the TX reclaim tasklet, but such a new event will
then not trigger another PCI interrupt until a zero is written to the
TX_DONE interrupt status register bit.

I.e., if we write a zero to the TX_DONE interrupt source bit in the
interrupt status register when the TX reclaim tasklet thinks it's
done, a PCI interrupt will be triggered if a new TX_DONE event arrived
from the hardware between us deciding that there is no more work to do
and re-enabling the TX_DONE interrupt source, thereby avoiding the
classic NAPI poll mode exit race that would otherwise occur.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:10 -05:00
Lennert Buytenhek
efb7c49a68 mwl8k: allow limiting the amount of transmit reclaim done
Add a limit argument to mwl8k_txq_reclaim(), to allow limiting the
number of packets that it will reclaim, and make it return the number
of packets that it reclaimed.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:10 -05:00
Lennert Buytenhek
b64fe619e3 mwl8k: basic AP interface support
Add support for creating AP interfaces, and enabling beaconing.
This allows running a basic AP (11b/g mode only for now).

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:10 -05:00
Lennert Buytenhek
a9e00b151e mwl8k: correctly set the mac_type field for AP SET_MAC_ADDR
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:09 -05:00
Lennert Buytenhek
3f5610ff56 mwl8k: implement AP firmware station database maintenance
STA firmware uses UPDATE_STADB to manipulate the hardware station
database, whereas AP firmware uses SET_NEW_STN -- this implements the
latter, and hooks it into mwl8k_sta_notify(), to be used if we're
running on AP firmware.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:09 -05:00
Lennert Buytenhek
088aab8b62 mwl8k: add the AP version of USE_FIXED_RATE
As with the STA version, unicast will use auto rate adaptation, but
the AP version allows setting the rates to be used for management and
multicast transmissions, which can be set based on the BSS basic rate
set.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:09 -05:00
Lennert Buytenhek
b71ed2c6ce mwl8k: simplify mwl8k_cmd_use_fixed_rate()
As we always use the auto rate adaptation feature and never pass in
a rate table, USE_FIXED_RATE can be simplified somewhat.  While we're
at it, rename it to *_sta, as this is the STA version of the command.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:09 -05:00
Lennert Buytenhek
62abd3cfb2 mwl8k: bump the transmit wait timeout to 5 seconds
While it is reasonable to expect that at least one transmit ring entry
will be processed per second while we are waiting for the transmit
rings to drain, the firmware can end up doing batching of transmit ring
status writeback, which means that the transmit rings can appear stuck
for more than a second at a time.

Bump the TX drain wait timeout up from 1 to 5 seconds to account for
this.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:08 -05:00
Lennert Buytenhek
b569e924a9 mwl8k: undo transmit queue 0/1 swapping in mwl8k_cmd_set_edca_params()
The comment and code in mwl8k_cmd_set_edca_params() suggest that the
mapping between SET_EDCA_PARAMS queue numbers and transmit rings isn't
actually 1:1, while tests show that the mapping is in fact 1:1.  So,
get rid of the transmit queue 0/1 swapping.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:08 -05:00
Lennert Buytenhek
c2c2b12a8b mwl8k: minor cleanups
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:08 -05:00
Felix Fietkau
3f0e0b220f mac80211: do not transmit frames on unconfigured 4-addr vlan interfaces
If frames are transmitted on 4-addr ap vlan interfaces with no station,
they end up being transmitted unencrypted, even if the ap interface
uses WPA. This patch add some sanity checking to make sure that this
does not happen.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:08 -05:00
Felix Fietkau
0e5ded5a87 mac80211: allow station updates on ap interfaces for vlan stations
Since the per-vif station changes, sta_info_get on the ap sdata no
longer returns entries for stations on ap vlans. This causes issues
with hostapd, which currently always passes the ap interface name to
nl80211 calls. This patch provides bug compatibility with the earlier
versions until hostapd is fixed.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:07 -05:00
Felix Fietkau
d524215f6c mac80211: use nullfunc frames for 4-addr sta detection
To detect incoming 4-addr stations, hostapd needs to receive a 4-addr
data frame from the remote station, so that it can create the AP VLAN
for it. With this patch, the mlme code emits a 4-addr nullfunc frame
immediately after assoc. On the AP side it also drops 4-addr nullfunc
frames to the cooked monitor mode interface, if the interface hasn't
been fully set up to receive 4-addr data frames yet.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:06 -05:00
Sujith
199afd9d89 ath9k: Fix monitor mode handling
mac80211 passes appropriate flags indicating whether
monitor mode is being used. Use this to set the HW opmode.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:06 -05:00
Sujith
1395d3f00a ath9k: Add debugfs file for RX errors
This file can be used to track frame reception errors.
PHY error counts are also added.

Location: ath9k/phy#/recv

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:06 -05:00
Sujith
cc9c378aa5 ath9k: Fix queue handling
The TX queues have to be stopped during an
internal reset. Not handling this would result
in packet loss - fix this.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:06 -05:00
Sujith
285f2ddae0 ath9k: Cleanup init/deinit routines
The device initialization and termination functions
were messy and convoluted. Introduce helper functions
to clarify init_softc() and simplify things in general.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:05 -05:00
Sujith
1b04b9308e ath9k: Cleanup Powersave flags
sc_flags has slowly become a kitchen sink over time.
Move powersave related flags to a separate variable.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-01-12 14:02:05 -05:00