linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] mac80211: Trigger disconnect for STA during target hardware restart
@ 2022-03-03 11:55 Youghandhar Chintala
  2022-03-03 11:55 ` [PATCH v4 1/2] mac80211: Add support to trigger sta disconnect on " Youghandhar Chintala
  2022-03-03 11:55 ` [PATCH v4 2/2] ath10k:trigger " Youghandhar Chintala
  0 siblings, 2 replies; 5+ messages in thread
From: Youghandhar Chintala @ 2022-03-03 11:55 UTC (permalink / raw)
  To: ath10k
  Cc: linux-wireless, linux-kernel, pillair, dianders, kuabhs,
	briannorris, mpubbise, 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 1/2] mac80211: Add support to trigger sta disconnect on  hardware restart
  2022-03-03 11:55 [PATCH v4 0/2] mac80211: Trigger disconnect for STA during target hardware restart Youghandhar Chintala
@ 2022-03-03 11:55 ` Youghandhar Chintala
  2022-03-03 16:44   ` Jeff Johnson
  2022-03-03 11:55 ` [PATCH v4 2/2] ath10k:trigger " Youghandhar Chintala
  1 sibling, 1 reply; 5+ messages in thread
From: Youghandhar Chintala @ 2022-03-03 11:55 UTC (permalink / raw)
  To: ath10k
  Cc: linux-wireless, linux-kernel, pillair, dianders, kuabhs,
	briannorris, mpubbise, 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 <youghand@codeaurora.org>
---
 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: &struct 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,
 					false);
 
+	if (in_reconfig) {
+		list_for_each_entry(sdata, &local->interfaces, list) {
+			if (!ieee80211_sdata_running(sdata))
+				continue;
+			if (sdata->vif.type == NL80211_IFTYPE_STATION)
+				ieee80211_sta_restart(sdata);
+		}
+	}
+
 	if (!suspended)
 		return 0;
 
@@ -2718,7 +2729,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
 	return 0;
 }
 
-void ieee80211_resume_disconnect(struct ieee80211_vif *vif)
+static void ieee80211_reconfig_disconnect(struct ieee80211_vif *vif, u8 flag)
 {
 	struct ieee80211_sub_if_data *sdata;
 	struct ieee80211_local *local;
@@ -2730,19 +2741,35 @@ void ieee80211_resume_disconnect(struct ieee80211_vif *vif)
 	sdata = vif_to_sdata(vif);
 	local = sdata->local;
 
-	if (WARN_ON(!local->resuming))
+	if (WARN_ON(flag & IEEE80211_SDATA_DISCONNECT_RESUME &&
+		    !local->resuming))
+		return;
+
+	if (WARN_ON(flag & IEEE80211_SDATA_DISCONNECT_HW_RESTART &&
+		    !local->in_reconfig))
 		return;
 
 	if (WARN_ON(vif->type != NL80211_IFTYPE_STATION))
 		return;
 
-	sdata->flags |= IEEE80211_SDATA_DISCONNECT_RESUME;
+	sdata->flags |= flag;
 
 	mutex_lock(&local->key_mtx);
 	list_for_each_entry(key, &sdata->key_list, list)
 		key->flags |= KEY_FLAG_TAINTED;
 	mutex_unlock(&local->key_mtx);
 }
+
+void ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif)
+{
+	ieee80211_reconfig_disconnect(vif, IEEE80211_SDATA_DISCONNECT_HW_RESTART);
+}
+EXPORT_SYMBOL_GPL(ieee80211_hw_restart_disconnect);
+
+void ieee80211_resume_disconnect(struct ieee80211_vif *vif)
+{
+	ieee80211_reconfig_disconnect(vif, IEEE80211_SDATA_DISCONNECT_RESUME);
+}
 EXPORT_SYMBOL_GPL(ieee80211_resume_disconnect);
 
 void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata)
-- 
2.29.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v4 2/2] ath10k:trigger sta disconnect on hardware restart
  2022-03-03 11:55 [PATCH v4 0/2] mac80211: Trigger disconnect for STA during target hardware restart Youghandhar Chintala
  2022-03-03 11:55 ` [PATCH v4 1/2] mac80211: Add support to trigger sta disconnect on " Youghandhar Chintala
@ 2022-03-03 11:55 ` Youghandhar Chintala
  2022-03-03 16:56   ` Jeff Johnson
  1 sibling, 1 reply; 5+ messages in thread
From: Youghandhar Chintala @ 2022-03-03 11:55 UTC (permalink / raw)
  To: ath10k
  Cc: linux-wireless, linux-kernel, pillair, dianders, kuabhs,
	briannorris, mpubbise, 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 <youghand@codeaurora.org>
