Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net80211 EDCA and QOS additions from OpenBSD
details: https://anonhg.NetBSD.org/src/rev/44785795995a
branches: trunk
changeset: 785780:44785795995a
user: christos <christos%NetBSD.org@localhost>
date: Sat Mar 30 01:05:48 2013 +0000
description:
EDCA and QOS additions from OpenBSD
diffstat:
sys/net80211/ieee80211.h | 73 +++++++++++++++++++++++++++++++++++++++++-
sys/net80211/ieee80211_proto.h | 5 +-
2 files changed, 75 insertions(+), 3 deletions(-)
diffs (131 lines):
diff -r 0f56d82131e9 -r 44785795995a sys/net80211/ieee80211.h
--- a/sys/net80211/ieee80211.h Fri Mar 29 22:51:04 2013 +0000
+++ b/sys/net80211/ieee80211.h Sat Mar 30 01:05:48 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211.h,v 1.22 2012/08/20 07:30:10 christos Exp $ */
+/* $NetBSD: ieee80211.h,v 1.23 2013/03/30 01:05:48 christos Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -149,6 +149,21 @@
#define IEEE80211_FC0_SUBTYPE_QOS 0x80
#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0
+/*
+ * DS bit usage
+ *
+ * TA = transmitter address
+ * RA = receiver address
+ * DA = destination address
+ * SA = source address
+ *
+ * ToDS FromDS A1(RA) A2(TA) A3 A4 Use
+ * -----------------------------------------------------------------
+ * 0 0 DA SA BSSID - IBSS/DLS
+ * 0 1 DA BSSID SA - AP -> STA
+ * 1 0 BSSID SA DA - AP <- STA
+ * 1 1 RA TA DA SA unspecified (WDS)
+ */
#define IEEE80211_FC1_DIR_MASK 0x03
#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
@@ -188,12 +203,24 @@
#define IEEE80211_QOS_TID 0x000f
/* does frame have QoS sequence control data */
+/* XXX: use ieee80211_has_qos() instead */
#define IEEE80211_QOS_HAS_SEQ(wh) \
(((wh)->i_fc[0] & \
(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
(IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
/*
+ * EDCA Access Categories.
+ */
+enum ieee80211_edca_ac {
+ EDCA_AC_BK = 1, /* Background */
+ EDCA_AC_BE = 0, /* Best Effort */
+ EDCA_AC_VI = 2, /* Video */
+ EDCA_AC_VO = 3 /* Voice */
+};
+#define EDCA_NUM_AC 4
+
+/*
* WME/802.11e information element.
*/
struct ieee80211_wme_info {
@@ -346,6 +373,50 @@
/* FCS */
} __packed;
+static __inline int
+ieee80211_has_seq(const struct ieee80211_frame *wh)
+{
+ return (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) !=
+ IEEE80211_FC0_TYPE_CTL;
+}
+
+static __inline int
+ieee80211_has_addr4(const struct ieee80211_frame *wh)
+{
+ return (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) ==
+ IEEE80211_FC1_DIR_DSTODS;
+}
+
+static __inline int
+ieee80211_has_qos(const struct ieee80211_frame *wh)
+{
+ return (wh->i_fc[0] &
+ (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) ==
+ (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS);
+}
+
+static __inline int
+ieee80211_has_htc(const struct ieee80211_frame *wh)
+{
+ return (wh->i_fc[1] & IEEE80211_FC1_ORDER) &&
+ (ieee80211_has_qos(wh) ||
+ (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
+ IEEE80211_FC0_TYPE_MGT);
+}
+
+static __inline u_int16_t
+ieee80211_get_qos(const struct ieee80211_frame *wh)
+{
+ const u_int8_t *frm;
+
+ if (ieee80211_has_addr4(wh))
+ frm = ((const struct ieee80211_qosframe_addr4 *)wh)->i_qos;
+ else
+ frm = ((const struct ieee80211_qosframe *)wh)->i_qos;
+
+ return le16toh(*(const u_int16_t *)frm);
+}
+
/*
* BEACON management packets
*
diff -r 0f56d82131e9 -r 44785795995a sys/net80211/ieee80211_proto.h
--- a/sys/net80211/ieee80211_proto.h Fri Mar 29 22:51:04 2013 +0000
+++ b/sys/net80211/ieee80211_proto.h Sat Mar 30 01:05:48 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_proto.h,v 1.19 2013/01/10 17:40:10 christos Exp $ */
+/* $NetBSD: ieee80211_proto.h,v 1.20 2013/03/30 01:05:48 christos Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -223,7 +223,7 @@
#define ieee80211_new_state(_ic, _nstate, _arg) \
(((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
-extern int ieee80211_compute_duration(const struct ieee80211_frame_min *,
+int ieee80211_compute_duration(const struct ieee80211_frame_min *,
const struct ieee80211_key *, int,
uint32_t, int, int, struct ieee80211_duration *,
struct ieee80211_duration *, int *, int);
@@ -263,4 +263,5 @@
void ieee80211_notify_node_leave(struct ieee80211com *,
struct ieee80211_node *);
void ieee80211_notify_scan_done(struct ieee80211com *);
+
#endif /* !_NET80211_IEEE80211_PROTO_H_ */
Home |
Main Index |
Thread Index |
Old Index