900483 Commits

Author SHA1 Message Date
Felix Fietkau
cd82b0e0ca dt-bindings: net: wireless: mt76: document bindings for MT7622
MT7622 is a SoC that includes a 2.4 GHz 4x4 802.11n WMAC. Its
feature set is comparable to a MT7615 chip, but limited to 2.4 GHz.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:06 +01:00
Felix Fietkau
d9c54264d8 mt76: enable Airtime Queue Limit support
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-14 10:06:06 +01:00
Felix Fietkau
e970e66598 mt76: mt7603: increase dma mcu rx ring size
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-14 10:06:06 +01:00
Felix Fietkau
8f6c4f7ba1 mt76: dma: do not write cpu_idx on rx queue reset until after refill
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-14 10:06:06 +01:00
Felix Fietkau
93eaec7625 mt76: fix handling full tx queues in mt76_dma_tx_queue_skb_raw
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-14 10:06:06 +01:00
Felix Fietkau
5ffc6b5a98 mt76: set dma-done flag for flushed descriptors
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-14 10:06:06 +01:00
Lorenzo Bianconi
94d4d07675 mt76: mt76u: introduce MT_DRV_RX_DMA_HDR flag
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-14 10:06:06 +01:00
Lorenzo Bianconi
3bcd979c8a mt76: mt76u: add endpoint to mt76u_bulk_msg signature
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-14 10:06:06 +01:00
Lorenzo Bianconi
9803b7b161 mt76: mt76u: introduce mt76u_skb_dma_info routine
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-14 10:06:06 +01:00
Lorenzo Bianconi
16d6dac009 mt76: mt76u: take into account different queue mapping for 7663
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-14 10:06:05 +01:00
Lorenzo Bianconi
1e816c65cb mt76: mt76u: add {read/write}_extended utility routines
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-14 10:06:05 +01:00
Lorenzo Bianconi
94e1cfa890 mt76: mt76u: introduce mt76u_alloc_mcu_queue utility routine
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>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
1d54bc2716 mt76: mt76u: resume all rx queue in mt76u_resume_rx
Resume all possible rx queues after suspend. This is a preliminary patch
to support mt7663u 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>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
87999d4e6b mt76: mt76u: add queue parameter to mt76u_rx_urb_alloc
Add mt76_queue parameter to mt76u_rx_urb_alloc signature since this
routine will be used to allocate urbs for mcu hw queue used by new
chipset generation (e.g. mt7663u). Check sg_max_size in in
mt76u_urb_alloc in order to use linear urb for mcu queue

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-14 10:06:05 +01:00
Lorenzo Bianconi
63deaab0dd mt76: mt76u: add mt76u_alloc_rx_queue utility routine
Introduce mt76u_alloc_rx_queue routine to allocate rx hw 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>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
b430b7db38 mt76: mt76u: stop/free all possible rx queues
Stop/free all configured rx queues (data/mcu) in
mt76u_stop_rx/mt76u_free_rx. 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>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
38e09a49f4 mt76: mt76u: introduce mt76u_free_rx_queue utility routine
Introduce mt76u_free_rx_queue utility routine to free rx hw 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>
2020-02-14 10:06:05 +01:00
Lorenzo Bianconi
9aeb0d114d mt76: mt76u: move mcu buffer allocation in mt76x02u drivers
Move mcu buffer allocation in mt76x2u/mt76x0u drivers since newer
chipsets (e.g. mt7663u) does not rely on synchronous mcu communication

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-14 10:06:05 +01:00
Lorenzo Bianconi
37ec6a03d7 mt76: mt76u: add queue id parameter to mt76u_submit_rx_buffers
Add queue_id parameter to mt76u_submit_rx_buffers in order to reuse it
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-14 10:06:05 +01:00
Lorenzo Bianconi
2fe6a5564d mt76: mt76u: use mt76_queue as mt76u_complete_rx context
In order to reuse mt76u_complete_rx for both data and mcu rx queue, rely
on mt76_queue as urb context in mt76u_complete_rx. Moreover set usb rx
endoint according to rx queue in mt76u_submit_rx_buf. This is a
preliminary patch to add 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-14 10:06:05 +01:00
Lorenzo Bianconi
ab221b207b mt76: mt76u: add mt76_queue to mt76u_refill_rx signature
Introduce mt76_queue parameter to mt76u_refill_rx signature in order to
reuse it for mcu hw rx queue

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-14 10:06:04 +01:00
Lorenzo Bianconi
0d1862104e mt76: mt76u: add mt76_queue to mt76u_get_next_rx_entry signature
Rely on mt76_queue pointer in mt76u_get_next_rx_entry in order to add
support for new devices (e.g 7663u) that reports fw events through hw rx
mcu queue

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-14 10:06:04 +01:00
Lorenzo Bianconi
840728899c mt76: mt76u: add mt76u_process_rx_queue utility routine
Introduce mt76u_process_rx_queue routine to process rx hw 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>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
f4021e1f06 mt76: mt76u: check tx_status_data pointer in mt76u_tx_tasklet
New devices (e.g. mt7663u) do not rely on stats workqueue to load tx
statistics but will be reported by the firmware. Check tx_status_data
pointer in mt76u_tx_tasklet in order to reuse tx tasklet for new 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>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
a1ea1d688d mt76: mt76x02u: avoid overwrite max_tx_fragments
Starting from 'commit ee8040139ab1 ("mt76: do not overwrite
max_tx_fragments if it has been set")' we can avoid overwriting
max_tx_fragments for mt76x02u devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
85b7a5d0b2 mt76: rely on mac80211 utility routines to compute airtime
Rely on mac80211 airitme utility routines and remove mt76 duplicated code
to estimate tx/rx airtime

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
1b784c3343 mt76: mt7615: remove leftover routine declaration
Get rid of mt76_dfs_start_rdd unused declaration

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
fecde5da03 mt76: move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76_phy_init
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-14 10:06:04 +01:00
Ryder Lee
26b4876697 mt76: mt7615: fix endianness in mt7615_mcu_set_eeprom
The field 'u16 len' should be __le16.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
2ce73efe0f mt76: mt7615: initialize radar specs from host driver
Introduce dfs radar pattern specs in mt7615 driver in order to make
dfs debugging easier. Radar pulse/pattern thresholds are taken from
vendor SDK.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
d9d8be11f8 mt76: mt76x2: get rid of leftover target
Remove tracing leftover target in mt76x2 Makefile

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:04 +01:00
Lorenzo Bianconi
9cd82366a7 mt76: mt7615: add tracing support
Introduce token tracing support in mt7615_mac_tx_free routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Lorenzo Bianconi
5498974bd5 mt76: move mac_txdone tracepoint in mt76 module
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-14 10:06:03 +01:00
Lorenzo Bianconi
a3f657ec1f mt76: move dev_irq tracepoint in mt76 module
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-14 10:06:03 +01:00
Ryder Lee
c388d8584b mt76: mt7615: add a get_stats() callback
Add a get_stats() callback for mib statistics.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
679b23fef8 mt76: mt7615: add per-phy mib statistics
Update per-phy mib counters every 500ms.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
31affc967f mt76: mt7615: report TSF information
This adds a get_tsf() callback for ibss.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
0d88aea88f mt76: mt7615: add set_antenna callback
Add a set_antenna callback to setup per phy tx/rx streams.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
4fe9218c5e mt76: mt7615: rework set_channel function
No need to send both MCU_EXT_CMD_SET_RX_PATH and MCU_EXT_CMD_CHANNEL_SWITCH
together to MCU.

