aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76
AgeCommit message (Collapse)Author
2019-09-05mt76: mt7615: fix some checkpatch warningsRyder Lee
This fixes the following checkpatch warnings: WARNING: Improper SPDX comment style Fix blank lines. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7603: fix some checkpatch warningsRyder Lee
This fixes the following checkpatch warnings: WARNING: Improper SPDX comment style CHECK: No space is necessary after a cast Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: Add paragraphs to describe the config symbols fullyRyder Lee
Update the help text to fix a checkpatch warning: WARNING: please write a paragraph that describes the config symbol fully Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: update cw_min/max related settingsRyder Lee
Add default values of cw_min/max and use fls() for configuration. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add 4 WMM sets supportRyder Lee
Hardware supports 4 sets of WMM that should be put to good use. And fix incorrect queue mapping in mt7615_conf_tx(). Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7603: fix watchdog rescheduling in mt7603_set_channelLorenzo Bianconi
Convert MT7603_WATCHDOG_TIME in jiffies rescheduling watchdog delayed work Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: fix MT7615_WATCHDOG_TIME definitionLorenzo Bianconi
Express watchdog timeout in jiffies since it is used directly in ieee80211_queue_delayed_work Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: introduce mt76_mmio_read_copy routineLorenzo Bianconi
Add mt76_mmio_read_copy routine and the related function pointer in mt76_bus_ops data structure. mt76_mmio_read_copy will be used to add BIP_CMAC_128 cipher hw support to mt7615 driver Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add set_key_cmd and mt76_wcid to mt7615_mac_wtbl_set_key signatureLorenzo Bianconi
Introduce set_key_cmd and mt76_wcid pointer to mt7615_mac_wtbl_set_key signature and do not set key to NULL if cmd is DISABLE_KEY. This is a preliminary patch to add BIP_CMAC_128 hw support to mt7615 driver Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: remove wtbl_sec_key definitionLorenzo Bianconi
Get rid of wtbl_sec_key definition since it is no longer used Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: introduce mt7615_mac_wtbl_set_key routineLorenzo Bianconi
Add mt7615_mac_wtbl_set_key routine to configure wtbl key parameter directly from host cpu. This is a preliminary patch to add BIP_CMAC_128 hw support. Moreover add static qualifier to mt7615_mac_get_key_info routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add mt7615_mac_wtbl_addr routineLorenzo Bianconi
Introduce mt7615_mac_wtbl_addr rouinte to compute sta wtbl address. This is a preliminary patch to update wtbl key directly from host processor Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: move mt7615_mac_get_key_info in mac.cLorenzo Bianconi
This is a preliminary patch to update wtbl key directly from host processor Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add missing register initializationFelix Fietkau
- initialize CCA signal source - initialize clock for band 1 (7615D) - initialize BAR rate Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt76x0u: add support to TP-Link T2UHPLorenzo Bianconi
Introduce support to TP-Link T2UHP https://wikidevi.com/wiki/TP-LINK_Archer_T2UHP Tested-by: Sid Hayn <sidhayn@gmail.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: use params->ssn value directlyStanislaw Gruszka
There is no point to use pointer to params->ssn. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7603: use params->ssn value directlyStanislaw Gruszka
There is no point to use pointer to params->ssn. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt76x02: use params->ssn value directlyStanislaw Gruszka
There is no point to use pointer to params->ssn. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: usb: remove unneeded {put,get}_unalignedStanislaw Gruszka
Compiler give us guarantees on variables alignment, so use an variable as buffer when read/write registers and remove unneeded {put,get}_unaligned. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: usb: fix endian in mt76u_copyStanislaw Gruszka
In contrast to mt76_wr() which we use to program registers, on mt76_wr_copy() we should not change endian of the data. Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7603: fix invalid fallback ratesFelix Fietkau
Only decrement the rate index on duplicate rates if it is not already 0 Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: fix invalid fallback ratesFelix Fietkau
Only decrement the rate index on duplicate rates if it is not already 0 Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: fix PS buffering of action framesFelix Fietkau
Bufferable management frames need to be put in the data queue, otherwise they will not be buffered when the receiver is asleep. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: fix using VHT STBC ratesFelix Fietkau
The hardware expects MT_TX_RATE_NSS to be filled with the number of space/time streams. For non-STBC rates, this is equal to nss. For 1-stream STBC, this needs to be set to 2. This is relevant for VHT rates only, on HT, the value is derived from MCS internally. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt76u: fix typo in mt76u_fill_rx_sgLorenzo Bianconi
Fix typo setting urb->transfer_buffer_length in mt76u_fill_rx_sg Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer") Fixes: f8f527b16db5 ("mt76: usb: use EP max packet aligned buffer sizes for rx") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: sync with mt7603 rate control changesFelix Fietkau
- Store the previous and current rate set in the driver + the TSF value at the time of the switch. - Use the tx status TSF value to determine which rate set needs to be used as reference. - Report only short or long GI rates for a single status event, not a mix. - The hardware reports the last used rate index. Use it along with the retry count to figure out what rate was used for the first attempt. - Use the same retry count value for all rate slots to make this calculation work. - Derive the probe rate from the current rateset instead of the skb cb - Do not wait for a status report for the probe frame before removing the probe rate from the rate table. Do it immediately after it was referenced in a tx status report. - Use the first half of the first rate retry budget for the probe rate in order to avoid using too many retries on that rate - Switch from lower rates to higher rates more conservatively - enable hardware rate up/down selection Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: reset rate index/counters on rate table updateFelix Fietkau
These values must be initialized to zero, otherwise the hardware could reuse previous values, especially the rate index Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: move mt7615_mcu_set_rates to mac.cFelix Fietkau
It bypasses the MCU, so it does not belong in mcu.c Also make mt7615_mac_tx_rate_val static Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7603: enable hardware rate up/down selectionFelix Fietkau
Improves performance by switching away from bad rates faster Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: introduce mt7615_mcu_send_ram_firmware routineLorenzo Bianconi
Add mt7615_mcu_send_ram_firmware routine since mt7615_load_ram runs the same code to send ram firmware to cr4 and n9 mcus. Moreover rename gen_dl_mode in mt7615_mcu_gen_dl_mode. This patch does not introduce any behaviour change, it is just code refactor. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: always release sem in mt7615_load_patchLorenzo Bianconi
Release patch semaphore even if request_firmware fails in mt7615_load_patch Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: fall back to sw encryption for unsupported ciphersLorenzo Bianconi
Fix following warning falling back to sw encryption for unsupported ciphers WARNING: CPU: 2 PID: 1495 at backports-4.19.32-1/net/mac80211/key.c:1023 mt76_wcid_key_setup+0x68/0xbc [mt76] CPU: 2 PID: 1495 Comm: hostapd Not tainted 4.14.131 #0 Stack : 00000000 8f0f8bc0 00000000 8007ccec 805f0000 8058ec18 00000000 00000000 80559788 8dca79bc 8fefb10c 805c89c7 805545c8 00000001 8dca7960 53261662 00000000 00000000 80640000 00004668 00000000 000000e9 00000007 00000000 00000000 805d0000 00072537 00000000 80000000 00000000 805f0000 8f1e70d0 8e8fa098 000003ff 805c0000 8f0f8bc0 00000001 802d4340 00000008 80630008 [<800108d0>] show_stack+0x58/0x100 [<8049214c>] dump_stack+0x9c/0xe0 [<80033998>] __warn+0xe0/0x138 [<80033a80>] warn_slowpath_null+0x1c/0x2c [<8e8fa098>] mt76_wcid_key_setup+0x68/0xbc [mt76] [<8e889930>] mt7615_eeprom_init+0x7c0/0xe14 [mt7615e] Suggested-by: Sebastian Gottschall <s.gottschall@newmedia-net.de> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: clean up FWDL TXQ during/after firmware uploadFelix Fietkau
Since we don't clean that tx queue from the tx tasklet, we need to do it after the firmware upload is done. This patch also adds a cleanup step during the upload, to help reclaim memory faster. Fixes unprocessed queued frames eating up memory long after the firmware upload has already completed Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add radar pattern test knob to debugfsLorenzo Bianconi
Introduce mt7615_mcu_rdd_send_pattern routine to trigger a radar pattern detection. Moreover move debugfs related routines in a dedicated source file. Suggested-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add csa supportLorenzo Bianconi
Add Channel Switch Announcement support to mt7615 driver updating beacon template with CSA IE received from mac80211 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: do not perform txcalibration before cac is complitedLorenzo Bianconi
Delay channel calibration after Channel Availability Check. Add some code cleanup to mt7615_mcu_set_channel Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add hw dfs pattern detector supportLorenzo Bianconi
Add hw radar detection support to mt7615 driver in order to unlock dfs channels on 5GHz band Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: introduce mt7615_regd_notifierLorenzo Bianconi
Introduce mt7615_regd_notifier callback. This is a preliminary patch to add radar detection support to mt7615 driver Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: fix sparse warnings: warning: restricted __le16 degrades to ↵Lorenzo Bianconi
integer Fix the following sparse warning in __mt7615_mcu_msg_send: drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:78:15: sparse: warning: restricted __le16 degrades to integer drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:78:15: sparse: warning: cast from restricted __le16 Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: round up length on mt76_wr_copyFelix Fietkau
When beacon length is not a multiple of 4, the beacon could be sent with the last 1-3 bytes corrupted. The skb data is guaranteed to have enough room for reading beyond the end, because it is always followed by skb_shared_info, so rounding up is safe. All other callers of mt76_wr_copy have multiple-of-4 length already. Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-03mt76: mt76x0e: disable 5GHz band for MT7630EStanislaw Gruszka
MT7630E hardware does support 5GHz, but we do not properly configure phy for 5GHz channels. Scanning at this band not only do not show any APs but also can hang the firmware. Since vendor reference driver do not support 5GHz we don't know how properly configure 5GHz channels. So disable this band for MT7630E . Cc: stable@vger.kernel.org Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-09-03mt76: mt76x0e: don't use hw encryption for MT7630EStanislaw Gruszka
Since 41634aa8d6db ("mt76: only schedule txqs from the tx tasklet") I can observe firmware hangs on MT7630E on station mode: tx stop functioning after minor activity (rx keep working) and on module unload device fail to stop with messages: [ 5446.141413] mt76x0e 0000:06:00.0: TX DMA did not stop [ 5449.176764] mt76x0e 0000:06:00.0: TX DMA did not stop Loading module again results in failure to associate with AP. Only machine power off / power on cycle can make device work again. It's unclear why commit 41634aa8d6db causes the problem, but it is related to HW encryption. Since issue is a firmware hang, that is super hard to debug, just disable HW encryption as fix for the issue. Fixes: 41634aa8d6db ("mt76: only schedule txqs from the tx tasklet") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-08-27Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller
Minor conflict in r8169, bug fix had two versions in net and net-next, take the net-next hunks. Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-20mt76: mt76x0u: do not reset radio on resumeStanislaw Gruszka
On some machines mt76x0u firmware can hung during resume, what result on messages like below: [ 475.480062] mt76x0 1-8:1.0: Error: MCU response pre-completed! [ 475.990066] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110 [ 475.990075] mt76x0 1-8:1.0: Error: MCU response pre-completed! [ 476.500003] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110 [ 476.500012] mt76x0 1-8:1.0: Error: MCU response pre-completed! [ 477.010046] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110 [ 477.010055] mt76x0 1-8:1.0: Error: MCU response pre-completed! [ 477.529997] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110 [ 477.530006] mt76x0 1-8:1.0: Error: MCU response pre-completed! [ 477.824907] mt76x0 1-8:1.0: Error: send MCU cmd failed:-71 [ 477.824916] mt76x0 1-8:1.0: Error: MCU response pre-completed! [ 477.825029] usb 1-8: USB disconnect, device number 6 and possible whole system freeze. This can be avoided, if we do not perform mt76x0_chip_onoff() reset. Cc: stable@vger.kernel.org Fixes: 134b2d0d1fcf ("mt76x0: init files") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-07-30net: Remove dev_err() usage after platform_get_irq()Stephen Boyd
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: "David S. Miller" <davem@davemloft.net> Cc: Kalle Valo <kvalo@codeaurora.org> Cc: Saeed Mahameed <saeedm@mellanox.com> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Cc: Felix Fietkau <nbd@nbd.name> Cc: Lorenzo Bianconi <lorenzo@kernel.org> Cc: netdev@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-16kernel: fix typos and some coding style in commentsWeitao Hou
fix lenght to length Link: http://lkml.kernel.org/r/20190521050937.4370-1-houweitaoo@gmail.com Signed-off-by: Weitao Hou <houweitaoo@gmail.com> Acked-by: Kees Cook <keescook@chromium.org> Cc: Colin Ian King <colin.king@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-07-08Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller
Two cases of overlapping changes, nothing fancy. Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-30Merge tag 'mt76-for-kvalo-2019-06-27' of https://github.com/nbd168/wirelessKalle Valo
mt76 patches for 5.3 * use NAPI polling for tx cleanup on mt7603/mt7615 * various fixes for mt7615 * unify some code between mt7603 and mt7615 * fix locking issues on mt76x02 * add support for toggling edcca on mt7603 * fix reading target tx power with ext PA on mt7603/mt7615 * fix initalizing channel maximum power * fix rate control / tx status reporting issues on mt76x02/mt7603 * add support for eeprom calibration data from mtd on mt7615 * support configuring tx power on mt7615 * fix external PA support on mt76x0 * per-chain signal reporting on mt7615 * rx/tx buffer fixes for USB devices
2019-06-27mt76: usb: fix rx A-MSDU supportLorenzo Bianconi
Commit f8f527b16db5 ("mt76: usb: use EP max packet aligned buffer sizes for rx") breaks A-MSDU support. When A-MSDU is enable the device can receive frames up to q->buf_size but they will be discarded in mt76u_process_rx_entry since there is no enough room for skb_shared_info. Fix the issue reallocating the skb and copying in the linear area the first 128B of the received frames and in the frag_list the remaining part Fixes: f8f527b16db5 ("mt76: usb: use EP max packet aligned buffer sizes for rx") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-27mt76: mt7603: fix sparse warnings: warning: incorrect type in assignment ↵Lorenzo Bianconi
(different base types) Fix the following sparse warning in mt7603_mcu_set_eeprom: drivers/net/wireless/mediatek/mt76/mt7603/mcu.c:376:30: sparse: warning: incorrect type in assignment (different base types) drivers/net/wireless/mediatek/mt76/mt7603/mcu.c:376:30: sparse: expected unsigned short [usertype] addr drivers/net/wireless/mediatek/mt76/mt7603/mcu.c:376:30: sparse: got restricted __le16 [usertype] Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>