History log of /drivers/net/wireless/wl12xx/tx.c
Revision Date Author Comments
55df5afb13718cda49128fa5985556df91d07765 03-Mar-2012 Arik Nemtsov <arik@wizery.com> wl12xx: implement SW Tx watchdog

Track freed FW blocks during Tx. If no blocks were freed during a
predefined timeout, initiate a HW recovery. This helps in situations
when the FW watchdog fails.

Don't trigger recovery during activities that can temporarily stop
Tx. This includes:
- scanning
- buffering packets for sleeping stations (AP role)
- ROC on any role

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
18aa755b84715f36e2811734f95cb822bcacfd89 27-Feb-2012 Arik Nemtsov <arik@wizery.com> wl12xx: flush all Tx queues on tx_flush timeout

Ensure our queues are empty at the end of a tx_flush(), in case we
timeout on passively waiting for them. This makes sure no left-overs are
transmitted when we are on the wrong channel.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
49c9cd26445aa8bc8348c384c943b758c57c47a9 27-Feb-2012 Arik Nemtsov <arik@wizery.com> wl12xx: avoid starving the system hlid

Re-factor the Tx scheduler so that the system_hlid is taken into account
before restarting an iteration over the wlvifs. Previously this
hlid had a lower priority and would starve if some wlvif had many
packets.
In addition avoid iterating over wlvifs past last_wlvif when performing
the a second pass. If we had packets in those wlvifs they would have
been found earlier.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
6246ca003f2560e30b9696757efc271284b809f6 27-Feb-2012 Arik Nemtsov <arik@wizery.com> wl12xx: reset link Tx queues when freeing it

Before, the link was first freed (invalidating it in the map), and later
on vif removal, all valid wlvif-related links were reset. Since these
links were already invalid, we failed to reset them.
The bug was made worse by op_stop, which set the tx_queue_count to 0
arbitrarily. This resulted in a negative tx_queue_count in some scenarios.

Fix this by resetting the Tx-queues of a link when freeing it. Add a
WARN_ON and reset all link Tx-queues in op_stop, to avoid a negative
tx_queue_count.

[changed WARN_ON to WARN_ON_ONCE -- Luca]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
5ec8a448e0e978103bc5ca7136084b5e2b36989e 01-Feb-2012 Eliad Peller <eliad@wizery.com> wl12xx: consider encryption and QoS in auto arp template

When configuring the arp response template,
and encryption is enabled, we should add some
space and set the protected flag bit in the fc.

In order to track the encryption type, set
wlvif->encryption_type when setting an encryption key,
and reconfigure the arp response. Clear this field on
wl1271_join, as keys have to be re-configured
anyway after a join command.

Similarly, track whether QoS is configured.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
f4f57943f265d80fe5f0fedf6964f8056e753cf3 31-Jan-2012 Eliad Peller <eliad@wizery.com> wl12xx: add TX_HW_ATTR_HOST_ENCRYPT flag

In WEP shared authentication, we encrypt the auth frame
in the host, and we want the fw to pass it as-is.
Use the TX_HW_ATTR_HOST_ENCRYPT flag in order to indicate
it to the fw.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
defe02c720d54fc9bda3e5e625be70adac347a61 31-Jan-2012 Pontus Fuchs <pontus.fuchs@gmail.com> wl12xx: Set IEEE80211_TX_RC_SHORT_GI if short GI was used on

New FW reports usage of short GI as a rate class index. Check for
this rate and set the IEEE80211_TX_RC_SHORT_GI if used.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
d2e2d769e3d328ba7cbf08e8ed85e3f817915843 31-Jan-2012 Pontus Fuchs <pontus.fuchs@gmail.com> wl12xx: Set IEEE80211_TX_RC_MCS on MCS rates on TX complete.

IEEE80211_TX_RC_MCS was not set correctly leading to incorrect link
speed calculation.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2801d69e84d04714c22f8cc22fbe8535ac5f1eb7 24-Jan-2012 Eliad Peller <eliad@wizery.com> wl12xx: remove wl1271_tx_update_filters

