Changeset View
Changeset View
Standalone View
Standalone View
sys/net80211/ieee80211_proto.c
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | null_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, | ||||
ic_printf(ni->ni_ic, "missing ic_raw_xmit callback, drop frame\n"); | ic_printf(ni->ni_ic, "missing ic_raw_xmit callback, drop frame\n"); | ||||
m_freem(m); | m_freem(m); | ||||
return ENETDOWN; | return ENETDOWN; | ||||
} | } | ||||
void | void | ||||
ieee80211_proto_attach(struct ieee80211com *ic) | ieee80211_proto_attach(struct ieee80211com *ic) | ||||
{ | { | ||||
struct ifnet *ifp = ic->ic_ifp; | uint8_t hdrlen; | ||||
/* override the 802.3 setting */ | /* override the 802.3 setting */ | ||||
ifp->if_hdrlen = ic->ic_headroom | hdrlen = ic->ic_headroom | ||||
+ sizeof(struct ieee80211_qosframe_addr4) | + sizeof(struct ieee80211_qosframe_addr4) | ||||
+ IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN | + IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN | ||||
+ IEEE80211_WEP_EXTIVLEN; | + IEEE80211_WEP_EXTIVLEN; | ||||
/* XXX no way to recalculate on ifdetach */ | /* XXX no way to recalculate on ifdetach */ | ||||
if (ALIGN(ifp->if_hdrlen) > max_linkhdr) { | if (ALIGN(hdrlen) > max_linkhdr) { | ||||
/* XXX sanity check... */ | /* XXX sanity check... */ | ||||
max_linkhdr = ALIGN(ifp->if_hdrlen); | max_linkhdr = ALIGN(hdrlen); | ||||
max_hdr = max_linkhdr + max_protohdr; | max_hdr = max_linkhdr + max_protohdr; | ||||
max_datalen = MHLEN - max_hdr; | max_datalen = MHLEN - max_hdr; | ||||
} | } | ||||
ic->ic_protmode = IEEE80211_PROT_CTSONLY; | ic->ic_protmode = IEEE80211_PROT_CTSONLY; | ||||
TASK_INIT(&ic->ic_parent_task, 0, parent_updown, ifp); | TASK_INIT(&ic->ic_parent_task, 0, parent_updown, ic); | ||||
TASK_INIT(&ic->ic_mcast_task, 0, update_mcast, ic); | TASK_INIT(&ic->ic_mcast_task, 0, update_mcast, ic); | ||||
TASK_INIT(&ic->ic_promisc_task, 0, update_promisc, ic); | TASK_INIT(&ic->ic_promisc_task, 0, update_promisc, ic); | ||||
TASK_INIT(&ic->ic_chan_task, 0, update_channel, ic); | TASK_INIT(&ic->ic_chan_task, 0, update_channel, ic); | ||||
TASK_INIT(&ic->ic_bmiss_task, 0, beacon_miss, ic); | TASK_INIT(&ic->ic_bmiss_task, 0, beacon_miss, ic); | ||||
TASK_INIT(&ic->ic_chw_task, 0, update_chw, ic); | TASK_INIT(&ic->ic_chw_task, 0, update_chw, ic); | ||||
ic->ic_wme.wme_hipri_switch_hysteresis = | ic->ic_wme.wme_hipri_switch_hysteresis = | ||||
AGGRESSIVE_MODE_SWITCH_HYSTERESIS; | AGGRESSIVE_MODE_SWITCH_HYSTERESIS; | ||||
Show All 33 Lines | |||||
void | void | ||||
ieee80211_proto_vattach(struct ieee80211vap *vap) | ieee80211_proto_vattach(struct ieee80211vap *vap) | ||||
{ | { | ||||
struct ieee80211com *ic = vap->iv_ic; | struct ieee80211com *ic = vap->iv_ic; | ||||
struct ifnet *ifp = vap->iv_ifp; | struct ifnet *ifp = vap->iv_ifp; | ||||
int i; | int i; | ||||
/* override the 802.3 setting */ | /* override the 802.3 setting */ | ||||
ifp->if_hdrlen = ic->ic_ifp->if_hdrlen; | ifp->if_hdrlen = ic->ic_headroom | ||||
+ sizeof(struct ieee80211_qosframe_addr4) | |||||
+ IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN | |||||
+ IEEE80211_WEP_EXTIVLEN; | |||||
vap->iv_rtsthreshold = IEEE80211_RTS_DEFAULT; | vap->iv_rtsthreshold = IEEE80211_RTS_DEFAULT; | ||||
vap->iv_fragthreshold = IEEE80211_FRAG_DEFAULT; | vap->iv_fragthreshold = IEEE80211_FRAG_DEFAULT; | ||||
vap->iv_bmiss_max = IEEE80211_BMISS_MAX; | vap->iv_bmiss_max = IEEE80211_BMISS_MAX; | ||||
callout_init_mtx(&vap->iv_swbmiss, IEEE80211_LOCK_OBJ(ic), 0); | callout_init_mtx(&vap->iv_swbmiss, IEEE80211_LOCK_OBJ(ic), 0); | ||||
callout_init(&vap->iv_mgtsend, 1); | callout_init(&vap->iv_mgtsend, 1); | ||||
TASK_INIT(&vap->iv_nstate_task, 0, ieee80211_newstate_cb, vap); | TASK_INIT(&vap->iv_nstate_task, 0, ieee80211_newstate_cb, vap); | ||||
TASK_INIT(&vap->iv_swbmiss_task, 0, beacon_swmiss, vap); | TASK_INIT(&vap->iv_swbmiss_task, 0, beacon_swmiss, vap); | ||||
▲ Show 20 Lines • Show All 950 Lines • ▼ Show 20 Lines | if (ic->ic_caps & IEEE80211_C_WME) { | ||||
ieee80211_wme_updateparams_locked(vap); | ieee80211_wme_updateparams_locked(vap); | ||||
IEEE80211_UNLOCK(ic); | IEEE80211_UNLOCK(ic); | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
parent_updown(void *arg, int npending) | parent_updown(void *arg, int npending) | ||||
{ | { | ||||
struct ifnet *parent = arg; | struct ieee80211com *ic = arg; | ||||
parent->if_ioctl(parent, SIOCSIFFLAGS, NULL); | ic->ic_parent(ic); | ||||
} | } | ||||
static void | static void | ||||
update_mcast(void *arg, int npending) | update_mcast(void *arg, int npending) | ||||
{ | { | ||||
struct ieee80211com *ic = arg; | struct ieee80211com *ic = arg; | ||||
ic->ic_update_mcast(ic); | ic->ic_update_mcast(ic); | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
* set running on the underlying device then we | * set running on the underlying device then we | ||||
* automatically bring the device up. | * automatically bring the device up. | ||||
*/ | */ | ||||
void | void | ||||
ieee80211_start_locked(struct ieee80211vap *vap) | ieee80211_start_locked(struct ieee80211vap *vap) | ||||
{ | { | ||||
struct ifnet *ifp = vap->iv_ifp; | struct ifnet *ifp = vap->iv_ifp; | ||||
struct ieee80211com *ic = vap->iv_ic; | struct ieee80211com *ic = vap->iv_ic; | ||||
struct ifnet *parent = ic->ic_ifp; | |||||
IEEE80211_LOCK_ASSERT(ic); | IEEE80211_LOCK_ASSERT(ic); | ||||
IEEE80211_DPRINTF(vap, | IEEE80211_DPRINTF(vap, | ||||
IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, | IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, | ||||
"start running, %d vaps running\n", ic->ic_nrunning); | "start running, %d vaps running\n", ic->ic_nrunning); | ||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { | if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { | ||||
/* | /* | ||||
* Mark us running. Note that it's ok to do this first; | * Mark us running. Note that it's ok to do this first; | ||||
* if we need to bring the parent device up we defer that | * if we need to bring the parent device up we defer that | ||||
* to avoid dropping the com lock. We expect the device | * to avoid dropping the com lock. We expect the device | ||||
* to respond to being marked up by calling back into us | * to respond to being marked up by calling back into us | ||||
* through ieee80211_start_all at which point we'll come | * through ieee80211_start_all at which point we'll come | ||||
* back in here and complete the work. | * back in here and complete the work. | ||||
*/ | */ | ||||
ifp->if_drv_flags |= IFF_DRV_RUNNING; | ifp->if_drv_flags |= IFF_DRV_RUNNING; | ||||
/* | /* | ||||
* We are not running; if this we are the first vap | * We are not running; if this we are the first vap | ||||
* to be brought up auto-up the parent if necessary. | * to be brought up auto-up the parent if necessary. | ||||
*/ | */ | ||||
if (ic->ic_nrunning++ == 0 && | if (ic->ic_nrunning++ == 0) { | ||||
(parent->if_drv_flags & IFF_DRV_RUNNING) == 0) { | |||||
IEEE80211_DPRINTF(vap, | IEEE80211_DPRINTF(vap, | ||||
IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, | IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, | ||||
"%s: up parent %s\n", __func__, parent->if_xname); | "%s: up parent %s\n", __func__, ic->ic_name); | ||||
parent->if_flags |= IFF_UP; | |||||
ieee80211_runtask(ic, &ic->ic_parent_task); | ieee80211_runtask(ic, &ic->ic_parent_task); | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* If the parent is up and running, then kick the | * If the parent is up and running, then kick the | ||||
* 802.11 state machine as appropriate. | * 802.11 state machine as appropriate. | ||||
*/ | */ | ||||
if ((parent->if_drv_flags & IFF_DRV_RUNNING) && | if (vap->iv_roaming != IEEE80211_ROAMING_MANUAL) { | ||||
vap->iv_roaming != IEEE80211_ROAMING_MANUAL) { | |||||
if (vap->iv_opmode == IEEE80211_M_STA) { | if (vap->iv_opmode == IEEE80211_M_STA) { | ||||
#if 0 | #if 0 | ||||
/* XXX bypasses scan too easily; disable for now */ | /* XXX bypasses scan too easily; disable for now */ | ||||
/* | /* | ||||
* Try to be intelligent about clocking the state | * Try to be intelligent about clocking the state | ||||
* machine. If we're currently in RUN state then | * machine. If we're currently in RUN state then | ||||
* we should be able to apply any new state/parameters | * we should be able to apply any new state/parameters | ||||
* simply by re-associating. Otherwise we need to | * simply by re-associating. Otherwise we need to | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
* too to insure it will be properly initialized when the | * too to insure it will be properly initialized when the | ||||
* next vap is brought up. | * next vap is brought up. | ||||
*/ | */ | ||||
void | void | ||||
ieee80211_stop_locked(struct ieee80211vap *vap) | ieee80211_stop_locked(struct ieee80211vap *vap) | ||||
{ | { | ||||
struct ieee80211com *ic = vap->iv_ic; | struct ieee80211com *ic = vap->iv_ic; | ||||
struct ifnet *ifp = vap->iv_ifp; | struct ifnet *ifp = vap->iv_ifp; | ||||
struct ifnet *parent = ic->ic_ifp; | |||||
IEEE80211_LOCK_ASSERT(ic); | IEEE80211_LOCK_ASSERT(ic); | ||||
IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, | IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, | ||||
"stop running, %d vaps running\n", ic->ic_nrunning); | "stop running, %d vaps running\n", ic->ic_nrunning); | ||||
ieee80211_new_state_locked(vap, IEEE80211_S_INIT, -1); | ieee80211_new_state_locked(vap, IEEE80211_S_INIT, -1); | ||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING) { | if (ifp->if_drv_flags & IFF_DRV_RUNNING) { | ||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING; /* mark us stopped */ | ifp->if_drv_flags &= ~IFF_DRV_RUNNING; /* mark us stopped */ | ||||
if (--ic->ic_nrunning == 0 && | if (--ic->ic_nrunning == 0) { | ||||
(parent->if_drv_flags & IFF_DRV_RUNNING)) { | |||||
IEEE80211_DPRINTF(vap, | IEEE80211_DPRINTF(vap, | ||||
IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, | IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, | ||||
"down parent %s\n", parent->if_xname); | "down parent %s\n", ic->ic_name); | ||||
parent->if_flags &= ~IFF_UP; | |||||
ieee80211_runtask(ic, &ic->ic_parent_task); | ieee80211_runtask(ic, &ic->ic_parent_task); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void | void | ||||
ieee80211_stop(struct ieee80211vap *vap) | ieee80211_stop(struct ieee80211vap *vap) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 623 Lines • Show Last 20 Lines |