Commit Graph
1110 Commits
Author SHA1 Message Date
Felix Fietkau 471d397e06 mt7603: fix priority for buffered multicast packets
Ensure that they are transmitted immediately after the beacon

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-17 15:41:32 +01:00
Lorenzo BianconiandFelix Fietkau 96b3b3d60d mt76x2u: main: fix typo setting sta_state mac80211 callback
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-16 13:33:14 +01:00
Felix Fietkau d0fdf01a95 mt7603: avoid unnecessary wtbl writes for ps-filter
Only clear the skip_tx flag if powersave mode is enabled

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-16 12:41:17 +01:00
Felix Fietkau 41931e43ab mt7603: toggle skip_tx on station add/remove
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-16 12:33:17 +01:00
Felix Fietkau 90e2c1b616 mt7603: add mt7603_wtbl_set_skip_tx, change mt7603_wtbl_set_ps users
Avoids unnecessary toggling of the MT_WTBL1_OR_PSM_WRITE flag

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-16 12:28:30 +01:00
Felix Fietkau 13f1e82f6f mt7603: clear wtbl entry for removed stations
Should fix some issues with reassociating stations

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-16 12:09:52 +01:00
Felix Fietkau a97127b1b3 mt76: replace sta_add/remove ops with common sta_state function
Allows adding unassociated stations from mac80211

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-16 12:09:52 +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 e65ad4c5db mt7603: make group_wcid the first member in struct mt7603_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 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 963768d38f mt76x02: fix regression in tx station race condition fix
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
Stanislaw GruszkaandFelix Fietkau 88f68838d9 mt76: remove wait argument from mt76x02_mcu_calibrate
We always wait for CMD_CALIBRATION_OP mcu message, but wait argument is used
for do additional MT_MCU_COM_REG0 register operations, which are needed
for mt76x2e devices and we can use appropriate check instead of wait argument.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau 3fc95d7464 mt76x2u: init: remove mt76x2u_init_beacon_offsets routine
Remove mt76x2u_init_beacon_offsets routine since the driver supports
just STA mode

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau 9fe0fe8594 mt76x2u: main: use mt76x02_bss_info_changed utility routine
Initialize bss_info_changed mac80211 callback to
mt76x02_bss_info_changed utility routine and remove duplicated code.
Use 8 as WCID index for sta interface

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau c1d67b47d4 mt76x2u: phy: run phy_channel_calibrate after channel switch
Perform channel calibration after each channel switch and not only after
connection establishment since NetworkManager perform multiple frequency
scanning if RSSI in lower a given threshold

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau f75efd81f8 mt76x2u: phy: add TX_SHAPING calibration
Add MCU_CAL_TX_SHAPING calibration in mt76x2u_phy_channel_calibrate
routine since now mt76x2 and mt76x2u driver run the same firmware

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau 4248446224 mt76x0: pci: enable VHT rates in IBSS mode
Enable VHT tx rates in ad-hoc mode for mt76x0e driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau 0bfa98eb08 mt76: introduce mt76x02_config_mac_addr_list routine
Add mt76x02_config_mac_addr_list routine in order to set
the mac address list supported by the driver. Initialize
wiphy->addresses/n_addresses for mt76x0e driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau df5c797b21 mt76: fix uninitialized mutex access setting rts threshold
Fix following crash due to a leftover uninitialized mutex access
in mt76x2_set_rts_threshold routine.

[   31.018059] Call Trace:
[   31.018341]  register_lock_class+0x51f/0x530
[   31.018828]  __lock_acquire+0x6c/0x1580
[   31.019247]  lock_acquire+0x88/0x120
[   31.021089]  __mutex_lock+0x4a/0x4f0
[   31.023343]  mt76x2_set_rts_threshold+0x28/0x50
[   31.023831]  ieee80211_set_wiphy_params+0x16d/0x4e0
[   31.024344]  nl80211_set_wiphy+0x72b/0xbc0
[   31.024781]  genl_family_rcv_msg+0x192/0x3a0
[   31.025233]  genl_rcv_msg+0x42/0x89
[   31.026079]  netlink_rcv_skb+0x38/0x100
[   31.026475]  genl_rcv+0x1f/0x30
[   31.026804]  netlink_unicast+0x19c/0x250
[   31.027212]  netlink_sendmsg+0x1ed/0x390
[   31.027615]  sock_sendmsg+0x31/0x40
[   31.027973]  ___sys_sendmsg+0x23c/0x280
[   31.030414]  __sys_sendmsg+0x42/0x80
[   31.030783]  do_syscall_64+0x4a/0x170
[   31.031160]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
[   31.031677] RIP: 0033:0x7f3498b39ba7
[   31.033953] RSP: 002b:00007fffe19675b8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
[   31.034883] RAX: ffffffffffffffda RBX: 00000000012d5350 RCX: 00007f3498b39ba7
[   31.035756] RDX: 0000000000000000 RSI: 00007fffe19675f0 RDI: 0000000000000003
[   31.036587] RBP: 00000000012da740 R08: 0000000000000002 R09: 0000000000000000
[   31.037422] R10: 0000000000000006 R11: 0000000000000246 R12: 00000000012da880
[   31.038252] R13: 00007fffe19675f0 R14: 00007fffe19678c0 R15: 00000000012da880

