/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2002-2008 Sam Leffler, Errno Consulting4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR16* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES17* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.18* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,19* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT20* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,21* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY22* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF24* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.25*/26#ifndef _NET80211_IEEE80211_POWER_H_27#define _NET80211_IEEE80211_POWER_H_2829struct ieee80211com;30struct ieee80211vap;31struct ieee80211_node;32struct mbuf;3334/*35* Power save packet queues. There are two queues, one36* for frames coming from the net80211 layer and the other37* for frames that come from the driver. Frames from the38* driver are expected to have M_ENCAP marked to indicate39* they have already been encapsulated and are treated as40* higher priority: they are sent first when flushing the41* queue on a power save state change or in response to a42* ps-poll frame.43*44* Note that frames sent from the high priority queue are45* fed directly to the driver without going through46* ieee80211_start again; drivers that send up encap'd47* frames are required to handle them when they come back.48*/49struct ieee80211_psq {50ieee80211_psq_lock_t psq_lock;51int psq_len;52int psq_maxlen;53int psq_drops;54struct ieee80211_psq_head {55struct mbuf *head;56struct mbuf *tail;57int len;58} psq_head[2]; /* 2 priorities */59};6061void ieee80211_psq_init(struct ieee80211_psq *, const char *);62void ieee80211_psq_cleanup(struct ieee80211_psq *);6364void ieee80211_power_attach(struct ieee80211com *);65void ieee80211_power_detach(struct ieee80211com *);66void ieee80211_power_vattach(struct ieee80211vap *);67void ieee80211_power_vdetach(struct ieee80211vap *);68void ieee80211_power_latevattach(struct ieee80211vap *);6970struct mbuf *ieee80211_node_psq_dequeue(struct ieee80211_node *ni, int *qlen);71int ieee80211_node_psq_drain(struct ieee80211_node *);72int ieee80211_node_psq_age(struct ieee80211_node *);7374/*75* Don't call these directly from the stack; they are vap methods76* that should be overridden.77*/78int ieee80211_pwrsave(struct ieee80211_node *, struct mbuf *);79void ieee80211_node_pwrsave(struct ieee80211_node *, int enable);80void ieee80211_sta_pwrsave(struct ieee80211vap *, int enable);81void ieee80211_sta_tim_notify(struct ieee80211vap *vap, int set);82void ieee80211_sta_ps_timer_check(struct ieee80211vap *vap);8384/* XXX what's this? */85void ieee80211_power_poll(struct ieee80211com *);86#endif /* _NET80211_IEEE80211_POWER_H_ */878889