linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath10k: don't drop corrupted mgmt frames
@ 2014-11-24 14:34 Michal Kazior
  2014-11-25  9:04 ` Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michal Kazior @ 2014-11-24 14:34 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

Some firmware revisions don't seem to deilver
management frames with FCS error via WMI so narrow
down the HTT rule to not drop corrupted management
frames.

This basically increases number of frames ath10k
reports while sniffing.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 13 +++++++++++--
 drivers/net/wireless/ath/ath10k/wmi.c    |  7 +++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 75b2293..85910b2 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1381,6 +1381,8 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
 {
 	struct sk_buff *msdu;
 	struct htt_rx_desc *rxd;
+	bool is_mgmt;
+	bool has_fcs_err;
 
 	msdu = skb_peek(amsdu);
 	rxd = (void *)msdu->data - sizeof(*rxd);
@@ -1394,12 +1396,19 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
 		return false;
 	}
 
+	is_mgmt = !!(rxd->attention.flags &
+		     __cpu_to_le32(RX_ATTENTION_FLAGS_MGMT_TYPE));
+	has_fcs_err = !!(rxd->attention.flags &
+			 __cpu_to_le32(RX_ATTENTION_FLAGS_FCS_ERR));
+
 	/* Management frames are handled via WMI events. The pros of such
 	 * approach is that channel is explicitly provided in WMI events
 	 * whereas HTT doesn't provide channel information for Rxed frames.
+	 *
+	 * However some firmware revisions don't report corrupted frames via
+	 * WMI so don't drop them.
 	 */
-	if (rxd->attention.flags &
-	    __cpu_to_le32(RX_ATTENTION_FLAGS_MGMT_TYPE)) {
+	if (is_mgmt && !has_fcs_err) {
 		ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx mgmt ctrl\n");
 		return false;
 	}
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index c2bc828..df948a4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1166,8 +1166,11 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
 		return 0;
 	}
 
-	if (rx_status & WMI_RX_STATUS_ERR_CRC)
-		status->flag |= RX_FLAG_FAILED_FCS_CRC;
+	if (rx_status & WMI_RX_STATUS_ERR_CRC) {
+		dev_kfree_skb(skb);
+		return 0;
+	}
+
 	if (rx_status & WMI_RX_STATUS_ERR_MIC)
 		status->flag |= RX_FLAG_MMIC_ERROR;
 
-- 
1.8.5.3


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

* Re: [PATCH] ath10k: don't drop corrupted mgmt frames
  2014-11-24 14:34 [PATCH] ath10k: don't drop corrupted mgmt frames Michal Kazior
@ 2014-11-25  9:04 ` Kalle Valo
  2014-11-25  9:22   ` Michal Kazior
  2014-11-26  6:35 ` Kalle Valo
  2014-11-26  6:36 ` Kalle Valo
  2 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2014-11-25  9:04 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
> +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
> @@ -1381,6 +1381,8 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
>  {
>  	struct sk_buff *msdu;
>  	struct htt_rx_desc *rxd;
> +	bool is_mgmt;
> +	bool has_fcs_err;
>  
>  	msdu = skb_peek(amsdu);
>  	rxd = (void *)msdu->data - sizeof(*rxd);
> @@ -1394,12 +1396,19 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
>  		return false;
>  	}
>  
> +	is_mgmt = !!(rxd->attention.flags &
> +		     __cpu_to_le32(RX_ATTENTION_FLAGS_MGMT_TYPE));
> +	has_fcs_err = !!(rxd->attention.flags &
> +			 __cpu_to_le32(RX_ATTENTION_FLAGS_FCS_ERR));

I think I asked this before in some other patch, but isn't '!!' operator
useless here? is_mgmt is a boolean so the compiler should convert it
correctly without '!!' anyway, right?

-- 
Kalle Valo

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

* Re: [PATCH] ath10k: don't drop corrupted mgmt frames
  2014-11-25  9:04 ` Kalle Valo
@ 2014-11-25  9:22   ` Michal Kazior
  2014-11-25  9:24     ` Kalle Valo
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Kazior @ 2014-11-25  9:22 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath10k, linux-wireless