Fixes: 108a4861ef19 ("mt76: create new mt76x02-lib module for common
mt76x{0,2} code")
Reported-by: [email protected]
Reported-by: [email protected]
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:18 +01:00
Felix Fietkau 83a80cabbd mt76: request tx status for powersave released EOSP packet
Allows mac80211 to keep track of the service period

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-13 20:54:19 +01:00
Felix Fietkau 0848d2db97 mt7603: simplify mt7603_mcu_msg_send, remove skb_ret handling
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-13 14:53:45 +01:00
Felix Fietkau fd85ff9a97 mt7603: use mt76_sta_remove helper
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-13 11:53:22 +01:00
Felix Fietkau 75aa36e0a3 mt7603: use wcid/wcid_mask from struct mt76_dev
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-13 11:51:49 +01:00
Felix Fietkau 7e5c819a45 mt76: add mt76_sta_remove helper
This allows station removal code to be used by mt7603 later

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-13 11:33:48 +01:00
Felix Fietkau 67458301fd mt76: fix race condition in station removal
If there are still pending packets in the tx queue when removing a station,
it could possibly lead to a call to further attempts to pull packets from
the mac80211 tx queue after it has already been removed from the scheduling
list.
Prevent this from happening by calling synchronize_rcu after deleting the
wcid pointer before further cleaning up the tx queues.
To be extra careful, ensure that mtxq->list is always initialized properly.

Also drop the useless call to mt76x02_mac_wcid_setup, which only re-assigns
the bss index of the wcid entry, but does not help with the cleanup in any
way.

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-13 11:30:00 +01:00
Felix Fietkau ffccb48c50 mt76: do not wake tx queues during flush
While the queue is being cleaned up, the stack must not attempt to add
any extra packets

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-09 13:44:02 +01:00
Felix Fietkau 29d95328d6 mt7603: fix faulty variable initialization in last commit
Should be harmless, since watchdog reset is only performed when necessary

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-08 09:07:11 +01:00
Felix Fietkau 417cf49ce8 mt7603: improve recovery from MCU hang
Fix forcing watchdog reset after a MCU hang
Run watchdog work immediately after a failed channel change

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-07 18:46:47 +01:00
Felix Fietkau 5ee05239fa mt7603: fix tx status rate reporting for fixed-rate packets
Add support for parsing legacy rates, use a flag in the tx status info
as indicator for fixed rate packets

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 22:19:20 +01:00
Felix Fietkau a1afefdbf0 mt7603: fix handling of fixed rate packets
The FIXED_RATE flag of txd6 does not enable fixed rate, it only configures
the use of the fixed rate register as rate source.
Set the right flag in txd2 instead.

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 17:42:10 +01:00
Felix Fietkau 498d716353 mt7603: fix checkpatch issues
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 15:41:37 +01:00
Felix Fietkau d9b5324ecc mt7603: add SPDX license identifiers
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 13:53:26 +01:00
Felix Fietkau ac6fc78aee mt7603: add debugfs file to trigger watchdog resets
Makes it easier to verify that the reset code is working properly

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 13:39:41 +01:00
Felix Fietkau c34baabf3b mt7603: add missing unlock in case changing the channel fails
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 13:35:32 +01:00
Felix Fietkau 87bad3a592 mt7603: stop MAC on watchdog reset
Prevent further rx activity while shutting down DMA and resetting PSE

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 13:24:58 +01:00
Felix Fietkau 8b7f50d236 mt76: add size check for additional rx fragments
So far the code only validates the buffer size of the first skb.
Extend this check to cover additional fragments as well, in case the size
is corrupted during a DMA reset.

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 12:29:46 +01:00
Felix Fietkau 3c8e8a789b mt7603: use irq_lock/irqmask from struct mt76_dev
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 12:24:48 +01:00
Felix Fietkau 01815e9ac2 mt7603: use mutex from struct mt76_dev
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 12:21:50 +01:00
Felix Fietkau 5195257f22 mt7603: fix maximum rx frame size
Use 4096 as maximum size instead of the rx buffer size, since rx packets
can be split across multiple buffers. This fixes issues with receiving
A-MSDU aggregated packets.

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-05 21:25:54 +01:00
Felix Fietkau ef06c3074f mt76: avoid queue/status spinlocks while passing tx status to mac80211
There is some code in the mac80211 tx status processing code that could
potentially call back into the tx codepath.
To avoid deadlocks, make sure that no tx related spinlocks are taken
during the ieee80211_tx_status call.

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-05 21:11:42 +01:00
Lorenzo BianconiandFelix Fietkau eb53745a3a mt76x0: dfs: fix IBI_R11 configuration on non-radar channels
Fix IBI_R11 configuration on non-radar channels for mt76x0e
driver. This patch improve system stability under heavy load.
Moreover use IBI_R11 name and remove magic numbers for
0x212c register

Fixes: 0c3b3abc9251 ("mt76x0: pci: add DFS support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-05 10:21:24 +01:00
Stanislaw GruszkaandFelix Fietkau 663b197401 mt76x02: assure we update gain after scan
Assure that after we initialize dev->cal.low_gain to -1 this
will cause update gain calibration. Otherwise this might or
might not happen depending on value of second bit of low_gain
and values read from registers in mt76x02_phy_adjust_vga_gain().

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-11-01 18:29:27 +01:00
Stanislaw GruszkaandFelix Fietkau 9b97e0f2a5 mt76x02: run calibration after scanning
If we are associated and scanning is performed, sw_scan_complete callback
is done after we get back to operating channel, so we do not perform
queue cal work. Fix this queue cal work from sw_scan_complete().

On mt76x0 we have to restore gain in MT_BBP(AGC, 8) register after
scanning, as it was multiple times modified by channel switch code.
So queue cal work without any delay to set AGC gain value.

Similar like in mt76x2 init AGC gain only when set operating channel
and just check before queuing cal work in sw_scan_complete() if
initialization was already done.

Fixes: bbd10586f0df ("mt76x0: phy: do not run calibration during channel switch")
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-11-01 18:29:27 +01:00
Stanislaw GruszkaandFelix Fietkau cd76a835bb mt76: remove wait argument from mt76x02_mcu_set_radio_state
Remove wait argument from mt76x02_mcu_set_radio_state and newer wait
for response when sending CMD_POWER_SAVING_OP mcu command.
Note this change behaviour for PCIe devices, but the change is in
align with vendor driver.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-11-01 18:29:27 +01:00
Stanislaw GruszkaandFelix Fietkau 15cb426adf mt76: remove wait argument from mt76x02_mcu_function_select
Remove wait argument from mt76x02_mcu_function_select and wait for
response when function is not Q_SELECT, what is the same behaviour
like in vendor driver.

Note this change behaviour for PCIe devices for Q_SELECT function
form wait to no-wait, and for mt76x0u BW_SETTING from no-wait to wait.
But the change is in align with vendor driver.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-11-01 18:29:27 +01:00
Stanislaw GruszkaandFelix Fietkau 94ad030758 mt76: remove mcu_msg_alloc
We almost always use patter like this:

       skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg));
       return mt76_mcu_send_msg(dev, skb, CMD_FUN_SET_OP, wait_resp);

This is not needed, we can allocate skb in mcu_send_msg routine.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-11-01 18:04:33 +01:00
Lorenzo BianconiandFelix Fietkau a78802c63b mt76x0: phy: use tssi reported value to configure tx power if available
Use tssi calibrated value to configure tx power gain if tssi is enabled
in eeprom data

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau 57b441dcae mt76x0: phy: introduce tssi calibration support
Run mt76x0 tssi calibration process if enabled in eeprom data.
Perform calibration procedure every 4s

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau bd568d9b39 mt76: move mt76x02_eeprom_copy in mt76x02-lib module
Move mt76x02_eeprom_copy utility routine in mt76x02-lib module
in order to be reused by mt76x0 driver adding tssi calibration
support

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00