Commit Graph

32039 Commits

Author SHA1 Message Date
Yibo Zhao
5637c4ca96 ath10k: allow qca988x family to support ack rssi of tx data packets.
Hardwares tested : QCA9887
Firmwares tested : 10.4-3.9.0.1-00036

Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-12 10:20:02 +02:00
Remi Pommarel
968ae2caad ath9k: Handle txpower changes even when TPC is disabled
When TPC is disabled IEEE80211_CONF_CHANGE_POWER event can be handled to
reconfigure HW's maximum txpower.

This fixes 0dBm txpower setting when user attaches to an interface for
the first time with the following scenario:

ieee80211_do_open()
    ath9k_add_interface()
        ath9k_set_txpower() /* Set TX power with not yet initialized
                               sc->hw->conf.power_level */

    ieee80211_hw_config() /* Iniatilize sc->hw->conf.power_level and
                             raise IEEE80211_CONF_CHANGE_POWER */

    ath9k_config() /* IEEE80211_CONF_CHANGE_POWER is ignored */

This issue can be reproduced with the following:

  $ modprobe -r ath9k
  $ modprobe ath9k
  $ wpa_supplicant -i wlan0 -c /tmp/wpa.conf &
  $ iw dev /* Here TX power is either 0 or 3 depending on RF chain */
  $ killall wpa_supplicant
  $ iw dev /* TX power goes back to calibrated value and subsequent
              calls will be fine */

Fixes: 283dd11994 ("ath9k: add per-vif TX power capability")
Cc: stable@vger.kernel.org
Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:52:51 +02:00
Krzysztof Kozlowski
c98cdaef93 ath5k: Add proper dependency for ATH5K_AHB
The CONFIG_ATH5K_AHB could be enabled on ATH25 system without enabling
ATH5K driver itself.  This does not make sense because CONFIG_ATH5K_AHB
controls object build within drivers/net/wireless/ath/ath5k/ so enabling
it without CONFIG_ATH5K brings nothing.

Add proper dependency to CONFIG_ATH5K_AHB.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:51:23 +02:00
Pradeep Kumar Chitrapu
a41d10348b ath11k: add thermal sensor device support
Temperature sensor generates electrical analog voltage from temperature
of each chain. The analog voltage is converted to digital value through
ADC. For reading temperature values fom user space, hw monitoring device
is used.

Whenever the user requests for current temperature, the driver sends WMI
command and wait for response. For reading temperature,

cat /sys/class/ieee80211/phy*/device/hwmon/hwmon2/temp1_input

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:47:18 +02:00
Pradeep Kumar Chitrapu
2a63bbca06 ath11k: add thermal cooling device support
Thermal cooling device support is added to control the temperature by
throttling the data transmission for the given duration. Throttling is
done by suspending all data tx queues by given percentage of time. The
thermal device allows user to configure duty cycle.

Throttling can be disabled by setting the duty cycle to 0. The cooling
device can be found under /sys/class/thermal/cooling_deviceX/.
Corresponding soft link to this device can be found under phy folder.

/sys/class/ieee80211/phy*/device/cooling_device.

To set duty cycle as 40%,

echo 40 >/sys/class/ieee80211/phy*/device/cooling_device/cur_state

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:47:07 +02:00
Yibo Zhao
f9680c75d1 ath10k: fix not registering airtime of 11a station with WMM disable
The tid of 11a station with WMM disable reported by FW is 0x10 in
tx completion. The tid 16 is mapped to a NULL txq since buffer
MMPDU capbility is not supported. Then 11a station's airtime will
not be registered due to NULL txq check. As a results, airtime of
11a station keeps unchanged in debugfs system.

Mask the tid along with IEEE80211_QOS_CTL_TID_MASK to make it in
the valid range.

Hardwares tested : QCA9984
Firmwares tested : 10.4-3.10-00047

Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:45:43 +02:00
Govindaraj Saminathan
a36adf54cb ath11k: config reorder queue for all tids during peer setup
Currently rx tid setup is happening for TID 0 and TID 16
during peer setup. And if other TID packets received for
the peer it will be redirected to rx error ring and not through
reo ring. And this rx tid configuration cannot be done
in the rx error ring path since it is a atomic context.
So moving the rx tid setup for all tids during the peer setup.
This is required to enable PN offload functionality to route
all packets through reo ring.

Co-developed-by: Tamizh Chelvam <tamizhr@codeaurora.org>
Signed-off-by: Tamizh Chelvam <tamizhr@codeaurora.org>
Signed-off-by: Govindaraj Saminathan <gsamin@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:43:43 +02:00
Yingying Tang
bbdc8c5abb ath10k: fix unsupported chip reset debugs file write
Before this change, after writing "warm_hw_reset" debugfs file, host
will send chip reset command to FW even though FW do not support this
service getting a warning print.

Though there is no FW impact before this change, this patch restricts
chip reset command sent to FW only if FW advertises the support via WMI
service bit.

Removed the redundant check and ath10k_warn() print as well.

New version FW will report chip reset service bit to host. Host allow user
to trigger WLAN chip reset only when fw report this service bit.

For older NON-TLV FW, since it do not report chip reset service bit, host
will not send chip reset command. For older TLV FW, since it report chip
reset service bit, host will send chip reset command.

Tested HW:  QCA9984, WCN3990

QCA9984 FW version: WLAN.BL.3.9.0.2-00042-S-1

Signed-off-by: Yingying Tang <yintang@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:41:11 +02:00
Wen Gong
402f2992b4 ath10k: use kzalloc to read for ath10k_sdio_hif_diag_read
When use command to read values, it crashed.

command:
dd if=/sys/kernel/debug/ieee80211/phy0/ath10k/mem_value count=1 bs=4 skip=$((0x100233))

It will call to ath10k_sdio_hif_diag_read with address = 0x4008cc and buf_len = 4.

