Commit Graph
100 Commits
Author SHA1 Message Date
Ryder LeeandFelix Fietkau 12bf28feba mt76: fix iv and CCMP header insertion
The iv from RXD is only for TKIP_RSC/CCMP_PN/GCMP_PN, and it needs a
check for CCMP header insertion. Move mt76_cipher_type to mt76.h to
reduce duplicated code.

Signed-off-by: Xing Song <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-18 17:19:44 +02:00
Ryder LeeandFelix Fietkau 6fbd47153b mt76: mt7915: fix IEEE80211_HE_PHY_CAP7_MAX_NC for station mode
The value of station mode is always 0.

Fixed: 00b2e16e0063 ("mt76: mt7915: add TxBF capabilities")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-18 16:38:45 +02:00
Ryder LeeandFelix Fietkau c13df42282 mt76: mt7915: improve MU stability
- Adjust starec flow since VHT MU group is only updated by starec_vht
  follows starec_bf settings.
- Drop unnecessary MU BF checks.

TX MPDU PER (Status = Success):
                                           TOT_MPDU_CNT  FAIL_MPDU_CNT  TX_PER
WCID Rate
1      VHT_BW80_2SS_MCS7_LGI_LDPC_MUBF              114              0   0.00%
       VHT_BW80_2SS_MCS7_LGI_LDPC_MUBF_MU            64              0   0.00%
       VHT_BW80_2SS_MCS7_SGI_LDPC_MUBF              128              0   0.00%
       VHT_BW80_2SS_MCS7_SGI_LDPC_MUBF_MU           745              0   0.00%
       VHT_BW80_2SS_MCS8_LGI_LDPC_MUBF_MU           856              0   0.00%
       VHT_BW80_2SS_MCS8_SGI_LDPC_MUBF_MU          1430              4   0.28%
       VHT_BW80_2SS_MCS9_LGI_LDPC_MUBF_MU          5220             31   0.59%
       VHT_BW80_2SS_MCS9_LGI_LDPC_iBF                59              0   0.00%
       VHT_BW80_2SS_MCS9_SGI_LDPC_MUBF               64              2   3.12%
       VHT_BW80_2SS_MCS9_SGI_LDPC_MUBF_MU         22132             76   0.34%
       VHT_BW80_2SS_MCS9_SGI_LDPC_iBF              2866              1   0.03%
2      VHT_BW80_2SS_MCS7_LGI_LDPC_MUBF_MU          3781              5   0.13%
       VHT_BW80_2SS_MCS7_SGI_LDPC_MUBF_MU           735              0   0.00%
       VHT_BW80_2SS_MCS8_LGI_LDPC_MUBF_MU          1270            365  28.74%
       VHT_BW80_2SS_MCS8_SGI_LDPC_MUBF_MU          3420             57   1.67%
       VHT_BW80_2SS_MCS9_LGI_LDPC_MUBF              128              0   0.00%
       VHT_BW80_2SS_MCS9_LGI_LDPC_MUBF_MU            64              0   0.00%
       VHT_BW80_2SS_MCS9_SGI_LDPC_MUBF              191              0   0.00%
       VHT_BW80_2SS_MCS9_SGI_LDPC_MUBF_MU         18833            320   1.70%
       VHT_BW80_2SS_MCS9_SGI_LDPC_iBF              6040              0   0.00%
287    OFDM 6M

Tested-by: Evelyn Tsai <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-18 16:38:20 +02:00
Ryder LeeandFelix Fietkau 5ca602fb94 mt76: mt7915: introduce mt7915_mcu_set_txbf()
Use mt7915_mcu_set_txbf() to reduce global functions. This can be
easily extended to support other TxBF commands in further patches.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-18 16:38:20 +02:00
Ryder LeeandFelix Fietkau 23c6ec49c0 mt76: make mt76_update_survey() per phy
Reduce duplicated survey for DBDC.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-18 16:38:20 +02:00
Ryder LeeandFelix Fietkau b9f09f5302 mt76: mt7915: fix MT_EE_CAL_GROUP_SIZE
Fix wrong offset for pre-calibration data.

