Commit Graph
67 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau d679b56b95 mt76: move mac_work in mt76_core module
Move mac_work delayed_work and mac_work_count in mt76_phy since it is
used by all drivers. This is a preliminary patch to create a common mcu
library used by mt7615 and mt7921 drivers

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-14 11:14:59 +01:00
Allen PaisandFelix Fietkau 4f9f79b085 wireless: mt76: convert tasklets to use new tasklet_setup() API
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-10 13:15:51 +01:00
Felix Fietkau 1a2547b27d mt76: do not set NEEDS_UNIQUE_STA_ADDR for 7615 and 7915
The newer chipsets can deal with the same STA on multiple interfaces
Preparation for supporting more station interfaces

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-26 22:40:13 +02:00
Felix Fietkau b36d7ae096 mt76: mt7603: move number of streams detection to eeprom init
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-25 12:35:34 +02:00
Felix Fietkau 97e6513144 mt76: mt7603: check for single-stream EEPROM configuration
Some devices using MT7628 or MT7603 have only one antenna chain connected.
Detect these using the EEPROM rx/tx path settings

Reported-by: Qin Wei <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-25 07:11:14 +02:00
Lorenzo BianconiandFelix Fietkau 8bd88a1b18 mt76: enable p2p support
Introduce p2p-go/p2p-client suppor to mt76 driver

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-20 10:37:11 +02:00
Felix Fietkau 46e63c05f7 mt76: mt7603: enable dynamic sensitivity adjustment by default
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-22 10:05:32 +01:00
Felix Fietkau 0a53dcda52 mt76: mt7603: add upper limit for dynamic sensitivity minimum receive power
If the minimum power is raised too much, it can make it impossible for weaker
clients to connect, and there are some scenarios where the false detects will
not go down no matter how much the sensitivity is adjusted.
Fixes connectivity issues in some rare cases

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-22 10:04:37 +01:00
Felix Fietkau c75cf513c6 mt76: do not set HOST_BROADCAST_PS_BUFFERING for mt7615
mt7615 handles powersave buffering in firmware

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-13 22:56:34 +01:00
Lorenzo BianconiandFelix Fietkau fd1fa68606 mt76: move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76_phy_init
Move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76-core module since now all
drivers support Channel Switch Announcement

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Lorenzo BianconiandFelix Fietkau cf00467c5d mt76: mt7603: simplify led reg definitions
Rely on FIELD_PREP macro for led register definitions and
remove open coding

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 16:09:15 +01:00
Felix Fietkau 9e95fa6208 mt76: move txpower and antenna mask to struct mt76_phy
Adds multiple wiphy support to mt76_get_txpower

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:58:37 +01:00
Felix Fietkau a3e88bcf17 mt76: move state from struct mt76_dev to mt76_phy
Allows keeping per-wiphy state separate

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:54:55 +01:00
Felix Fietkau ee36c8e217 mt76: move channel state to struct mt76_phy
Add support for an extra wiphy in mt76_set_channel and mt76_get_survey
This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:54:17 +01:00
Lorenzo BianconiandFelix Fietkau e2f90adcc3 mt76: move interface_modes definition in mt76_core module
Move interface modes declaration in common code since now mt76
chipsets support all modes (NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP,
NL80211_IFTYPE_MESH_POINT and NL80211_IFTYPE_ADHOC)

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:26:32 +01:00
Lorenzo BianconiandFelix Fietkau e0731a82a1 mt76: move SUPPORTS_REORDERING_BUFFER hw property in mt76_register_device
Move SUPPORTS_REORDERING_BUFFER hw property configuration from chip
specific code to mt76_register_device since it is supported by all mt76
drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:26:32 +01:00
Felix Fietkau ee310307ad mt76: mt7603: track tx airtime for airtime fairness and survey
Poll per-station hardware counters after tx status events

Signed-off-by: Felix Fietkau <[email protected]>
2019-09-26 14:59:06 +02:00
Felix Fietkau f34b1ae42c mt76: track rx airtime for airtime fairness and survey
Report total rx airtime for valid stations as BSS rx time in survey

mt7615 is left out for now, it will be supported later by reading
hardware counters instead of calculating airtime in software

