Commit Graph
1719 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau 0394715025 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Lorenzo BianconiandFelix Fietkau fd877a17cc mt76: mt76x2: get rid of leftover target
Remove tracing leftover target in mt76x2 Makefile

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Lorenzo BianconiandFelix Fietkau 7801ebd775 mt76: mt7615: add tracing support
Introduce token tracing support in mt7615_mac_tx_free routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Lorenzo BianconiandFelix Fietkau 5ac9889c33 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Lorenzo BianconiandFelix Fietkau b06177ce38 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Ryder LeeandFelix Fietkau 8d690f3bfb mt76: mt7615: add a get_stats() callback
Add a get_stats() callback for mib statistics.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Ryder LeeandFelix Fietkau 2d22ef6187 mt76: mt7615: add per-phy mib statistics
Update per-phy mib counters every 500ms.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Ryder LeeandFelix Fietkau 1c258940d8 mt76: mt7615: report TSF information
This adds a get_tsf() callback for ibss.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Felix Fietkau 62c447e2c7 mt76: enable Airtime Queue Limit support
It is supported by all drivers

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-20 12:16:27 +01:00
Felix Fietkau 99ce686254 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 <[email protected]>
2020-01-20 12:15:56 +01:00
Felix Fietkau 14f37f8d86 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 <[email protected]>
2020-01-20 12:11:09 +01:00
Felix Fietkau 65745c5ac5 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 <[email protected]>
2020-01-20 12:08:32 +01:00
Felix Fietkau 9453dbe921 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 <[email protected]>
2020-01-20 12:07:10 +01:00
Felix Fietkau 161d1c73c6 mt7615: use local MAC address for the second PHY
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-16 10:42:57 +01:00
Felix Fietkau 43db699b1a mt76: mt7615: increment the MAC address of the secondary PHY (DBDC)
The hardware does not support using the same MAC address for interfaces,
even if they are on different bands.
In the future this will be made configurable via device tree

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-13 22:17:00 +01:00
Felix Fietkau 8f33a1e936 mt76: mt7615: report firmware log event messages
Useful for debugging firmware issues. Can be turned on via the "fw_debug"
debugfs file

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-13 22:17:00 +01:00
Lorenzo BianconiandDavid Bauer 38f4c57989 mt76: mt76x0: fix default mac address overwrite
Current implementation always use default eeprom mac address to
configure device registers even if it is updated using
mt76_eeprom_override. Fix it initializing macaddr filed of mt76_dev data
structure with eeprom mac address and running mt76_eeprom_override
before mt76x02_mac_setaddr

Fixes: d1bc9bf2072c ("mt76: mt76x0: eeprom: add support for MAC address from OF")
Tested-by: Kevin Schmidt <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
[backported from upstream commit 693d060536abca7b16d2fb8e66aa56be2a2443a2]
Signed-off-by: David Bauer <[email protected]>
2020-01-03 16:55:51 +01:00
Ryder LeeandFelix Fietkau 4cb1195a15 mt76: mt7615: add set_antenna callback
Add a set_antenna callback to setup per phy tx/rx streams.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-27 15:17:54 +01:00
Ryder LeeandFelix Fietkau e09b9f61ee 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-27 15:17:54 +01:00
Ryder LeeandFelix Fietkau 15e1c29ed8 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-27 15:15:07 +01:00
Lorenzo BianconiandFelix Fietkau 960f5cc239 mt76: mt76u: fix endpoint definition order
Even if they are not currently used fix BK/BE endpoint definition order.

Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 16:11:47 +01:00
Lorenzo BianconiandFelix Fietkau 1c8e76f4de 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:100:1: warning: label ‘out’ defined but not used [-Wunused-label]

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 16:11:10 +01:00
Lorenzo BianconiandFelix Fietkau cf00467c5d mt76: mt7603: simplify led reg definitions
Rely on FIELD_PREP macro for led register definitions and
remove open coding

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 16:09:15 +01:00
Lorenzo BianconiandFelix Fietkau cd759b00cc mt76: mt76x02: simplify led reg definitions
Rely on FIELD_PREP macro for led register definitions and
remove open coding

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 16:09:15 +01:00
Lorenzo BianconiandFelix Fietkau ae25a4bf99 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 <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 16:09:15 +01:00
Ryder LeeandFelix Fietkau d5fdd2e7ce mt76: mt7615: fix MT7615_CFEND_RATE_DEFAULT value
Fix default CFEND_RATE and replace hardcode values.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:43 +01:00
Stanislaw GruszkaandFelix Fietkau ca17e5657e 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:43 +01:00
Stanislaw GruszkaandFelix Fietkau 584c0784e0 mt76: mt76x02u: do not set NULL beacons
With current implementation we do not cleanup beacon memory, so is not
needed to call mt76x02_mac_set_beacon() with NULL skb.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:43 +01:00
Stanislaw GruszkaandFelix Fietkau 09fcbc214b mt76: usb: use max packet length for m76u_copy
For transferring data over USB the optimal size is endpoint maxpacket.
For my hardware maxpaket for control endpoint is 64 bytes and changing
to this value from 128 bytes further shorten TBTT work time from
3ms to 1ms.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:42 +01:00
Markus TheilandFelix Fietkau 6a84ad2130 mt76: mt76x02: add channel switch support for usb interfaces
This patch enables channel switch support on mt76 usb interfaces.

