[PATCH] wifi: ath10k: Trigger STA disconnect after reconfig complete on hardware restart

2023-05-18 Thread Youghandhar Chintala
Currently, on WCN3990, the station disconnect after hardware recovery is
not working as expected. This is because of setting the
IEEE80211_SDATA_DISCONNECT_HW_RESTART flag very early in the hardware
recovery process even before the driver invokes ieee80211_hw_restart().
On the contrary, mac80211 expects this flag to be set after
ieee80211_hw_restart() is invoked for it to trigger station disconnect.

Set the IEEE80211_SDATA_DISCONNECT_HW_RESTART flag in
ath10k_reconfig_complete() instead to fix this.

The other targets are not affected by this change, since the hardware
params flag is not set.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1

Fixes: 2c3fc50591ff ("ath10k: Trigger sta disconnect on hardware restart")
Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 9 -
 drivers/net/wireless/ath/ath10k/mac.c  | 8 
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 533ed7169e11..6cdb225b7eac 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2504,7 +2504,6 @@ EXPORT_SYMBOL(ath10k_core_napi_sync_disable);
 static void ath10k_core_restart(struct work_struct *work)
 {
struct ath10k *ar = container_of(work, struct ath10k, restart_work);
-   struct ath10k_vif *arvif;
int ret;
 
set_bit(ATH10K_FLAG_CRASH_FLUSH, >dev_flags);
@@ -2543,14 +2542,6 @@ static void ath10k_core_restart(struct work_struct *work)
ar->state = ATH10K_STATE_RESTARTING;
ath10k_halt(ar);
ath10k_scan_finish(ar);
-   if (ar->hw_params.hw_restart_disconnect) {
-   list_for_each_entry(arvif, >arvifs, list) {
-   if (arvif->is_up &&
-   arvif->vdev_type == WMI_VDEV_TYPE_STA)
-   
ieee80211_hw_restart_disconnect(arvif->vif);
-   }
-   }
-
ieee80211_restart_hw(ar->hw);
break;
case ATH10K_STATE_OFF:
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 9c4bf2fdbc0f..ab12e3e0c515 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -8109,6 +8109,7 @@ static void ath10k_reconfig_complete(struct ieee80211_hw 
*hw,
 enum ieee80211_reconfig_type reconfig_type)
 {
struct ath10k *ar = hw->priv;
+   struct ath10k_vif *arvif;
 
if (reconfig_type != IEEE80211_RECONFIG_TYPE_RESTART)
return;
@@ -8123,6 +8124,13 @@ static void ath10k_reconfig_complete(struct ieee80211_hw 
*hw,
ar->state = ATH10K_STATE_ON;
ieee80211_wake_queues(ar->hw);
clear_bit(ATH10K_FLAG_RESTARTING, >dev_flags);
+   if (ar->hw_params.hw_restart_disconnect) {
+   list_for_each_entry(arvif, >arvifs, list) {
+   if (arvif->is_up && arvif->vdev_type == 
WMI_VDEV_TYPE_STA)
+   
ieee80211_hw_restart_disconnect(arvif->vif);
+   }
+   }
+
}
 
mutex_unlock(>conf_mutex);
-- 
2.38.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 2/2] wifi: ath10k: update the channel list if change in channel flags.

2023-03-02 Thread Youghandhar Chintala
There are connection failures in hidden SSID case when the device is
with default reg domain WW.
For WW reg domain most of the 5 GHz channels are passive. When device
listens to the beacon on that channel, the driver is updating its
channel flag but firmware is not aware of it and firmware is not
sending probes on that channels.
Due to this, we are seeing connection failures when a device is trying
to connect with hidden SSID AP.
Register beacon hint notifier to the regulatory core so that driver get
notified when there is a change in channel flags. Driver's notifier
callback will send the updated flags to the firmware.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00174

Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index ec8d5b29bc72..91a957295456 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3534,6 +3534,15 @@ static void ath10k_mac_update_channel_list(struct ath10k 
*ar,
}
 }
 
+static void ath10k_mac_beacon_notifier(struct wiphy *wiphy)
+{
+   struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+   struct ath10k *ar = hw->priv;
+
+   if (ath10k_update_channel_list(ar))
+   ath10k_warn(ar, "failed to update channel list\n");
+}
+
 static void ath10k_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request)
 {
@@ -10286,6 +10295,8 @@ int ath10k_mac_register(struct ath10k *ar)
goto err_unregister;
}
 
+   ar->hw->wiphy->beacon_hint_notifier = ath10k_mac_beacon_notifier;
+
return 0;
 
 err_unregister:
-- 
2.38.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 1/2] wifi: cfg80211: Add beacon hint notifier support

2023-03-02 Thread Youghandhar Chintala
There are connection failures in hidden SSID case when the device is
with default reg domain WW.
For WW reg domain most of the 5 GHz channels are passive. When device
listens to the beacon on that channel, the driver is updating its
channel flag but firmware is not aware of it and firmware is not
sending probes on that channels.
Due to this, we are seeing connection failures when the device is trying
to connect with hidden SSID AP.

In the case of devices using the ath10k driver, it is required to update
the change in channel flags to firmware as well. Therefore, we need a
mechanism to notify the driver from the regulatory core regarding the
channel flag changes.
Adding a beacon hint notifier logic, so that drivers can register
callbacks to get notified whenever there is a change in channel flags.

