Commit Graph

853 Commits

Author SHA1 Message Date
Johannes Berg 3b40c04071 wl12xx: remove wext dependencies
This driver uses IW_ESSID_MAX_SIZE when it should
be using IEEE80211_MAX_SSID_LEN instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-08 14:26:19 -04:00
John W. Linville 95a943c162 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
	net/bluetooth/l2cap_core.c
2011-07-15 10:05:24 -04:00
John W. Linville e441a5eab9 Merge branch 'for-linville' of git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx 2011-07-08 11:05:20 -04:00
John W. Linville 204d1641d2 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2011-07-08 11:03:36 -04:00
Arik Nemtsov f1a46384ad wl12xx: start/stop queues according to global per-AC counters
Split tx_queue_count to count per-AC skb's queued, instead of relying on
the skb-queue len. The skb queues used were only valid in STA-mode, as
AP-mode uses per-link queues.

This fixes a major regression in AP-mode, caused by the patch
"wl12xx: implement Tx watermarks per AC". With that patch applied, we
effectively had no regulation of Tx queues in AP-mode. Therefore a
sustained high rate of Tx could cause exhaustion of the skb memory pool.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-08 09:39:47 +03:00
John W. Linville 333c0dbfcd Merge branch 'for-linville' of git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx 2011-07-06 15:03:16 -04:00
Arik Nemtsov 097f882153 wl12xx: always initialize AP-mode max power level
Sometimes we only get the Tx power level via op->config when the FW is
off. Record the received power level when this happens and use it to
initialize the firmware during boot.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:51:05 +03:00
Arik Nemtsov 6cfa5cffde wl12xx: initialize max_power levels for 11a channels
Set the maximum FW supported power levels for 11a channels.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:51:05 +03:00
Eliad Peller 73ecce31fe wl12xx: implement cancel_hw_scan() callback
After implementing cancel_hw_scan(), there is no more need to
flush scan_complete_work on suspend.

scan_complete_work enqueues a new scan_work, that might lead
to the following warning (if the device was already suspended):

WARNING: at drivers/mmc/core/core.c:169 mmc_wait_for_req+0x1ac/0x2c8()
Backtrace:
[<c004b50c>] (dump_backtrace+0x0/0x110)
[<c04fda50>] (dump_stack+0x0/0x1c)
[<c008f700>] (warn_slowpath_common+0x0/0x6c)
[<c008f76c>] (warn_slowpath_null+0x0/0x2c)
[<c034b058>] (mmc_wait_for_req+0x0/0x2c8)
[<c034f804>] (mmc_io_rw_extended+0x0/0x1e4)
[<c0350b5c>] (sdio_io_rw_ext_helper+0x0/0x1ac)
[<c0350e00>] (sdio_memcpy_fromio+0x0/0x2c)
[<bf194464>] (wl1271_sdio_raw_read+0x0/0x1bc [wl12xx_sdio])
[<bf15ac14>] (wl1271_cmd_wait_for_event_or_timeout+0x0/0x19c [wl12xx])
[<bf15adb0>] (wl1271_cmd_wait_for_event+0x0/0x30 [wl12xx])
[<bf15b7dc>] (wl1271_cmd_disconnect+0x0/0x14c [wl12xx])
[<bf158fd0>] (wl1271_unjoin+0x0/0x48 [wl12xx])
[<bf159070>] (wl1271_op_config+0x0/0x490 [wl12xx])
[<bf105084>] (ieee80211_hw_config+0x0/0x14c [mac80211])
[<bf113120>] (ieee80211_recalc_idle+0x0/0x4c [mac80211])
[<bf109a70>] (__ieee80211_scan_completed+0x0/0x1ac [mac80211])
[<bf109fd4>] (ieee80211_scan_work+0x0/0x484 [mac80211])
[<c00a197c>] (worker_thread+0x0/0x1e8)
[<c00a5874>] (kthread+0x0/0x90)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:50:39 +03:00
Eliad Peller 2aa01597eb wl12xx: add stop_scan command
define wl1271_scan_stop() to cancel an ongoing hw scan.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:50:39 +03:00
Eliad Peller e85d1629c6 wl12xx: configure suspend/resume only if associated/started
Configure the device (to wowlan) only if the sta/ap
is associated/started.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:50:39 +03:00
Ohad Ben-Cohen b5d6e5f663 wl12xx: one SDIO initialization is enough
Skip manual device power on in case runtime PM is enabled for
our device.

This eliminates a secondary & redundant SDIO init sequence.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:48:12 +03:00
Arik Nemtsov 708bb3cf58 wl12xx: implement Tx watermarks per AC
Each AC is stopped when its queue is filled up to the high watermark,
and restarted when its queue it lower than the low watermark. This
ensures congested ACs are not able to starve other ACs.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:33:44 +03:00
Ido Yariv 787b2dc44a wl12xx: Increase low & high TX watermarks
The current TX watermark settings cause the driver to stop queues too
frequently. Among other things, this can have a negative impact on WMM
prioritization, since mac80211 sorts pending packets by their ACs.

Fix this by increasing the high watermark to 256 packets. Increase the
low watermark to 32 to minimize periods with queues being stopped.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:33:44 +03:00
Arik Nemtsov 9e374a37b6 wl12xx: schedule TX packets according to FW occupancy
When selecting packets for transmission, prefer the ACs that are least
occupied in the FW. When packets for multiple ACs are present in the FW,
it decides which to transmit according to WMM QoS parameters.

With these changes, lower priority ACs should not be starved when higher
priority traffic is present.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:33:44 +03:00
Arik Nemtsov fae2fd767e wl12xx: use 802.11 header location after relocation to frame start
When operating with TKIP encryption, the function wl1271_tx_fill_hdr()
relocates the 802.11 header to the start of the frame, and leaves room
for the security header.

Some functions in the Tx path rely on the location of the header,
namely, for purposes of roaming in STA mode and connecting new stations
in AP mode. Call these functions only after the header is relocated.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:33:20 +03:00
Arik Nemtsov 3618f30f30 wl12xx: AP mode - support FW TX inactivity triggers
In AP mode we register for the MAX_TX_RETRY and INACTIVE_STA events.
Both are reported to the upper layers as a TX failure in the offending
stations.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:33:20 +03:00
Oz Krakowski b992c68228 wl12xx: fix Tx security sequence number handling
Do not reset the security sequence number when issuing a join command or
interface is removed. Instead, reset the counter only during the unjoin
command.

Added the notion of counter wrap-around to the LSB number in
wl1271_tx_complete_packet.

Added post recovery padding to adjust for potential security number
progress during the recovery process by the firmware and avoid
potential interop issues in encrypted networks.

Signed-off-by: Oz Krakowski <ozk@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-07-05 21:33:19 +03:00
John W. Linville df2cbe4075 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2011-06-30 13:34:06 -04:00
Arik Nemtsov b4d38db121 wl12xx: AP-mode - use mac80211 indication about STA WME support
When adding a station, use the information given in the mac80211
populated ieee80211_sta structure to determine if it supports WME.
Provide this information to the FW.

