]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mac80211: don't check rates on PLCP error frames
authorJohannes Berg <johannes.berg@intel.com>
Fri, 30 Jul 2010 11:23:12 +0000 (13:23 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 16 Aug 2010 19:26:36 +0000 (15:26 -0400)
Frames that failed PLCP error checks are most likely
microwave transmissions (well, maybe not ...) and
don't have a proper rate detected, so ignore it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/rx.c

index fa0f37e4afe4901226b0ccd668ae6a88c136eeb2..225e8ee682e3dd8daf127f69b0cb3f6091b9abbd 100644 (file)
@@ -2615,28 +2615,37 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
        if (WARN_ON(!local->started))
                goto drop;
 
-       if (status->flag & RX_FLAG_HT) {
+       if (likely(!(status->flag & RX_FLAG_FAILED_PLCP_CRC))) {
                /*
-                * rate_idx is MCS index, which can be [0-76] as documented on:
-                *
-                * http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n
-                *
-                * Anything else would be some sort of driver or hardware error.
-                * The driver should catch hardware errors.
+                * Validate the rate, unless a PLCP error means that
+                * we probably can't have a valid rate here anyway.
                 */
-               if (WARN((status->rate_idx < 0 ||
-                        status->rate_idx > 76),
-                        "Rate marked as an HT rate but passed "
-                        "status->rate_idx is not "
-                        "an MCS index [0-76]: %d (0x%02x)\n",
-                        status->rate_idx,
-                        status->rate_idx))
-                       goto drop;
-       } else {
-               if (WARN_ON(status->rate_idx < 0 ||
-                           status->rate_idx >= sband->n_bitrates))
-                       goto drop;
-               rate = &sband->bitrates[status->rate_idx];
+
+               if (status->flag & RX_FLAG_HT) {
+                       /*
+                        * rate_idx is MCS index, which can be [0-76]
+                        * as documented on:
+                        *
+                        * http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n
+                        *
+                        * Anything else would be some sort of driver or
+                        * hardware error. The driver should catch hardware
+                        * errors.
+                        */
+                       if (WARN((status->rate_idx < 0 ||
+                                status->rate_idx > 76),
+                                "Rate marked as an HT rate but passed "
+                                "status->rate_idx is not "
+                                "an MCS index [0-76]: %d (0x%02x)\n",
+                                status->rate_idx,
+                                status->rate_idx))
+                               goto drop;
+               } else {
+                       if (WARN_ON(status->rate_idx < 0 ||
+                                   status->rate_idx >= sband->n_bitrates))
+                               goto drop;
+                       rate = &sband->bitrates[status->rate_idx];
+               }
        }
 
        /*