Signed-off-by: Youghandhar Chintala 
---
 include/net/cfg80211.h | 7 +++
 net/wireless/reg.c | 5 -
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 11a370e64143..7a00f5317e1f 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5096,6 +5096,10 @@ struct wiphy_iftype_akm_suites {
  * @reg_notifier: the driver's regulatory notification callback,
  * note that if your driver uses wiphy_apply_custom_regulatory()
  * the reg_notifier's request can be passed as NULL
+ * @beacon_hint_notifier: the driver's beacon hint notification callback,
+ * which will trigger when there is channel flag updates seen in
+ * beacon hints. The beacon_hint_notifier's request can be passed
+ * with chan context.
  * @regd: the driver's regulatory domain, if one was requested via
  * the regulatory_hint() API. This can be used by the driver
  * on the reg_notifier() if it chooses to ignore future
@@ -5386,6 +5390,9 @@ struct wiphy {
void (*reg_notifier)(struct wiphy *wiphy,
 struct regulatory_request *request);
 
+   void (*beacon_hint_notifier)(struct wiphy *wiphy,
+struct ieee80211_channel *chan);
+
/* fields below are read-only, assigned by cfg80211 */
 
const struct ieee80211_regdomain __rcu *regd;
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index c3d950d29432..2dc6880a28c5 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2219,8 +2219,11 @@ static void handle_reg_beacon(struct wiphy *wiphy, 
unsigned int chan_idx,
channel_changed = true;
}
 
-   if (channel_changed)
+   if (channel_changed) {
nl80211_send_beacon_hint_event(wiphy, _before, chan);
+   if (wiphy->beacon_hint_notifier)
+   wiphy->beacon_hint_notifier(wiphy, chan);
+   }
 }
 
 /*
-- 
2.38.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 0/2] Update the channel list if the change in channel flags

2023-03-02 Thread Youghandhar Chintala
There are connection failures in hidden SSID case when the device is with
default reg domain WW.
For WW reg domain most of the 5 GHz channels are passive. When device
listens to the beacon on that channel, the driver is updating its channel
flag but firmware is not aware of it and firmware is not sending probes
on that channels.
Due to this, we are seeing connection failures when the device is tries to
connect with hidden SSID AP.
Whenever the driver detects a channel flag change, send the updated channel
list command to the firmware.

Changes from v1:
 - Added the documentation for notifier call back.
 - Passed channel context as argument for notifier.

Youghandhar Chintala (2):
  wifi: cfg80211: Add beacon hint notifier support
  wifi: ath10k: update the channel list if change in channel flags.

 drivers/net/wireless/ath/ath10k/mac.c | 11 +++
 include/net/cfg80211.h|  7 +++
 net/wireless/reg.c|  5 -
 3 files changed, 22 insertions(+), 1 deletion(-)

-- 
2.38.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH 1/2] wifi: cfg80211: Add beacon hint notifier support

2023-02-15 Thread Youghandhar Chintala (Temp)



On 1/18/2023 10:00 PM, Johannes Berg wrote:

+++ b/include/net/cfg80211.h
@@ -5386,6 +5386,8 @@ struct wiphy {
void (*reg_notifier)(struct wiphy *wiphy,
 struct regulatory_request *request);
  
+	void (*beacon_hint_notifier)(struct wiphy *wiphy);


missing documentation, for sure

I will add the missed documentation in next version of patch.

Also this should probably be in the ops, rather than here? Not sure why
reg_notifier is here.

I followed reg_notifier implementation.

-   if (channel_changed)
+   if (channel_changed) {
nl80211_send_beacon_hint_event(wiphy, _before, chan);
+   if (wiphy->beacon_hint_notifier)
+   wiphy->beacon_hint_notifier(wiphy);
+   }

This also seems excessive if you're not even passing the channel - you
call it for every (affected) channel, but you don't tell it anything
about the channel? Seems strange.

I will address this in next version of patch.



However ...

Why is this even needed? You should always get reg_notifier after this
anyway?

johannes


Currently when channel flag changed through the beacon hints are not 
informed to driver.


reg_notifier will be triggered for regdomain changes but not for channel flag 
changes due to beacon hints.

Regards,
Youghandhar


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH 2/2] wifi: ath10k: update the channel list if change in channel flags.

2023-01-18 Thread Youghandhar Chintala (Temp)


On 1/19/2023 7:56 AM, Wen Gong wrote:

On 12/22/2022 8:42 PM, Youghandhar Chintala wrote:
...

  +static void ath10k_mac_beacon_notifier(struct wiphy *wiphy)
+{
+    struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+    struct ath10k *ar = hw->priv;
+
+    if (ath10k_update_channel_list(ar))
+    ath10k_warn(ar, "failed to update channel list\n");
+}
+


Will this called while scan is running?
On ath11k, if send channel list to firmware, then the running scan 
will be cancel and removed.

I guess this is same for ath10k.


...


Yes Wen. You are right.

Regards,

Youghandhar


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 2/2] wifi: ath10k: update the channel list if change in channel flags.

2022-12-22 Thread Youghandhar Chintala
There are connection failures in hidden SSID case when the device is
with default reg domain WW.
For WW reg domain most of the 5 GHz channels are passive. When device
listens to the beacon on that channel, the driver is updating its
channel flag but firmware is not aware of it and firmware is not
sending probes on that channels.
Due to this, we are seeing connection failures when a device is trying
to connect with hidden SSID AP.
Register beacon hint notifier to the regulatory core so that driver get
notified when there is a change in channel flags. Driver's notifier
callback will send the updated flags to the firmware.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00174

Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index ec8d5b29bc72..91a957295456 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3534,6 +3534,15 @@ static void ath10k_mac_update_channel_list(struct ath10k 
*ar,
}
 }
 
+static void ath10k_mac_beacon_notifier(struct wiphy *wiphy)
+{
+   struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+   struct ath10k *ar = hw->priv;
+
+   if (ath10k_update_channel_list(ar))
+   ath10k_warn(ar, "failed to update channel list\n");
+}
+
 static void ath10k_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request)
 {
@@ -10286,6 +10295,8 @@ int ath10k_mac_register(struct ath10k *ar)
goto err_unregister;
}
 
+   ar->hw->wiphy->beacon_hint_notifier = ath10k_mac_beacon_notifier;
+
return 0;
 
 err_unregister:
-- 
2.38.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 0/2] Update the channel list if the change in channel flags

2022-12-22 Thread Youghandhar Chintala
There are connection failures in hidden SSID case when the device is with
default reg domain WW.
For WW reg domain most of the 5 GHz channels are passive. When device
listens to the beacon on that channel, the driver is updating its channel
flag but firmware is not aware of it and firmware is not sending probes
on that channels.
Due to this, we are seeing connection failures when the device is tries to
connect with hidden SSID AP.
Whenever the driver detects a channel flag change, send the updated channel
list command to the firmware.

Youghandhae Chintala (2):
  wifi: cfg80211: Add beacon hint notifier support
  wifi: ath10k: update the channel list if change in channel flags.

 drivers/net/wireless/ath/ath10k/mac.c | 11 +++
 include/net/cfg80211.h|  2 ++
 net/wireless/reg.c|  5 -
 3 files changed, 17 insertions(+), 1 deletion(-)

-- 
2.38.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v3] wifi: ath10k: Add WLAN firmware image version info into smem

2022-11-17 Thread Youghandhar Chintala (Temp)



On 11/14/2022 6:29 PM, Kalle Valo wrote:

Youghandhar Chintala  writes:


In a SoC based solution, it would be useful to know the versions of the
various binary firmware blobs the system is running on. On a QCOM based
SoC, this info can be obtained from socinfo debugfs infrastructure. For
this to work, respective subsystem drivers have to export the firmware
version information to an SMEM based version information table.

Having firmware version information at one place will help quickly
figure out the firmware versions of various subsystems on the device
instead of going through builds/logs in an event of a system crash.

Fill WLAN firmware version information in SMEM version table to be
printed as part of socinfo debugfs infrastructure on a Qualcomm based
SoC.

This change is applicable only for WCN399X targets.

Example:
cat /sys/kernel/debug/qcom_socinfo/cnss/name
QC_IMAGE_VERSION_STRING=WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1

Reported-by: kernel test robot 

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1

Signed-off-by: Youghandhar Chintala 
---
Changes from v2:
  - Removed blank line between trailers
  - Changed memcpy to strscpy
  - Removed version_string_size
  - Added new condition fw_build_id against max length
  - Added depends on QCOM_SMEM for ath10k_snoc
---
  drivers/net/wireless/ath/ath10k/Kconfig |  1 +
  drivers/net/wireless/ath/ath10k/qmi.c   | 34 +
  2 files changed, 35 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index ca007b800f75..e6ea884cafc1 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -44,6 +44,7 @@ config ATH10K_SNOC
tristate "Qualcomm ath10k SNOC support"
depends on ATH10K
depends on ARCH_QCOM || COMPILE_TEST
+   depends on QCOM_SMEM
select QCOM_SCM
select QCOM_QMI_HELPERS

Is there a reason why you used "depends on"? Other QCOM dependencies
used "select", so I'm wondering if QCOM_SMEM should also use select?

Sure Kalle. As suggested will change it to select.


Please also use ath10k list for ath10k patches, not ath11k.

Apologies, My bad.

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] wifi: ath10k: Add WLAN firmware image version info into smem

2022-11-01 Thread Youghandhar Chintala (Temp)


On 11/1/2022 2:31 PM, Kalle Valo wrote:

(fixing quotation)

"Youghandhar Chintala (Temp)"  writes:


On 10/28/2022 12:19 AM, Jeff Johnson wrote:


On 10/26/2022 3:22 AM, Youghandhar Chintala wrote:

   +static void ath10k_qmi_add_wlan_ver_smem(struct ath10k *ar, char
*fw_build_id)

const char *fw_build_id?


+{
+    u8 *smem_table_ptr;
+    size_t smem_block_size;
+    const u32 version_string_size = 128;

should you s/128/MAX_BUILD_ID_LEN/ since that is what is used to
size qmi->fw_build_id?

or alternately have the caller pass fw_build_id length as a separate
param?

Sure Jeff. Will address it in next version of patch.

BTW Youghandhar, your quotes were broken in this mail so your reply was
difficult to find. See here:

https://patchwork.kernel.org/project/linux-wireless/patch/20221026102257.19919-1-quic_yough...@quicinc.com/

If you are using Outlook, I recommend switching to an application which
respects standards more :) For example, some people seem to be happy
with Thunderbird.



Thank you so much for your suggestion. I will address it.

Currently I am using  Thunderbird.


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] wifi: ath10k: Add WLAN firmware image version info into smem

2022-10-26 Thread Youghandhar Chintala
In a SoC based solution, it would be useful to know the versions of the
various binary firmware blobs the system is running on. On a QCOM based
SoC, this info can be obtained from socinfo debugfs infrastructure. For
this to work, respective subsystem drivers have to export the firmware
version information to an SMEM based version information table.

Having firmware version information at one place will help quickly
figure out the firmware versions of various subsystems on the device
instead of going through builds/logs in an event of a system crash.

Fill WLAN firmware version information in SMEM version table to be
printed as part of socinfo debugfs infrastructure on a Qualcomm based
SoC.

This change is applicable only for WCN399X targets.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1

Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 28 +++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 66cb7a1e628a..e88bcfd96859 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -22,6 +23,8 @@
 
 #define ATH10K_QMI_CLIENT_ID   0x4b4e454c
 #define ATH10K_QMI_TIMEOUT 30
+#define ATH10K_SMEM_IMAGE_VERSION_TABLE   469
+#define ATH10K_SMEM_IMAGE_TABLE_CNSS_INDEX 13
 
 static int ath10k_qmi_map_msa_permission(struct ath10k_qmi *qmi,
 struct ath10k_msa_mem_info *mem_info)
@@ -536,6 +539,29 @@ int ath10k_qmi_wlan_disable(struct ath10k *ar)
return ath10k_qmi_mode_send_sync_msg(ar, QMI_WLFW_OFF_V01);
 }
 
+static void ath10k_qmi_add_wlan_ver_smem(struct ath10k *ar, char *fw_build_id)
+{
+   u8 *smem_table_ptr;
+   size_t smem_block_size;
+   const u32 version_string_size = 128;
+   const u32 smem_img_idx_wlan = ATH10K_SMEM_IMAGE_TABLE_CNSS_INDEX * 128;
+
+   smem_table_ptr = qcom_smem_get(QCOM_SMEM_HOST_ANY,
+  ATH10K_SMEM_IMAGE_VERSION_TABLE,
+  _block_size);
+   if (IS_ERR(smem_table_ptr)) {
+   ath10k_dbg(ar, ATH10K_DBG_QMI, "smem image version table not 
found");
+   return;
+   }
+   if (smem_img_idx_wlan + version_string_size > smem_block_size) {
+   ath10k_dbg(ar, ATH10K_DBG_QMI, "smem block size too small: %i",
+  smem_block_size);
+   return;
+   }
+   memcpy(smem_table_ptr + smem_img_idx_wlan, fw_build_id,
+  version_string_size);
+}
+
 static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)
 {
struct wlfw_cap_resp_msg_v01 *resp;
@@ -606,6 +632,8 @@ static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi 
*qmi)
qmi->fw_version, qmi->fw_build_timestamp, 
qmi->fw_build_id);
}
 
+   ath10k_qmi_add_wlan_ver_smem(ar, qmi->fw_build_id);
+
kfree(resp);
return 0;
 
-- 
2.38.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2] wifi: ath10k: Delay the unmapping of the buffer

2022-10-12 Thread Youghandhar Chintala
On WCN3990, we are seeing a rare scenario where copy engine hardware is
sending a copy complete interrupt to the host driver while still
processing the buffer that the driver has sent, this is leading into an
SMMU fault triggering kernel panic. This is happening on copy engine
channel 3 (CE3) where the driver normally enqueues WMI commands to the
firmware. Upon receiving a copy complete interrupt, host driver will
immediately unmap and frees the buffer presuming that hardware has
processed the buffer. In the issue case, upon receiving copy complete
interrupt, host driver will unmap and free the buffer but since hardware
is still accessing the buffer (which in this case got unmapped in
parallel), SMMU hardware will trigger an SMMU fault resulting in a
kernel panic.

In order to avoid this, as a work around, add a delay before unmapping
the copy engine source DMA buffer. This is conditionally done for
WCN3990 and only for the CE3 channel where issue is seen.

Below is the crash signature:

wifi smmu error: kernel: [ 10.120965] arm-smmu 1500.iommu: Unhandled
context fault: fsr=0x402, iova=0x7fdfd8ac0,
fsynr=0x53,cbfrsynra=0xc1, cb=6 arm-smmu 1500.iommu: Unhandled
context fault:fsr=0x402, iova=0x7fe06fdc0, fsynr=0x710003,
cbfrsynra=0xc1, cb=6 qcom-q6v5-mss 408.remoteproc: fatal error
received: err_qdi.c:1040:EF:wlan_process:0x1:WLAN RT:0x2091:
cmnos_thread.c:3998:Asserted in copy_engine.c:AXI_ERROR_DETECTED:2149
remoteproc remoteproc0: crash detected in
408.remoteproc: type fatal error <3> remoteproc remoteproc0:
handling crash #1 in 408.remoteproc

pc : __arm_lpae_unmap+0x500/0x514
lr : __arm_lpae_unmap+0x4bc/0x514
sp : ffc011ffb530
x29: ffc011ffb590 x28: 
x27:  x26: 0004
x25: 0003 x24: ffc011ffb890
x23: ffa762ef9be0 x22: ffa77244ef00
x21: 0009 x20: 0007fff7c000
x19: 0003 x18: 
x17: 0004 x16: ffd7a357d9f0
x15:  x14: 00fd5d4fa7ff
x13: 000e x12: 
x11:  x10: fe00
x9 : 017c x8 : 000c
x7 :  x6 : ffa762ef9000
x5 : 0003 x4 : 0004
x3 : 1000 x2 : 0007fff7c000
x1 : ffc011ffb890 x0 :  Call trace:
__arm_lpae_unmap+0x500/0x514
__arm_lpae_unmap+0x4bc/0x514
__arm_lpae_unmap+0x4bc/0x514
arm_lpae_unmap_pages+0x78/0xa4
arm_smmu_unmap_pages+0x78/0x104
__iommu_unmap+0xc8/0x1e4
iommu_unmap_fast+0x38/0x48
__iommu_dma_unmap+0x84/0x104
iommu_dma_free+0x34/0x50
dma_free_attrs+0xa4/0xd0
ath10k_htt_rx_free+0xc4/0xf4 [ath10k_core] ath10k_core_stop+0x64/0x7c
[ath10k_core]
ath10k_halt+0x11c/0x180 [ath10k_core]
ath10k_stop+0x54/0x94 [ath10k_core]
drv_stop+0x48/0x1c8 [mac80211]
ieee80211_do_open+0x638/0x77c [mac80211] ieee80211_open+0x48/0x5c
[mac80211]
__dev_open+0xb4/0x174
__dev_change_flags+0xc4/0x1dc
dev_change_flags+0x3c/0x7c
devinet_ioctl+0x2b4/0x580
inet_ioctl+0xb0/0x1b4
sock_do_ioctl+0x4c/0x16c
compat_ifreq_ioctl+0x1cc/0x35c
compat_sock_ioctl+0x110/0x2ac
__arm64_compat_sys_ioctl+0xf4/0x3e0
el0_svc_common+0xb4/0x17c
el0_svc_compat_handler+0x2c/0x58
el0_svc_compat+0x8/0x2c

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1

Tested-by: Douglas Anderson 
Signed-off-by: Youghandhar Chintala 

---
V2:
  - Commit message changes
---
 drivers/net/wireless/ath/ath10k/core.c | 16 
 drivers/net/wireless/ath/ath10k/htc.c  |  9 +
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 3 files changed, 27 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index d1ac64026cb3..9a8ea7231a9e 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -99,6 +99,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -138,6 +139,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -178,6 +180,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -213,6 +216,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support 

[PATCH] wifi: ath10k: Delay the unmapping of the buffer

2022-08-15 Thread Youghandhar Chintala
We are seeing a corner case where host receiving copy completion for WMI
command though copy engine is processing it. Once host receives the
copy completion, host is unmapping corresponding memory which results
in SMMU fault. To avoid such conditions though host receives copy
completion, as a work around we are adding a delay to unmap the memory
for WMI end point.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1

Tested-by: Douglas Anderson 
Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 15 +++
 drivers/net/wireless/ath/ath10k/htc.c  |  8 
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 3 files changed, 25 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index d1ac64026cb3..c2fda8deb9ef 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -99,6 +99,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -138,6 +139,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -178,6 +180,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -252,6 +255,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -291,6 +295,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -330,6 +335,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -373,6 +379,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = true,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -418,6 +425,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -470,6 +478,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -519,6 +528,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9377_HW_1_0_DEV_VERSION,
@@ -558,6 +568,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9377_HW_1_1_DEV_VERSION,
@@ -599,6 +610,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
.use_fw_tx_credits = true,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9377_HW_1_1_DEV_VERSION,
@@ -631,6 +643,7 @@ static const

[PATCH] wifi:ath10k: Set tx credit to one for WCN3990 snoc based devices

2022-08-01 Thread Youghandhar Chintala
Currently host can send two WMI commands at once.There is possibility to
cause SMMU issues or corruption, if host wants to initiate 2 DMA
transfers, it is possible when copy complete interrupt for first DMA
reaches host, CE has already updated SRRI (Source ring read index) for
both DMA transfers and is in the middle of 2nd DMA. Host uses SRRI
(Source ring read index) to interpret how many DMA’s have been completed
and tries to unmap/free both the DMA entries.Hence now it is limiting to
one.Because CE is  still in the middle of 2nd DMA which can cause these
issues when handling two DMA transfers.

This change will not impact other targets, as it is only for WCN3990.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1

Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 16 
 drivers/net/wireless/ath/ath10k/htc.c  | 10 +++---
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 276954b70d63..d1ac64026cb3 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -98,6 +98,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.tx_stats_over_pktlog = true,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -136,6 +137,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = true,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -175,6 +177,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -209,6 +212,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.supports_peer_stats_info = true,
.dynamic_sar_support = true,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -247,6 +251,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -285,6 +290,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -323,6 +329,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -365,6 +372,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.supports_peer_stats_info = true,
.dynamic_sar_support = true,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -409,6 +417,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -460,6 +469,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -508,6 +518,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
.hw_restart_disconnect = false,
+   .use_fw_tx_credits = true,
},
{
.id = QCA9377_HW_1_0_DEV_VERSION,
@@ -546,6 +557,7 @@ static const struct

[PATCH v6 1/2] mac80211: Add support to trigger sta disconnect on hardware restart

2022-03-15 Thread Youghandhar Chintala
Currently in case of target hardware restart, we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a sta disconnect, in case of target
hw restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex changes and
will still be inefficient.

Tested on ath10k using WCN3990, QCA6174

Reviewed-by: Brian Norris 
Reported-by: kernel test robot 
Signed-off-by: Youghandhar Chintala 
---
 include/net/mac80211.h | 10 ++
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c| 14 +-
 net/mac80211/util.c| 33 ++---
 4 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index bd6912d0292b..2f9236e8e33d 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -6064,6 +6064,16 @@ void ieee80211_disconnect(struct ieee80211_vif *vif, 
bool reconnect);
  */
 void ieee80211_resume_disconnect(struct ieee80211_vif *vif);
 
+/**
+ * ieee80211_hw_restart_disconnect - disconnect from AP after
+ * hardware restart
+ * @vif:  ieee80211_vif pointer from the add_interface callback.
+ *
+ * Instructs mac80211 to disconnect from the AP after
+ * hardware restart.
+ */
+void ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif);
+
 /**
  * ieee80211_cqm_rssi_notify - inform a configured connection quality 
monitoring
  * rssi threshold triggered
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index da35791b8378..7819cdf7ddfa 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -765,6 +765,8 @@ struct ieee80211_if_mesh {
  * back to wireless media and to the local net stack.
  * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
  * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
+ * @IEEE80211_SDATA_DISCONNECT_HW_RESTART: Disconnect after hardware restart
+ *  recovery
  */
 enum ieee80211_sub_if_data_flags {
IEEE80211_SDATA_ALLMULTI= BIT(0),
@@ -772,6 +774,7 @@ enum ieee80211_sub_if_data_flags {
IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
IEEE80211_SDATA_DISCONNECT_RESUME   = BIT(4),
IEEE80211_SDATA_IN_DRIVER   = BIT(5),
+   IEEE80211_SDATA_DISCONNECT_HW_RESTART   = BIT(6),
 };
 
 /**
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 20b57ddf149c..182a5d477c43 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4842,6 +4842,7 @@ void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data 
*sdata)
 
sdata_unlock(sdata);
 }
+#endif
 
 void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
 {
@@ -4863,9 +4864,20 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data 
*sdata)
sdata_unlock(sdata);
return;
}
+
+   if (sdata->flags & IEEE80211_SDATA_DISCONNECT_HW_RESTART) {
+   sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART;
+   mlme_dbg(sdata, "driver requested disconnect after hardware 
restart\n");
+   ieee80211_sta_connection_lost(sdata,
+ ifmgd->associated->bssid,
+ WLAN_REASON_UNSPECIFIED,
+ true);
+   sdata_unlock(sdata);
+   return;
+   }
+
sdata_unlock(sdata);
 }
-#endif
 
 /* interface setup */
 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index abc29df6834c..4b791f94751f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2321,6 +2321,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
struct cfg80211_sched_scan_request *sched_scan_req;
bool sched_scan_stopped = false;
bool suspended = local->suspended;
+   bool in_reconfig = false;
 
/* nothing to do if HW shouldn't run */
if (!local->open_count)
@@ -2672,6 +2673,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTAR

[PATCH v6 0/2] mac80211: Trigger disconnect for STA during target hardware restart

2022-03-15 Thread Youghandhar Chintala
Currently in case of target hardware restart ,we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a disconnect in case of hardware
restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex/inefficient
datapath changes.

---
Changes from v5:
- Fixed kernel test robot error

Youghandhar Chintala (2):
  mac80211: Add support to trigger sta disconnect on  hardware restart
  ath10k: Trigger sta disconnect on hardware restart

 drivers/net/wireless/ath/ath10k/core.c | 25 +++
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 include/net/mac80211.h | 10 
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c| 14 ++-
 net/mac80211/util.c| 33 +++---
 6 files changed, 83 insertions(+), 4 deletions(-)

-- 
2.29.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v6 2/2] ath10k: Trigger sta disconnect on hardware restart

