Date: Mon, 16 Feb 2004 14:37:15 -0800 (PST) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 47056 for review Message-ID: <200402162237.i1GMbFEO067196@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=47056 Change 47056 by sam@sam_ebb on 2004/02/16 14:36:48 o add locking directives for 802.1x and radius client code o add ALIGNED_POINTER definition o add ieee80211_node_refcnt portability wrapper o add get_random_bytes portability wrapper Affected files ... .. //depot/projects/netperf+sockets/sys/net80211/ieee80211_freebsd.h#5 edit Differences ... ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_freebsd.h#5 (text+ko) ==== @@ -32,7 +32,7 @@ #define NBPFILTER 1 /* always enabled */ /* - * Locking definitions. + * Node locking definitions. */ typedef struct mtx ieee80211_node_lock_t; #define IEEE80211_NODE_LOCK_INIT(_ic, _name) \ @@ -41,8 +41,32 @@ #define IEEE80211_NODE_LOCK(_ic) mtx_lock(&(_ic)->ic_nodelock) #define IEEE80211_NODE_UNLOCK(_ic) mtx_unlock(&(_ic)->ic_nodelock) +/* + * 802.1x state locking definitions. + */ +typedef struct mtx eapol_node_lock_t; +#define EAPOL_LOCK_INIT(_ec, _name) \ + mtx_init(&(_ec)->ec_lock, _name, "802.1x node table", MTX_DEF) +#define EAPOL_LOCK_DESTROY(_ec) mtx_destroy(&(_ec)->ec_lock) +#define EAPOL_LOCK(_ec) mtx_lock(&(_ec)->ec_lock) +#define EAPOL_UNLOCK(_ec) mtx_unlock(&(_ec)->ec_lock) +#define EAPOL_LOCK_ASSERT(_ec) mtx_assert((_ec)->ec_lock, MTX_OWNED) + +/* + * Radius state locking definitions. + */ +typedef struct mtx radius_lock_t; +#define RADIUS_LOCK_INIT(_rc, _name) \ + mtx_init(&(_rc)->rc_lock, _name, "802.1x radius client", MTX_DEF) +#define RADIUS_LOCK_DESTROY(_rc) mtx_destroy(&(_rc)->rc_lock) +#define RADIUS_LOCK(_rc) mtx_lock(&(_rc)->rc_lock) +#define RADIUS_UNLOCK(_rc) mtx_unlock(&(_rc)->rc_lock) +#define RADIUS_LOCK_ASSERT(_rc) mtx_assert((_rc)->rc_lock, MTX_OWNED) + #define M_LINK0 M_PROTO1 #define ALTQ_DECL(_x) +/* NB: this assumes the alignement is a pow2 */ +#define ALIGNED_POINTER(p,a) ((((uintptr_t)(p)) & ((a)-1)) == 0) /* * Node reference counting definitions: @@ -52,10 +76,12 @@ * ieee80211_node_decref remove a reference * ieee80211_node_dectestref remove a reference and return 1 if this * is the last reference, otherwise 0 + * ieee80211_node_refcnt reference count for printing (only) */ #define ieee80211_node_initref(_ni) ((_ni)->ni_refcnt = 1) #define ieee80211_node_incref(_ni) atomic_add_int(&(_ni)->ni_refcnt,1) #define ieee80211_node_decref(_ni) atomic_subtract_int(&(_ni)->ni_refcnt,1) +#define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt /* XXX handle circularity required by inline function */ #include <sys/malloc.h> @@ -73,5 +99,6 @@ } extern struct mbuf *ieee80211_getmgtframe(u_int8_t **frm, u_int pktlen); +extern void get_random_bytes(void *data, u_int len); #endif /* _NET80211_IEEE80211_FREEBSD_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402162237.i1GMbFEO067196>