diff mbox

ath10k: Fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq

Message ID 1508284992-3574-1-git-send-email-greearb@candelatech.com (mailing list archive)
State Accepted
Commit cc6df017e55764ffef9819dd9554053182535ffd
Delegated to: Kalle Valo
Headers show

Commit Message

Ben Greear Oct. 18, 2017, 12:03 a.m. UTC
From: Ben Greear <greearb@candelatech.com>

This bug appears to have been added between 4.0 (which works for us),
and 4.4, which does not work.

I think this is because the tx-offchannel logic gets in a loop when
ath10k_mac_tx_frm_has_freq(ar) is false, so pkt is never actually
sent to the firmware for transmit.

This patch fixes the problem on 4.9 for me, and now HS20 clients
can work again with my firmware.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Comments

Antonio Quartulli Sept. 30, 2019, 2:29 p.m. UTC | #1
Hi,

On 18/10/2017 02:03, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> This bug appears to have been added between 4.0 (which works for us),
> and 4.4, which does not work.
> 
> I think this is because the tx-offchannel logic gets in a loop when
> ath10k_mac_tx_frm_has_freq(ar) is false, so pkt is never actually
> sent to the firmware for transmit.
> 
> This patch fixes the problem on 4.9 for me, and now HS20 clients
> can work again with my firmware.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>

I have been struggling to send offchannels mgmt frames since a while, as
I was always getting:

[18099.253732] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
skb cf0e3780
[18102.293686] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
skb cf0e3780
[18105.333653] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
skb cf0e3780
[18108.373712] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
skb cf0e3780
[18111.413687] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
skb cf0e36c0
[18114.453726] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
skb cf0e3f00
[18117.493773] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
skb cf0e36c0
[18120.533631] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
skb cf0e3f00

After digging through the ath10k patchwork I have found this patch which
touches exactly the code I was trying to debug.

After applying this set of changes, I can confirm that sending
offchannel frames works again like a charm.

I have tested only one fw though: ver 10.4-3.5.3-00057.

