rt2x00: clear IV's on start to fix AP mode regression

To do not brake HW restart we should keep initialization vectors data.
I assumed that on start the data is already initialized to zeros, but
that not true on some scenarios and we should clear it. So add
additional flag to check if we are under HW restart and clear IV's
data if we are not.

Patch fixes AP mode regression.

Reported-and-tested-by: Emil Karlson <jekarl@iki.fi>
Fixes: 710e6cc159 ("rt2800: do not nullify initialization vector data")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Stanislaw Gruszka 2019-08-19 13:20:07 +02:00 committed by Kalle Valo
parent 8f2d163cb2
commit 9584412438
3 changed files with 18 additions and 5 deletions

View File

@ -6094,6 +6094,15 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
rt2800_delete_wcid_attr(rt2x00dev, i); rt2800_delete_wcid_attr(rt2x00dev, i);
} }
/*
* Clear encryption initialization vectors on start, but keep them
* for watchdog reset. Otherwise we will have wrong IVs and not be
* able to keep connections after reset.
*/
if (!test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags))
for (i = 0; i < 256; i++)
rt2800_register_write(rt2x00dev, MAC_IVEIV_ENTRY(i), 0);
/* /*
* Clear all beacons * Clear all beacons
*/ */

View File

@ -658,6 +658,7 @@ enum rt2x00_state_flags {
DEVICE_STATE_ENABLED_RADIO, DEVICE_STATE_ENABLED_RADIO,
DEVICE_STATE_SCANNING, DEVICE_STATE_SCANNING,
DEVICE_STATE_FLUSHING, DEVICE_STATE_FLUSHING,
DEVICE_STATE_RESET,
/* /*
* Driver configuration * Driver configuration

View File

@ -1256,13 +1256,14 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
{ {
int retval; int retval = 0;
if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) { if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) {
/* /*
* This is special case for ieee80211_restart_hw(), otherwise * This is special case for ieee80211_restart_hw(), otherwise
* mac80211 never call start() two times in row without stop(); * mac80211 never call start() two times in row without stop();
*/ */
set_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev); rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev);
rt2x00lib_stop(rt2x00dev); rt2x00lib_stop(rt2x00dev);
} }
@ -1273,14 +1274,14 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
*/ */
retval = rt2x00lib_load_firmware(rt2x00dev); retval = rt2x00lib_load_firmware(rt2x00dev);
if (retval) if (retval)
return retval; goto out;
/* /*
* Initialize the device. * Initialize the device.
*/ */
retval = rt2x00lib_initialize(rt2x00dev); retval = rt2x00lib_initialize(rt2x00dev);
if (retval) if (retval)
return retval; goto out;
rt2x00dev->intf_ap_count = 0; rt2x00dev->intf_ap_count = 0;
rt2x00dev->intf_sta_count = 0; rt2x00dev->intf_sta_count = 0;
@ -1289,11 +1290,13 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
/* Enable the radio */ /* Enable the radio */
retval = rt2x00lib_enable_radio(rt2x00dev); retval = rt2x00lib_enable_radio(rt2x00dev);
if (retval) if (retval)
return retval; goto out;
set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags);
return 0; out:
clear_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
return retval;
} }
void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev)