Commit Graph
652 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau 058de6d36f mt76: connac: move mt76_connac_mcu_rdd_cmd in mt76-connac module
Move mt76_connac_mcu_rdd_cmd routine in mt76-connac module and remove
duplicated code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau 951b1ddd37 mt76: connac: move mt76_connac_mcu_gen_dl_mode in mt76-connac module
Move mt76_connac_mcu_gen_dl_mode utility routine in mt76_connac_mcu.h
since it is shared by all drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau 0f29d2aa5a mt76: connac: move mt76_connac_mcu_set_pm in connac module
Move mt76_connac_mcu_set_pm utility routine in connac module since it is
shared between mt7615 and mt7915 drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau 6dc585a3a2 mt76: connac: introduce is_connac_v1 utility routine
Introduce is_connac_v1 inline utility routine to check if the device is
generation v1.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau a92024c5a5 mt76: connac: move mt76_connac_mcu_wtbl_update_hdr_trans in connac module
Move mt76_connac_mcu_wtbl_update_hdr_trans routine in mt76-connac module
since it is shared between mt7915 and mt7615 drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau 9ae9aa6c1a mt76: mt7915: rely on mt76_connac_mcu_wtbl_ht_tlv
Rely on mt76_connac_mcu_wtbl_ht_tlv routine and
remove duplicated code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau e3ae182806 mt76: mt7915: rely on mt76_connac_mcu_sta_ba
Rely on mt76_connac_mcu_sta_ba routine in mt7915 and remove duplicated
code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau 50956cf179 mt76: connac: move mt76_connac_mcu_bss_basic_tlv in connac module
Move mt7615_mcu_bss_basic_tlv/mt7915_mcu_bss_basic_tlv in connac
module since it is shared between mt7615 and mt7915 drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau 829d87a93a mt76: connac: move mt76_connac_mcu_bss_ext_tlv in connac module
Move mt7915_mcu_bss_ext_tlv/mt7615_mcu_bss_ext_tlv in connac module
since it is shared between mt7615 and mt7915 drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Lorenzo BianconiandFelix Fietkau 9198eca1b1 mt76: connac: move mt76_connac_mcu_bss_omac_tlv in connac module
Move mt7915_mcu_bss_omac_tlv/mt7615_mcu_bss_omac_tlv in connac module
since it is shared between mt7615 and mt7915 drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-29 12:09:02 +01:00
Sean WangandFelix Fietkau 22fcff5ff2 mt76: sdio: lock sdio when it is needed
Acquire the SDIO as needed as possible because either MT7663S or MT7921S
is a multiple-function device that always includes Bluetooth that would
share with the same SDIO bus. So not to avoid breaking Bluetooth pairing,
audio, and HID such kind of time critical application on that, we only
lock sdio bus when it is necessary in WiFi driver.

Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-22 20:35:40 +01:00
Lorenzo BianconiandFelix Fietkau 922f0d4084 mt76: mt7915: rely on mt76_connac definitions
Remove duplicated mcu definitions in mt7915 mcu.h and reused connac
ones.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-15 20:35:45 +01:00
Lorenzo BianconiandFelix Fietkau f96fbdf038 mt76: connac: rely on MCU_CMD macro
Similar to mt7915 driver, rely on MCU_CMD macro and do not command
definitions directly

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-15 20:35:45 +01:00
Lorenzo BianconiandFelix Fietkau 116109bee7 mt76: connac: introduce MCU_CE_CMD macro
Similar to MCU_EXT_CMD, introduce MCU_CE_CMD for CE commands

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-15 20:35:45 +01:00
Lorenzo BianconiandFelix Fietkau da5128a59e mt76: connac: introduce MCU_UNI_CMD macro
Similar to MCU_EXT_CMD, introduce MCU_UNI_CMD for unified commands

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-15 20:35:45 +01:00
Lorenzo BianconiandFelix Fietkau 5a87f5497c mt76: connac: align MCU_EXT definitions with 7915 driver
Align MCU_EXT and MCU_FW definitions between mt76_connac and mt7915
driver. This is a preliminary patch to reuse mt76_connac in mt7915
driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-15 20:35:45 +01:00
Lorenzo BianconiandFelix Fietkau e2b454b6fb mt76: connac: introduce MCU_EXT macros
Introduce MCU_EXT_CMD and MCU_EXT_QUERY macros in mt76_connac module.
This is a preliminary patch to reuse mt76_connac module in mt7915
driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-15 20:35:45 +01:00
Lorenzo BianconiandFelix Fietkau 3a21d6e215 mt76: mt7663: disable 4addr capability
4addr is not supported by the offload firmware yet

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-15 18:32:09 +01:00
Felix Fietkau 047b9a9e78 mt76: mt7615: in debugfs queue stats, skip wmm index 3 on mt7663
The hardware only supports WMM index 0-2 and registers for index 3 return
bogus data.

