Commit Graph
2302 Commits
Author SHA1 Message Date
Nathan ChancellorandFelix Fietkau 36a745d0f7 mt76: Fix queue ID variable types after mcu queue split
Clang warns in both mt7615 and mt7915:

drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:271:9: warning: implicit
conversion from enumeration type 'enum mt76_mcuq_id' to different
enumeration type 'enum mt76_txq_id' [-Wenum-conversion]
                txq = MT_MCUQ_FWDL;
                    ~ ^~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:278:9: warning: implicit
conversion from enumeration type 'enum mt76_mcuq_id' to different
enumeration type 'enum mt76_txq_id' [-Wenum-conversion]
                txq = MT_MCUQ_WA;
                    ~ ^~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:282:9: warning: implicit
conversion from enumeration type 'enum mt76_mcuq_id' to different
enumeration type 'enum mt76_txq_id' [-Wenum-conversion]
                txq = MT_MCUQ_WM;
                    ~ ^~~~~~~~~~
3 warnings generated.

drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:238:9: warning: implicit
conversion from enumeration type 'enum mt76_mcuq_id' to different
enumeration type 'enum mt76_txq_id' [-Wenum-conversion]
                qid = MT_MCUQ_WM;
                    ~ ^~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:240:9: warning: implicit
conversion from enumeration type 'enum mt76_mcuq_id' to different
enumeration type 'enum mt76_txq_id' [-Wenum-conversion]
                qid = MT_MCUQ_FWDL;
                    ~ ^~~~~~~~~~~~
2 warnings generated.

Use the proper type for the queue ID variables to fix these warnings.
Additionally, rename the txq variable in mt7915_mcu_send_message to be
more neutral like mt7615_mcu_send_message.

Fixes: e637763b606b ("mt76: move mcu queues to mt76_dev q_mcu array")
Link: https://github.com/ClangBuiltLinux/linux/issues/1229
Signed-off-by: Nathan Chancellor <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-04 18:30:34 +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
Lorenzo BianconiandFelix Fietkau 062f3f4f06 mt76: mt7915: simplify mt7915_mcu_send_message routine
Simplify mt7915_mcu_send_message routine removing unused code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-04 18:30:34 +01:00
Lorenzo BianconiandFelix Fietkau b6f7b3da52 mt76: mt7915: fix endianness warning in mt7915_mcu_set_radar_th
Fix the following sparse warning in mt7915_mcu_set_radar_th routine:

drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3154:17: warning: incorrect type in initializer (different base types)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3154:17:    expected unsigned int [usertype] min_pri
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3154:17:    got restricted __le32 [usertype]
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3155:17: warning: incorrect type in initializer (different base types)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3155:17:    expected unsigned int [usertype] max_pri
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3155:17:    got restricted __le32 [usertype]
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3162:17: warning: incorrect type in initializer (different base types)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3162:17:    expected unsigned int [usertype] min_stgpr_diff
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3162:17:    got restricted __le32 [usertype]

Fixes: cee236e1489ec ("mt76: mt7915: fix endian issues")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-04 18:30:33 +01:00
Shayne ChenandFelix Fietkau a515727e84 mt76: mt7915: add support for flash mode
Add support for getting rf values from flash.
This is used for some test purposes and products.
If the mtd partition is configured in dts, driver will read from flash
to init eeprom command; if not, still init it with efuse's values.

An example:
&slot0 {
	mt7915@0,0 {
		reg = <0x0000 0 0 0 0>;
		device_type = "pci";
		mediatek,mtd-eeprom = <&factory 0x0000>;
	};
};

