Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Begin sync with 802.11 framework in FreeBSD: adopt m...
details: https://anonhg.NetBSD.org/src/rev/e7ae33cf9a5f
branches: trunk
changeset: 547109:e7ae33cf9a5f
user: dyoung <dyoung%NetBSD.org@localhost>
date: Tue May 13 09:22:31 2003 +0000
description:
Begin sync with 802.11 framework in FreeBSD: adopt macros for
locking.
diffstat:
sys/net/if_ieee80211.h | 15 +++++++++++++--
sys/net/if_ieee80211subr.c | 27 +++++++++++++--------------
2 files changed, 26 insertions(+), 16 deletions(-)
diffs (121 lines):
diff -r 94f84dc125e0 -r e7ae33cf9a5f sys/net/if_ieee80211.h
--- a/sys/net/if_ieee80211.h Tue May 13 08:58:01 2003 +0000
+++ b/sys/net/if_ieee80211.h Tue May 13 09:22:31 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ieee80211.h,v 1.28 2003/05/13 05:51:46 dyoung Exp $ */
+/* $NetBSD: if_ieee80211.h,v 1.29 2003/05/13 09:22:31 dyoung Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -539,8 +539,19 @@
u_int32_t ic_aid_bitmap[IEEE80211_MAX_AID / 32 + 1];
u_int16_t ic_max_aid;
};
+#ifdef __NetBSD__
#define ic_if ic_ec.ec_if
-#define ic_softc ic_ec.ec_if.if_softc
+#define IEEE80211_LOCK_DECL() int s
+#define IEEE80211_LOCK(_ic) do { s = splnet(); } while (0)
+#define IEEE80211_UNLOCK(_ic) splx(s)
+#endif
+#ifdef __FreeBSD__
+#define ic_if ic_ac.ac_if
+#define IEEE80211_LOCK_DECL()
+#define IEEE80211_LOCK(_ic) mtx_lock(&(_ic)->ic_mtx)
+#define IEEE80211_UNLOCK(_ic) mtx_unlock(&(_ic)->ic_mtx)
+#endif
+#define ic_softc ic_if.if_softc
#define IEEE80211_SEND_MGMT(ic,ni,type,arg) do { \
if ((ic)->ic_send_mgmt[(type)>>IEEE80211_FC0_SUBTYPE_SHIFT] != NULL) \
diff -r 94f84dc125e0 -r e7ae33cf9a5f sys/net/if_ieee80211subr.c
--- a/sys/net/if_ieee80211subr.c Tue May 13 08:58:01 2003 +0000
+++ b/sys/net/if_ieee80211subr.c Tue May 13 09:22:31 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ieee80211subr.c,v 1.26 2003/05/13 05:43:43 dyoung Exp $ */
+/* $NetBSD: if_ieee80211subr.c,v 1.27 2003/05/13 09:22:31 dyoung Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ieee80211subr.c,v 1.26 2003/05/13 05:43:43 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ieee80211subr.c,v 1.27 2003/05/13 09:22:31 dyoung Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@@ -217,9 +217,9 @@
ieee80211_ifdetach(struct ifnet *ifp)
{
struct ieee80211com *ic = (void *)ifp;
- int s;
+ IEEE80211_LOCK_DECL();
- s = splnet();
+ IEEE80211_LOCK(ic);
IF_PURGE(&ic->ic_mgtq);
IF_PURGE(&ic->ic_pwrsaveq);
if (ic->ic_wep_ctx != NULL) {
@@ -1306,7 +1306,7 @@
{
struct ieee80211_node *ni;
int hash;
- int s;
+ IEEE80211_LOCK_DECL();
ni = malloc(sizeof(struct ieee80211_node) + ic->ic_node_privlen,
M_DEVBUF, M_NOWAIT);
@@ -1324,10 +1324,10 @@
ni->ni_private = NULL;
hash = IEEE80211_NODE_HASH(macaddr);
- s = splnet();
+ IEEE80211_LOCK(ic);
TAILQ_INSERT_TAIL(&ic->ic_node, ni, ni_list);
LIST_INSERT_HEAD(&ic->ic_hash[hash], ni, ni_hash);
- splx(s);
+ IEEE80211_UNLOCK(ic);
ic->ic_inact_timer = IEEE80211_INACT_WAIT;
return ni;
}
@@ -1337,24 +1337,23 @@
{
struct ieee80211_node *ni;
int hash;
- int s;
+ IEEE80211_LOCK_DECL();
hash = IEEE80211_NODE_HASH(macaddr);
- s = splnet();
+ IEEE80211_LOCK(ic);
LIST_FOREACH(ni, &ic->ic_hash[hash], ni_hash) {
if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr))
break;
}
- splx(s);
+ IEEE80211_UNLOCK(ic);
return ni;
}
void
ieee80211_free_node(struct ieee80211com *ic, struct ieee80211_node *ni)
{
- int s;
-
- s = splnet();
+ IEEE80211_LOCK_DECL();
+ IEEE80211_LOCK(ic);
if (ic->ic_node_free != NULL)
(*ic->ic_node_free)(ic, ni);
IEEE80211_AID_CLR(ni->ni_associd, ic->ic_aid_bitmap);
@@ -1365,7 +1364,7 @@
if (ic->ic_set_tim)
ic->ic_set_tim(ic, ni->ni_associd, 0);
}
- splx(s);
+ IEEE80211_UNLOCK(ic);
free(ni, M_DEVBUF);
if (TAILQ_EMPTY(&ic->ic_node))
ic->ic_inact_timer = 0;
Home |
Main Index |
Thread Index |
Old Index