ieee80211.c (160690) | ieee80211.c (164645) |
---|---|
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 17 unchanged lines hidden (view full) --- 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 17 unchanged lines hidden (view full) --- 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211.c 160690 2006-07-26 03:15:16Z sam $"); | 34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211.c 164645 2006-11-26 22:48:03Z sam $"); |
35 36/* 37 * IEEE 802.11 generic handler 38 */ 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> --- 13 unchanged lines hidden (view full) --- 56 "11a", /* IEEE80211_MODE_11A */ 57 "11b", /* IEEE80211_MODE_11B */ 58 "11g", /* IEEE80211_MODE_11G */ 59 "FH", /* IEEE80211_MODE_FH */ 60 "turboA", /* IEEE80211_MODE_TURBO_A */ 61 "turboG", /* IEEE80211_MODE_TURBO_G */ 62}; 63 | 35 36/* 37 * IEEE 802.11 generic handler 38 */ 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> --- 13 unchanged lines hidden (view full) --- 56 "11a", /* IEEE80211_MODE_11A */ 57 "11b", /* IEEE80211_MODE_11B */ 58 "11g", /* IEEE80211_MODE_11G */ 59 "FH", /* IEEE80211_MODE_FH */ 60 "turboA", /* IEEE80211_MODE_TURBO_A */ 61 "turboG", /* IEEE80211_MODE_TURBO_G */ 62}; 63 |
64/* 65 * Default supported rates for 802.11 operation (in IEEE .5Mb units). 66 */ 67#define B(r) ((r) | IEEE80211_RATE_BASIC) 68static const struct ieee80211_rateset ieee80211_rateset_11a = 69 { 8, { B(12), 18, B(24), 36, B(48), 72, 96, 108 } }; 70static const struct ieee80211_rateset ieee80211_rateset_11b = 71 { 4, { B(2), B(4), B(11), B(22) } }; 72/* NB: OFDM rates are handled specially based on mode */ 73static const struct ieee80211_rateset ieee80211_rateset_11g = 74 { 12, { B(2), B(4), B(11), B(22), 12, 18, 24, 36, 48, 72, 96, 108 } }; 75#undef B 76 |
|
64/* list of all instances */ 65SLIST_HEAD(ieee80211_list, ieee80211com); 66static struct ieee80211_list ieee80211_list = 67 SLIST_HEAD_INITIALIZER(ieee80211_list); 68static u_int8_t ieee80211_vapmap[32]; /* enough for 256 */ 69static struct mtx ieee80211_vap_mtx; 70MTX_SYSINIT(ieee80211, &ieee80211_vap_mtx, "net80211 instances", MTX_DEF); 71 --- 44 unchanged lines hidden (view full) --- 116ieee80211_default_reset(struct ifnet *ifp) 117{ 118 return ENETRESET; 119} 120 121void 122ieee80211_ifattach(struct ieee80211com *ic) 123{ | 77/* list of all instances */ 78SLIST_HEAD(ieee80211_list, ieee80211com); 79static struct ieee80211_list ieee80211_list = 80 SLIST_HEAD_INITIALIZER(ieee80211_list); 81static u_int8_t ieee80211_vapmap[32]; /* enough for 256 */ 82static struct mtx ieee80211_vap_mtx; 83MTX_SYSINIT(ieee80211, &ieee80211_vap_mtx, "net80211 instances", MTX_DEF); 84 --- 44 unchanged lines hidden (view full) --- 129ieee80211_default_reset(struct ifnet *ifp) 130{ 131 return ENETRESET; 132} 133 134void 135ieee80211_ifattach(struct ieee80211com *ic) 136{ |
137#define RATESDEFINED(m) \ 138 ((ic->ic_modecaps & (1<<m)) && ic->ic_sup_rates[m].rs_nrates != 0) |
|
124 struct ifnet *ifp = ic->ic_ifp; 125 struct ieee80211_channel *c; 126 int i; 127 128 ether_ifattach(ifp, ic->ic_myaddr); 129 ifp->if_output = ieee80211_output; 130 131 bpfattach2(ifp, DLT_IEEE802_11, --- 42 unchanged lines hidden (view full) --- 174 ic->ic_curchan = &ic->ic_channels[i]; 175 } 176 } 177 } 178 /* validate ic->ic_curmode */ 179 if ((ic->ic_modecaps & (1<<ic->ic_curmode)) == 0) 180 ic->ic_curmode = IEEE80211_MODE_AUTO; 181 ic->ic_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */ | 139 struct ifnet *ifp = ic->ic_ifp; 140 struct ieee80211_channel *c; 141 int i; 142 143 ether_ifattach(ifp, ic->ic_myaddr); 144 ifp->if_output = ieee80211_output; 145 146 bpfattach2(ifp, DLT_IEEE802_11, --- 42 unchanged lines hidden (view full) --- 189 ic->ic_curchan = &ic->ic_channels[i]; 190 } 191 } 192 } 193 /* validate ic->ic_curmode */ 194 if ((ic->ic_modecaps & (1<<ic->ic_curmode)) == 0) 195 ic->ic_curmode = IEEE80211_MODE_AUTO; 196 ic->ic_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */ |
197 198 /* fillin well-known rate sets if driver has not specified */ 199 if (!RATESDEFINED(IEEE80211_MODE_11B)) 200 ic->ic_sup_rates[IEEE80211_MODE_11B] = ieee80211_rateset_11b; 201 if (!RATESDEFINED(IEEE80211_MODE_11G)) 202 ic->ic_sup_rates[IEEE80211_MODE_11G] = ieee80211_rateset_11g; 203 if (!RATESDEFINED(IEEE80211_MODE_11A)) 204 ic->ic_sup_rates[IEEE80211_MODE_11A] = ieee80211_rateset_11a; 205 if (!RATESDEFINED(IEEE80211_MODE_TURBO_A)) 206 ic->ic_sup_rates[IEEE80211_MODE_TURBO_A] = ieee80211_rateset_11a; 207 if (!RATESDEFINED(IEEE80211_MODE_TURBO_G)) 208 ic->ic_sup_rates[IEEE80211_MODE_TURBO_G] = ieee80211_rateset_11g; |
|
182#if 0 183 /* 184 * Enable WME by default if we're capable. 185 */ 186 if (ic->ic_caps & IEEE80211_C_WME) 187 ic->ic_flags |= IEEE80211_F_WME; 188#endif 189 if (ic->ic_caps & IEEE80211_C_BURST) --- 19 unchanged lines hidden (view full) --- 209 * Install a default reset method for the ioctl support. 210 * The driver is expected to fill this in before calling us. 211 */ 212 if (ic->ic_reset == NULL) 213 ic->ic_reset = ieee80211_default_reset; 214 215 KASSERT(ifp->if_spare2 == NULL, ("oops, hosed")); 216 ifp->if_spare2 = ic; /* XXX temp backpointer */ | 209#if 0 210 /* 211 * Enable WME by default if we're capable. 212 */ 213 if (ic->ic_caps & IEEE80211_C_WME) 214 ic->ic_flags |= IEEE80211_F_WME; 215#endif 216 if (ic->ic_caps & IEEE80211_C_BURST) --- 19 unchanged lines hidden (view full) --- 236 * Install a default reset method for the ioctl support. 237 * The driver is expected to fill this in before calling us. 238 */ 239 if (ic->ic_reset == NULL) 240 ic->ic_reset = ieee80211_default_reset; 241 242 KASSERT(ifp->if_spare2 == NULL, ("oops, hosed")); 243 ifp->if_spare2 = ic; /* XXX temp backpointer */ |
244#undef RATESDEFINED |
|
217} 218 219void 220ieee80211_ifdetach(struct ieee80211com *ic) 221{ 222 struct ifnet *ifp = ic->ic_ifp; 223 224 ieee80211_remove_vap(ic); --- 808 unchanged lines hidden --- | 245} 246 247void 248ieee80211_ifdetach(struct ieee80211com *ic) 249{ 250 struct ifnet *ifp = ic->ic_ifp; 251 252 ieee80211_remove_vap(ic); --- 808 unchanged lines hidden --- |