Changeset View
Changeset View
Standalone View
Standalone View
sys/net80211/ieee80211_power.c
Show First 20 Lines • Show All 412 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static void | static void | ||||
pwrsave_flushq(struct ieee80211_node *ni) | pwrsave_flushq(struct ieee80211_node *ni) | ||||
{ | { | ||||
struct ieee80211_psq *psq = &ni->ni_psq; | struct ieee80211_psq *psq = &ni->ni_psq; | ||||
struct ieee80211com *ic = ni->ni_ic; | struct ieee80211com *ic = ni->ni_ic; | ||||
struct ieee80211vap *vap = ni->ni_vap; | struct ieee80211vap *vap = ni->ni_vap; | ||||
struct ieee80211_psq_head *qhead; | struct ieee80211_psq_head *qhead; | ||||
struct ifnet *parent, *ifp; | |||||
struct mbuf *parent_q = NULL, *ifp_q = NULL; | struct mbuf *parent_q = NULL, *ifp_q = NULL; | ||||
struct mbuf *m; | struct mbuf *m; | ||||
IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, | IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, | ||||
"flush ps queue, %u packets queued", psq->psq_len); | "flush ps queue, %u packets queued", psq->psq_len); | ||||
IEEE80211_PSQ_LOCK(psq); | IEEE80211_PSQ_LOCK(psq); | ||||
qhead = &psq->psq_head[0]; /* 802.11 frames */ | qhead = &psq->psq_head[0]; /* 802.11 frames */ | ||||
if (qhead->head != NULL) { | if (qhead->head != NULL) { | ||||
/* XXX could dispatch through vap and check M_ENCAP */ | /* XXX could dispatch through vap and check M_ENCAP */ | ||||
parent = vap->iv_ic->ic_ifp; | |||||
/* XXX need different driver interface */ | /* XXX need different driver interface */ | ||||
/* XXX bypasses q max and OACTIVE */ | /* XXX bypasses q max and OACTIVE */ | ||||
parent_q = qhead->head; | parent_q = qhead->head; | ||||
qhead->head = qhead->tail = NULL; | qhead->head = qhead->tail = NULL; | ||||
qhead->len = 0; | qhead->len = 0; | ||||
} else | } | ||||
parent = NULL; | |||||
qhead = &psq->psq_head[1]; /* 802.3 frames */ | qhead = &psq->psq_head[1]; /* 802.3 frames */ | ||||
if (qhead->head != NULL) { | if (qhead->head != NULL) { | ||||
ifp = vap->iv_ifp; | |||||
/* XXX need different driver interface */ | /* XXX need different driver interface */ | ||||
/* XXX bypasses q max and OACTIVE */ | /* XXX bypasses q max and OACTIVE */ | ||||
ifp_q = qhead->head; | ifp_q = qhead->head; | ||||
qhead->head = qhead->tail = NULL; | qhead->head = qhead->tail = NULL; | ||||
qhead->len = 0; | qhead->len = 0; | ||||
} else | } | ||||
ifp = NULL; | |||||
psq->psq_len = 0; | psq->psq_len = 0; | ||||
IEEE80211_PSQ_UNLOCK(psq); | IEEE80211_PSQ_UNLOCK(psq); | ||||
/* NB: do this outside the psq lock */ | /* NB: do this outside the psq lock */ | ||||
/* XXX packets might get reordered if parent is OACTIVE */ | /* XXX packets might get reordered if parent is OACTIVE */ | ||||
/* parent frames, should be encapsulated */ | /* parent frames, should be encapsulated */ | ||||
if (parent != NULL) { | |||||
while (parent_q != NULL) { | while (parent_q != NULL) { | ||||
m = parent_q; | m = parent_q; | ||||
parent_q = m->m_nextpkt; | parent_q = m->m_nextpkt; | ||||
m->m_nextpkt = NULL; | m->m_nextpkt = NULL; | ||||
/* must be encapsulated */ | /* must be encapsulated */ | ||||
KASSERT((m->m_flags & M_ENCAP), | KASSERT((m->m_flags & M_ENCAP), | ||||
("%s: parentq with non-M_ENCAP frame!\n", | ("%s: parentq with non-M_ENCAP frame!\n", | ||||
__func__)); | __func__)); | ||||
/* | /* | ||||
* For encaped frames, we need to free the node | * For encaped frames, we need to free the node | ||||
* reference upon failure. | * reference upon failure. | ||||
*/ | */ | ||||
if (ieee80211_parent_xmitpkt(ic, m) != 0) | if (ieee80211_parent_xmitpkt(ic, m) != 0) | ||||
ieee80211_free_node(ni); | ieee80211_free_node(ni); | ||||
} | } | ||||
} | |||||
/* VAP frames, aren't encapsulated */ | /* VAP frames, aren't encapsulated */ | ||||
if (ifp != NULL) { | |||||
while (ifp_q != NULL) { | while (ifp_q != NULL) { | ||||
m = ifp_q; | m = ifp_q; | ||||
ifp_q = m->m_nextpkt; | ifp_q = m->m_nextpkt; | ||||
m->m_nextpkt = NULL; | m->m_nextpkt = NULL; | ||||
KASSERT((!(m->m_flags & M_ENCAP)), | KASSERT((!(m->m_flags & M_ENCAP)), | ||||
("%s: vapq with M_ENCAP frame!\n", __func__)); | ("%s: vapq with M_ENCAP frame!\n", __func__)); | ||||
(void) ieee80211_vap_xmitpkt(vap, m); | (void) ieee80211_vap_xmitpkt(vap, m); | ||||
} | |||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Handle station power-save state change. | * Handle station power-save state change. | ||||
*/ | */ | ||||
void | void | ||||
ieee80211_node_pwrsave(struct ieee80211_node *ni, int enable) | ieee80211_node_pwrsave(struct ieee80211_node *ni, int enable) | ||||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |