ieee80211_freebsd.c (283529) | ieee80211_freebsd.c (283538) |
---|---|
1/*- 2 * Copyright (c) 2003-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_freebsd.c 283529 2015-05-25 14:30:44Z glebius $"); | 27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_freebsd.c 283538 2015-05-25 19:18:16Z adrian $"); |
28 29/* 30 * IEEE 802.11 support (FreeBSD-specific code) 31 */ 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/kernel.h> --- 41 unchanged lines hidden (view full) --- 77 * below and are called automatically by the ifnet code 78 * when the ifnet of the parent device is created. 79 */ 80static void * 81wlan_alloc(u_char type, struct ifnet *ifp) 82{ 83 struct ieee80211com *ic; 84 | 28 29/* 30 * IEEE 802.11 support (FreeBSD-specific code) 31 */ 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/kernel.h> --- 41 unchanged lines hidden (view full) --- 77 * below and are called automatically by the ifnet code 78 * when the ifnet of the parent device is created. 79 */ 80static void * 81wlan_alloc(u_char type, struct ifnet *ifp) 82{ 83 struct ieee80211com *ic; 84 |
85 ic = malloc(sizeof(struct ieee80211com), M_80211_COM, M_WAITOK|M_ZERO); | 85 ic = IEEE80211_MALLOC(sizeof(struct ieee80211com), M_80211_COM, 86 IEEE80211_M_WAITOK | IEEE80211_M_ZERO); |
86 ic->ic_ifp = ifp; 87 88 return (ic); 89} 90 91static void 92wlan_free(void *ic, u_char type) 93{ | 87 ic->ic_ifp = ifp; 88 89 return (ic); 90} 91 92static void 93wlan_free(void *ic, u_char type) 94{ |
94 free(ic, M_80211_COM); | 95 IEEE80211_FREE(ic, M_80211_COM); |
95} 96 97static int 98wlan_clone_create(struct if_clone *ifc, int unit, caddr_t params) 99{ 100 struct ieee80211_clone_params cp; 101 struct ieee80211vap *vap; 102 struct ieee80211com *ic; --- 136 unchanged lines hidden (view full) --- 239void 240ieee80211_sysctl_vattach(struct ieee80211vap *vap) 241{ 242 struct ifnet *ifp = vap->iv_ifp; 243 struct sysctl_ctx_list *ctx; 244 struct sysctl_oid *oid; 245 char num[14]; /* sufficient for 32 bits */ 246 | 96} 97 98static int 99wlan_clone_create(struct if_clone *ifc, int unit, caddr_t params) 100{ 101 struct ieee80211_clone_params cp; 102 struct ieee80211vap *vap; 103 struct ieee80211com *ic; --- 136 unchanged lines hidden (view full) --- 240void 241ieee80211_sysctl_vattach(struct ieee80211vap *vap) 242{ 243 struct ifnet *ifp = vap->iv_ifp; 244 struct sysctl_ctx_list *ctx; 245 struct sysctl_oid *oid; 246 char num[14]; /* sufficient for 32 bits */ 247 |
247 ctx = (struct sysctl_ctx_list *) malloc(sizeof(struct sysctl_ctx_list), 248 M_DEVBUF, M_NOWAIT | M_ZERO); | 248 ctx = (struct sysctl_ctx_list *) IEEE80211_MALLOC(sizeof(struct sysctl_ctx_list), 249 M_DEVBUF, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); |
249 if (ctx == NULL) { 250 if_printf(ifp, "%s: cannot allocate sysctl context!\n", 251 __func__); 252 return; 253 } 254 sysctl_ctx_init(ctx); 255 snprintf(num, sizeof(num), "%u", ifp->if_dunit); 256 oid = SYSCTL_ADD_NODE(ctx, &SYSCTL_NODE_CHILDREN(_net, wlan), --- 58 unchanged lines hidden (view full) --- 315} 316 317void 318ieee80211_sysctl_vdetach(struct ieee80211vap *vap) 319{ 320 321 if (vap->iv_sysctl != NULL) { 322 sysctl_ctx_free(vap->iv_sysctl); | 250 if (ctx == NULL) { 251 if_printf(ifp, "%s: cannot allocate sysctl context!\n", 252 __func__); 253 return; 254 } 255 sysctl_ctx_init(ctx); 256 snprintf(num, sizeof(num), "%u", ifp->if_dunit); 257 oid = SYSCTL_ADD_NODE(ctx, &SYSCTL_NODE_CHILDREN(_net, wlan), --- 58 unchanged lines hidden (view full) --- 316} 317 318void 319ieee80211_sysctl_vdetach(struct ieee80211vap *vap) 320{ 321 322 if (vap->iv_sysctl != NULL) { 323 sysctl_ctx_free(vap->iv_sysctl); |
323 free(vap->iv_sysctl, M_DEVBUF); | 324 IEEE80211_FREE(vap->iv_sysctl, M_DEVBUF); |
324 vap->iv_sysctl = NULL; 325 } 326} 327 328int 329ieee80211_node_dectestref(struct ieee80211_node *ni) 330{ 331 /* XXX need equivalent of atomic_dec_and_test */ --- 583 unchanged lines hidden --- | 325 vap->iv_sysctl = NULL; 326 } 327} 328 329int 330ieee80211_node_dectestref(struct ieee80211_node *ni) 331{ 332 /* XXX need equivalent of atomic_dec_and_test */ --- 583 unchanged lines hidden --- |