Commit Graph
1539 Commits
Author SHA1 Message Date
Ryder LeeandFelix Fietkau ae0f111492 mt76: mt7615: update cw_min/max related settings
Add default values of cw_min/max and use fls() for configuration.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Ryder LeeandFelix Fietkau 8d7a480300 mt76: mt7615: add 4 WMM sets support
Hardware supports 4 sets of WMM that should be put to good use.
And fix incorrect queue mapping in mt7615_conf_tx().

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Lorenzo BianconiandFelix Fietkau 3d6796b867 mt76: mt7603: fix watchdog rescheduling in mt7603_set_channel
Convert MT7603_WATCHDOG_TIME in jiffies rescheduling watchdog delayed
work

Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Lorenzo BianconiandFelix Fietkau 4d9001b8ab mt76: mt7615: fix MT7615_WATCHDOG_TIME definition
Express watchdog timeout in jiffies since it is used directly in
ieee80211_queue_delayed_work

Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Lorenzo BianconiandFelix Fietkau 4947ad4eab mt76: introduce mt76_mmio_read_copy routine
Add mt76_mmio_read_copy routine and the related function pointer in
mt76_bus_ops data structure. mt76_mmio_read_copy will be used to add
BIP_CMAC_128 cipher hw support to mt7615 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Lorenzo BianconiandFelix Fietkau 60d279ec27 mt76: mt7615: add set_key_cmd and mt76_wcid to mt7615_mac_wtbl_set_key signature
Introduce set_key_cmd and mt76_wcid pointer to mt7615_mac_wtbl_set_key
signature and do not set key to NULL if cmd is DISABLE_KEY.
This is a preliminary patch to add BIP_CMAC_128 hw support to mt7615
driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Lorenzo BianconiandFelix Fietkau d998b90c4b mt76: mt7615: remove wtbl_sec_key definition
Get rid of wtbl_sec_key definition since it is no longer used

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Lorenzo BianconiandFelix Fietkau e8c95e5a41 mt76: mt7615: introduce mt7615_mac_wtbl_set_key routine
Add mt7615_mac_wtbl_set_key routine to configure wtbl key parameter
directly from host cpu. This is a preliminary patch to add BIP_CMAC_128
hw support. Moreover add static qualifier to mt7615_mac_get_key_info
routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Lorenzo BianconiandFelix Fietkau e4f48a8df6 mt76: mt7615: add mt7615_mac_wtbl_addr routine
Introduce mt7615_mac_wtbl_addr rouinte to compute sta wtbl address.
This is a preliminary patch to update wtbl key directly from host
processor

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Lorenzo BianconiandFelix Fietkau 8e495245ab mt76: mt7615: move mt7615_mac_get_key_info in mac.c
This is a preliminary patch to update wtbl key directly from host
processor

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:21:27 +02:00
Felix Fietkau 3245ca8b8a mt76: check of_get_mac_address for NULL as well to restore old kernel compat
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-12 20:26:55 +02:00
Felix Fietkau 76aada563b mt76: dma: reset q->rx_buf on rx reset
Fixes rx of the first frame if a fragmented rx was interrupted by the reset

Signed-off-by: Felix Fietkau <[email protected]>
2019-08-12 15:51:00 +02:00
Felix Fietkau fb0f432834 mt76: stop rx aggregation on station removal
Fixes use-after-free issues on forced station removal during hardware restart
on MT76x02

Signed-off-by: Felix Fietkau <[email protected]>
2019-08-12 15:48:55 +02:00
Petr Štetiar 75656a4590 net: wireless: support of_get_mac_address new ERR_PTR error
commit d31a36b5f407d796d121af745730712337cd32a1 upstream.

There was NVMEM support added to of_get_mac_address, so it could now return
ERR_PTR encoded error values, so we need to adjust all current users of
of_get_mac_address to this new fact.

