summaryrefslogtreecommitdiff
path: root/sys/net80211
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2008-12-14 10:17:25 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2008-12-14 10:17:25 +0000
commit1eb7ec748bcfcb151661c1861a9ad5c8a86c688f (patch)
tree3ad4fe4da1521b84e13de1d6ba7fc40c051670ff /sys/net80211
parent8a975d6a017601c4f8b4bed5da12a68d68b985a5 (diff)
Add an ieee80211_notify_dtim() function that drivers should call after
every DTIM in HostAP mode. Flushes all group addressed MSDUs buffered at the AP for power management.
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211_node.c33
-rw-r--r--sys/net80211/ieee80211_node.h3
2 files changed, 34 insertions, 2 deletions
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 0eb7cb3064a..5d10129c9b4 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.c,v 1.48 2008/10/23 16:21:21 mk Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.49 2008/12/14 10:17:24 damien Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
@@ -1568,6 +1568,37 @@ ieee80211_set_tim(struct ieee80211com *ic, int aid, int set)
else
clrbit(ic->ic_tim_bitmap, aid & ~0xc000);
}
+
+/*
+ * This function shall be called by drivers immediately after every DTIM.
+ * Transmit all group addressed MSDUs buffered at the AP.
+ */
+void
+ieee80211_notify_dtim(struct ieee80211com *ic)
+{
+ /* NB: group addressed MSDUs are buffered in ic_bss */
+ struct ieee80211_node *ni = ic->ic_bss;
+ struct ifnet *ifp = &ic->ic_if;
+ struct ieee80211_frame *wh;
+ struct mbuf *m;
+
+ KASSERT(ic->ic_opmode == IEEE80211_M_HOSTAP);
+
+ for (;;) {
+ IF_DEQUEUE(&ni->ni_savedq, m);
+ if (m == NULL)
+ break;
+ if (!IF_IS_EMPTY(&ni->ni_savedq)) {
+ /* more queued frames, set the more data bit */
+ wh = mtod(m, struct ieee80211_frame *);
+ wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA;
+ }
+ IF_ENQUEUE(&ic->ic_pwrsaveq, m);
+ (*ifp->if_start)(ifp);
+ }
+ /* XXX assumes everything has been sent */
+ ic->ic_tim_mcast_pending = 0;
+}
#endif /* IEEE80211_STA_ONLY */
/*
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
index cf4c9dca0d2..be2081e59c3 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.h,v 1.33 2008/09/27 15:16:09 damien Exp $ */
+/* $OpenBSD: ieee80211_node.h,v 1.34 2008/12/14 10:17:24 damien Exp $ */
/* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */
/*-
@@ -274,6 +274,7 @@ extern int ieee80211_match_bss(struct ieee80211com *,
struct ieee80211_node *);
extern void ieee80211_create_ibss(struct ieee80211com* ,
struct ieee80211_channel *);
+extern void ieee80211_notify_dtim(struct ieee80211com *);
extern int ieee80211_node_cmp(const struct ieee80211_node *,
const struct ieee80211_node *);