wlcore: re-enable idle handling

We need some stuff done on idle change, most notably we have to stop
sched-scanning. Take care of this be reintroducing idle handling.
While at it, fix a bug where we would send sched_scan_stopped() up
before getting an event about stopping it from FW.

Signed-off-by: Arik Nemtsov <arik@wizery.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>
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>
mac80211: RX BA support for sta max_rx_aggregation_subframes

Normally rx ba buff size is limited by a max limitation set by the driver
with local->hw.max_rx_aggregation_subframes. This is the max aggregation
'win_size' supported by the chip.

This fix adds max_rx_aggregation_subframes field to sta->sta. This field
is initialy set to local->hw.max_rx_aggregation_subframes and is used
by addba_req routine. The driver/chip can choose to change this value
causing stop of existing ba sessions and effectivly forcing new ba sessions
(on this link) to be restricted by the new value.

This capability is usefull in cases of IOP, i.e. cases where peer sta
or ap doesn't respect the max subframes in a single-frame and uses the
max win_size instead. In these cases the driver/chip may recover by
decreasing the win_size to use the single frame limitation.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
wlcore: ACX_BA_SESSION_RX_SETUP win_size taken from sta

Now that max_rx_aggregation_subframes (BA RX win size) is stored in the
mac per active link (and not only per chip), use the link (sta) value
when passing the win_size to firmware through the ACX_BA_SESSION_RX_SETUP
command.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event

This event is used by the Firmware to limit the RX BA win size
for a specific link.

The event handler updates the new size in the driver's link struct
and in the mac's sta->sta struct accordingly and closes all active BA
sessions for that link.

Conseqent BA sessions opened for that link will use the new restricted
win_size. This limitation remains until a new update is received or
until the link is closed.

This solves an IOP bug with APs that don't respect the max subframes in
a single-frame and uses the max win_size instead. In these cases the FW
recovers by sending this event to decrease the win_size to use the single
frame limitation.

Update the min fw version accordingly to 8.6.0.0.1

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
wl18xx: increase the number of allowed BA sessions

Starting from fw 8.5.0.0.58, WL18XX_RX_BA_MAX_SESSIONS
was increased to 8..

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
wlcore: send EAPOL frames with voice priority

Send EAPOL frames with voice priority by setting TX_HW_ATTR_EAPOL_FRAME
new bit in tx attribute. Sending EAPOL with voice priority fixes
re-key timeout during heavy traffic issue.

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
wl18xx: update chip ROM version mask and offset

This should properly handle new PG 2.2 devices.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
wlcore: optimize scan debug prints

Remove scan debug dumps which are rarely used.
Make scan debug prints clear and short.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
wlcore: don't bail out when beacon/probe resp are missing

On ap initialization, the ap rates are configured before
the beacon and probe-response are configured.

Trying to set the beacon/probe-response in this stage
results in bailing out from wl1271_bss_info_changed_ap,
before all the configurations took place.

Identify this case by checking explicitly for -ENOENT
return value when configuring the beacon/probe-response.

Signed-off-by: Eliad Peller <eliad@wizery.com>
wlcore: fix unsafe dereference of the wlvif

wlvif could be passed as NULL from the wlcore_tx_work_locked()
to the wl1271_prepare_tx_frame() and to wl1271_skb_queue_head()
functions. This may lead to a Kernel panic, fix this by
validating that wlvif != NULL.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
wlcore: fix regulatory domain bit translation

This is a fix for channels 52,56,60,64 bit translation.

Reported-by: Yaniv Machani <yanivma@ti.com>
Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Victor Goldenshtein <victorg@ti.com>
wl18xx: fix boot process in high temperature environment

In addition to existing WCS PLL configuration add and enable
also the coex PLL during init phase. This fixes boot failures
due to silicon latchup in high temperature environment (>85c).

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>
wl18xx: print new RDL versions during boot

Extract and print info for the new RDL 5, 6, 7 and 8.
Replace const struct with function which translates
the RDL number to string.

Signed-off-by: Victor Goldenshtein <victorg@ti.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.

Signed-off-by: Ido Yariv <ido@wizery.com>
wlcore: always register dummy hardirq

This keeps the kernel happy when using edge-irqs and requesting a
threaded irq.

Signed-off-by: Arik Nemtsov <arik@wizery.com>