aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/tx.c
Commit message (Collapse)AuthorAgeFilesLines
* wl12xx: fix race condition during recovery in AP modeArik Nemtsov2011-05-021-3/+5
| | | | | | | | | | | | | | 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>
* wl12xx: Restart TX when TX descriptors are availableIdo Yariv2011-05-021-0/+3
| | | | | | | | | | | | | | | | | 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>
* wl12xx: sleep instead of wakeup after tx workEliad Peller2011-05-021-1/+1
| | | | | | | | | | 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>
* wl12xx: Simplify TX blocks accountingIdo Yariv2011-04-191-0/+1
| | | | | | | | | | | | | | | | | 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>
* wl12xx: Clean up the dummy packet mechanismIdo Yariv2011-04-191-12/+31
| | | | | | | | | | | | | | | | | | | | | | 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>
* wl12xx: Clean up the block size alignment codeIdo Yariv2011-04-191-12/+14
| | | | | | | | | | | | | | 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>
* wl12xx: fix roamingOhad Ben-Cohen2011-04-191-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* wl12xx: rearrange some ELP wake_up/sleep callsEliad Peller2011-04-191-13/+9
| | | | | | | | | | | | | | | | | | | 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>
* wl12xx: set the skbuff priority for dummy packetsLuciano Coelho2011-04-191-3/+0
| | | | | | | | | | | 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>
* wl12xx: set the actual tid instead of the acEliad Peller2011-04-191-2/+2
| | | | | | | | | | | | | | | | 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>
* wl12xx: use 1 spare TX block instead of twoLuciano Coelho2011-04-191-2/+8
| | | | | | | | | | | | 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>
* wl12xx: 1281/1283 support - Add dummy packet supportShahar Levi2011-04-191-20/+55
| | | | | | | | | | | | | | | | | | 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>
* wl12xx: 1281/1283 support - Improve Tx & Rx pathShahar Levi2011-04-191-9/+21
| | | | | | | | | | | 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>
* wl12xx: 1281/1283 support - Add acx commandsShahar Levi2011-04-191-19/+45
| | | | | | | | | | | | | | | | | | | 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>
* wl12xx: Switch to a threaded interrupt handlerIdo Yariv2011-03-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* wl12xx: Do end-of-transactions transfers only if neededIdo Yariv2011-03-031-2/+8
| | | | | | | | | | | | | | | | | | | 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>
* wl12xx: Remove private headers in wl1271_tx_resetIdo Yariv2011-03-031-9/+23
| | | | | | | | | | | | Frames in the tx_frames array include extra private headers, which must be removed before passing the skbs to ieee80211_tx_status. Fix this by removing any private headers in wl1271_tx_reset, similar to how this is done in wl1271_tx_complete_packet. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP-mode - management of links in PS-modeArik Nemtsov2011-02-231-1/+23
| | | | | | | | | | | | | | | | | | Update the PS mode of each link according to a bitmap polled from fw_status. Manually notify mac80211 about PS mode changes in connected stations. mac80211 will only be notified about PS start when the station is in PS and there is a small number of TX blocks from this link ready in HW. This is required for waking up the remote station since the TIM is updated entirely by FW. When a station enters mac80211-PS-mode, we drop all the skbs in the low-level TX queues belonging to this sta with STAT_TX_FILTERED to keep our queues clean. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP-mode - count free FW TX blocks per linkArik Nemtsov2011-02-231-24/+29
| | | | | | | | | | Count the number of FW TX blocks allocated per link. We add blocks to a link counter when allocated for a TX descriptor. We remove blocks according to counters in fw_status indicating the number of freed blocks in FW. These counters are polled after each IRQ. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: report invalid TX rate when returning non-TX-ed skbsArik Nemtsov2011-02-231-0/+11
| | | | | | | | | Report a TX rate idx of -1 and count 0 when returning untransmitted skbs to mac80211 using ieee80211_tx_status(). Otherwise mac80211 tries to use the returned (essentially garbage) status. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP-mode - TX queue per link in ACArik Nemtsov2011-02-231-11/+119
| | | | | | | | | | | | | When operating in AP-mode we require a per link tx-queue. This allows us to implement HW assisted PS mode for links, as well as regulate per-link FW TX blocks consumption. Split each link into ACs to support future QoS for AP-mode. AC queues are emptied in priority and per-link queues are scheduled in a simple round-robin fashion. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP-mode - fix race condition on sta connectionArik Nemtsov2011-02-231-0/+19
| | | | | | | | | | | | If a sta starts transmitting immediately after authentication, sometimes the FW deauthenticates it. Fix this by marking the sta "in-connection" in FW before sending the autentication response. The "in-connection" entry is automatically removed when connection succeeds or after a timeout. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: use standard ALIGN() macroEliad Peller2011-02-231-2/+2
| | | | | | | Use the standard ALIGN() macro instead of redefining similar macros. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: set supported_rates after associationEliad Peller2011-02-081-22/+0
| | | | | | | | | | | | Instead of looking for supported_rates change on every tx packet, just extract the supported_rates after association completes (station only). Remove wl1271.sta_rate_set and WL1271_FLAG_STA_RATES_CHANGED which are not used anymore. Signed-off-by: Eliad Peller <eliad@wizery.com> Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: fix some endianess bugsEliad Peller2011-01-241-3/+3
| | | | | | | | | | | | | | | | | | | | pointed out by sparse warnings: CHECK drivers/net/wireless/wl12xx/cmd.c drivers/net/wireless/wl12xx/cmd.c:987:20: warning: incorrect type in assignment (different base types) drivers/net/wireless/wl12xx/cmd.c:987:20: expected restricted __le16 [usertype] aging_period drivers/net/wireless/wl12xx/cmd.c:987:20: got int CHECK drivers/net/wireless/wl12xx/tx.c drivers/net/wireless/wl12xx/tx.c:197:2: warning: cast from restricted __le16 drivers/net/wireless/wl12xx/tx.c:197:2: warning: cast from restricted __le16 drivers/net/wireless/wl12xx/tx.c:197:2: warning: cast from restricted __le16 CHECK drivers/net/wireless/wl12xx/acx.c drivers/net/wireless/wl12xx/acx.c:816:23: warning: incorrect type in assignment (different base types) drivers/net/wireless/wl12xx/acx.c:816:23: expected restricted __le32 [usertype] rate_policy_idx drivers/net/wireless/wl12xx/acx.c:816:23: got unsigned char [unsigned] [usertype] idx Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP mode - encryption supportArik Nemtsov2011-01-241-5/+25
| | | | | | | | | | | Encryption key configuration is different for AP/STA modes. AP encryption keys are recorded when the BSS is not started. On BSS start they are propagated to the AP (in wl1271_ap_init_hwenc). Signed-off-by: Arik Nemtsov <arik@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP mode - changes in TX pathArik Nemtsov2011-01-241-9/+46
| | | | | | | | | | When in AP mode set appropriate HLID and rate policy for each skb. Respond to supported-rates related changes in op_tx only when acting as STA. Signed-off-by: Arik Nemtsov <arik@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP mode - init sequenceArik Nemtsov2011-01-241-0/+18
| | | | | | | | | | | | | | | Split HW init sequence into AP/STA specific parts The AP specific init sequence includes configuration of templates, rate classes, power mode, etc. Also unmask AP specific events in the event mbox. Separate the differences between AP and STA init into mode specific functions called from wl1271_hw_init. The first is called after radio configuration and the second after memory configuration. Signed-off-by: Arik Nemtsov <arik@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP-mode high level commandsArik Nemtsov2011-01-241-1/+1
| | | | | | | | | | Add commands to start/stop BSS, add/remove STA and configure encryption keys. Split the encryption commands "set key" and "set default key" into AP and STA specific versions. Signed-off-by: Arik Nemtsov <arik@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: AP mode - AP specific CMD_CONFIGURE sub-commandsArik Nemtsov2011-01-241-1/+1
| | | | | | | | | Add AP max retries and rate policy configuration. Rename STA rate policy configuration function. Signed-off-by: Arik Nemtsov <arik@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
* wl12xx: Change TX queue to be per ACJuuso Oikarinen2010-12-151-11/+49
| | | | | | | | | | | | | | | With the current single-queue implementation traffic priorization is not working correctly - when using multiple BE streams and one, say VI stream, the VI stream will share bandwidth almost equally with the BE streams. To fix the issue, implement per AC queues, which are emptied in priority order to the firmware. To keep it relatively simple, maintain a global buffer count and global queue stop/wake instead of per-AC. With these changes, priorization appears to work just fine. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
* wl1271: Change wl12xx Files NamesShahar Levi2010-11-221-0/+485
| | | | | | | | | All files name prefix removed due to the fact that wl12xx driver supports wl1271 and wl1273. Also the definition in Kconfig and header files changed respectively. Signed-off-by: Shahar Levi <shahar_levi@ti.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
* wl12xx: Moved wl1251 TX path implementation into chip specific filesJuuso Oikarinen2009-07-101-557/+0
| | | | | | | | | Moved wl1251 TX path implementation into chip specific files to enable parallel implementation for the wl1271 TX path. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* wl12xx: add driverKalle Valo2009-05-061-0/+557
wl12xx is a driver for TI wl1251 802.11 chipset designed for embedded devices, supporting both SDIO and SPI busses. Currently the driver supports only SPI. Adding support 1253 (the 5 GHz version) should be relatively easy. More information here: http://focus.ti.com/general/docs/wtbu/wtbuproductcontent.tsp?contentId=4711&navigationId=12494&templateId=6123 (Collapsed original sequence of pre-merge patches into single commit for initial merge. -- JWL) Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>