2022-03-15 Thread Youghandhar Chintala
Currently after the hardware restart triggered from the driver,
the station interface connection remains intact, since a disconnect
trigger is not sent to userspace. This can lead to a problem in
targets where the wifi mac sequence is added by the firmware.

After the target restart, its wifi mac sequence number gets
reset to zero. Hence AP to which our device is connected will receive
frames with a  wifi mac sequence number jump to the past, thereby
resulting in the AP dropping all these frames, until the frame
arrives with a wifi mac sequence number which AP was expecting.

To avoid such frame drops, its better to trigger a station disconnect
upon target hardware restart which can be done with API
ieee80211_reconfig_disconnect exposed to mac80211.

The other targets are not affected by this change, since the hardware
params flag is not set.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00048

Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 25 +
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 9e1f483e1362..2092bfd02cd1 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -94,6 +94,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.credit_size_workaround = false,
.tx_stats_over_pktlog = true,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -131,6 +132,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = true,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -169,6 +171,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -202,6 +205,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.bmi_large_size_download = true,
.supports_peer_stats_info = true,
.dynamic_sar_support = true,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -239,6 +243,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -276,6 +281,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -313,6 +319,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -354,6 +361,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.supports_peer_stats_info = true,
.dynamic_sar_support = true,
+   .hw_restart_disconnect = false,
},
{
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -397,6 +405,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -447,6 +456,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -494,6 +504,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list

[PATCH v5 1/2] mac80211: Add support to trigger sta disconnect on hardware restart

2022-03-08 Thread Youghandhar Chintala
Currently in case of target hardware restart, we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a sta disconnect, in case of target
hw restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex changes and
will still be inefficient.

Tested on ath10k using WCN3990, QCA6174

Signed-off-by: Youghandhar Chintala 
---
 include/net/mac80211.h | 10 ++
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c| 12 
 net/mac80211/util.c| 33 ++---
 4 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index bd6912d0292b..2f9236e8e33d 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -6064,6 +6064,16 @@ void ieee80211_disconnect(struct ieee80211_vif *vif, 
bool reconnect);
  */
 void ieee80211_resume_disconnect(struct ieee80211_vif *vif);
 
+/**
+ * ieee80211_hw_restart_disconnect - disconnect from AP after
+ * hardware restart
+ * @vif:  ieee80211_vif pointer from the add_interface callback.
+ *
+ * Instructs mac80211 to disconnect from the AP after
+ * hardware restart.
+ */
+void ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif);
+
 /**
  * ieee80211_cqm_rssi_notify - inform a configured connection quality 
monitoring
  * rssi threshold triggered
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index da35791b8378..7819cdf7ddfa 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -765,6 +765,8 @@ struct ieee80211_if_mesh {
  * back to wireless media and to the local net stack.
  * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
  * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
+ * @IEEE80211_SDATA_DISCONNECT_HW_RESTART: Disconnect after hardware restart
+ *  recovery
  */
 enum ieee80211_sub_if_data_flags {
IEEE80211_SDATA_ALLMULTI= BIT(0),
@@ -772,6 +774,7 @@ enum ieee80211_sub_if_data_flags {
IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
IEEE80211_SDATA_DISCONNECT_RESUME   = BIT(4),
IEEE80211_SDATA_IN_DRIVER   = BIT(5),
+   IEEE80211_SDATA_DISCONNECT_HW_RESTART   = BIT(6),
 };
 
 /**
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 20b57ddf149c..7e5be39dc6cc 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4863,6 +4863,18 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data 
*sdata)
sdata_unlock(sdata);
return;
}
+
+   if (sdata->flags & IEEE80211_SDATA_DISCONNECT_HW_RESTART) {
+   sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART;
+   mlme_dbg(sdata, "driver requested disconnect after hardware 
restart\n");
+   ieee80211_sta_connection_lost(sdata,
+ ifmgd->associated->bssid,
+ WLAN_REASON_UNSPECIFIED,
+ true);
+   sdata_unlock(sdata);
+   return;
+   }
+
sdata_unlock(sdata);
 }
 #endif
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index abc29df6834c..4b791f94751f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2321,6 +2321,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
struct cfg80211_sched_scan_request *sched_scan_req;
bool sched_scan_stopped = false;
bool suspended = local->suspended;
+   bool in_reconfig = false;
 
/* nothing to do if HW shouldn't run */
if (!local->open_count)
@@ -2672,6 +2673,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART);
 
