summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_node.c
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2007-07-03 20:25:34 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2007-07-03 20:25:34 +0000
commitcace2ba154790fd3de5869905b8de59f1e3f6d52 (patch)
treecf4671e5b6fb472c54e7cc98ed3991a108325398 /sys/net80211/ieee80211_node.c
parentf0ec217509a6f9cc784437cfcefa6844b07ad8e4 (diff)
maintain the traffic-indication (TIM) virtual bitmap by defining
a default ieee80211_set_tim() function that drivers can override by setting ic_set_tim.
Diffstat (limited to 'sys/net80211/ieee80211_node.c')
-rw-r--r--sys/net80211/ieee80211_node.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index de4ee19c471..d8ef5c76e30 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.c,v 1.25 2007/07/02 16:46:44 damien Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.26 2007/07/03 20:25:32 damien Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
@@ -81,6 +81,7 @@ struct ieee80211_node *ieee80211_alloc_node_helper(struct ieee80211com *);
void ieee80211_node_cleanup(struct ieee80211com *, struct ieee80211_node *);
void ieee80211_node_join_11g(struct ieee80211com *, struct ieee80211_node *);
void ieee80211_node_leave_11g(struct ieee80211com *, struct ieee80211_node *);
+void ieee80211_set_tim(struct ieee80211com *, int, int);
#define M_80211_NODE M_DEVBUF
@@ -118,8 +119,10 @@ ieee80211_node_attach(struct ifnet *ifp)
if (ic->ic_tim_bitmap == NULL) {
printf("%s: no memory for TIM bitmap!\n", __func__);
ic->ic_tim_len = 0;
- } else
+ } else {
memset(ic->ic_tim_bitmap, 0, ic->ic_tim_len);
+ ic->ic_set_tim = ieee80211_set_tim;
+ }
}
}
@@ -833,7 +836,7 @@ ieee80211_free_node(struct ieee80211com *ic, struct ieee80211_node *ni)
ic->ic_nnodes--;
if (!IF_IS_EMPTY(&ni->ni_savedq)) {
IF_PURGE(&ni->ni_savedq);
- if (ic->ic_set_tim)
+ if (ic->ic_set_tim != NULL)
(*ic->ic_set_tim)(ic, ni->ni_associd, 0);
}
if (RB_EMPTY(&ic->ic_tree))
@@ -1139,6 +1142,15 @@ ieee80211_node_leave(struct ieee80211com *ic, struct ieee80211_node *ni)
#endif
}
+void
+ieee80211_set_tim(struct ieee80211com *ic, int aid, int set)
+{
+ if (set)
+ setbit(ic->ic_tim_bitmap, aid & ~0xc000);
+ else
+ clrbit(ic->ic_tim_bitmap, aid & ~0xc000);
+}
+
/*
* Compare nodes in the tree by lladdr
*/