summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2016-09-15 03:32:48 +0000
committerdlg <dlg@openbsd.org>2016-09-15 03:32:48 +0000
commit8529d8f0154210a31b3839d3d204a93779db2719 (patch)
tree602f3ccdb2cce9a75ca49f39b640f946e7662e6a
parentall pools have their ipl set via pool_setipl, so fold it into pool_init. (diff)
downloadwireguard-openbsd-8529d8f0154210a31b3839d3d204a93779db2719.tar.xz
wireguard-openbsd-8529d8f0154210a31b3839d3d204a93779db2719.zip
move from RB macros to the RBT functions.
shaves about 5k off an amd64 GENERIC.MP kernel
-rw-r--r--sys/net80211/ieee80211_ioctl.c6
-rw-r--r--sys/net80211/ieee80211_node.c40
-rw-r--r--sys/net80211/ieee80211_node.h8
-rw-r--r--sys/net80211/ieee80211_proto.c6
4 files changed, 30 insertions, 30 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 34b23d3f455..96ee7b6eb15 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.43 2016/08/31 13:33:52 stsp Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.44 2016/09/15 03:32:48 dlg Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -754,7 +754,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCG80211ALLNODES:
na = (struct ieee80211_nodereq_all *)data;
na->na_nodes = i = 0;
- ni = RB_MIN(ieee80211_tree, &ic->ic_tree);
+ ni = RBT_MIN(ieee80211_tree, &ic->ic_tree);
while (ni && na->na_size >=
i + sizeof(struct ieee80211_nodereq)) {
ieee80211_node2req(ic, ni, &nrbuf);
@@ -764,7 +764,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
i += sizeof(struct ieee80211_nodereq);
na->na_nodes++;
- ni = RB_NEXT(ieee80211_tree, &ic->ic_tree, ni);
+ ni = RBT_NEXT(ieee80211_tree, ni);
}
break;
case SIOCG80211FLAGS:
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 03094b8586e..c5fc227a745 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.c,v 1.104 2016/08/17 09:42:03 stsp Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.105 2016/09/15 03:32:48 dlg Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
@@ -92,9 +92,9 @@ ieee80211_inact_timeout(void *arg)
int s;
s = splnet();
- for (ni = RB_MIN(ieee80211_tree, &ic->ic_tree);
+ for (ni = RBT_MIN(ieee80211_tree, &ic->ic_tree);
ni != NULL; ni = next_ni) {
- next_ni = RB_NEXT(ieee80211_tree, &ic->ic_tree, ni);
+ next_ni = RBT_NEXT(ieee80211_tree, ni);
if (ni->ni_refcnt > 0)
continue;
if (ni->ni_inact < IEEE80211_INACT_MAX)
@@ -123,7 +123,7 @@ ieee80211_node_attach(struct ifnet *ifp)
int size;
#endif
- RB_INIT(&ic->ic_tree);
+ RBT_INIT(ieee80211_tree, &ic->ic_tree);
ic->ic_node_alloc = ieee80211_node_alloc;
ic->ic_node_free = ieee80211_node_free;
ic->ic_node_copy = ieee80211_node_copy;
@@ -538,7 +538,7 @@ ieee80211_end_scan(struct ifnet *ifp)
if (ic->ic_scan_count)
ic->ic_flags &= ~IEEE80211_F_ASCAN;
- ni = RB_MIN(ieee80211_tree, &ic->ic_tree);
+ ni = RBT_MIN(ieee80211_tree, &ic->ic_tree);
#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
@@ -554,7 +554,7 @@ ieee80211_end_scan(struct ifnet *ifp)
* channel from the active set.
*/
memset(occupied, 0, sizeof(occupied));
- RB_FOREACH(ni, ieee80211_tree, &ic->ic_tree)
+ RBT_FOREACH(ni, ieee80211_tree, &ic->ic_tree)
setbit(occupied, ieee80211_chan2ieee(ic, ni->ni_chan));
for (i = 0; i < IEEE80211_CHAN_MAX; i++)
if (isset(ic->ic_chan_active, i) && isclr(occupied, i))
@@ -611,7 +611,7 @@ ieee80211_end_scan(struct ifnet *ifp)
selbs = NULL;
for (; ni != NULL; ni = nextbs) {
- nextbs = RB_NEXT(ieee80211_tree, &ic->ic_tree, ni);
+ nextbs = RBT_NEXT(ieee80211_tree, ni);
if (ni->ni_fails) {
/*
* The configuration of the access points may change
@@ -807,7 +807,7 @@ ieee80211_setup_node(struct ieee80211com *ic,
timeout_set(&ni->ni_sa_query_to, ieee80211_sa_query_timeout, ni);
#endif
s = splnet();
- RB_INSERT(ieee80211_tree, &ic->ic_tree, ni);
+ RBT_INSERT(ieee80211_tree, &ic->ic_tree, ni);
ic->ic_nnodes++;
splx(s);
}
@@ -845,14 +845,14 @@ ieee80211_find_node(struct ieee80211com *ic, const u_int8_t *macaddr)
struct ieee80211_node *ni;
int cmp;
- /* similar to RB_FIND except we compare keys, not nodes */
- ni = RB_ROOT(&ic->ic_tree);
+ /* similar to RBT_FIND except we compare keys, not nodes */
+ ni = RBT_ROOT(ieee80211_tree, &ic->ic_tree);
while (ni != NULL) {
cmp = memcmp(macaddr, ni->ni_macaddr, IEEE80211_ADDR_LEN);
if (cmp < 0)
- ni = RB_LEFT(ni, ni_node);
+ ni = RBT_LEFT(ieee80211_tree, ni);
else if (cmp > 0)
- ni = RB_RIGHT(ni, ni_node);
+ ni = RBT_RIGHT(ieee80211_tree, ni);
else
break;
}
@@ -1112,7 +1112,7 @@ ieee80211_free_node(struct ieee80211com *ic, struct ieee80211_node *ni)
IEEE80211_AID_CLR(ni->ni_associd, ic->ic_aid_bitmap);
#endif
ieee80211_ba_del(ni);
- RB_REMOVE(ieee80211_tree, &ic->ic_tree, ni);
+ RBT_REMOVE(ieee80211_tree, &ic->ic_tree, ni);
ic->ic_nnodes--;
#ifndef IEEE80211_STA_ONLY
if (mq_purge(&ni->ni_savedq) > 0) {
@@ -1147,7 +1147,7 @@ ieee80211_free_allnodes(struct ieee80211com *ic)
DPRINTF(("freeing all nodes\n"));
s = splnet();
- while ((ni = RB_MIN(ieee80211_tree, &ic->ic_tree)) != NULL)
+ while ((ni = RBT_MIN(ieee80211_tree, &ic->ic_tree)) != NULL)
ieee80211_free_node(ic, ni);
splx(s);
@@ -1162,9 +1162,9 @@ ieee80211_clean_cached(struct ieee80211com *ic)
int s;
s = splnet();
- for (ni = RB_MIN(ieee80211_tree, &ic->ic_tree);
+ for (ni = RBT_MIN(ieee80211_tree, &ic->ic_tree);
ni != NULL; ni = next_ni) {
- next_ni = RB_NEXT(ieee80211_tree, &ic->ic_tree, ni);
+ next_ni = RBT_NEXT(ieee80211_tree, ni);
if (ni->ni_state == IEEE80211_STA_CACHE)
ieee80211_free_node(ic, ni);
}
@@ -1195,9 +1195,9 @@ ieee80211_clean_nodes(struct ieee80211com *ic, int cache_timeout)
#endif
s = splnet();
- for (ni = RB_MIN(ieee80211_tree, &ic->ic_tree);
+ for (ni = RBT_MIN(ieee80211_tree, &ic->ic_tree);
ni != NULL; ni = next_ni) {
- next_ni = RB_NEXT(ieee80211_tree, &ic->ic_tree, ni);
+ next_ni = RBT_NEXT(ieee80211_tree, ni);
if (!cache_timeout && ic->ic_nnodes < ic->ic_max_nnodes)
break;
if (ni->ni_scangen == gen) /* previously handled */
@@ -1282,7 +1282,7 @@ ieee80211_iterate_nodes(struct ieee80211com *ic, ieee80211_iter_func *f,
int s;
s = splnet();
- RB_FOREACH(ni, ieee80211_tree, &ic->ic_tree)
+ RBT_FOREACH(ni, ieee80211_tree, &ic->ic_tree)
(*f)(arg, ni);
splx(s);
}
@@ -1877,4 +1877,4 @@ ieee80211_node_cmp(const struct ieee80211_node *b1,
/*
* Generate red-black tree function logic
*/
-RB_GENERATE(ieee80211_tree, ieee80211_node, ni_node, ieee80211_node_cmp);
+RBT_GENERATE(ieee80211_tree, ieee80211_node, ni_node, ieee80211_node_cmp);
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
index 038f66ab76b..4c47ceaab02 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.h,v 1.60 2016/04/28 08:18:10 stsp Exp $ */
+/* $OpenBSD: ieee80211_node.h,v 1.61 2016/09/15 03:32:48 dlg Exp $ */
/* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */
/*-
@@ -162,7 +162,7 @@ struct ieee80211_rx_ba {
* the ieee80211com structure.
*/
struct ieee80211_node {
- RB_ENTRY(ieee80211_node) ni_node;
+ RBT_ENTRY(ieee80211_node) ni_node;
struct ieee80211com *ni_ic; /* back-pointer */
@@ -284,7 +284,7 @@ struct ieee80211_node {
#define IEEE80211_NODE_SA_QUERY_FAILED 0x1000 /* last SA Query failed */
};
-RB_HEAD(ieee80211_tree, ieee80211_node);
+RBT_HEAD(ieee80211_tree, ieee80211_node);
static __inline void
ieee80211_node_incref(struct ieee80211_node *ni)
@@ -379,6 +379,6 @@ extern void ieee80211_set_tim(struct ieee80211com *, int, int);
extern int ieee80211_node_cmp(const struct ieee80211_node *,
const struct ieee80211_node *);
-RB_PROTOTYPE(ieee80211_tree, ieee80211_node, ni_node, ieee80211_node_cmp);
+RBT_PROTOTYPE(ieee80211_tree, ieee80211_node, ni_node, ieee80211_node_cmp);
#endif /* _NET80211_IEEE80211_NODE_H_ */
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
index 9aa63d823d0..99bda98d882 100644
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_proto.c,v 1.68 2016/07/20 15:40:27 stsp Exp $ */
+/* $OpenBSD: ieee80211_proto.c,v 1.69 2016/09/15 03:32:48 dlg Exp $ */
/* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */
/*-
@@ -847,7 +847,7 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate,
#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_HOSTAP:
s = splnet();
- RB_FOREACH(ni, ieee80211_tree, &ic->ic_tree) {
+ RBT_FOREACH(ni, ieee80211_tree, &ic->ic_tree) {
if (ni->ni_state != IEEE80211_STA_ASSOC)
continue;
IEEE80211_SEND_MGMT(ic, ni,
@@ -873,7 +873,7 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate,
#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_HOSTAP:
s = splnet();
- RB_FOREACH(ni, ieee80211_tree, &ic->ic_tree) {
+ RBT_FOREACH(ni, ieee80211_tree, &ic->ic_tree) {
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_DEAUTH,
IEEE80211_REASON_AUTH_LEAVE);