linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] ath10k: Set wiphy flag to trigger sta disconnect on hardware restart
@ 2020-12-15 17:24 Youghandhar Chintala
  2020-12-22 22:36 ` Abhishek Kumar
  0 siblings, 1 reply; 4+ messages in thread
From: Youghandhar Chintala @ 2020-12-15 17:24 UTC (permalink / raw)
  To: ath10k
  Cc: kvalo, davem, kuba, linux-wireless, netdev, linux-kernel, kuabhs,
	dianders, briannorris, Rakesh Pillai, Youghandhar Chintala

From: Rakesh Pillai <pillair@codeaurora.org>

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 <pillair@codeaurora.org>
Signed-off-by: Youghandhar Chintala <youghand@codeaurora.org>
---
 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,
 		.tx_stats_over_pktlog = false,
+		.tx_mac_seq_by_fw = false,
 	},
 	{
 		.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -460,6 +470,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 = QCA9377_HW_1_0_DEV_VERSION,
@@ -494,6 +505,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 = QCA9377_HW_1_1_DEV_VERSION,
@@ -530,6 +542,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,
 	},
 	{
 		.id = QCA9377_HW_1_1_DEV_VERSION,
@@ -598,6 +611,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 = WCN3990_HW_1_0_DEV_VERSION,
@@ -625,6 +639,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 		.hw_filter_reset_required = false,
 		.fw_diag_ce_download = false,
 		.tx_stats_over_pktlog = false,
+		.tx_mac_seq_by_fw = true,
 	},
 };
 
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index c6ded21..c146d02 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -623,6 +623,9 @@ struct ath10k_hw_params {
 
 	/* provides bitrates for sta_statistics using WMI_TLV_PEER_STATS_INFO_EVENTID */
 	bool supports_peer_stats_info;
+
+	/* tx mac seq num is added by FW */
+	bool tx_mac_seq_by_fw;
 };
 
 struct htt_rx_desc;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index dc32c78..6fe9cd6 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -9890,6 +9890,9 @@ int ath10k_mac_register(struct ath10k *ar)
 	if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
 		ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA);
 
+	if (ar->hw_params.tx_mac_seq_by_fw)
+		ar->hw->wiphy->flags |= WIPHY_FLAG_STA_DISCONNECT_ON_HW_RESTART;
+
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 	ar->hw->wiphy->max_remain_on_channel_duration = 5000;
-- 
2.7.4


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

* Re: [PATCH 3/3] ath10k: Set wiphy flag to trigger sta disconnect on hardware restart
  2020-12-15 17:24 [PATCH 3/3] ath10k: Set wiphy flag to trigger sta disconnect on hardware restart Youghandhar Chintala
@ 2020-12-22 22:36 ` Abhishek Kumar
  2020-12-23 11:08   ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Abhishek Kumar @ 2020-12-22 22:36 UTC (permalink / raw)
  To: Youghandhar Chintala
  Cc: ath10k, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, LKML, Douglas Anderson, Brian Norris,
	Rakesh Pillai

On Tue, Dec 15, 2020 at 9:24 AM Youghandhar Chintala
<youghand@codeaurora.org> wrote:
>
> From: Rakesh Pillai <pillair@codeaurora.org>
>
> 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 <pillair@codeaurora.org>
> Signed-off-by: Youghandhar Chintala <youghand@codeaurora.org>
> ---
>  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,
Probably orthogonal to this patch, there is a static array maintained
for different hardware configs and the structure members like
"tx_mac_seq_by_fw" are initialized. This does not seem to be scalable
and probably these parameters can be auto populated based on FW
capabilities and so we don't have to maintain the static array.
Thoughts?

-Abhishek

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

* Re: [PATCH 3/3] ath10k: Set wiphy flag to trigger sta disconnect on hardware restart
  2020-12-22 22:36 ` Abhishek Kumar
@ 2020-12-23 11:08   ` Kalle Valo
  2021-02-05 22:00     ` Abhishek Kumar
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2020-12-23 11:08 UTC (permalink / raw)
  To: Abhishek Kumar
  Cc: Youghandhar Chintala, netdev, Brian Norris, linux-wireless, LKML,
	ath10k, Douglas Anderson, Rakesh Pillai, Jakub Kicinski,
	David S. Miller

Abhishek Kumar <kuabhs@chromium.org> writes:

> On Tue, Dec 15, 2020 at 9:24 AM Youghandhar Chintala
> <youghand@codeaurora.org> wrote:
>>
>> From: Rakesh Pillai <pillair@codeaurora.org>
>>
>> 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 <pillair@codeaurora.org>
>> Signed-off-by: Youghandhar Chintala <youghand@codeaurora.org>
>> ---
>>  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,
>
> Probably orthogonal to this patch, there is a static array maintained
> for different hardware configs and the structure members like
> "tx_mac_seq_by_fw" are initialized. This does not seem to be scalable
> and probably these parameters can be auto populated based on FW
> capabilities and so we don't have to maintain the static array.
> Thoughts?

I'm not sure what you mean. But if you are saying that we should move
ath10k_hw_params_list entirely to firmware then that is a huge task as
we would need to make changes in every firmware branch, and there are so
many different branches that I have lost count. And due to backwards
compatibility we still need to have ath10k_hw_params_list in ath10k for
few years.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH 3/3] ath10k: Set wiphy flag to trigger sta disconnect on hardware restart
  2020-12-23 11:08   ` Kalle Valo
@ 2021-02-05 22:00     ` Abhishek Kumar
  0 siblings, 0 replies; 4+ messages in thread
From: Abhishek Kumar @ 2021-02-05 22:00 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Youghandhar Chintala, netdev, Brian Norris, linux-wireless, LKML,
	ath10k, Douglas Anderson, Rakesh Pillai, Jakub Kicinski,
	David S. Miller

> I'm not sure what you mean. But if you are saying that we should move
> ath10k_hw_params_list entirely to firmware then that is a huge task as
> we would need to make changes in every firmware branch, and there are so
> many different branches that I have lost count. And due to backwards
> compatibility we still need to have ath10k_hw_params_list in ath10k for
> few years.
>
 Apologies for late reply on this thread. Yes you got me right( to
move ath10k_hw_params_list entirely to firmware ). I wanted to trigger
an idea and know what other people's views are, or atleast what are
the challenges. As you said the task is much bigger with so many
firmware branches. As long as you feel it is scalable for coming
years, we should be good.

As far as the patch is concerned, it LGTM.

Reviewed-by: Abhishek Kumar <kuabhs@chromium.org>

Thanks
Abhishek

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

end of thread, other threads:[~2021-02-06  3:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 17:24 [PATCH 3/3] ath10k: Set wiphy flag to trigger sta disconnect on hardware restart Youghandhar Chintala
2020-12-22 22:36 ` Abhishek Kumar
2020-12-23 11:08   ` Kalle Valo
2021-02-05 22:00     ` Abhishek Kumar

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).