It's a bummer that this trivial but critical patch is not yet merged
upstream :-(


Tested-by: Antonio Quartulli <antonio.quartulli@kaiwoo.ai>
Kalle Valo Oct. 2, 2019, 6:05 a.m. UTC | #2
Antonio Quartulli <antonio.quartulli@kaiwoo.ai> writes:

> Hi,
>
> On 18/10/2017 02:03, greearb@candelatech.com wrote:
>> From: Ben Greear <greearb@candelatech.com>
>> 
>> This bug appears to have been added between 4.0 (which works for us),
>> and 4.4, which does not work.
>> 
>> I think this is because the tx-offchannel logic gets in a loop when
>> ath10k_mac_tx_frm_has_freq(ar) is false, so pkt is never actually
>> sent to the firmware for transmit.
>> 
>> This patch fixes the problem on 4.9 for me, and now HS20 clients
>> can work again with my firmware.
>> 
>> Signed-off-by: Ben Greear <greearb@candelatech.com>
>
> I have been struggling to send offchannels mgmt frames since a while, as
> I was always getting:
>
> [18099.253732] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
> skb cf0e3780
> [18102.293686] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
> skb cf0e3780
> [18105.333653] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
> skb cf0e3780
> [18108.373712] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
> skb cf0e3780
> [18111.413687] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
> skb cf0e36c0
> [18114.453726] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
> skb cf0e3f00
> [18117.493773] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
> skb cf0e36c0
> [18120.533631] ath10k_pci 0000:01:00.0: timed out waiting for offchannel
> skb cf0e3f00
>
> After digging through the ath10k patchwork I have found this patch which
> touches exactly the code I was trying to debug.
>
> After applying this set of changes, I can confirm that sending
> offchannel frames works again like a charm.
>
> I have tested only one fw though: ver 10.4-3.5.3-00057.
>
> It's a bummer that this trivial but critical patch is not yet merged
> upstream :-(

Ben has it's own firmware and own hacks in kernel so I can't apply them
without testing, and it's just very difficult for me to find time to
test anything right now.

> Tested-by: Antonio Quartulli <antonio.quartulli@kaiwoo.ai>

Thanks! What hardware did you test this? I'll add that to the commit
log.

The patch also had some conflicts which I fixed in the pending branch,
please check:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=bdc657dd0c0cb7163fcf39b94e664e3d9409140e
Antonio Quartulli Oct. 2, 2019, 6:55 a.m. UTC | #3
Hi,

On 02/10/2019 08:05, Kalle Valo wrote:
>> Tested-by: Antonio Quartulli <antonio.quartulli@kaiwoo.ai>
> 
> Thanks! What hardware did you test this? I'll add that to the commit
> log.
> 

It was tested on my AP equipped with and QCA4019 and QCA9888.

> The patch also had some conflicts which I fixed in the pending branch,
> please check:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=bdc657dd0c0cb7163fcf39b94e664e3d9409140e
> 

Looks good to me, thanks!

Regards,
Kalle Valo Oct. 2, 2019, 5:17 p.m. UTC | #4
greearb@candelatech.com wrote:

> Offchannel management frames were failing:
> 
> [18099.253732] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780
> [18102.293686] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780
> [18105.333653] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780
> [18108.373712] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780
> [18111.413687] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e36c0
> [18114.453726] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3f00
> [18117.493773] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e36c0
> [18120.533631] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3f00
> 
> This bug appears to have been added between 4.0 (which works for us),
> and 4.4, which does not work.
> 
> I think this is because the tx-offchannel logic gets in a loop when
> ath10k_mac_tx_frm_has_freq(ar) is false, so pkt is never actually
> sent to the firmware for transmit.
> 
> This patch fixes the problem on 4.9 for me, and now HS20 clients
> can work again with my firmware.
> 
> Antonio: tested with 10.4-3.5.3-00057 on QCA4019 and QCA9888
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> Tested-by: Antonio Quartulli <antonio.quartulli@kaiwoo.ai>
> [kvalo@codeaurora.org: improve commit log, remove unneeded parenthesis]
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

cc6df017e557 ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index c45ca04..f0a7864 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4101,7 +4101,7 @@  static int ath10k_mac_tx(struct ath10k *ar,
 			 struct ieee80211_sta *sta,
 			 enum ath10k_hw_txrx_mode txmode,
 			 enum ath10k_mac_tx_path txpath,
-			 struct sk_buff *skb)
+			 struct sk_buff *skb, bool noque_offchan)
 {
 	struct ieee80211_hw *hw = ar->hw;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -4134,10 +4134,10 @@  static int ath10k_mac_tx(struct ath10k *ar,
 		}
 	}
 
-	if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) {
+	if ((!noque_offchan) && info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) {
 		if (!ath10k_mac_tx_frm_has_freq(ar)) {
-			ath10k_dbg(ar, ATH10K_DBG_MAC, "queued offchannel skb %pK\n",
-				   skb);
+			ath10k_dbg(ar, ATH10K_DBG_MAC, "no-tx-frm-has-freq: queued offchannel skb %pK, len: %d\n",
+				   skb, skb->len);
 
 			skb_queue_tail(&ar->offchan_tx_queue, skb);
 			ieee80211_queue_work(hw, &ar->offchan_tx_work);
@@ -4198,8 +4198,8 @@  void ath10k_offchan_tx_work(struct work_struct *work)
 
 		mutex_lock(&ar->conf_mutex);
 
-		ath10k_dbg(ar, ATH10K_DBG_MAC, "mac offchannel skb %pK\n",
-			   skb);
+		ath10k_dbg(ar, ATH10K_DBG_MAC, "offchan-tx-work: mac offchannel skb %pK len: %d\n",
+			   skb, skb->len);
 
 		hdr = (struct ieee80211_hdr *)skb->data;
 		peer_addr = ieee80211_get_DA(hdr);
@@ -4245,7 +4245,7 @@  void ath10k_offchan_tx_work(struct work_struct *work)
 		txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
 		txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode);
 
-		ret = ath10k_mac_tx(ar, vif, sta, txmode, txpath, skb);
+		ret = ath10k_mac_tx(ar, vif, sta, txmode, txpath, skb, true);
 		if (ret) {
 			ath10k_warn(ar, "failed to transmit offchannel frame: %d\n",
 				    ret);
@@ -4255,8 +4255,8 @@  void ath10k_offchan_tx_work(struct work_struct *work)
 		time_left =
 		wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ);
 		if (time_left == 0)
-			ath10k_warn(ar, "timed out waiting for offchannel skb %pK\n",
-				    skb);
+			ath10k_warn(ar, "timed out waiting for offchannel skb %pK, len: %d\n",
+				    skb, skb->len);
 
 		if (!peer && tmp_peer_created) {
 			ret = ath10k_peer_delete(ar, vdev_id, peer_addr);
@@ -4513,7 +4513,7 @@  int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,
 		spin_unlock_bh(&ar->htt.tx_lock);
 	}
 
-	ret = ath10k_mac_tx(ar, vif, sta, txmode, txpath, skb);
+	ret = ath10k_mac_tx(ar, vif, sta, txmode, txpath, skb, false);
 	if (unlikely(ret)) {
 		ath10k_warn(ar, "failed to push frame: %d\n", ret);
 
@@ -4802,7 +4802,7 @@  static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
 		spin_unlock_bh(&ar->htt.tx_lock);
 	}
 
-	ret = ath10k_mac_tx(ar, vif, sta, txmode, txpath, skb);
+	ret = ath10k_mac_tx(ar, vif, sta, txmode, txpath, skb, false);
 	if (ret) {
 		ath10k_warn(ar, "failed to transmit frame: %d\n", ret);
 		if (is_htt) {