Fixes: 495184ac91bb ("mt76: mt7915: add support for applying pre-calibration data")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-02 08:40:46 +02:00
Ryder LeeandFelix Fietkau ef2f7aa874 mt76: mt7615: update radar parameters
Patch radar parameters to match the SDK to avoid possible false alarms.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-02 08:40:46 +02:00
Ryder LeeandFelix Fietkau cf1ff7bf4f mt76: mt7915: setup drr group for peers
This is a prerequisite for MU functionality.

Tested-by: Evelyn Tsai <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-02 08:40:46 +02:00
Ryder LeeandFelix Fietkau c55c22e39b mt7915: update firmware to 2020110522 2021-06-01 20:10:59 +02:00
Ryder LeeandFelix Fietkau d9dd7635b0 mt76: mt7915: use mt7915_mcu_get_mib_info() to get survey data
Firmware functions (SCS, MU ...) also require read-clear phy counters,
hence firmware prepares a global task to read shared fields out to a
shared pool to avoid concurrency. Switch to event format accordingly.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-28 12:13:48 +02:00
Ryder LeeandFelix Fietkau 4aef2a2be4 mt76: mt7615: fix potential overflow on large shift
Fix the following static checker warning:
error: undefined (user controlled) shift '(((1))) << (c->omac_idx)'

Fixes: 402a695b1ae6 ("mt76: mt7615: fix CSA notification for DBDC")
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-28 11:54:16 +02:00
Ryder LeeandFelix Fietkau ad91f8e8e4 mt76: mt7615: add .offset_tsf callback
It's much more accurate than .get_tsf + .set_tsf and switch to use
mt76_rmw to operate tsf registers.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-28 11:52:34 +02:00
Ryder LeeandFelix Fietkau 22ea365913 mt76: mt7915: add .offset_tsf callback
It's much more accurate than .get_tsf + .set_tsf, and switch to use
mt76_rmw to operate tsf registers.

Tested-by: Xing Song <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-28 11:52:34 +02:00
Ryder LeeandFelix Fietkau 41cf021846 mt76: mt7615: add thermal sensor device support
Similar to mt7915, switching to use standard hwmon sysfs.
For reading temperature, cat /sys/class/ieee80211/phy*/hwmon*/temp1_input

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-28 10:14:15 +02:00
Ryder LeeandFelix Fietkau afab0e8202 mt76: mt7915: 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 adjusting Tx period 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

To set duty cycle as 80%,
echo 80 > /sys/class/ieee80211/phy*/cooling_device/cur_state

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-28 10:14:15 +02:00
Ryder LeeandFelix Fietkau 3c90f35ddd mt76: mt7915: add thermal sensor device support
This provides userspace with a unified interface, hwmon sysfs, to monitor
temperature in the hardware and can be adapted to system monitoring tools.

For reading temperature, cat /sys/class/ieee80211/phy*/hwmon*/temp1_input

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-28 10:14:15 +02:00
Ryder LeeandFelix Fietkau ff8bbe22dd mt76: mt7915: add .set_bitrate_mask() callback
Add runtime configuration for bitrate mask. This update firmware rate
control to add a boundary on top of table to limit the rate selection
for each peer, so when user set bitrates vht-mcs-5 1:9, which actually
means nss = 1 mcs = 0~9. This only applies to data frames as for other
mgmt, mcast, bcast still use legacy rates as it is.

Note that driver does not support GI configuration.

Example:
iw dev wlan0 set bitrates vht-mcs-5 1:9 he-mcs-5 2:7
iw dev wlan0 set bitrates legacy-5 6 he-mcs-5 2:0-11

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-10 12:29:55 +02:00
Ryder LeeandFelix Fietkau 535025d65d mt76: mt7915: cleanup mt7915_mcu_sta_rate_ctrl_tlv()
Remove obsoleted codes. This is the preparation for .set_bitrate_mask().

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-05-10 12:29:55 +02:00
Ryder LeeandFelix Fietkau cf0e406af8 mt76: mt7915: add support for applying pre-calibration data
When the EEPROM data is read from flash, it can contain pre-calibration
data, which can save calibration time.