Signed-off-by: Felix Fietkau <[email protected]>
2019-09-26 12:42:08 +02:00
Ryder LeeandFelix Fietkau 8b7bbd0176 mt76: mt7603: fix some checkpatch warnings
This fixes the following checkpatch warnings:

WARNING: Improper SPDX comment style
CHECK: No space is necessary after a cast

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:30 +02:00
Felix Fietkau b973bef0f8 mt7603: do not use tssi-off power value for mt7628
This value does not exist in the MT7628 EEPROM guidelines, so it is empty

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:07:15 +02:00
Felix Fietkau bc5e041793 mt76: mt7603: enable hardware rate up/down selection
Improves performance by switching away from bad rates faster

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-03 21:45:10 +02:00
Lorenzo BianconiandFelix Fietkau 2dca431cd7 mt76: move nl80211_dfs_regions in mt76_dev data structure
Move dfs region field in mt76_dev data structure since it is
used by all drivers. This is a preliminary patch to add DFS support to
mt7615 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-06-25 13:19:51 +02:00
Felix Fietkau 539b679660 mt7603: improve hardware rate switching configuration
Now that tx status reporting can figure out the first attempted rate, we can
make switching from lower rates to higher rates more conservative.
This reduces retries under bad link conditions and ensures that fallback
rates get more test coverage

Signed-off-by: Felix Fietkau <[email protected]>
2019-06-25 00:16:22 +02:00
Felix Fietkau 0b6520bd1c mt7603: rework and fix tx status reporting
Tx status reporting on mt7603 has a number of issues:

- the hardware can alter the first rate index, but it is not reported to
  the driver
- probing is very imprecise, because it alters the per-client rate set,
  but only considers info->status.rates for rate selection of a single probe
  packet
- short/long GI selection has limitations, which are not accurately reported
  to mac80211
- if rates are changed while packets are in flight, tx status reports for
  the old rate set might be processed based on the new selection

This led to very suboptimal rate selection with minstrel_ht.

This patch completely reworks tx status reporting to get rid of these
limitations:

- Store the previous and current rate set in the driver + the TSF value
  at the time of the switch.
- Use the tx status TSF value to determine which rate set needs to be used
  as reference.
- Report only short or long GI rates for a single status event, not a mix.
- The hardware reports the last used rate index. Use it along with the
  retry count to figure out what rate was used for the first attempt.
- Use the same retry count value for all rate slots to make this calculation
  work.
- Derive the probe rate from the current rateset instead of the skb cb
- Do not wait for a status report for the probe frame before removing the
  probe rate from the rate table. Do it immediately after it was referenced
  in a tx status report.
- Use the first half of the first rate retry budget for the probe rate
  in order to avoid using too many retries on that rate

With this patch, throughput under bad link conditions is improved
significantly, and there is a lot less rate fluctuation going on.

Signed-off-by: Felix Fietkau <[email protected]>
2019-06-25 00:03:50 +02:00
Felix Fietkau 77d0e3378b mt76: fix setting chan->max_power
When setting chan->max_power after registering the wiphy, chan->max_reg_power
needs to be used as a limit

Signed-off-by: Felix Fietkau <[email protected]>
2019-05-31 22:03:13 +02:00
Felix Fietkau 89cda5d854 mt7603: fix reading target tx power from eeprom
For the external PA (TSSI OFF) case, the target power needs to be read
from a different location in EEPROM

Signed-off-by: Felix Fietkau <[email protected]>
2019-05-31 22:02:19 +02:00
Lorenzo BianconiandFelix Fietkau f9dadd2d93 mt76: mt7603: add debugfs knob to enable/disable edcca
Introduce a knob in mt7603 debugfs in order to enable/disable
energy detection based on CCA thresholds

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-05-20 18:57:45 +02:00
Lorenzo BianconiandFelix Fietkau 6e790e106a mt76: move pre_tbtt_tasklet in mt76_dev
Move pre_tbtt_tasklet tasklet in mt76_dev data structure since
it is used by all drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-30 17:52:28 +02:00
Lorenzo BianconiandFelix Fietkau be8f0394e3 mt76: mt7603: initialize mt76_mcu_ops data structure
Use __mt76_mcu_send_msg wrapper instead of mt7603_mcu_msg_send.
This is a preliminary patch for mt7615-mt7603 mcu code unification

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-30 11:37:12 +02:00
Lorenzo BianconiandFelix Fietkau a7dfcf2e24 mt76: move mac_work in mt76_dev
Move mac_work delayed work in mt76_dev data structure since
it is used by all drivers and it will be reused adding mac work to
mt7615

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau 61311d9b30 mt76: introduce mt76_free_device routine
Move mt76_tx_free in mt76_free_device routine in order to
unmap all txwi descriptors at module unload

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Felix Fietkau a11b67348a mt76: fix tx power issues
- tx power is stored in the channels after ieee80211_register_hw, so
  chan->orig_mpwr needs to be updated as well