Signed-off-by: Markus Theil <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:42 +01:00
Markus TheilandFelix Fietkau fa24aba4c2 mt76: speed up usb bulk copy
Use larger batches for usb copy to speed this operation up. Otherwise it
would be too slow for copying new beacons or broadcast frames over usb.
Assure, that always a multiple of 4 Bytes is copied, as outlined in
850e8f6fbd "mt76: round up length on mt76_wr_copy" from Felix Fietkau.

Signed-off-by: Markus Theil <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:42 +01:00
Markus TheilandFelix Fietkau 462a16e185 mt76: mt76x02: remove a copy call for usb speedup
This patch removes a mt76_wr_copy call from the beacon path to hw.
The skb which is used in this place gets therefore build with txwi
inside its data. For mt76 usb drivers, this saves one synchronuous
copy call over usb, which lets the beacon work complete faster.

In mmio case, there is not enough headroom to put the txwi into the
skb, it is therefore using an additional mt76_wr_copy, which is fast
over mmio. Thanks Stanislaw for pointing this out.

Signed-off-by: Markus Theil <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:42 +01:00
Markus TheilandFelix Fietkau dc364547d9 mt76: mt76x02: add check for invalid vif idx
On adding vifs the idx can become 1 + (7 & 7) = 8 for APs.
Check against that, as only AP vif idx 0-7 is possible.

Signed-off-by: Markus Theil <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:42 +01:00
Markus TheilandFelix Fietkau 8b5d3615e1 mt76: mt76x02: split beaconing
Sending beacons to the hardware always happens in batches. In order to
speed up beacon processing on usb devices, this patch splits out common
code an calls it only once.

Beacons are sequentially written into the beacon memory area, by
tracking its usage with the dev->beacon_data_count. For MBSS support
and buffered traffic dev->beacon_data_count is used to create the bypass
mask.

The code is also adapted for the mmio part of the driver, but should not
have any performance implication there.

MBSS tests were performed with AVM AC860 USB NIC with temporary support
for 5 BSS'. Different combinations of active vifs were created and
brought up. Afterwards connection and data transfer was tested for the
announced BSS'.

Signed-off-by: Markus Theil <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:42 +01:00
Markus TheilandFelix Fietkau 85a8abf803 mt76: mt76x02: omit beacon slot clearing
mt76 hw does not send beacons from beacon slots, if the corresponding
bitmask is set accordingly. Therefore we can omit clearing the beacon
memory. Clearing uses many usb calls, if usb drivers are used. These
calls unnecessarily slow down the beacon tasklet. Thanks to Stanislaw
Gruzska for pointing this out.

