mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-07 14:28:50 +00:00
114 lines
3.6 KiB
Diff
114 lines
3.6 KiB
Diff
|
From patchwork Mon Aug 19 11:20:07 2019
|
||
|
Content-Type: text/plain; charset="utf-8"
|
||
|
MIME-Version: 1.0
|
||
|
Content-Transfer-Encoding: 7bit
|
||
|
X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
|
||
|
X-Patchwork-Id: 11100685
|
||
|
X-Patchwork-Delegate: kvalo@adurom.com
|
||
|
Return-Path: <linux-wireless-owner@kernel.org>
|
||
|
From: Stanislaw Gruszka <sgruszka@redhat.com>
|
||
|
To: linux-wireless@vger.kernel.org
|
||
|
Subject: [PATCH 5.3] rt2x00: clear IV's on start to fix AP mode regression
|
||
|
Date: Mon, 19 Aug 2019 13:20:07 +0200
|
||
|
Message-Id: <1566213607-6723-1-git-send-email-sgruszka@redhat.com>
|
||
|
Sender: linux-wireless-owner@vger.kernel.org
|
||
|
List-ID: <linux-wireless.vger.kernel.org>
|
||
|
X-Mailing-List: linux-wireless@vger.kernel.org
|
||
|
|
||
|
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: 710e6cc1595e ("rt2800: do not nullify initialization vector data")
|
||
|
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
|
||
|
---
|
||
|
drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 +++++++++
|
||
|
drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 +
|
||
|
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 13 ++++++++-----
|
||
|
3 files changed, 18 insertions(+), 5 deletions(-)
|
||
|
|
||
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
||
|
@@ -6095,6 +6095,15 @@ static int rt2800_init_registers(struct
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
+ * 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
|
||
|
*/
|
||
|
for (i = 0; i < 8; i++)
|
||
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
|
||
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
|
||
|
@@ -658,6 +658,7 @@ enum rt2x00_state_flags {
|
||
|
DEVICE_STATE_ENABLED_RADIO,
|
||
|
DEVICE_STATE_SCANNING,
|
||
|
DEVICE_STATE_FLUSHING,
|
||
|
+ DEVICE_STATE_RESET,
|
||
|
|
||
|
/*
|
||
|
* Driver configuration
|
||
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
|
||
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
|
||
|
@@ -1256,13 +1256,14 @@ static int rt2x00lib_initialize(struct r
|
||
|
|
||
|
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 *r
|
||
|
*/
|
||
|
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 *r
|
||
|
/* 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)
|