15b16c28cSSam Leffler /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3fe267a55SPedro F. Giffuni * 45b16c28cSSam Leffler * Copyright (c) 2009 Sam Leffler, Errno Consulting 55b16c28cSSam Leffler * All rights reserved. 65b16c28cSSam Leffler * 75b16c28cSSam Leffler * Redistribution and use in source and binary forms, with or without 85b16c28cSSam Leffler * modification, are permitted provided that the following conditions 95b16c28cSSam Leffler * are met: 105b16c28cSSam Leffler * 1. Redistributions of source code must retain the above copyright 115b16c28cSSam Leffler * notice, this list of conditions and the following disclaimer. 125b16c28cSSam Leffler * 2. Redistributions in binary form must reproduce the above copyright 135b16c28cSSam Leffler * notice, this list of conditions and the following disclaimer in the 145b16c28cSSam Leffler * documentation and/or other materials provided with the distribution. 155b16c28cSSam Leffler * 165b16c28cSSam Leffler * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 175b16c28cSSam Leffler * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 185b16c28cSSam Leffler * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 195b16c28cSSam Leffler * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 205b16c28cSSam Leffler * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 215b16c28cSSam Leffler * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 225b16c28cSSam Leffler * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 235b16c28cSSam Leffler * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 245b16c28cSSam Leffler * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 255b16c28cSSam Leffler * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 265b16c28cSSam Leffler */ 275b16c28cSSam Leffler #ifndef _NET80211_IEEE80211_STAGEQ_H_ 285b16c28cSSam Leffler #define _NET80211_IEEE80211_STAGEQ_H_ 295b16c28cSSam Leffler 305b16c28cSSam Leffler struct ieee80211_node; 315b16c28cSSam Leffler struct mbuf; 325b16c28cSSam Leffler 335b16c28cSSam Leffler struct ieee80211_ageq { 345b16c28cSSam Leffler ieee80211_ageq_lock_t aq_lock; 355b16c28cSSam Leffler int aq_len; /* # items on queue */ 365b16c28cSSam Leffler int aq_maxlen; /* max queue length */ 375b16c28cSSam Leffler int aq_drops; /* frames dropped */ 385b16c28cSSam Leffler struct mbuf *aq_head; /* frames linked w/ m_nextpkt */ 395b16c28cSSam Leffler struct mbuf *aq_tail; /* last frame in queue */ 405b16c28cSSam Leffler }; 415b16c28cSSam Leffler 425b16c28cSSam Leffler void ieee80211_ageq_init(struct ieee80211_ageq *, int maxlen, 435b16c28cSSam Leffler const char *name); 445b16c28cSSam Leffler void ieee80211_ageq_cleanup(struct ieee80211_ageq *); 455b16c28cSSam Leffler void ieee80211_ageq_mfree(struct mbuf *); 465b16c28cSSam Leffler int ieee80211_ageq_append(struct ieee80211_ageq *, struct mbuf *, 475b16c28cSSam Leffler int age); 485b16c28cSSam Leffler void ieee80211_ageq_drain(struct ieee80211_ageq *); 495b16c28cSSam Leffler void ieee80211_ageq_drain_node(struct ieee80211_ageq *, 505b16c28cSSam Leffler struct ieee80211_node *); 515b16c28cSSam Leffler struct mbuf *ieee80211_ageq_age(struct ieee80211_ageq *, int quanta); 525b16c28cSSam Leffler struct mbuf *ieee80211_ageq_remove(struct ieee80211_ageq *, 535b16c28cSSam Leffler struct ieee80211_node *match); 545b16c28cSSam Leffler #endif /* _NET80211_IEEE80211_STAGEQ_H_ */ 55