Signed-off-by: Markus Theil <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:42 +01:00
Markus ElfringandFelix Fietkau 32129af260 net/wireless: Delete unnecessary checks before the macro call “dev_kfree_skb”
The dev_kfree_skb() function performs also input parameter validation.
Thus the test around the shown calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2019-12-22 15:17:32 +01:00
Felix Fietkau 99d8cd03ed 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 <[email protected]>
2019-12-21 17:02:53 +01:00
Felix Fietkau 726fd50165 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 <[email protected]>
2019-12-19 13:41:25 +01:00
Felix Fietkau 3ef5f3444a 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 <[email protected]>
2019-12-15 15:39:43 +01:00
Markus TheilandFelix Fietkau 05fa07c667 mt76: use AC specific reorder timeout
Before this patch, mt76 handled rx traffic for all TIDs equally,
when released from reorder buffer early. This patch uses an AC specific
reorder timeout, in order to release partial aggregated frames for video
ACs earlier. Voice ACs are currently not aggregated (thanks to Felix for
this hint). For example, ath10k also uses AC specific reorder timeouts
(reported by firmware in that case).

Signed-off-by: Markus Theil <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-14 18:16:08 +01:00
Shayne ChenandFelix Fietkau 05c87a3383 mt76: do not overwrite max_tx_fragments if it has been set
Prevent the overwriting of max_tx_fragments if it has already been set
in chip-specific init routine.

Signed-off-by: Shayne Chen <[email protected]>
2019-12-14 14:38:45 +01:00
Felix Fietkau 257c19f5b5 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 <[email protected]>
2019-12-14 00:15:27 +01:00
Lorenzo BianconiandFelix Fietkau a589d095ee mt76: mt7615: add set_coverage class support
Add the capability to configure acktimeout for mt7615 driver. Moreover
configure slottime according to the value provided by mac80211

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-13 23:16:36 +01:00
Lorenzo BianconiandFelix Fietkau 9354f0f41d mt76: mt7603: set 0 as min coverage_class value
Set 0 as minimum configurable value for coverage_class since mt76 does
not support dynack

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-13 23:16:36 +01:00
Lorenzo BianconiandFelix Fietkau 5cec93d57e mt76: mt76x02: fix coverage_class type
Fix coverage_class type in mt76x02_dev data structure since
coverage_class can be negative to enable dynack (just supported by
ath9k). Set 0 as minimum value for coverage_class

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-13 23:16:36 +01:00
Lorenzo BianconiandFelix Fietkau fc24815a2c mt76: mt7615: report firmware version using ethtool
Print fw_ver and build_date members of struct mt7615_fw_trailer
similarly to what appears in the output of 'dmesg' when the MCU firmware
is loaded.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-13 23:16:36 +01:00
Pablo GrecoandFelix Fietkau 8b362382b1 mt76: mt7615: Fix build with older compilers
Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
FIELD_GET inside an inline function, which ends up in a BUILD_BUG_ON.
Convert inline function to a macro.

Fixes commit bf92e7685100 ("mt76: mt7615: add support for per-chain
signal strength reporting")
Reported in https://lkml.org/lkml/2019/9/21/146

Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Pablo Greco <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-13 23:16:36 +01:00
Lorenzo BianconiandFelix Fietkau 812692db17 mt76: eeprom: add support for big endian eeprom partition
mt76x0e users reported some devices (e.g TP-Link Archer VR200v) have
been flashed with big endian radio partition. Add the possibility to
specify eeprom endianness using big-endian dts property and in case
covert eeprom data in little endian

Tested-by: Kevin Schmidt <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-13 23:16:32 +01:00
Lorenzo BianconiandFelix Fietkau 683eb244fa mt76: mt7603: reset STA_CCA counter setting the channel
Reset MT_MIB_STAT_CCA after channel switch since it is used to track busy
time starting from 'commit dcff8d4dc301 ("mt76: mt7603: switch to a
different counter for survey busy time")'

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-13 23:16:32 +01:00
Dan CarpenterandFelix Fietkau becdec318f mt76: Off by one in mt76_calc_rx_airtime()
The sband->bitrates[] array has "sband->n_bitrates" elements so this
check needs to be >= instead of > or we could read beyond the end of the
array.

These values come from when we call mt76_register_device():

	ret = mt76_register_device(&dev->mt76, true, mt7603_rates,
				   ARRAY_SIZE(mt7603_rates));

Here sband->bitrates[] is mt7603_rates[] and ->n_bitrates is the
ARRAY_SIZE()

Fixes: 5ce09c1a7907 ("mt76: track rx airtime for airtime fairness and survey")
Signed-off-by: Dan Carpenter <[email protected]>
2019-12-13 22:43:22 +01:00