Then system crash:
[ 1786.013258] Unable to handle kernel paging request at virtual address ffffffc00bd45000
[ 1786.013273] Mem abort info:
[ 1786.013281]   ESR = 0x96000045
[ 1786.013291]   Exception class = DABT (current EL), IL = 32 bits
[ 1786.013299]   SET = 0, FnV = 0
[ 1786.013307]   EA = 0, S1PTW = 0
[ 1786.013314] Data abort info:
[ 1786.013322]   ISV = 0, ISS = 0x00000045
[ 1786.013330]   CM = 0, WnR = 1
[ 1786.013342] swapper pgtable: 4k pages, 39-bit VAs, pgdp = 000000008542a60e
[ 1786.013350] [ffffffc00bd45000] pgd=0000000000000000, pud=0000000000000000
[ 1786.013368] Internal error: Oops: 96000045 [#1] PREEMPT SMP
[ 1786.013609] Process swapper/0 (pid: 0, stack limit = 0x0000000084b153c6)
[ 1786.013623] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.86 #137
[ 1786.013631] Hardware name: MediaTek krane sku176 board (DT)
[ 1786.013643] pstate: 80000085 (Nzcv daIf -PAN -UAO)
[ 1786.013662] pc : __memcpy+0x94/0x180
[ 1786.013678] lr : swiotlb_tbl_unmap_single+0x84/0x150
[ 1786.013686] sp : ffffff8008003c60
[ 1786.013694] x29: ffffff8008003c90 x28: ffffffae96411f80
[ 1786.013708] x27: ffffffae960d2018 x26: ffffff8019a4b9a8
[ 1786.013721] x25: 0000000000000000 x24: 0000000000000001
[ 1786.013734] x23: ffffffae96567000 x22: 00000000000051d4
[ 1786.013747] x21: 0000000000000000 x20: 00000000fe6e9000
[ 1786.013760] x19: 0000000000000004 x18: 0000000000000020
[ 1786.013773] x17: 0000000000000001 x16: 0000000000000000
[ 1786.013787] x15: 00000000ffffffff x14: 00000000000044c0
[ 1786.013800] x13: 0000000000365ba4 x12: 0000000000000000
[ 1786.013813] x11: 0000000000000001 x10: 00000037be6e9000
[ 1786.013826] x9 : ffffffc940000000 x8 : 000000000bd45000
[ 1786.013839] x7 : 0000000000000000 x6 : ffffffc00bd45000
[ 1786.013852] x5 : 0000000000000000 x4 : 0000000000000000
[ 1786.013865] x3 : 0000000000000c00 x2 : 0000000000000004
[ 1786.013878] x1 : fffffff7be6e9004 x0 : ffffffc00bd45000
[ 1786.013891] Call trace:
[ 1786.013903]  __memcpy+0x94/0x180
[ 1786.013914]  unmap_single+0x6c/0x84
[ 1786.013925]  swiotlb_unmap_sg_attrs+0x54/0x80
[ 1786.013938]  __swiotlb_unmap_sg_attrs+0x8c/0xa4
[ 1786.013952]  msdc_unprepare_data+0x6c/0x84
[ 1786.013963]  msdc_request_done+0x58/0x84
[ 1786.013974]  msdc_data_xfer_done+0x1a0/0x1c8
[ 1786.013985]  msdc_irq+0x12c/0x17c
[ 1786.013996]  __handle_irq_event_percpu+0xe4/0x250
[ 1786.014006]  handle_irq_event_percpu+0x28/0x68
[ 1786.014015]  handle_irq_event+0x48/0x78
[ 1786.014026]  handle_fasteoi_irq+0xd0/0x1a0
[ 1786.014039]  __handle_domain_irq+0x84/0xc4
[ 1786.014050]  gic_handle_irq+0x124/0x1a4
[ 1786.014059]  el1_irq+0xb0/0x128
[ 1786.014072]  cpuidle_enter_state+0x298/0x328
[ 1786.014082]  cpuidle_enter+0x30/0x40
[ 1786.014094]  do_idle+0x190/0x268
[ 1786.014104]  cpu_startup_entry+0x24/0x28
[ 1786.014116]  rest_init+0xd4/0xe0
[ 1786.014126]  start_kernel+0x30c/0x38c
[ 1786.014139] Code: f8408423 f80084c3 36100062 b8404423 (b80044c3)
[ 1786.014150] ---[ end trace 3b02ddb698ea69ee ]---
[ 1786.015415] Kernel panic - not syncing: Fatal exception in interrupt
[ 1786.015433] SMP: stopping secondary CPUs
[ 1786.015447] Kernel Offset: 0x2e8d200000 from 0xffffff8008000000
[ 1786.015458] CPU features: 0x0,2188200c
[ 1786.015466] Memory Limit: none

For sdio chip, it need the memory which is kmalloc, if it is
vmalloc from ath10k_mem_value_read, then it have a memory error.
kzalloc of ath10k_sdio_hif_diag_read32 is the correct type, so
add kzalloc in ath10k_sdio_hif_diag_read to replace the buffer
which is vmalloc from ath10k_mem_value_read.

This patch only effect sdio chip.

Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:39:40 +02:00
Wen Gong
37b7ecb756 ath10k: start recovery process when read int status fail for sdio
When running simulate crash stress test, it happened
"failed to read from address 0x800: -110".

Test steps:
1. Run command continuous
echo soft > /sys/kernel/debug/ieee80211/phy0/ath10k/simulate_fw_crash

2. error happened and it did not begin recovery for long time.
[74377.334846] ath10k_sdio mmc1:0001:1: simulating soft firmware crash
[74378.378217] ath10k_sdio mmc1:0001:1: failed to read from address 0x800: -110
[74378.378371] ath10k_sdio mmc1:0001:1: failed to process pending SDIO interrupts: -110

It has sdio errors since it can not read MBOX_HOST_INT_STATUS_ADDRESS,
then it has to do recovery process to recovery ath10k.

Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00042.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:36:24 +02:00
Erik Stromdahl
6e51b0e491 ath10k: add QCA9377 sdio hw_param item
Add hardware parameters for QCA9377 sdio devices, it's now properly supported.

Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:33:02 +02:00
Vikas Patel
a4b9f641e8 ath10k: avoid consecutive OTP download to reduce boot time
Currently, OTP is downloaded twice in case of "pre-cal-dt"
and "pre-cal-file" to fetch the board ID and takes around
~2 sec more boot uptime.

First OTP download happens in "ath10k_core_probe_fw" and
second in ath10k_core_start. First boot does not need OTP
download in core start when valid board id acquired.

The second OTP download is required upon core stop/start.

This patch skips the OTP download when first OTP download
has acquired a valid board id. This patch also marks board
id invalid in "ath10k_core_stop", which will force the OTP
download in ath10k_core_start and fetches valid board id.

Tested HW: QCA9984
Tested FW: 10.4-3.6-00104

Signed-off-by: Vikas Patel <vikpatel@codeaurora.org>
Signed-off-by: Maharaja Kennadyrajan <mkenna@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-11 18:29:50 +02:00
Jakub Kicinski
fad99303f0 wil6210: reject unsupported coalescing params
Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver did not previously reject unsupported parameters.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-06 22:45:55 -08:00
Luca Coelho
9352ed0165 iwlwifi: cfg: use antenna diversity with all AX101 devices
We were erroneously only setting the tx_with_siso_diversity flag in
the Qu B-step configurations for AX101 devices, though we should do
it on all configurations.  Add the flag to the other two
configurations, namely Qu C-step and QuZ.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151129.1cd986ef467c.Idc0b111475ae3d38b68ae062613c080b574e33e1@changeid
2020-03-06 15:26:33 +02:00
Ilan Peer
ce19801ba7 iwlwifi: mvm: Fix rate scale NSS configuration
The TLC configuration did not take into consideration the station's
SMPS configuration, and thus configured rates for 2 NSS even if
static SMPS was reported by the station. Fix this.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151129.b4f940d13eca.Ieebfa889d08205a3a961ae0138fb5832e8a0f9c1@changeid
2020-03-06 15:26:33 +02:00
Luca Coelho
699b760bd2 iwlwifi: dbg: don't abort if sending DBGC_SUSPEND_RESUME fails
If the firmware is in a bad state or not initialized fully, sending
the DBGC_SUSPEND_RESUME command fails but we can still collect logs.

Instead of aborting the entire dump process, simply ignore the error.
By removing the last callpoint that was checking the return value, we
can also convert the function to return void.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Fixes: 576058330f ("iwlwifi: dbg: support debug recording suspend resume command")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151129.dcec37b2efd4.I8dcd190431d110a6a0e88095ce93591ccfb3d78d@changeid
2020-03-06 15:26:32 +02:00
Mordechay Goodstein
a5688e600e iwlwifi: yoyo: don't add TLV offset when reading FIFOs
The TLV offset is only used to read registers, while the offset used for
the FIFO addresses are hard coded in the driver and not given by the
TLV.

If we try to apply the TLV offset when reading the FIFOs, we'll read
from invalid addresses, causing the driver to hang.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Fixes: 8d7dea25ad ("iwlwifi: dbg_ini: implement Rx fifos dump")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151129.fbab869c26fa.I4ddac20d02f9bce41855a816aa6855c89bc3874e@changeid
2020-03-06 15:26:32 +02:00
Luca Coelho
71bc0334a6 iwlwifi: check allocated pointer when allocating conf_tlvs
We were erroneously checking the length of the tlv instead of checking
the pointer returned by kmemdup() when allocating dbg_conf_tlv[].
This was probably a typo.  Fix it by checking the returned pointer
instead of the length.

Reported-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151128.06e00e6e980f.I9a890ce83493b79892a5f690d12016525317fa7e@changeid
2020-03-06 15:26:32 +02:00
Mordechay Goodstein
cb377dfda1 iwlwifi: consider HE capability when setting LDPC
The AP may set the LDPC capability only in HE (IEEE80211_HE_PHY_CAP1),
but we were checking it only in the HT capabilities.

If we don't use this capability when required, the DSP gets the wrong
configuration in HE and doesn't work properly.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Fixes: befebbb30a ("iwlwifi: rs: consider LDPC capability in case of HE")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151128.492d167c1a25.I1ad1353dbbf6c99ae57814be750f41a1c9f7f4ac@changeid
2020-03-06 15:26:32 +02:00
Avraham Stern
089e5016d7 iwlwifi: mvm: take the required lock when clearing time event data
When receiving a session protection end notification, the time event
data is cleared without holding the required lock. Fix it.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151128.a49846a634e4.Id1ada7c5a964f5e25f4d0eacc2c4b050015b46a2@changeid
2020-03-06 15:26:32 +02:00
David S. Miller
a368e860ad wireless-drivers-next patches for v5.7
First set of patches for v5.7. Lots of mt76 patches as they missed the
 v5.6 deadline and hence they were postponed to the next version.
 Otherwise nothing special standing out.
 
 mt76
 
 Major changes:
 
 * dual-band concurrent support for MT7615
 
 * fixes for rx path race conditions
 
 * coverage class support for MT7615
 
 * beacon fixes for USB devices
 
 * MT7615 LED support
 
 * set_antenna support for MT7615
 
 * tracing improvements
 
 * preparation for supporting new USB devices
 
 * tx power fixes
 
 brcmfmac
 
 * support BRCM 4364 found in MacBook Pro 15,2
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJeYQnTAAoJEG4XJFUm622bVEkH/13OGWPYjWQXeAFeMFiukSp0
 NJk9s6xRQmzuLxJsharKfwpr1hVm93ZZpGCG8RGCRAlMJqRnRT9q429YNFcpbWFY
 NIfsioktIk7wbyXiw6p73z+vlvRgCYTQ/QCr19731xRli2JCNh9ZYzAOA6I6iX8v
 7nCcRLLm4NM/+L+iybBumgNB4/5CCRgQTJQqbtvrgDQYXLMtu6HqcHQ1ldzivM9U
 cs9c25tthC5Zv7YhAscVRDys4ca1o/gJr7VB6surTqLCx02LmgUjBZQ9ZFqabSBa
 hkumUGivGkRN6yW1CDYu+Gok5ij0a/A3QQ9Hy5gAq1KrjtUKXbZeFVNSBSiKtQQ=
 =kUdG
 -----END PGP SIGNATURE-----

Merge tag 'wireless-drivers-next-2020-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
wireless-drivers-next patches for v5.7

First set of patches for v5.7. Lots of mt76 patches as they missed the
v5.6 deadline and hence they were postponed to the next version.
Otherwise nothing special standing out.

mt76

Major changes:

* dual-band concurrent support for MT7615

* fixes for rx path race conditions

* coverage class support for MT7615

* beacon fixes for USB devices

* MT7615 LED support

* set_antenna support for MT7615

* tracing improvements

* preparation for supporting new USB devices

* tx power fixes

brcmfmac

* support BRCM 4364 found in MacBook Pro 15,2
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-05 15:08:10 -08:00
Kalle Valo
6065bb8a9c mt76 patches for 5.7
* dual-band concurrent support for MT7615
 * fixes for rx path race conditions
 * EEPROM fixes
 * MAC address handling fixes
 * coverage class support for MT7615
 * beacon fixes for USB devices
 * MT7615 LED support
 * minor cleanups/fixes for all drivers
 * set_antenna support for MT7615
 * tracing improvements
 * preparation for supporting new USB devices
 * tx power fixes
 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org
 
 iEYEABECAAYFAl5G3tEACgkQ130UHQKnbvXVtgCdEBlcmjViCqkCPXStdSxUy9o9
 JCsAn2TnPduCoTCB1jo1foJbNXn5XzuG
 =Z/l3
 -----END PGP SIGNATURE-----

Merge tag 'mt76-for-kvalo-2020-02-14' of https://github.com/nbd168/wireless

mt76 patches for 5.7

* dual-band concurrent support for MT7615
* fixes for rx path race conditions
* EEPROM fixes
* MAC address handling fixes
* coverage class support for MT7615
* beacon fixes for USB devices
* MT7615 LED support
* minor cleanups/fixes for all drivers
* set_antenna support for MT7615
* tracing improvements
* preparation for supporting new USB devices
* tx power fixes
2020-03-03 17:35:57 +02:00
Felix Fietkau
b102f0c522 mt76: fix array overflow on receiving too many fragments for a packet
If the hardware receives an oversized packet with too many rx fragments,
skb_shinfo(skb)->frags can overflow and corrupt memory of adjacent pages.
This becomes especially visible if it corrupts the freelist pointer of
a slab page.

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-03-03 17:30:25 +02:00
Jouni Malinen
a483e29ca0 mac80211_hwsim: enable Beacon protection
Now that there is support for BIGTK configuration and AP/STA
functionality for using BIP with Beacon frames, indicate support for the
Beacon protection functionality.

Johannes: move this to hwsim, since it's not clear that all drivers
using mac80211 will do this correctly - lots of them modify the
beacon before transmission e.g. to update the TIM element, and that
would obviously break the signature.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Link: https://lore.kernel.org/r/20200222132548.20835-7-jouni@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-02-24 10:40:00 +01:00
David S. Miller
ddb535a6a0 A few big new things:
* 802.11 frame encapsulation offload support
  * more HE (802.11ax) support, including some for 6 GHz band
  * powersave in hwsim, for better testing
 
 Of course as usual there are various cleanups and small fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEH1e1rEeCd0AIMq6MB8qZga/fl8QFAl5GggsACgkQB8qZga/f
 l8Qgdg//R42bSv94JYPcwZ5phgTgraCRZODWjBJq08n2T5m0EmEufgX79d9uEdgT
 u9npvn+ich5/VZhmuSbGrW9TT6/FPLAZyghV1fj79o971Qd7ky2Mp8G1fcTEbtDn
 IG2e9vauY9XDSb2O3wNj8dA8rAN/kLNmhsPqWxn2CgLPqjdbf+W15dvo4rnaL2gs
 ffGyE47dHuAFwCruyT8UPbw3iu4+tQhruN9eVg+UkU8rJGvEMqfrLK20zl1weIV9
 a7IuXdxacdsHO8Y+tl6GtvgOURQPpvf55+leLOUhcmHPJ3f/eAal6wmWRxDxs/qB
 IWSe8BC81cZZ5pYWk1A+0sXfJMlYjNsN0xw5SQRSrbgyb5saz8aLUIlHsOBM4iPH
 SwzCMN5A1GOPOUFsugzPwbiki9g6dh0/EC2NyXE4A26CAd967dVXTvTY5SMNgiB+
 bZaaUDaPQUm1jgDT5bLRhTipTHbekDkYzG/e+wNO+HKyStoEYM485MwY4MQCYzEh
 HKDmkAbFuCwEUeXXw1y8GybUknApCRru9FtY+oiN/+y/aESfB7HJfmDFFU/KYgPu
 HOuqJoNAxdMdycDCb24/cLjUiehzfM6sujwBxZOD5WHhAcXrBo5dGd6ibfurIrjj
 XI36/mwTiMtyyb0/5xM1AKvoic2j+a5YU3MB7KSc9TlaPa5j2NA=
 =CgmJ
 -----END PGP SIGNATURE-----

Merge tag 'mac80211-next-for-net-next-2020-02-14' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
A few big new things:
 * 802.11 frame encapsulation offload support
 * more HE (802.11ax) support, including some for 6 GHz band
 * powersave in hwsim, for better testing

Of course as usual there are various cleanups and small fixes.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16 19:00:22 -08:00
Ganapathi Bhat
932183aa35 mwifiex: change license text from MARVELL to NXP
As of 6-DEC-2019, NXP has acquired Marvell’s Wireless business
unit. This change is to update the license text accordingly.

Signed-off-by: James Cao <zheng.cao@nxp.com>
Signed-off-by: Cathy Luo <xiaohua.luo@nxp.com>
Signed-off-by: Ganapathi Bhat <ganapathi.bhat@nxp.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-02-14 14:41:54 +02:00
Lorenzo Bianconi
0987295750 mt76: Introduce mt76_mcu data structure
Introduce mt76_mcu data structure to contain common fields between
mt76u_mcu and mt76e_mcu.
Initialize mcu common fields in mt76_alloc_device().
Rely on mt76_mcu in mt76_mcu_rx_event and in mt76_mcu_get_response
in order to reuse them in usb code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:17:46 +01:00
Lorenzo Bianconi
a9fddf08ec mt76: mt7615: remove rx_mask in mt7615_eeprom_parse_hw_cap
Get rid of rx_mask in mt7615_eeprom_parse_hw_cap routine since it is not
actually used

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:17:45 +01:00
Lorenzo Bianconi
5d5a99464a mt76: mt76u: rename stat_wq in wq
Rename usb stat_wq in wq in order to be reused not just for gathering hw
tx statistics

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:17:45 +01:00
Sean Wang
972c598133 mt76: mt76u: extend RX scatter gather number
Set RX scatter gather number to 4 in order to extend the maximum AMSDU
size to 11,454.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:17:44 +01:00
Lorenzo Bianconi
cf605a3bd9 mt76: mt7615: rely on mt76_queues_read for mt7622
As previous devices, mt7622 relies on multiple hw queues while for
mt7615 we have just on per band hw queue and the mcu demux the traffic
according to the packet AC. In order to dump all configured hw queues,
rely on mt76_queues_read for mt7622 in mt7615 debugfs

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:17:44 +01:00
Felix Fietkau
e22d0b8964 mt76: do not set HOST_BROADCAST_PS_BUFFERING for mt7615
mt7615 handles powersave buffering in firmware

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Felix Fietkau
0e544cb59c mt76: mt7615: rework rx phy index handling
Overwriting the RMAC_CHFREQ register is not reliable enough, as the firmware
could potentially write it again.
Since there is no PHY index indication in the rx info, we need to use another
way:

If both PHYs are using different channels, find the PHY where chfreq matches
the register value.

The only corner case remaining is when both PHYs are using the same channel.
In that case, the per-packet noise value on the primary PHY will have
information belonging to the chains of the secondary PHY from the previous
received packet of that PHY. The secondary PHY will set noise to 0 for extra
chains.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Felix Fietkau
07cda40630 mt76: fix rounding issues on converting per-chain and combined txpower
Unify code converting between the different txpower values. Always add/remove
the combined txpower delta before dividing half-dB values.
Also fix the combined txpower delta values. The correct half-dB delta for
3 chains is 9, not 8.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Felix Fietkau
049019c2a0 mt76: mt76x2: avoid starting the MAC too early
Do not set the tx/rx start bits in MT_MAC_SYS_CTRL from within initvals.
The driver sets these later when the hardware is ready

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Felix Fietkau
43ba19228c mt76: avoid extra RCU synchronization on station removal
Use sta_pre_rcu_remove callback to clear wcid pointer earlier

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Felix Fietkau
8e2ad48e2b mt76: mt7615: fix monitor mode on second PHY
The second PHY receives no packets unless there is an active vif present.
Set the WANT_MONITOR_VIF flag to deal with that

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Felix Fietkau
c5502b89ee mt76: mt7615: fix adding active monitor interfaces
Treat them the same as AP iftype internally for MCU commands

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Ryder Lee
e07880b24d mt76: mt7615: switch mt7615_mcu_set_rx_ba to v2 format
To adapt new firmware version.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Ryder Lee
4690da34f1 mt76: mt7615: switch mt7615_mcu_set_tx_ba to v2 format
To adapt new firmware version.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:09 +01:00
Ryder Lee
184dd9a11d mt76: mt7615: use new tag sta_rec_wtbl
In order to reduce command/event times, newer firmware adds a tag
sta_rec_wtbl to take care of WTBL operations.

MCU_EXT_CMD_WTBL_UPDATE is deprecated.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Ryder Lee
6849e29ed9 mt76: mt7615: add starec operating flow for firmware v2
Add fw_ver in mt7615_dev to check firmware version, and adjust
mt7615_mcu_send_sta_rec() to adapt firmware v2 changes.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Ryder Lee
9190d90daa mt76: mt7615: add a helper to encapsulate sta_rec operation
Operating command is simpler and just as clear

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Ryder Lee
20c3604f3e mt76: mt7615: simplify mcu_set_sta flow
Move mcu_add_wtbl and mcu_set_ht_cap into mcu_set_sta to simplify flow.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Ryder Lee
dc80bb6f6e mt76: mt7615: simplify mcu_set_bmc flow
Move set_bmc_wtbl into sta_rec function to simplify flow.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Felix Fietkau
35492cd28f mt76: mt7615: add support for testing hardware reset
Send an undersized corrupt packet to the DMA queue, which causes the
firmware to issue a full chip reset

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Felix Fietkau
61c4fa7219 mt76: mt7615: implement hardware reset support
When the firmware detects a problem, it needs the host to stop/reset DMA and
resume it again when the hardware state has been reset.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Felix Fietkau
f347f81a8a mt76: mt7615: report firmware log event messages
Useful for debugging firmware issues. Can be turned on via the "fw_debug"
debugfs file

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Felix Fietkau
15d9a5d7b5 mt76: mt7615: fix and rework tx power handling
Setting the tx power by manipulating EEPROM may in some cases not be enough,
since it only covers the base target power and not per-rate offsets.
In other cases, it could limit tx power of rates too much, possibly reducing
throughput or range.
Use firmware support for applying per-rate limit and power offsets for
different values of Nss.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:08 +01:00
Felix Fietkau
8351943d3c mt76: mt7615: add Kconfig entry for MT7622
This enables building support for the MT7622 SoC built-in WLAN chip

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
eacf611012 mt76: mt7615: disable DBDC on MT7622
It is only supported on MT7615

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
8c90c2253e mt76: mt7615: decrease rx ring size for MT7622
Since it's 2.4 GHz only, it needs fewer buffers

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
6aa4ed7927 mt76: mt7615: implement DMA support for MT7622
MT7622 does not have the CR4 microcontroller sitting in the data path.
Because of that, it uses the chip's native tx descriptor format instead of
something parsed and converted by the firmware.

Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
2020-02-14 10:06:07 +01:00
Felix Fietkau
35da599fcd mt76: mt7615: implement probing and firmware loading on MT7622
MT7622 does not have a CR4 microcontroller, so it only uses its own N9
firmware.

Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
c3ad5e9d00 mt76: mt7615: disable 5 GHz on MT7622
It is not supported by the chip, so avoid issues with potentially wrong
EEPROM configurations.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
8acb7afc69 mt76: mt7615: add calibration free support for MT7622
MT7622 uses fewer efuse overrides than MT7615

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
5dff21eef6 mt76: mt7615: add eeprom support for MT7622
When sending EEPROM data to the MCU, MT7622 uses a longer buffer

Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
cdad487405 mt76: mt7615: add dma and tx queue initialization for MT7622
MT7622 queue mapping is different from MT7615 and requires an extra dma
scheduler init and a few register tweaks

Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
853fb35c50 mt76: mt7615: fix MT_INT_TX_DONE_ALL definition for MT7622
MT7622 uses more interrupt bits for queue tx completion events.
Enabling those extra bits is harmless on MT7615

Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
4e569727da mt76: mt7615: store N9 firmware version instead of CR4
CR4 is used very little, N9 is the main firmware that the driver interacts with

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:07 +01:00
Felix Fietkau
1c88e7e0ae mt76: mt7615: split up firmware loading functions
Preparation for adding MT7622 support

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Felix Fietkau
57ec55e9f7 mt76: mt7615: move mmio related code from pci.c to mmio.c
Will be shared with MT7622 SoC support

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Felix Fietkau
13602c9d20 mt76: mt7615: add __aligned(4) to txp structs
The beginning of the struct is guaranteed to be 4-byte aligned, and this
attribute allows the compiler to generate more efficient code

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Felix Fietkau
d9c54264d8 mt76: enable Airtime Queue Limit support
It is supported by all drivers

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Felix Fietkau
e970e66598 mt76: mt7603: increase dma mcu rx ring size
The ring is used for looping back tx powersave filtered frames, so it could
use some more room, in case more than one aggregate was queued

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Felix Fietkau
8f6c4f7ba1 mt76: dma: do not write cpu_idx on rx queue reset until after refill
The hardware should only start processing the ring after at least one
buffer has been added

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Felix Fietkau
93eaec7625 mt76: fix handling full tx queues in mt76_dma_tx_queue_skb_raw
Fixes a theoretical issue where it could potentially overwrite an existing
descriptor entry (and leaking its skb)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Felix Fietkau
5ffc6b5a98 mt76: set dma-done flag for flushed descriptors
Avoids a theoretical corner case where the hardware could try to process
a stale descriptor after a watchdog reset

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Lorenzo Bianconi
94d4d07675 mt76: mt76u: introduce MT_DRV_RX_DMA_HDR flag
Define MT_DRV_RX_DMA_HDR flag in drv_flag in order to not skip rx frame
dma header since new devices (e.g. mt7663u) reports rx frame info in the
usb dma header

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Lorenzo Bianconi
3bcd979c8a mt76: mt76u: add endpoint to mt76u_bulk_msg signature
This is a preliminary patch to support mt7663u usb dongles

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Lorenzo Bianconi
9803b7b161 mt76: mt76u: introduce mt76u_skb_dma_info routine
Introduce mt76u_skb_dma_info utility routine in mt76-usb module in order
to be reused adding mt7663u support

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Lorenzo Bianconi
16d6dac009 mt76: mt76u: take into account different queue mapping for 7663
7663u devices rely on a different endpoint mapping. Take it into account
in mt76u_alloc_tx routine

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
1e816c65cb mt76: mt76u: add {read/write}_extended utility routines
Introduce extended utility routines to read/write data o usb bus. New
devices (e.g. mt7663u) will rely on both upper and lower part of the
register address. Add ext parameter to mt76u_init signature in order to
reuse the code adding mt7663u support.

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
94e1cfa890 mt76: mt76u: introduce mt76u_alloc_mcu_queue utility routine
Add mt76u_alloc_mcu_queue  utility routine to allocate mcu hw rx queue.
This is a preliminary patch to support new devices (e.g. mt7663u) that
rely on a hw queue for mcu messages

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
1d54bc2716 mt76: mt76u: resume all rx queue in mt76u_resume_rx
Resume all possible rx queues after suspend. This is a preliminary patch
to support mt7663u devices

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
87999d4e6b mt76: mt76u: add queue parameter to mt76u_rx_urb_alloc
Add mt76_queue parameter to mt76u_rx_urb_alloc signature since this
routine will be used to allocate urbs for mcu hw queue used by new
chipset generation (e.g. mt7663u). Check sg_max_size in in
mt76u_urb_alloc in order to use linear urb for mcu queue

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
63deaab0dd mt76: mt76u: add mt76u_alloc_rx_queue utility routine
Introduce mt76u_alloc_rx_queue routine to allocate rx hw queue.
This is a preliminary patch to support new devices (e.g. mt7663u) that
rely on a hw queue for mcu messages

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
b430b7db38 mt76: mt76u: stop/free all possible rx queues
Stop/free all configured rx queues (data/mcu) in
mt76u_stop_rx/mt76u_free_rx. This is a preliminary patch to support new
devices (e.g. mt7663u) that rely on a hw queue for mcu messages

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
38e09a49f4 mt76: mt76u: introduce mt76u_free_rx_queue utility routine
Introduce mt76u_free_rx_queue utility routine to free rx hw queue.
This is a preliminary patch to support new devices (e.g. mt7663u) that
rely on a hw queue for mcu messages

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
9aeb0d114d mt76: mt76u: move mcu buffer allocation in mt76x02u drivers
Move mcu buffer allocation in mt76x2u/mt76x0u drivers since newer
chipsets (e.g. mt7663u) does not rely on synchronous mcu communication

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
37ec6a03d7 mt76: mt76u: add queue id parameter to mt76u_submit_rx_buffers
Add queue_id parameter to mt76u_submit_rx_buffers in order to reuse it
adding mt7663u support

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
2fe6a5564d mt76: mt76u: use mt76_queue as mt76u_complete_rx context
In order to reuse mt76u_complete_rx for both data and mcu rx queue, rely
on mt76_queue as urb context in mt76u_complete_rx. Moreover set usb rx
endoint according to rx queue in mt76u_submit_rx_buf. This is a
preliminary patch to add mt7663u support

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
ab221b207b mt76: mt76u: add mt76_queue to mt76u_refill_rx signature
Introduce mt76_queue parameter to mt76u_refill_rx signature in order to
reuse it for mcu hw rx queue

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
0d1862104e mt76: mt76u: add mt76_queue to mt76u_get_next_rx_entry signature
Rely on mt76_queue pointer in mt76u_get_next_rx_entry in order to add
support for new devices (e.g 7663u) that reports fw events through hw rx
mcu queue

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
840728899c mt76: mt76u: add mt76u_process_rx_queue utility routine
Introduce mt76u_process_rx_queue routine to process rx hw queue.
This is a preliminary patch to support new devices (e.g. mt7663u) that
rely on a hw queue for mcu messages

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
f4021e1f06 mt76: mt76u: check tx_status_data pointer in mt76u_tx_tasklet
New devices (e.g. mt7663u) do not rely on stats workqueue to load tx
statistics but will be reported by the firmware. Check tx_status_data
pointer in mt76u_tx_tasklet in order to reuse tx tasklet for new devices

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
a1ea1d688d mt76: mt76x02u: avoid overwrite max_tx_fragments
Starting from 'commit ee8040139ab1 ("mt76: do not overwrite
max_tx_fragments if it has been set")' we can avoid overwriting
max_tx_fragments for mt76x02u devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
85b7a5d0b2 mt76: rely on mac80211 utility routines to compute airtime
Rely on mac80211 airitme utility routines and remove mt76 duplicated code
to estimate tx/rx airtime

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
1b784c3343 mt76: mt7615: remove leftover routine declaration
Get rid of mt76_dfs_start_rdd unused declaration

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
fecde5da03 mt76: move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76_phy_init
Move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76-core module since now all
drivers support Channel Switch Announcement

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Ryder Lee
26b4876697 mt76: mt7615: fix endianness in mt7615_mcu_set_eeprom
The field 'u16 len' should be __le16.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
2ce73efe0f mt76: mt7615: initialize radar specs from host driver
Introduce dfs radar pattern specs in mt7615 driver in order to make
dfs debugging easier. Radar pulse/pattern thresholds are taken from
vendor SDK.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
d9d8be11f8 mt76: mt76x2: get rid of leftover target
Remove tracing leftover target in mt76x2 Makefile

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
9cd82366a7 mt76: mt7615: add tracing support
Introduce token tracing support in mt7615_mac_tx_free routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Lorenzo Bianconi
5498974bd5 mt76: move mac_txdone tracepoint in mt76 module
Move mac_txdone tracepoint in common code in order to
be reused by mt7603 and mt7615 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Lorenzo Bianconi
a3f657ec1f mt76: move dev_irq tracepoint in mt76 module
Move dev_irq tracepoint in common code in order to be reused by mt7603
and mt7615 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
c388d8584b mt76: mt7615: add a get_stats() callback
Add a get_stats() callback for mib statistics.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
679b23fef8 mt76: mt7615: add per-phy mib statistics
Update per-phy mib counters every 500ms.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
31affc967f mt76: mt7615: report TSF information
This adds a get_tsf() callback for ibss.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
0d88aea88f mt76: mt7615: add set_antenna callback
Add a set_antenna callback to setup per phy tx/rx streams.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
4fe9218c5e mt76: mt7615: rework set_channel function
No need to send both MCU_EXT_CMD_SET_RX_PATH and MCU_EXT_CMD_CHANNEL_SWITCH
together to MCU.

Split them out by passing the proper command in the corresponding flow.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
2cad515ece mt76: mt7615: add missing settings for simultaneous dual-band support
MT7615 supports dual-wiphy which means that it can run on 2.4G and 5GHz
channels simultaneously, and driver should configure each band.

Add missing register settings, and refine band related definitions to
avoid duplicate codes.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Lorenzo Bianconi
cd736c4747 mt76: fix compilation warning in mt76_eeprom_override()
Fix the following compilation warning in mt76_eeprom_override routine
when CONFIG_OF is not set and label 'out' is not actually used

drivers/net/wireless/mediatek/mt76/eeprom.c: In function ‘mt76_eeprom_override’:
drivers/net/wireless/mediatek/mt76/eeprom.c💯1: warning: label ‘out’ defined but not used [-Wunused-label]

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Lorenzo Bianconi
ff44d907ee mt76: mt7603: simplify led reg definitions
Rely on FIELD_PREP macro for led register definitions and
remove open coding

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Lorenzo Bianconi
d1ff4a3c2f mt76: mt76x02: simplify led reg definitions
Rely on FIELD_PREP macro for led register definitions and
remove open coding

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Lorenzo Bianconi
ff913979a2 mt76: mt7615: introduce LED support
Initialize brightness_set and blink_set callbacks to
mt7615_led_set_brightness and mt7615_led_set_blink in order to enable
LED support in mt7615 driver

Tested-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Felix Fietkau
9379df2fd9 mt76: clear skb pointers from rx aggregation reorder buffer during cleanup
During the cleanup of the aggregation session, a rx handler (or release timer)
on another CPU might still hold a pointer to the reorder buffer and could
attempt to release some packets.
Clearing pointers during cleanup avoids a theoretical use-after-free bug here.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Felix Fietkau
d55aa5e174 mt76: mt7603: fix input validation issues for powersave-filtered frames
Before extracting the tid out of the packet, check if it was qos-data.
Only accept tid values 0-7
Also, avoid accepting the hardware queue as skb queue mapping, it could
lead to an overrun. Instead, derive the hardware queue from the tid number,
in order to avoid issues with packets being filtered multiple times.
This also fixes a mismatch between hardware and software queue indexes.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Felix Fietkau
c99dc3c152 mt76: mt7615: increase MCU command timeout
MCU_EXT_CMD_EFUSE_BUFFER_MODE needs more time on initialization, and
with only 10 seconds it sometimes runs into timeouts.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Felix Fietkau
e5051965fd mt76: mt7615: measure channel noise and report it via survey
Read measurements every 100 ms and build a simple moving average

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Ryder Lee
a25c888f3a mt76: mt7615: fix MT7615_CFEND_RATE_DEFAULT value
Fix default CFEND_RATE and replace hardcode values.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Stanislaw Gruszka
b74f98b828 mt76: mt76x02: minor mt76x02_mac_set_beacon optimization
We do not call mt76x02_mac_set_beacon() with NULL skb any longer and
we do not need to return error value.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Stanislaw Gruszka
c708bfa352 mt76: mt76x02u: do not set NULL beacons
With current implementation we do not cleanup beacon memory, so is not
needed to call mt76x02_mac_set_beacon() with NULL skb.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Stanislaw Gruszka
a6bfb6d13f mt76: usb: use max packet length for m76u_copy
For transferring data over USB the optimal size is endpoint maxpacket.
For my hardware maxpaket for control endpoint is 64 bytes and changing
to this value from 128 bytes further shorten TBTT work time from
3ms to 1ms.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Markus Theil
d3cc4e7640 mt76: mt76x02: add channel switch support for usb interfaces
This patch enables channel switch support on mt76 usb interfaces.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Markus Theil
9446248669 mt76: speed up usb bulk copy
Use larger batches for usb copy to speed this operation up. Otherwise it
would be too slow for copying new beacons or broadcast frames over usb.
Assure, that always a multiple of 4 Bytes is copied, as outlined in
850e8f6fbd "mt76: round up length on mt76_wr_copy" from Felix Fietkau.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Markus Theil
5c48e60e57 mt76: mt76x02: remove a copy call for usb speedup
This patch removes a mt76_wr_copy call from the beacon path to hw.
The skb which is used in this place gets therefore build with txwi
inside its data. For mt76 usb drivers, this saves one synchronuous
copy call over usb, which lets the beacon work complete faster.

In mmio case, there is not enough headroom to put the txwi into the
skb, it is therefore using an additional mt76_wr_copy, which is fast
over mmio. Thanks Stanislaw for pointing this out.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Markus Theil
7d2886404e mt76: mt76x02: add check for invalid vif idx
On adding vifs the idx can become 1 + (7 & 7) = 8 for APs.
Check against that, as only AP vif idx 0-7 is possible.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Markus Theil
f27469a933 mt76: mt76x02: split beaconing
Sending beacons to the hardware always happens in batches. In order to
speed up beacon processing on usb devices, this patch splits out common
code an calls it only once.

Beacons are sequentially written into the beacon memory area, by
tracking its usage with the dev->beacon_data_count. For MBSS support
and buffered traffic dev->beacon_data_count is used to create the bypass
mask.

The code is also adapted for the mmio part of the driver, but should not
have any performance implication there.

MBSS tests were performed with AVM AC860 USB NIC with temporary support
for 5 BSS'. Different combinations of active vifs were created and
brought up. Afterwards connection and data transfer was tested for the
announced BSS'.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Markus Theil
0794d03a8f mt76: mt76x02: omit beacon slot clearing
mt76 hw does not send beacons from beacon slots, if the corresponding
bitmask is set accordingly. Therefore we can omit clearing the beacon
memory. Clearing uses many usb calls, if usb drivers are used. These
calls unnecessarily slow down the beacon tasklet. Thanks to Stanislaw
Gruzska for pointing this out.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Markus Theil
e7ec563eae mt76: use AC specific reorder timeout
Before this patch, mt76 handled rx traffic for all TIDs equally,
when released from reorder buffer early. This patch uses an AC specific
reorder timeout, in order to release partial aggregated frames for video
ACs earlier. Voice ACs are currently not aggregated (thanks to Felix for
this hint). For example, ath10k also uses AC specific reorder timeouts
(reported by firmware in that case).

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Lorenzo Bianconi
183d1fcf0b mt76: mt7615: add set_coverage class support
Add the capability to configure acktimeout for mt7615 driver. Moreover
configure slottime according to the value provided by mac80211

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Lorenzo Bianconi
6a792b1a03 mt76: mt7603: set 0 as min coverage_class value
Set 0 as minimum configurable value for coverage_class since mt76 does
not support dynack

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:01 +01:00
Lorenzo Bianconi
bae76a1eef mt76: mt76x02: fix coverage_class type
Fix coverage_class type in mt76x02_dev data structure since
coverage_class can be negative to enable dynack (just supported by
ath9k). Set 0 as minimum value for coverage_class

Fixes: 7bc04215a6 ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Lorenzo Bianconi
175b4d58b9 mt76: mt7615: report firmware version using ethtool
Print fw_ver and build_date members of struct mt7615_fw_trailer
similarly to what appears in the output of 'dmesg' when the MCU firmware
is loaded.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Pablo Greco
f53300fdaa mt76: mt7615: Fix build with older compilers
Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
FIELD_GET inside an inline function, which ends up in a BUILD_BUG_ON.
Convert inline function to a macro.

Fixes commit bf92e76851 ("mt76: mt7615: add support for per-chain
signal strength reporting")
Reported in https://lkml.org/lkml/2019/9/21/146

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Pablo Greco <pgreco@centosproject.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Lorenzo Bianconi
b3c6d6388b mt76: eeprom: add support for big endian eeprom partition
mt76x0e users reported some devices (e.g TP-Link Archer VR200v) have
been flashed with big endian radio partition. Add the possibility to
specify eeprom endianness using big-endian dts property and in case
covert eeprom data in little endian

Tested-by: Kevin Schmidt <kevin.patrick.schmidt@googlemail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Lorenzo Bianconi
00c29ab2f6 mt76: mt7603: reset STA_CCA counter setting the channel
Reset MT_MIB_STAT_CCA after channel switch since it is used to track busy
time starting from 'commit dcff8d4dc3 ("mt76: mt7603: switch to a
different counter for survey busy time")'

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Shayne Chen
eba571683b mt76: fix possible undetected invalid MAC address
Make sure the MAC address is checked before function returns.

If CONFIG_OF is set and the device node is null, the function will
return directly, and an invalid MAC address will not be checked.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Felix Fietkau
37a68e0015 mt76: disable bh in mt76_dma_rx_poll
Fixes potential RCU issues and avoids calling ieee80211_rx_napi with softirq
enabled.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Felix Fietkau
2703bafcdb mt76: fix rx dma ring descriptor state on reset
To avoid having the hardware potentially write to memory behind stale
descriptors, set the dma-done flag on all of them before cleaning up
allocated rx buffers

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Felix Fietkau
3e3848280f mt7615: replace sta_state callback with sta_add/sta_remove
The MT7615 firmware needs to know the association id at creation time,
which is unavailable during the transition from notexist to none in
.sta_state.
This can cause a number of issues, probably also breaking powersave
support.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Felix Fietkau
c3c25d09d4 mt76: mt7615: defer mcu initialization via workqueue
Loading the mcu firmware and waiting for it to boot takes a long time,
which adds a significant amount to the system boot time.
Fix this by running the mcu init from a workqueue and waiting for it to
complete before starting the phy or issuing mcu commands via debugfs

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:00 +01:00
Felix Fietkau
f0305d182c mt76: mt7615: update beacon contents on BSS_CHANGED_BEACON
Beacon changes need to be sent to the firmware, otherwise it will
keep sending stale data

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:59 +01:00
Felix Fietkau
0f2173f093 mt76: mt7615: add support for registering a second wiphy via debugfs
This is only used for testing for now. In the future it will be possible to
enable the second PHY through an proper API via device tree

Running:
 echo 1 > /sys/kernel/debug/ieee80211/phyX/mt76/dbdc

will register a second wiphy (and limit the primary one to 2 spatial streams).
The second wiphy will only be able to run on 5 GHz, while the primary one can
operate in both bands (if supported by the device).

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:59 +01:00
Felix Fietkau
9ce2f7fa94 mt76: mt7615: select the correct tx queue for frames sent to the second phy
Beacons and management frames need to explicitly select the alternate tx
queues in order to be sent out on the right phy

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:59 +01:00
Felix Fietkau
b0b5426ee7 mt76: mt7615: move radio/mac initialization to .start/stop callbacks
Run initialization per phy

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:59 +01:00
Felix Fietkau
ac3ef85ceb mt76: mt7615: initialize dbdc settings on interface add
Use the first two WMM slots for the primary phy and the second two for the
secondary phy.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:59 +01:00
Felix Fietkau
27ae721932 mt76: mt7615: add multiple wiphy support to the rx path
Program the RMAC CHFREQ registers to properly indicate the band that the
frames are received on.
Add some sanity checks to the programmed values, because the firmware
programs these registers differently

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:59 +01:00
Felix Fietkau
2bed2a3e90 mt76: mt7615: rework chainmask handling
Move chainmask to struct mt7615_phy and instead of needlessly making the
format similar to values for older chips, make it refer to the actual chain
bits used for the rx/tx path.
This is important for multiple wiphy support, where for a secondary phy,
antenna_mask will start at 0, and chainmask will start at the chain offset
(bit 2)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:59 +01:00
Felix Fietkau
5dabdf71e9 mt76: mt7615: add multiple wiphy support to the dfs support code
There are two DFS detectors on the chip. When using 160 MHz channel bandwidth
(not supported in dual-wiphy mode), both are used. Otherwise, one detector is
used per wiphy.
Rework the code to start/stop them separately per phy and to indicate the
radar event on the right phy based on the detector index

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:58 +01:00
Felix Fietkau
d23cb96ccf mt76: mt7615: remove useless MT_HW_RDD0/1 enum
Writing 0/1 is shorter and just as clear

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:58 +01:00
Felix Fietkau
f89f58c8fb mt76: mt7615: add missing register init for dual-wiphy support
Initialize low-power beacon mode setting

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:58 +01:00
Felix Fietkau
d446a20f5b mt76: mt7615: add multiple wiphy support for smart carrier sense
Use per-phy radio stats and tuning registers

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:58 +01:00
Felix Fietkau
fdd2e57076 mt76: mt7615: add dual-phy support for mac80211 ops
Allows them to be used by a separately registered wiphy later

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:05:58 +01:00
Shayne Chen
c9619dfaf2 mt76: do not overwrite max_tx_fragments if it has been set
Prevent the overwriting of max_tx_fragments if it has already been set
in chip-specific init routine.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:03:10 +01:00
Felix Fietkau
30684481e6 mt76: move ampdu_ref from mt76_dev to driver struct
It is only used by the driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:03:10 +01:00
Felix Fietkau
c7d2d63109 mt76: add ext_phy field to struct mt76_wcid
Will be used to determine the phy from within the driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:03:10 +01:00
Felix Fietkau
c89d362541 mt76: add function for allocating an extra wiphy
Unlike the core phy, this will have extra allocated memory for a driver
private struct.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:03:09 +01:00
Felix Fietkau
a3d0103871 mt76: add priv pointer to struct mt76_phy
Will be used for per-phy driver private data

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:03:09 +01:00