Acked-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-04 18:30:33 +01:00
Lorenzo BianconiandFelix Fietkau 742c36b2e5 mt76: mt7915: run mt7915_configure_filter holding mt76 mutex
In order to avoid races, run mt7915_configure_filter routine holding
mt76 mutex

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-12-31 18:40:08 +01:00
Zheng YongjunandFelix Fietkau 37865118ae mt76: mt7915: convert comma to semicolon
Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-12-31 18:40:08 +01:00
Zheng YongjunandFelix Fietkau 6e22bbfe03 mt76: mt7615: convert comma to semicolon
Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-12-31 18:40:08 +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
Lorenzo BianconiandFelix Fietkau 4a90fdf610 mt76: mt76s: fix NULL pointer dereference in mt76s_process_tx_queue
Fix a possible NULL pointer dereference in mt76s_process_tx_queue that
can occur if status thread runs before allocating tx queues

Fixes: 6a618acb7e62 ("mt76: sdio: convert {status/net}_work to mt76_worker")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-12-18 18:21:01 +01:00
Lorenzo BianconiandFelix Fietkau 34f318a254 mt76: sdio: remove wake logic in mt76s_process_tx_queue
Similar to mmio/usb code path, remove wake logic in mt76s_process_tx_queue
routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-12-18 18:20:55 +01:00
Lorenzo BianconiandFelix Fietkau 510cb5be1b mt76: usb: remove wake logic in mt76u_status_worker
Similar to mmio code path, remove wake logic in mt76u_status_worker
handler

Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-12-18 18:20:49 +01:00
Felix Fietkau 6c6a5c59c1 mt76: mt7915: do not set DRR group for stations
This is causing some extreme latency spikes when sending traffic to
multiple stations at the same time. Disable this until the firmware issue
is sorted out

Signed-off-by: Felix Fietkau <[email protected]>
2020-12-18 18:19:42 +01:00
Felix Fietkau e44b7c9107 mt76: skip queue stop/wake, rely entirely on txq scheduling
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-25 19:54:16 +01:00
Felix Fietkau aa893c73bf mt76: mt7915; increase txq memory limit for non-DBDC 7915 cards to 32 MiB
This helps dealing with lots of clients using very high HE data rates

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-25 19:52:52 +01:00
Felix Fietkau 5cd805ddfb mt76: add more conditions for stopping tx scheduling
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-25 05:42:40 +01:00
Felix Fietkau 9e9da427b8 mt76: mt7915: fix polling firmware-own status
Check the register status bit instead of the trigger bit

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-23 14:06:53 +01:00
Felix Fietkau c017e329a3 mt76: mt7915: ensure that init work completes before starting the device
Without this change, the start operation could potentially race against eeprom
or txbf init

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-23 13:32:28 +01:00
Felix Fietkau 93c806a34e mt7915: fix minor issues in the token queue blocking change
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-22 12:30:32 +01:00
Felix Fietkau 066cc441eb mt76: attempt to free up more room when filling the tx queue
Run dma cleanup immediately if the queue is almost full, instead of waiting
for the tx interrupt

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-21 18:23:36 +01:00
Felix Fietkau fb24e5f230 mt76: mt7915: stop queues when running out of tx tokens
Avoids packet drops under load with lots of stations

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-21 16:00:17 +01:00
Felix Fietkau e361b6a71e mt76: improve tx queue stop/wake
Instead of stopping and waking only a single queue, handle all phy tx queues
mapped ot the same hardware queue.
Also allow the driver to block tx queues

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-21 15:58:52 +01:00
Shayne ChenandFelix Fietkau 19c9e277ef mt76: mt7915: fix memory leak in mt7915_mcu_get_rx_rate()
Free the skb to prevent memory leak.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-18 11:28:04 +01:00
Lorenzo BianconiandFelix Fietkau d8e681bd32 mt76: mt7615: fix rdd mcu cmd endianness
Similar to mt7915 driver, fix mt7615 radar mcu command endianness