Note that group_cal can save 30% bootup calibration time, and dpd_cal can
save 75% channel switching time.

Tested-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-17 11:19:58 +02:00
Ryder LeeandFelix Fietkau b03d1e62ac mt76: mt7615: use ieee80211_free_txskb() in mt7615_tx_token_put()
We should use ieee80211_free_txskb() to report skb status avoid wrong
aql accounting after reset.

Cc: [email protected]
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-13 10:15:11 +02:00
Ryder LeeandFelix Fietkau 0ce955b04b mt76: mt7615: only free skbs after mt7615_dma_reset() when reset happens
In mt7615_mac_reset_work(), make sure freeing skbs after mt7615_dma_reset().

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-13 10:15:11 +02:00
Ryder LeeandFelix Fietkau c3656268b3 mt76: mt7915: only free skbs after mt7915_dma_reset() when reset happens
In mt7915_mac_reset_work(), make sure freeing skbs after mt7915_dma_reset().

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-13 10:15:11 +02:00
Ryder LeeandFelix Fietkau 7401e0db31 mt76: mt7915: fix memleak when mt7915_unregister_device()
mt7915_tx_token_put() should get call before mt76_free_pending_txwi().

Fixes: f285dfb98562 ("mt76: mt7915: reset token when mac_reset happens")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-13 10:15:11 +02:00
Ryder LeeandFelix Fietkau 22fd2958c4 mt76: mt7615: fix memleak when mt7615_unregister_device()
mt7615_tx_token_put() should get call before mt76_free_pending_txwi().

Fixes: a6275e934605 ("mt76: mt7615: reset token when mac_reset happens")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-13 10:15:11 +02:00
Ryder LeeandFelix Fietkau fe8717dd57 mt76: mt7615: add missing SPDX tag in mmio.c
Resolve the following checkpatch.pl script warning:

WARNING: Missing or malformed SPDX-License-Identifier tag in line 1

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-11 12:55:54 +02:00
Ryder LeeandFelix Fietkau ffd4cf15fa mt76: mt7915: add mmio.c
Add mmio.c in order to use mt76_bus_ops throughout the driver.
It will be also shared with the future APSoC revision.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-11 12:55:54 +02:00
Ryder LeeandFelix Fietkau 7714dc914d mt76: report Rx timestamp
Frame reception timestamp (low 32-bits) that indicates the value of the
local TSF timer value at the time the first bit of the MAC header in the
received frame (PPDU unit) arriving at the MAC.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-11 12:49:17 +02:00
Ryder LeeandFelix Fietkau 7d35b7a15d mt76: mt7915: add wifi subsystem reset
Reset wifi subsystem when MCU is already running.
Fixes firmware download failure after soft reboot on systems where the PCIe
reset could not be performed properly.

Signed-off-by: Ryder Lee <[email protected]>
Co-developed-by: Felix Fietkau <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-06 17:53:30 +02:00
Ryder LeeandFelix Fietkau f8c6c7cbf1 mt76: mt7915: fix mt7915_mcu_add_beacon
ieee80211_beacon_get_template() returns NULL when beacon state is disabled.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-04 10:37:33 +02:00
Ryder LeeandFelix Fietkau e578b4b8d5 mt76: mt7615: fix .add_beacon_offload()
ieee80211_beacon_get_template() returns NULL when beacon state is disabled,
so beacon_offload cannot be disabled for some devices.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-04 10:37:33 +02:00
Ryder LeeandFelix Fietkau 57432e701d mt76: mt7915: cleanup mcu tx queue in mt7915_dma_reset()
Cleanup mcu queues in mt7915_mac_reset_work().

Fixes: mt76: e637763b606 ("move mcu queues to mt76_dev q_mcu array")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-26 09:24:03 +01:00
Ryder LeeandFelix Fietkau 115b742823 mt76: mt7915: keep mcu_add_bss_info enabled till interface removal
The same as mt7615. Keep BSS_INFO_BASIC enabled throughout interfaces
life cycle.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-26 09:24:03 +01:00
Ryder LeeandFelix Fietkau bf6d9ee4ac mt76: mt7615: keep mcu_add_bss_info enabled till interface removal
BSS_INFO_BASIC is never called alone with inactive state, which always
follows beacon offload disable, so keep it enabled throughout interfaces
life cycle. Inactive state also removes sta record of all connected
stations, thurs causes connection lost which defeats the purpose of CSA.

