Commit Graph

19 Commits

Author SHA1 Message Date
Felix Fietkau a164a94212 mt76: prevent tx scheduling during channel change
Re-schedule tx afterwards

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-05-23 10:58:09 +03:00
Felix Fietkau d98fb328ad mt76: fix sending encrypted broadcast packets for secondary interfaces
For encryption to work properly, the BSS index needs to be initialized
for the WCID entry used for the interface.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-05-23 10:56:47 +03:00
Lorenzo Bianconi 0d45d3fe42 mt76x2: apply coverage class on slot time too
According to 802.11-2007 17.3.8.6 (slot time), the slot time should
be increased by 3 us * coverage class. Taking into account coverage
class in slot time configuration allows to increase by an order of
magnitude the throughput on a 4Km link in a noisy environment

Tested-by: Luca Bisti <luca.bisti@gmail.com>
Tested-by: Gaetano Catalli <gaetano.catalli@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-05-23 10:56:05 +03:00
Felix Fietkau 11b2a25f02 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 (to be submitted later)
it needs to be false.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-04-24 20:29:55 +03:00
Lorenzo Bianconi c03a5aacde 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: 30ce7f4456 ("mt76: validate rx CCMP PN")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-03-27 12:12:35 +03:00
Lorenzo Bianconi 5ebdc3e069 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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-03-13 18:32:01 +02:00
Felix Fietkau d71ef28636 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.

Fixes: aee5b8cf24 ("mt76: implement A-MPDU rx reordering in the driver code")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-02-01 10:43:57 +02:00
Felix Fietkau 30ce7f4456 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. This is important for
protecting against replay attacks.

Since validation of fragmented frames is more complex, the CCMP header
for those is preserved. To keep the counter in sync, the first fragment
is verified by both mt76 and mac80211, and all other fragments only by
mac80211.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-26 11:20:52 +02:00
Felix Fietkau 3675302de8 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 <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-26 11:18:45 +02:00
Felix Fietkau aee5b8cf24 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 <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-26 11:18:39 +02:00
Felix Fietkau 9c68a57bc2 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 <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-26 11:18:34 +02:00
Lorenzo Bianconi 8c9f6491a3 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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-24 17:15:33 +02:00
Felix Fietkau 2340523646 mt76: fix transmission of encrypted management frames
Hardware encryption seems to break encrypted unicast mgmt tx.
Unfortunately the hardware TXWI header does not have a bit to indicate
that a frame is software encrypted, so sw-encrypted frames need to use a
different WCID. For that to work, the CCMP PN needs to be generated in
software, which makes things a bit slower, so only do it for keys that
also need to tx management frames.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-24 17:12:40 +02:00
Lorenzo Bianconi 1cbbf69cc8 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: 7bc04215a6 ("mt76: add driver code for MT76x2e")
Tested-by: Gaetano Catalli <gaetano.catalli@gmail.com>
Signed-off-by: Gaetano Catalli <gaetano.catalli@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-24 17:11:03 +02:00
Lorenzo Bianconi 99ac5327e9 mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()
Initialize mt76_txq pointer after ieee80211_txq pointer check.
Remove space after the pointer cast

Fixes: 7bc04215a6 ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-17 16:49:06 +02:00
Felix Fietkau e8be626d79 mt76x2: configure rx filter based on monitor mode setting
Due to an unrelated issue, the MT_RX_FILTR_CFG_PROMISC flag is currently
unset, which means that monitor mode is unconditionally enabled.
Toggle this flag based on the mac80211 monitor mode setting instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-08 19:25:55 +02:00
Felix Fietkau 53aa29b274 mt76x2: convert between per-chain tx power and combined output
Using both chains adds max. 3 dBm. A similar worst-case calculation is
being used in ath9k as well to ensure that the hardware stays within
regulatory limits

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-08 19:25:51 +02:00
Fengguang Wu 34152a809d 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 <nbd@nbd.name>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-01-08 19:25:47 +02:00
Felix Fietkau 7bc04215a6 mt76: add driver code for MT76x2e
MT76x2e is a 2x2 PCIe 802.11ac chipset by MediaTek. This driver has full
support for AP, station, ad-hoc, mesh and monitor mode.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2017-12-07 15:35:56 +02:00