wlcore: don't switch channels on disconnected STA vifs

Sending the FW a channel switch command on a disconnected vif may result
in a beacon loss event. Avoid this edge case.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
mac80211: reject BA action frames if sent fron non HT STA [INTERNAL]

The FW doesn't work well with BA sessions started from non 802.11n
STAs. Reject these as a work around until the FW issue is fixed.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
mac80211: deny ADDBA on VO AC TIDs

Avoid Rx BA on TID 6 and 7 to prefer lower latency
on VO AC instead of higher throughput.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
mac80211: extract basic rates on start_ap

On ap start, the beacon is configured while
the basic rates were not set yet (they are
set only later by userspace).

Since sometimes it's important to know
the supported rates before we start
beaconing (e.g. 11a, p2p), parse the beacon
and configure the bss_conf with the correct
basic rates, according to the supported_rates
and ext_supported_rates ies.

Signed-off-by: Eliad Peller <eliad@wizery.com>
mac80211: fix delayed ADDBA response

Block frame processing during scan might delay the
ADDBA response, which eventually timeouts and
significantly reduces the device throughput.
Remove this constrain as it's not required for the
HW scan.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
mac80211: use freezable workqueue for restart work

Requesting hw restart during suspend might result
in the restart work being executed after mac80211
and the hw are suspended.

Solve the race by simply scheduling the restart
work on a freezable workqueue.

Signed-off-by: Eliad Peller <eliad@wizery.com>
mac80211: use legacy mode for all ACs [INTERNAL]

AVM FritzBox 7390 has a weird behaviour where once we enable
U-APSD only on the VO AC it limits the rate of the packets
it sends to 39Mbps and doesn't do AMPDU aggregation.
This causes a big degradation in throughput obviously.
It's important to note that this isn't related to PS and happens
also when ACTIVE is forced. The traffic affected is sent in BE AC.
Once legacy mode for all ACs is used the AP begins using higher rates
as well as AMPDU aggregation which improves throughput significantly.

In order to deal with this AP and potentially others switch to
using legacy mode for all ACs by default.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
mac80211: implement STA CSA for drivers using channel contexts

Limit the current implementation to a single channel context used by
a single vif, thereby avoiding multi-vif/channel complexities.

Reuse the main function from AP CSA code, but move a portion out in
order to fit the STA scenario.

Add a new mac80211 HW flag so we don't break devices that don't support
channel switch with channel-contexts. The new behavior will be opt-in.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: add support for STA CSA with chan contexts

TI wl12xx/wl18xx cards support channel switch via a driver specific
switch_channel op while operating with channel contexts.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: Add support for DT platform data

When running with DT, we no longer have a board file that can set up the
platform data for wlcore. Allow this data to be passed from DT.

Since some platforms use a gpio-irq, add support for passing either the
irq number or the gpio number. For the latter case, the driver will
request the gpio and convert it to the irq number. If an irq is
specified, it'll be used as is.

[Arik - the pdev_data pointer does not belong to us and is freed when
the device is released. Dereference to our private data first.]

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: don't allocate platform_data for platform device

The memory is managed by the platform device which takes ownership of it
when platform_device_add_data() is called. Our memory is simply leaked.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: add counters with reasons for aggr packet sending (DEBUG)

Count the reasons that triggered us to send the buffer to the firmware
for transmission.  Count buffer_full, fw_buffer_full, other reasons
and no_data left to send.

This is useful when debugging throughput issues.

To have a better understanding of what is going on in the TX data
path, we can count the number of times we sent n packets.  For
example, if we sent 10 times aggregations of 2 packets, we print [2] =
10.

Instead of counting the reasons as an overall value, we count the
reasons for each number of packets used in the aggregation.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
wlcore: add avg Tx aggregation size to debugfs [DEBUG]

This helps determine if we are sending traffic efficiently over the bus.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: add tx/rx number of packets per interrupt to debugfs [DEBUG]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: debugfs: avg number of loops in wlcore_irq [DEBUG]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: debugfs: allow changing tx pacing settings [DEBUG]

This is helpful for tweaking settings for new platforms

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: allow setting min req rx blocks in debugfs [DEBUG]

Also fix IRQ timeout in debugfs (related to Rx irq pacing).

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: add wake_locks (ANDROID)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: acquire a wakelock in the hardirq only on wake up (ANDROID)

This wakelock doesn't seem to protect against a reoccurring race, but only
cases in which the system starts suspending after the hardirq was serviced but
prior to the threaded irq. This is not very likely and being handled by
flushing the interrupts in the suspend op.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: set "any" trigger by default (ANDROID)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>