From: Zhu Yi <yi.zhu@intel.com>
To: linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>,
Johannes Berg <johannes@sipsolutions.net>
Subject: [PATCH 2/6] mac80211: Fix TSINFO macros endian issue
Date: Mon, 11 Jun 2007 17:00:04 +0800 [thread overview]
Message-ID: <20070611090004.GA5558@mail.intel.com> (raw)
The short1 defined in struct ieee80211_ts_info causes wrong values on big
endian systems. Fix this by replacing short with 2 bytes.
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
include/linux/ieee80211.h | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 31368bc..27ecac9 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -124,28 +124,34 @@ struct ieee80211_ht_additional_info {
}__attribute__ ((packed));
-#define IEEE80211_TSINFO_TYPE(a) ((a.short1 & 0x0001) >> 0)
-#define IEEE80211_TSINFO_TSID(a) ((a.short1 & 0x001E) >> 1)
-#define IEEE80211_TSINFO_DIR(a) ((a.short1 & 0x0060) >> 5)
-#define IEEE80211_TSINFO_POLICY(a) ((a.short1 & 0x0180) >> 7)
-#define IEEE80211_TSINFO_AGG(a) ((a.short1 & 0x0200) >> 9)
-#define IEEE80211_TSINFO_APSD(a) ((a.short1 & 0x0400) >> 10)
-#define IEEE80211_TSINFO_UP(a) ((a.short1 & 0x3800) >> 11)
-#define IEEE80211_TSINFO_ACK(a) ((a.short1 & 0xC000) >> 14)
+#define IEEE80211_TSINFO_TYPE(a) ((a.byte1 & 0x01) >> 0)
+#define IEEE80211_TSINFO_TSID(a) ((a.byte1 & 0x1E) >> 1)
+#define IEEE80211_TSINFO_DIR(a) ((a.byte1 & 0x60) >> 5)
+#define IEEE80211_TSINFO_POLICY(a) ((a.byte1 & 0x80) >> 7 + \
+ (a.byte2 & 0x01) << 1)
+#define IEEE80211_TSINFO_AGG(a) ((a.byte2 & 0x02) >> 1)
+#define IEEE80211_TSINFO_APSD(a) ((a.byte2 & 0x04) >> 2)
+#define IEEE80211_TSINFO_UP(a) ((a.byte2 & 0x38) >> 3)
+#define IEEE80211_TSINFO_ACK(a) ((a.byte2 & 0xC0) >> 6)
#define IEEE80211_TSINFO_SCHEDULE(a) ((a.byte3 & 0x01) >> 0)
-#define IEEE80211_SET_TSINFO_TYPE(i, d) (i.short1 |= (d << 0) & 0x0001)
-#define IEEE80211_SET_TSINFO_TSID(i, d) (i.short1 |= (d << 1) & 0x001E)
-#define IEEE80211_SET_TSINFO_DIR(i, d) (i.short1 |= (d << 5) & 0x0060)
-#define IEEE80211_SET_TSINFO_POLICY(i, d) (i.short1 |= (d << 7) & 0x0180)
-#define IEEE80211_SET_TSINFO_AGG(i, d) (i.short1 |= (d << 9) & 0x0200)
-#define IEEE80211_SET_TSINFO_APSD(i, d) (i.short1 |= (d << 10) & 0x0400)
-#define IEEE80211_SET_TSINFO_UP(i, d) (i.short1 |= (d << 11) & 0x3800)
-#define IEEE80211_SET_TSINFO_ACK(i, d) (i.short1 |= (d << 14) & 0xC000)
+#define IEEE80211_SET_TSINFO_TYPE(i, d) (i.byte1 |= (d << 0) & 0x01)
+#define IEEE80211_SET_TSINFO_TSID(i, d) (i.byte1 |= (d << 1) & 0x1E)
+#define IEEE80211_SET_TSINFO_DIR(i, d) (i.byte1 |= (d << 5) & 0x60)
+#define IEEE80211_SET_TSINFO_POLICY(i, d) \
+do { \
+ i.byte1 |= (d & 0x01) << 7; \
+ i.byte2 |= (d & 0x02) >> 1; \
+} while(0)
+#define IEEE80211_SET_TSINFO_AGG(i, d) (i.byte2 |= (d << 1) & 0x02)
+#define IEEE80211_SET_TSINFO_APSD(i, d) (i.byte2 |= (d << 2) & 0x04)
+#define IEEE80211_SET_TSINFO_UP(i, d) (i.byte2 |= (d << 3) & 0x38)
+#define IEEE80211_SET_TSINFO_ACK(i, d) (i.byte2 |= (d << 6) & 0xC0)
#define IEEE80211_SET_TSINFO_SCHEDULE(i, d) (i.byte3 |= (d << 0) & 0x01)
struct ieee80211_ts_info {
- __le16 short1;
+ u8 byte1;
+ u8 byte2;
u8 byte3;
} __attribute__ ((packed));
--
1.5.0.rc2.g73a2
reply other threads:[~2007-06-11 9:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20070611090004.GA5558@mail.intel.com \
--to=yi.zhu@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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).