wlcore: don't get the hlid from a queued skb

There was a bug hiding here since the hlid was sometimes inferred from
the sta, which might be invalid at this point.

Instead, propagate the hlid from the skb-queue where we got the skb
in the first place.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: op_tx: pass sta explicitly when inferring frame hlid

avoid using the skb CB for getting the appropriate sta.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl18xx: update default phy configuration for pg2

default switch configuration set to pg2 chips (rdl 1/2/3/4).
removed hacks for specific board types.
pg1.x boards are now supported only using module params
or specific conf files.

Signed-off-by: Ido Reis <idor@ti.com>
wlcore: consider single fw case

When a single fw is being used for both single-role
and multi-role cases (e.g. 18xx), wl->mr_fw_name is
NULL, which results in NULL dereference while trying
to load the multi-role fw.

In this case, always use the single-role fw, and avoid
redundant fw switch by checking for this case in
wl12xx_need_fw_change() as well.

Signed-off-by: Eliad Peller <eliad@wizery.com>
wlcore: Prevent interaction with HW after recovery is queued

When a function requests to recover, it would normally abort and will
not send any additional commands to the HW. However, other threads may
not be aware of the failure and could try to communicate with the HW
after a recovery was queued, but before the recovery work began.

Fix this by introducing an intermediate state which is set when recovery
is queued, and modify all state checks accordingly.

Signed-off-by: Ido Yariv <ido@wizery.com>
mac80211: don't clear sched_scan_sdata on sched scan stop request

ieee80211_request_sched_scan_stop() cleared
local->sched_scan_sdata. However, sched_scan_sdata
should be cleared only after the driver calls
ieee80211_sched_scan_stopped() (like with normal hw scan).

Clearing sched_scan_sdata too early, caused
ieee80211_sched_scan_stopped_work to exit prematurely
without properly cleaning all the sched scan resources,
and without calling cfg80211_sched_scan_stopped (so
userspace wasn't notified about sched scan completion).

Signed-off-by: Eliad Peller <eliad@wizery.com>
wl18xx: increase rx_ba_win_size to 32

The new FWs support a bigger BA window.

Signed-off-by: Ido Reis <idor@ti.com>
wlcore: cancel recovery_work on stop() instead of remove_interface()

recovery_work should be cancelled when stopping the device,
not when removing an interface (this is probably a leftover
from the single-role days)

Signed-off-by: Eliad Peller <eliad@wizery.com>
wlcore: AP mode - send non-data packets with basic rates

This solves interoperability issues with peer that don't seem to "hear"
management packets transmitted in higher rates. Based on a previous
patch by Igal Chernobelsky.

Cc: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: allow only the lowest OFDM rate for p2p setup frames

The IEEE80211_TX_CTL_NO_CCK_RATE flag is only set for mgmt packets
transmitted during p2p connection setup. Make sure to use the lowest
OFDM rate guarantee the peer always hears us.
Change the p2p rate policy to contain only the 6mpbs rate to acheive
this effect.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: make Tx flush timings more verbose

Print how much time a flush took. This will help debug the time it takes
to switch between channels.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: tx_flush - optimize flow and force Tx during the flush

Force Tx during the flush if there are packets pending in the driver.
This actually solves a bug where we would get called from the mac80211
wq context, which would prevent tx_work from getting queued, even when
the mutex is unlocked.

Don't stop the queues needlessly if there's nothing to flush. Use a
larger delay when sleeping to give the driver a chance to flush and
avoid cpu busy looping. Re-arrange the loop so the last iteration is
not wasted.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl18xx/wl12xx: defines for Tx/Rx descriptors num

Use defines for number of Tx/Rx descriptors.

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
wlcore/wl18xx/wl12xx: aggregation buffer size set

Aggregation buffer size is set separately per 18xx/12xx chip family.
For 18xx aggragation buffer is set to 13 pages to utilize all
the available tx/rx descriptors for aggregation.

[Arik - remove redundant parts from the patch]

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: configure wowlan regardless of wakeup conditions

wowlan filters should be configured in any case in suspend/resume.
This shouldn't be dependent on whether wakeup conditions are the
same for suspend and resume states. Only the FW command to
reconfigure wakeup conditions should be avoided in such a case.

Reported-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
wlcore: resume() only if sta is associated

mac80211's resume() callback might get called even if
the sta is not associated (but only up). The
resume sequence in this case results in configuring
the wake-up conditions of a non-started role, which
causes fw assertion.

Fix it by bailing out if the STA is not connected
(like we do on suspend()).

Signed-off-by: Eliad Peller <eliad@wizery.com>
wlcore/wl18xx/wl12xx: allow up to 3 mac addresses

Allow 3 native mac addresses on 18xx. On 12xx allow 2 native mac
addresses and set the LAA bit to create a third mac address. This
enabled operation with a separate group interface.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: make debug prints work without dynamic debug

Make debug prints operational when dynamic debug is not defined.
This allows better debugging in production environments.

Change the driver prefix to "wlcore" while were at it.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wlcore: always use wlvif->role_id for scans

enabled (but not-started) sta role should be good enough
for scanning (both normal and scheduled), so use it
instead of the device_role.

Signed-off-by: Eliad Peller <eliad@wizery.com>
wlcore: lazy-enable device roles

Enable device roles just before starting it.
This way, a single device role should be enough
for all vifs, as we can't use concurrent device
roles (which require ROC) anyway.

Signed-off-by: Eliad Peller <eliad@wizery.com>