if (local->in_reconfig) {
+   in_reconfig = local->in_reconfig;
local->in_reconfig = false;
barrier();
 
@@ -2689,6 +2691,15 @@ int ieee80211_reconfig(struct ieee80211_local *local)
IEEE80211_QUEUE_STOP_REASON_SUSPEND,

[PATCH v5 0/2] mac80211: Trigger disconnect for STA during target hardware restart

2022-03-08 Thread Youghandhar Chintala
Currently in case of target hardware restart ,we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a disconnect in case of hardware
restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex/inefficient
datapath changes.

---
Changes from v3:
- Fixed commit text errors
- Remove excess space in "hardware  restart"
- Removed blank line between the function description and the arguments

Youghandhar Chintala (2):
  mac80211: Add support to trigger sta disconnect on  hardware restart
  ath10k: Trigger sta disconnect on hardware restart

 drivers/net/wireless/ath/ath10k/core.c | 25 +++
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 include/net/mac80211.h | 10 
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c| 12 ++
 net/mac80211/util.c| 33 +++---
 6 files changed, 82 insertions(+), 3 deletions(-)

-- 
2.29.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v5 2/2] ath10k: Trigger sta disconnect on hardware restart

2022-03-08 Thread Youghandhar Chintala
Currently after the hardware restart triggered from the driver,
the station interface connection remains intact, since a disconnect
trigger is not sent to userspace. This can lead to a problem in
targets where the wifi mac sequence is added by the firmware.