This patch depends on "mac80211: propagate information about
STA WME support down".

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-29 15:11:01 -04:00
Ido Yariv 95dac04f88 wl12xx: Support routing FW logs to the host
A recently added feature to the firmware enables the driver to retrieve
firmware logs via the host bus (SDIO or SPI).

There are two modes of operation:
1. On-demand: The FW collects its log in an internal ring buffer. This
   buffer can later be read, for example, upon recovery.
2. Continuous: The FW pushes the FW logs as special packets in the RX
   path.

Reading the internal ring buffer does not involve the FW. Thus, as long
as the HW is not in ELP, it should be possible to read the logs, even if
the FW crashes.

A sysfs binary file named "fwlog" was added to support this feature,
letting a monitor process read the FW messages. The log is transferred
from the FW only when available, so the reading process might block.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 15:10:56 +03:00
Ido Yariv baacb9aed0 wl12xx: Avoid recovery while one is already in progress
During recovery work commands sent to the FW could fail and schedule
additional recovery work. Since the chip is going to be powered off,
avoid recursive recoveries.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 15:05:15 +03:00
Ido Yariv 842f1a6c71 wl12xx: Check for FW quirks as soon as the FW boots
The FW initialization might depend on the FW revision, so check for any
FW quirks right after booting it.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 15:05:14 +03:00
Eliad Peller 92ef8960ae wl12xx: use freezable workqueue for netstack_work
When resuming (after wowlan), we want the rx packets (which is
usually the wake-up packet itself) to be passed to mac80211 only
after the resume notifier was completed, and mac80211 is up and
running (otherwise, the packets will be dropped).

By enqueueing the netstack_work to a freezable workqueue, we can
guarantee the rx processing to occur only after mac80211 was resumed.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 13:56:14 +03:00
Eliad Peller c27d3accb6 wl12xx: use _ni version of ieee80211_tx_status
wl1271_flush_deferred_work(), which calls ieee80211_rx() and
ieee80211_tx_status(), is called from a process context.
hence, use ieee80211_tx_status_ni() instead of ieee80211_tx_status().

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 13:56:14 +03:00
Eliad Peller ef4b29e976 wl12xx: check the vif's operstate after join
When resuming while connected (without wowlan), the interface
is already IF_OPER_UP, so we won't get the notifier callback,
and hence never complete the association (from wl12xx perspective)

This situation, among other potential problems, prevents the
station from entering psm.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 13:56:14 +03:00
Eliad Peller 6bb0433215 wl12xx_sdio: enable wowlan only if enable_irq_wake() succeeded
Some platforms don't support the wake_irq, so disable wowlan
in this case, and avoid the "Unbalanced IRQ wake disable"
warning on disable_irq_wake().

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 13:35:53 +03:00
Eliad Peller 8a7cf3febb wl12xx: enable/disable beacon filtering on ap suspend/resume
Beacon filtering needs to be enabled so AP won't wake up by
by every received beacon.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 13:35:40 +03:00
Eliad Peller ff91afc90a wl12xx: clear wl->wow_enabled on resume
We set wl->wow_enabled on every suspend(), so we need to clear it
on every resume().
(we can't rely on setting wl->wow_enabled=false in suspend(),
as it being called only when wowlan triggers are configured)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 13:29:21 +03:00
Eliad Peller 4a859df85a wl12xx: don't check wow param on suspend/resume
Since mac80211 calls suspend/resume only when wowlan triggers
exist, there is no need to check for triggers existance in the
callbacks as well.
Add a WARN_ON() to verify it.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 13:29:21 +03:00
Shahar Levi 0c005048aa wl12xx: Add Support for Low Power DRPw (LPD) Mode
The Low Power DRPw (LPD) mode contains several optimizations
that designed to reduce power consumption. The purpose
is to save current consumption in RX and Listen mode.

LPD setting apply only for wl127x AP mode (not wl128x)

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 12:50:33 +03:00
Ohad Ben-Cohen 86046da4af wl12xx: don't bail if mmc isn't MMC_CAP_POWER_OFF_CARD
If our SDIO function has its runtime PM disabled, don't try to
manipulate its runtime PM status at all. This way we can still
power on cards plugged to mmc hosts that are not MMC_CAP_POWER_OFF_CARD.

