The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/net80211/ieee80211_ht.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   24  *
   25  * $FreeBSD: releng/11.0/sys/net80211/ieee80211_ht.h 297603 2016-04-06 01:21:51Z adrian $
   26  */
   27 #ifndef _NET80211_IEEE80211_HT_H_
   28 #define _NET80211_IEEE80211_HT_H_
   29 
   30 /*
   31  * 802.11n protocol implementation definitions.
   32  */
   33 
   34 #define IEEE80211_AGGR_BAWMAX   64      /* max block ack window size */
   35 /* threshold for aging overlapping non-HT bss */
   36 #define IEEE80211_NONHT_PRESENT_AGE     msecs_to_ticks(60*1000)
   37 
   38 struct ieee80211_tx_ampdu {
   39         struct ieee80211_node *txa_ni;  /* back pointer */
   40         u_short         txa_flags;
   41 #define IEEE80211_AGGR_IMMEDIATE        0x0001  /* BA policy */
   42 #define IEEE80211_AGGR_XCHGPEND         0x0002  /* ADDBA response pending */
   43 #define IEEE80211_AGGR_RUNNING          0x0004  /* ADDBA response received */
   44 #define IEEE80211_AGGR_SETUP            0x0008  /* deferred state setup */
   45 #define IEEE80211_AGGR_NAK              0x0010  /* peer NAK'd ADDBA request */
   46 #define IEEE80211_AGGR_BARPEND          0x0020  /* BAR response pending */
   47         uint8_t         txa_tid;
   48         uint8_t         txa_token;      /* dialog token */
   49         int             txa_lastsample; /* ticks @ last traffic sample */
   50         int             txa_pkts;       /* packets over last sample interval */
   51         int             txa_avgpps;     /* filtered traffic over window */
   52         int             txa_qbytes;     /* data queued (bytes) */
   53         short           txa_qframes;    /* data queued (frames) */
   54         ieee80211_seq   txa_start;      /* BA window left edge */
   55         ieee80211_seq   txa_seqpending; /* new txa_start pending BAR response */
   56         uint16_t        txa_wnd;        /* BA window size */
   57         uint8_t         txa_attempts;   /* # ADDBA/BAR requests w/o a response*/
   58         int             txa_nextrequest;/* soonest to make next request */
   59         struct callout  txa_timer;
   60         void            *txa_private;   /* driver-private storage */
   61         uint64_t        txa_pad[4];
   62 };
   63 
   64 /* return non-zero if AMPDU tx for the TID is running */
   65 #define IEEE80211_AMPDU_RUNNING(tap) \
   66         (((tap)->txa_flags & IEEE80211_AGGR_RUNNING) != 0)
   67 
   68 /* return non-zero if AMPDU tx for the TID was NACKed */
   69 #define IEEE80211_AMPDU_NACKED(tap)\
   70         (!! ((tap)->txa_flags & IEEE80211_AGGR_NAK))
   71 
   72 /* return non-zero if AMPDU tx for the TID is running or started */
   73 #define IEEE80211_AMPDU_REQUESTED(tap) \
   74         (((tap)->txa_flags & \
   75          (IEEE80211_AGGR_RUNNING|IEEE80211_AGGR_XCHGPEND|IEEE80211_AGGR_NAK)) != 0)
   76 
   77 #define IEEE80211_AGGR_BITS \
   78         "\2\1IMMEDIATE\2XCHGPEND\3RUNNING\4SETUP\5NAK"
   79 
   80 /*
   81  * Traffic estimator support.  We estimate packets/sec for
   82  * each AC that is setup for AMPDU or will potentially be
   83  * setup for AMPDU.  The traffic rate can be used to decide
   84  * when AMPDU should be setup (according to a threshold)
   85  * and is available for drivers to do things like cache
   86  * eviction when only a limited number of BA streams are
   87  * available and more streams are requested than available.
   88  */
   89 
   90 static __inline void
   91 ieee80211_txampdu_init_pps(struct ieee80211_tx_ampdu *tap)
   92 {
   93         /*
   94          * Reset packet estimate.
   95          */
   96         tap->txa_lastsample = ticks;
   97         tap->txa_avgpps = 0;
   98 }
   99 
  100 static __inline void
  101 ieee80211_txampdu_update_pps(struct ieee80211_tx_ampdu *tap)
  102 {
  103 
  104         /* NB: scale factor of 2 was picked heuristically */
  105         tap->txa_avgpps = ((tap->txa_avgpps << 2) -
  106              tap->txa_avgpps + tap->txa_pkts) >> 2;
  107 }
  108 
  109 /*
  110  * Count a packet towards the pps estimate.
  111  */
  112 static __inline void
  113 ieee80211_txampdu_count_packet(struct ieee80211_tx_ampdu *tap)
  114 {
  115 
  116         /* XXX bound loop/do more crude estimate? */
  117         while (ticks - tap->txa_lastsample >= hz) {
  118                 ieee80211_txampdu_update_pps(tap);
  119                 /* reset to start new sample interval */
  120                 tap->txa_pkts = 0;
  121                 if (tap->txa_avgpps == 0) {
  122                         tap->txa_lastsample = ticks;
  123                         break;
  124                 }
  125                 tap->txa_lastsample += hz;
  126         }
  127         tap->txa_pkts++;
  128 }
  129 
  130 /*
  131  * Get the current pps estimate.  If the average is out of
  132  * date due to lack of traffic then we decay the estimate
  133  * to account for the idle time.
  134  */
  135 static __inline int
  136 ieee80211_txampdu_getpps(struct ieee80211_tx_ampdu *tap)
  137 {
  138         /* XXX bound loop/do more crude estimate? */
  139         while (ticks - tap->txa_lastsample >= hz) {
  140                 ieee80211_txampdu_update_pps(tap);
  141                 tap->txa_pkts = 0;
  142                 if (tap->txa_avgpps == 0) {
  143                         tap->txa_lastsample = ticks;
  144                         break;
  145                 }
  146                 tap->txa_lastsample += hz;
  147         }
  148         return tap->txa_avgpps;
  149 }
  150 
  151 struct ieee80211_rx_ampdu {
  152         int             rxa_flags;
  153         int             rxa_qbytes;     /* data queued (bytes) */
  154         short           rxa_qframes;    /* data queued (frames) */
  155         ieee80211_seq   rxa_seqstart;
  156         ieee80211_seq   rxa_start;      /* start of current BA window */
  157         uint16_t        rxa_wnd;        /* BA window size */
  158         int             rxa_age;        /* age of oldest frame in window */
  159         int             rxa_nframes;    /* frames since ADDBA */
  160         struct mbuf *rxa_m[IEEE80211_AGGR_BAWMAX];
  161         void            *rxa_private;
  162         uint64_t        rxa_pad[3];
  163 };
  164 
  165 void    ieee80211_ht_attach(struct ieee80211com *);
  166 void    ieee80211_ht_detach(struct ieee80211com *);
  167 void    ieee80211_ht_vattach(struct ieee80211vap *);
  168 void    ieee80211_ht_vdetach(struct ieee80211vap *);
  169 
  170 void    ieee80211_ht_announce(struct ieee80211com *);
  171 
  172 struct ieee80211_mcs_rates {
  173         uint16_t        ht20_rate_800ns;
  174         uint16_t        ht20_rate_400ns;
  175         uint16_t        ht40_rate_800ns;
  176         uint16_t        ht40_rate_400ns;
  177 };
  178 extern const struct ieee80211_mcs_rates ieee80211_htrates[];
  179 const struct ieee80211_htrateset *ieee80211_get_suphtrates(
  180                 struct ieee80211com *, const struct ieee80211_channel *);
  181 
  182 struct ieee80211_node;
  183 int     ieee80211_setup_htrates(struct ieee80211_node *,
  184                 const uint8_t *htcap, int flags);
  185 void    ieee80211_setup_basic_htrates(struct ieee80211_node *,
  186                 const uint8_t *htinfo);
  187 struct mbuf *ieee80211_decap_amsdu(struct ieee80211_node *, struct mbuf *);
  188 int     ieee80211_ampdu_reorder(struct ieee80211_node *, struct mbuf *);
  189 void    ieee80211_recv_bar(struct ieee80211_node *, struct mbuf *);
  190 void    ieee80211_ht_node_init(struct ieee80211_node *);
  191 void    ieee80211_ht_node_cleanup(struct ieee80211_node *);
  192 void    ieee80211_ht_node_age(struct ieee80211_node *);
  193 
  194 struct ieee80211_channel *ieee80211_ht_adjust_channel(struct ieee80211com *,
  195                 struct ieee80211_channel *, int);
  196 void    ieee80211_ht_wds_init(struct ieee80211_node *);
  197 void    ieee80211_ht_node_join(struct ieee80211_node *);
  198 void    ieee80211_ht_node_leave(struct ieee80211_node *);
  199 void    ieee80211_htprot_update(struct ieee80211com *, int protmode);
  200 void    ieee80211_ht_timeout(struct ieee80211com *);
  201 void    ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *);
  202 void    ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *);
  203 int     ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *,
  204                 const uint8_t *);
  205 void    ieee80211_ht_updatehtcap(struct ieee80211_node *, const uint8_t *);
  206 int     ieee80211_ampdu_request(struct ieee80211_node *,
  207                 struct ieee80211_tx_ampdu *);
  208 void    ieee80211_ampdu_stop(struct ieee80211_node *,
  209                 struct ieee80211_tx_ampdu *, int);
  210 int     ieee80211_send_bar(struct ieee80211_node *, struct ieee80211_tx_ampdu *,
  211                 ieee80211_seq);
  212 uint8_t *ieee80211_add_htcap(uint8_t *, struct ieee80211_node *);
  213 uint8_t *ieee80211_add_htcap_vendor(uint8_t *, struct ieee80211_node *);
  214 uint8_t *ieee80211_add_htinfo(uint8_t *, struct ieee80211_node *);
  215 uint8_t *ieee80211_add_htinfo_vendor(uint8_t *, struct ieee80211_node *);
  216 struct ieee80211_beacon_offsets;
  217 void    ieee80211_ht_update_beacon(struct ieee80211vap *,
  218                 struct ieee80211_beacon_offsets *);
  219 int     ieee80211_ampdu_rx_start_ext(struct ieee80211_node *ni, int tid,
  220             int seq, int baw);
  221 int     ieee80211_ampdu_tx_request_ext(struct ieee80211_node *ni, int tid);
  222 int     ieee80211_ampdu_tx_request_active_ext(struct ieee80211_node *ni,
  223             int tid, int status);
  224 
  225 #endif /* _NET80211_IEEE80211_HT_H_ */

Cache object: d4a08d7d763f2f30d87146b03e6f0801


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.