Signed-off-by: Petr Štetiar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
2019-07-22 22:27:46 +02:00
Felix Fietkau 3d7f7384be mt76: mt7615: add missing register initialization
- initialize CCA signal source
- initialize clock for band 1 (7615D)
- initialize BAR rate

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-16 18:12:43 +02:00
Felix Fietkau 410923fa24 Revert accidental debugging change
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-13 15:48:49 +02:00
Lorenzo BianconiandFelix Fietkau b647180c86 mt76: mt7615: unlock dfs bands
Unlock dfs channels since now mt7615 driver supports radar detection

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-07-12 16:08:50 +02:00
Stanislaw GruszkaandFelix Fietkau 649f2e8374 mt76: mt7615: use params->ssn value directly
There is no point to use pointer to params->ssn.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-12 16:07:11 +02:00
Stanislaw GruszkaandFelix Fietkau f74d117ed4 mt76: mt7603: use params->ssn value directly
There is no point to use pointer to params->ssn.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-12 16:07:11 +02:00
Stanislaw GruszkaandFelix Fietkau 5d298297c0 mt76: mt76x02: use params->ssn value directly
There is no point to use pointer to params->ssn.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-12 16:07:11 +02:00
Stanislaw GruszkaandFelix Fietkau 307be50cc5 mt76: usb: remove unneeded {put,get}_unaligned
Compiler give us guarantees on variables alignment, so use
an variable as buffer when read/write registers and remove
unneeded {put,get}_unaligned.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-07-12 15:56:23 +02:00
Stanislaw GruszkaandFelix Fietkau 8c1da9367b mt76: usb: fix endian in mt76u_copy
In contrast to mt76_wr() which we use to program registers,
on mt76_wr_copy() we should not change endian of the data.

Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer")
Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-07-12 15:56:23 +02:00
Felix Fietkau 439354d540 Revert "mt76: usb: fix endian in mt76u_copy"
This reverts commit edbe88ec7c.
2019-07-12 15:52:03 +02:00
Felix Fietkau 48800e7b60 Revert "mt76: usb: remove unneeded {put,get}_unaligned"
This reverts commit f43b6228fa.
2019-07-12 15:52:02 +02:00
Felix Fietkau 3b08966d99 Revert "mt76: usb: use full intermediate buffer in mt76u_copy"
This reverts commit 5e1e5b75d6.
2019-07-12 15:51:58 +02:00
Felix Fietkau 0ce46825b8 mt76: mt7603: fix invalid fallback rates
Only decrement the rate index on duplicate rates if it is not already 0

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-12 08:19:43 +02:00
Felix Fietkau 3d43dd8869 mt76: mt7615: fix invalid fallback rates
Only decrement the rate index on duplicate rates if it is not already 0

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-12 08:19:23 +02:00
Felix Fietkau b21b99187a mt76: mt7615: fix PS buffering of action frames
Bufferable management frames need to be put in the data queue, otherwise
they will not be buffered when the receiver is asleep.

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-12 08:18:34 +02:00
Felix Fietkau 8fc3e6e02e mt76: mt7615: fix using VHT STBC rates
The hardware expects MT_TX_RATE_NSS to be filled with the number of
space/time streams. For non-STBC rates, this is equal to nss.
For 1-stream STBC, this needs to be set to 2.
This is relevant for VHT rates only, on HT, the value is derived from MCS
internally.

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-12 08:18:34 +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
Lorenzo BianconiandFelix Fietkau e07451d279 mt76: mt7615: fix sparse warnings: warning: cast from restricted __le16
Do not convert {tx,rx}_mcs_map to little-endian since it is already done
by mac80211. This patch fix the following sparse warning:

drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:1497:25: sparse:
warning: cast from restricted __le16
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:1499:25: sparse:
warning: cast from restricted __le16

Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Fixes: 3ca0a6f6e9df ("mt7615: mcu: use standard signature for mt7615_mcu_msg_send")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:05:30 +02:00
Lorenzo BianconiandFelix Fietkau 947532099c mt76: mt7603: fix sparse warnings: warning: incorrect type in assignment (different base types)
Fix the following sparse warning in mt7603_mcu_set_eeprom:
drivers/net/wireless/mediatek/mt76/mt7603/mcu.c:376:30: sparse: warning:
incorrect type in assignment (different base types)
drivers/net/wireless/mediatek/mt76/mt7603/mcu.c:376:30: sparse:
expected unsigned short [usertype] addr
drivers/net/wireless/mediatek/mt76/mt7603/mcu.c:376:30: sparse: got
restricted __le16 [usertype]

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:04:59 +02:00
Lorenzo BianconiandFelix Fietkau 3dfc1eeffe mt76: mt7615: fix sparse warnings: incorrect type in assignment (different base types)
Fix the following sparse warning in mt7615_mcu_bss_info_ext_header:
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:728:30: sparse: sparse:
incorrect type in assignment (different base types)
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:728:30: sparse:
expected restricted __le32 [usertype] mbss_tsf_offset