On 25 November 2014 at 10:04, Kalle Valo <kvalo@qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior@tieto.com> writes:
[...]
>> @@ -1394,12 +1396,19 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
>>               return false;
>>       }
>>
>> +     is_mgmt = !!(rxd->attention.flags &
>> +                  __cpu_to_le32(RX_ATTENTION_FLAGS_MGMT_TYPE));
>> +     has_fcs_err = !!(rxd->attention.flags &
>> +                      __cpu_to_le32(RX_ATTENTION_FLAGS_FCS_ERR));
>
> I think I asked this before in some other patch, but isn't '!!' operator
> useless here? is_mgmt is a boolean so the compiler should convert it
> correctly without '!!' anyway, right?

If I remove `!!` I get:

 warning: incorrect type in assignment (different base types)
    expected bool [unsigned] [usertype] is_mgmt
    got restricted __le32

I could do a temporary `u32 attention` to get rid of the `!!`. You
want me to update it?


Michał

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

* Re: [PATCH] ath10k: don't drop corrupted mgmt frames
  2014-11-25  9:22   ` Michal Kazior
@ 2014-11-25  9:24     ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2014-11-25  9:24 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> On 25 November 2014 at 10:04, Kalle Valo <kvalo@qca.qualcomm.com> wrote:
>> Michal Kazior <michal.kazior@tieto.com> writes:
> [...]
>>> @@ -1394,12 +1396,19 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
>>>               return false;
>>>       }
>>>
>>> +     is_mgmt = !!(rxd->attention.flags &
>>> +                  __cpu_to_le32(RX_ATTENTION_FLAGS_MGMT_TYPE));
>>> +     has_fcs_err = !!(rxd->attention.flags &
>>> +                      __cpu_to_le32(RX_ATTENTION_FLAGS_FCS_ERR));
>>
>> I think I asked this before in some other patch, but isn't '!!' operator
>> useless here? is_mgmt is a boolean so the compiler should convert it
>> correctly without '!!' anyway, right?
>
> If I remove `!!` I get:
>
>  warning: incorrect type in assignment (different base types)
>     expected bool [unsigned] [usertype] is_mgmt
>     got restricted __le32

Oh. Sorry, my bad.

> I could do a temporary `u32 attention` to get rid of the `!!`. You
> want me to update it?

Please don't, this is fine.

-- 
Kalle Valo

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

* Re: [PATCH] ath10k: don't drop corrupted mgmt frames
  2014-11-24 14:34 [PATCH] ath10k: don't drop corrupted mgmt frames Michal Kazior
  2014-11-25  9:04 ` Kalle Valo
@ 2014-11-26  6:35 ` Kalle Valo
  2014-11-26  6:36 ` Kalle Valo
  2 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2014-11-26  6:35 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> Some firmware revisions don't seem to deilver
> management frames with FCS error via WMI so narrow
> down the HTT rule to not drop corrupted management
> frames.
>
> This basically increases number of frames ath10k
> reports while sniffing.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

Thanks, applied.

-- 
Kalle Valo

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

* Re: [PATCH] ath10k: don't drop corrupted mgmt frames
  2014-11-24 14:34 [PATCH] ath10k: don't drop corrupted mgmt frames Michal Kazior
  2014-11-25  9:04 ` Kalle Valo
  2014-11-26  6:35 ` Kalle Valo
@ 2014-11-26  6:36 ` Kalle Valo
  2 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2014-11-26  6:36 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> Some firmware revisions don't seem to deilver
> management frames with FCS error via WMI so narrow
> down the HTT rule to not drop corrupted management
> frames.
>
> This basically increases number of frames ath10k
> reports while sniffing.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

Thanks, applied.

-- 
Kalle Valo

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

end of thread, other threads:[~2014-11-26  6:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-24 14:34 [PATCH] ath10k: don't drop corrupted mgmt frames Michal Kazior
2014-11-25  9:04 ` Kalle Valo
2014-11-25  9:22   ` Michal Kazior
2014-11-25  9:24     ` Kalle Valo
2014-11-26  6:35 ` Kalle Valo
2014-11-26  6:36 ` Kalle Valo

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