After the target restart, its wifi mac sequence number gets
reset to zero. Hence AP to which our device is connected will receive
frames with a  wifi mac sequence number jump to the past, thereby
resulting in the AP dropping all these frames, until the frame
arrives with a wifi mac sequence number which AP was expecting.

To avoid such frame drops, its better to trigger a station disconnect
upon target hardware restart which can be done with API
ieee80211_reconfig_disconnect exposed to mac80211.

The other targets are not affected by this change, since the hardware
params flag is not set.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00048

Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 25 +
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 9e1f483e1362..2092bfd02cd1 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -94,6 +94,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.credit_size_workaround = false,
.tx_stats_over_pktlog = true,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -131,6 +132,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = true,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -169,6 +171,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -202,6 +205,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.bmi_large_size_download = true,
.supports_peer_stats_info = true,
.dynamic_sar_support = true,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -239,6 +243,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -276,6 +281,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -313,6 +319,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -354,6 +361,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.supports_peer_stats_info = true,
.dynamic_sar_support = true,
+   .hw_restart_disconnect = false,
},
{
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -397,6 +405,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -447,6 +456,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -494,6 +504,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list

[PATCH v4 1/2] mac80211: Add support to trigger sta disconnect on hardware restart

2022-03-03 Thread Youghandhar Chintala
Currently in case of target hardware restart, we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a sta disconnect, in case of target
hw restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex changes and
will still be inefficient.

Tested on ath10k using WCN3990, QCA6174

Signed-off-by: Youghandhar Chintala 
---
 include/net/mac80211.h | 11 +++
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c| 12 
 net/mac80211/util.c| 33 ++---
 4 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index bd6912d0292b..0773c50fa182 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -6064,6 +6064,17 @@ void ieee80211_disconnect(struct ieee80211_vif *vif, 
bool reconnect);
  */
 void ieee80211_resume_disconnect(struct ieee80211_vif *vif);
 
+/**
+ * ieee80211_hw_restart_disconnect - disconnect from AP after
+ * hardware  restart
+ *
+ * @vif:  ieee80211_vif pointer from the add_interface callback.
+ *
+ * Instructs mac80211 to disconnect from the AP after
+ * hardware restart.
+ */
+void ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif);
+
 /**
  * ieee80211_cqm_rssi_notify - inform a configured connection quality 
monitoring
  * rssi threshold triggered
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index da35791b8378..7819cdf7ddfa 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -765,6 +765,8 @@ struct ieee80211_if_mesh {
  * back to wireless media and to the local net stack.
  * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
  * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
+ * @IEEE80211_SDATA_DISCONNECT_HW_RESTART: Disconnect after hardware restart
+ *  recovery
  */
 enum ieee80211_sub_if_data_flags {
IEEE80211_SDATA_ALLMULTI= BIT(0),
@@ -772,6 +774,7 @@ enum ieee80211_sub_if_data_flags {
IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
IEEE80211_SDATA_DISCONNECT_RESUME   = BIT(4),
IEEE80211_SDATA_IN_DRIVER   = BIT(5),
+   IEEE80211_SDATA_DISCONNECT_HW_RESTART   = BIT(6),
 };
 
 /**
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 20b57ddf149c..7e5be39dc6cc 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4863,6 +4863,18 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data 
*sdata)
sdata_unlock(sdata);
return;
}
+
+   if (sdata->flags & IEEE80211_SDATA_DISCONNECT_HW_RESTART) {
+   sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART;
+   mlme_dbg(sdata, "driver requested disconnect after hardware 
restart\n");
+   ieee80211_sta_connection_lost(sdata,
+ ifmgd->associated->bssid,
+ WLAN_REASON_UNSPECIFIED,
+ true);
+   sdata_unlock(sdata);
+   return;
+   }
+
sdata_unlock(sdata);
 }
 #endif
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index abc29df6834c..4b791f94751f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2321,6 +2321,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
struct cfg80211_sched_scan_request *sched_scan_req;
bool sched_scan_stopped = false;
bool suspended = local->suspended;
+   bool in_reconfig = false;
 
/* nothing to do if HW shouldn't run */
if (!local->open_count)
@@ -2672,6 +2673,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART);
 
