summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
Commit message (Collapse)AuthorAgeFilesLines
* mt76: unify send_tx_status and related helpersStanislaw Gruszka2018-09-191-2/+2
| | | | | | | Merge send_tx_status and helper functions from mt76x0 and mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify load_tx_statusStanislaw Gruszka2018-09-191-1/+1
| | | | | | | Unify load/fetch tx status from mt76x0 and mt76x2 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify txwi and rxwi structuresStanislaw Gruszka2018-09-191-3/+3
| | | | | | | txwi and rxwi are the same for mt76x0 and mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify sta structure part 2Stanislaw Gruszka2018-09-041-2/+2
| | | | | | | Second part of unifying mt76x02_sta structure between mt76x0 and mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add mt76x2_mac_common to mt76x2-common moduleLorenzo Bianconi2018-08-021-627/+0Star
| | | | | | | | Move mac related code shared between mt76x2 and mt76x2u in mt76x2-common module Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: add buffer len to mt76x2_mac_write_txwi signatureLorenzo Bianconi2018-08-021-3/+3
| | | | | | | | | | Add frame length to mt76x2_mac_write_txwi routine signature and do not fetch it from skb since txwi data structure is added at the beginning of the skb for usb based devices and mt76x2_mac_write_txwi will be shared between pci and usb related code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: introduce mt76x2_mac_load_tx_status routineLorenzo Bianconi2018-08-021-17/+30
| | | | | | | | | | Add mt76x2_mac_load_tx_status routine since tx stats register map is shared between usb and pci based devices but usb devices do not have a tx stat irq line as pcie ones and it is necessary to load tx statistics using a workqueue Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: add frame protection supportLorenzo Bianconi2018-07-301-0/+30
| | | | | | | | Introduce mac80211 rts threshold handler in order to add frame protection support to mt76x2 driver Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: track ewma rssi for gain adjustment per stationFelix Fietkau2018-06-271-8/+25
| | | | | | | | This preserves more sensitivity when weak stations are active and avoids counting signal measurements from other unrelated networks Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: fix mrr idx/count estimation in mt76x2_mac_fill_tx_status()Lorenzo Bianconi2018-06-271-4/+2Star
| | | | | | | | | | Fix mcs and attempt count estimation in mt76x2_mac_fill_tx_status routine if the number of tx retries reported by the hw is grater than IEEE80211_TX_MAX_RATES Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e") Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: discard early received packets if not running yetFelix Fietkau2018-05-231-0/+3
| | | | | | | | | | If the radio was previously in running state, it can receive some packets before it is able to process them. This can lead to a crash if the channel is not initialized yet. Discard all rx packets until start() is called Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: remove unnecessary break in mt76x2_mac_process_tx_rate()Lorenzo Bianconi2018-05-041-1/+0Star
| | | | | | | | Remove unnecessary break statement in the default case of bw switch block in mt76x2_mac_process_tx_rate routine Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: remove warnings in mt76x2_mac_write_txwi()Lorenzo Bianconi2018-02-281-2/+2
| | | | | | | | | | | | | | | | | | | | 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 <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: do not set status->aggr for NULL data framesFelix Fietkau2018-02-011-1/+1
| | | | | | | | Avoids data connection stalls when the client toggles powersave mode Fixes: aee5b8cf2477 ("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>
* mt76: validate rx CCMP PNFelix Fietkau2018-01-261-13/+48
| | | | | | | | | | | | | | 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>
* mt76: pass the per-vif wcid to the core for multicast rxFelix Fietkau2018-01-261-3/+12
| | | | | | | Preparation for adding software rx CCMP PN validation Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: implement A-MPDU rx reordering in the driver codeFelix Fietkau2018-01-261-0/+7
| | | | | | | 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>
* mt76: get station pointer by wcid and pass it to mac80211Felix Fietkau2018-01-261-0/+13
| | | | | | | 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>
* mt76: add an intermediate struct for rx status informationFelix Fietkau2018-01-261-2/+2
| | | | | | | Preparation for passing in more internal rx data via skb->cb Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: fix TSF value in probe responsesFelix Fietkau2018-01-261-1/+5
| | | | | | | | 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 <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: fix transmission of encrypted management framesFelix Fietkau2018-01-241-0/+16
| | | | | | | | | | | | 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>
* mt76: fix possible NULL pointer dereferencing in mt76x2_mac_write_txwi()Lorenzo Bianconi2018-01-171-1/+1
| | | | | | | | | Verify wcid is not NULL before dereferencing the pointer to initialize txwi rate/power info Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e") Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: remove some harmless WARN_ONs in tx status and rx pathFelix Fietkau2018-01-081-14/+14
| | | | | | | | Discard affected packets instead. Should reduce the frequency of bogus bug reports Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add driver code for MT76x2eFelix Fietkau2017-12-071-0/+755
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>