- for non-TSSI devices, mt76x2e needs to use a different target power value
  from the EEPROM
- fix a rounding error in a few places (need to round up, not down)

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-27 12:54:48 +01:00
Felix Fietkau 7e9e9ad734 mt76: mt7603: add missing initialization for dev->ps_lock
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-22 13:29:47 +01:00
Lorenzo BianconiandFelix Fietkau 81a32aa61f mt7603: remove mt7603_mcu_init routine
Remove mt7603_mcu_init since mcu.mutex has been already initialized
in mt76_mmio_init. Run mt7603_load_firmware directly in
mt7603_init_hardware

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-16 20:28:17 +01:00
Felix Fietkau 320af65ca1 mt76: mt7603: use the correct hweight8() function
__sw_hweight8() is only defined if CONFIG_GENERIC_HWEIGHT is enabled.
The function that works on all architectures is hweight8().

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-11 14:09:05 +01:00
Felix Fietkau 00ac79d1af mt7603: fix initialization of max rx length
The previous version only accidentally disabled A-MSDU deaggregation by
using the wrong mask for rx length configuration, which left previous
length value in place.
Fix the length and initialize the register completely to keep A-MSDU
de-aggregation remaining disabled

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-08 19:51:42 +01:00
Lorenzo BianconiandFelix Fietkau 82fa31293f mt7603: move alloc_dev common code in mt76_alloc_device
Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-02-18 20:39:41 +01:00
Felix Fietkau 8027b5d061 mt7603: remove copyright headers
No longer needed because of SPDX License Identifier

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-31 18:30:30 +01:00
Felix Fietkau b5ac8e49c5 mt7603: initialize LED callbacks only if CONFIG_MT76_LEDS is set
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-30 15:03:25 +01:00
Felix Fietkau 0db925f076 mt7603: update HT/VHT capabilities after assoc
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-30 12:18:32 +01:00
Felix Fietkau c4e4982fa9 mt7603: set IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN
The hardware cannot report accurate tx A-MPDU length information, so tell rate
control to ignore it. Improves tx rate selection

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-16 22:35:17 +01:00
Felix Fietkau 63bf183451 mt76: add channel switch announcement support
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-15 14:27:02 +01:00
Felix Fietkau 148219d572 mt7603: fix checkpatch issues
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-29 13:27:35 +01:00
Felix Fietkau 6203d46fcc mt7603: add support for setting transmit power
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-06 14:38:07 +01:00
Felix Fietkau 2c8e9acb40 mt7603: initialize channel maximum power from eeprom data
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-06 14:13:29 +01:00
Felix Fietkau 9d009be68d mt7603: add dynamic sensitivity tuning based on false CCA events
This reduces sensitivity in cases where it could help throughput/stability.

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-05 18:26:20 +01:00
Felix Fietkau da00af00c5 mt7603: clear bit 18 in MT_SEC_SCR to fix ICV error
Ported from vendor driver

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-04 12:22:21 +01:00
Felix Fietkau 0ad998b6ff mt7603: increase aggregation limits (based on vendor driver changes)
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-04 12:22:21 +01:00
Felix Fietkau 80843237fa mt7603: implement code for adjusting energy detect CCA thresholds
Ported from the reference driver.
Should fix compliance with ETSI rules on preventing transmission while
energy detect values are above the threshold.
Relax rules for non-ETSI regdomains

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-03 18:03:52 +01:00
Felix Fietkau c3efb5d899 mt7603: add support for detecting MT7688 and single stream devices
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-28 14:34:05 +01:00