diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index 8d9bcce5890a..e3d9272b0a00 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -242,7 +242,7 @@ adhoc_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) ic->ic_newassoc(ni, ostate != IEEE80211_S_RUN); break; case IEEE80211_S_SLEEP: - ieee80211_sta_pwrsave(vap, 0); + vap->iv_sta_ps(vap, 0); break; default: invalid: diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 72e1771be1ed..01a8078bdfe0 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -73,7 +73,6 @@ static void hostap_deliver_data(struct ieee80211vap *, static void hostap_recv_mgmt(struct ieee80211_node *, struct mbuf *, int subtype, int rssi, int nf); static void hostap_recv_ctl(struct ieee80211_node *, struct mbuf *, int); -static void hostap_recv_pspoll(struct ieee80211_node *, struct mbuf *); void ieee80211_hostap_attach(struct ieee80211com *ic) @@ -100,6 +99,7 @@ hostap_vattach(struct ieee80211vap *vap) vap->iv_recv_ctl = hostap_recv_ctl; vap->iv_opdetach = hostap_vdetach; vap->iv_deliver_data = hostap_deliver_data; + vap->iv_recv_pspoll = ieee80211_recv_pspoll; } static void @@ -645,7 +645,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) */ if (((wh->i_fc[1] & IEEE80211_FC1_PWR_MGT) ^ (ni->ni_flags & IEEE80211_NODE_PWR_MGT))) - ieee80211_node_pwrsave(ni, + vap->iv_node_ps(ni, wh->i_fc[1] & IEEE80211_FC1_PWR_MGT); /* * For 4-address packets handle WDS discovery @@ -2240,7 +2240,7 @@ hostap_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype) { switch (subtype) { case IEEE80211_FC0_SUBTYPE_PS_POLL: - hostap_recv_pspoll(ni, m); + ni->ni_vap->iv_recv_pspoll(ni, m); break; case IEEE80211_FC0_SUBTYPE_BAR: ieee80211_recv_bar(ni, m); @@ -2251,8 +2251,8 @@ hostap_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype) /* * Process a received ps-poll frame. */ -static void -hostap_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0) +void +ieee80211_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0) { struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_frame_min *wh; diff --git a/sys/net80211/ieee80211_hostap.h b/sys/net80211/ieee80211_hostap.h index 87f858d19609..e08c4a04c203 100644 --- a/sys/net80211/ieee80211_hostap.h +++ b/sys/net80211/ieee80211_hostap.h @@ -32,4 +32,10 @@ */ void ieee80211_hostap_attach(struct ieee80211com *); void ieee80211_hostap_detach(struct ieee80211com *); + +/* + * This method can be overridden + */ +void ieee80211_recv_pspoll(struct ieee80211_node *, struct mbuf *); + #endif /* !_NET80211_IEEE80211_HOSTAP_H_ */ diff --git a/sys/net80211/ieee80211_power.c b/sys/net80211/ieee80211_power.c index 11eb141eacef..558e1f36b838 100644 --- a/sys/net80211/ieee80211_power.c +++ b/sys/net80211/ieee80211_power.c @@ -69,6 +69,8 @@ ieee80211_power_vattach(struct ieee80211vap *vap) vap->iv_update_ps = ieee80211_update_ps; vap->iv_set_tim = ieee80211_set_tim; } + vap->iv_node_ps = ieee80211_node_pwrsave; + vap->iv_sta_ps = ieee80211_sta_pwrsave; } void diff --git a/sys/net80211/ieee80211_power.h b/sys/net80211/ieee80211_power.h index 352cdadba58e..55270d2d984a 100644 --- a/sys/net80211/ieee80211_power.h +++ b/sys/net80211/ieee80211_power.h @@ -71,6 +71,11 @@ void ieee80211_power_latevattach(struct ieee80211vap *); struct mbuf *ieee80211_node_psq_dequeue(struct ieee80211_node *ni, int *qlen); int ieee80211_node_psq_drain(struct ieee80211_node *); int ieee80211_node_psq_age(struct ieee80211_node *); + +/* + * Don't call these directly from the stack; they are vap methods + * that should be overridden. + */ int ieee80211_pwrsave(struct ieee80211_node *, struct mbuf *); void ieee80211_node_pwrsave(struct ieee80211_node *, int enable); void ieee80211_sta_pwrsave(struct ieee80211vap *, int enable); diff --git a/sys/net80211/ieee80211_scan.c b/sys/net80211/ieee80211_scan.c index 27f24c10475e..c24b63179298 100644 --- a/sys/net80211/ieee80211_scan.c +++ b/sys/net80211/ieee80211_scan.c @@ -866,7 +866,7 @@ scan_task(void *arg, int pending) vap->iv_state == IEEE80211_S_RUN) { if ((vap->iv_bss->ni_flags & IEEE80211_NODE_PWR_MGT) == 0) { /* Enable station power save mode */ - ieee80211_sta_pwrsave(vap, 1); + vap->iv_sta_ps(vap, 1); /* * Use an 1ms delay so the null data frame has a chance * to go out. @@ -1047,7 +1047,7 @@ done: * waiting for us. */ if (scandone) { - ieee80211_sta_pwrsave(vap, 0); + vap->iv_sta_ps(vap, 0); if (ss->ss_next >= ss->ss_last) { ieee80211_notify_scan_done(vap); ic->ic_flags_ext &= ~IEEE80211_FEXT_BGSCAN; diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 139fa370dc8d..88146f3f3c01 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -402,7 +402,7 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) arg == IEEE80211_FC0_SUBTYPE_ASSOC_RESP); break; case IEEE80211_S_SLEEP: - ieee80211_sta_pwrsave(vap, 0); + vap->iv_sta_ps(vap, 0); break; default: goto invalid; @@ -438,7 +438,7 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) goto invalid; break; case IEEE80211_S_SLEEP: - ieee80211_sta_pwrsave(vap, 1); + vap->iv_sta_ps(vap, 1); break; default: invalid: @@ -1396,7 +1396,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, * we are expecting data. */ ic->ic_lastdata = ticks; - ieee80211_sta_pwrsave(vap, 0); + vap->iv_sta_ps(vap, 0); } #endif ni->ni_dtim_count = tim->tim_count; diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 935b8487a608..7ec00ee427db 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -486,6 +486,11 @@ struct ieee80211vap { /* power save handling */ void (*iv_update_ps)(struct ieee80211vap *, int); int (*iv_set_tim)(struct ieee80211_node *, int); + void (*iv_node_ps)(struct ieee80211_node *, int); + void (*iv_sta_ps)(struct ieee80211vap *, int); + void (*iv_recv_pspoll)(struct ieee80211_node *, + struct mbuf *); + /* state machine processing */ int (*iv_newstate)(struct ieee80211vap *, enum ieee80211_state, int);