Reported-and-tested-by: Tim Yamin <tim@kangatronix.co.uk>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 12:01:31 +03:00
Luciano Coelho d2c2bb9fcc wl12xx: split channel array per band in sched_scan
The firmware, in practice, treats the channels in three separate
blocks, one for each band (bg, a and j).  Instead of using a single
array and doing some magic with indices, split the array in 3 to make
it more readable.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 12:01:20 +03:00
Eliad Peller d192d268a1 wl12xx: fix erroneous commit (cb5ae0)
Due to rebase error, the patch for commit cb5ae0 ("wl12xx: configure
rates when working in ibss mode") was wrong - a blob was added
into the wrong function. fix it.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 12:01:14 +03:00
Eliad Peller a011130265 wl12xx: remove unused crc7 references
crc7 is used only in wl12xx_spi.

Remove redundant crc7.h includes, and update Kconfig to select CRC7
only if WL12XX_SPI is being selected.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:52 +03:00
Shahar Levi 0e44eb2093 wl12xx: Enable beacon early termination in 2.4GHz band only
Beacon early termination doesn't help much in the 5GHz band and masks
channel switch IE Beacons.  Thus, change the code to use BET only in
2.4GHz.

[Reworded the commit log slightly -- Luca.]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:51 +03:00
Eliad Peller c84368e01a wl12xx: add rx_streaming debugfs entry
Allow control over rx_streaming interval and operation mode
(always/only on coex) via debugfs.

e.g.
echo 100 > /debug/ieee80211/phy0/wl12xx/rx_streaming/interval
echo 1 > /debug/ieee80211/phy0/wl12xx/rx_streaming/always

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:50 +03:00
Eliad Peller 77ddaa108f wl12xx: add automatic rx streaming triggers
When rx_streaming.interval is non-zero, use automatic rx streaming.
Enable rx streaming on the each rx/tx packet, and disable it
rx_streaming.duration msecs later.

When rx_streaming.always=0 (default), rx streaming is enabled only
when there is a coex operation.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:49 +03:00
Eliad Peller f84673d597 wl12xx: add support for rx streaming
wl12xx supports the "rx streaming" feature:

When in ps mode, and @timeout msecs have been passed since
the last rx/tx, it issues trigger packets (QoS-null/PS-Poll packets,
according to the ac type) in const intervals (in order to reduce
the rx time).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:48 +03:00
Felipe Balbi ba2274c68e net: wl12xx: remove unnecessary prints
Those have little value. Remove those to
make the driver less noisy.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:47 +03:00
Felipe Balbi 4c4cdfa12f net: wl12xx: remove the nops
Nops aren't needed. When we actually need
those calls, then we add them with meat
and barbecue sauce.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:47 +03:00
Felipe Balbi 77d7d7a36d net: wl12xx: care for optional operations
->init and ->reset are optional - at least
sdio.c doesn't implement them - so allow those
pointers to be NULL.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:46 +03:00
Felipe Balbi 6bdaf79623 net: wl12xx: remove some unnecessary prints
Those have little value. Remove those to make
the driver less noisy.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:45 +03:00
Felipe Balbi 33dd74c784 net: wl12xx: sdio: id_tables should be __devinitconst
That's only needed during init anyway, let's free
some space after we're done probing.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:44 +03:00
John W. Linville c0c33addcb Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2011-06-08 13:44:21 -04:00
Shahar Levi 70559a0665 wl12xx: Stop BA session event from device
Adding new event that close RX BA session in case of periodic BT activity
limiting WLAN activity.

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-07 14:44:02 -04:00
Alexey Dobriyan a6b7a40786 net: remove interrupt.h inclusion from netdevice.h
* remove interrupt.g inclusion from netdevice.h -- not needed
* fixup fallout, add interrupt.h and hardirq.h back where needed.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-06 22:55:11 -07:00
Luciano Coelho 66870b1ccd wl12xx: fix oops in sched_scan when forcing a passive scan
Fix kernel oops when trying to use passive scheduled scans.  The
reason was that in passive scans there are no SSIDs, so there was a
NULL pointer dereference.

To solve the problem, we now check the number of SSIDs provided in the
sched_scan request and only access the list if there's one or more
(ie. passive scan is not forced).  We also force all the channels to
be passive by adding the IEEE80211_CHAN_PASSIVE_SCAN flag locally
before the checks in the wl1271_scan_get_sched_scan_channels()
function.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-05-31 14:47:26 -04:00
Luciano Coelho 50a66d7f04 wl12xx: add separate config value for DFS dwell time on sched scan
Use a different value for DFS dwell time when performing a scheduled
scan.  Previously we were using the same value as for normal passive
scans.  This adds some flexibility between these two different types
of passive scan.

For now we use 150 TUs for DFS channel dwell time.  This may need to
be fine-tuned in the future.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-05-31 14:47:25 -04:00
Luciano Coelho 2497a246e8 wl12xx: fix DFS channels handling in scheduled scan
DFS channels were never getting included in the scheduled scans,
because they always contain the passive flag as well and the call was
asking for DFS and active channels.

Fix this by ignoring the passive flag when collecting DFS channels.
Also, move the DFS channels in the channel list before the 5GHz active
channels (this was implemented in the FW differently than specified).

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-05-31 14:47:25 -04:00
Luciano Coelho dd08682150 wl12xx: fix passive and radar channel generation for scheduled scan
We were comparing bitwise AND results with a boolean, so when the
boolean was set to true, it was not matching as it should.

Fix this by booleanizing the bitwise AND results with !!.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-05-31 14:47:24 -04:00
Luciano Coelho f634a4e707 wl12xx: fix compilation error when CONFIG_PM is not set
There was a compilation error when PM is not enabled:

  CC [M]  drivers/net/wireless/wl12xx/main.o
drivers/net/wireless/wl12xx/main.c:3653: error: unknown field 'suspend' specified in initializer
drivers/net/wireless/wl12xx/main.c:3653: warning: initialization from incompatible pointer type
drivers/net/wireless/wl12xx/main.c:3654: error: unknown field 'resume' specified in initializer
drivers/net/wireless/wl12xx/main.c:3654: warning: initialization from incompatible pointer type

Fix this by adding #ifdef's in the appropriate places.

Cc: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-18 16:51:26 -04:00
John W. Linville e00cf3b9eb Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
	drivers/net/wireless/iwlwifi/iwl-agn-tx.c
	net/mac80211/sta_info.h
2011-05-16 19:32:19 -04:00
Eliad Peller 9439064cd9 wl12xx: enter/exit psm on wowlan suspend/resume
When operating as station, enter psm before suspending
the device into wowlan state.

Add a new completion event to signal when psm was entered
successfully.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 14:55:49 +03:00
Eliad Peller f795ea8b2f wl12xx_sdio: declare support for NL80211_WOW_TRIGGER_ANYTHING trigger
Since wowlan requires the ability to stay awake while the host
is suspended, declare support for NL80211_WOW_TRIGGER_ANYTHING
if the MMC_PM_KEEP_POWER capability is being supported.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 14:55:49 +03:00
Eliad Peller f44e58681a wl12xx: prevent scheduling while suspending (WoW enabled)
When WoW is enabled, the interface will stay up and the chip will
be powered on, so we have to flush/cancel any remaining work, and
prevent the irq handler from scheduling a new work until the system
is resumed.

Add 2 new flags:
* WL1271_FLAG_SUSPENDED - the system is (about to be) suspended.
* WL1271_FLAG_PENDING_WORK - there is a pending irq work which
   should be scheduled when the system is being resumed.

In order to wake-up the system while getting an irq, we initialize
the device as wakeup device, and calling pm_wakeup_event() upon
getting the interrupt (while the system is about to be suspended)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 14:55:49 +03:00
Eliad Peller 039bdb1494 wl12xx_sdio: set MMC_PM_KEEP_POWER flag on suspend
if a wow trigger was configured, set the MMC_PM_KEEP_POWER flag
on suspend, so our power will be kept while the system is suspended.

We needed to set this flag on each suspend attempt (when we want
to keep power)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 14:55:48 +03:00
Eliad Peller 402e486160 wl12xx: declare suspend/resume callbacks (for wowlan)
Additionally, add wow_enabled field to wl, to indicate
whether wowlan was configured.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 14:55:48 +03:00
Eliad Peller 2c0f24636c wl12xx_sdio: set interrupt as wake_up interrupt
set the sdio interrupt as wake_up interrupt, so we will be able
to wake up the suspended system (Wake-On-Wireless)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 14:55:48 +03:00
Luciano Coelho fe44870bcd wl12xx: remove unused flag WL1271_FLAG_IDLE_REQUESTED
This flag is not used anymore, remove it from the list.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:33 +03:00
Luciano Coelho 683c002447 wl12xx: prevent sched_scan when not idle or not in station mode
The current firmware only supports scheduled scan in station mode and
when idle.  To prevent the firmware from crashing, return -EOPNOTSUPP
when sched_scan start is called in an invalid state.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:33 +03:00
Luciano Coelho d3eff81de6 wl12xx: export scheduled scan state in debugfs
Add the sched_scanning value to the driver_status debugfs entry.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:33 +03:00
Luciano Coelho 33c2c06cd2 wl12xx: implement scheduled scan driver operations and reporting
This patch adds the mac80211 operations for scheduled scan and the
scheduled scan results reporting.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:33 +03:00
Luciano Coelho 95feadca6d wl12xx: add scheduled scan structures and commands
Add firmware command structures, definitions and code to to configure,
start and stop scheduled scans.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:33 +03:00
Luciano Coelho 6394c01b61 wl12xx: listen to scheduled scan events
Subscribe and listen to PERIODIC_SCAN_REPORT_EVENT_ID and
PERIODIC_SCAN_COMPLETE_EVENT_ID in preparation for the scheduled scan
implementation.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:32 +03:00
Luciano Coelho 3a9d60e5bd wl12xx: add configuration values for scheduled scan
Add the structures and values for driver-configured scheduled scan
parameters.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:32 +03:00
Shahar Levi fcd23b6305 wl12xx: add IEEE80211_HW_SPECTRUM_MGMT bit to the hw flags
Set the spectrum management bit in the hw flags so that mac80211 will
set the WLAN_CAPABILITY_SPECTRUM_MGMT bit in association requests
(which in practice means that we support 802.11h spectrum management).

[Reworded the commit log -- Luca.]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:32 +03:00
Shahar Levi bc76b94051 wl12xx: Don't filter beacons that include changed HT IEs
This patch adds a beacon filter rule to pass up the beacons that
contain changed HT information elements.  These beacons need to be
passed to mac80211 so that it can act on such changes.

[Reworded commit log -- Luca.]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:32 +03:00
Eliad Peller 889cb360b4 wl12xx: simplify wl1271_ssid_set()
Simplify wl1271_ssid_set by re-using cfg80211_find_ie instead of
reimplementing it.

Additionally, add a length check to prevent a potential buffer overflow.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13 00:06:31 +03:00
John W. Linville a70171dce9 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
	drivers/net/wireless/libertas/if_cs.c
	drivers/net/wireless/rtlwifi/pci.c
	net/bluetooth/l2cap_sock.c
2011-05-05 13:32:35 -04:00
Luciano Coelho 25eaea30cd Revert "wl12xx: support FW TX inactivity triggers"
This reverts commit 47684808fd.

Conflicts:

	drivers/net/wireless/wl12xx/conf.h
	drivers/net/wireless/wl12xx/main.c
2011-05-02 12:46:40 +03:00
Arik Nemtsov 2d66bee7fb wl12xx: export driver state to debugfs
By reading the "driver_state" debugfs value we get all the important
state information from the wl12xx driver. This helps testing and
debugging, particularly in situations where the driver seems "stuck".

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:31:34 +03:00
Arik Nemtsov 7dece1c8e1 wl12xx: fix race condition during recovery in AP mode
When operating as AP, the TX queues are not stopped when we start
recovery. mac80211 is notified only after the fact. When there is
pending TX, it will be queued even after the FW is down. This leads to
situations where the TX queues are stopped (because of the TX-watermark
mechanism), and are never woken up when we return from recovery.

Fix this by explicitly stopping the TX queues when before initiating
recovery.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:31:28 +03:00
Arik Nemtsov 2dc5a5c2c6 wl12xx: add debugfs entry for starting recovery
This entry is useful for debugging the driver state machine during
recovery.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:31:23 +03:00
Arik Nemtsov c45a85b5a3 wl12xx: AP-mode - reconfigure templates after basic rates change
When there's a change in the basic rates of the AP, reconfigure relevant
templates with the new rates.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:31:18 +03:00
Arik Nemtsov 70f474241b wl12xx: AP-mode - overhaul rate policy configuration
Use the minimal rate configured in the basic rates set as the AP
broadcast and multicast rate. The minimal rate is used to ensure weak
links can still communicate.

When the basic rates contains at least one OFDM rate, configure all
unicast TX rates to OFDM only.

Unify rate configuration on initialization and on change notification
into a single function.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:31:13 +03:00
Arik Nemtsov 52dcaf577f wl12xx: print firmware program counter during recovery
When performing recovery, print the firmware version and program
counter (by reading the SCR_PAD4 register). The value of the firmware
program counter during assert can be useful for debugging.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:31:09 +03:00
Arik Nemtsov f482b76202 wl12xx: schedule recovery on command timeout
We use a long timeout (2 seconds) when sending commands to the FW.
When a command times out, it means the FW is stuck, and we should
commence recovery.

This should make recovery times shorter as we'll recover on the first
timeout indication.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:31:03 +03:00
Arik Nemtsov 521a4a2326 wl12xx: AP-mode - disable beacon filtering on start up
New AP-mode FWs filter external beacons by default. Disable this
filtering on start up so we can properly configure ERP protection.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:30:48 +03:00
Arik Nemtsov 5f704d180e wl12xx: use wiphy values for setting rts, frag thresholds on init
Use the wiphy RTS and fragmentation thresholds for initializing the FW
when possible. This mitigates a bug where previously set values are
forgotten after interface down/up.

Add checks before settings these values to ensure they are valid. Use
default values when invalid thresholds are configured.

Update the default RTS threshold to the maximum value given by the
specification.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:29:20 +03:00
Arik Nemtsov 801f870bc0 wl12xx: add BT-coexistance for AP
Initialize AP specific BT coexitance parameters to default values and
enable them in AP mode.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:28:49 +03:00
Luciano Coelho f7c7c7e69c wl12xx: strict_stroul introduced converted to kstrtoul
One new patch applied added a couple of new strict_strtoul calls.
Converted those to kstroul().

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:27:34 +03:00
Hauke Mehrtens 86c438f40c wl12xx: do not set queue_mapping directly
It is preferred to use the setter that to set queue_mapping directly.
This also helps backporting in compat-wireless.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:27:30 +03:00
Arik Nemtsov 34c8e3d2bb wl12xx: discard corrupted packets in RX
When packets arrive with a RX descriptor indicating corruption, discard
them.

In general white-list the RX descriptor status to prevent rouge data
from being sent up.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:27:25 +03:00
Arik Nemtsov 3343789302 wl12xx: implement the tx_frames_pending mac80211 callback
Frames are considered pending when they reside in the driver TX queue or
already queued in the FW.

This notion of "pending" is appropriate for power save considerations in
STA mode, but not necessarily in other modes (for instance P2P-GO).

[Fixed a sparse warning about missing "static" in a function
declaration -- Luca]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:27:21 +03:00
Ido Yariv 4cf557fcf0 wl12xx: Enable dynamic memory for 127x
The FW can dynamically manage its internal TX & RX memory pools, moving
blocks from one pool to another when necessary. This can significantly
improve performance. Currently this feature is enabled only for 128x.

Enable dynamic memory for 127x as well. Other parameters in the memory
configuration structure may need to be fine tuned, as the optimal values
for these may change once dynamic memory is enabled.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:27:17 +03:00
Ido Yariv ef2e300485 wl12xx: Restart TX when TX descriptors are available
The driver stops sending TX packets when either there aren't enough
memory blocks, or it runs out of TX descriptors. The driver continues to
send packets to the FW only when more memory blocks are available.

The FW might free TX descriptors without freeing the corresponding
memory blocks, especially when dynamic memory is enabled. In cases where
memory blocks are not freed at all, the driver will keep waiting for
more memory blocks indefinitely.

Fix this by clearing the WL1271_FLAG_FW_TX_BUSY flag when there are
available TX descriptors.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:27:13 +03:00
Ido Yariv ae825e4ba8 wl12xx: Modify memory configuration for 128x/AP
The 128x/AP firmware does not yet support dynamic memory. Temporarily,
the memory configuration for the 127x was used both for 127x/AP as well
as 128x/AP. Since the two chips don't have the same number of memory
blocks, TP was significantly degraded.

This hasn't been fine tuned yet, but using the base 128x numbers
(without dynamic memory) seems to yield much better results (around 30%
more). Additional fine tuning will be required in the future.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:27:08 +03:00
Eliad Peller 1fe9e2464c wl12xx: add debugfs entries for dtim_interval and beacon_interval
When configuring ACX_WAKE_UP_CONDITIONS (before entering psm), we
tell the firmware to wake up once in N DTIMs/beacons.

Allow control of this value via debugfs (for debugging purposes).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:27:03 +03:00
Shahar Levi 2370841bf1 wl12xx: Update Power Save Exit Retries Packets
Reducing the retries of sending PS exit packets to the peer AP.
That fix is to avoid sending unrealizable number of PS exit packets
in case of ap lost.

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:26:58 +03:00
Shahar Levi ff86843dfb wl12xx: FM WLAN coexistence
Add support to FM WLAN coexistence (STA only).  Some WiFi harmonics
may interfere with FM operation, to avoid this problem special
coexistence techniques are activated around some FM frequencies.

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:26:06 +03:00
Eliad Peller cb5ae0530e wl12xx: configure rates when working in ibss mode
When working in ibss mode, we don't configure rate policy per station
(as we use the same link for multiple stations), so currently the
1mb/s rate is being used.

Instead, configure the firmware to use the whole 11b rates by default.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:26:02 +03:00
Eliad Peller 30df14d0d3 wl12xx: avoid redundant join on interface reconfiguration
ieee80211_reconfig() sets most of the "changed" flags regardless
of the actual change (e.g. BSS_CHANGED_ASSOC will be set even if
the interface is still not associated). in this case the driver
will issue some unneeded commands.

Since the driver relies solely on the BSS_CHANGED_ASSOC flag,
without checking if there was an actual change, it will end up
issuing unjoin() and dummy_join() commands, although it was
never associated and should just remain idle.

Avoid it by checking the actual state change, in addition to the
"changed" flag.

(there seem to be more redundant configuration commands being
issued, but they shouldn't harm)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:25:57 +03:00
Eliad Peller a20a5b7e48 wl12xx: print actual rx packet size (without padding)
When debugging, reduce the padding size from each rx packet, to
get the actual packet size (so comparing it against a cap file
will be easier)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:25:53 +03:00
Shahar Levi b03acadea4 wl12xx: Set correct REF CLK and TCXO CLK values to the FW
Fix mismatch between the REF CLK and TCXO CLK information that is
set in the platform data and the NVS, so we override what comes
from the NVS and replace it with what comes from the platform data.

[Small fix in a comment -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:25:48 +03:00
Eliad Peller a665d6e260 wl12xx: avoid premature elp entrance
The elp_work is being enqueued on wl1271_ps_elp_sleep, but doesn't get
cancelled on wl1271_ps_elp_wakeup. This might cause immediate entrance
to elp when the wl->mutex is being released, rather than using the delayed
enqueueing optimization.

Cancel elp_work on wakeup request, and add a new WL1271_FLAG_ELP_REQUESTED
flag to further synchronize the elp actions.

[Fixed a couple of typos in some comments -- Luca]

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:25:27 +03:00
Eliad Peller c75bbcdb20 wl12xx: sleep instead of wakeup after tx work
commit d05c806 ("wl12xx: rearrange some ELP wake_up/sleep calls")
introduced a bug in which wl1271_ps_elp_wakeup() was called instead
of wl1271_ps_elp_sleep() after completing the tx work.

Reported-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:25:22 +03:00
Shahar Levi 564f59509e wl12xx: Set End-of-transaction Flag at Wl127x AP Mode
End-of-transaction flag should be set when working with
wl127x chip on AP mode.

Thanks Ido Yariv <ido@wizery.com> for the guidance with that.

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-02 10:25:17 +03:00
Arik Nemtsov 47684808fd wl12xx: support FW TX inactivity triggers
In AP mode we register for the MAX_TX_RETRY and INACTIVE_STA events.
Both are reported to the upper layers as a TX failure in the offending
stations.

In STA mode we register only for the MAX_TX_RETRY event. A TX failure is
interpreted as a loss of connection.

Support for IEEE80211_HW_REPORTS_TX_ACK_STATUS has been removed to avoid
the inherent race condition of a mac80211 TX failure counter in addition
to the FW counter.

This patch depends on "mac80211: allow low level driver to report packet
loss"

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-04-28 14:50:45 -04:00
Luciano Coelho cf27d86775 wl12xx: fix sparse warning about undeclared wl12xx_alloc_dummy_packet
Fix sparse warning:

  CHECK   drivers/net/wireless/wl12xx/main.c
drivers/net/wireless/wl12xx/main.c:1246:17: warning: symbol 'wl12xx_alloc_dummy_packet' was not declared. Should it be static?

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:24 +03:00
Luciano Coelho 4ec23d6e13 wl12xx: remove unused conf_radio_params structure
This structure has not been used anymore since commit
e6b190ff3c.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:23 +03:00
Luciano Coelho afb7d3cd80 wl12xx: move hardcoded hci_io_ds value into the conf struct
Instead of hardcoding the hci_io_ds configuration that we write to the
SDIO_IO_DS top registed, read it from the default configuration so
that it's easier to change for different platforms.

Reported-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:22 +03:00
Luciano Coelho 6277ed6570 wl12xx: use kstrtoul functions
Use the new kstrtoul functions instead of the deprecated strict_strtoul().

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:21 +03:00
Ido Yariv 341b7cde6c wl12xx: Handle platforms without level trigger interrupts
Some platforms are incapable of triggering on level interrupts. Add a
platform quirks member in the platform data structure, as well as an
edge interrupt quirk which can be set on such platforms.

When the interrupt is requested with IRQF_TRIGGER_RISING, IRQF_ONESHOT
cannot be used, as we might miss interrupts that occur after the FW
status is cleared and before the threaded interrupt handler exits.

Moreover, when IRQF_ONESHOT is not set, iterating more than once in the
threaded interrupt handler introduces a few race conditions between this
handler and the hardirq handler. Currently this is worked around by
limiting the loop to one iteration only. This workaround has an impact
on performance. To remove to this restriction, the race conditions will
need to be addressed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:20 +03:00
Ido Yariv d2f4d47d84 wl12xx: Simplify TX blocks accounting
The total number of TX memory blocks may change when the dynamic memory
option is enabled. The current implementation only tracks the available
memory blocks, which over-complicates TX blocks accounting.

By tracking the number of allocated blocks, calculation of the number of
available blocks becomes simpler and cleaner. It simply equals the total
number of TX memory blocks minus the allocated ones.

Also, remove some unnecessary castings and use union member accesses
instead.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:20 +03:00
Ido Yariv 990f5de738 wl12xx: Clean up the dummy packet mechanism
The current implementation allocates a skb each time one is requested by
the firmware. Since dummy packets are handled differently than regular
packets, the skb needs to be marked. Currently, this is done by
setting the pkt_type member to 5. This might not be safe, as we cannot
be sure that there won't be any other packets with this pkt_type value.

Since the packet does not change from one request to another, we can
simply allocate a dummy packet template and always send it. All changes
to the skb done during packet preparation must be reverted, so the same
skb can be reused.

The dummy packets are not transmitted, therefore there's no need to set
the BSSID or our own MAC address.

In addition, the header portion of the packet was zeroed by mistake, so
fix that as well.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:19 +03:00
Ido Yariv 0da13da767 wl12xx: Clean up the block size alignment code
Simplify and clean up the block size alignment code:
1. Set the block size according to the padding field type, as it cannot
   exceed the maximum value this field can hold.
2. Move the alignment code into a function instead of duplicating it in
   multiple places.
3. In the current implementation, the block_size member can be
   misleading because a zero value actually means that there's no need to
   align. Declare a block size alignment quirk instead.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:18 +03:00
Ido Yariv d29633b40e wl12xx: Clean up and fix the 128x boot sequence
Clean up the boot sequence code & fix the following issues:
1. Always read the registers' values and set the relevant bits instead of
   zeroing all other bits
2. Handle cases where wl1271_top_reg_read returns an error
3. Verify that the HW can detect the selected clock source
4. Remove 128x PG10 initialization code
5. Configure the MCS PLL to work in HP mode

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:17 +03:00
Ohad Ben-Cohen 8bf69aae4c wl12xx: fix "JOIN while associated" commentary
Issuing multiple JOIN commands to the wl12xx's firmware, while
we're associated, might have undesired implications, so the driver
prints a message when that happens, and warn developers who check
out the source.

Update the commentary in order to consider the one valid scenario
where this can happen: roaming.

Cautiously keep the message for now, until we either gain confidence
there are no unintentional JOIN-while-associated events, or until
we move to the new multi-role fw who solves this multiple-join issue
for good.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:16 +03:00
Ohad Ben-Cohen c5745187a4 wl12xx: fix roaming
The wl12xx device normally drops all frames coming from BSSID
it is not joined with.

This behavior is configured today by the wl12xx driver in response
to a handful of ieee80211_bss_change and ieee80211_conf_changed
notification flags, such as BSS_CHANGED_ASSOC, BSS_CHANGED_BSSID,
IEEE80211_CONF_CHANGE_IDLE, etc..

This breaks when we roam to a new BSSID, where authentication frames
are sent before any BSS_CHANGED/CONF_CHANGED flags are received.
When this happens the hardware silently drops the authentication
responses, and the roaming fails.

Ideally this aggressive filtering behavior of the device should be disabled
upon a notification from mac80211. Such notification will take place
after multi-channel support will be added: mac80211 will likely send a
remain-on-channel notification to drivers when entering sensitive
states (like authentication), otherwise the firmware might jump to
different channels (to serve a different role).

Until those notifications materialize, disable the hw BSSID filter
when authentication requests are sent, so roaming would work.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:15 +03:00
Juuso Oikarinen 13026decf7 wl12xx: Handle duplicate calling of remove interface
Because of the hardware recovery mechanism, its possible the
__wl1271_op_remove_interface is called twice. Currently, this leads to a
kernel crash even before a kernel WARNing can be issued.

Fix this.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:15 +03:00
Eliad Peller c1b193eb65 wl12xx: rearrange some ELP wake_up/sleep calls
ELP (Extremely/Enhanced Low Power, or something like that ;)) refers to
the powerstate of the 12xx chip, in which very low power is consumed,
and no commands (from the host) can be issued until the chip is woken up.

Wakeup/sleep commands must be protected by a wl->mutex, so it's generally
a good idea to call wakeup/sleep along with the mutex lock/unlock (where
needed). However, in some places the wl12xx driver calls wakeup/sleep in
some "inner" functions. This result in some "nested" wakeup/sleep calls
which might end up letting the chip go to sleep prematurely (e.g. during
event handling).

Fix it by rearranging the elp calls to come along with mutex_lock/unlock.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:14 +03:00
Arik Nemtsov 17e672d6e4 wl12xx: configure channel/band while FW is off
Initialize the channel and band from mac80211 conf even when the FW is
not yet loaded. This mitigates a bug in AP-mode where the channel was
never changed from its initial setting after FW boot and was therefore
never configured to FW.

Reported-by: Alexander Boukaty <alexanderb@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:13 +03:00
Luciano Coelho 4a31c11c7d wl12xx: use a bitmask instead of list of booleans in scanned_ch
We were using an array of booleans to mark the channels we had already
scanned.  This was causing a sparse error, because bool is not a type
with defined size.  To fix this, use bitmasks instead, which is much
cleaner anyway.

Thanks Johannes Berg for the idea.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:12 +03:00
Luciano Coelho 4623ec7d97 wl12xx: fix a couple of sparse warnings about undeclared functions
Fix the following sparse warnings:

drivers/net/wireless/wl12xx/main.c:1129:5: warning: symbol '__wl1271_plt_stop' was not declared. Should it be static?
drivers/net/wireless/wl12xx/main.c:2988:5: warning: symbol 'wl1271_op_ampdu_action' was not declared. Should it be static?

Both functions should be static.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:11 +03:00
Luciano Coelho d9482e2b51 wl12xx: fix SG BT load value to reflect its new meaning
The Soft Gemini BT load ratio value has changed its meaning with FW
version 6.1.0.0.310.  It now means the passive scan compensation
percentage during A2DP EDR.  Instead of 50, we need to use 200.

Fix the SG configuration accordingly.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:10 +03:00
Luciano Coelho 18b92ffaf3 wl12xx: set the skbuff priority for dummy packets
The firmware requires dummy packets to be sent using TID 7
(WL1271_TID_MGMT).  Instead of hardcoding it in the tx_fill_hdr()
function, set it when creating the packet itself.

This requires Eliad's fix to set the actual TID in the TX descriptor.

Cc: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:09 +03:00
Eliad Peller db674d249c wl12xx: set the actual tid instead of the ac
When passing a tx frame, the driver incorrectly set desc->tid
with the ac instead of the actual tid.

It has some serious implications when using 802.11n + QoS,
as the fw starts a BlockAck with the wrong tid (which finally
cause beacon loss and disconnection / some fw crash)

Fix it by using the actual tid stored in skb->priority.

Reported-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:08 +03:00
Juuso Oikarinen f9f774c17e wl12xx: Add mutex protection for interface list
The interface list maintained in main.c is not mutex protected. This could
cause issues, as the list is accessed from notifier chains.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:08 +03:00
Arik Nemtsov 1d732e8cf3 wl12xx: Clamp byte mode transfers for 128x chips
On wl128x based devices, when TX packets are aggregated, each packet
size must be aligned to the SDIO block size, and sent using block mode
transfers.

The block size is set to 256 bytes, which is less than the maximum
possible byte transfer. Thus, if two small packets (< 256 bytes) are
aggregated, the aggregation buffer size would be 512, and will be sent
using byte mode transfers. This can have undesired side effects.

Fix this by setting the MMC_QUIRK_BLKSZ_FOR_BYTE_MODE mmc card quirk.
For 127x chips this has no effect, as the block size is set to 512
bytes.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:07 +03:00
Ohad Ben-Cohen 958b20e068 wl12xx: update bet_max_consecutive
Allow early termination of 50 consecutive beacons.

This value is the recommended one by the 12xx's system/RF team,
and tests show that power consumption is improved as expected.

Reported-by: Ruthy Zaphir <ruthyz@ti.com>
Tested-by: Danil Shalumov <danils@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:06 +03:00
Shahar Levi 871d0c3ba3 wl12xx: Add support for 11n Rx STBC one spatial stream
The wl12xx chip supports one Rx STBC spatial stream.  Announce this in
the HT capabilities info field.

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:05 +03:00
Juuso Oikarinen 0af0467f09 wl12xx: Fix potential incorrect band in rx-status
The rx-status passed to mac80211 along with each received frame contains the
band on which the frame was received. Under certain circumstances, this band
information may be incorrect, causing in worst case a WARNING from mac80211,
and causes the received frame to be dropped.

This scenario mainly occurs when performing connected-mode scans, when the
received scan results are from the other band than the one currently
associated to.

[Since desc_band doesn't exist anymore, use status->band in the later
call to ieee80211_channel_to_frequency() to fix compilation -- Luca]

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:04 +03:00
Luciano Coelho e7ddf549f3 wl12xx: use 1 spare TX block instead of two
All the new firmware versions (>=6.1.3.50.58 for STA and >=6.2.0.0.47
for AP) use 1 spare TX block.  We still want to support older
firmwares that require 2 spare blocks, so added a quirk to handle the
difference.

Also implemented a generic way of setting quirks that depend on the
firmware revision.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:03 +03:00
Shahar Levi 0830ceedbf wl12xx: 1281/1283 support - enable chip support
Add support to wl128x chip via chip id

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:03 +03:00
Arik Nemtsov 1aed55fd78 wl12xx: 1281/1283 support - Use different FW file for AP mode wl127x/wl128x chips
Choose a different FW for AP-mode wl127x and wl128x chips, base on chip
ID at boot time.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:02 +03:00
Shahar Levi ae47c45fd0 wl12xx: 1281/1283 support - Add dummy packet support
Support sending dummy packet to wl128x FW as results of
dummy packet event. That is part of dynamic TX mem blocks mechanism.

Only send dummy packet when not in AP mode.

[Even though the DUMMY_PACKET_EVENT_ID and the
STA_REMOVE_COMPLETE_EVENT_ID events are defined to the same value, we
need to treat them separately in the code.  Keep the check and enable
STA_REMOVE_COMPLETE_EVENT_ID for AP mode and DUMMY_PACKET_EVENT_ID for
STA.  Moved one warning to a cleaner place.  Use WL1271_TID_MGMT for
dummy packets -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:01 +03:00
Shahar Levi ae77eccf04 wl12xx: 1281/1283 support - Improve Tx & Rx path
Reduced bus transactions in the Tx & Rx path.

[Removed unnecessary check wl->chip.id != CHIP_ID_1283_PG20 when
checking the quirk -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:00 +03:00
Shahar Levi 13b107dd98 wl12xx: 1281/1283 support - use dynamic memory for the RX/TX pools
Separate the memory configuration to chip-specific structures and
implement dynamic memory for wl128x.

This feature allows us to move TX memory blocks to the RX pool when
the RX path is overloaded.

Thanks for Arik Nemtsov <arik@wizery.com> for helping simplify the
wl1271_fw_status() code.

[Rewrote the commit subject and message for clarity; improved some
comments and changed "spare" to "padding" for consistency; added a
FIXME for the AP memory configuration -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:48:59 +03:00
Shahar Levi 5ea417ae77 wl12xx: 1281/1283 support - New boot sequence
Boot sequence support FREF clock and TCXO clock.
WL128x has two clocks input - TCXO and FREF.
TCXO is the main clock of the device, while FREF is used to sync
between the GPS and the cellular modem.
Auto-detection checks where TCXO is 32.736MHz or 16.368MHz, in that
case the FREF will be used as the WLAN/BT main clock.

[Use clock enumeration as defined in linux/wl12xx.h; remove
unnecessary else block in wl128x_switch_fref; remove unnecessary
change in main.c; remove some unnecessary debug prints and comments;
fix potential use of uninitialized value (pll_config) -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:48:58 +03:00
Shahar Levi bc765bf3b9 wl12xx: 1281/1283 support - Loading FW & NVS
Take care of FW & NVS with the auto-detection between wl127x and
wl128x.

[Moved some common code outside if statements and added notes about
NVS structure assumptions; Fixed a bug when checking the nvs size: if
the size was incorrect, the local nvs variable was set to NULL, it
should be wl->nvs instead. -- Luca]

[Merged with potential buffer overflow fix -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:48:10 +03:00
Shahar Levi 49d750ca14 wl12xx: 1281/1283 support - New radio structs and functions
New general and radio parameters structures and functions.
Implemented as separate functions due to auto-detection
between wl127x and wl128x.

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:19:48 +03:00
Luciano Coelho a81159edf8 wl12xx: 1281/1283 support - add block size handling for sdio and spi
Add the the set_block_size op in the SDIO and in the SPI modules.
Since it is only used with SDIO, just explicitly set the op to NULL in
spi.c

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:19:48 +03:00
Shahar Levi 48a61477bd wl12xx: 1281/1283 support - Add acx commands
New acx command that sets: Rx fifo enable reduced bus transactions
in RX path. Tx bus transactions padding to SDIO block size that
improve preference in Tx and essential for working with SDIO HS (48Mhz).
The max SDIO block size is 256 when working with Tx bus transactions
padding to SDIO block.

Add new ops to SDIO & SPI that handles the win size change in case of
transactions padding (relevant only for SDIO).

[Fix endianess issues; simplify sdio-specific block_size handling;
minor changes in comments; use "aligned_len" in one calculation
instead of "pad" to avoid confusion -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:19:47 +03:00
Shahar Levi 5aa42346bb wl12xx: 1281/1283 support - Add Definitions
Definitions to support wl128x:
  - New FW file name
  - Chip ID
  - New PLL Configuration Algorithm macros that will be used at wl128x
    boot stage
  - Rename NVS macro name: wl127x and wl128x are using the same NVS
    file name. However, the ini parameters between them are
    different. The driver will validate the correct NVS size in
    wl1271_boot_upload_nvs().

[Cleaned up some of the definitions. -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:19:46 +03:00
Shahar Levi b9b0fdead0 wl12xx: 1281/1283 support - move IRQ polarity
In order to prevent overran of IRQ polarity via FW the polarity setting move after
FW download and before IRQ enable.

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:19:45 +03:00
Linus Torvalds c44eaf41a5 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (34 commits)
  net: Add support for SMSC LAN9530, LAN9730 and LAN89530
  mlx4_en: Restoring RX buffer pointer in case of failure
  mlx4: Sensing link type at device initialization
  ipv4: Fix "Set rt->rt_iif more sanely on output routes."
  MAINTAINERS: add entry for Xen network backend
  be2net: Fix suspend/resume operation
  be2net: Rename some struct members for clarity
  pppoe: drop PPPOX_ZOMBIEs in pppoe_flush_dev
  dsa/mv88e6131: add support for mv88e6085 switch
  ipv6: Enable RFS sk_rxhash tracking for ipv6 sockets (v2)
  be2net: Fix a potential crash during shutdown.
  bna: Fix for handling firmware heartbeat failure
  can: mcp251x: Allow pass IRQ flags through platform data.
  smsc911x: fix mac_lock acquision before calling smsc911x_mac_read
  iwlwifi: accept EEPROM version 0x423 for iwl6000
  rt2x00: fix cancelling uninitialized work
  rtlwifi: Fix some warnings/bugs
  p54usb: IDs for two new devices
  wl12xx: fix potential buffer overflow in testmode nvs push
  zd1211rw: reset rx idle timer from tasklet
  ...
2011-04-11 07:27:24 -07:00
Luciano Coelho 09b661b332 wl12xx: fix potential buffer overflow in testmode nvs push
We were allocating the size of the NVS file struct and not checking
whether the length of the buffer passed was correct before copying it
into the allocated memory.  This is a security hole because buffer
overflows can occur if the userspace passes a bigger file than what is
expected.

With this patch, we check if the size of the data passed from
userspace matches the size required.

This bug was introduced in 2.6.36.

Cc: stable@kernel.org
Reported-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-04-04 15:22:12 -04:00
Luciano Coelho 5245e3a9f7 wl12xx: fix module author's email address in the spi and sdio modules
The MODULE_AUTHOR() macro in the main module (wl12xx) has been updated
to reflect one of the author's new email address, but the wl12xx_spi
and wl12xx_sdio modules haven't been updated.  This patches updates
them.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-04-04 15:22:11 -04:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Bing Zhao 80751e2b8f ieee80211: add IEEE80211_COUNTRY_STRING_LEN definition
and make use of it in wireless drivers

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-03-09 16:10:56 -05:00
Helmut Schaa 95a776107a wl12xx: Correctly set up protection if non-GF STAs are present
Set the gf_protection bit when calling ACX_HT_BSS_OPERATION according
to the GF bit passed by mac80211 in ht_operation_mode.

[Added a proper commit message -- Luca]

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:20:34 +02:00
Arik Nemtsov 24225b37bd wl12xx: wakeup chip from ELP during scan
Commands are sometimes sent to FW on scan completion. Make sure the chip
is awake to receive them. Sending commands while the chip is in ELP
can cause SDIO read errors and/or crash the FW.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:20:25 +02:00
Ido Yariv b16d4b6864 wl12xx: Modify requested number of memory blocks
Tests have shown that the requested number of memory blocks is
sub-optimal. Slightly modify the requested number of memory blocks for
TX.

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:12:57 +02:00
Ido Yariv b07d403705 wl12xx: Avoid redundant TX work
TX might be handled in the threaded IRQ handler, in which case, TX work
might be scheduled just to discover it has nothing to do.

Save a few context switches by cancelling redundant TX work in case TX
is about to be handled in the threaded IRQ handler. Also, avoid
scheduling TX work from wl1271_op_tx if not needed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:12:57 +02:00
Ido Yariv 2da69b890f wl12xx: Switch to level trigger interrupts
The interrupt of the wl12xx is a level interrupt in nature, since the
interrupt line is not auto-reset. However, since resetting the interrupt
requires bus transactions, this cannot be done from an interrupt
context. Thus, requesting a level interrupt would require to disable the
irq and re-enable it after the HW is acknowledged. Since we now request
a threaded irq, this can also be done by specifying the IRQF_ONESHOT
flag.

Triggering on an edge can be problematic in some platforms, if the
sampling frequency is not sufficient for detecting very frequent
interrupts. In case an interrupt is missed, the driver will hang as the
interrupt line will stay high until it is acknowledged by the driver,
which will never happen.

Fix this by requesting a level triggered interrupt, with the
IRQF_ONESHOT flag.

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:10:46 +02:00
Ido Yariv a620865edf wl12xx: Switch to a threaded interrupt handler
To achieve maximal throughput, it is very important to react to
interrupts as soon as possible. Currently the interrupt handler wakes up
a worker for handling interrupts in process context. A cleaner and more
efficient design would be to request a threaded interrupt handler.  This
handler's priority is very high, and can do blocking operations such as
SDIO/SPI transactions.

Some work can be deferred, mostly calls to mac80211 APIs
(ieee80211_rx_ni and ieee80211_tx_status). By deferring such work to a
different worker, we can keep the irq handler thread more I/O
responsive. In addition, on multi-core systems the two threads can be
scheduled on different cores, which will improve overall performance.

The use of WL1271_FLAG_IRQ_PENDING & WL1271_FLAG_IRQ_RUNNING was
changed. For simplicity, always query the FW for more pending
interrupts. Since there are relatively long bursts of interrupts, the
extra FW status read overhead is negligible. In addition, this enables
registering the IRQ handler with the ONESHOT option.

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:10:46 +02:00
Ido Yariv 393fb560d3 wl12xx: Change claiming of the SDIO bus
The SDIO bus is claimed and released for each SDIO transaction. In
addition to the few CPU cycles it takes to claim and release the bus, it
may also cause undesired side effects such as the MMC host stopping its
internal clocks.

Since only the wl12xx_sdio driver drives this SDIO card, it is safe to
claim the SDIO host once (on power on), and release it only when turning
the power off.

This patch was inspired by Juuso Oikarinen's (juuso.oikarinen@nokia.com)
patch "wl12xx: Change claiming of the (SDIO) bus".

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:10:46 +02:00
Ido Yariv 606ea9fa0b wl12xx: Do end-of-transactions transfers only if needed
On newer hardware revisions, there is no need to write the host's
counter at the end of a RX transaction. The same applies to writing the
number of packets at the end of a TX transaction.

It is generally a good idea to avoid unnecessary SDIO/SPI transfers.
Throughput and CPU usage are improved when avoiding these.

Send the host's RX counter and the TX packet count only if needed, based
on the hardware revision.

[Changed WL12XX_QUIRK_END_OF_TRANSACTION to use BIT(0) -- Luca]

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:10:46 +02:00
Ido Yariv 8aad24642a wl12xx: Reorder data handling in irq_work
The FW has a limited amount of memory for holding frames. In case it
runs out of memory reserved for RX frames, it'll have no other choice
but to drop packets received from the AP. Thus, it is important to
handle RX data interrupts as soon as possible, before handling anything
else.

In addition, since there are enough TX descriptors to go around, it is
better to first send TX frames, and only then handle TX completions.

Fix this by changing the order of function calls in wl1271_irq_work.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:10:46 +02:00