if (local->in_reconfig) {
+   in_reconfig = local->in_reconfig;
local->in_reconfig = false;
barrier();
 
@@ -2689,6 +2691,15 @@ int ieee80211_reconfig(struct ieee80211_local *local)
IEEE80211_QUEUE_STOP_REASON_SUSPEND,

[PATCH v4 2/2] ath10k:trigger sta disconnect on hardware restart

2022-03-03 Thread Youghandhar Chintala
Currently after the hardware restart triggered from the driver,
the station interface connection remains intact, since a disconnect
trigger is not sent to userspace. This can lead to a problem in
targets where the wifi mac sequence is added by the firmware.

After the target restart, during subsytem recovery, the target
restarts its wifi mac sequence number. Hence AP to which our device
is connected will receive frames with a  wifi mac sequence number jump
to the past, thereby resulting in the AP dropping all these frames,
until the frame arrives with a wifi mac sequence number which AP was
expecting.

To avoid such frame drops, its better to trigger a station disconnect
upon target hardware restart which can be done with API
ieee80211_reconfig_disconnect exposed to mac80211.

The other targets are not affected by this change, since the hardware
params flag is not set.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1
   QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
   QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00048

Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 25 +
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 9e1f483e1362..2092bfd02cd1 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -94,6 +94,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.credit_size_workaround = false,
.tx_stats_over_pktlog = true,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -131,6 +132,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = true,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -169,6 +171,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -202,6 +205,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.bmi_large_size_download = true,
.supports_peer_stats_info = true,
.dynamic_sar_support = true,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -239,6 +243,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -276,6 +281,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -313,6 +319,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -354,6 +361,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.supports_peer_stats_info = true,
.dynamic_sar_support = true,
+   .hw_restart_disconnect = false,
},
{
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -397,6 +405,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -447,6 +456,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.credit_size_workaround = false,
.tx_stats_over_pktlog = false,
.dynamic_sar_support = false,
+   .hw_restart_disconnect = false,
},
{
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -494,6 +504,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list

[PATCH v4 0/2] mac80211: Trigger disconnect for STA during target hardware restart

2022-03-03 Thread Youghandhar Chintala
Currently in case of target hardware restart ,we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a disconnect in case of hardware
restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex/inefficient
datapath changes.

---
Changes from v3:
- Added common API to trigger disconnect.

Youghandhar Chintala (2):
  mac80211: Add support to trigger sta disconnect on  hardware restart
  ath10k:trigger sta disconnect on hardware restart

 drivers/net/wireless/ath/ath10k/core.c | 27 
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 include/net/mac80211.h | 23 +
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c| 12 +
 net/mac80211/util.c| 34 +++---
 6 files changed, 98 insertions(+), 3 deletions(-)

-- 
2.29.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[RFC 2/2] ath10k: Delay the unmapping of the buffer

2022-01-20 Thread Youghandhar Chintala
We are seeing a corner case smmu fault issue where copy engine is still
accessing the memory though host unmaps it hence as work around
we are delaying the unmapping the memory.

Tested-on: WLAN.HL.3.2.2.c10-00757-QCAHLSWMTPL-1

Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 15 +++
 drivers/net/wireless/ath/ath10k/htc.c  |  5 +
 drivers/net/wireless/ath/ath10k/hw.h   |  3 +++
 3 files changed, 23 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index fcaed7d176568..65f775fb5ccab 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -93,6 +93,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -130,6 +131,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -168,6 +170,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -200,6 +203,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.bmi_large_size_download = true,
.dynamic_sar_support = true,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -237,6 +241,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -274,6 +279,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -311,6 +317,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -351,6 +358,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = true,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -394,6 +402,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -444,6 +453,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -491,6 +501,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9377_HW_1_0_DEV_VERSION,
@@ -528,6 +539,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9377_HW_1_1_DEV_VERSION,
@@ -567,6 +579,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
.tx_credit_limit = false,
+   .delay_unmap_buffer = false,
},
{
.id = QCA9377_HW_1_1_DEV_VERSION

[RFC 0/2] ath10k:set tx credit to one and delay the unmaping

2022-01-20 Thread Youghandhar Chintala
Currently for WCN3990, the host driver can send two wmi commands at once, 
now it is limiting to one because if HOST wants to initiate 2 DMA transfers,
it is possible when copy complete interrupt for first DMA reaches HOST,  
CE has already updated SRRI for both DMA transfers and is in the middle 
of 2nd DMA. HOST uses SRRI to interpret how many DMA???s have been completed 
and tries to unmap/free both the DMA entries, but CE is still in the middle
of 2nd DMA which can cause SMMU issues or corruption.

We are seeing a corner case smmu fault issue where copy engine is still 
accessing
the memory though host unmaps it hence as work around we are delaying the 
unmapping the memory and tx credit to one.

Youghandhar Chintala (2):
  ath10k: Set tx credit to one for wcn3990 snoc based devices
  ath10k: Delay the unmapping of the buffer

 drivers/net/wireless/ath/ath10k/core.c | 30 ++
 drivers/net/wireless/ath/ath10k/htc.c  | 18 +---
 drivers/net/wireless/ath/ath10k/htc.h  |  1 +
 drivers/net/wireless/ath/ath10k/hw.h   |  6 ++
 4 files changed, 52 insertions(+), 3 deletions(-)

-- 
2.29.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[RFC 1/2] ath10k: Set tx credit to one for wcn3990 snoc based devices

2022-01-20 Thread Youghandhar Chintala
Currently for WCN3990, the host driver can send two wmi commands at once,
now it is limiting to one because if HOST wants to initiate 2 DMA transfers,
it is possible when copy complete interrupt for first DMA reaches HOST,
CE has already updated SRRI for both DMA transfers and is in the middle
of 2nd DMA.HOST uses SRRI to interpret how many DMA???s have been completed
and tries to unmap/free both the DMA entries, but CE is  still in the middle
of 2nd DMA which can cause SMMU issues or corruption.

Tested-on: WLAN.HL.3.2.2.c10-00757-QCAHLSWMTPL-1
Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 15 +++
 drivers/net/wireless/ath/ath10k/htc.c  | 13 ++---
 drivers/net/wireless/ath/ath10k/htc.h  |  1 +
 drivers/net/wireless/ath/ath10k/hw.h   |  3 +++
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index f0e12556e7dce..fcaed7d176568 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -92,6 +92,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.tx_stats_over_pktlog = true,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -128,6 +129,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = true,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -165,6 +167,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -196,6 +199,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_mac_seq_by_fw = false,
.bmi_large_size_download = true,
.dynamic_sar_support = true,
+   .tx_credit_limit = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -232,6 +236,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -268,6 +273,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -304,6 +310,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -343,6 +350,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = true,
+   .tx_credit_limit = false,
},
{
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -385,6 +393,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -434,6 +443,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -480,6 +490,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit = false,
},
{
.id = QCA9377_HW_1_0_DEV_VERSION,
@@ -516,6 +527,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_stats_over_pktlog = false,
.tx_mac_seq_by_fw = false,
.dynamic_sar_support = false,
+   .tx_credit_limit

Re: [PATCH v3] ath10k: Don't always treat modem stop events as crashes

2021-09-24 Thread Youghandhar Chintala
I pulled the latest patch changes and tested them on SC7180. Which works 
as expected.
Do not see this error message during reboot and can be seen while doing 
SSR.


Tested-By: Youghandhar Chintala 

On 2021-09-23 05:03, Stephen Boyd wrote:

When rebooting on sc7180 Trogdor devices I see the following crash from
the wifi driver.

 ath10k_snoc 1880.wifi: firmware crashed! (guid
83493570-29a2-4e98-a83e-70048c47669c)

This is because a modem stop event looks just like a firmware crash to
the driver, the qmi connection is closed in both cases. Use the qcom 
ssr

notifier block to stop treating the qmi connection close event as a
firmware crash signal when the modem hasn't actually crashed. See
ath10k_qmi_event_server_exit() for more details.

This silences the crash message seen during every reboot.

Fixes: 3f14b73c3843 ("ath10k: Enable MSA region dump support for 
WCN3990")

Cc: Youghandhar Chintala 
Cc: Abhishek Kumar 
Cc: Steev Klimaszewski 
Cc: Matthias Kaehlcke 
Cc: Rakesh Pillai 
Signed-off-by: Stephen Boyd 
---

Changes since v2
(https://lore.kernel.org/r/20210913205313.3420049-1-swb...@chromium.org):
 * Use a new bit instead of overloading unregistering

Changes since v1
(https://lore.kernel.org/r/20210905210400.1157870-1-swb...@chromium.org):
 * Push error message into function instead of checking at callsite

 drivers/net/wireless/ath/ath10k/qmi.c  |  3 +-
 drivers/net/wireless/ath/ath10k/snoc.c | 77 ++
 drivers/net/wireless/ath/ath10k/snoc.h |  5 ++
 3 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c
b/drivers/net/wireless/ath/ath10k/qmi.c
index 07e478f9a808..80fcb917fe4e 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -864,7 +864,8 @@ static void ath10k_qmi_event_server_exit(struct
ath10k_qmi *qmi)

ath10k_qmi_remove_msa_permission(qmi);
ath10k_core_free_board_files(ar);
-   if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags))
+   if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags) &&
+   !test_bit(ATH10K_SNOC_FLAG_MODEM_STOPPED, _snoc->flags))
ath10k_snoc_fw_crashed_dump(ar);