Signed-off-by: Felix Fietkau <[email protected]>
2021-12-03 20:09:05 +01:00
Felix Fietkau 678071ef70 mt76: mt7615: clear mcu error interrupt status on mt7663
Should fix issues with error recovery

Signed-off-by: Felix Fietkau <[email protected]>
2021-12-03 10:50:10 +01:00
Lorenzo BianconiandFelix Fietkau 6fad970893 mt76: fix key pointer overwrite in mt7921s_write_txwi/mt7663_usb_sdio_write_txwi
Fix pointer overwrite in mt7921s_tx_prepare_skb and
mt7663_usb_sdio_tx_prepare_skb routines since in
commit '2a9e9857473b ("mt76: fix possible pktid leak")
mt76_tx_status_skb_add() has been moved out of
mt7921s_write_txwi()/mt7663_usb_sdio_write_txwi() overwriting
hw key pointer in ieee80211_tx_info structure. Fix the issue saving
key pointer before running mt76_tx_status_skb_add().

Fixes: 2a9e9857473b ("mt76: fix possible pktid leak")
Tested-by: Deren Wu <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-29 15:09:54 +01:00
Felix Fietkau a6451fea5a mt76: mt7615: improve wmm index allocation
Typically all AP interfaces on a PHY will share the same WMM settings, while
sta/mesh interfaces will usually inherit the settings from a remote device.
In order minimize the likelihood of conflicting WMM settings, make all AP
interfaces share one slot, and all non-AP interfaces another one.

This also fixes running multiple AP interfaces on MT7613, which only has 3
WMM slots.

Signed-off-by: Felix Fietkau <[email protected]>
2021-11-25 10:50:11 +01:00
Shayne ChenandFelix Fietkau 99225b985c mt76: mt7615: fix unused tx antenna mask in testmode
The mask variable is assigned but not used after testmode disabled:
if (!en)
	mask = phy->mt76->chainmask;

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-23 13:33:02 +01:00
Lorenzo BianconiandFelix Fietkau 46261d4bbf mt76: fix possible pktid leak
Fix a possible idr pkt-id leak if the packet is dropped on tx side

Fixes: bd1e3e7b693c ("mt76: introduce packet_id idr")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-23 13:20:47 +01:00
Felix Fietkau 67f93aa9a2 mt76: mt7615: fix decap offload corner case with 4-addr VLAN frames
With 4-address mode VLAN frames, an internal header translation step fails,
leaving behind an extra 2-byte length field that must be reomved by the driver.
Add a check for this condition to fix receiving such packets

Signed-off-by: Felix Fietkau <[email protected]>
2021-11-23 11:49:04 +01:00
Xing SongandFelix Fietkau 526591b203 mt76: do not pass the received frame with decryption error
MAC80211 doesn't care any decryption error in 802.3 path, so received
frame will be dropped if HW tell us that the cipher configuration is not
matched as well as the header has been translated to 802.3. This case only
appears when IEEE80211_FCTL_PROTECTED is 0 and cipher suit is not none in
the corresponding HW entry.

The received frame is only reported to monitor interface if HW decryption
block tell us there is ICV error or CCMP/BIP/WPI MIC error. Note in this
case the reported frame is decrypted 802.11 frame and the payload may be
malformed due to mismatched key.