Lastly, this is especially an unexpected behavior that keeping mt7622
failing beacon buffer recyled when scanning channels.

bss_conf change is updated with active state only, so just overwrite it.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-26 09:24:03 +01:00
Ryder LeeandFelix Fietkau 3bd285424e mt76: mt7622: trigger hif interrupt for system reset
hif interrupt needs to be triggered after MT_MCU_INT_EVENT.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-26 09:24:03 +01:00
Ryder LeeandFelix Fietkau 9a98b1a6f9 mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset()
With this patch, mt7615_mac_reset_work() can recover system back.

Fixes: e637763b606b ("mt76: move mcu queues to mt76_dev q_mcu array")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-26 09:24:03 +01:00
Ryder LeeandFelix Fietkau ee29cd5f3a mt76: mt7615: only enable DFS test knobs for mt7615
DFS knobs should not be visible to non-DFS devices.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-26 09:24:03 +01:00
Ryder LeeandFelix Fietkau 48a905e237 mt76: mt7615: fix CSA event format
Fix format changes among the firmware versions.

Fixes: f9390c251868 ("mt76: mt7615: fix CSA notification for DBDC")
Signed-off-by: Ryder Lee <[email protected]>
2021-03-18 10:44:48 +01:00
Ryder LeeandFelix Fietkau 2303e1844a mt76: mt7915: fix possible deadlock while mt7915_register_ext_phy()
ieee80211_register_hw() is called with rtnl_lock held, and this could be
caused lockdep from a work item that's on a workqueue that is flushed
with the rtnl held.

Move mt7915_register_ext_phy() outside the init_work().

Signed-off-by: Evelyn Tsai <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:22 +01:00
Ryder LeeandFelix Fietkau 00628061b5 mt76: mt7615: add missing capabilities for DBDC
This improves performance for second phy.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 638b112188 mt76: mt7615: check mcu returned values in mt7615_ops
Properly check returned values from mcu utility routines in
mt7615_ops.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 256f324f8f mt76: mt7915: check mcu returned values in mt7915_ops
Properly check returned values from mcu utility routines in
mt7915_ops.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau a4307e6ba0 mt76: mt7915: fix txrate reporting
Properly check rate_info to fix unexpected reporting.

[ 1215.161863] Call trace:
[ 1215.164307]  cfg80211_calculate_bitrate+0x124/0x200 [cfg80211]
[ 1215.170139]  ieee80211s_update_metric+0x80/0xc0 [mac80211]
[ 1215.175624]  ieee80211_tx_status_ext+0x508/0x838 [mac80211]
[ 1215.181190]  mt7915_mcu_get_rx_rate+0x28c/0x8d0 [mt7915e]
[ 1215.186580]  mt7915_mac_tx_free+0x324/0x7c0 [mt7915e]
[ 1215.191623]  mt7915_queue_rx_skb+0xa8/0xd0 [mt7915e]
[ 1215.196582]  mt76_dma_cleanup+0x7b0/0x11d0 [mt76]
[ 1215.201276]  __napi_poll+0x38/0xf8
[ 1215.204668]  napi_workfn+0x40/0x80
[ 1215.208062]  process_one_work+0x1fc/0x390
[ 1215.212062]  worker_thread+0x48/0x4d0
[ 1215.215715]  kthread+0x120/0x128
[ 1215.218935]  ret_from_fork+0x10/0x1c

Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Fixes: e4c5ead632ff ("mt76: mt7915: rename mt7915_mcu_get_rate_info to mt7915_mcu_get_tx_rate")
Reported-by: Evelyn Tsai <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 29a04583ae mt76: mt7915: fix rxrate reporting
Avoid directly updating sinfo->rxrate from firmware since rate_info might
be overwritten by wrong results even mt7915_mcu_get_rx_rate() fails check.

Add more error handlings accordingly.

