summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
AgeCommit message (Collapse)AuthorFilesLines
2021-06-19mt76: make mt76_update_survey() per phyRyder Lee1-1/+1
Reduce duplicated survey for DBDC. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: remove qid argument to drv->tx_complete_skbFelix Fietkau1-2/+1
It is not needed Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt76x02: minor mt76x02_mac_set_beacon optimizationStanislaw Gruszka1-1/+1
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-14mt76: mt76x02: split beaconingMarkus Theil1-2/+1
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 <markus.theil@tu-ilmenau.de> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: move state from struct mt76_dev to mt76_phyFelix Fietkau1-1/+1
Allows keeping per-wiphy state separate Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: mt76x02: track approximate tx airtime for airtime fairness and surveyFelix Fietkau1-0/+6
Estimate by calculating duration for EWMA packet size + estimated A-MPDU length on tx status events Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: unify channel survey update codeFelix Fietkau1-0/+1
Host time is used to calculate the channel active time on mt7603 and mt7615. Use the same on mt76x02 and move the lock to core code to get rid of some duplicated code. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: mt76x02: move mac_reset_counter in mt76x02_lib moduleLorenzo Bianconi1-0/+1
Unify mac_reset_counter routine and move it in mt76x02_lib module since it is shared by all mt76x02 drivers (pci/usb) Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt76x02: do not copy beacon skb in mt76x02_mac_set_beacon_enableLorenzo Bianconi1-1/+1
Do not copy beacon skb in mt76x02_mac_set_beacon_enable for usb devices since it will be done in mt76x02_update_beacon_iter. Moreover squash mt76x02_mac_set_beacon_enable and __mt76x02_mac_set_beacon_enable since the latter is run just by mt76x02_mac_set_beacon_enable Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: switch to SPDX tag instead of verbose boilerplate textRyder Lee1-12/+1
No functional change intended. Add SPDX identifiers to all remaining files in /mt76. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt76x02: remove enable from mt76x02_edcca_init signatureLorenzo Bianconi1-1/+1
Remove enable parameter from mt76x02_edcca_init routine signature since it is always true Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-05-01mt76: remove mt76_queue dependency from tx_complete_skb function pointerLorenzo Bianconi1-2/+2
Remove mt76_queue dependency from tx_complete_skb function pointer and rely on mt76_tx_qid instead. Remove flush from tx_complete_skb signature. This is a preliminary patch to introduce mt76_sw_queue support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-03-07mt76: mt76x2: implement full device restart on watchdog resetFelix Fietkau1-0/+2
Restart the firmware and re-initialize the MAC to be able to recover from more kinds of hang states Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-02-18mt76: explicitly disable energy detect cca during scanFelix Fietkau1-1/+1
Avoid reusing the previous channel's tx blocking state Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-02-18mt76: beaconing fixes for USBStanislaw Gruszka1-2/+2
Configure beaconing on USB devices without PS buffering support. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-02-18mt76x02: initialize mutli bss mode when set up addressStanislaw Gruszka1-1/+1
BSSID is not strtirct related with beaconing (for example we can have 2 STA vifs) and more related with MAC address, so initaize BSSID when setting MAC address. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-01-17mt76: move mt76x02_phy_get_min_avg_rssi to mt76 coreFelix Fietkau1-6/+0
This will be used by mt7603 as well Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-01-11mt76: add energy detect CCA support to mt76x{0,2}e driversLorenzo Bianconi1-0/+2
Ported from the reference driver. Should fix compliance with ETSI regulatories on preventing transmission while energy detect values are above the threshold. The code has been tested using an ath9k device running tx99 as noise generator Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-01-11mt76x02: set protection according to ht operation elementStanislaw Gruszka1-0/+2
Configure protection based on information that are provided to us either by remote AP or by hostapd via HT operation IE. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-01-11mt76x02: do not set protection on set_rts_threshold callbackStanislaw Gruszka1-1/+1
Use set_rts_threshold calback to enable/disable threshold only for legacy traffic. Protection for HT and VHT traffic is defined by HT operation element and it's provided by remote AP or by hostapd. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: mt76x02: remove mt76x02_txq_initFelix Fietkau1-2/+0
Open-coding it simplifies the code Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: mt76x02: make group_wcid the first member in struct mt76x02_vifFelix Fietkau1-2/+1
Allows mt76 core to cast vif->drv_priv to struct mt76_wcid Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: add support for reporting tx status with skbFelix Fietkau1-19/+0
MT76x2/MT76x0 has somewhat unreliable tx status reporting, and for that reason the driver currently does not report per-skb tx ack status at all. This breaks things like client idle polling, which relies on the tx ack status of a transmitted nullfunc frame. This patch adds code to report skb-attached tx status if requested by mac80211 or the rate control module. Since tx status is polled from a simple FIFO register, the code needs to account for the possibility of tx status events getting lost. The code keeps a list of skbs for which tx status is required and passes them to mac80211 once tx status has been filled in and the DMA queue is done with it. If a tx status event is not received after one second, the status rates are cleared, and a succesful ACK is indicated to avoid spurious disassoc during assoc or client polling. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: clean up more unused EXPORT_SYMBOLsFelix Fietkau1-1/+0
Make functions static where possible Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: move tx protection routines in mt76x02-lib moduleLorenzo Bianconi1-2/+2
Move mt76x02_set_rts_threshold and mt76x02_mac_set_tx_protection routines in mt76x02-lib module and remove duplicated code in mt76x0 and mt76x2 drivers. Remove pci_mac.c and mt76x0/mac.c since now are empty files Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: move mac beacon routines in mt76x02-lib moduleLorenzo Bianconi1-0/+6
Move mt76x02_beacon mac routines in mt76x02_mac.c in order to be reused by mt76x0 driver adding AP support Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: move mt76x02_mac_set_short_preamble in mt76x02_mac.cLorenzo Bianconi1-0/+1
Move mt76x02_mac_set_short_preamble routine in mt76x02-lib module since it is shared between mt76x0 and mt76x2 drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: clean up unused leftover EXPORT_SYMBOLsFelix Fietkau1-2/+0
Make previously exported functions static where possible Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: move mt76x02_mac_work routine in mt76x02-lib moduleLorenzo Bianconi1-0/+1
Move mt76x02_mac_work routine in mt76x02_mac.c in order to be reused by mt76x0 driver to read device statistics Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76x0: pci: add get_survey supportLorenzo Bianconi1-0/+1
Move mt76x02_update_channel routine in mt76x02-lib module in order to be reused by mt76x0 driver adding get_survey support Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-13mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mac.cLorenzo Bianconi1-15/+16
Use mt76x02_dev data structure as reference in mt76x02_mac.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76: move mt76x02_tx_complete in mt76x02-lib moduleLorenzo Bianconi1-0/+19
Move mt76x02_tx_complete mt76x02-lib module in order to be reused by mt76x0 drivers for irq unification. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76: move mt76x02_mac_poll_tx_status in mt76x02-lib moudleLorenzo Bianconi1-0/+1
Move mt76x02_mac_poll_tx_status in mt76x02_mac.c in order to be reused by mt76x0 drivers for irq unification. Moreover introduce mt76x02_trace source file to define mt76x02 trace points Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76: move mt76x02_mac_process_rx in mt76x02-lib moduleLorenzo Bianconi1-0/+4
Move mt76x02_mac_process_rx utility routine in mt76x02-lib in order to by reused by mt76x0 driver for rxwi parsing. Add stream number check in mt76x02_mac_process_rx since mt76x0 chipsets are 1x1:1 Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76: usb: use mt76x02u_tx_prepare_skb to fill txwiLorenzo Bianconi1-5/+0
Use mt76x02u_tx_prepare_skb routine to fill txwi in mt76x2u and mt76x0u driver and remove duplicated code. Moreover add static qualifier to mt76x02_mac_tx_rate_val and mt76x02_mac_fill_txwi routines Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76: move mt76x02_mac_write_txwi in mt76x02-lib moduleLorenzo Bianconi1-0/+3
Move mt76x02_mac_write_txwi in mt76x02_mac.c since it is shared between mt76x0 and mt76x2 drivers. This is a preliminary patch to unify txwi configuration between mt76x0 and mt76x2 drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76: fix return value of mt76x02_wait_for_macStanislaw Gruszka1-1/+1
We need to return bool value in mt76x02_wait_for_mac. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 2735a6dd7df3 ("mt76: unify wait_for_mac") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76: move mt76x02_mac_setaddr in mt76x02-lib moduleLorenzo Bianconi1-0/+1
Move mt76x02_mac_setaddr utility routine in mt76x02-lib module and remove duplicated code. This is a preliminary patch to unify eeprom code between mt76x2 and mt76x0 driver Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76: partially unify filling txwi fieldsStanislaw Gruszka1-1/+2
Merge code filing txwi fields the same way on mt76x0 and mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76: unify mac_process_rateStanislaw Gruszka1-0/+2
Merge mac_process_rate from mt76x0 and mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76: unify send_tx_status and related helpersStanislaw Gruszka1-0/+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>
2018-09-19mt76: unify load_tx_statusStanislaw Gruszka1-0/+2
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>
2018-09-19mt76: unify txwi and rxwi structuresStanislaw Gruszka1-0/+54
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>
2018-09-19mt76: unify sta_rate_tbl_update and related helpersStanislaw Gruszka1-0/+56
Use common sta_rate_tbl_update on mt76x0 and mt76x2. mt76x0 do not have support TPC (transmision power control) implmented, msta->wcid.max_txpwr_adj is only set for mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76: pratially unify add_interfaceStanislaw Gruszka1-0/+3
Create common mt76x02_vif_init function and use int on drivers add_interface callback. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-04mt76: unify sta structure part 2Stanislaw Gruszka1-0/+7
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>
2018-09-04mt76: unify sta structure part 1Stanislaw Gruszka1-0/+21
First 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>
2018-09-04mt76: unify mt76x02_vif structStanislaw Gruszka1-0/+6
Private vif structures definitions are the same for mt76x2 and mt76x0. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-09-04mt76: use mac_wcid_set_drop in mt76x0Stanislaw Gruszka1-0/+1
Move mt76x02_mac_wcid_set_drop to common code and use it in mt76x0. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-09-04mt76: unify mac_wcid_setupStanislaw Gruszka1-0/+1
Merge mt76x{0,2}_mac_wcid_setup into common code. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>