wireless: radiotap updates
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 13 Mar 2009 11:52:10 +0000 (12:52 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Sat, 28 Mar 2009 00:12:52 +0000 (20:12 -0400)
Radiotap was updated to include a "bad PLCP" flag and standardise
the "bad FCS" flag in the "flags" rather than "RX flags" field,
this patch updates Linux to that standard.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/radiotap.h
drivers/net/wireless/libertas/rx.c
include/net/ieee80211_radiotap.h
net/mac80211/rx.c

index f8eb9097ff0a013b06aa61d76033c622488f6a1b..d16b26416e82097f8ba4cd4464eb9f4a7fd81145 100644 (file)
@@ -33,22 +33,12 @@ struct rx_radiotap_hdr {
        struct ieee80211_radiotap_header hdr;
        u8 flags;
        u8 rate;
-       u16 chan_freq;
-       u16 chan_flags;
-       u8 antenna;
        u8 antsignal;
-       u16 rx_flags;
-#if 0
-       u8 pad[IEEE80211_RADIOTAP_HDRLEN - 18];
-#endif
 } __attribute__ ((packed));
 
 #define RX_RADIOTAP_PRESENT (                  \
        (1 << IEEE80211_RADIOTAP_FLAGS) |       \
        (1 << IEEE80211_RADIOTAP_RATE) |        \
-       (1 << IEEE80211_RADIOTAP_CHANNEL) |     \
-       (1 << IEEE80211_RADIOTAP_ANTENNA) |     \
        (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) |\
-       (1 << IEEE80211_RADIOTAP_RX_FLAGS) |    \
        0)
 
index 4f60948dde9c65d5051ea86b70aefb0da024b7e5..63d7e19ce9bd46f6753c15d7bafc2f2b6b48abe4 100644 (file)
@@ -351,19 +351,11 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
        radiotap_hdr.hdr.it_pad = 0;
        radiotap_hdr.hdr.it_len = cpu_to_le16 (sizeof(struct rx_radiotap_hdr));
        radiotap_hdr.hdr.it_present = cpu_to_le32 (RX_RADIOTAP_PRESENT);
-       /* unknown values */
-       radiotap_hdr.flags = 0;
-       radiotap_hdr.chan_freq = 0;
-       radiotap_hdr.chan_flags = 0;
-       radiotap_hdr.antenna = 0;
-       /* known values */
+       if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
+               radiotap_hdr.flags |= IEEE80211_RADIOTAP_F_BADFCS;
        radiotap_hdr.rate = convert_mv_rate_to_radiotap(prxpd->rx_rate);
        /* XXX must check no carryout */
        radiotap_hdr.antsignal = prxpd->snr + prxpd->nf;
-       radiotap_hdr.rx_flags = 0;
-       if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
-               radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS;
-       //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18);
 
        /* chop the rxpd */
        skb_pull(skb, sizeof(struct rxpd));
index 384698cb773a81b2667a4e7dea8c2c8e763de4d5..23c3f3d97779e8682943b2ac3321c39bce8ff5a0 100644 (file)
@@ -230,8 +230,10 @@ enum ieee80211_radiotap_type {
                                                 * 802.11 header and payload
                                                 * (to 32-bit boundary)
                                                 */
+#define IEEE80211_RADIOTAP_F_BADFCS    0x40    /* bad FCS */
+
 /* For IEEE80211_RADIOTAP_RX_FLAGS */
-#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001  /* frame failed crc check */
+#define IEEE80211_RADIOTAP_F_RX_BADPLCP        0x0002  /* frame has bad PLCP */
 
 /* For IEEE80211_RADIOTAP_TX_FLAGS */
 #define IEEE80211_RADIOTAP_F_TX_FAIL   0x0001  /* failed due to excessive
index 66f7ecf51b924078a8ea52e6f88e85c3ff1f07d4..fcc0a5995791756e0507365b199628e779671e72 100644 (file)
@@ -142,6 +142,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
        /* IEEE80211_RADIOTAP_FLAGS */
        if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
                *pos |= IEEE80211_RADIOTAP_F_FCS;
+       if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
+               *pos |= IEEE80211_RADIOTAP_F_BADFCS;
        if (status->flag & RX_FLAG_SHORTPRE)
                *pos |= IEEE80211_RADIOTAP_F_SHORTPRE;
        pos++;
@@ -204,9 +206,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
        /* ensure 2 byte alignment for the 2 byte field as required */
        if ((pos - (unsigned char *)rthdr) & 1)
                pos++;
-       /* FIXME: when radiotap gets a 'bad PLCP' flag use it here */
-       if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
-               *(__le16 *)pos |= cpu_to_le16(IEEE80211_RADIOTAP_F_RX_BADFCS);
+       if (status->flag & RX_FLAG_FAILED_PLCP_CRC)
+               *(__le16 *)pos |= cpu_to_le16(IEEE80211_RADIOTAP_F_RX_BADPLCP);
        pos += 2;
 }