Bug 45591

Summary: ath9k filters out needed wifi frames
Product: Drivers Reporter: Thomas.Wagner
Component: network-wirelessAssignee: drivers_network-wireless (drivers_network-wireless)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, florian, linville, shafi.wireless
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.3.8 Tree: Mainline
Regression: No
Attachments: Solving the "droped frames problem" for ath9k
upstreamed fix for mesh related filtering issue

Description Thomas.Wagner 2012-08-04 16:30:21 UTC
On setting up a IEEE 802.11s mesh network with a Linksys WRT160NL Router (OpenWRT trunk) I could not comunicate because some certain wifi frame types where dropped by the ath9k driver and don't apper in the MAC80211 layer.
One of the dropped frame types contains the ARP request package which is nessaccary to comunicate on a mesh.

I do a workarround by letting ath_calcrxfilter()  (drivers/net/wireless/ath/ath9k/recv.c) always return 0xFFFFFFFF.
This deactivates frame filtering in the ath9k driver.

As I use OpenWRT I also reported this bug to dev.openwrt.org:
https://dev.openwrt.org/ticket/11972
This OpenWRT ticket has a OpenWRT specific patch file as attachment to solve the problem.
Comment 1 Thomas.Wagner 2012-08-04 16:59:28 UTC
By the way, I found some dead code touching the filter handling in ath9k.
See Line 20 on http://pastie.org/private/iar14wacykwu58f7ipq0q .
"changed_flags" is set but never used.
Comment 2 Thomas.Wagner 2012-08-06 14:48:34 UTC
Problem solved:

Instead of doing the workaround I modified ath9k/recv.c like this:

-               if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160)
+               if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160 ||
+                   sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9100)


From other people I know that they have the same issue with Atheros AR5416.
So perhaps it is better to pach like this:

-               if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160)
+               if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160      ||
+                   sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9100      ||
+                   sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE ||
+                   sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI)

I had this idea from: https://github.com/cozybit/open80211s/wiki/ath9kFilteringIssueFix

My mesh now orks like expected.
Comment 3 Thomas.Wagner 2012-08-06 14:50:24 UTC
Created attachment 76891 [details]
Solving the "droped frames problem" for ath9k
Comment 4 Alan 2012-09-06 15:51:59 UTC
You seem to have attached a text file of a link not the fix.

Also we don't take patches via bugzilla as we need them via email with a signed off by line to provide an audit trail. If you've not already submitted it then please email it to

linux-wireless@vger.kernel.org
Comment 5 shafi 2012-09-10 08:36:03 UTC
(In reply to comment #4)
> You seem to have attached a text file of a link not the fix.
> 
> Also we don't take patches via bugzilla as we need them via email with a
> signed
> off by line to provide an audit trail. If you've not already submitted it
> then
> please email it to
> 
> linux-wireless@vger.kernel.org

Alan,

I can properly send out a patch with the Thomas as author, after reviewing
it.
Comment 6 Thomas.Wagner 2012-09-12 09:16:48 UTC
@shafi:
Thank you very mutch.
Comment 7 shafi 2012-09-14 13:31:16 UTC
(In reply to comment #6)
> @shafi:
> Thank you very mutch.

Thomas having a check like this as the older h/w may need this stuff.

    if (sc->nvifs > 1 || (sc->rx.rxfilter & FIF_OTHER_BSS)) {
-               /* The following may also be needed for other older chips */
-               if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160)
+               /* This needed for other older chips especially for mesh mode */
+               if (sc->sc_ah->hw_version.macVersion <= AR_SREV_VERSION_9160)
                        rfilt |= ATH9K_RX_FILTER_PROM;
Comment 8 shafi 2012-09-14 14:53:47 UTC
Hi Thomas,

patch up-streamed signing off both of our names, attaching the patch
for your reference.
Comment 9 shafi 2012-09-14 14:55:09 UTC
Created attachment 80161 [details]
upstreamed fix for mesh related filtering issue
Comment 10 Thomas.Wagner 2012-09-14 19:04:00 UTC
> +            /* This needed for other older chips especially for mesh mode */
No, it is not Mesh related:
Several frames where filtered out.
I discovered this on trying to set up a mesh.
But the where filtered frames beyond  the mesh: e.g. a beacon of 802.11b Sitecom Router.

So patch it that way:
+               /* This needed for other older chips */
+               if (sc->sc_ah->hw_version.macVersion <= AR_SREV_VERSION_9160)
                        rfilt |= ATH9K_RX_FILTER_PROM;

This should work.
AR_SREV_VERSION_9160 = 0x40 is greater than
AR_SREV_VERSION_9100 (=0x14), AR_SREV_VERSION_5416_PCIE (=0xC) and AR_SREV_VERSION_5416_PCI (=0xD).
Comment 11 Florian Mickler 2012-10-15 20:45:21 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc1:

commit a549459c96ba99a691aa1cafeabdd327a7a2bfcf
Author: Thomas Wagner <Thomas.Wagner@hs-rm.de>
Date:   Tue Sep 25 21:32:55 2012 +0530

    ath9k: Fix rx filtering issue for older chips