Commit Graph
100 Commits
Author SHA1 Message Date
Felix Fietkau 060e375a92 mt76: fix per-driver wcid range checks after wcid array size bump
All drivers before MT7915 have a limit of 128 WCID entries. Stop relying
on ARRAY_SIZE(dev->mt76.wcid), since it no longer reflects that limit.

Fixes: 49e649c3e0a6 ("mt76: adjust wcid size to support new 802.11ax generation")
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-20 08:11:08 +02:00
Felix Fietkau f85c1f3fc1 firmware: add mt7915 firmware
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:22:30 +02:00
Felix Fietkau d7a10094c4 mt7663: add client offload firmware
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:12:52 +02:00
Felix Fietkau 8688ed70c9 mt76: mt7615: use module parameter option for offload firmware preference
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:06 +02:00
Felix Fietkau 10a5b7630a mt76: mt7615: fix getting maximum tx power from eeprom
On top of the EEPROM target power, each rate can also has a power offset.
On many devices, this power offset is used to boost the tx power of lower
rates. Take this into account when parsing rate power.
The assumption here is, that the first rate (OFDM 6M or CCK 1M) has the
highest tx power

Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:06 +02:00
Felix Fietkau 7aabfd0c92 mt7615: add CONFIG_MT76_LEDS to cflags
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:06 +02:00
Felix Fietkau 6aaf029973 mt76: mt7615: fix endian issues in dcoc/txdpd calibration
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-27 19:53:08 +02:00
Felix Fietkau 1846da5dd4 mt76: mt7615: set spatial extension index
The vendor driver sets this in firmware rate control (which we don't use)

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-27 19:45:45 +02:00
Felix Fietkau 8304b38661 mt76: mt7603: fix tx status rate index calculation
A switch from one rate index to the next only happens when tx count from
the current slot is greater than MT7615_RATE_RETRY, which is 1 has to be
subtracted from count, instead of added to it.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau 4e7ce907fa mt76: mt7615: fix tx status rate index calculation
A switch from one rate index to the next only happens when tx count from
the current slot is greater than MT7615_RATE_RETRY, which is 1 has to be
subtracted from count, instead of added to it.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau 1656882f27 mt76: mt7615: do not adjust MAC timings if the device is not running
Avoids register writes and MAC start/stop when the hardware isn't ready for it

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau c0b19ac97c mt76: mt7615: adjust timing in mt7615_mac_set_timing to match fw/hw values
Slightly improves performance

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau 29a92c5606 mt76: mt7603: never use an 802.11b CF-End rate on 5GHz
Sometimes mt7615_mac_set_timing gets called while the slot time is still
configured to 20. Ensure that in this case it always uses the OFDM CFend
rate.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau 257319e9b0 mt76: mt7615: never use an 802.11b CF-End rate on 5GHz
Sometimes mt7615_mac_set_timing gets called while the slot time is still
configured to 20. Ensure that in this case it always uses the OFDM CFend
rate.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:46:38 +02:00
Felix Fietkau d73e3a23a5 mt76: mt7615: use larger rx buffers if VHT is supported
In VHT mode we can receive larger MPDUs. Increasing the buffer size reduces
fragmentation here, which should improve performance.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-20 16:53:29 +02:00
Felix Fietkau e5adbb2077 mt76: fix A-MPDU density handling
The hardware requirements for A-MPDU density are entirely on the tx side,
not the rx side. Because of that, the IE value should stay at 0 and the
minimum value should instead be enforced in WTBL/TXWI

MT7615 has no restrictions here

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-20 16:35:19 +02:00
Felix Fietkau 01fd34f3a6 mt76: mt7615: fix sta ampdu factor for VHT
If VHT has a larger A-MPDU size limit, pass it to the MCU via the wtbl_ht
TLV element.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-20 15:49:36 +02:00
Felix Fietkau 05b23d7478 mt76: mt7615: rework IRQ handling to prepare for MSI support
With MSI interrupts, IRQs must not be enabled from within the IRQ handler,
because that can lead to lost events.
Defer IRQ processing to a tasklet, which is also responsible for enabling
IRQs (to avoid race conditions against the handler)

Co-developed-by: Soul Huang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 19:54:25 +02:00
Felix Fietkau 8fb1cd20a7 mt76: mt7615: set hw scan limits only for firmware with offload support
They do not apply to software scan

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 12:35:22 +02:00
Felix Fietkau 08b8bd2bc9 mt76: mt7615: disable hw/sched scan ops for non-offload firmware
Avoid having to attempt hw scan and fall back to software for every scan
on devices/firmware without hw scan support

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 12:26:05 +02:00
Felix Fietkau 9406eb1d11 mt76: mt7615: fix endian issues in applying flash calibration data
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 16:54:00 +02:00
Felix Fietkau bf60f43b12 mt76: mt76x2: disable merge of OTP ROM data by default
The reference driver does not seem to enable it by default, only under certain
conditions, e.g. when a .bin file is loaded.
Make it opt-in via a device tree property for now, in case it is needed on some
boards.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 14:03:06 +02:00
Felix Fietkau 5a1eaa38d3 mt76: mt7603: disable merge of OTP ROM data by default
The reference driver does not seem to enable it by default, only under certain
conditions, e.g. when a .bin file is loaded.
Make it opt-in via a device tree property for now, in case it is needed on some
boards.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 14:01:56 +02:00
Felix Fietkau 55198aafb7 mt76: mt7615: add support for applying tx DPD calibration from EEPROM
When the EEPROM data is read from flash, it can contain tx DPD calibration
data. Add support for sending the data to the firmware.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:17 +02:00
Felix Fietkau 2b58998bb5 mt76: mt7615: add support for applying DC offset calibration from EEPROM
When the EEPROM data is read from flash, it can contain DC offset calibration
data. Add support for sending the data to the firmware.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:17 +02:00
Felix Fietkau d16a4698f1 mt76: mt7615: disable merge of OTP ROM data by default
The reference driver does not seem to enable it by default, only under certain
conditions, e.g. when a .bin file is loaded.
Make it opt-in via a device tree property for now, in case it is needed on some
boards.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:17 +02:00
Felix Fietkau 6e4b2a709f mt76: sync Makefile with upstream
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-26 14:36:18 +01:00
Felix Fietkau 3b4f938409 mt76: add memory barrier to DMA queue kick
Ensure that descriptor memory has been fully written before letting the
hardware read it

Signed-off-by: Felix Fietkau <[email protected]>
2020-03-26 14:24:28 +01:00
Felix Fietkau 8e9cd01228 mt7615: sync Kconfig with upstream
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-26 14:22:15 +01:00
Felix Fietkau a94e43f277 mt76: mt76x02: reset MCU timeout counter earlier in watchdog reset
Ensure that MCU commands issued right after hardware reset are not dropped
and treated as failed.

Signed-off-by: Felix Fietkau <[email protected]>
2020-03-10 17:11:04 +01:00
Felix Fietkau 81476f11b6 mt76: mt7615: fix antenna mask initialization in DBDC mode
Update wiphy available antenna mask, and fix chainmask setting on 3x3 hardware

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-25 13:15:38 +01: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 8f8e9161b3 mt76: fix array overflow on receiving too many fragments for a packet
If the hardware receives an oversized packet with too many rx fragments,
skb_shinfo(skb)->frags can overflow and corrupt memory of adjacent pages.
This becomes especially visible if it corrupts the freelist pointer of
a slab page.

Cc: [email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-19 13:55:52 +01:00
Felix Fietkau 284e9fd729 mt76: mt7615: fix monitor injection of beacon frames
When injecting beacon frames via monitor interface, they must not be sent to
the beacon hardware queue, because they don't follow normal hardware beacon tx
rules.
Fix sending them by adding a flag to mt7615_mac_write_txwi that selects the
beacon queue for tx, and use it only from mt7615_mcu_set_bcn.

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-17 17:46:33 +01:00
Felix Fietkau 17ecf07625 mt76: mt76x02: fix handling MCU timeouts during hw restart
If a MCU timeout occurs before a hw restart completes, another hw restart
is scheduled, and the station state gets corrupted.
To speed up dealing with that, do not issue any MCU commands after the first
timeout, and defer handling timeouts until the reset has completed.
Also ignore errors in MCU commands during start/config to avoid making user
space fail on this condition. If it happens, another restart is scheduled
quickly, and that usually recovers the hardware properly.

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-16 16:09:00 +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
Felix Fietkau 457a932036 mt76: mt7615: fix MT_TX_HW_QUEUE_EXT_PHY to deal with mac80211 changes
The size of info->hw_queue was reduced to 4 bits

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-13 22:51:34 +01:00
Felix Fietkau a205ce3e3e mt76: mt7615: fix ext_phy flag for stations
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-13 22:10:05 +01:00
Felix Fietkau fa14e7f331 mt76: mt7615: rework rx phy index handling
Overwriting the RMAC_CHFREQ register is not reliable enough, as the firmware
could potentially write it again.
Since there is no PHY index indication in the rx info, we need to use another
way:

If both PHYs are using different channels, find the PHY where chfreq matches
the register value.

The only corner case remaining is when both PHYs are using the same channel.
In that case, the per-packet noise value on the primary PHY will have
information belonging to the chains of the secondary PHY from the previous
received packet of that PHY. The secondary PHY will set noise to 0 for extra
chains.

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-13 21:25:11 +01:00
Felix Fietkau 1881241c7e mt76: fix rounding issues on converting per-chain and combined txpower
Unify code converting between the different txpower values. Always add/remove
the combined txpower delta before dividing half-dB values.
Also fix the combined txpower delta values. The correct half-dB delta for
3 chains is 9, not 8.

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-11 21:01:03 +01:00
Felix Fietkau 764e1d208a mt76: mt7615: fix tx power reporting
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-11 20:13:11 +01:00
Felix Fietkau d5a5e97b67 mt76: mt76x2: avoid starting the MAC too early
Do not set the tx/rx start bits in MT_MAC_SYS_CTRL from within initvals.
The driver sets these later when the hardware is ready

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-07 12:33:17 +01:00
Felix Fietkau bd0df1b017 mt76: avoid extra RCU synchronization on station removal
Use sta_pre_rcu_remove callback to clear wcid pointer earlier

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-07 12:33:17 +01:00
Felix Fietkau 269de7c229 firmware: fix version number for upcoming mt7615 mcu v2 support patches
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-02 17:11:59 +01:00
Felix Fietkau fd216cb5b2 mt76: mt7615: fix monitor mode on second PHY
The second PHY receives no packets unless there is an active vif present.
Set the WANT_MONITOR_VIF flag to deal with that

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-02 16:24:11 +01:00
Felix Fietkau b9d9f91b15 mt76: mt7615: fix adding active monitor interfaces
Treat them the same as AP iftype internally for MCU commands

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-02 16:13:04 +01:00
Felix Fietkau db97358df4 mt76: mt7615: add support for testing hardware reset
Send an undersized corrupt packet to the DMA queue, which causes the
firmware to issue a full chip reset

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-31 16:37:02 +01:00
Felix Fietkau 0f06914acf mt76: mt7615: implement hardware reset support
When the firmware detects a problem, it needs the host to stop/reset DMA and
resume it again when the hardware state has been reset.

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-31 16:37:02 +01:00
Felix Fietkau 7882bbd25c mt76: mt7615: fix and rework tx power handling
Setting the tx power by manipulating EEPROM may in some cases not be enough,
since it only covers the base target power and not per-rate offsets.
In other cases, it could limit tx power of rates too much, possibly reducing
throughput or range.
Use firmware support for applying per-rate limit and power offsets for
different values of Nss.

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:12:44 +01:00
Felix Fietkau f66b480434 mt76: mt7615: add Kconfig entry for MT7622
This enables building support for the MT7622 SoC built-in WLAN chip

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:38 +01:00
Felix Fietkau 6cd5c381ea mt76: mt7615: disable DBDC on MT7622
It is only supported on MT7615

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:38 +01:00
Felix Fietkau bddcbb25cd mt76: mt7615: decrease rx ring size for MT7622
Since it's 2.4 GHz only, it needs fewer buffers

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:38 +01:00
Felix Fietkau 79808e6232 mt76: mt7615: implement DMA support for MT7622
MT7622 does not have the CR4 microcontroller sitting in the data path.
Because of that, it uses the chip's native tx descriptor format instead of
something parsed and converted by the firmware.

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:38 +01:00
Felix Fietkau 80d3681b40 mt76: mt7615: implement probing and firmware loading on MT7622
MT7622 does not have a CR4 microcontroller, so it only uses its own N9
firmware.

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:37 +01:00
Felix Fietkau fd3ae9a342 mt76: mt7615: disable 5 GHz on MT7622
It is not supported by the chip, so avoid issues with potentially wrong
EEPROM configurations.

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:40 +01:00
Felix Fietkau f0b02d8115 mt76: mt7615: add calibration free support for MT7622
MT7622 uses fewer efuse overrides than MT7615

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:40 +01:00
Felix Fietkau ab94a85efb mt76: mt7615: add eeprom support for MT7622
When sending EEPROM data to the MCU, MT7622 uses a longer buffer

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:33 +01:00
Felix Fietkau 13a4269a1b mt76: mt7615: add dma and tx queue initialization for MT7622
MT7622 queue mapping is different from MT7615 and requires an extra dma
scheduler init and a few register tweaks

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:20 +01:00
Felix Fietkau 92bafd4b1b mt76: mt7615: fix MT_INT_TX_DONE_ALL definition for MT7622
MT7622 uses more interrupt bits for queue tx completion events.
Enabling those extra bits is harmless on MT7615

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:33:18 +01:00
Felix Fietkau f84b590b64 mt76: mt7615: store N9 firmware version instead of CR4
CR4 is used very little, N9 is the main firmware that the driver interacts with

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-29 17:18:19 +01:00
Felix Fietkau 51b1eb7a49 mt76: mt7615: split up firmware loading functions
Preparation for adding MT7622 support

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-29 17:18:19 +01:00
Felix Fietkau 1c4ff4f2dc mt76: mt7615: move mmio related code from pci.c to mmio.c
Will be shared with MT7622 SoC support

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-29 17:18:19 +01:00
Felix Fietkau d15a4bbb3f mt76: mt7615: add __aligned(4) to txp structs
The beginning of the struct is guaranteed to be 4-byte aligned, and this
attribute allows the compiler to generate more efficient code

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-29 17:14:46 +01:00
Felix Fietkau 60e2768960 firmware: update MT7615 CR4 firmware to 20190121161307
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-28 17:42:43 +01:00
Felix Fietkau 2db2bab099 firmware: update mt7615 N9 firmware to 20200107155603
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-28 17:38:47 +01:00
Felix Fietkau 62c447e2c7 mt76: enable Airtime Queue Limit support
It is supported by all drivers

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-20 12:16:27 +01:00
Felix Fietkau 99ce686254 mt76: mt7603: increase dma mcu rx ring size
The ring is used for looping back tx powersave filtered frames, so it could
use some more room, in case more than one aggregate was queued

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-20 12:15:56 +01:00
Felix Fietkau 14f37f8d86 mt76: dma: do not write cpu_idx on rx queue reset until after refill
The hardware should only start processing the ring after at least one
buffer has been added

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-20 12:11:09 +01:00
Felix Fietkau 65745c5ac5 mt76: fix handling full tx queues in mt76_dma_tx_queue_skb_raw
Fixes a theoretical issue where it could potentially overwrite an existing
descriptor entry (and leaking its skb)

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-20 12:08:32 +01:00
Felix Fietkau 9453dbe921 mt76: set dma-done flag for flushed descriptors
Avoids a theoretical corner case where the hardware could try to process
a stale descriptor after a watchdog reset

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-20 12:07:10 +01:00
Felix Fietkau 161d1c73c6 mt7615: use local MAC address for the second PHY
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-16 10:42:57 +01:00
Felix Fietkau 43db699b1a mt76: mt7615: increment the MAC address of the secondary PHY (DBDC)
The hardware does not support using the same MAC address for interfaces,
even if they are on different bands.
In the future this will be made configurable via device tree

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-13 22:17:00 +01:00
Felix Fietkau 8f33a1e936 mt76: mt7615: report firmware log event messages
Useful for debugging firmware issues. Can be turned on via the "fw_debug"
debugfs file

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-13 22:17:00 +01:00
Felix Fietkau 99d8cd03ed mt76: mt7603: fix input validation issues for powersave-filtered frames
Before extracting the tid out of the packet, check if it was qos-data.
Only accept tid values 0-7
Also, avoid accepting the hardware queue as skb queue mapping, it could
lead to an overrun. Instead, derive the hardware queue from the tid number,
in order to avoid issues with packets being filtered multiple times.
This also fixes a mismatch between hardware and software queue indexes.

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-21 17:02:53 +01:00
Felix Fietkau 726fd50165 mt76: mt7615: increase MCU command timeout
MCU_EXT_CMD_EFUSE_BUFFER_MODE needs more time on initialization, and
with only 10 seconds it sometimes runs into timeouts.

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-19 13:41:25 +01:00
Felix Fietkau 3ef5f3444a mt76: mt7615: measure channel noise and report it via survey
Read measurements every 100 ms and build a simple moving average

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-15 15:39:43 +01:00
Felix Fietkau 257c19f5b5 mt76: clear skb pointers from rx aggregation reorder buffer during cleanup
During the cleanup of the aggregation session, a rx handler (or release timer)
on another CPU might still hold a pointer to the reorder buffer and could
attempt to release some packets.
Clearing pointers during cleanup avoids a theoretical use-after-free bug here.

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-14 00:15:27 +01:00
Felix Fietkau b3bf83d6da mt76: disable bh in mt76_dma_rx_poll
Fixes potential RCU issues and avoids calling ieee80211_rx_napi with softirq
enabled.

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-05 17:46:42 +01:00
Felix Fietkau fff2c07193 Revert "mt76: use rcu_read_lock_bh in mt76_dma_rx_poll"
This reverts commit 44825e88a4.
Will be replaced by a better fix

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-05 17:46:07 +01:00
Felix Fietkau 88db676f85 mt76: fix rx dma ring descriptor state on reset
To avoid having the hardware potentially write to memory behind stale
descriptors, set the dma-done flag on all of them before cleaning up
allocated rx buffers

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-05 17:40:11 +01:00
Felix Fietkau 59de6c9447 mt7615: replace sta_state callback with sta_add/sta_remove
The MT7615 firmware needs to know the association id at creation time,
which is unavailable during the transition from notexist to none in
.sta_state.
This can cause a number of issues, probably also breaking powersave
support.

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-05 14:26:14 +01:00
Felix Fietkau ea41ad8bdb mt76: mt7615: defer mcu initialization via workqueue
Loading the mcu firmware and waiting for it to boot takes a long time,
which adds a significant amount to the system boot time.
Fix this by running the mcu init from a workqueue and waiting for it to
complete before starting the phy or issuing mcu commands via debugfs

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-05 11:36:53 +01:00
Felix Fietkau 1456a53dde mt76: mt7615: update beacon contents on BSS_CHANGED_BEACON
Beacon changes need to be sent to the firmware, otherwise it will
keep sending stale data

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 993683d62f mt76: mt7615: add support for registering a second wiphy via debugfs
This is only used for testing for now. In the future it will be possible to
enable the second PHY through an proper API via device tree

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 5725d1f919 mt76: mt7615: select the correct tx queue for frames sent to the second phy
Beacons and management frames need to explicitly select the alternate tx
queues in order to be sent out on the right phy

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 6265fd1954 mt76: mt7615: move radio/mac initialization to .start/stop callbacks
Run initialization per phy

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau c5585a7358 mt76: mt7615: initialize dbdc settings on interface add
Use the first two WMM slots for the primary phy and the second two for the
secondary phy.

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau caa47af1d6 mt76: mt7615: add multiple wiphy support to the rx path
Program the RMAC CHFREQ registers to properly indicate the band that the
frames are received on.
Add some sanity checks to the programmed values, because the firmware
programs these registers differently

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 849fefacc4 mt76: mt7615: rework chainmask handling
Move chainmask to struct mt7615_phy and instead of needlessly making the
format similar to values for older chips, make it refer to the actual chain
bits used for the rx/tx path.
This is important for multiple wiphy support, where for a secondary phy,
antenna_mask will start at 0, and chainmask will start at the chain offset
(bit 2)

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 705a0fcdc3 mt76: mt7615: add multiple wiphy support to the dfs support code
There are two DFS detectors on the chip. When using 160 MHz channel bandwidth
(not supported in dual-wiphy mode), both are used. Otherwise, one detector is
used per wiphy.
Rework the code to start/stop them separately per phy and to indicate the
radar event on the right phy based on the detector index

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 0954c37d01 mt76: mt7615: remove useless MT_HW_RDD0/1 enum
Writing 0/1 is shorter and just as clear

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau bdcd45dd04 mt76: mt7615: add missing register init for dual-wiphy support
Initialize low-power beacon mode setting

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau e5ea72ac71 mt76: mt7615: add multiple wiphy support for smart carrier sense
Use per-phy radio stats and tuning registers

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau e6659d12d0 mt76: mt7615: add dual-phy support for mac80211 ops
Allows them to be used by a separately registered wiphy later

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 1c8d69e7d6 mt76: move ampdu_ref from mt76_dev to driver struct
It is only used by the driver

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 04cd17a645 mt76: add ext_phy field to struct mt76_wcid
Will be used to determine the phy from within the driver

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 8ca0484685 mt76: add function for allocating an external wiphy
Unlike the core phy, this will have extra allocated memory for a driver
private struct.

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 842cae558b mt76: add priv pointer to struct mt76_phy
Will be used for per-phy driver private data

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:58:37 +01:00
Felix Fietkau 502d09a6e8 mt76: add multiple wiphy support to mt76_get_min_avg_rssi
Allow tracking clients of both wiphys separately

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:58:37 +01:00