Fixes: 11553d88d0b9 ("mt76: mt7915: query station rx rate from firmware")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 477b783018 mt76: mt7915: fix PHY mode for DBDC
Fix PHY mode configuration for DBDC.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau e9e418fc7e mt76: mt7915: stop ext_phy queue when mac reset happens
Stop Tx burst for ext_phy after mac reset.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 7de0a06540 mt76: mt7915: fix CSA notification for DBDC
Add CSA notification for second phy.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 76f4959107 mt76: mt7615: stop ext_phy queue when mac reset happens
Stop Tx burst for ext_phy after mac reset.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 58dd3f26c0 mt76: mt7615: fix CSA notification for DBDC
Add CSA notification for second phy.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 5ff25c915e mt76: mt7915: add missing capabilities for DBDC
This improves dbdc performance.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:39:10 +01:00
Ryder LeeandFelix Fietkau 8a5b036af4 mt76: mt7915: fix mib stats counter reporting to mac80211
In order to properly report MIB counters to mac80211, resets stats in
mt7915_get_stats routine() and hold mt76 mutex accessing MIB counters.
Sum up MIB counters in mt7915_mac_update_mib_stats routine.

Fixes: c6b002bcdf ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:38:18 +01:00
Ryder LeeandFelix Fietkau 1a2e2965b6 mt76: mt7615: remove hdr->fw_ver check
Only mt7615 uses v1 version. Also, some of released firmware doesn't
have hdr->fw_ver.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:38:18 +01:00
Ryder LeeandFelix Fietkau 1b245e5754 mt76: mt7615: fix TSF configuration
The index of TSF counters should follow HWBSSID.

Fixes: cd79526761 ("mt76: mt7615: support 16 interfaces")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:38:18 +01:00
Ryder LeeandFelix Fietkau 8e3f5bfe74 mt76: mt7615: add support for rx decapsulation offload
For AP and Client mode, the hardware can pass received packets
as 802.3 frames that can be passed to the network stack as-is.

Tested-by: Frank Wunderlich <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:38:18 +01:00
Ryder LeeandFelix Fietkau 9002b0b30a mt76: mt7615: add rx checksum offload support
Set skb->ip_summed to CHECKSUM_UNNECESSARY if the hardware has validated
the IP and TCP/UDP checksum

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:38:18 +01:00
Ryder LeeandFelix Fietkau c5aca6692c mt76: mt7615: enable hw rx-amsdu de-aggregation
Enable hw rx-amsdu de-aggregation support.
This is a preliminary patch to enable rx checksum offload.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:38:18 +01:00
Ryder LeeandFelix Fietkau c7d98fc358 mt76: use PCI_VENDOR_ID_MEDIATEK to avoid open coded
Use PCI standard defines.

Signed-off-by: Ryder Lee <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-02-14 11:34:10 +01:00
Ryder LeeandFelix Fietkau 994893d38d mt76: always use WTBL_MAX_SIZE for tlv allocation
Simplify WTBL defines.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-02-14 11:30:00 +01:00
Ryder LeeandFelix Fietkau 3f546330b5 mt76: mt7915: support TxBF for DBDC
With this patch, TxBF can be run on both bands simultaneously.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-19 11:00:39 +01:00
Ryder LeeandFelix Fietkau 6377b7f330 mt76: mt7915: add implicit Tx beamforming support
Add ht/vht implicit Tx beamforming support and enable it via debugfs.

Tested-by: Shayne Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-14 11:25:11 +01:00
Ryder LeeandFelix Fietkau 9fc19db512 mt76: mt7915: simplify peer's TxBF capability check
This is a preliminary patch for implicit beamforming support.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-14 11:25:11 +01:00
Ryder LeeandFelix Fietkau dbba9b9933 mt76: mt7915: drop zero-length packet to avoid Tx hang
Hardware wouldn't add LLC-SNAP when skb->data_len is 0, which causes
Tx hang, so add a check to drop this kind of packet.