ath10k_snoc_fw_indication(ar, ATH10K_QMI_EVENT_FW_DOWN_IND);
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c
b/drivers/net/wireless/ath/ath10k/snoc.c
index ea00fbb15601..9513ab696fff 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

@@ -1477,6 +1478,74 @@ void ath10k_snoc_fw_crashed_dump(struct ath10k 
*ar)

mutex_unlock(>dump_mutex);
 }

+static int ath10k_snoc_modem_notify(struct notifier_block *nb,
unsigned long action,
+   void *data)
+{
+	struct ath10k_snoc *ar_snoc = container_of(nb, struct ath10k_snoc, 
nb);

+   struct ath10k *ar = ar_snoc->ar;
+   struct qcom_ssr_notify_data *notify_data = data;
+
+   switch (action) {
+   case QCOM_SSR_BEFORE_POWERUP:
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem starting 
event\n");
+   clear_bit(ATH10K_SNOC_FLAG_MODEM_STOPPED, _snoc->flags);
+   break;
+
+   case QCOM_SSR_AFTER_POWERUP:
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem running 
event\n");
+   break;
+
+   case QCOM_SSR_BEFORE_SHUTDOWN:
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem %s event\n",
+  notify_data->crashed ? "crashed" : "stopping");
+   if (!notify_data->crashed)
+   set_bit(ATH10K_SNOC_FLAG_MODEM_STOPPED, 
_snoc->flags);
+   else
+   clear_bit(ATH10K_SNOC_FLAG_MODEM_STOPPED, 
_snoc->flags);
+   break;
+
+   case QCOM_SSR_AFTER_SHUTDOWN:
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem offline 
event\n");
+   break;
+
+   default:
+   ath10k_err(ar, "received unrecognized event %lu\n", action);
+   break;
+   }
+
+   return NOTIFY_OK;
+}
+
+static int ath10k_modem_init(struct ath10k *ar)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   void *notifier;
+   int ret;
+
+   ar_snoc->nb.notifier_call = ath10k_snoc_modem_notify;
+
+   notifier = qcom_register_ssr_notifier("mpss", _snoc->nb);
+   if (IS_ERR(notifier)) {
+   ret = PTR_ERR(notifier);
+   ath10k_err(ar, "failed to initialize modem notifier: %d\n", 
ret);
+   return ret;
+   }
+
+   ar_snoc->notifier = notifier;
+
+   return 0;
+}
+
+static void ath10k_modem_deinit(struct ath10k *ar)
+{
+   int ret;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+
+   r

[PATCH v3] ath10k: skip the wait for completion to recovery in shutdown path

2021-02-23 Thread Youghandhar Chintala
Currently in the shutdown callback we wait for recovery to complete
before freeing up the resources. This results in additional two seconds
delay during the shutdown and thereby increase the shutdown time.

As an attempt to take less time during shutdown, remove the wait for
recovery completion in the shutdown callback and added an API to freeing
the reosurces in which they were common for shutdown and removing
the module.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Youghandhar Chintala 
Change-Id: I65bc27b5adae1fedc7f7b367ef13aafbd01f8c0c
---
Changes from v2:
-Corrected commit text and added common API for freeing the
 resources for shutdown and unloading the module
---
 drivers/net/wireless/ath/ath10k/snoc.c | 29 ++
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 84666f72bdfa..70b3f2bd1c81 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1781,17 +1781,11 @@ static int ath10k_snoc_probe(struct platform_device 
*pdev)
return ret;
 }
 
-static int ath10k_snoc_remove(struct platform_device *pdev)
+static int ath10k_snoc_free_resources(struct ath10k *ar)
 {
-   struct ath10k *ar = platform_get_drvdata(pdev);
struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
 
-   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc remove\n");
-
-   reinit_completion(>driver_recovery);
-
-   if (test_bit(ATH10K_SNOC_FLAG_RECOVERY, _snoc->flags))
-   wait_for_completion_timeout(>driver_recovery, 3 * HZ);
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc free resources\n");
 
set_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags);
 
@@ -1805,12 +1799,29 @@ static int ath10k_snoc_remove(struct platform_device 
*pdev)
return 0;
 }
 
