aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/wireless/mediatek (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-03-12Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller1-3/+6
Minor overlapping changes, nothing serious. Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-03mt76: fix array overflow on receiving too many fragments for a packetFelix Fietkau1-3/+6
If the hardware receives an oversized packet with too many rx fragments, skb_shinfo(skb)->frags can overflow and corrupt memory of adjacent pages. This becomes especially visible if it corrupts the freelist pointer of a slab page. Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2020-02-14mt76: Introduce mt76_mcu data structureLorenzo Bianconi12-54/+48
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: mt7615: remove rx_mask in mt7615_eeprom_parse_hw_capLorenzo Bianconi1-6/+1
Get rid of rx_mask in mt7615_eeprom_parse_hw_cap routine since it is not actually used Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt76u: rename stat_wq in wqLorenzo Bianconi2-8/+8
Rename usb stat_wq in wq in order to be reused not just for gathering hw tx statistics Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt76u: extend RX scatter gather numberSean Wang1-1/+1
Set RX scatter gather number to 4 in order to extend the maximum AMSDU size to 11,454. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: rely on mt76_queues_read for mt7622Lorenzo Bianconi2-3/+7
As previous devices, mt7622 relies on multiple hw queues while for mt7615 we have just on per band hw queue and the mcu demux the traffic according to the packet AC. In order to dump all configured hw queues, rely on mt76_queues_read for mt7622 in mt7615 debugfs 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 Fietkau3-1/+2
mt7615 handles powersave buffering in firmware Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: rework rx phy index handlingFelix Fietkau4-50/+75
Overwriting the RMAC_CHFREQ register is not reliable enough, as the firmware could potentially write it again. Since there is no PHY index indication in the rx info, we need to use another way: If both PHYs are using different channels, find the PHY where chfreq matches the register value. The only corner case remaining is when both PHYs are using the same channel. In that case, the per-packet noise value on the primary PHY will have information belonging to the chains of the secondary PHY from the previous received packet of that PHY. The secondary PHY will set noise to 0 for extra chains. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: fix rounding issues on converting per-chain and combined txpowerFelix Fietkau4-36/+15
Unify code converting between the different txpower values. Always add/remove the combined txpower delta before dividing half-dB values. Also fix the combined txpower delta values. The correct half-dB delta for 3 chains is 9, not 8. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt76x2: avoid starting the MAC too earlyFelix Fietkau1-1/+1
Do not set the tx/rx start bits in MT_MAC_SYS_CTRL from within initvals. The driver sets these later when the hardware is ready Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: avoid extra RCU synchronization on station removalFelix Fietkau9-3/+23
Use sta_pre_rcu_remove callback to clear wcid pointer earlier Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: fix monitor mode on second PHYFelix Fietkau2-4/+10
The second PHY receives no packets unless there is an active vif present. Set the WANT_MONITOR_VIF flag to deal with that Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: fix adding active monitor interfacesFelix Fietkau1-0/+1
Treat them the same as AP iftype internally for MCU commands Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: switch mt7615_mcu_set_rx_ba to v2 formatRyder Lee1-28/+34
To adapt new firmware version. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Tested-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: switch mt7615_mcu_set_tx_ba to v2 formatRyder Lee1-27/+33
To adapt new firmware version. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Tested-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: use new tag sta_rec_wtblRyder Lee2-3/+27
In order to reduce command/event times, newer firmware adds a tag sta_rec_wtbl to take care of WTBL operations. MCU_EXT_CMD_WTBL_UPDATE is deprecated. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Tested-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: add starec operating flow for firmware v2Ryder Lee2-6/+19
Add fw_ver in mt7615_dev to check firmware version, and adjust mt7615_mcu_send_sta_rec() to adapt firmware v2 changes. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Tested-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: add a helper to encapsulate sta_rec operationRyder Lee1-57/+65
Operating command is simpler and just as clear Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Tested-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: simplify mcu_set_sta flowRyder Lee3-191/+153
Move mcu_add_wtbl and mcu_set_ht_cap into mcu_set_sta to simplify flow. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: simplify mcu_set_bmc flowRyder Lee3-61/+45
Move set_bmc_wtbl into sta_rec function to simplify flow. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: add support for testing hardware resetFelix Fietkau1-0/+24
Send an undersized corrupt packet to the DMA queue, which causes the firmware to issue a full chip reset Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: implement hardware reset supportFelix Fietkau8-2/+171
When the firmware detects a problem, it needs the host to stop/reset DMA and resume it again when the hardware state has been reset. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: report firmware log event messagesFelix Fietkau4-0/+70
Useful for debugging firmware issues. Can be turned on via the "fw_debug" debugfs file Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: fix and rework tx power handlingFelix Fietkau4-75/+105
Setting the tx power by manipulating EEPROM may in some cases not be enough, since it only covers the base target power and not per-rate offsets. In other cases, it could limit tx power of rates too much, possibly reducing throughput or range. Use firmware support for applying per-rate limit and power offsets for different values of Nss. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: add Kconfig entry for MT7622Felix Fietkau1-0/+11
This enables building support for the MT7622 SoC built-in WLAN chip Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: disable DBDC on MT7622Felix Fietkau1-0/+3
It is only supported on MT7615 Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: decrease rx ring size for MT7622Felix Fietkau1-2/+5
Since it's 2.4 GHz only, it needs fewer buffers Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: implement DMA support for MT7622Felix Fietkau4-60/+200
MT7622 does not have the CR4 microcontroller sitting in the data path. Because of that, it uses the chip's native tx descriptor format instead of something parsed and converted by the firmware. Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Co-developed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
2020-02-14mt76: mt7615: implement probing and firmware loading on MT7622Felix Fietkau8-13/+213
MT7622 does not have a CR4 microcontroller, so it only uses its own N9 firmware. Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Co-developed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: disable 5 GHz on MT7622Felix Fietkau1-0/+3
It is not supported by the chip, so avoid issues with potentially wrong EEPROM configurations. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: add calibration free support for MT7622Felix Fietkau1-0/+22
MT7622 uses fewer efuse overrides than MT7615 Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: add eeprom support for MT7622Felix Fietkau3-7/+14
When sending EEPROM data to the MCU, MT7622 uses a longer buffer Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Co-developed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: add dma and tx queue initialization for MT7622Felix Fietkau3-51/+154
MT7622 queue mapping is different from MT7615 and requires an extra dma scheduler init and a few register tweaks Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Co-developed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: fix MT_INT_TX_DONE_ALL definition for MT7622Felix Fietkau1-1/+1
MT7622 uses more interrupt bits for queue tx completion events. Enabling those extra bits is harmless on MT7615 Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Co-developed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: store N9 firmware version instead of CR4Felix Fietkau1-4/+4
CR4 is used very little, N9 is the main firmware that the driver interacts with Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: split up firmware loading functionsFelix Fietkau1-6/+26
Preparation for adding MT7622 support Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: move mmio related code from pci.c to mmio.cFelix Fietkau4-97/+108
Will be shared with MT7622 SoC support Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt7615: add __aligned(4) to txp structsFelix Fietkau1-2/+2
The beginning of the struct is guaranteed to be 4-byte aligned, and this attribute allows the compiler to generate more efficient code Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: enable Airtime Queue Limit supportFelix Fietkau1-0/+1
It is supported by all drivers Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> 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: dma: do not write cpu_idx on rx queue reset until after refillFelix Fietkau1-7/+8
The hardware should only start processing the ring after at least one buffer has been added Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: fix handling full tx queues in mt76_dma_tx_queue_skb_rawFelix Fietkau1-1/+8
Fixes a theoretical issue where it could potentially overwrite an existing descriptor entry (and leaking its skb) Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: set dma-done flag for flushed descriptorsFelix Fietkau1-1/+3
Avoids a theoretical corner case where the hardware could try to process a stale descriptor after a watchdog reset Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt76u: introduce MT_DRV_RX_DMA_HDR flagLorenzo Bianconi2-12/+20
Define MT_DRV_RX_DMA_HDR flag in drv_flag in order to not skip rx frame dma header since new devices (e.g. mt7663u) reports rx frame info in the usb dma header 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-02-14mt76: mt76u: add endpoint to mt76u_bulk_msg signatureLorenzo Bianconi2-6/+9
This is a preliminary patch to support mt7663u usb dongles 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-02-14mt76: mt76u: introduce mt76u_skb_dma_info routineLorenzo Bianconi3-23/+32
Introduce mt76u_skb_dma_info utility routine in mt76-usb module in order to be reused adding mt7663u 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>
2020-02-14mt76: mt76u: take into account different queue mapping for 7663Lorenzo Bianconi1-1/+9
7663u devices rely on a different endpoint mapping. Take it into account in mt76u_alloc_tx routine 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-02-14mt76: mt76u: add {read/write}_extended utility routinesLorenzo Bianconi4-29/+123
Introduce extended utility routines to read/write data o usb bus. New devices (e.g. mt7663u) will rely on both upper and lower part of the register address. Add ext parameter to mt76u_init signature in order to reuse the code adding mt7663u 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>
2020-02-14mt76: mt76u: introduce mt76u_alloc_mcu_queue utility routineLorenzo Bianconi2-0/+7
Add mt76u_alloc_mcu_queue utility routine to allocate mcu hw rx queue. This is a preliminary patch to support new devices (e.g. mt7663u) that rely on a hw queue for mcu messages 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>