1 /* 2 * 802.11e protocol header file 3 * 4 * Copyright (C) 1999-2013, Broadcom Corporation 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * $Id: 802.11e.h 382883 2013-02-04 23:26:09Z $ 19 */ 20 21 #ifndef _802_11e_H_ 22 #define _802_11e_H_ 23 24 #ifndef _TYPEDEFS_H_ 25 #include <typedefs.h> 26 #endif 27 28 /* This marks the start of a packed structure section. */ 29 #include <packed_section_start.h> 30 31 32 /* WME Traffic Specification (TSPEC) element */ 33 #define WME_TSPEC_HDR_LEN 2 /* WME TSPEC header length */ 34 #define WME_TSPEC_BODY_OFF 2 /* WME TSPEC body offset */ 35 36 #define WME_CATEGORY_CODE_OFFSET 0 /* WME Category code offset */ 37 #define WME_ACTION_CODE_OFFSET 1 /* WME Action code offset */ 38 #define WME_TOKEN_CODE_OFFSET 2 /* WME Token code offset */ 39 #define WME_STATUS_CODE_OFFSET 3 /* WME Status code offset */ 40 41 BWL_PRE_PACKED_STRUCT struct tsinfo { 42 uint8 octets[3]; 43 } BWL_POST_PACKED_STRUCT; 44 45 typedef struct tsinfo tsinfo_t; 46 47 /* 802.11e TSPEC IE */ 48 typedef BWL_PRE_PACKED_STRUCT struct tspec { 49 uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */ 50 uint8 type; /* WME_TYPE */ 51 uint8 subtype; /* WME_SUBTYPE_TSPEC */ 52 uint8 version; /* WME_VERSION */ 53 tsinfo_t tsinfo; /* TS Info bit field */ 54 uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */ 55 uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */ 56 uint32 min_srv_interval; /* Minimum Service Interval (us) */ 57 uint32 max_srv_interval; /* Maximum Service Interval (us) */ 58 uint32 inactivity_interval; /* Inactivity Interval (us) */ 59 uint32 suspension_interval; /* Suspension Interval (us) */ 60 uint32 srv_start_time; /* Service Start Time (us) */ 61 uint32 min_data_rate; /* Minimum Data Rate (bps) */ 62 uint32 mean_data_rate; /* Mean Data Rate (bps) */ 63 uint32 peak_data_rate; /* Peak Data Rate (bps) */ 64 uint32 max_burst_size; /* Maximum Burst Size (bytes) */ 65 uint32 delay_bound; /* Delay Bound (us) */ 66 uint32 min_phy_rate; /* Minimum PHY Rate (bps) */ 67 uint16 surplus_bw; /* Surplus Bandwidth Allowance (range 1.0-8.0) */ 68 uint16 medium_time; /* Medium Time (32 us/s periods) */ 69 } BWL_POST_PACKED_STRUCT tspec_t; 70 71 #define WME_TSPEC_LEN (sizeof(tspec_t)) /* not including 2-bytes of header */ 72 73 /* ts_info */ 74 /* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */ 75 #define TS_INFO_TID_SHIFT 1 /* TS info. TID shift */ 76 #define TS_INFO_TID_MASK (0xf << TS_INFO_TID_SHIFT) /* TS info. TID mask */ 77 #define TS_INFO_CONTENTION_SHIFT 7 /* TS info. contention shift */ 78 #define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) /* TS info. contention mask */ 79 #define TS_INFO_DIRECTION_SHIFT 5 /* TS info. direction shift */ 80 #define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) /* TS info. direction mask */ 81 #define TS_INFO_PSB_SHIFT 2 /* TS info. PSB bit Shift */ 82 #define TS_INFO_PSB_MASK (1 << TS_INFO_PSB_SHIFT) /* TS info. PSB mask */ 83 #define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) /* TS info. uplink */ 84 #define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) /* TS info. downlink */ 85 #define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) /* TS info. bidirectional */ 86 #define TS_INFO_USER_PRIO_SHIFT 3 /* TS info. user priority shift */ 87 /* TS info. user priority mask */ 88 #define TS_INFO_USER_PRIO_MASK (0x7 << TS_INFO_USER_PRIO_SHIFT) 89 90 /* Macro to get/set bit(s) field in TSINFO */ 91 #define WLC_CAC_GET_TID(pt) ((((pt).octets[0]) & TS_INFO_TID_MASK) >> TS_INFO_TID_SHIFT) 92 #define WLC_CAC_GET_DIR(pt) ((((pt).octets[0]) & \ 93 TS_INFO_DIRECTION_MASK) >> TS_INFO_DIRECTION_SHIFT) 94 #define WLC_CAC_GET_PSB(pt) ((((pt).octets[1]) & TS_INFO_PSB_MASK) >> TS_INFO_PSB_SHIFT) 95 #define WLC_CAC_GET_USER_PRIO(pt) ((((pt).octets[1]) & \ 96 TS_INFO_USER_PRIO_MASK) >> TS_INFO_USER_PRIO_SHIFT) 97 98 #define WLC_CAC_SET_TID(pt, id) ((((pt).octets[0]) & (~TS_INFO_TID_MASK)) | \ 99 ((id) << TS_INFO_TID_SHIFT)) 100 #define WLC_CAC_SET_USER_PRIO(pt, prio) ((((pt).octets[0]) & (~TS_INFO_USER_PRIO_MASK)) | \ 101 ((prio) << TS_INFO_USER_PRIO_SHIFT)) 102 103 /* 802.11e QBSS Load IE */ 104 #define QBSS_LOAD_IE_LEN 5 /* QBSS Load IE length */ 105 #define QBSS_LOAD_AAC_OFF 3 /* AAC offset in IE */ 106 107 #define CAC_ADDTS_RESP_TIMEOUT 1000 /* default ADDTS response timeout in ms */ 108 /* DEFVAL dot11ADDTSResponseTimeout = 1s */ 109 110 /* 802.11e ADDTS status code */ 111 #define DOT11E_STATUS_ADMISSION_ACCEPTED 0 /* TSPEC Admission accepted status */ 112 #define DOT11E_STATUS_ADDTS_INVALID_PARAM 1 /* TSPEC invalid parameter status */ 113 #define DOT11E_STATUS_ADDTS_REFUSED_NSBW 3 /* ADDTS refused (non-sufficient BW) */ 114 #define DOT11E_STATUS_ADDTS_REFUSED_AWHILE 47 /* ADDTS refused but could retry later */ 115 116 /* 802.11e DELTS status code */ 117 #define DOT11E_STATUS_QSTA_LEAVE_QBSS 36 /* STA leave QBSS */ 118 #define DOT11E_STATUS_END_TS 37 /* END TS */ 119 #define DOT11E_STATUS_UNKNOWN_TS 38 /* UNKNOWN TS */ 120 #define DOT11E_STATUS_QSTA_REQ_TIMEOUT 39 /* STA ADDTS request timeout */ 121 122 123 /* This marks the end of a packed structure section. */ 124 #include <packed_section_end.h> 125 126 #endif /* _802_11e_CAC_H_ */ 127