提交 95844124 编写于 作者: S Stanislaw Gruszka 提交者: Kalle Valo

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: NEmil Karlson <jekarl@iki.fi>
Fixes: 710e6cc1 ("rt2800: do not nullify initialization vector data")
Signed-off-by: NStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 8f2d163c
......@@ -6094,6 +6094,15 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
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
*/
......
......@@ -658,6 +658,7 @@ enum rt2x00_state_flags {
DEVICE_STATE_ENABLED_RADIO,
DEVICE_STATE_SCANNING,
DEVICE_STATE_FLUSHING,
DEVICE_STATE_RESET,
/*
* Driver configuration
......
......@@ -1256,13 +1256,14 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
{
int retval;
int retval = 0;
if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) {
/*
* This is special case for ieee80211_restart_hw(), otherwise
* mac80211 never call start() two times in row without stop();
*/
set_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev);
rt2x00lib_stop(rt2x00dev);
}
......@@ -1273,14 +1274,14 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
*/
retval = rt2x00lib_load_firmware(rt2x00dev);
if (retval)
return retval;
goto out;
/*
* Initialize the device.
*/
retval = rt2x00lib_initialize(rt2x00dev);
if (retval)
return retval;
goto out;
rt2x00dev->intf_ap_count = 0;
rt2x00dev->intf_sta_count = 0;
......@@ -1289,11 +1290,13 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
/* Enable the radio */
retval = rt2x00lib_enable_radio(rt2x00dev);
if (retval)
return retval;
goto out;
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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册