Commit Graph
835 Commits
Author SHA1 Message Date
Stanislaw GruszkaandFelix Fietkau a8c61c25ad mt76x0: remove some usb specific code from mt76x0_register_device
Initial effort to make mt76x0_register_device bus neutral.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Stanislaw GruszkaandFelix Fietkau 3e241f3783 mt76x0: remove unused mt76x0_wcid
We do not use mt76x0_wcid any longer.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Stanislaw GruszkaandFelix Fietkau bb57912be5 mt76x0: inital split between pci and usb
For now pci driver can read ASIC version from the device :-)

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 2d77a9a869 mt76x0: use mt76_register_device for device registration
Use mt76_register_device routine for device registration.
mt76_register_device allows to enable VHT support on 5GHz band.
Overwrite unsupported vht features with mt76x0_vht_cap_mask routine.
Remove macaddr field of mt76x0_dev data structure and
use the mt76_dev one. Moreover remove following unused routines:
- mt76_init_sband
- mt76_init_sband_2g
- mt76_init_sband_5g

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 297cc34b62 mt76x0: remove has_{2,5}ghz fields of mt76x0_eeprom_params
Remove has_2ghz/has_5ghz fields of mt76x0_eeprom_params data
structure and use mt76_dev ones. This is a preliminary patch
to use shared routines for device allocation

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 12c01f4acd mt76x0: do not free/alloc buffers during suspend/resume
Do not free/alloc {tx,rx} buffers during suspend/resume phases
but use the ones previously allocated during hw probe.
Move {tx,rx}/mcu buffers allocation from mt76x0_init_hardware routine
to mt76x0_register_device

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau d07c02a093 mt76x0: move mt76x0_init_hardware in mt76x0_register_device
Move mt76x0_init_hardware routine in mt76x0_register_device
during hw probe. This is a preliminary patch to avoid {tx/rx}
buffer allocation during resume/suspend

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 98faee1e4d mt76x0: move stop related routines in mt76x0_mac_stop
Move tear-down routines in mt76x0_mac_stop function.
mt76x0_mac_stop routines will be reused in mt76x0_suspend

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 3c693a1492 mt76x0: fix memory leak during hw probe
Fix memory leak during hw probe if mt76x0_register_device fails
since MT76_STATE_INITIALIZED has not set yet and mt76x0_cleanup
does not free tx/rx queues and mcu buffers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau aae3fb8f53 mt76x0: alloc mcu buffers first in mt76x0_mcu_cmd_init
swap mt76u_mcu_init_rx and mt76x0_mcu_function_select in
mt76x0_mcu_cmd_init routine in order to allocate mcu buffers
first and then send mcu commands

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 246a216a2b mt76: move mt76 rate definitions in mt76x02-lib module
Move mt76x2_rate definition in mt76x02-lib module and rename it in
mt76x02_rates in order to be reused in mt76x0 driver.
Moreover remove unused mt76_rate definition

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 873d792431 mt76x0: remove mt76x0_stop_hardware routine
Since it is actually used in a single place and it just
runs mt76x0_chip_onoff routine, remove mt76x0_stop_hardware
and use mt76x0_chip_onoff directly

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau aa0c27928d mt76: remove unused MT76_MORE_STATS state
Remove no longer used hw state

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Stanislaw GruszkaandFelix Fietkau 6a9b73c288 mt76x0: trim rx skb to proper length
We need to truncate skb to proper length. This fix below message:

wlan0: associating with AP with corrupt beacon and probe response

Fixes: 9d87d9fad47e ("mt76x0: unify tx/rx datapath with mt76x2u driver")
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau a8fcaa37c1 mt76x0: init hw capabilities
Enable hw capabilities supported by mt76-usb layer
- fast_xmit
- tx/rx amsdu
- MFP
- non-linear tx skbs

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau bfbbf05852 mt76x0: enable per-sta tx queueing
Initialize wake_tx_queue function pointer in ieee80211_ops
in order to enable per-sta tx queueing. Moreover set driver
private txq size

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 8340e19fa8 mt76x0: remove unused stat_work
Remove unused definition of stat_work delayed_work definition and
related flush/cancel routines

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 0e92ff636a mt76x0: remove unused endpoint definitions
remove unused usb endpoint definitions since mt76x0
uses mt76-usb ones. Moreover remove unused usb_ctrl mutex

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau a4fd791093 mt76x0: remove unused mt76x0_tx_status routine
Remove no longer used mt76x0_tx_status routine since
mt76x0 driver uses mt76-usb utility routines to report tx-feedbacks

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau afb34b86b6 mt76x0: remove unused {tx/rx}_queue definitions
Remove unused tx_queue and rx_queue definitions since
now mt76x0 driver uses mt76-usb {tx/rx}_queues

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 964df72ba8 mt76x0: remove unused stat work_queue
Remove unused tx_status workqueue since now tx feedbacks are
processed by mt76-usb layer

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau ac02f5c96b mt76x0: remove unused dma.c source file
Remove unused dma.c source file since dma related routines are no
longer used

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 8c681150c1 mt76x0: set max fragments size
Set maximum number of tx fragments according to usb controller
features

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 85f171f52f mt76x0: stop stat workqueue at hw stop
Cancel tx status workqueue during vif teardown

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 062aaa8398 mt76x0: unify tx/rx datapath with mt76x2u driver
Use mt76/mt76-usb shared routine for tx/rx datapath.
Initialize mt76-usb tx/rx queues in mt76x0_init_hardware and
deallocate them in mt76x0_cleanup routine.
Moreover remove data padding in mt76_mac_process_rx routine.
Furthermore remove unused skb2q routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 37396010a5 mt76x0: add mt76x0_queue_rx_skb routine
Introduce mt76x0_queue_rx_skb routine as mt76x0 driver
frame rx handler. mt76x0_queue_rx_skb will be run by mt76-usb layer
rx datapath

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau dd77785a80 mt76x0: simplify mt76_mac_process_rx signature
Remove data pointer from mt76_mac_process_rx routine signature

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 746edd7d19 mt76x0: mark device as running in mt76x0_start
Set MT76_STATE_RUNNING flag in mt76x0_start routine and
clear it in mt76x0_stop one

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 3c40eafd9e mt76x0: disable usb rx bulk aggregation
In order to use zero-copying, disable usb rx bulk aggregation

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 26150902f3 mt76x0: use mt76_alloc_device for device allocation
Use mt76_alloc_device utility routine for mt76x0_dev/mt76_dev
allocation

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 0ba8261a49 mt76x0: init mt76_driver_ops callbacks
Init mt76_driver_ops callbacks in mt76x0_alloc_device.
mt76_driver_ops callbacks will be used by mt76-usb module

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 6c5ac15d5d mt76: move mt76x2u_tx_status_data in mt76x02-lib module
Move mt76x2u_tx_status_data routine in mt76x02-lib module and rename it
in mt76x02_tx_status_data in order to be reused in mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:24 +02:00
Lorenzo BianconiandFelix Fietkau 34cec25890 mt76x0: introduce mt76x0_tx_prepare_skb routine
Add mt76x0_tx_prepare_skb routine as tx txwi handler.
mt76x0_tx_prepare_skb will be used by mt76-usb layer

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-12 13:16:22 +02:00
Lorenzo BianconiandFelix Fietkau 53b3c5a531 mt76: move mt76x2u_set_txinfo in mt76x02-lib module
Move mt76x2u_set_txinfo routine in mt76x02-lib module and rename it in
mt76x02_set_txinfo in order to be reused in mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau b85e072e4d mt76: move mt76_qsel definition in dma.h
Move mt76_qsel definition in dma.h in order to be reused in mt76x0
driver. Moreover remove empty mt76x2_dma.h header file

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau c87a7e84b2 mt76: move mt76x2u_tx_complete_skb in mt76x02-lib moudule
Move mt76x2u_tx_complete_skb routine in mt76x02-lib module
and rename it in mt76x02_tx_complete_skb in order to be reused
in mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 87f138bfe0 mt76: move mt76x2u_remove_dma_hdr in mt76x02-lib module
Move mt76x2u_remove_dma_hdr in mt76x02-lib module and rename it in
mt76x02_remove_dma_hdr. Moreover use mt76x02_remove_hdr_pad routine
in mt76x02_remove_dma_hdr function.
Furthermore remove mt76x0_tx_skb_remove_dma_overhead routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 469aeb1104 mt76: move mt76x2_tx_complete routine in mt76x02-lib module
Move mt76x2_tx_complete routine in mt76x02-lib module and rename it in
mt76x02_tx_complete in order to be used in mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 3533718ecc mt76x2: change mt76x2_tx_complete routine signature
Use mt76_dev instead of mt76x2_dev in mt76x2_tx_complete signature
in order to be reused in mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +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 81a655afd7 mt76: unify {insert/remove}_hdr_pad
Merge insert/remove _hdr_pad from mt76x0 and mt76x2.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 8aac175371 mt76x0: reserve enough space in mac80211
Allocate skg with enough headroom by mac80211 , this eliminate need
to add extra skb headroom by the mt76x0 driver.

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 02816b0aba mt76: use mt76_rx_status in mt76x0
Make rx status processing similar to 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 57c3e8971e mt76: unify add_interface
Make common add_interface for mt76x0 and mt76x2e. This change behavior
for mt76x0, but it should work with the new implementation.

mt76x2u has different implementation. Maybe it can use common one,
but for now leave it as is.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Stanislaw GruszkaandFelix Fietkau 196720e348 mt76: unify remove_interface
Use common remove_interface callback in mt76x0 and mt76x2.

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