wl1271_tx_update_filters() is used as some workaround
to open filters while roaming on the same channel.

However, it doesn't handle roaming to a different channel,
and it might also sleep in the tx path, which is a bug.

With the new auth/assoc redesign, roaming is much simpler,
and this function is not needed anymore.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
5de8eef4fdd2044f6981ebf62330720bcdba8ee3 13-Dec-2011 Eliad Peller <eliad@wizery.com> wl12xx: use ieee80211_free_txskb()

Use the newly introduced ieee80211_free_txskb() instead
of dev_kfree_skb() for failed tx packets.

Additionally, if the skb is a dummy packet, re-enqueue
it (as the fw expects it) instead of freeing it.

Reported-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
cf00f379d82d170712150588accd2ebe316c2226 08-Dec-2011 John W. Linville <linville@tuxdriver.com> wl12xx: silence tx_attr uninitialized warning in wl1271_tx_fill_hdr

CC [M] drivers/net/wireless/wl12xx/tx.o
drivers/net/wireless/wl12xx/tx.c: In function ‘wl1271_tx_fill_hdr’:
drivers/net/wireless/wl12xx/tx.c:288:6: warning: ‘tx_attr’ may be used uninitialized in this function

Signed-off-by: John W. Linville <linville@tuxdriver.com>
e0d62536d032db689adf9c8162a9d2caf4714f44 08-Nov-2011 Eliad Peller <eliad@wizery.com> wl12xx: don't explicitly check for unjoined ibss

After the ibss carrier issue was fixed, we can revert
the following patch:

commit 48309fd477ef867babb6819f67fe082c133a5fa9
Author: Shahar Lev <shahar@wizery.com>
Date: Fri Oct 7 18:17:25 2011 +0200

wl12xx: remove warning message during IBSS Tx

mac80211 sets the carrier on an IBSS interface even when no network is
joined. Ignore garbage frames transmitted on a disconnected IBSS
interface without printing warnings.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
8a0f2ee37810aa4a4f46baf08b2ad587e138eb58 01-Nov-2011 Eliad Peller <eliad@wizery.com> wl12xx: use p2p rate index when the skb has the NO_CCK flag

If the skb contains the NO_CCK flag, use the p2p rate index
(which contains only the OFDM rates)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
ce39defb5c6312a89a0c7be48797d6fb8fe9abad 03-Nov-2011 Luciano Coelho <coelho@ti.com> wl12xx: change blocksize alignment quirk to negative

SDIO blocksize alignment support is now the rule, not the exception.
To simplify the code in patches to come, invert the meaning of the
quirk to be negative (ie. the quirk is set if the device does _not_
support blocksize alignment).

Signed-off-by: Luciano Coelho <coelho@ti.com>
679a673414473239d189b5b41ea4014b088be7b9 11-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: couple role_start_dev with roc

Device role is always started along with ROC.
Couple them together by introducing new wl12xx_start_dev
and wl12xx_stop_dev functions.

By using these functions, we solve a bug that occured during
channel switch - we started the dev role on one channel, and
ROCed on a different one.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
0f1680147ce2509383e053fa843020e0e9f3c6ce 11-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: handle injected packets

Injected packets are sent with no vif, causing the wl12xx
to NULL-dereference in multiple places.

Furthermore, injected packets are currently not sent at all,
as system_hlid doesn't belong to any specific role, so
wl1271_skb_dequeue() never return its packets.

Handle both these problems.

Reported-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
48309fd477ef867babb6819f67fe082c133a5fa9 07-Oct-2011 Shahar Lev <shahar@wizery.com> wl12xx: remove warning message during IBSS Tx

mac80211 sets the carrier on an IBSS interface even when no network is
joined. Ignore garbage frames transmitted on a disconnected IBSS
interface without printing warnings.

Signed-off-by: Shahar Lev <shahar@wizery.com>
[merged with wlvif changes]
Signed-off-by: Luciano Coelho <coelho@ti.com>
0f4e31222a2c0b93f25a87effd2033cb78c7a79c 07-Oct-2011 Luciano Coelho <coelho@ti.com> wl12xx: move debugging definitions to a separate file