Tested-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-04 18:30:34 +01:00
Ryder LeeandFelix Fietkau e4b23301e6 mt76: mt7615: reset token when mac_reset happens
Reset token in mt7615_mac_reset_work() to avoid possible leakege.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-12-31 18:40:08 +01:00
Ryder LeeandFelix Fietkau eacd2d493c mt76: mt7915: reset token when mac_reset happens
Reset buffering token in mt7915_mac_reset_work() to avoid possible leakege,
which leads to Tx stop after mac reset.

Tested-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-12-31 18:18:45 +01:00
Ryder LeeandFelix Fietkau 0a449cef02 mt76: mt7915: fix MT_CIPHER_BIP_CMAC_128 setkey
MCU expects to set WLAN_CIPHER_SUITE_CCMP and WLAN_CIPHER_SUITE_AES_CMAC
at the same time, so adding an intermediate buffer for batch update.

Tested-by: Sujuan Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-12-31 18:18:45 +01:00
Ryder LeeandFelix Fietkau 27ad12352a mt76: mt7615: add vif check in mt7615_update_vif_beacon()
This avoids the WARN_ON(1) calltrace in station mode.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-12-31 18:18:45 +01:00
Ryder LeeandFelix Fietkau a46f9a9160 mt76: mt7915: add vif check in mt7915_update_vif_beacon()
To avoid the warn_on() calltrace in station mode.

[ 4522.024382]  ieee80211_tx_dequeue+0x1258/0x1298 [mac80211]
[ 4522.029868]  ieee80211_beacon_get_template+0x10/0x18 [mac80211]
[ 4522.035780]  mt7915_mcu_add_beacon+0x2c/0x208 [mt7915e]
[ 4522.040997]  mt7915_mcu_get_rx_rate+0x304/0x878 [mt7915e]
[ 4522.046394]  ieee80211_delayed_tailroom_dec+0x158/0x180 [mac80211]
[ 4522.052573]  ieee80211_iterate_interfaces+0x48/0x68 [mac80211]
[ 4522.058398]  mt7915_mac_reset_work+0x3b4/0x630 [mt7915e]
[ 4522.063704]  process_one_work+0x1fc/0x390
[ 4522.067703]  worker_thread+0x48/0x4d0
[ 4522.071356]  kthread+0x120/0x128

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-12-31 18:18:45 +01:00
Ryder LeeandFelix Fietkau cd79526761 mt76: mt7615: support 16 interfaces
When looking for a MAC address slot, start by using main BSSID slots 1-3,
afterwards use 16 repeater mode BSSID slots, then start using the slots
usually used for AP mode.

This search order should prevent unnecessary conflicts with AP mode interfaces
on the same PHY.

Note that two PHYs share global 32 omac slots with each other.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-10 13:55:37 +01:00
Ryder LeeandFelix Fietkau 27227fd57e mt76: mt7915: remove unused mt7915_mcu_bss_sync_tlv()
mt7915_mcu_bss_sync_tlv() is no longer used, so remove it.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-10 13:55:37 +01:00
Ryder LeeandFelix Fietkau 9b48c13b52 mt76: mt7915: use BIT_ULL for omac_idx
The omac_idx variable is u64 so we should use the 64-bit BIT_ULL().

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-10 13:48:06 +01:00
Ryder LeeandFelix Fietkau 36089a655f mt76: mt7915: fix sparse warning cast from restricted __le16
drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse:
sparse: cast from restricted __le16

Fixes: 00b2e16 ("mt76: mt7915: add TxBF capabilities")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
2020-11-10 13:19:38 +01:00
Ryder LeeandFelix Fietkau 8884a5def5 mt76: mt7915: rename mt7915_mcu_get_rate_info to mt7915_mcu_get_tx_rate
Avoid confusion with rx rate query function.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-10-11 21:48:37 +02:00
Ryder LeeandFelix Fietkau 594890b111 mt76: mt7915: update ppe threshold
Update ppe_thresh capability to sync SDK setting.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-10-11 21:48:37 +02:00
Ryder LeeandFelix Fietkau 434940e082 mt76: mt7915: measure channel noise and report it via survey
Read per-stream measurements every 100 ms and build a simple moving average.

