/* * Default scan attach method. */ void ieee80211_swscan_attach(struct ieee80211com *ic) { struct scan_state *ss; /* * Setup the default methods */ ic->ic_scan_methods = &swscan_methods; /* Allocate initial scan state */ ss = (struct scan_state *) IEEE80211_MALLOC(sizeof(struct scan_state), M_80211_SCAN, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ss == NULL) { ic->ic_scan = NULL; return; } TASK_INIT(&ss->ss_scan_start, 0, scan_start, ss); TIMEOUT_TASK_INIT(ic->ic_tq, &ss->ss_scan_curchan, 0, scan_curchan_task, ss); ic->ic_scan = &ss->base; ss->base.ss_ic = ic; ic->ic_scan_curchan = scan_curchan; ic->ic_scan_mindwell = scan_mindwell; }
void ieee80211_tdma_vattach(struct ieee80211vap *vap) { struct ieee80211_tdma_state *ts; KASSERT(vap->iv_caps & IEEE80211_C_TDMA, ("not a tdma vap, caps 0x%x", vap->iv_caps)); ts = (struct ieee80211_tdma_state *) IEEE80211_MALLOC( sizeof(struct ieee80211_tdma_state), M_80211_VAP, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ts == NULL) { printf("%s: cannot allocate TDMA state block\n", __func__); /* NB: fall back to adhdemo mode */ vap->iv_caps &= ~IEEE80211_C_TDMA; return; } /* NB: default configuration is passive so no beacons */ ts->tdma_version = TDMA_VERSION; ts->tdma_slotlen = TDMA_SLOTLEN_DEFAULT; ts->tdma_slotcnt = TDMA_SLOTCNT_DEFAULT; ts->tdma_bintval = TDMA_BINTVAL_DEFAULT; ts->tdma_slot = 1; /* passive operation */ /* setup default fixed rates */ settxparms(vap, IEEE80211_MODE_11A, TDMA_TXRATE_11A_DEFAULT); settxparms(vap, IEEE80211_MODE_11B, TDMA_TXRATE_11B_DEFAULT); settxparms(vap, IEEE80211_MODE_11G, TDMA_TXRATE_11G_DEFAULT); settxparms(vap, IEEE80211_MODE_TURBO_A, TDMA_TXRATE_TURBO_DEFAULT); settxparms(vap, IEEE80211_MODE_TURBO_G, TDMA_TXRATE_TURBO_DEFAULT); settxparms(vap, IEEE80211_MODE_STURBO_A, TDMA_TXRATE_TURBO_DEFAULT); settxparms(vap, IEEE80211_MODE_11NA, TDMA_TXRATE_11NA_DEFAULT); settxparms(vap, IEEE80211_MODE_11NG, TDMA_TXRATE_11NG_DEFAULT); settxparms(vap, IEEE80211_MODE_HALF, TDMA_TXRATE_HALF_DEFAULT); settxparms(vap, IEEE80211_MODE_QUARTER, TDMA_TXRATE_QUARTER_DEFAULT); setackpolicy(vap->iv_ic, 1); /* disable ACK's */ ts->tdma_opdetach = vap->iv_opdetach; vap->iv_opdetach = tdma_vdetach; ts->tdma_newstate = vap->iv_newstate; vap->iv_newstate = tdma_newstate; vap->iv_bmiss = tdma_beacon_miss; ts->tdma_recv_mgmt = vap->iv_recv_mgmt; vap->iv_recv_mgmt = tdma_recv_mgmt; vap->iv_tdma = ts; }
void ieee80211_superg_attach(struct ieee80211com *ic) { struct ieee80211_superg *sg; if (ic->ic_caps & IEEE80211_C_FF) { sg = (struct ieee80211_superg *) IEEE80211_MALLOC( sizeof(struct ieee80211_superg), M_80211_VAP, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (sg == NULL) { printf("%s: cannot allocate SuperG state block\n", __func__); return; } ic->ic_superg = sg; } ieee80211_ffagemax = msecs_to_ticks(150); }
void ieee80211_power_latevattach(struct ieee80211vap *vap) { /* * Allocate these only if needed. Beware that we * know adhoc mode doesn't support ATIM yet... */ if (vap->iv_opmode == IEEE80211_M_HOSTAP) { vap->iv_tim_len = howmany(vap->iv_max_aid,8) * sizeof(uint8_t); vap->iv_tim_bitmap = (uint8_t *) IEEE80211_MALLOC(vap->iv_tim_len, M_80211_POWER, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (vap->iv_tim_bitmap == NULL) { printf("%s: no memory for TIM bitmap!\n", __func__); /* XXX good enough to keep from crashing? */ vap->iv_tim_len = 0; } } }
void ieee80211_superg_attach(struct ieee80211com *ic) { struct ieee80211_superg *sg; sg = (struct ieee80211_superg *) IEEE80211_MALLOC( sizeof(struct ieee80211_superg), M_80211_VAP, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (sg == NULL) { printf("%s: cannot allocate SuperG state block\n", __func__); return; } ic->ic_superg = sg; /* * Default to not being so aggressive for FF/AMSDU * aging, otherwise we may hold a frame around * for way too long before we expire it out. */ ieee80211_ffagemax = msecs_to_ticks(2); }
static void amrr_init(struct ieee80211vap *vap) { struct ieee80211_amrr *amrr; KASSERT(vap->iv_rs == NULL, ("%s called multiple times", __func__)); #if defined(__DragonFly__) amrr = vap->iv_rs = kmalloc(sizeof(struct ieee80211_amrr), M_80211_RATECTL, M_INTWAIT|M_ZERO); #else amrr = vap->iv_rs = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr), M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); #endif if (amrr == NULL) { if_printf(vap->iv_ifp, "couldn't alloc ratectl structure\n"); return; } amrr->amrr_min_success_threshold = IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD; amrr->amrr_max_success_threshold = IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD; amrr_setinterval(vap, 500 /* ms */); amrr_sysctlattach(vap, vap->iv_sysctl, vap->iv_oid); }
[IEEE80211_MODE_TURBO_G] = CHAN_UNINTERESTING, [IEEE80211_MODE_STURBO_A] = CHAN_UNINTERESTING, [IEEE80211_MODE_HALF] = IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO, [IEEE80211_MODE_QUARTER] = IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO, [IEEE80211_MODE_11NA] = CHAN_UNINTERESTING, [IEEE80211_MODE_11NG] = CHAN_UNINTERESTING, }; const struct ieee80211_regdomain *rd = &ic->ic_regdomain; uint8_t nextchan, chans[IEEE80211_CHAN_BYTES], *frm; struct ieee80211_appie *aie; struct ieee80211_country_ie *ie; int i, skip, nruns; aie = IEEE80211_MALLOC(IEEE80211_COUNTRY_MAX_SIZE, M_80211_NODE_IE, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (aie == NULL) { ic_printf(ic, "%s: unable to allocate memory for country ie\n", __func__); /* XXX stat */ return NULL; } ie = (struct ieee80211_country_ie *) aie->ie_data; ie->ie = IEEE80211_ELEMID_COUNTRY; if (rd->isocc[0] == '\0') { ic_printf(ic, "no ISO country string for cc %d; using blanks\n", rd->country); ie->cc[0] = ie->cc[1] = ' '; } else { ie->cc[0] = rd->isocc[0]; ie->cc[1] = rd->isocc[1];
static void amrr_node_init(struct ieee80211_node *ni) { const struct ieee80211_rateset *rs = NULL; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_amrr *amrr = vap->iv_rs; struct ieee80211_amrr_node *amn; uint8_t rate; if (ni->ni_rctls == NULL) { #if defined(__DragonFly__) ni->ni_rctls = amn = kmalloc(sizeof(struct ieee80211_amrr_node), M_80211_RATECTL, M_INTWAIT|M_ZERO); #else ni->ni_rctls = amn = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr_node), M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); #endif if (amn == NULL) { if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl " "structure\n"); return; } } else amn = ni->ni_rctls; amn->amn_amrr = amrr; amn->amn_success = 0; amn->amn_recovery = 0; amn->amn_txcnt = amn->amn_retrycnt = 0; amn->amn_success_threshold = amrr->amrr_min_success_threshold; /* 11n or not? Pick the right rateset */ if (amrr_node_is_11n(ni)) { /* XXX ew */ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "%s: 11n node", __func__); rs = (struct ieee80211_rateset *) &ni->ni_htrates; } else { IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "%s: non-11n node", __func__); rs = &ni->ni_rates; } /* Initial rate - lowest */ rate = rs->rs_rates[0]; /* XXX clear the basic rate flag if it's not 11n */ if (! amrr_node_is_11n(ni)) rate &= IEEE80211_RATE_VAL; /* pick initial rate from the rateset - HT or otherwise */ /* Pick something low that's likely to succeed */ for (amn->amn_rix = rs->rs_nrates - 1; amn->amn_rix > 0; amn->amn_rix--) { /* legacy - anything < 36mbit, stop searching */ /* 11n - stop at MCS4 */ if (amrr_node_is_11n(ni)) { if ((rs->rs_rates[amn->amn_rix] & 0x1f) < 4) break; } else if ((rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL) <= 72) break; } rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; /* if the rate is an 11n rate, ensure the MCS bit is set */ if (amrr_node_is_11n(ni)) rate |= IEEE80211_RATE_MCS; /* Assign initial rate from the rateset */ ni->ni_txrate = rate; amn->amn_ticks = ticks; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "AMRR: nrates=%d, initial rate %d", rs->rs_nrates, rate); }