Separate the debugging macros and other definitions to a new debug.h
file. This is be needed because the sdio and spi modules don't need
to depend on the wl12xx module anymore, but still need to include
wl12xx.h. Currently they do depend on it, because of the debugging
global that wl12xx exports. A future patch will remove this
dependency.

Signed-off-by: Luciano Coelho <coelho@ti.com>
e4120df982c2051f3cfc02f6278798c5166a72f8 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: use round-robin policy for tx

Currently, a single vif might starve all the other vifs.
Save the last vif we dequeued a packet from, and continue
with the following one using a round-robin policy.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
e5a359f873f50cc123d5ca97637caa30fa095bb9 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: use dynamic rate policies

allocate the rate policies dynamically, instead of using hardcoded
indexes. this is needed for proper multi-role configuration.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
6e8cd3310491b10db20d0f7eaf5713b05fa7b753 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: replace all remaining wl->vif references

wl->vif is appropriate only when a single vif is being used.
Instead, pass wlvif as parameter or iterate through all
the vifs (e.g. when a global configuration was changed)

Leave wl->vif only to determine whether a vif was already
added (this check will be removed as well after both the
driver and fw will support multiple vifs)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
1b92f15ee0e0f06222d4fd36dc36960d217243b3 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: add band field to wlvif

add band field into the per-interface data.

mac80211 configures some values (e.g. band, channel)
globally, while we configure them per-interface.

In order to make it easier to keep track of the
configured value for each value while keeping sync
with mac80211, save these values both globally
and per-vif.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
0744bdb60b51dce54553d5af9a6133f1fe419032 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: make WL1271_FLAG_RX_STREAMING_STARTED flag per-vif

This flag should be set per-vif, rather than globally.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
53d40d0b863e22b697f8d85e1f95cb6f9d2d95b1 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: make WL1271_FLAG_AP_STARTED flag per-vif

This flag should be set per-vif, rather than globally.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
eee514e3d6cecc7abdf1b27734169004fefb0941 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: make WL1271_FLAG_IBSS_JOINED flag per-vif

This flag should be set per-vif, rather than globally.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
ba8447f64159927baf673d827e404605471d8f68 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: make WL1271_FLAG_STA_ASSOCIATED flag per-vif

This flag should be set per-vif, rather than globally.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
9eb599e9c62dcfd4efece1936c385381b366b684 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: rearm rx streaming per vif

Currently, the rx streaming doesn't support multi-vif
(the actual wlvif is taken from wl->vif, and the management
is global).

Make the rx streaming timers/works per-vif, and pass the
the actual vif as param.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
48e93e402ad19f570bae323b07911bdf6562af8e 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move tx_security_seq into wlvif

The last security seq num has to be saved across reconfigs.
Add a new "persistent" struct into wlvif, which won't get
deleted on wl12xx_init_vif_data()

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
a32d0cdfcb7e5d41f210e13cbc78dc86a5a85a08 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: support multiple vifs in the tx path

Pass the wlvif associated with each skb as param.

Note that dummy packet doesn't belong to any
particular vif, so we pass NULL in this case.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
d6a3cc2ef962ad4392a2401cae513a18a6d35099 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: unify STA and AP tx_queue mechanism

Make sta use the global wl->links[hlid].tx_queue (by
considering its links map) instead of wl->tx_queue,
and then unify the tx and tx_reset flows for the
various vifs.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
4438aca9e16901d8d32a025ca27ad8284a117e09 10-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move last_tx_hlid into wlvif

move last_tx_hlid into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
c7ffb902cca655e4d6bdda4156407008573bb214 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move ap_hlid_map into wlvif.ap

Add wlvif->links_map bitmap to represent all the links
allocated for this vif.

AP vif also has a sta_hlid_map bitmap, which represents
the links stations connected to it (sta_hlid_bitmap is
a subset of wlvif->links_map, which itself is a subset
of the global wl->links_map)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
d0802abdf9c60b1dadb097e806022f3449b0cc6b 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move ba fields into wlvif

move ba_fields into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
f75c753f3c77b758fa5ace90c15b2ea3b7a3d46d 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move default_key into wlvif

