mac80211: fix network header location when adding encryption headers

Update the location of the network header when adding encryption
specific headers to a skb. This allows low-level drivers to use the
(now correct) location of the network header.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: use psd_type indexing according to spec

In ieee80211.h the uapsd bit mask is defined such that
VO=BIT(0), VI=BIT(1), BK=BIT(2), BE=BIT(3).
The firmware uses the indexing as defined in the ieee80211
spec, meaning that VO=3, VI=2, BK=1, BE=0.

In AP mode when adding peer wlcore needs to convert
the indexing accordingly.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
wl12xx: set the irq polarity before loading the fw

The polarity should be set before the firmware is loaded
since the firmware touches the same register. Access
of the firmware and driver to the same register will
cause a collision since there is no exclusion scheme.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
wlcore: fix the CONF_TX_AC_ANY_TID to be 0xff

In the enum conf_tx_ac CONF_TX_AC_ANY_TID should
be 0xff to match the firmware's implementation.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
wlcore: flush tx on CHANGE_CHANNEL

On CHANGE_CHANNEL indication, we should flush all the
queued tx frames, so they will be sent on the correct
(current) channel.
wlcore: increase WL1271_EVENT_TIMEOUT

In some cases, the ROC_COMPLETE event might exceed the
current timeout (750 msec). Increase it to 1 sec.

Signed-off-by: Eliad Peller <eliad@wizery.com>
wlcore: remove duplicate BUG_ON during recovery

This BUG_ON also ignored the INTENDED_FW_RECOVERY flag. This would
result in a BUG() when using the bug_on_recovery module parameter during
multi-role.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: fix sparse warnings related to static functions

The "static" modifier was mistakenly forgotten for some functions.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl12xx: use the original elp time in forced_ps mode

The dynamic PS timeout is meaningless in forced PS mode.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: fix dynamic_ps_timeout time regression

In patch d7b63b9fc7ee73e75a4c7fdb899 we have raised the dynamic
PS timeout to 200ms to improve user experience. Re-apply the change,
since it was reverted in the wlcore split.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: increase Tx spare size only for GEM encrypted packets

When allocating FW Tx spare blocks, consider the cipher used for this
skb. GEM packets require 2 spare blocks.
This is a change from globally requiring 2 spare blocks when a GEM cipher
is configured for any interface.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: fixes for connection_loss_work

We can't use cancel_delayed_work_sync() from functions that take the
wl->mutex, since connection_loss_work also takes the mutex. This might
result in a deadlock. Restructure the code so the work is synchronously
canceled before taking the mutex.
Avoid a bug where we would indefinitely delay the connection loss
indication by re-queuing the connection loss work on consecutive beacon
loss events.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: use correct link for bcast/multicast frames

Multicast management frames (e.g. global deauth)
should be sent out on the bcast link, rather than
the global, which should be used only for pre-added
stations (e.g. for auth/assoc resp).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
wlcore: flush before stopping AP

Make sure the deauth bcast gets sent

[Make sure we are AP as well before the flush - Arik]

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: modify bss loss parameters

Modify default parameters to reduce firmware BSS lose
probability in congested environment.

[Applied to 18xx configuration as well - Arik]

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: increase number of BA sessions to 3

With the new FW (sigle role X.3.8.0.108, multi role X.5.4.0.21)
we are supporting 3 RX BA sessions, this change is to support this
new ability.

Signed-off-by: Assaf Azulay <assaf@ti.com>
wlcore: Fix sdio out-of-sync power state

wl1271_sdio_power_off() manually powers down the card, regardless of the
runtime pm state. If wl1271_sdio_power_on() is called before the card
was suspended by runtime PM, it will not power up the card.

As part of the HW detection, the chip's power is toggled. Since this
happens in the context of probing sdio, the power reference counter will
be higher than zero. As a result, when wl1271_sdio_power_off() is
called, the chip will be powered down while still having a positive
power reference counter. If the interface is quickly activated, the
driver might try to transfer data to a powered off chip.

Fix this by ensuring that wl1271_sdio_power_on() explicitly powers on
the chip in case runtime pm claims the chip is already powered on.

Also verify that the chip is indeed powered on before powering off, to
avoid wrong reference counter values in error cases.

Signed-off-by: Ido Yariv <ido@wizery.com>
wl18xx: add dependency on mac80211

Add a dependency on mac80211 in Kconfig, and also replace some spaces
with tabs.

Reported-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: set wl->ht_cap per-band

Save the ht_cap IE per-band, so we can configure different
params to BG and A bands (we currently don't support MIMO
on A band)

[Small fix for rx_highest - Arik]

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl18xx: release OCP bridge (yield issue) (INTERNAL)

Some PDSP Registers wake up value is such that OCP
bridge is stuck, this happens randomly.
Toggle BT and PHY reset till OCP is free during boot.

Signed-off-by: Orit Brayer <orit@ti.com>
Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>