Commit Graph
39 Commits
Author SHA1 Message Date
Stanislaw GruszkaandFelix Fietkau a80acaf544 mt76x02: initialize mutli bss mode when set up address
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-31 09:37:27 +01:00
Lorenzo BianconiandFelix Fietkau 9661da4580 mt76: add energy detect CCA support to mt76x{0,2}e drivers
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 <[email protected]>
2018-12-28 13:43:56 +01:00
Stanislaw GruszkaandFelix Fietkau 628f8d72e2 mt76x02: set protection according to ht operation element
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 <[email protected]>
2018-12-28 13:43:56 +01:00
Stanislaw GruszkaandFelix Fietkau d94e9c4c44 mt76x02: do not set protection on set_rts_threshold callback
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 <[email protected]>
2018-12-28 13:43:56 +01:00
Felix Fietkau fea7ad804e mt76: move mt76x02_phy_get_min_avg_rssi to mt76 core
This will be used by mt7603 as well

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-05 17:06:59 +01:00
Felix Fietkau 7b1373e7e2 mt76: mt76x02: remove mt76x02_txq_init
Open-coding it simplifies the code

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-16 12:09:52 +01:00
Felix Fietkau d7788cc661 mt76: mt76x02: make group_wcid the first member in struct mt76x02_vif
Allows mt76 core to cast vif->drv_priv to struct mt76_wcid

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-16 12:09:52 +01:00
Felix Fietkau 009ab9179e mt76: clean up more unused EXPORT_SYMBOLs
Make functions static where possible

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-16 12:09:52 +01:00
Felix Fietkau 9d59d2a53f mt76: add support for reporting tx status with skb
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 <[email protected]>
2018-10-25 18:27:55 +02:00
Lorenzo BianconiandFelix Fietkau fe5a1494c1 mt76: move tx protection routines in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau a4a08c33a9 mt76: move mac beacon routines in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau d4391ae2f0 mt76: move mt76x02_mac_set_short_preamble in mt76x02_mac.c
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Felix Fietkau b51337adf0 mt76: clean up unused leftover EXPORT_SYMBOLs
Make previously exported functions static where possible

Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-18 10:16:44 +02:00
Lorenzo BianconiandFelix Fietkau 9e493f7500 mt76: move mt76x02_mac_work routine in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:49:15 +02:00
Lorenzo BianconiandFelix Fietkau eab7ab1450 mt76x0: pci: add get_survey support
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:49:15 +02:00
Lorenzo BianconiandFelix Fietkau fd9b2b0fdf mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mac.c
Use mt76x02_dev data structure as reference in mt76x02_mac.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 9730290287 mt76: move mt76x02_tx_complete in mt76x02-lib module
Move mt76x02_tx_complete mt76x02-lib module in order to
be reused by mt76x0 drivers for irq unification.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 20:00:30 +02:00
Lorenzo BianconiandFelix Fietkau 3770c54128 mt76: move mt76x02_mac_poll_tx_status in mt76x02-lib moudle
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 20:00:30 +02:00
Lorenzo BianconiandFelix Fietkau e236ba5514 mt76: move mt76x02_mac_process_rx in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau 4bae980ce2 mt76: usb: use mt76x02u_tx_prepare_skb to fill txwi
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-04 12:55:58 +02:00
Lorenzo BianconiandFelix Fietkau c49a3ae79f mt76: move mt76x02_mac_write_txwi in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-04 12:55:58 +02:00
Stanislaw GruszkaandFelix Fietkau cf8f750600 mt76: fix return value of mt76x02_wait_for_mac
We need to return bool value in mt76x02_wait_for_mac.

Reported-by: Dan Carpenter <[email protected]>
Fixes: 2735a6dd7df3 ("mt76: unify wait_for_mac")
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-09-26 16:55:35 +02:00
Lorenzo BianconiandFelix Fietkau b59ed565de mt76: move mt76x02_mac_setaddr in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-09-21 18:05:35 +02:00
Stanislaw GruszkaandFelix Fietkau d8f7d2ecbf mt76: partially unify filling txwi fields
Merge code filing txwi fields the same way on mt76x0 and mt76x2.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 0a17b1e18c mt76: unify mac_process_rate
Merge mac_process_rate from mt76x0 and mt76x2.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 4674502740 mt76: unify send_tx_status and related helpers
Merge send_tx_status and helper functions from mt76x0 and mt76x2.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 41e0403540 mt76: unify load_tx_status
Unify load/fetch tx status from mt76x0 and mt76x2

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 3977f4881c mt76: unify txwi and rxwi structures
txwi and rxwi are the same for mt76x0 and mt76x2.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 91fce2f79f mt76: unify sta_rate_tbl_update and related helpers
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 <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau d972dddc3e mt76: pratially unify add_interface
Create common mt76x02_vif_init function and use int on drivers
add_interface callback.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 086ea9f42c mt76: unify sta structure part 2
Second part of unifying mt76x02_sta structure between mt76x0 and mt76x2.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 1f35eb5b86 mt76: unify sta structure part 1
First part of unifying mt76x02_sta structure between mt76x0 and mt76x2.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau fcf2130e42 mt76: unify mt76x02_vif struct
Private vif structures definitions are the same for mt76x2 and mt76x0.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 51b74acc22 mt76: use mac_wcid_set_drop in mt76x0
Move mt76x02_mac_wcid_set_drop to common code and use it in mt76x0.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 732535e54b mt76: unify mac_wcid_setup
Merge mt76x{0,2}_mac_wcid_setup into common code.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 428625526e mt76: unify mt76x02_mac_wcid_set_key
Merge mt76x{0,2}_mac_wcid_set_key into common code.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 34a95b8bf5 mt76: unify mac_shared_key_setup
Merge mt76x{0,2} mac_shared_key_setup into common code.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 55bceeeda2 mt76: unify mac_get_key_info
Merge mt76x{0,2} mac_get_key_info into new mt76x02_mac.c file.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 884eca5f4b mt76: unify wait_for_mac
Create new mt76x02_mac.h for common mac functions of mt76x0 and mt76x2
and unity wait_for_mac for both drivers.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00