move default_key into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
afaf8bdb2b08bbf493b03757243821df72b26c53 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move dev_hlid into wlvif

move dev_hlid into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
98b8625301e55bd3e4340f704edc378e4707e577 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move session_counter into wlvif

move session_counter into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
a8ab39a4b588e8523be2fa75671bdc9612d3467a 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move ap_global_hlid and ap_bcast_hlid into wlvif

move ap_global_hlid and ap_bcast_hlid into the per-interface
data, rather than being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
154da67c7da14ffd8da292394f8cbc81cc5ea4e3 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move sta_hlid into wlvif

move sta_hlid into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
7edebf56ca424484b9e0e51a6188c93c7fdd3a41 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move dev_role_id into wlvif

move dev_role_id into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
536129c8ad35de87ff2f864f205a54ac32bfebcc 05-Oct-2011 Eliad Peller <eliad@wizery.com> wl12xx: move bss_type into wlvif

move bss_type into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
af7fbb28efff0c0d8fc0852ad6622e5437a7611e 19-Sep-2011 Eliad Peller <eliad@wizery.com> wl12xx: implement set_bitrate_mask callback

Save the configured bitrate, and use the min allowed rate
as the basic rate (e.g. when scanning).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
df4c849f4608e8962f019fea6021ebd602a11641 15-Sep-2011 Eliad Peller <eliad@wizery.com> wl12xx: Use dev_hlid for auth and assoc req

On roaming, the auth and assoc req are sent with the sta
hlid. This is wrong, as the sta hlid is configured according
to the old ap. Use the dev_hlid instead.

Move the wl1271_tx_update_filters() call into wl1271_tx_get_hlid(),
so wl->dev_hlid will be valid.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
f1acea9a9d48174f982e14a7a488b208d39d825f 24-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: AP mode - clean BA and queue state in tx_reset

Reset the BA state of all connected stations and explicitly clear the
Tx queues. The latter is needed for clearing dummy packets from
tx_queue_count.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
da03209eaca9302e110925f84a515e03062aaa9e 24-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: don't regulate links when a single STA is connected

When operating as AP track the number of connected stations. When a
single STA is connected don't regulate the PS status of the link.
Since this is the only STA connected, there's no point holding space in
FW for other links. This will speed up communications with a single
connected STA in PSM.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
56d4f8f685c073c7ed7203b78c57f5d893d65102 24-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: AP mode - don't regulate FW blocks for non-active STAs

Check a STA is associated before regulating its PS-status in mac80211.
Should never happen, so warn as a precaution.