+static int ath10k_snoc_remove(struct platform_device *pdev)
+{
+   struct ath10k *ar = platform_get_drvdata(pdev);
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc remove\n");
+
+   reinit_completion(>driver_recovery);
+
+   if (test_bit(ATH10K_SNOC_FLAG_RECOVERY, _snoc->flags))
+   wait_for_completion_timeout(>driver_recovery, 3 * HZ);
+
+   ath10k_snoc_free_resources(ar);
+
+   return 0;
+}
+
 static void ath10k_snoc_shutdown(struct platform_device *pdev)
 {
struct ath10k *ar = platform_get_drvdata(pdev);
 
ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc shutdown\n");
-   ath10k_snoc_remove(pdev);
+   ath10k_snoc_free_resources(ar);
 }
 
 static struct platform_driver ath10k_snoc_driver = {
-- 
2.29.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 0/3] mac80211: Trigger disconnect for STA during recovery

2020-12-15 Thread Youghandhar Chintala
From: Rakesh Pillai 

Currently in case of target hardware restart ,we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a disconnect in case of hardware
restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex/inefficient
datapath changes.

Rakesh Pillai (1):
  ath10k: Set wiphy flag to trigger sta disconnect on hardware restart

Youghandhar Chintala (2):
  cfg80211: Add wiphy flag to trigger STA disconnect after hardware
restart
  mac80211: Add support to trigger sta disconnect on hardware restart

 drivers/net/wireless/ath/ath10k/core.c | 15 +++
 drivers/net/wireless/ath/ath10k/hw.h   |  3 +++
 drivers/net/wireless/ath/ath10k/mac.c  |  3 +++
 include/net/cfg80211.h |  4 
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c|  9 +
 net/mac80211/util.c| 22 +++---
 7 files changed, 56 insertions(+), 3 deletions(-)

-- 
2.7.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 3/3] ath10k: Set wiphy flag to trigger sta disconnect on hardware restart

2020-12-15 Thread Youghandhar Chintala
From: Rakesh Pillai 

Currently after the hardware restart triggered from the driver,
the station interface connection remains intact, since a disconnect
trigger is not sent to userspace. This can lead to a problem in
hardwares where the wifi mac sequence is added by the firmware.

After the firmware restart, during subsytem recovery, the firmware
restarts its wifi mac sequence number. Hence AP to which our device
is connected will receive frames with a  wifi mac sequence number jump
to the past, thereby resulting in the AP dropping all these frames,
until the frame arrives with a wifi mac sequence number which AP was
expecting.

To avoid such frame drops, its better to trigger a station disconnect
upon the  hardware restart. Indicate this support via a WIPHY flag
to mac80211, if the hardware params flag mentions the support to
add wifi mac sequence numbers for TX frames in the firmware.

All the other hardwares, except WCN3990, are not affected by this
change, since the hardware params flag is not set for any hardware
except for WCN3990

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00048

Signed-off-by: Rakesh Pillai 
Signed-off-by: Youghandhar Chintala 
---
 drivers/net/wireless/ath/ath10k/core.c | 15 +++
 drivers/net/wireless/ath/ath10k/hw.h   |  3 +++
 drivers/net/wireless/ath/ath10k/mac.c  |  3 +++
 3 files changed, 21 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 796107b..4155f94 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -90,6 +90,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.hw_filter_reset_required = true,
.fw_diag_ce_download = false,
.tx_stats_over_pktlog = true,
+   .tx_mac_seq_by_fw = false,
},
{
.id = QCA988X_HW_2_0_VERSION,
@@ -124,6 +125,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_filter_reset_required = true,
.fw_diag_ce_download = false,
.tx_stats_over_pktlog = true,
+   .tx_mac_seq_by_fw = false,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -159,6 +161,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_filter_reset_required = true,
.fw_diag_ce_download = false,
.tx_stats_over_pktlog = false,
+   .tx_mac_seq_by_fw = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -187,6 +190,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.num_wds_entries = 0x20,
.uart_pin_workaround = true,
.tx_stats_over_pktlog = false,
+   .tx_mac_seq_by_fw = false,
.bmi_large_size_download = true,
.supports_peer_stats_info = true,
},
@@ -223,6 +227,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_filter_reset_required = true,
.fw_diag_ce_download = false,
.tx_stats_over_pktlog = false,
+   .tx_mac_seq_by_fw = false,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -257,6 +262,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_filter_reset_required = true,
.fw_diag_ce_download = false,
.tx_stats_over_pktlog = false,
+   .tx_mac_seq_by_fw = false,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -291,6 +297,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_filter_reset_required = true,
.fw_diag_ce_download = false,
.tx_stats_over_pktlog = false,
+   .tx_mac_seq_by_fw = false,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -328,6 +335,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_filter_reset_required = true,
.fw_diag_ce_download = true,
.tx_stats_over_pktlog = false,
+   .tx_mac_seq_by_fw = false,
.supports_peer_stats_info = true,
},
{
@@ -369,6 +377,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_filter_reset_required = true,
.fw_diag_ce_download = false,
.tx_stats_over_pktlog = false,
+   .tx_mac_seq_by_fw = false,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -416,6 +425,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_filter_reset_required = true,
.fw_diag_ce_download = false

[PATCH 0/3] mac80211: Trigger disconnect for STA during recovery

2020-12-15 Thread Youghandhar Chintala
From: Rakesh Pillai 

Currently in case of target hardware restart ,we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a disconnect in case of hardware
restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex/inefficient
datapath changes.

Rakesh Pillai (1):
  ath10k: Set wiphy flag to trigger sta disconnect on hardware restart

Youghandhar Chintala (2):
  cfg80211: Add wiphy flag to trigger STA disconnect after hardware
restart
  mac80211: Add support to trigger sta disconnect on hardware restart

 drivers/net/wireless/ath/ath10k/core.c | 15 +++
 drivers/net/wireless/ath/ath10k/hw.h   |  3 +++
 drivers/net/wireless/ath/ath10k/mac.c  |  3 +++
 include/net/cfg80211.h |  4 
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c|  9 +
 net/mac80211/util.c| 22 +++---
 7 files changed, 56 insertions(+), 3 deletions(-)

-- 
2.7.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2] ath10k: skip the wait for completion to recovery in shutdown path

2020-11-26 Thread Youghandhar Chintala
Currently in the shutdown callback we wait for recovery to complete
before freeing up the resources. This can lead to unwanted delay
during the shutdown and thereby increase the shutdown time.

As an attempt to take less time during shutdown, remove the wait for
recovery completion in the shutdown callback.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Youghandhar Chintala 
---
Changes from v1:
-Removed stray change-id text
---
 drivers/net/wireless/ath/ath10k/snoc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 84666f72bdfa..15580a91fe98 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1790,9 +1790,6 @@ static int ath10k_snoc_remove(struct platform_device 
*pdev)
 
reinit_completion(>driver_recovery);
 
-   if (test_bit(ATH10K_SNOC_FLAG_RECOVERY, _snoc->flags))
-   wait_for_completion_timeout(>driver_recovery, 3 * HZ);
-
set_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags);
 
ath10k_core_unregister(ar);
-- 
2.26.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: skip the wait for completion to recovery in shutdown path

2020-11-26 Thread Youghandhar Chintala
Currently in the shutdown callback we wait for recovery to complete
before freeing up the resources. This can lead to unwanted delay
during the shutdown and thereby increase the shutdown time.

As an attempt to take less time during shutdown, remove the wait for
recovery completion in the shutdown callback.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Youghandhar Chintala 
Change-Id: I0474ab7dc3730aaacac888bb9a7acc2fa0e8b4f8
---
 drivers/net/wireless/ath/ath10k/snoc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 84666f72bdfa..15580a91fe98 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1790,9 +1790,6 @@ static int ath10k_snoc_remove(struct platform_device 
*pdev)
 
reinit_completion(>driver_recovery);
 
-   if (test_bit(ATH10K_SNOC_FLAG_RECOVERY, _snoc->flags))
-   wait_for_completion_timeout(>driver_recovery, 3 * HZ);
-
set_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags);
 
ath10k_core_unregister(ar);
-- 
2.26.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k