summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211.h
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-03-18 19:28:17 +0000
committersam <sam@FreeBSD.org>2009-03-18 19:28:17 +0000
commit8bfd160665d6b36b087de434348dc376113ec6a6 (patch)
tree8452969c7e6a5966840de839c95bbc46ce5c5321 /sys/net80211/ieee80211.h
parent9f91fe4f6bb519a3c35b1c93fd0afdddd7817f59 (diff)
downloadFreeBSD-src-8bfd160665d6b36b087de434348dc376113ec6a6.zip
FreeBSD-src-8bfd160665d6b36b087de434348dc376113ec6a6.tar.gz
Minor cleanups of tdma protocol handling:
o break out version-related code to simplify rev'ing the protocol o add parameter validation macros so checks that appear multiple places are consistent (and easy to change) o add protocol version check when looking for a scan candidate o improve scan debug output format o rewrite beacon update handling to calculate a bitmask of changed values and pass that down through the driver callback so drivers can optimize work o do slot bounds check before use when parsing received beacons
Diffstat (limited to 'sys/net80211/ieee80211.h')
-rw-r--r--sys/net80211/ieee80211.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h
index fb63507..9b8079f 100644
--- a/sys/net80211/ieee80211.h
+++ b/sys/net80211/ieee80211.h
@@ -1077,15 +1077,27 @@ struct ieee80211_duration {
#define ATH_FF_SNAP_ORGCODE_1 0x03
#define ATH_FF_SNAP_ORGCODE_2 0x7f
+/* NB: Atheros allocated the OUI for this purpose ~2005 but beware ... */
+#define TDMA_OUI ATH_OUI
+#define TDMA_OUI_TYPE 0x02
+#define TDMA_VERSION_V2 2
+#define TDMA_VERSION TDMA_VERSION_V2
+
+/* NB: we only support 2 right now but protocol handles up to 8 */
+#define TDMA_MAXSLOTS 2 /* max slots/sta's */
+
+#define TDMA_PARAM_LEN_V2 sizeof(struct ieee80211_tdma_param)
+
struct ieee80211_tdma_param {
u_int8_t tdma_id; /* IEEE80211_ELEMID_VENDOR */
u_int8_t tdma_len;
u_int8_t tdma_oui[3]; /* 0x00, 0x03, 0x7f */
u_int8_t tdma_type; /* OUI type */
u_int8_t tdma_subtype; /* OUI subtype */
+#define TDMA_SUBTYPE_PARAM 0x01
u_int8_t tdma_version; /* spec revision */
- u_int8_t tdma_slot; /* station slot # */
- u_int8_t tdma_slotcnt; /* bss slot count */
+ u_int8_t tdma_slot; /* station slot # [0..7] */
+ u_int8_t tdma_slotcnt; /* bss slot count [1..8] */
u_int16_t tdma_slotlen; /* bss slot len (100us) */
u_int8_t tdma_bintval; /* beacon interval (superframes) */
u_int8_t tdma_inuse[1]; /* slot occupancy map */
@@ -1093,10 +1105,14 @@ struct ieee80211_tdma_param {
u_int8_t tdma_tstamp[8]; /* timestamp from last beacon */
} __packed;
-/* NB: Atheros allocated the OUI for this purpose ~3 years ago but beware ... */
-#define TDMA_OUI ATH_OUI
-#define TDMA_OUI_TYPE 0x02
-#define TDMA_SUBTYPE_PARAM 0x01
-#define TDMA_VERSION 2
+#define TDMA_VERSION_VALID(_version) \
+ (TDMA_VERSION_V2 <= (_version) && (_version) <= TDMA_VERSION)
+#define TDMA_SLOTCNT_VALID(_slotcnt) \
+ (2 <= (_slotcnt) && (_slotcnt) <= TDMA_MAXSLOTS)
+/* XXX magic constants */
+#define TDMA_SLOTLEN_VALID(_slotlen) \
+ (2*100 <= (_slotlen) && (unsigned)(_slotlen) <= 0xfffff)
+/* XXX probably should set a max */
+#define TDMA_BINTVAL_VALID(_bintval) (1 <= (_bintval))
#endif /* _NET80211_IEEE80211_H_ */
OpenPOWER on IntegriCloud