[Small cosmetic change wrt Kalle Valo's comment. -- Luca]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
f8e0af6b8732b47c2531a280753d29a4ca2d114b 24-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: don't indicate up PS-filtered dummy packets

Dummy packets are currently only sent on the system_hlid link. The
system_hlid link should never be filtered for PS (as it is not
a STA link). Even so, for correctness, don't indicate dummy packets up.
The skb does not belong to mac80211 and as such does not contain a
correct skb->cb.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
04907011d59101b508b1c4258f2731fd8f6b6c0a 19-May-2011 Luciano Coelho <coelho@ti.com> wl12xx: remove deprecated CONFIG_WL12XX_HT flag

The driver now support HT properly, so we can always have HT enabled.

Remove the WL12XX_HT configuration.

Signed-off-by: Luciano Coelho <coelho@ti.com>
e9eb8cbe77139470651c858b8b7a3d20d332cf47 16-Aug-2011 Guy Eilam <guy@wizery.com> wl12xx: use 2 spare TX blocks for GEM cipher

Add tx_spare_blocks member to the wl1271 struct
for more generic configuration of the amount
of spare TX blocks that should be used.
The default value is 1.
In case GEM cipher is used by the STA, we need
2 spare TX blocks instead of just 1.

Signed-off-by: Guy Eilam <guy@wizery.com>
Acked-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
9b17f1b371c5aa5179b3e5392bc22132a3371da4 14-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: enable AP advanced functionality

This adjusts FW TX block allocation for connected stations in PS.
Firmware congestion is measured in allocated packets instead of blocks.

Allow a link in PS to queue up to 2 packets to the FW.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
742246f8bc16c3a1a556c68ca2fabca162d14c24 14-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: schedule TX packets according to FW packet 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: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
bf54e301671a6ece6c94550294dc7faf14158cd3 14-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: track freed packets in FW by AC

Track the number of freed packets in each AC when receiving an interrupt
from the FW. This paves the way for tracking allocated packets per AC.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
227e81e18422851901b9de11c5955d292c4a47fc 14-Aug-2011 Eliad Peller <eliad@wizery.com> wl12xx: support IBSS vif type

Start IBSS role when the interface type is IBSS.
As with sta role, use the dev role until the role
is started.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
e51ae9be2e313b63a43f1f93578d9a71d38a77ea 14-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: use dynamic hlids for AP-mode

Using hlid=0 in AP mode is a bug. Dynamically allocate HLIDs.

Set the "first sta hlid" as 3. This will have to be changed
when multiple vifs will be supported.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
251c177f886027fbce494202e44935762f103137 14-Aug-2011 Eliad Peller <eliad@wizery.com> wl12xx: replace dummy_join with ROC/CROC commands

The ROC command asks the fw stay on the channel of the given
hlid. it currently has 2 primary functions:

1. Allow tx/rx from the device role.

In order to tx/rx packets while the stations is not associated
(e.g. auth req/resp), the device role has to be used, along
with ROC on its link.

Keep the logic similiar to the one used in dummy_join. However,
since we can't scan while we ROC, we add CROC before starting
a scan, and ROC again (if needed) on scan complete.

2. Keeping the antenna for a specific link.

We ROC until the connection was completed (after EAPOLs exchange)
in order to prevent BT coex operations from taking the antenna
and failing the connection (after this stage, psm can be used).

During association, we ROC on the station role, and then CROC
the device role, thus assuring being ROC during all the connection
process.

Delete the WL1271_FLAG_JOINED flag, and use a roc bitmap
to indicate what roles are currently ROCed.

Add wl12xx_roc/croc functions in order to wrap the roc/croc
commands while taking care of the roc bitmap.

The current ROC/CROC state-machine is a bit complicated. In
the future we'll probably want to use wpa_supplicant to control
the ROC during connection.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
79ebec76be4e7c2ebed9fb0b9510d10d599ed63e 14-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: handle dummy packet event also in ap mode

Allow handling of DUMMY_PACKET_EVENT_ID also in ap mode.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
f4df1bd525e027aa1975e00f87a420aec7bef4e0 14-Aug-2011 Eliad Peller <eliad@wizery.com> wl12xx: add system_hlid

system_hlid is a const hlid (always 0), used by the fw and driver
for packets which are not bound to specific role (e.g. dynamic
memory packets).
indicate it as always allocated.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
79b122dc51797b650201f21360481a0450e9b7e4 14-Aug-2011 Eliad Peller <eliad@wizery.com> wl12xx: update rx/tx

Update the rx/tx descriptors according to the new fw api
(fw >= 6/7.3.0.0.75)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
c690ec816f9fa2ab2b6200c5b79b6933acca49a4 14-Aug-2011 Eliad Peller <eliad@wizery.com> wl12xx: update commands & events

Change the commands and events according to the new fw api
(fw >= 6/7.3.0.0.75).

The main change is the replacement of JOIN/DISCONNECT commands,
with ROLE_START/ROLE_STOP commands.

The use of these commands should be preceded by the ROLE_ENABLE
command (allocating role resources), and followed by the
ROLE_DISABLE command (freeing role resources).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
08c1d1c7042330e2280a7718be4ad88c2e8f8268 14-Aug-2011 Eliad Peller <eliad@wizery.com> wl12xx: remove rx filtering stuff

The new fw doesn't support rx_filtering configuration (as a
stand-alone command. the rx filtering is done automatically
according to the active role).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
dbe25cb5eb04b0ffdad582a93f9fe9edd0ed791b 14-Aug-2011 Eliad Peller <eliad@wizery.com> wl12xx: temporarily disable advanced ap functions