Fixes: 2ce73efe0f8e5 ("mt76: mt7615: initialize radar specs from host driver")
Fixes: 70911d9638069 ("mt76: mt7615: add radar pattern test knob to debugfs")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-18 11:28:04 +01:00
Lorenzo BianconiandFelix Fietkau 1e34a02c2d mt76: mt7915: get rid of dbdc debugfs knob
mt7915 automatically detects dbdc feature so drop debugfs knob.
Move if_comb, mt7915_rates, if_limits structs and mt7915_regd_notifier(),
mt7915_init_wiphy() routines at the begging of init.c in order to make
mt7915_register_ext_phy routine static

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Co-developed-by: Ryder Lee <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-13 11:23:27 +01:00
Lorenzo BianconiandFelix Fietkau b436da4d9d mt76: mt7915: introduce dbdc support
Introduce mt7915 dbdc support. If dbdc is available, mt7915 primary phy
will work on 2.4GHz band, while secondary one on 5GHz band.

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Co-developed-by: Ryder Lee <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-13 11:19:28 +01:00
Lorenzo BianconiandFelix Fietkau 8aa24c91b1 mt76: move hw mac_addr in mt76_phy
This is a preliminary patch to properly support mt7915 dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-13 11:19:13 +01:00
Lorenzo BianconiandFelix Fietkau 231ef27697 mt76: move band allocation in mt76_register_phy
This is a preliminary patch to introduce dbdc support to mt7915 devices

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-13 11:19:13 +01:00
Lorenzo BianconiandFelix Fietkau c728cecd7b mt76: rely on mt76_phy in mt76_init_sband_2g and mt76_init_sband_5g
This is a preliminary patch to properly support mt7915 dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-13 11:19:13 +01:00
Lorenzo BianconiandFelix Fietkau e881fd67c7 mt76: move band capabilities in mt76_phy
This is a preliminary patch to move properly support mt7915 dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-13 11:19:13 +01:00
Felix Fietkau 576647f2ec mt76: mt7915: fix endian issues
Multiple MCU messages were using u16/u32 fields without endian annotations
or conversions

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 15:23:30 +01:00
Lorenzo BianconiandFelix Fietkau 2e217fb9e9 mt76: move tx hw data queues in mt76_phy
Move hw data queues in mt76_phy from mt76_dev since mt7915 supports per
phy hw queues in dbdc mode

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau ccd62467d0 mt76: move mcu queues to mt76_dev q_mcu array
Move mcu queue to a dedicated array q_mcu in mt76_dev structure.
This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau b0eb7edcc6 mt76: rely on mt76_queue in tx_queue_skb_raw signature
This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau 8932975be0 mt76: introduce mt76_init_mcu_queue utility routine
Introduce mt76_init_mcu_queue utility routine in order to allocate
dedicate q_mcu pointers for mcu hw queues. This is a preliminary patch
to move data queues in mt76_phy and add dbdc support to mt7915 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau 0f9350bef1 mt76: rely on mt76_queue in tx_queue_skb signature
Rely on mt76_queue instead of qid in tx_queue_skb signature.
This is a preliminary patch to move data queues in mt76_phy and add
dbdc support to mt7915 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau 216cf8b285 mt76: dma: rely on mt76_queue in mt76_dma_tx_cleanup signature
This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau 3ed4aad81c mt76: mt7663s: rely on mt76_queue in mt7663s_tx_run_queue signature
This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc for mt7915

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau caba5a99e5 mt76: sdio: rely on mt76_queue in mt76s_process_tx_queue signature
This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc for mt7915

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau b0b221e914 mt76: sdio: introduce mt76s_alloc_tx_queue
This is a preliminary patch to move hw data queues in mt76_phy for
mt7915 dbdc support

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau c79d18723d mt76: move mt76_init_tx_queue in common code
Move mt76_init_tx_queue in mac80211.c since it is shared by all
drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau b9a50da503 mt76: mt7915: rely on eeprom definitions
In order to make the code more readable, rely on mt7915_eeprom_field
definitions for eeprom parsing

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-10 13:55:37 +01:00
Lorenzo BianconiandFelix Fietkau 82da525ad0 mt76: mt7615: refactor usb/sdio rate code
Since wtbl workqueue is used only for rate handling, refactor code to
make it more clear

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-10 13:55:37 +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