summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt7603
AgeCommit message (Collapse)AuthorFilesLines
2020-12-04mt76: move mt76_mcu_send_firmware in common moduleLorenzo Bianconi1-22/+2
Move mt76_mcu_send_firmware routine in common code since it is actually shared between mt7615, mt7663, mt7603 and mt7915 devices Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt7603: add additional EEPROM chip IDDavid Bauer1-0/+1
Some newer MT7628 based routers (notably the TP-Link Archer C50 v4) are shipped with a chip-id of 0x7600 in the on-flash EEPROM. Add this as a possible valid ID. Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2781 Suggested-by: Ron Asimi <ron.asimi@gmail.com> Signed-off-by: David Bauer <mail@david-bauer.net> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: fix memory leak if device probing failsLorenzo Bianconi1-1/+2
Run mt76_free_device instead of ieee80211_free_hw if device probing fails in order to remove the already allocated mt76 workqueue Fixes: a86f1d01f5ce5 ("mt76: move mt76 workqueue in common code") Fixes: f1d962369d568 ("mt76: mt7915: implement HE per-rate tx power support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04wireless: mt76: convert tasklets to use new tasklet_setup() APIAllen Pais3-5/+4
In preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly. Signed-off-by: Romain Perier <romain.perier@gmail.com> Signed-off-by: Allen Pais <apais@linux.microsoft.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt7603: switch to .mcu_skb_send_msgFelix Fietkau1-37/+6
Reduces code duplication Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: move mcu timeout handling to .mcu_parse_responseFelix Fietkau1-10/+11
Preparation for further cleanup Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: implement .mcu_parse_response in struct mt76_mcu_opsFelix Fietkau1-9/+15
Do not free skb inside that function Preparation for further cleanup Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: rename __mt76_mcu_send_msg to mt76_mcu_send_msgFelix Fietkau1-14/+13
Preparation for further cleanup Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: do not set NEEDS_UNIQUE_STA_ADDR for 7615 and 7915Felix Fietkau1-0/+1
The newer chipsets can deal with the same STA on multiple interfaces Preparation for supporting more station interfaces Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: Convert to DEFINE_SHOW_ATTRIBUTEQinglang Miao1-14/+4
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: Use fallthrough pseudo-keywordGustavo A. R. Silva2-3/+3
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: remove retry_q from struct mt76_txq and related codeFelix Fietkau1-2/+0
Since the switch to using AQL by default, mtxq->retry_q is never filled anymore Remove it to get rid of a few more unnecessary cycles in the tx path Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: convert from tx tasklet to tx worker threadFelix Fietkau2-4/+3
This improves performance by allowing the scheduler to move the tx scheduling work to idle CPUs. Since tx scheduling work is very latency sensitive and kept short via AQL, sched_set_fifo_low is used to keep worker priority above normal tasks Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: mt7603: tune tx ring sizeFelix Fietkau2-2/+4
Stop relying on global tx ring size, reduce size for PS/mgmt queue Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: remove struct mt76_sw_queueFelix Fietkau4-17/+15
All members except for the struct mt76_queue pointer have been removed Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: rely on AQL for burst size limits on tx queueingFelix Fietkau1-1/+1
Now that AQL works well on all mt76 drivers, completely replace the arbitrary burst sizing and number of bursts logic for tx scheduling. For the short period of time in which AQL does not work well yet, limit each stations to 16 in-flight packets that have no estimated tx time. This should avoid filling the queue if a station connects and queues up a large number of packets before rate control information is available, especially with hardware rate control Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: remove swq from struct mt76_sw_queueFelix Fietkau1-1/+0
Since txq selection was moved to mac80211, it is no longer used Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: remove qid argument to drv->tx_complete_skbFelix Fietkau2-7/+3
It is not needed Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: mt7603: check for single-stream EEPROM configurationFelix Fietkau3-7/+18
Some devices using MT7628 or MT7603 have only one antenna chain connected. Detect these using the EEPROM rx/tx path settings Reported-by: Qin Wei <me@vonger.cn> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: move mt76_check_agg_ssn to driver tx_prepare callsFelix Fietkau1-0/+2
mt7615 and newer drivers do not need this, since they use sequence number offload Moving this code also reduces the number of callsites to make it easier to review Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: set interrupt mask register to 0 before requesting irqFelix Fietkau2-0/+4
Avoids spurious interrupts in case the hardware was running already Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: vif_mask to struct mt76_phyFelix Fietkau2-5/+3
All drivers use this in pretty much the same way. Moving it to core helps with some checks for the upcoming testmode support Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: add missing lock configuring coverage classLorenzo Bianconi1-0/+2
Coverage class callback can potentially run in parallel with other routines (e.g. mt7615_set_channel) that configures timing registers. Run coverage class callback holding mt76 mutex Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-28mt76: only iterate over initialized rx queuesFelix Fietkau1-1/+2
Fixes the following reported crash: [ 2.361127] BUG: spinlock bad magic on CPU#0, modprobe/456 [ 2.361583] lock: 0xffffa1287525b3b8, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 [ 2.362250] CPU: 0 PID: 456 Comm: modprobe Not tainted 4.14.177 #5 [ 2.362751] Hardware name: HP Meep/Meep, BIOS Google_Meep.11297.75.0 06/17/2019 [ 2.363343] Call Trace: [ 2.363552] dump_stack+0x97/0xdb [ 2.363826] ? spin_bug+0xa6/0xb3 [ 2.364096] do_raw_spin_lock+0x6a/0x9a [ 2.364417] mt76_dma_rx_fill+0x44/0x1de [mt76] [ 2.364787] ? mt76_dma_kick_queue+0x18/0x18 [mt76] [ 2.365184] mt76_dma_init+0x53/0x85 [mt76] [ 2.365532] mt7615_dma_init+0x3d7/0x546 [mt7615e] [ 2.365928] mt7615_register_device+0xe6/0x1a0 [mt7615e] [ 2.366364] mt7615_mmio_probe+0x14b/0x171 [mt7615e] [ 2.366771] mt7615_pci_probe+0x118/0x13b [mt7615e] [ 2.367169] pci_device_probe+0xaf/0x13d [ 2.367491] driver_probe_device+0x284/0x2ca [ 2.367840] __driver_attach+0x7a/0x9e [ 2.368146] ? driver_attach+0x1f/0x1f [ 2.368451] bus_for_each_dev+0xa0/0xdb [ 2.368765] bus_add_driver+0x132/0x204 [ 2.369078] driver_register+0x8e/0xcd [ 2.369384] do_one_initcall+0x160/0x257 [ 2.369706] ? 0xffffffffc0240000 [ 2.369980] do_init_module+0x60/0x1bb [ 2.370286] load_module+0x18c2/0x1a2b [ 2.370596] ? kernel_read_file+0x141/0x1b9 [ 2.370937] ? kernel_read_file_from_fd+0x46/0x71 [ 2.371320] SyS_finit_module+0xcc/0xf0 [ 2.371636] do_syscall_64+0x6b/0xf7 [ 2.371930] entry_SYSCALL_64_after_hwframe+0x3d/0xa2 [ 2.372344] RIP: 0033:0x7da218ae4199 [ 2.372637] RSP: 002b:00007fffd0608398 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 2.373252] RAX: ffffffffffffffda RBX: 00005a705449df90 RCX: 00007da218ae4199 [ 2.373833] RDX: 0000000000000000 RSI: 00005a7052e73bd8 RDI: 0000000000000006 [ 2.374411] RBP: 00007fffd06083e0 R08: 0000000000000000 R09: 00005a705449d540 [ 2.374989] R10: 0000000000000006 R11: 0000000000000246 R12: 0000000000000000 [ 2.375569] R13: 00005a705449def0 R14: 00005a7052e73bd8 R15: 0000000000000000 Reported-by: Sean Wang <sean.wang@mediatek.com> Fixes: d3377b78cec6 ("mt76: add HE phy modes and hardware queue") Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-28mt76: fix per-driver wcid range checks after wcid array size bumpFelix Fietkau1-2/+2
All drivers before MT7915 have a limit of 128 WCID entries. Stop relying on ARRAY_SIZE(dev->mt76.wcid), since it no longer reflects that limit. Fixes: 49e649c3e0a6 ("mt76: adjust wcid size to support new 802.11ax generation") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-13mt76: enable p2p supportLorenzo Bianconi1-0/+2
Introduce p2p-go/p2p-client suppor to mt76 driver 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-05-12mt76: mt7603: remove duplicate error messageDejin Zheng1-3/+1
it will print an error message by itself when devm_platform_ioremap_resource() goes wrong. so remove the duplicate error message. Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-12mt76: mt7603: fix tx status rate index calculationFelix Fietkau1-1/+1
A switch from one rate index to the next only happens when tx count from the current slot is greater than MT7615_RATE_RETRY, which is 1 has to be subtracted from count, instead of added to it. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-12mt76: mt7603: never use an 802.11b CF-End rate on 5GHzFelix Fietkau1-2/+3
Sometimes mt7615_mac_set_timing gets called while the slot time is still configured to 20. Ensure that in this case it always uses the OFDM CFend rate. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-12mt76: fix A-MPDU density handlingFelix Fietkau1-0/+5
The hardware requirements for A-MPDU density are entirely on the tx side, not the rx side. Because of that, the IE value should stay at 0 and the minimum value should instead be enforced in WTBL/TXWI MT7615 has no restrictions here Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-12mt76: add rx queues info to mt76 debugfsLorenzo Bianconi1-1/+1
Introduce rx-queues debugfs node in order to dump rx queues status. This would be useful for mcu fw debugging Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-12mt76: mt7603: disable merge of OTP ROM data by defaultFelix Fietkau1-0/+5
The reference driver does not seem to enable it by default, only under certain conditions, e.g. when a .bin file is loaded. Make it opt-in via a device tree property for now, in case it is needed on some boards. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-12mt76: add headroom and tailroom to mt76_mcu_ops data structureLorenzo Bianconi2-8/+2
Introduce headroom and tailroom to mt76_mcu_ops data structure in order to unify the routine used for mcu message allocation. This is a preliminary patch to add mt7663u support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-03-17mt76: always init to 0 mcu messagesLorenzo Bianconi1-1/+0
Always initialize to 0 mcu messages since if they are not propely configured they could hang the firmware. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-03-17mt76: mt7603: make dynamic sensitivity adjustment configurable via debugfsFelix Fietkau4-0/+7
In some cases it may be useful for debugging to disable this feature Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-03-17mt76: mt7603: add upper limit for dynamic sensitivity minimum receive powerFelix Fietkau4-1/+6
If the minimum power is raised too much, it can make it impossible for weaker clients to connect, and there are some scenarios where the false detects will not go down no matter how much the sensitivity is adjusted. Fixes connectivity issues in some rare cases Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: Introduce mt76_mcu data structureLorenzo Bianconi1-5/+5
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-14mt76: do not set HOST_BROADCAST_PS_BUFFERING for mt7615Felix Fietkau1-0/+1
mt7615 handles powersave buffering in firmware Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: avoid extra RCU synchronization on station removalFelix Fietkau1-0/+1
Use sta_pre_rcu_remove callback to clear wcid pointer earlier Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7603: increase dma mcu rx ring sizeFelix Fietkau2-1/+2
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-14mt76: move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76_phy_initLorenzo Bianconi1-1/+0
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-14mt76: move mac_txdone tracepoint in mt76 moduleLorenzo Bianconi1-0/+3
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-14mt76: move dev_irq tracepoint in mt76 moduleLorenzo Bianconi1-0/+3
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-14mt76: mt7603: simplify led reg definitionsLorenzo Bianconi2-15/+6
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-14mt76: mt7603: fix input validation issues for powersave-filtered framesFelix Fietkau1-4/+15
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-14mt76: mt7603: set 0 as min coverage_class valueLorenzo Bianconi1-1/+1
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-14mt76: mt7603: reset STA_CCA counter setting the channelLorenzo Bianconi1-1/+1
Reset MT_MIB_STAT_CCA after channel switch since it is used to track busy time starting from 'commit dcff8d4dc301 ("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-14mt76: move ampdu_ref from mt76_dev to driver structFelix Fietkau2-3/+4
It is only used by the driver Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: add multiple wiphy support to mt76_get_min_avg_rssiFelix Fietkau1-1/+1
Allow tracking clients of both wiphys separately Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: move txpower and antenna mask to struct mt76_phyFelix Fietkau3-9/+9
Adds multiple wiphy support to mt76_get_txpower Signed-off-by: Felix Fietkau <nbd@nbd.name>