In order to keep to driver compiling during the patchset,
while avoiding one-huge-patch, temporarily disable some
advanced ap functions.

These changes will be reverted later in the patchset, as
part of the patches for advanced ap functions support.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2920743a14764eda099700e1eca9a282393cee16 14-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: use 1 spare block in all cases

Remove support for firmwares that require 2 spare blocks for packet TX
(and delete the WL12XX_QUIRK_USE_2_SPARE_BLOCKS quirk definition)

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
7bb5d6ce9e6ebb3bb71915cb0224523d3c284b4f 14-Aug-2011 Arik Nemtsov <arik@wizery.com> wl12xx: Revert "wl12xx: schedule TX packets according to FW occupancy"

This does not make sense in fw >= 6/7.3.0.0.75 (wl127x/wl128x) -
we don't use Tx blocks to measure FW occupancy anymore.

This reverts commit 9e374a37b6fa2310b71d3c5657cd0c1e693120c6.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
f1a46384ad568f72c11edbe2a3ec284bf32f2dbd 07-Jul-2011 Arik Nemtsov <arik@wizery.com> 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>
708bb3cf58a9bc90f3171ba64f30601f690e5aaa 24-Jun-2011 Arik Nemtsov <arik@wizery.com> 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>
9e374a37b6fa2310b71d3c5657cd0c1e693120c6 24-Jun-2011 Arik Nemtsov <arik@wizery.com> 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>
fae2fd767e9d380ed0d05e4a5d6b1673e2c2d3df 26-Jun-2011 Arik Nemtsov <arik@wizery.com> 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>
b992c68228a3ccdf73ea4f57519e1663839a9cbe 26-Jun-2011 Oz Krakowski <ozk@ti.com> 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>
92ef8960aee2f840c6a54c968d40199843f015c0 06-Jun-2011 Eliad Peller <eliad@wizery.com> 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>
c27d3accb6f06b0afedfe472dfe0c8e7d87ff0a6 07-Jun-2011 Eliad Peller <eliad@wizery.com> 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>
77ddaa108f727b5ef3be004b952d2c3d3ffc48e5 15-May-2011 Eliad Peller <eliad@wizery.com> 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>
7dece1c8e1044287287d44ac183a946333b55fc3 18-Apr-2011 Arik Nemtsov <arik@wizery.com> 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>
ef2e3004855e90d2919105e4a91d7df6ab9845a9 18-Apr-2011 Ido Yariv <ido@wizery.com> 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>
c75bbcdb200e2815c855e42a4685d170858af306 04-Apr-2011 Eliad Peller <eliad@wizery.com> 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>
d2f4d47d84f8c665ab9babb2cc84d2e7872a96e1 31-Mar-2011 Ido Yariv <ido@wizery.com> 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>
990f5de7384f9e5922e4c7c7572cbf4f29a9441e 31-Mar-2011 Ido Yariv <ido@wizery.com> 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>
0da13da767cd568c1fe2a7b5b936e86e521b5ae7 31-Mar-2011 Ido Yariv <ido@wizery.com> 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>
c5745187a4812f2991a58e469a866582a7326d91 30-Mar-2011 Ohad Ben-Cohen <ohad@wizery.com> 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>
c1b193eb6557279d037ab18c00ab628c6c78847f 23-Mar-2011 Eliad Peller <eliad@wizery.com> 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>
18b92ffaf33c862e852992e82e17b9fffca8d5a4 21-Mar-2011 Luciano Coelho <coelho@ti.com> 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>
db674d249c1fa20fd6731048f41646b3a2e8bdf5 16-Mar-2011 Eliad Peller <eliad@wizery.com> 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>
e7ddf549f3f2da156f5c12921e6699024e80a3f4 10-Mar-2011 Luciano Coelho <coelho@ti.com> 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>
ae47c45fd02fdf88d57adc370e78e7a01e2bfcbc 06-Mar-2011 Shahar Levi <shahar_levi@ti.com> 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>
ae77eccf04f8c36769bdba334e1bbcc7bb9d3644 06-Mar-2011 Shahar Levi <shahar_levi@ti.com> 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>
48a61477bdc04896bd96d259388a0c42a7019943 06-Mar-2011 Shahar Levi <shahar_levi@ti.com> 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>
a620865edf62ea2d024bbfe62162244473badfcb 01-Mar-2011 Ido Yariv <ido@wizery.com> 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>
606ea9fa0b2c01ffafb6beae92ea8e2b1473520b 01-Mar-2011 Ido Yariv <ido@wizery.com> 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>
50e9f746f63c9b881f2ca4a35dbdfd34b1a8a215 27-Feb-2011 Ido Yariv <ido@wizery.com> wl12xx: Remove private headers in wl1271_tx_reset

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>
b622d992c21a85ce590afe2c18977ed28b457e0e 22-Feb-2011 Arik Nemtsov <arik@wizery.com> wl12xx: AP-mode - management of links in PS-mode

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>
09039f42a24084c10e7761ab28ef22932c62a46f 22-Feb-2011 Arik Nemtsov <arik@wizery.com> wl12xx: AP-mode - count free FW TX blocks per link

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>
1d36cd892c130a5a781acb282e083b94127f1c50 22-Feb-2011 Arik Nemtsov <arik@wizery.com> wl12xx: report invalid TX rate when returning non-TX-ed skbs

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>
a8c0ddb5ba2889e1e11a033ccbadfc600f236a91 22-Feb-2011 Arik Nemtsov <arik@wizery.com> wl12xx: AP-mode - TX queue per link in AC

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>
99a2775d02a7accf4cc661a65c76fd7b379d1c7a 22-Feb-2011 Arik Nemtsov <arik@wizery.com> wl12xx: AP-mode - fix race condition on sta connection

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>
02ad2d9080266e6d999c00b78610ef6a45be45ea 22-Feb-2011 Eliad Peller <eliad@wizery.com> wl12xx: use standard ALIGN() macro

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>
72c2d9e511846a4f2759389b38ed8a5553579eb3 02-Feb-2011 Eliad Peller <eliad@wizery.com> wl12xx: set supported_rates after association

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>
1d4801f2689dc2618fdb5e83d4cb7743747491ed 16-Jan-2011 Eliad Peller <eliad@wizery.com> wl12xx: fix some endianess bugs

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>
7f179b468963564aa3faa5729fb3153c08b3d7c1 16-Oct-2010 Arik Nemtsov <arik@wizery.com> wl12xx: AP mode - encryption support

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>
c6c8a65de6d3aa8daa93beeac390f49a21d0be36 16-Oct-2010 Arik Nemtsov <arik@wizery.com> wl12xx: AP mode - changes in TX path

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>
e0fe371b74326a85029fe8720506e021fe73905a 16-Oct-2010 Arik Nemtsov <arik@wizery.com> wl12xx: AP mode - init sequence

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>
98bdaabbbced007c7eb89cd373f9cb1640635b46 16-Oct-2010 Arik Nemtsov <arik@wizery.com> wl12xx: AP-mode high level commands

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>
79b223f4c7ce35fba145c504de12be030cc0007e 16-Oct-2010 Arik Nemtsov <arik@wizery.com> wl12xx: AP mode - AP specific CMD_CONFIGURE sub-commands

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>
6742f554db14da94172da9eb1875a1aa944a827f 13-Dec-2010 Juuso Oikarinen <juuso.oikarinen@nokia.com> wl12xx: Change TX queue to be per AC

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>
00d201001bd4e8a46e3d03c970abcb72256c368b 08-Nov-2010 Shahar Levi <shahar_levi@ti.com> wl1271: Change wl12xx Files Names

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>
9f2ad4fb52916e58a1b75e9a30f42638655932d3 12-Jun-2009 Juuso Oikarinen <juuso.oikarinen@nokia.com> wl12xx: Moved wl1251 TX path implementation into chip specific files

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>
2f01a1f58889fbfeb68b1bc1b52e4197f3333490 29-Apr-2009 Kalle Valo <kalle.valo@nokia.com> wl12xx: add driver

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>