From: Daniel Golle Date: Mon, 19 Aug 2019 11:40:51 +0000 (+0200) Subject: mac80211: rt2x00: clear IV's on start to fix AP mode regression X-Git-Tag: v21.02.0-rc1~5218 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=91c84e87c249f6968eeedf377a001b0b2132a7ca;p=openwrt%2Fstaging%2Fchunkeey.git mac80211: 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. Patch pending on linux-wireless and imported from patchwork. Fixes: 0b2c42ced21a ("mac80211: Update to version 5.2-rc7") Signed-off-by: Daniel Golle --- diff --git a/package/kernel/mac80211/patches/rt2x00/010-rt2x00-clear-IV-s-on-start-to-fix-AP-mode-regression.patch b/package/kernel/mac80211/patches/rt2x00/010-rt2x00-clear-IV-s-on-start-to-fix-AP-mode-regression.patch new file mode 100644 index 0000000000..8859c0dd9e --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/010-rt2x00-clear-IV-s-on-start-to-fix-AP-mode-regression.patch @@ -0,0 +1,113 @@ +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 +X-Patchwork-Id: 11100685 +X-Patchwork-Delegate: kvalo@adurom.com +Return-Path: +From: Stanislaw Gruszka +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: +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 +Fixes: 710e6cc1595e ("rt2800: do not nullify initialization vector data") +Signed-off-by: Stanislaw Gruszka +--- + 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) diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index 0c6e5a03b0..964c243f91 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -105,7 +105,7 @@ .drv_init_registers = rt2800mmio_init_registers, --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -694,6 +694,7 @@ enum rt2x00_capability_flags { +@@ -695,6 +695,7 @@ enum rt2x00_capability_flags { REQUIRE_HT_TX_DESC, REQUIRE_PS_AUTOWAKE, REQUIRE_DELAYED_RFKILL, @@ -113,7 +113,7 @@ /* * Capabilities -@@ -970,6 +971,11 @@ struct rt2x00_dev { +@@ -971,6 +972,11 @@ struct rt2x00_dev { const struct firmware *fw; /* @@ -127,7 +127,7 @@ DECLARE_KFIFO_PTR(txstatus_fifo, u32); --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1418,6 +1418,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de +@@ -1421,6 +1421,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); @@ -138,7 +138,7 @@ /* * Let the driver probe the device to detect the capabilities. */ -@@ -1561,6 +1565,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ +@@ -1564,6 +1568,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ * Free the driver data. */ kfree(rt2x00dev->drv_data); diff --git a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch index ed2f6173b5..76a2d1c2ca 100644 --- a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch +++ b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch @@ -8,7 +8,7 @@ #include "rt2x00.h" #include "rt2800lib.h" -@@ -9526,6 +9527,17 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9535,6 +9536,17 @@ static int rt2800_init_eeprom(struct rt2 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); diff --git a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch index d909a2e6c6..aa2b25ba7f 100644 --- a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch +++ b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1356,7 +1356,7 @@ static inline void rt2x00lib_set_if_comb +@@ -1359,7 +1359,7 @@ static inline void rt2x00lib_set_if_comb */ if_limit = &rt2x00dev->if_limits_ap; if_limit->max = rt2x00dev->ops->max_ap_intf; diff --git a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch index 3f03a68f59..2d733a3180 100644 --- a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch @@ -76,7 +76,7 @@ Signed-off-by: Tomislav Po=C5=BEega bbp = rt2800_bbp_read(rt2x00dev, 4); rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); rt2800_bbp_write(rt2x00dev, 4, bbp); -@@ -9555,7 +9594,8 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9564,7 +9603,8 @@ static int rt2800_init_eeprom(struct rt2 */ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); @@ -86,7 +86,7 @@ Signed-off-by: Tomislav Po=C5=BEega if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) __set_bit(CAPABILITY_EXTERNAL_PA_TX0, -@@ -9566,6 +9606,18 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9575,6 +9615,18 @@ static int rt2800_init_eeprom(struct rt2 &rt2x00dev->cap_flags); } diff --git a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch index 73413217b7..e8e28eac05 100644 --- a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8417,6 +8417,58 @@ static void rt2800_init_rfcsr_5592(struc +@@ -8426,6 +8426,58 @@ static void rt2800_init_rfcsr_5592(struc rt2800_led_open_drain_enable(rt2x00dev); } @@ -59,7 +59,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9024,6 +9076,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9033,6 +9085,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch index 23dde9b07c..da4d9a39e3 100644 --- a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8469,6 +8469,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x +@@ -8478,6 +8478,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x } EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal); @@ -161,7 +161,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9076,6 +9230,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9085,6 +9239,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch index 3a638f82e3..1dd4746be9 100644 --- a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8623,6 +8623,71 @@ void rt2800_r_calibration(struct rt2x00_ +@@ -8632,6 +8632,71 @@ void rt2800_r_calibration(struct rt2x00_ } EXPORT_SYMBOL_GPL(rt2800_r_calibration); @@ -72,7 +72,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9232,6 +9297,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9241,6 +9306,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); diff --git a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch index 5bd53b7a21..e820d1c264 100644 --- a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8688,6 +8688,386 @@ void rt2800_rxdcoc_calibration(struct rt +@@ -8697,6 +8697,386 @@ void rt2800_rxdcoc_calibration(struct rt } EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration); @@ -387,7 +387,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9300,6 +9680,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9309,6 +9689,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch index 464db9c921..7048a84dbc 100644 --- a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9068,6 +9068,954 @@ restore_value: +@@ -9077,6 +9077,954 @@ restore_value: } EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration); @@ -955,7 +955,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9680,6 +10628,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9689,6 +10637,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false);