aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-06-25mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_setLorenzo Bianconi3-0/+15
Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs concurrently with calibration work and mt76x2_set_channel. Moreover perform phy calibration atomically Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt76x2: move mutex_lock inside mt76x2_set_channelLorenzo Bianconi2-17/+21
This is a preliminary patch to run mt76x02_edcca_init atomically Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt76x2u: remove mt76x02_edcca_init in mt76x2u_set_channelLorenzo Bianconi1-1/+0
Remove mt76x02_edcca_init in mt76x2u_set_channel since it is already run by mt76x2u_phy_channel_calibrate performing channel calibration Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt76x02: remove enable from mt76x02_edcca_init signatureLorenzo Bianconi8-9/+9
Remove enable parameter from mt76x02_edcca_init routine signature since it is always true Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt7615: add static qualifier to mt7615_rx_poll_completeLorenzo Bianconi2-2/+2
Make mt7615_rx_poll_complete static since it is used just in pci.c to initialize rx_poll_complete function pointer Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt7615: rearrange cleanup operations in mt7615_unregister_deviceLorenzo Bianconi1-4/+5
Cleanup tx/rx napi before releasing pending idrs. Moreover unmap txwi_cache running mt76_free_device routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt7603: stop mac80211 queues before setting the channelLorenzo Bianconi1-1/+4
Suspend data transmission during channel switch Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: run __mt76_mcu_send_msg in mt7615_mcu_send_firmwareLorenzo Bianconi1-10/+5
Run __mt76_mcu_send_msg instead of __mt7615_mcu_msg_send and remove duplicated code. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: init mcu_restart function pointerLorenzo Bianconi1-4/+5
Use common function wrapper in mt7615_mcu_exit since the code is shared with m7603 driver Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: initialize mt76_mcu_ops data structureLorenzo Bianconi1-34/+40
Use __mt76_mcu_send_msg wrapper instead of mt7615_mcu_msg_send. This is a preliminary patch for mt7615-mt7603 mcu code unification Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: use standard signature for mt7615_mcu_msg_sendLorenzo Bianconi2-296/+337
Use mt76 common signature for mt7615_mcu_msg_send. Move skb allocation in mt7615_mcu_msg_send and remove duplicated code. Remove __mt7615_mcu_set_wtbl and __mt7615_mcu_set_sta_rec since now are used just to send mcu msgs. This is a preliminary patch for mt7615-mt7603 mcu code unification Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: remove unused structure in mcu.hLorenzo Bianconi1-30/+0
Remove following struct no longer used: - dev_info - bss_info - bss_info_tag_handler Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: do not use function pointers whenever possibleLorenzo Bianconi1-115/+105
Remove function pointers in mt7615_mcu_set_bss_info and run function directly. Moreover remove __mt7615_mcu_set_bss_info since it is run just by mt7615_mcu_set_bss_info and remove duplicated istructions Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: unify __mt7615_mcu_set_dev_info and mt7615_mcu_set_dev_infoLorenzo Bianconi2-57/+38
Unify mt7615_mcu_set_dev_info and __mt7615_mcu_set_dev_info since the latter is run just by mt7615_mcu_set_dev_info Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: remove skb_ret from mt7615_mcu_msg_sendLorenzo Bianconi1-53/+24
Remove skb_ret parameter from mt7615_mcu_msg_send signature since it is actually used just by mt7615_mcu_patch_sem_ctrl. This is a prelimanry patch to use mt76 common mcu API Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: remove dest from mt7615_mcu_msg_send signatureLorenzo Bianconi1-34/+22
Remove dest parameter from mt7615_mcu_msg_send/__mt7615_mcu_msg_send routine signature since it can is always set to MCU_S2D_H2N Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: remove query from mt7615_mcu_msg_send signatureLorenzo Bianconi1-27/+26
Remove query parameter from mt7615_mcu_msg_send routine signature since it can be obtained from cmd value Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: remove unused parameter in mt7615_mcu_del_wtblLorenzo Bianconi3-4/+3
Remove unused vif parameter in mt7615_mcu_del_wtbl signature Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: unify mt7615_mcu_add_wtbl_bmc and mt7615_mcu_del_wtbl_bmcLorenzo Bianconi3-17/+14
Remove duplicated code in mt7615_bss_info_changed Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: use proper msg size in mt7615_mcu_add_wtblLorenzo Bianconi1-30/+24
Use proper mcu message size in mt7615_mcu_add_wtbl and do not allocate a huge buffer. Moreover use stack memory instead of heap one Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: use proper msg size in mt7615_mcu_add_wtbl_bmcLorenzo Bianconi1-30/+24
Use proper mcu message size in mt7615_mcu_add_wtbl_bmc and do not allocate a huge buffer. Moreover use stack memory instead of heap one Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: remove bss_info_convert_vif_type routineLorenzo Bianconi1-46/+27
Remove bss_info_convert_vif_type routine since it is run just in mt7615_mcu_set_bss_info and the switch over vif->type is already there. Simplify mt7615_mcu_set_bss_info routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: simplify __mt7615_mcu_set_sta_recLorenzo Bianconi1-30/+21
Do not loop over cmd payload in __mt7615_mcu_set_sta_rec since it is already done in before running __mt7615_mcu_set_sta_rec (e.g. mt7615_mcu_set_sta_rec) Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: simplify __mt7615_mcu_set_wtblLorenzo Bianconi1-36/+26
Do not loop over cmd payload in __mt7615_mcu_set_wtbl since it is already done in before running __mt7615_mcu_set_wtbl (e.g. mt7615_mcu_set_wtbl_key) Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt7615: Make mt7615_irq_handler staticYueHaibing1-1/+1
Fix sparse warning: drivers/net/wireless/mediatek/mt76/mt7615/pci.c:37:13: warning: symbol 'mt7615_irq_handler' was not declared. Should it be static? Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt7615: Use after free in mt7615_mcu_set_bcn()Dan Carpenter1-1/+1
We dereference "skb" when we assign: req.pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len); ^^^^^^^^ So this patch just moves the dev_kfree_skb() down a bit to avoid the use after free. Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: Fix a signedness bug in mt7615_add_interface()Dan Carpenter1-2/+3
The problem is that "mvif->omac_idx" is a u8 so it can't be negative and the error handling won't work. The get_omac_idx() function returns -1 on error. Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: move netif_napi_del in mt76_dma_cleanupLorenzo Bianconi4-3/+1
Move netif_napi_del in mt76_dma_cleanup routine since it is done by all drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt7615: use napi polling for tx cleanupLorenzo Bianconi2-3/+23
This allows tx scheduling and tx cleanup to run concurrently Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt7603: use napi polling for tx cleanupLorenzo Bianconi3-5/+31
This allows tx scheduling and tx cleanup to run concurrently Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: move tx_napi in mt76_devLorenzo Bianconi3-10/+11
Move tx_napi in mt76_dev data structure in order to implement concurrency between tx scheduling and tx cleanup in mt7603 and mt7615 drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt76x02: remove useless return in mt76x02_resync_beacon_timerLorenzo Bianconi1-3/+1
Remove useless return statment in mt76x02_resync_beacon_timer routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25airo: switch to skcipher interfaceArd Biesheuvel2-30/+29
The AIRO driver applies a ctr(aes) on a buffer of considerable size (2400 bytes), and instead of invoking the crypto API to handle this in its entirety, it open codes the counter manipulation and invokes the AES block cipher directly. Let's fix this, by switching to the sync skcipher API instead. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rt2800: do not enable watchdog by defaultStanislaw Gruszka3-3/+12
Make watchdog disabled by default and add module parameter to enable it. User will have to create file in /etc/modprobe.d/ with options rt2800lib watchdog=1 to enable the watchdog or load "rt2800lib watchdog=1" module manually before loading rt2800{soc,pci,usb} module. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rt2x00: add restart hwStanislaw Gruszka4-2/+54
Add ieee80211_restart_hw() to watchdog and debugfs file for testing if restart works as expected. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rt2800: do not nullify initialization vector dataStanislaw Gruszka1-5/+4
If we restart hw we should keep existing IV (initialization vector) otherwise HW encryption will be broken after restart. Also fix some coding style issues on the way. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rt2800: add pre_reset_hw callbackStanislaw Gruszka6-0/+24
Add routine to cleanup interfaces data before hw reset as ieee80211_restart_hw() will do setup interfaces again. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rt2800: initial watchdog implementationStanislaw Gruszka6-0/+67
Add watchdog for rt2800 devices. For now it only detect hung and print error. [Note: I verified that printing messages from process context is fine on MT7620 (WT3020) platform that have problem when printk is called from interrupt context]. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rt2800: add helpers for reading dma done indexStanislaw Gruszka6-0/+52
For mmio we do not properlly trace dma done Q_INDEX_DMA_DONE index for TX queues. That would require implementing INT_SOURCE_CSR_*_DMA_DONE interrupts, what is rather not worth to do due to adding extra CPU load (small but still somewhat not necessary otherwise). We can just read TX DMA done indexes from registers directly. What will be used by watchdog. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rt2x00: allow to specify watchdog intervalStanislaw Gruszka2-4/+10
Allow subdriver to change watchdog interval by intialize link->watchdog_interval value before rt2x00link_register(). Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25p54: remove dead branch in op_conf_tx callbackChristian Lamparter1-6/+3
This patch removes the error branch for (queue > dev->queues). It is no longer needed anymore as the "queue" value is validated by cfg80211's parse_txq_params() before the driver code gets called. Signed-off-by: Christian Lamparter <chunkeey@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: fix typo rtw_writ16_setTzu-En Huang1-1/+1
rtw_writ16_set should be rtw_write16_set Signed-off-by: Tzu-En Huang <tehuang@realtek.com> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: rsvd page should go though management queueYan-Hsuan Chuang1-1/+1
The hardware default uses management queue to transmit frames that are downloaded into reserved page, so we need to clearly assign the frames to use qsel in TX_DESC_QSEL_MGMT to avoid using wrong queue. Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: restore DACK results to save timeYan-Hsuan Chuang3-12/+355
DACK is done right after the hardware has been turned on, which means it will be done every time we leave the IDLE state. But it takes ~2 seconds to finish DACK. We can back up the results and restore them. And it only takes a few milliseconds to restore the results to the hardware, saving a lot of time. Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: power on again if it was already onYan-Hsuan Chuang1-1/+7
We could fail to power on because it was already on. If the return value is -EALREADY, power off and then power on again to turn on the hardware as expected. Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: 8822c: use more accurate ofdm fa countingYan-Hsuan Chuang2-4/+26
8822c used to count OFDM FA count by subtracting tx count from FA count. But it need to substract more counters to be accurate. However, we can count it by adding up all of the FA counters we want. And it is simpler to add than list all of the components to substract. Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: 8822c: disable rx clock gating before counter resetYan-Hsuan Chuang2-0/+6
Driver Could fail to reset counter if rx clock gating is not disabled. So we need to disable rx clock gating before resetting counters. Otherwise counters may increase unexpected. Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: 8822c: update channel and bandwidth BB settingChien-Hsun Liao2-8/+56
In 2G channels, the cck source and rxagc should be set to different values based on different bandwidth to increase the performance of rx sensitivity. To improve rx throughput performance, the values of sbd subtune and pt_opt should be changed in different bandwidth. Signed-off-by: Chien-Hsun Liao <ben.liao@realtek.com> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: 8822c: add rf write protection when switching channelChien-Hsun Liao1-4/+9
Collision of writing rf registers could occur if the driver writes rf registers by direct write while the hardware is writing other rf registers by pi write simultaneously. Hardware pi write can be triggered by rf calibrations sometimes, so the driver can not always write rf registers by direct write protection. Direct write protection can make sure that there is no hardware pi write during the direct write. According to some experiments, if we add direct write protection when switching channel, the performance of rf calibration will not be affected. Signed-off-by: Chien-Hsun Liao <ben.liao@realtek.com> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-06-25rtw88: add beacon function settingChin-Yen Lee3-0/+21
Add beacon function setting routines for each hardware port. If beacon function is not enabled, the hardware is not able to synchronize with AP's beacon and can miss the beacons under some scenarios such as PS mode. For AP and Adhoc modes that require to send beacons, do not update the TSF, otherwise the beacon interval may be affected. Signed-off-by: Chin-Yen Lee <timlee@realtek.com> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>