---
 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[] = {
 		.credit_size_workaround = false,
 		.tx_stats_over_pktlog = false,
 		.dynamic_sar_support = false,
+		.hw_restart_disconnect = false,
 	},
 	{
 		.id = QCA9377_HW_1_0_DEV_VERSION,
@@ -531,6 +542,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 = QCA9377_HW_1_1_DEV_VERSION,
@@ -570,6 +582,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 = QCA9377_HW_1_1_DEV_VERSION,
@@ -600,6 +613,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 		.uart_pin_workaround = true,
 		.credit_size_workaround = true,
 		.dynamic_sar_support = false,
+		.hw_restart_disconnect = false,
 	},
 	{
 		.id = QCA4019_HW_1_0_DEV_VERSION,
@@ -644,6 +658,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 = WCN3990_HW_1_0_DEV_VERSION,
@@ -674,6 +689,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 		.credit_size_workaround = false,
 		.tx_stats_over_pktlog = false,
 		.dynamic_sar_support = true,
+		.hw_restart_disconnect = true,
 	},
 };
 
@@ -2442,6 +2458,7 @@ 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, &ar->dev_flags);
@@ -2480,6 +2497,14 @@ 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, &ar->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/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 5215a6816d71..93acf0dd580a 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -633,6 +633,8 @@ struct ath10k_hw_params {
 	bool supports_peer_stats_info;
 
 	bool dynamic_sar_support;
+
+	bool hw_restart_disconnect;
 };
 
 struct htt_resp;
-- 
2.29.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 1/2] mac80211: Add support to trigger sta disconnect on hardware restart
  2022-03-03 11:55 ` [PATCH v4 1/2] mac80211: Add support to trigger sta disconnect on " Youghandhar Chintala
@ 2022-03-03 16:44   ` Jeff Johnson
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Johnson @ 2022-03-03 16:44 UTC (permalink / raw)
  To: Youghandhar Chintala, ath10k
  Cc: linux-wireless, linux-kernel, pillair, dianders, kuabhs,
	briannorris, mpubbise

On 3/3/2022 3:55 AM, Youghandhar Chintala wrote:
> 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 <youghand@codeaurora.org>
> ---
>   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

nits:
remove excess space in "hardware  restart"

"Do not leave a blank line between the function description and the 
arguments" per 
<https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#function-documentation>

(I see that there is quite a mixture of compliant and non-compliant 
kernel-doc in this file)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 2/2] ath10k:trigger sta disconnect on hardware restart
  2022-03-03 11:55 ` [PATCH v4 2/2] ath10k:trigger " Youghandhar Chintala
@ 2022-03-03 16:56   ` Jeff Johnson
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Johnson @ 2022-03-03 16:56 UTC (permalink / raw)
  To: Youghandhar Chintala, ath10k
  Cc: linux-wireless, linux-kernel, pillair, dianders, kuabhs,
	briannorris, mpubbise

On 3/3/2022 3:55 AM, Youghandhar Chintala wrote:

nit: in subject add space after ath10k:

> 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

nit: s/subsytem/subsystem/

> 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

<https://wireless.wiki.kernel.org/en/users/drivers/ath10k/submittingpatches#tested-on_tag>

there should be a Tested-on: tag for each line/target

> 
> Signed-off-by: Youghandhar Chintala <youghand@codeaurora.org>
> ---
>   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[] = {
>   		.credit_size_workaround = false,
>   		.tx_stats_over_pktlog = false,
>   		.dynamic_sar_support = false,
> +		.hw_restart_disconnect = false,
>   	},
>   	{
>   		.id = QCA9377_HW_1_0_DEV_VERSION,
> @@ -531,6 +542,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 = QCA9377_HW_1_1_DEV_VERSION,
> @@ -570,6 +582,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 = QCA9377_HW_1_1_DEV_VERSION,
> @@ -600,6 +613,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
>   		.uart_pin_workaround = true,
>   		.credit_size_workaround = true,
>   		.dynamic_sar_support = false,
> +		.hw_restart_disconnect = false,
>   	},
>   	{
>   		.id = QCA4019_HW_1_0_DEV_VERSION,
> @@ -644,6 +658,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 = WCN3990_HW_1_0_DEV_VERSION,
> @@ -674,6 +689,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
>   		.credit_size_workaround = false,
>   		.tx_stats_over_pktlog = false,
>   		.dynamic_sar_support = true,
> +		.hw_restart_disconnect = true,
>   	},
>   };
>   
> @@ -2442,6 +2458,7 @@ 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, &ar->dev_flags);
> @@ -2480,6 +2497,14 @@ 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, &ar->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/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
> index 5215a6816d71..93acf0dd580a 100644
> --- a/drivers/net/wireless/ath/ath10k/hw.h
> +++ b/drivers/net/wireless/ath/ath10k/hw.h
> @@ -633,6 +633,8 @@ struct ath10k_hw_params {
>   	bool supports_peer_stats_info;
>   
>   	bool dynamic_sar_support;
> +
> +	bool hw_restart_disconnect;
>   };
>   
>   struct htt_resp;


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-03 16:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 11:55 [PATCH v4 0/2] mac80211: Trigger disconnect for STA during target hardware restart Youghandhar Chintala
2022-03-03 11:55 ` [PATCH v4 1/2] mac80211: Add support to trigger sta disconnect on " Youghandhar Chintala
2022-03-03 16:44   ` Jeff Johnson
2022-03-03 11:55 ` [PATCH v4 2/2] ath10k:trigger " Youghandhar Chintala
2022-03-03 16:56   ` Jeff Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).