Reported-by: kbuild test robot <[email protected]>
Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Fixes: 7339fbc0caa5 ("mt7615: mcu: do not use function pointers whenever possible")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:04:32 +02:00
Lorenzo BianconiandFelix Fietkau 0c6f1a2b3c mt76: mt7615: introduce mt7615_mcu_send_ram_firmware routine
Add mt7615_mcu_send_ram_firmware routine since mt7615_load_ram runs the
same code to send ram firmware to cr4 and n9 mcus. Moreover rename
gen_dl_mode in mt7615_mcu_gen_dl_mode.
This patch does not introduce any behaviour change, it is just code
refactor.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:03:37 +02:00
Lorenzo BianconiandFelix Fietkau 2c0ccf1561 mt76: mt7615: always release sem in mt7615_load_patch
Release patch semaphore even if request_firmware fails in
mt7615_load_patch

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:03:37 +02:00
Lorenzo BianconiandFelix Fietkau 017d0ff097 mt76: mt76u: fix typo in mt76u_fill_rx_sg
Fix typo setting urb->transfer_buffer_length in mt76u_fill_rx_sg

Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer")
Fixes: f8f527b16db5 ("mt76: usb: use EP max packet aligned buffer sizes for rx")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:03:00 +02:00
Stanislaw GruszkaandFelix Fietkau 5e1e5b75d6 mt76: usb: use full intermediate buffer in mt76u_copy
Instead of use several 4 bytes usb requests, use full 32 bytes buffer
to copy data to device. With the change we use less requests and copy
exact data size to the device regardless size is multiple of 4 or not.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:02:16 +02:00
Stanislaw GruszkaandFelix Fietkau f43b6228fa mt76: usb: remove unneeded {put,get}_unaligned
Compiler give us guaranties on variables alignment, so use
an variable as buffer when read/write registers and remove
unneeded {put,get}_unaligned.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:02:16 +02:00
Stanislaw GruszkaandFelix Fietkau edbe88ec7c mt76: usb: fix endian in mt76u_copy
In contrast to mt76_wr() which we use to program registers,
on mt76_wr_copy() we should not change endian of the data.

Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer")
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-04 20:02:16 +02:00
Felix Fietkau 6f9837833b mt76: mt7615: sync with mt7603 rate control changes
- 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
- Switch from lower rates to higher rates more conservatively
- enable hardware rate up/down selection

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-03 21:46:34 +02:00
Felix Fietkau 2ae01f7e77 mt76: mt7615: reset rate index/counters on rate table update
These values must be initialized to zero, otherwise the hardware could
reuse previous values, especially the rate index

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-03 21:45:10 +02:00
Felix Fietkau ae760db52a mt76: mt7615: move mt7615_mcu_set_rates to mac.c
It bypasses the MCU, so it does not belong in mcu.c
Also make mt7615_mac_tx_rate_val static

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-03 21:45:10 +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 47fe37e22f mt76: mt7615: fall back to sw encryption for unsupported ciphers
Fix following warning falling back to sw encryption for unsupported
ciphers

WARNING: CPU: 2 PID: 1495 at backports-4.19.32-1/net/mac80211/key.c:1023
mt76_wcid_key_setup+0x68/0xbc [mt76]
CPU: 2 PID: 1495 Comm: hostapd Not tainted 4.14.131 #0
Stack : 00000000 8f0f8bc0 00000000 8007ccec 805f0000 8058ec18 00000000 00000000
	80559788 8dca79bc 8fefb10c 805c89c7 805545c8 00000001 8dca7960 53261662
	00000000 00000000 80640000 00004668 00000000 000000e9 00000007 00000000
	00000000 805d0000 00072537 00000000 80000000 00000000 805f0000 8f1e70d0
	8e8fa098 000003ff 805c0000 8f0f8bc0 00000001 802d4340 00000008 80630008
[<800108d0>] show_stack+0x58/0x100
[<8049214c>] dump_stack+0x9c/0xe0
[<80033998>] __warn+0xe0/0x138
[<80033a80>] warn_slowpath_null+0x1c/0x2c
[<8e8fa098>] mt76_wcid_key_setup+0x68/0xbc [mt76]
[<8e889930>] mt7615_eeprom_init+0x7c0/0xe14 [mt7615e]

Suggested-by: Sebastian Gottschall <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-03 10:57:58 +02:00
Felix Fietkau 3be723cad7 mt76: mt7615: clean up FWDL TXQ during/after firmware upload
Since we don't clean that tx queue from the tx tasklet, we need to do it
after the firmware upload is done. This patch also adds a cleanup step during
the upload, to help reclaim memory faster.

Fixes unprocessed queued frames eating up memory  long after the firmware
upload has already completed

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-01 20:19:17 +02:00
Lorenzo BianconiandFelix Fietkau 8919516006 mt76: mt7615: add radar pattern test knob to debugfs
Introduce mt7615_mcu_rdd_send_pattern routine to trigger a radar pattern
detection. Moreover move debugfs related routines in a dedicated source
file.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-01 14:09:17 +02:00
Lorenzo BianconiandFelix Fietkau 6afc952196 mt76: mt7615: add csa support
Add Channel Switch Announcement support to mt7615 driver updating beacon
template with CSA IE received from mac80211

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-01 14:09:17 +02:00
Lorenzo BianconiandFelix Fietkau 57c600e5b9 mt76: mt7615: do not perform txcalibration before cac is complited
Delay channel calibration after Channel Availability Check. Add some
code cleanup to mt7615_mcu_set_channel

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-01 14:09:17 +02:00
Lorenzo BianconiandFelix Fietkau 901a4c7b7f mt76: mt7615: add hw dfs pattern detector support
Add hw radar detection support to mt7615 driver in order to
unlock dfs channels on 5GHz band

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-01 14:09:17 +02:00
Lorenzo BianconiandFelix Fietkau 7991dd7e25 mt76: mt7615: introduce mt7615_regd_notifier
Introduce mt7615_regd_notifier callback. This is a preliminary patch to
add radar detection support to mt7615 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-07-01 14:09:17 +02:00