Signed-off-by: Xing Song <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-21 20:26:13 +01:00
Lorenzo BianconiandFelix Fietkau 05953e7d6f mt76: mt7615: remove dead code in get_omac_idx
Remove always false if condition in get_omac_idx for sta type

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-21 20:26:13 +01:00
Xing SongandFelix Fietkau e814e15716 mt76: reverse the first fragmented frame to 802.11
The HW can apply header translation to first fragmented frame, and
ramaining fragmented frame can only keep 802.11 format. Check and
reverse the first fragmented frame to  802.11 format to make sure
them can be defragmented by mac80211.

Signed-off-by: Xing Song <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-12 13:13:18 +01:00
Peter ChiuandFelix Fietkau f5ad840ca5 mt76: mt7615: fix possible deadlock while mt7615_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 mt7615_register_ext_phy() outside the init_work().

Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-12 13:13:18 +01:00
Ryder LeeandFelix Fietkau 9d288d7c0c mt76: mt7615: apply cached RF data for DBDC
Band0 and band1 share the same hardware, so band0 will stop Tx/Rx when
band1 performs Rx calibration. cal_cache is introduced to solve such
corner cases by moving necessary datas from channel_switch to bootup.

Co-developed-by: Peter Chiu <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-23 07:27:06 +02:00
Lorenzo BianconiandFelix Fietkau 486da6fa25 mt76: do not reset MIB counters in get_stats callback
MIB counters are used for ethtool stats as well

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:33:21 +02:00
Sean WangandFelix Fietkau b2d9a1748a mt76: mt7921: rely on mcu_get_nic_capability
Rely on mcu_get_nic_capability to obtain Tx quota information
for the SDIO device, get PHY capability, MAC address and then we can
totally drop mt7921/eeprom.c and any unnecessary code.

Noting that mt76_connac_mcu_get_nic_capability should be run before set
flag MT76_STATE_MCU_RUNNING being set to setup the proper parameters
like Tx quota control before the device is started to running.

Tested-by: Deren Wu <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Sean WangandFelix Fietkau e353424f1b mt76: sdio: extend sdio module to support CONNAC2
Extend sdio module to support CONNAC2 hw that mt7921s rely on.

Tested-by: Deren Wu <[email protected]>
Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Lorenzo BianconiandFelix Fietkau 2625759439 mt76: sdio: introduce parse_irq callback
Add parse_irq to handle that interrupt status structure is
different between mt7663s and mt7921s.

This is a preliminary patch to introduce mt7921s driver

Tested-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Lorenzo BianconiandFelix Fietkau 5079d5b0b1 mt76: sdio: move common code in mt76_sdio module
Move sdio common code in mt76_sdio module.
This is a preliminary patch to support mt7921s devices.

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Sean WangandFelix Fietkau 65362a00d0 mt76: mt7663s: rely on mcu reg access utility
rely on mcu reg access utility and drop the duplicated code.

Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Lorenzo BianconiandFelix Fietkau b6051f7713 mt76: sdio: export mt76s_alloc_rx_queue and mt76s_alloc_tx routines
Export mt76s_alloc_rx_queue and mt76s_alloc_tx utility routines in order
to allow mt7921s driver to configure a different main rx queue.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:08:20 +02:00
Lorenzo BianconiandFelix Fietkau d0ccc42979 mt76: rely on phy pointer in mt76_register_debugfs_fops routine signature
This is a preliminary patch to create a mt76 debugfs subir for ext-phy.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 11:29:44 +02:00
Nick HainkeandFelix Fietkau 8d12f9ed27 mt76: mt7615: mt7622: fix ibss and meshpoint
Fixes: d8d59f66d136 ("mt76: mt7615: support 16 interfaces").

commit 7f4b7920318b ("mt76: mt7615: add ibss support") introduced IBSS
and commit f4ec7fdf7f83 ("mt76: mt7615: enable support for mesh")
meshpoint support.

Both used in the "get_omac_idx"-function:

	if (~mask & BIT(HW_BSSID_0))
		return HW_BSSID_0;

With commit d8d59f66d136 ("mt76: mt7615: support 16 interfaces") the
ibss and meshpoint mode should "prefer hw bssid slot 1-3". However,
with that change the ibss or meshpoint mode will not send any beacon on
the mt7622 wifi anymore. Devices were still able to exchange data but
only if a bssid already existed. Two mt7622 devices will never be able
to communicate.

