Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aae89831 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

wireless: radiotap updates



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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 25420604
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line Diff line number Diff line
@@ -33,22 +33,12 @@ struct rx_radiotap_hdr {
	struct ieee80211_radiotap_header hdr;
	struct ieee80211_radiotap_header hdr;
	u8 flags;
	u8 flags;
	u8 rate;
	u8 rate;
	u16 chan_freq;
	u16 chan_flags;
	u8 antenna;
	u8 antsignal;
	u8 antsignal;
	u16 rx_flags;
#if 0
	u8 pad[IEEE80211_RADIOTAP_HDRLEN - 18];
#endif
} __attribute__ ((packed));
} __attribute__ ((packed));


#define RX_RADIOTAP_PRESENT (			\
#define RX_RADIOTAP_PRESENT (			\
	(1 << IEEE80211_RADIOTAP_FLAGS) |	\
	(1 << IEEE80211_RADIOTAP_FLAGS) |	\
	(1 << IEEE80211_RADIOTAP_RATE) |	\
	(1 << IEEE80211_RADIOTAP_RATE) |	\
	(1 << IEEE80211_RADIOTAP_CHANNEL) |	\
	(1 << IEEE80211_RADIOTAP_ANTENNA) |	\
	(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) |\
	(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) |\
	(1 << IEEE80211_RADIOTAP_RX_FLAGS) |	\
	0)
	0)
+2 −10
Original line number Original line Diff line number Diff line
@@ -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_pad = 0;
	radiotap_hdr.hdr.it_len = cpu_to_le16 (sizeof(struct rx_radiotap_hdr));
	radiotap_hdr.hdr.it_len = cpu_to_le16 (sizeof(struct rx_radiotap_hdr));
	radiotap_hdr.hdr.it_present = cpu_to_le32 (RX_RADIOTAP_PRESENT);
	radiotap_hdr.hdr.it_present = cpu_to_le32 (RX_RADIOTAP_PRESENT);
	/* unknown values */
	if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
	radiotap_hdr.flags = 0;
		radiotap_hdr.flags |= IEEE80211_RADIOTAP_F_BADFCS;
	radiotap_hdr.chan_freq = 0;
	radiotap_hdr.chan_flags = 0;
	radiotap_hdr.antenna = 0;
	/* known values */
	radiotap_hdr.rate = convert_mv_rate_to_radiotap(prxpd->rx_rate);
	radiotap_hdr.rate = convert_mv_rate_to_radiotap(prxpd->rx_rate);
	/* XXX must check no carryout */
	/* XXX must check no carryout */
	radiotap_hdr.antsignal = prxpd->snr + prxpd->nf;
	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 */
	/* chop the rxpd */
	skb_pull(skb, sizeof(struct rxpd));
	skb_pull(skb, sizeof(struct rxpd));
+3 −1
Original line number Original line Diff line number Diff line
@@ -230,8 +230,10 @@ enum ieee80211_radiotap_type {
						 * 802.11 header and payload
						 * 802.11 header and payload
						 * (to 32-bit boundary)
						 * (to 32-bit boundary)
						 */
						 */
#define IEEE80211_RADIOTAP_F_BADFCS	0x40	/* bad FCS */

/* For IEEE80211_RADIOTAP_RX_FLAGS */
/* 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 */
/* For IEEE80211_RADIOTAP_TX_FLAGS */
#define IEEE80211_RADIOTAP_F_TX_FAIL	0x0001	/* failed due to excessive
#define IEEE80211_RADIOTAP_F_TX_FAIL	0x0001	/* failed due to excessive
+4 −3
Original line number Original line Diff line number Diff line
@@ -142,6 +142,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
	/* IEEE80211_RADIOTAP_FLAGS */
	/* IEEE80211_RADIOTAP_FLAGS */
	if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
	if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
		*pos |= IEEE80211_RADIOTAP_F_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)
	if (status->flag & RX_FLAG_SHORTPRE)
		*pos |= IEEE80211_RADIOTAP_F_SHORTPRE;
		*pos |= IEEE80211_RADIOTAP_F_SHORTPRE;
	pos++;
	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 */
	/* ensure 2 byte alignment for the 2 byte field as required */
	if ((pos - (unsigned char *)rthdr) & 1)
	if ((pos - (unsigned char *)rthdr) & 1)
		pos++;
		pos++;
	/* FIXME: when radiotap gets a 'bad PLCP' flag use it here */
	if (status->flag & RX_FLAG_FAILED_PLCP_CRC)
	if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
		*(__le16 *)pos |= cpu_to_le16(IEEE80211_RADIOTAP_F_RX_BADPLCP);
		*(__le16 *)pos |= cpu_to_le16(IEEE80211_RADIOTAP_F_RX_BADFCS);
	pos += 2;
	pos += 2;
}
}