Tested-by: Shayne Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 19:13:26 +02:00
Ryder LeeandFelix Fietkau 0b7d2b7628 mt76: mt7615: fix VHT LDPC capability
The MCU field should contain a boolean 0/1, not the flag itself.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Ryder LeeandFelix Fietkau e3af31409d update mt7915 firmware to the latest version
Signed-off-by: Ryder Lee <[email protected]>
2020-09-07 21:52:19 +02:00
Ryder LeeandFelix Fietkau 21182f90d9 mt76: mt7915: add Tx A-MSDU offloading support
This disables the software A-MSDU aggregation in mac80211 and enables hardware
offloading

Suggested-by: Yiwei Chung <[email protected]>
Suggested-by: YF Luo <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Co-developed-by: Felix Fietkau <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-12 09:44:38 +02:00
Ryder LeeandFelix Fietkau 43d6127d88 mt76: mt7915: enable U-APSD on AP side
Enable U-APSD support for AP interface.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Ryder LeeandFelix Fietkau 9a3723c8fe mt76: mt7915: fix potential memory leak in mcu message handler
Fix potential memory leak in mcu message handler on error condition.

Fixes: c6b002bcdf ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-22 11:13:06 +02:00
Ryder LeeandFelix Fietkau ca2b797ee5 mt76: mt7915: avoid memcpy in rxv operation
Avoid memcpy in Rx hot path to slightly improve performance.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:10 +02:00
Ryder LeeandFelix Fietkau 13ab1d6486 mt76: mt7915: update HE capabilities
Sync from SDK to update HE capabilities.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:10 +02:00
Ryder LeeandFelix Fietkau 8ae83adc73 mt76: mt7915: overwrite qid for non-bufferable mgmt frames
Overwrite hw queue id for non-bufferable management frames if the hw/fw
support always txq (altxq) in order to be in sync with mac txwi code

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:26:16 +02:00
Ryder LeeandFelix Fietkau 1ce4660a0e mt76: mt7915: use ieee80211_tx_queue_params to avoid open coded
This is easy to add MU EDCA parameters in the future. This patch
also fixes a wrong cw_min assignment.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:26:16 +02:00
Ryder LeeandFelix Fietkau dacc2d2967 mt76: mt7915: add MU-MIMO support
Enable MU-MIMO DL/UL and add relative counters in debugfs.

Currently MU modules read WTBL first to notify BA changes to
other cross modules, so adjust mt7915_mcu_sta_ba() accordingly.

Tested-by: Evelyn Tsai <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:26:16 +02:00
Ryder LeeandFelix Fietkau 84d54df769 mt76: mt7915: add a fixed AC queue mapping
In MT7915, hardware queue map is flexible. However, certain firmware modules
like MU and U-APSD presume a fixed queue order to adapt some devices that have
DMA scheduler with a strict order, so this patch can help in the long run.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:26:16 +02:00
Ryder LeeandFelix Fietkau c0dbbd930d mt76: mt7615: add .set_tsf callback
It is useful for IBSS Mesh to adjust t_clockdrift.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:26:16 +02:00
Ryder LeeandFelix Fietkau 82a94173b1 mt76: mt7915: add missing CONFIG_MAC80211_DEBUGFS
Add CONFIG_MAC80211_DEBUGFS to fix a reported warning.

Fixes: ec9742a ("mt76: mt7915: add .sta_add_debugfs support")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
2020-06-22 21:19:30 +02:00
Ryder LeeandFelix Fietkau b74d5b1c14 mt76: mt7915: fix some sparse warnings
drivers/net/wireless/mediatek/mt76/mt7915/main.c:694:1: sparse:
sparse: context imbalance in 'mt7915_sta_rc_update' - wrong count at exit
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:303:43: sparse: sparse: cast to restricted __le32
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:304:43: sparse: sparse: cast to restricted __le32
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:305:43: sparse: sparse: cast to restricted __le32
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:319:35: sparse: sparse: cast to restricted __le32
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:327:35: sparse: sparse: cast to restricted __le32
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:345:41: sparse: sparse: cast to restricted __le32
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:355:33: sparse: sparse: cast to restricted __le32
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:451:21: sparse: sparse: invalid assignment: |=
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:451:21: sparse:    left side has type unsigned int
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:451:21: sparse:    right side has type restricted __le32