This commits reverts the preferation of slot 1-3 for ibss and
meshpoint. Only NL80211_IFTYPE_STATION will still prefer slot 1-3.

Tested on Banana Pi R64.

Signed-off-by: Nick Hainke <[email protected]>
2021-10-19 10:29:50 +02:00
Felix Fietkau ebf5b23365 mt7615/mt7915: fix hwmon device name
the "-" character is rejected by the subsystem for device names

Signed-off-by: Felix Fietkau <[email protected]>
2021-10-12 15:21:02 +02:00
Ryder LeeandFelix Fietkau 53d7eb3b48 mt76: mt7615: fix monitor mode tear down crash
[  103.451600] CPU 3 Unable to handle kernel paging request at virtual address 00000003, epc == 8576591c, ra == 857659f0
[  103.462226] Oops[#1]:
[  103.464499] CPU: 3 PID: 9247 Comm: ifconfig Tainted: G        W         5.4.143 #0
[  103.472031] $ 0   : 00000000 00000001 83be3854 00000000
[  103.477239] $ 4   : 8102a374 8102a374 8102f0b0 00000200
[  103.482444] $ 8   : 0000002d 000001e4 64373765 5d206337
[  103.487647] $12   : 00000000 00000005 00000000 0006d1df
[  103.492853] $16   : 83be3848 853838a8 8743d600 00010000
[  103.498059] $20   : 00000000 00000000 8553dec0 0000007f
[  103.503266] $24   : 00000003 80382084
[  103.508472] $28   : 831d4000 831d5bc0 00000001 857659f0
[  103.513678] Hi    : 00000122
[  103.516543] Lo    : d1768000
[  103.519452] epc   : 8576591c mt7615_mcu_add_bss+0xd0/0x3c0 [mt7615_common]
[  103.526306] ra    : 857659f0 mt7615_mcu_add_bss+0x1a4/0x3c0 [mt7615_common]
[  103.533232] Status: 11007c03 KERNEL EXL IE
[  103.537402] Cause : 40800008 (ExcCode 02)
[  103.541389] BadVA : 00000003
[  103.544253] PrId  : 0001992f (MIPS 1004Kc)
[  103.797086] Call Trace:
[  103.799562] [<8576591c>] mt7615_mcu_add_bss+0xd0/0x3c0 [mt7615_common]
[  103.806082] [<85760a14>] mt7615_remove_interface+0x74/0x1e0 [mt7615_common]
[  103.813280] [<85603fcc>] drv_remove_interface+0x2c/0xa0 [mac80211]
[  103.819612] [<8561a8e4>] ieee80211_del_virtual_monitor.part.22+0x74/0xe8 [mac80211]
[  103.827410] [<8561b7f0>] ieee80211_do_stop+0x4a4/0x8a0 [mac80211]
[  103.833671] [<8561bc00>] ieee80211_stop+0x14/0x24 [mac80211]
[  103.839405] [<8045a328>] __dev_close_many+0x9c/0x10c
[  103.844364] [<80463de4>] __dev_change_flags+0x16c/0x1e4
[  103.849569] [<80463e84>] dev_change_flags+0x28/0x70
[  103.854440] [<80521e54>] devinet_ioctl+0x280/0x774
[  103.859222] [<80526248>] inet_ioctl+0xa4/0x1c8
[  103.863674] [<80436830>] sock_ioctl+0x2d8/0x4bc
[  103.868201] [<801adbb4>] do_vfs_ioctl+0xb8/0x7c0
[  103.872804] [<801ae30c>] ksys_ioctl+0x50/0xb4
[  103.877156] [<80014598>] syscall_common+0x34/0x58

Fixes: 04b8e65922f63 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 11:53:39 +02:00
Lorenzo BianconiandFelix Fietkau bcc8d9e03a mt76: remove mt76_wcid pointer from mt76_tx_status_check signature
Remove mt76_wcid pointer from mt76_tx_status_check signature since it is
always set to NULL

Tested-by: [email protected]
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 09:19:04 +02:00
Lorenzo BianconiandFelix Fietkau f143aedc1d mt76: introduce packet_id idr
Introduce per-wcid idr to manage packet id for txs. This allow fast idr
lookup and skb queueing at the same time.

Tested-by: [email protected]
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 09:19:04 +02:00
Ryder LeeandFelix Fietkau 3b9ba7e020 mt76: mt7615: fix hwmon temp sensor mem use-after-free
Without this change, garbage is seen in the hwmon name and sensors output
for mt7615 is garbled.

Fixes: 109e505ad944 ("mt76: mt7615: add thermal sensor device support")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 19:22:14 +02:00
Felix Fietkau 8ee6446075 mt76: disable BH around napi_schedule() calls
napi_schedule() can call __raise_softirq_irqoff(), which can perform softirq
handling, so it must not be called in a pure process context with BH enabled.

Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 17:54:42 +02:00
Christophe JAILLETandFelix Fietkau 9dcfba3169 mt76: switch from 'pci_' to 'dma_' API
The wrappers in include/linux/pci-dma-compat.h should go away.

The patch has been generated with the coccinelle script below.

It has been compile tested.

@@
@@
-    PCI_DMA_BIDIRECTIONAL
+    DMA_BIDIRECTIONAL

@@
@@
-    PCI_DMA_TODEVICE
+    DMA_TO_DEVICE

@@
@@
-    PCI_DMA_FROMDEVICE
+    DMA_FROM_DEVICE

@@
@@
-    PCI_DMA_NONE
+    DMA_NONE

@@
expression e1, e2, e3;
@@
-    pci_alloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3;
@@
-    pci_zalloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3, e4;
@@
-    pci_free_consistent(e1, e2, e3, e4)
+    dma_free_coherent(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_single(e1, e2, e3, e4)
+    dma_map_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_single(e1, e2, e3, e4)
+    dma_unmap_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4, e5;
@@
-    pci_map_page(e1, e2, e3, e4, e5)
+    dma_map_page(&e1->dev, e2, e3, e4, e5)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_page(e1, e2, e3, e4)
+    dma_unmap_page(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_sg(e1, e2, e3, e4)
+    dma_map_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_sg(e1, e2, e3, e4)
+    dma_unmap_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_device(e1, e2, e3, e4)
+    dma_sync_single_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2;
@@
-    pci_dma_mapping_error(e1, e2)
+    dma_mapping_error(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_dma_mask(e1, e2)
+    dma_set_mask(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_consistent_dma_mask(e1, e2)
+    dma_set_coherent_mask(&e1->dev, e2)

Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 17:42:12 +02:00
jing yangyangandFelix Fietkau eb75b9266c net:wireless:mt76: fix boolreturn.cocci warnings
./drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c:172:8-9:WARNING:
return of 0/1 in function 'mt7663_usb_sdio_tx_status_data' with return
type bool

Return statements in functions returning bool should use true/false
instead of 1/0.

Generated by: scripts/coccinelle/misc/boolreturn.cocci

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: jing yangyang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 17:40:52 +02:00
Lorenzo BianconiandFelix Fietkau da11c1c6ed mt76: mt7615: move mt7615_mcu_set_p2p_oppps in mt76_connac module
Move mt7615_mcu_set_p2p_oppps routine in mt76_connac_lib module in order
to be reused in mt7921 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-13 12:54:37 +02:00
Lorenzo BianconiandFelix Fietkau 51cff39d7a mt76: overwrite default reg_ops if necessary
Introduce mt76_register_debugfs_fops routine in order to
define per-driver regs file operations and make sure the
device is up before reading or writing its registers

Fixes: 1d8efc741df8 'mt76: mt7921: introduce Runtime PM support'
Fixes: de5ff3c9d1a2 'mt76: mt7615: introduce pm_power_save delayed work'
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-13 12:54:37 +02:00
Felix Fietkau 74dedf9352 mt76: mt7615: fix skb use-after-free on mac reset
When clearing all existing pending tx slots, mt76_tx_complete_skb needs to
be used to free the skbs, to ensure that they are cleared from the status
list as well.

Cc: [email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2021-07-21 07:25:05 +02:00