Commit Graph
644 Commits
Author SHA1 Message Date
Felix Fietkau df9f9f6740 mt7603: always try tx rate1 first
Tx status reporting cannot account for the tx attempt starting at a rate
further down the chain, so without this flag it leads to inaccurate
results.

Signed-off-by: Felix Fietkau <[email protected]>
2018-04-12 17:40:48 +02:00
Felix Fietkau 549f43b23e mt7603: ensure that the ACK flag is set for A-MPDUs with any acked subframe
Signed-off-by: Felix Fietkau <[email protected]>
2018-04-12 12:14:23 +02:00
Pawel DembickiandFelix Fietkau 1d23142954 mt76: add led active low to debugfs
In some boards mpcie leds have reversed polarity.
This patch allow change led polarity from userspace.

Signed-off-by: Pawel Dembicki <[email protected]>
2018-04-09 11:34:04 +02:00
Lorenzo BianconiandFelix Fietkau a3e7740ab8 mt76x2: fix tx_alc_enabled check
Fix mt76x2_temp_tx_alc_enabled routine since in order to enable tx_alc
temperature compensation it necessary to take into account BIT(15) of
MT_EE_TX_POWER_EXT_PA_5G eeprom info

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-09 10:15:14 +02:00
Lorenzo BianconiandFelix Fietkau 5153ece6b9 mt76x2: set default values in TX_ALC_CFG_{1,2} for tempetaure compensation
Initialize default values for temperature compensation in TX_ALC_CFG_{1,2}
if tssi has been enabled

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-09 10:14:39 +02:00
Lorenzo BianconiandFelix Fietkau 6e7d5ceb4f mt76x2: remove unnecessary MT_TX_ALC_CFG_4 configuration
Remove unnecessary MT_TX_ALC_CFG_4 configuration since the register value
will be properly set according to the usage of an external power amplifier

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-09 10:14:23 +02:00
Lorenzo BianconiandFelix Fietkau 700ed20476 mt76x2: make mt76x2_mac_reset routine static
Add static qualifier to mt76x2_mac_reset routine and remove the
prototype from mt76x2_mac.h since it is used just in mt76x2_init.c

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-03 21:36:32 +02:00
Lorenzo BianconiandFelix Fietkau bc35af8213 mt76x2: fix tssi initialization for 5GHz band
Fix mcu initial configuration for tssi calibration on 5GHz band

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-03 21:36:16 +02:00
Lorenzo BianconiandFelix Fietkau 880611b041 mt7603: main: fix warning in ieee80211_get_key_rx_seq()
Fall back to software encryption for hw unsupported ciphers in order
to fix the following warning in ieee80211_get_key_rx_seq routine:

WARNING: CPU: 0 PID: 1546 at backports-2017-11-01/net/mac80211/key.c:1010
mt76_wcid_key_setup+0x6c/0x210 [mt76]
CPU: 0 PID: 1546 Comm: hostapd Not tainted 4.9.87 #0
        ...
Call Trace:
[<8000e220>] show_stack+0x70/0x8c
[<80023a34>] __warn+0x110/0x118
[<80023ad0>] warn_slowpath_null+0x1c/0x2c
[<871515c0>] mt76_wcid_key_setup+0x6c/0x210 [mt76]
[<870a0c94>] 0x870a0c94
---[ end trace 1a391bb242f6a068 ]---

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-28 16:34:21 +02:00
Lorenzo BianconiandFelix Fietkau 238f3f1c2d mt76x2: remove warnings in mt76x2_mac_write_txwi()
Fix following sparse warnings in mt76x2_mac_write_txwi:
- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:201:26: warning:
  incorrect type in assignment (different base types)
- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:201:26: expected
  restricted __le32 [usertype] iv
- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:201:26: got unsigned
  int [unsigned] [usertype] <noident>
- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:202:27: warning:
  incorrect type in assignment (different base types)
- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:202:27: expected
  restricted __le32 [usertype] eiv
- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:202:27: got unsigned
  int [unsigned] [usertype] <noident>