Split them out by passing the proper command in the corresponding flow.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Ryder Lee
2cad515ece mt76: mt7615: add missing settings for simultaneous dual-band support
MT7615 supports dual-wiphy which means that it can run on 2.4G and 5GHz
channels simultaneously, and driver should configure each band.

Add missing register settings, and refine band related definitions to
avoid duplicate codes.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:03 +01:00
Lorenzo Bianconi
cd736c4747 mt76: fix compilation warning in mt76_eeprom_override()
Fix the following compilation warning in mt76_eeprom_override routine
when CONFIG_OF is not set and label 'out' is not actually used

drivers/net/wireless/mediatek/mt76/eeprom.c: In function ‘mt76_eeprom_override’:
drivers/net/wireless/mediatek/mt76/eeprom.c💯1: warning: label ‘out’ defined but not used [-Wunused-label]

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Lorenzo Bianconi
ff44d907ee mt76: mt7603: simplify led reg definitions
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-14 10:06:02 +01:00
Lorenzo Bianconi
d1ff4a3c2f mt76: mt76x02: simplify led reg definitions
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-14 10:06:02 +01:00
Lorenzo Bianconi
ff913979a2 mt76: mt7615: introduce LED support
Initialize brightness_set and blink_set callbacks to
mt7615_led_set_brightness and mt7615_led_set_blink in order to enable
LED support in mt7615 driver

Tested-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Felix Fietkau
9379df2fd9 mt76: clear skb pointers from rx aggregation reorder buffer during cleanup
During the cleanup of the aggregation session, a rx handler (or release timer)
on another CPU might still hold a pointer to the reorder buffer and could
attempt to release some packets.
Clearing pointers during cleanup avoids a theoretical use-after-free bug here.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Felix Fietkau
d55aa5e174 mt76: mt7603: fix input validation issues for powersave-filtered frames
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-14 10:06:02 +01:00
Felix Fietkau
c99dc3c152 mt76: mt7615: increase MCU command timeout
MCU_EXT_CMD_EFUSE_BUFFER_MODE needs more time on initialization, and
with only 10 seconds it sometimes runs into timeouts.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Felix Fietkau
e5051965fd mt76: mt7615: measure channel noise and report it via survey
Read measurements every 100 ms and build a simple moving average

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Ryder Lee
a25c888f3a mt76: mt7615: fix MT7615_CFEND_RATE_DEFAULT value
Fix default CFEND_RATE and replace hardcode values.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00
Stanislaw Gruszka
b74f98b828 mt76: mt76x02: minor mt76x02_mac_set_beacon optimization
We do not call mt76x02_mac_set_beacon() with NULL skb any longer and
we do not need to return error value.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14 10:06:02 +01:00