summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt76.h
Commit message (Collapse)AuthorAgeFilesLines
* mt76: move mt76_token_init in mt76_alloc_deviceLorenzo Bianconi2021-04-211-1/+0
| | | | | | | | In order to remove duplicated code, move mt76_token_init in mt76_alloc_device routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7921: get rid of mcu_reset function pointerLorenzo Bianconi2021-04-211-1/+0
| | | | | | | | since mcu_reset it used only by mt7921, move the reset callback to mt7921_mcu_parse_response routine and get rid of the function pointer. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move token utilities in mt76 common moduleLorenzo Bianconi2021-04-211-5/+45
| | | | | | | | Move token management in mt76 common module since it is shared between mt7615, mt7915 and mt7921 drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move token_lock, token and token_count in mt76_devLorenzo Bianconi2021-04-211-0/+4
| | | | | | | | | Move token_lock, token and token_count data structures in mt76_dev. This is a preliminary patch to move token management in mt76 common module since it is shared by mt7615, mt7915 and mt7921 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: dma: add the capability to define a custom rx napi poll routineLorenzo Bianconi2021-04-211-2/+3
| | | | | | | | Add the capability to define a custom rx napi callback for each driver. This is a preliminary patch to properly support runtime-pm on rx side Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7663: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx pathLorenzo Bianconi2021-04-211-0/+1
| | | | | | | | | | Introduce mt7615_tx_worker routine as mt76 tx worker callback for mt7663. Rely on mt76_connac_pm_ref/mt76_connac_pm_unref to check PM state and increment/decrement wake counter Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7915: add support for applying pre-calibration dataRyder Lee2021-04-211-0/+1
| | | | | | | | | | | | When the EEPROM data is read from flash, it can contain pre-calibration data, which can save calibration time. Note that group_cal can save 30% bootup calibration time, and dpd_cal can save 75% channel switching time. Tested-by: Bo Jiao <bo.jiao@mediatek.com> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: extend DT rate power limits to support 11ax devicesShayne Chen2021-04-211-0/+1
| | | | | | | | | | | Enable parsing per-rate txpower limits from DT for 11ax chipsets. Co-developed-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Felix Fietkau <nbd@nbd.name> Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: add functions for parsing rate power limits from DTFelix Fietkau2021-04-211-0/+12
| | | | | | | | | | | This subnode can be used to set per-rate tx power limits either per country code / regdomain or globally. These limits are typically provided by the device manufacturers and are used to limit sideband emissions and stay within regulatory limits Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: testmode: add support to send larger packetShayne Chen2021-04-211-1/+2
| | | | | | | | | Add support to send larger packet in testmode to meet requirements of some test cases. The limit of max packet size is determined based on tx rate mode setting. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: report Rx timestampRyder Lee2021-04-121-1/+2
| | | | | | | | | Frame reception timestamp (low 32-bits) that indicates the value of the local TSF timer value at the time the first bit of the MAC header in the received frame (PPDU unit) arriving at the MAC. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: dma: export mt76_dma_rx_cleanup routineLorenzo Bianconi2021-04-121-1/+4
| | | | | | | | | | Export mt76_dma_rx_cleanup routine in mt76_queue_ops data structure. This is a preliminary patch to introduce mt7921 chip reset support. 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>
* mt76: dma: introduce mt76_dma_queue_reset routineLorenzo Bianconi2021-04-121-0/+3
| | | | | | | | | | | Introduce mt76_dma_queue_reset utility routine to reset a given hw queue. This is a preliminary patch to introduce mt7921 chip reset support. 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>
* mt76: introduce mcu_reset function pointer in mt76_mcu_ops structureLorenzo Bianconi2021-04-121-0/+1
| | | | | | | | | | | Introduce mcu_reset function pointer in mt76_mcu_ops structure in order to run hw related reset function for the mcu running on the chipset. This is a preliminary patch to introduce chip reset for mt7921 devices. 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>
* mt76: use threaded NAPIFelix Fietkau2021-04-121-0/+1
| | | | | | | | | | | | With threaded NAPI, the rx handler function is no longer bound to the CPU that fired the interrupt, which significantly helps to spread the workload over multiple CPUs, especially when multiple devices are using threaded NAPI at the same time. Exclude the tx handler from threaded NAPI by using a separate dummy netdev. The work is small and short-lived enough that it makes more sense to run it in softirq instead of creating a dedicated thread Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7615: fix key set/delete issuesFelix Fietkau2021-04-111-0/+1
| | | | | | | | | | | There were multiple issues in the current key set/remove code: - deleting a key with the previous key index deletes the current key - BIP key would only be uploaded correctly initially and corrupted on rekey Rework the code to better keep track of multiple keys and check for the key index before deleting the current key Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7915: add support for rx decapsulation offloadFelix Fietkau2021-04-111-0/+1
| | | | | | | For AP and Client mode, the hardware can pass received packets as 802.3 frames that can be passed to the network stack as-is. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7915: enable hw rx-amsdu de-aggregationLorenzo Bianconi2021-04-111-0/+7
| | | | | | | | Enable hw rx-amsdu de-aggregation support available in 7915 devices. This is a preliminary patch to enable rx checksum offload Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: add support for 802.3 rx framesFelix Fietkau2021-04-111-1/+1
| | | | | | Do not try to access the header when receiving them Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: introduce mt76_vif data structureLorenzo Bianconi2021-01-291-0/+8
| | | | | | | | Introduce mt76_vif data structure to share common fields between mt7615_vif and mt7921_vif and create a mcu common library Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move vif_mask back from mt76_phy to mt76_devFelix Fietkau2021-01-271-2/+2
| | | | | | Since it is global for all drivers, it belongs to the main device Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7915: bring up the WA event rx queue for band1Felix Fietkau2021-01-271-0/+1
| | | | | | This is needed for DBDC cards to work correctly on both bands simultaneously Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7615: set mcu country code in mt7615_mcu_set_channel_domain()Lorenzo Bianconi2021-01-271-0/+1
| | | | | | | | | Update mcu country code running mt7615_mcu_set_channel_domain routine in mt7615_regd_notifier(). Filter out disabled channels in mt7615_mcu_set_channel_domain(). Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: testmode: make tx queued limit adjustableShayne Chen2021-01-261-0/+1
| | | | | | | | | | | | | | | | | Originally, tx queued limit is set to 1000 to prevent from running out of tx token. If a new testmode tx is triggered while the previous one hasn't finished yet, we'll wait a period of time until tx_done equals to tx_queued. Normally, current queued limit can finish in 10 seconds. However, if ipg is configured to a larger value, less than 1000 packets can be done in the default timeout period, which may lead to a crash when a new testmode tx triggered. To deal with this, make tx queued limit dynamically adjusted according to ipg value. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: testmode: add attributes for ipg related parametersShayne Chen2021-01-261-0/+4
| | | | | | | | Add attributes for setting tx inter-packet gap (ipg), duty cycle, and transmission time in testmode. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: testmode: add support to set user-defined spe indexShayne Chen2021-01-261-0/+1
| | | | | | | | | | | | Add spatial extension (spe) index as a configurable parameter in testmode. This is used for specifically configuring TX path, such as different WF TX priority, number of antennas and spatial streams. If spe_idx is not set, TX path depends on tx_antenna_mask; otherwise, both spe_idx and tx_antenna_mask are referenced to decide TX path. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move chainmask in mt76_phyLorenzo Bianconi2021-01-261-0/+1
| | | | | | | | | | | Move chainmask from driver phy to mt76_phy since it is used by all drivers. This is a preliminary patch to create a common mcu library used by mt7615 and mt7921 drivers 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>
* mt76: move mac_work in mt76_core moduleLorenzo Bianconi2021-01-261-1/+3
| | | | | | | | | | | Move mac_work delayed_work and mac_work_count in mt76_phy since it is used by all drivers. This is a preliminary patch to create a common mcu library used by mt7615 and mt7921 drivers 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>
* mt76: testmode: move mtd part to mt76_devShayne Chen2021-01-261-3/+4
| | | | | | | | | Move testmode mtd variables to mt76_dev, since they are the same on each phy. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Acked-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: testmode: introduce dbdc supportShayne Chen2021-01-261-12/+31
| | | | | | | | | | Add testmode support for DBDC NICs (both MT7615D and MT7915D work). Testmode data and parameters are moved from per-dev to per-phy for maintaining the value of each band. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Acked-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: attempt to free up more room when filling the tx queueFelix Fietkau2020-12-041-0/+1
| | | | | | | Run dma cleanup immediately if the queue is almost full, instead of waiting for the tx interrupt Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: improve tx queue stop/wakeFelix Fietkau2020-12-041-0/+1
| | | | | | | | 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 <nbd@nbd.name>
* mt76: mt7915: introduce dbdc supportLorenzo Bianconi2020-12-041-0/+1
| | | | | | | | | | | | 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 <shayne.chen@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Co-developed-by: Ryder Lee <ryder.lee@mediatek.com> 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>
* mt76: move hw mac_addr in mt76_phyLorenzo Bianconi2020-12-041-2/+3
| | | | | | | This is a preliminary patch to properly support mt7915 dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move band allocation in mt76_register_phyLorenzo Bianconi2020-12-041-1/+2
| | | | | | | This is a preliminary patch to introduce dbdc support to mt7915 devices Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move band capabilities in mt76_phyLorenzo Bianconi2020-12-041-1/+1
| | | | | | | This is a preliminary patch to move properly support mt7915 dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move tx hw data queues in mt76_phyLorenzo Bianconi2020-12-041-3/+4
| | | | | | | | 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 <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mcu queues to mt76_dev q_mcu arrayLorenzo Bianconi2020-12-041-4/+4
| | | | | | | | | 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 <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: rely on mt76_queue in tx_queue_skb_raw signatureLorenzo Bianconi2020-12-041-1/+1
| | | | | | | | This is a preliminary patch to move data queues in mt76_phy and properly support dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: introduce mt76_init_mcu_queue utility routineLorenzo Bianconi2020-12-041-2/+37
| | | | | | | | | 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 <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: rely on mt76_queue in tx_queue_skb signatureLorenzo Bianconi2020-12-041-1/+1
| | | | | | | | | 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 <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: dma: rely on mt76_queue in mt76_dma_tx_cleanup signatureLorenzo Bianconi2020-12-041-2/+2
| | | | | | | | This is a preliminary patch to move data queues in mt76_phy and properly support dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt7663s: rely on mt76_queue in mt7663s_tx_run_queue signatureLorenzo Bianconi2020-12-041-1/+1
| | | | | | | | This is a preliminary patch to move data queues in mt76_phy and properly support dbdc for mt7915 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76_init_tx_queue in common codeLorenzo Bianconi2020-12-041-0/+4
| | | | | | | | Move mt76_init_tx_queue in mac80211.c since it is shared by all drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: testmode: add support for LTF and GI combinations for HE modeShayne Chen2020-12-041-0/+1
| | | | | | | | | Prepare for setting different LTF (1x, 2x, and 4x) and GI (0.8us, 1.6us, 3.2us) combinations in HE rate mode. Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: testmode: add tx_rate_stbc parameterShayne Chen2020-12-041-0/+1
| | | | | | | | Add the parameter to control STBC function in testmode. Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt76u: use dedicated thread for status workLorenzo Bianconi2020-12-041-0/+2
| | | | | | | Split tx and status path in mt76-usb module relying on mt76 workers APIs Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt76u: rely on woker APIs for rx workLorenzo Bianconi2020-12-041-1/+1
| | | | | | | | In order to improve parallelism, convert rx path in mt76-usb module to mt76 workers APIs Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76_mcu_send_firmware in common moduleLorenzo Bianconi2020-12-041-0/+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>
* mt76: sdio: get rid of sched.lockLorenzo Bianconi2020-12-041-1/+0
| | | | | | | | sched quota is now updated in mt7663s_txrx_worker so there is no more need of sched.lock mutex Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>