Fixes: e57b790 ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-20 10:37:34 +02:00
Ryder LeeandFelix Fietkau 6d731d188d mt76: mt7915: fix decoded radiotap HE flags
Move assignment of .data1 and .data2 to a single place and fix overwriting
of values from the template

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-20 10:37:17 +02:00
Ryder LeeandFelix Fietkau 01b784174c mt76: mt7915: fix sparse warnings: incorrect type initializer
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:2317:31: sparse: sparse:
incorrect type in initializer (different base types)

Fixes: 5517f78b0063 ("mt76: mt7915: enable firmware module debug support")
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-20 10:37:17 +02:00
Ryder LeeandFelix Fietkau 1e3dc5b766 mt76: mt7915: fix some sparse warnings
This fixes the following sparse warning:

drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse: sparse: mixing different enum types:
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse:    unsigned int enum mt7915_txq_id
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse:    unsigned int enum mt76_txq_id
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse:    expected unsigned char const [usertype] *ies
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse:    got unsigned char const [noderef] <asn:4> *
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse: sparse: incorrect type in argument 1 (different base types)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse:    expected unsigned int w
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse:    got restricted __le32 [usertype] supp_ht_mcs
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse: sparse: restricted __le32 degrades to integer
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1429:60: sparse: sparse: bad assignment (>>=) to restricted __le16
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1773:16: sparse: sparse: restricted __le32 degrades to integer

Fixes: 6094f86fb371 ("mt76: mt7915: add HE bss_conf support for interfaces")
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-20 10:37:17 +02:00
Ryder LeeandFelix Fietkau 7005aa8914 mt76: mt7915: add spatial reuse support
Enable or disable OBSS PD when the bss config changes or we
assoc to an AP that broadcasts the IE.

With this patch, we can get ~20% gain in OBSS OTA environment.

Tested-by: Evelyn Tsai <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-20 10:37:17 +02:00
Ryder LeeandFelix Fietkau 26eb1ed659 mt76: mt7915: fix possible deadlock in mt7915_stop
make mac_work per phy instead of per device and fix a possible deadlock
in mt7915_stop since mt7915_mac_work runs holding mt76 mutex

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:19:02 +02:00
Ryder LeeandFelix Fietkau 9590db0254 mt76: mt7915: allocate proper size for tlv tags
Allocating proper memory size according to tlv usage.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:19:02 +02:00
Ryder LeeandFelix Fietkau 6656bebd39 mt76: mt7915: add debugfs to track TxBF status
Add debug counters to track status of beamformer and beamformee.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:19:02 +02:00
Ryder LeeandFelix Fietkau ac505404c3 mt76: mt7915: add TxBF capabilities
This allows to set HE TxBF runtime stream capabilities

Signed-off-by: Ryder Lee <[email protected]>
Tested-by: Evelyn Tsai <[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:19:02 +02:00
Ryder LeeandFelix Fietkau 5f9e7664cd mt76: mt7915: add Tx beamformee support
Enable beamformee support.

Signed-off-by: Ryder Lee <[email protected]>
Tested-by: Evelyn Tsai <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:19:02 +02:00
Ryder LeeandFelix Fietkau 095c72c81c mt76: mt7915: add Tx beamformer support
Enable TxBF modules and trigger sounding process to support Tx beamformer.

Signed-off-by: Ryder Lee <[email protected]>
Tested-by: Evelyn Tsai <[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:19:02 +02:00
Ryder LeeandFelix Fietkau 1d0903de21 mt76: mt7915: introduce mt7915_get_he_phy_cap
Add a helper to reduce duplicate codes.
This is a preliminary patch to add Tx beamforming support.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:19:02 +02:00
Ryder LeeandFelix Fietkau 56405976fc mt76: set runtime stream caps by mt76_phy
This patch can support concurrent dual-band operation.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-09 10:24:04 +02:00
Ryder LeeandFelix Fietkau 509fceb432 mt76: mt7915: enable firmware module debug support
This allows host driver to get useful information of some important modules.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Chih-Min Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-09 10:24:04 +02:00