Fixes: 23405236460b ("mt76: fix transmission of encrypted management
frames")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-21 11:23:10 +01:00
Lorenzo BianconiandFelix Fietkau ced433d006 mt76x2: add mac80211 {set,get}_antenna callbacks
Add capability to select tx/rx antennas. Possible values are:
 - 1: to use only the first antenna
 - 2: to use only the second antenna
 - 3: to use both of them

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-21 11:23:10 +01:00
Lorenzo BianconiandFelix Fietkau 6469dcafb5 mt76: add mt76_init_stream_cap routine
Add mt76_init_stream_cap utility routine to set ht/vht sta capabilities
related to number of streams currently used by the device
(it will be used by mac80211 set_antenna callback)

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-21 11:23:10 +01:00
Lorenzo BianconiandFelix Fietkau 7e6e00bf0a mt76: initialize available_antennas_{tx,rx} info
Initialize available_antennas related info in wiphy data structure
according to antenna_mask field; antenna_mask info is initialized
in device specific code and will be used in mac80211 {set,get}_antenna
callbacks

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-21 11:23:10 +01:00
Lorenzo BianconiandFelix Fietkau eb359f19b4 mt76x2: remove unnecessary len variable in mt76x2_eeprom_load()
Substitute unnecessary len variable in mt76x2_eeprom_load() with
MT7662_EEPROM_SIZE macro since len is used just to store eeprom
default size.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-19 21:39:09 +01:00
Lorenzo BianconiandFelix Fietkau 54d6710c93 mt76: use mt76_poll_msec routine in mt76pci_load_firmware()
Use mt76_poll_msec() in mt76pci_load_firmware to check if the firmware
has been started instead of explicitly poll MCU running register

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-19 21:38:48 +01:00
Lorenzo BianconiandFelix Fietkau 249fa2deda mt76x2: fix warning in ieee80211_get_key_rx_seq()
Fall back to software encryption for hw unsupported ciphers in order
to fix the following warning in ieee80211_get_key_rx_seq routine:

WARNING: CPU: 1 PID: 1277 at backports-2017-11-01/net/mac80211/key.c:
1010 mt76_wcid_key_setup+0x6c/0x138 [mt76]
CPU: 1 PID: 1277 Comm: hostapd Tainted: G        W       4.9.86 #0
Stack : 00000000 00000000 80527b4a 00000042 80523824 00000000 00000000 80520000
        8fd79a9c 804bbda7 80454c84 00000001 000004fd 80523824 8f7e4ba0 8eceda12
        00000010 8006af94 00000001 80520000 804c1f04 804c1f08 80459890 8ec999b4
        00000003 800a7840 8f7e4ba0 8eceda12 8121de20 00000000 00000001 00c999b4
        00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        ...
Call Trace:
[<8000f52c>] show_stack+0x70/0x8c
[<801d8d04>] dump_stack+0x94/0xd0
[<8002bcd4>] __warn+0x110/0x118
[<8002bd70>] warn_slowpath_null+0x1c/0x2c
[<8f0415cc>] mt76_wcid_key_setup+0x6c/0x138 [mt76]
[<8f1311b4>] mt76x2_dma_cleanup+0xa38/0x1048 [mt76x2e]

Fixes: 30ce7f4456ae ("mt76: validate rx CCMP PN")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-19 21:38:34 +01:00
Lorenzo BianconiandFelix Fietkau c66094e92d mt76x2: fix possible NULL pointer dereferencing in mt76x2_tx()
Fix a theoretical NULL pointer dereferencing in mt76x2_tx routine that
can occurs for injected frames in a monitor vif since vif pointer could
be NULL for that interfaces

Fixes: 23405236460b ("mt76: fix transmission of encrypted mgmt frames")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-19 21:38:25 +01:00
Felix Fietkau ffa2069e78 mt76: fix potential sleep in atomic context
Use cancel_delayed_work instead of cancel_delayed_work_sync

Signed-off-by: Felix Fietkau <[email protected]>
2018-02-27 16:04:08 +01:00
Felix Fietkau cda627fd8f mt76: add missing VHT maximum A-MPDU length capability
Signficantly improves throughput with some clients

Signed-off-by: Felix Fietkau <[email protected]>
2018-02-26 21:54:53 +01:00
Felix Fietkau 5ba59953c5 mt76x2: rework tx power handling
There were a number of issues in the existing tx power handling code:

1. The EEPROM target power for chain 0 refers to the actual output power
after the channel and bandwidth delta have been added to the initial
channel gain. This means the delta values should not be added/subtracted
for the rate power calculation

2. When power is reduced significantly, the initial channel gain
underflows very quickly, while the per-rate power offsets are high.
This miscalculation causes effective tx power to be increased when it
should actually be lowered.

Fix this by trying to adjust the channel gain to the lowest power from
the rate table. In case of under- or overflow, compensate by adding an
appropriate delta to the rate power values.

This makes power configuration more accurate on a wider range of
configurable values

Signed-off-by: Felix Fietkau <[email protected]>
2018-02-24 10:24:07 +01:00
Felix Fietkau 62d52e940b mt76: set RX_FLAG_DUP_VALIDATED for A-MPDU reordered packets
Required for fast-rx and allows mac80211 to skip an unnnecessary check.

Signed-off-by: Felix Fietkau <[email protected]>
2018-02-09 16:28:09 +01:00
Felix Fietkau 246d548b06 mt76: stop tx queues from the driver callback instead of common code
Allows the driver to control whether to send a BlockAckReq after waking
up. MT76x2 needs this set to true, for MT7603 it needs to be false

Signed-off-by: Felix Fietkau <[email protected]>
2018-02-09 16:01:39 +01:00
Felix Fietkau c60e6dbc4a mt76: toggle driver station powersave bit before notifying mac80211
Avoids race conditions from mac80211 enqueueing tx packets before the
tx-drop bit is cleared

Signed-off-by: Felix Fietkau <[email protected]>
2018-02-09 14:14:02 +01:00
Felix Fietkau 3413961e36 mt7603: avoid reordering qos-null data packets
Signed-off-by: Felix Fietkau <[email protected]>
2018-02-09 11:19:11 +01:00
Felix Fietkau 8693864cd5 mt76: check qos ack policy before reordering packets
Do not attempt to reorder packets not part of a BA session

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-29 09:35:39 +01:00
Felix Fietkau e67e7a55fd mt76x2: do not set status->aggr for NULL data frames
Avoids data connection stalls when the client toggles powersave mode

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-26 15:16:04 +01:00
Felix Fietkau c5209db332 mt76: avoid re-queueing A-MPDU rx reorder work if no frames are pending
Signed-off-by: Felix Fietkau <[email protected]>
2018-01-26 13:16:25 +01:00
Felix Fietkau 974142c098 mt76: implement processing of BlockAckReq frames
Avoids timeouts on reordered A-MPDU rx frames

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-26 12:34:49 +01:00
Felix Fietkau f515dfcca1 mt76: implement AP_LINK_PS
With software A-MPDU reordering in place, frames that notify mac80211 of
powersave changes are reordered as well, which can cause connection
stalls. Fix this by implementing powersave state processing in the
driver.

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-26 11:41:38 +01:00
Felix Fietkau 9c2e03dd0a mt7603: fix rx LDPC reporting
Signed-off-by: Felix Fietkau <[email protected]>
2018-01-25 16:46:58 +01:00
Felix Fietkau 3968dae910 mt7603: fix 40 mhz channel bandwidth reporting
Signed-off-by: Felix Fietkau <[email protected]>
2018-01-25 16:44:06 +01:00
Felix Fietkau c6f8caced2 mt76: let mac80211 validate CCMP PN for fragmented frames
The rules for those are more complex and performance is not an issue
here

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-25 11:29:25 +01:00
Lorenzo BianconiandFelix Fietkau 9f685fea72 mt7603: init: disable tbtt tasklet during device removal
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-01-23 14:54:50 +01:00
Lorenzo BianconiandFelix Fietkau 302af90bdc mt76x2: init: disable all pending tasklets during device removal
There is a possible race in mt76x2_stop_hardware() since pre_tbtt and
dfs tasklets could run during driver cleanup. Fix it disabling all
pending tasklets during device removal

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-01-23 11:39:46 +01:00
Felix Fietkau 9b2c77826d mt76: validate rx CCMP PN
Apparently hardware does not perform CCMP PN validation in hardware, so
we need to take care of this in the driver.

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-22 11:06:19 +01:00
Felix Fietkau 461cdf9f01 mt76: pass the per-vif wcid to the core for multicast rx
Preparation for adding software rx CCMP PN validation

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-22 11:06:17 +01:00
Felix Fietkau cf3cfc43af mt76: split mt76_rx_complete
Add a separate function for processing frames after A-MPDU reordering,
reduce code duplication

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-22 10:43:22 +01:00
Felix Fietkau b0508d3044 mt76: implement A-MPDU rx reordering in the driver code
This is required for performing CCMP PN validation in software

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-22 10:43:21 +01:00
Felix Fietkau 58a41f17aa mt76: get station pointer by wcid and pass it to mac80211
Avoids the rhashtable lookup based on the MAC address inside mac80211

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-22 10:14:25 +01:00
Felix Fietkau ad3f8e924e mt76: add an intermediate struct for rx status information
Preparation for passing in more internal rx data via skb->cb

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-21 10:48:29 +01:00
Felix Fietkau 0f8327abba mt76x2: fix TSF value in probe responses
Like beacons, probe responses need a hardware-generated TSF value. Set
the flag that causes the hw to generate it

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-19 18:07:54 +01:00
Felix Fietkau 34d612d9ed mt76: retry rx polling as long as there is budget left
Sending frames to mac80211 needs time, which could allow for more rx
packets to end up in the DMA ring. Retry polling until there are no more
frames left. Improves rx latency under load.

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-18 19:34:45 +01:00
Lorenzo BianconiandFelix Fietkau f76e25fe5a mt76x2: fix WMM parameter configuration
Fix hw queue configuration since mt76x2 devices use a reverse queue
enumeration respect to mac80211 one:
 - 0: AC_BE
 - 1: AC_BK
 - 2: AC_VI
 - 3: AC_VO

The issue can be reproduced sending two concurrent flow using
two separate queues:
 - VO: 20Mbps UDP traffic
 - BE: TCP traffic

In this scenario the UDP traffic will be blocked by the TCP one.
Fix it configuring properly WMM hw queue parameters

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Tested-by: Gaetano Catalli <[email protected]>
Signed-off-by: Gaetano Catalli <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-01-18 19:10:20 +01:00
Lorenzo BianconiandFelix Fietkau 5e4d60e833 mt76x2: dfs: take into account dfs region in mt76x2_dfs_init_params()
Do not enable DFS state machine if dfs region is set to NL80211_DFS_UNSET

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-01-18 19:06:53 +01:00
Lorenzo BianconiandFelix Fietkau cf591704e2 mt76x2: dfs: add set_domain handler
Add mt76x2_dfs_set_domain routine in order to properly reconfigure
pattern detector when DFS domain has been changed

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-01-18 19:06:30 +01:00
Lorenzo BianconiandFelix Fietkau 939e3e0ce2 mt76x2: dfs: avoid tasklet scheduling during mt76x2_dfs_init_params()
Substitute tasklet_kill with tasklet_disable/tasklet_enable in order to
guarantee dfs tasklet can not be executed during dfs parameter
initialization

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-01-18 19:06:06 +01:00
Fengguang WuandFelix Fietkau 2b7fae40d6 mt76: fix returnvar.cocci warnings
drivers/net/wireless/mediatek/mt76/mt76x2_main.c:86:5-8: Unneeded variable: "ret". Return "0" on line 112

 Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Fixes: a5f6039c8f9c ("mt76: add driver code for MT76x2e")
CC: Felix Fietkau <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-01-18 19:04:21 +01:00
Felix Fietkau 68b0cf17ef mt76x2: add functions for setting extended MAC address registers
Signed-off-by: Felix Fietkau <[email protected]>
2017-12-17 11:50:14 +01:00
Felix Fietkau d242650960 Revert "mt76x2: remove MAC address limitation for multi-vif setups"
This reverts commit 170f3341c6.
2017-12-17 11:44:47 +01:00
Felix Fietkau bdc6f2f970 Revert "mt76x2: clean up MAC/BSSID address initialization"
This reverts commit 3563b8fd0a.
2017-12-17 11:44:27 +01:00