summaryrefslogtreecommitdiff
path: root/sys/net80211
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2007-06-11 19:35:25 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2007-06-11 19:35:25 +0000
commit41d2e9f6609b9ed9694e9d32045d810ee0cc84d5 (patch)
tree4be64884e2e1123d52becca0d57bdafd7f68db71 /sys/net80211
parentfddd256c8b9e279420cf0199bd8b49ca03b5bc70 (diff)
adds 802.11e EDCA tables for QAPs and non-AP QSTAs.
not used yet. ok jsg@ deraadt@
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211.h19
-rw-r--r--sys/net80211/ieee80211_output.c101
-rw-r--r--sys/net80211/ieee80211_var.h13
3 files changed, 124 insertions, 9 deletions
diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h
index 23c60912d6c..16c2a78a012 100644
--- a/sys/net80211/ieee80211.h
+++ b/sys/net80211/ieee80211.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211.h,v 1.13 2007/06/07 20:20:15 damien Exp $ */
+/* $OpenBSD: ieee80211.h,v 1.14 2007/06/11 19:35:24 damien Exp $ */
/* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */
/*-
@@ -448,6 +448,17 @@ enum {
#define IEEE80211_ERP_USE_PROTECTION 0x02
#define IEEE80211_ERP_BARKER_MODE 0x04
+/*
+ * 802.11e 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
+
/* Atheros private advanced capabilities info */
#define ATHEROS_CAP_TURBO_PRIME 0x01
#define ATHEROS_CAP_COMPRESSION 0x02
@@ -492,12 +503,6 @@ enum {
#define WME_OUI_TYPE 0x02
#define WME_OUI_VERSION 1
-/* WME stream classes */
-#define WME_AC_BE 0 /* best effort */
-#define WME_AC_BK 1 /* background */
-#define WME_AC_VI 2 /* video */
-#define WME_AC_VO 3 /* voice */
-
/*
* AUTH management packets
*
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index 32930e71753..d291e878cc7 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_output.c,v 1.25 2007/06/07 20:20:15 damien Exp $ */
+/* $OpenBSD: ieee80211_output.c,v 1.26 2007/06/11 19:35:24 damien Exp $ */
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
/*-
@@ -192,6 +192,105 @@ ieee80211_mgmt_output(struct ifnet *ifp, struct ieee80211_node *ni,
return 0;
}
+/*-
+ * EDCA tables are computed using the following formulas:
+ *
+ * 1) EDCATable (non-AP QSTA)
+ *
+ * AC CWmin CWmax AIFSN TXOP limit(ms)
+ * -------------------------------------------------------------
+ * AC_BK aCWmin aCWmax 7 0
+ * AC_BE aCWmin aCWmax 3 0
+ * AC_VI (aCWmin+1)/2-1 aCWmin 2 agn=3.008 b=6.016 others=0
+ * AC_VO (aCWmin+1)/4-1 (aCWmin+1)/2-1 2 agn=1.504 b=3.264 others=0
+ *
+ * 2) QAPEDCATable (QAP)
+ *
+ * AC CWmin CWmax AIFSN TXOP limit(ms)
+ * -------------------------------------------------------------
+ * AC_BK aCWmin aCWmax 7 0
+ * AC_BE aCWmin 4*(aCWmin+1)-1 3 0
+ * AC_VI (aCWmin+1)/2-1 aCWmin 1 agn=3.008 b=6.016 others=0
+ * AC_VO (aCWmin+1)/4-1 (aCWmin+1)/2-1 1 agn=1.504 b=3.264 others=0
+ *
+ * and the following aCWmin/aCWmax values:
+ *
+ * PHY aCWmin aCWmax
+ * ---------------------------
+ * 11A 15 1023
+ * 11B 31 1023
+ * 11G 15* 1023 (*) aCWmin(1)
+ * FH 15 1023
+ * Turbo A/G 7 1023 (Atheros proprietary mode)
+ */
+static const struct ieee80211_edca_ac_params
+ ieee80211_edca_table[IEEE80211_MODE_MAX][EDCA_NUM_AC] = {
+ [IEEE80211_MODE_FH] = {
+ [EDCA_AC_BK] = { 4, 10, 7, 0 },
+ [EDCA_AC_BE] = { 4, 10, 3, 0 },
+ [EDCA_AC_VI] = { 3, 4, 2, 0 },
+ [EDCA_AC_VO] = { 2, 3, 2, 0 }
+ },
+ [IEEE80211_MODE_11B] = {
+ [EDCA_AC_BK] = { 5, 10, 7, 0 },
+ [EDCA_AC_BE] = { 5, 10, 3, 0 },
+ [EDCA_AC_VI] = { 4, 5, 2, 188 },
+ [EDCA_AC_VO] = { 3, 4, 2, 102 }
+ },
+ [IEEE80211_MODE_11A] = {
+ [EDCA_AC_BK] = { 4, 10, 7, 0 },
+ [EDCA_AC_BE] = { 4, 10, 3, 0 },
+ [EDCA_AC_VI] = { 3, 4, 2, 94 },
+ [EDCA_AC_VO] = { 2, 3, 2, 47 }
+ },
+ [IEEE80211_MODE_11G] = {
+ [EDCA_AC_BK] = { 4, 10, 7, 0 },
+ [EDCA_AC_BE] = { 4, 10, 3, 0 },
+ [EDCA_AC_VI] = { 3, 4, 2, 94 },
+ [EDCA_AC_VO] = { 2, 3, 2, 47 }
+ },
+ [IEEE80211_MODE_TURBO] = {
+ [EDCA_AC_BK] = { 3, 10, 7, 0 },
+ [EDCA_AC_BE] = { 3, 10, 2, 0 },
+ [EDCA_AC_VI] = { 2, 3, 2, 94 },
+ [EDCA_AC_VO] = { 2, 2, 1, 47 }
+ }
+};
+
+static const struct ieee80211_edca_ac_params
+ ieee80211_qap_edca_table[IEEE80211_MODE_MAX][EDCA_NUM_AC] = {
+ [IEEE80211_MODE_FH] = {
+ [EDCA_AC_BK] = { 4, 10, 7, 0 },
+ [EDCA_AC_BE] = { 4, 6, 3, 0 },
+ [EDCA_AC_VI] = { 3, 4, 1, 0 },
+ [EDCA_AC_VO] = { 2, 3, 1, 0 }
+ },
+ [IEEE80211_MODE_11B] = {
+ [EDCA_AC_BK] = { 5, 10, 7, 0 },
+ [EDCA_AC_BE] = { 5, 7, 3, 0 },
+ [EDCA_AC_VI] = { 4, 5, 1, 188 },
+ [EDCA_AC_VO] = { 3, 4, 1, 102 }
+ },
+ [IEEE80211_MODE_11A] = {
+ [EDCA_AC_BK] = { 4, 10, 7, 0 },
+ [EDCA_AC_BE] = { 4, 6, 3, 0 },
+ [EDCA_AC_VI] = { 3, 4, 1, 94 },
+ [EDCA_AC_VO] = { 2, 3, 1, 47 }
+ },
+ [IEEE80211_MODE_11G] = {
+ [EDCA_AC_BK] = { 4, 10, 7, 0 },
+ [EDCA_AC_BE] = { 4, 6, 3, 0 },
+ [EDCA_AC_VI] = { 3, 4, 1, 94 },
+ [EDCA_AC_VO] = { 2, 3, 1, 47 }
+ },
+ [IEEE80211_MODE_TURBO] = {
+ [EDCA_AC_BK] = { 3, 10, 7, 0 },
+ [EDCA_AC_BE] = { 3, 5, 2, 0 },
+ [EDCA_AC_VI] = { 2, 3, 1, 94 },
+ [EDCA_AC_VO] = { 2, 2, 1, 47 }
+ }
+};
+
/*
* Encapsulate an outbound data frame. The mbuf chain is updated and
* a reference to the destination node is returned. If an error is
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index 5ff921b67aa..2b3937d1dda 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_var.h,v 1.20 2007/06/07 20:24:42 damien Exp $ */
+/* $OpenBSD: ieee80211_var.h,v 1.21 2007/06/11 19:35:24 damien Exp $ */
/* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */
/*-
@@ -130,6 +130,17 @@ struct ieee80211_channel {
#define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1)
#define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD)
+/*
+ * 802.11e EDCA AC parameters.
+ */
+struct ieee80211_edca_ac_params {
+ u_int8_t ecwmin; /* CWmin = 2^ECWmin - 1 */
+ u_int8_t ecwmax; /* CWmax = 2^ECWmax - 1 */
+ u_int8_t aifsn;
+ u_int16_t txoplimit; /* 32TU */
+#define IEEE80211_TXOP_TO_US(txop) ((txop) * 32)
+};
+
#define IEEE80211_PS_SLEEP 0x1 /* STA is in power saving mode */
#define IEEE80211_PS_MAX_QUEUE 50 /* maximum saved packets */