From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Subject: [RFC 1/2] mac80211: allow drivers to indicate failed FCS/PLCP checksum
Date: Wed, 15 Aug 2007 17:25:58 +0200 [thread overview]
Message-ID: <20070815152657.809571000@sipsolutions.net> (raw)
In-Reply-To: 20070815152557.221351000@sipsolutions.net
This patch allows drivers to indicate bad FCS/PLCP CRC to the stack and
have the stack drop packets like that except for monitor interfaces.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
include/net/mac80211.h | 2 ++
net/mac80211/rx.c | 21 ++++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
--- wireless-dev.orig/include/net/mac80211.h 2007-08-15 15:26:31.346516958 +0200
+++ wireless-dev/include/net/mac80211.h 2007-08-15 15:27:03.766516958 +0200
@@ -241,6 +241,8 @@ struct ieee80211_rx_status {
#define RX_FLAG_MMIC_ERROR (1<<0)
#define RX_FLAG_DECRYPTED (1<<1)
#define RX_FLAG_RADIOTAP (1<<2)
+#define RX_FLAG_FAILED_FCS_CRC (1<<3)
+#define RX_FLAG_FAILED_PLCP_CRC (1<<4)
int flag;
};
--- wireless-dev.orig/net/mac80211/rx.c 2007-08-15 15:26:31.426516958 +0200
+++ wireless-dev/net/mac80211/rx.c 2007-08-15 15:27:03.766516958 +0200
@@ -154,6 +154,7 @@ ieee80211_rx_monitor(struct net_device *
__le16 chan_freq;
__le16 chan_flags;
u8 antsignal;
+ __le16 rx_flags;
} __attribute__ ((packed)) *rthdr;
skb->dev = dev;
@@ -178,12 +179,21 @@ ieee80211_rx_monitor(struct net_device *
cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_RATE) |
(1 << IEEE80211_RADIOTAP_CHANNEL) |
- (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL));
+ (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_RX_FLAGS));
rthdr->flags = local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS ?
IEEE80211_RADIOTAP_F_FCS : 0;
+
+ /* FIXME: when radiotap gets a 'bad PLCP' flag use it here */
+ rthdr->rx_flags = 0;
+ if (status->flag &
+ (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
+ rthdr->rx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_RX_BADFCS);
+
rate = ieee80211_get_rate(local, status->phymode, status->rate);
if (rate)
rthdr->rate = rate->rate / 5;
+
rthdr->chan_freq = cpu_to_le16(status->freq);
rthdr->chan_flags =
status->phymode == MODE_IEEE80211A ?
@@ -211,6 +221,15 @@ ieee80211_rx_h_monitor(struct ieee80211_
return TXRX_QUEUED;
}
+ /*
+ * Drop frames with failed FCS/PLCP checksums here, they are only
+ * relevant for monitor mode, the rest of the stack should never
+ * see them.
+ */
+ if (rx->u.rx.status->flag &
+ (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
+ return TXRX_DROP;
+
if (rx->u.rx.status->flag & RX_FLAG_RADIOTAP)
skb_pull(rx->skb, ieee80211_get_radiotap_len(rx->skb->data));
--
next prev parent reply other threads:[~2007-08-15 15:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-15 15:25 [RFC 0/2] device configuration changes Johannes Berg
2007-08-15 15:25 ` Johannes Berg [this message]
2007-08-16 14:53 ` [RFC 1/2 v2] mac80211: allow drivers to indicate failed FCS/PLCP checksum Johannes Berg
2007-08-15 15:25 ` [RFC 2/2] mac80211: revamp interface and filter configuration Johannes Berg
2007-08-16 12:41 ` Johannes Berg
2007-08-16 14:50 ` [RFC 2/2 v2] " Johannes Berg
2007-08-16 14:58 ` Johannes Berg
2007-08-16 17:10 ` Michael Buesch
-- strict thread matches above, loose matches on Subject: below --
2007-08-21 16:18 [RFC 0/2] the filter stuff again Johannes Berg
2007-08-21 16:18 ` [RFC 1/2] mac80211: allow drivers to indicate failed FCS/PLCP checksum Johannes Berg
2007-08-21 21:07 ` Ivo van Doorn
2007-08-22 9:22 ` Johannes Berg
2007-08-22 19:11 ` Ivo van Doorn
2007-08-23 14:13 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070815152657.809571000@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).