ath10k: print out size of wmi-ready-event message

Show message length and expected length.  Helps debug
firmware mismatch issues.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: add more debugging for receive errors

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: better tx/rx debugging

Make it easier to grep for htt rx errors.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: implement sta_rc_update()

This allows dynamic changes of bandwidth/nss/smps,
e.g. via ht/vht operation mode change
notification.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: remove excessive rx msdu len check

This throw a lot of pointless warnings in case of DFS (radar
detection) and PHYERR events from firmware, when firmware may
actually insert more data, than we assume.

Besides of being noisy this debug does not protect or check
anything usefull currently. It was introduced long time ago
while debugging aggregations. So just removing it.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: Set proper nss value for the peer

It was found during testing the nss calculation does not
cover all corner cases. Station could request eq. only MCS8
and MCS9 (nss=2 specific). Next num_rates=2 so the driver
sets nss=(max((2+7)/8, 1))=1. Which is wrong. The in-driver
calculation was introduced prior (commit ddcc347b70
mac80211: fix rx_nss calculation for drivers with hw rc).
Since it's fixed, use mac80211 provided value from now.
End user will experience lower throuhputs than expected
if the nss is wrongly calculated.

Signed-off-by: Marek Kwaczynski <marek.kwaczynski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: change simulate_fw_crash to work with 10.1 firmware

Wmi command WMI_FORCE_FW_HANG_CMDID is not supported
in firmware 10.1. In order to have firmware crash simulation
functionality also in firmware 10.1 driver can force firmware
crash by performing not allowed operation. Driver can deliberately
crash firmware when setting vdev param for vdev id out of range.

Command to trigger firmware crash:
echo "crash" > /sys/kernel/debug/ieee80211/phyX/ath10k/simulate_fw_crash

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: fix device initialization routine

Hardware CUS232 version 2 has some issues with cold
reset that lead to Data Bus Errors or system hangs
in some cases. It's safer to use warm reset when
possible as it shouldn't trigger the
aforementioned issues.

Prefer warm reset over cold reset. However since
warm reset doesn't work after FW crash make sure to
fallback to cold reset when booting up the HW.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: refactor suspend/resume functions

Suspend/resume callbacks are not protected by configuration mutex
so adding such protection. Also in order to simplify implemetation
of suspend function wait queue is replaced by completion.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: suspend hardware before reset

In case of warm reset target need to be suspended.
Suspend function is extented to handle both cases
with disabling interrupts and without disabling interrupts.
Warm target reset requires suspend with all interrupts
disabled.

This patch depends on
ath10k: fix device initialization routine

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: AP: handle HT station which does not have HT RX MCS

This is a workaround for HT-enabled STAs which break the spec
and have no HT capabilities RX mask (no HT RX MCS map).

As per spec, in section 20.3.5 Modulation and coding scheme (MCS),
MCS 0 through 7 are mandatory in 20MHz with 800 ns GI at all STAs.

Firmware asserts if such situation occurs.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>