wmm_ac.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * Wi-Fi Multimedia Admission Control (WMM-AC)
  3. * Copyright(c) 2014, Intel Mobile Communication GmbH.
  4. * Copyright(c) 2014, Intel Corporation. All rights reserved.
  5. *
  6. * This software may be distributed under the terms of the BSD license.
  7. * See README for more details.
  8. */
  9. #ifndef WMM_AC_H
  10. #define WMM_AC_H
  11. #include "common/ieee802_11_defs.h"
  12. #include "drivers/driver.h"
  13. struct wpa_supplicant;
  14. #define WMM_AC_ACCESS_POLICY_EDCA 1
  15. #define WMM_AC_FIXED_MSDU_SIZE BIT(15)
  16. #define WMM_AC_MAX_TID 7
  17. #define WMM_AC_MAX_USER_PRIORITY 7
  18. #define WMM_AC_MIN_SBA_UNITY 0x2000
  19. #define WMM_AC_MAX_NOMINAL_MSDU 32767
  20. /**
  21. * struct wmm_ac_assoc_data - WMM Admission Control Association Data
  22. *
  23. * This struct will store any relevant WMM association data needed by WMM AC.
  24. * In case there is a valid WMM association, an instance of this struct will be
  25. * created. In case there is no instance of this struct, the station is not
  26. * associated to a valid WMM BSS and hence, WMM AC will not be used.
  27. */
  28. struct wmm_ac_assoc_data {
  29. struct {
  30. /*
  31. * acm - Admission Control Mandatory
  32. * In case an access category is ACM, the traffic will have
  33. * to be admitted by WMM-AC's admission mechanism before use.
  34. */
  35. unsigned int acm:1;
  36. /*
  37. * uapsd_queues - Unscheduled Automatic Power Save Delivery
  38. * queues.
  39. * Indicates whether ACs are configured for U-APSD (or legacy
  40. * PS). Storing this value is necessary in order to set the
  41. * Power Save Bit (PSB) in ADDTS request Action frames (if not
  42. * given).
  43. */
  44. unsigned int uapsd:1;
  45. } ac_params[WMM_AC_NUM];
  46. };
  47. /**
  48. * wmm_ac_dir - WMM Admission Control Direction
  49. */
  50. enum wmm_ac_dir {
  51. WMM_AC_DIR_UPLINK = 0,
  52. WMM_AC_DIR_DOWNLINK = 1,
  53. WMM_AC_DIR_BIDIRECTIONAL = 3
  54. };
  55. /**
  56. * ts_dir_idx - indices of internally saved tspecs
  57. *
  58. * we can have multiple tspecs (downlink + uplink) per ac.
  59. * save them in array, and use the enum to directly access
  60. * the respective tspec slot (according to the direction).
  61. */
  62. enum ts_dir_idx {
  63. TS_DIR_IDX_UPLINK,
  64. TS_DIR_IDX_DOWNLINK,
  65. TS_DIR_IDX_BIDI,
  66. TS_DIR_IDX_COUNT
  67. };
  68. #define TS_DIR_IDX_ALL (BIT(TS_DIR_IDX_COUNT) - 1)
  69. /**
  70. * struct wmm_ac_addts_request - ADDTS Request Information
  71. *
  72. * The last sent ADDTS request(s) will be saved as element(s) of this struct in
  73. * order to be compared with the received ADDTS response in ADDTS response
  74. * action frame handling and should be stored until that point.
  75. * In case a new traffic stream will be created/replaced/updated, only its
  76. * relevant traffic stream information will be stored as a wmm_ac_ts struct.
  77. */
  78. struct wmm_ac_addts_request {
  79. /*
  80. * dialog token - Used to link the received ADDTS response with this
  81. * saved ADDTS request when ADDTS response is being handled
  82. */
  83. u8 dialog_token;
  84. /*
  85. * address - The alleged traffic stream's receiver/transmitter address
  86. * Address and TID are used to identify the TS (TID is contained in
  87. * TSPEC)
  88. */
  89. u8 address[ETH_ALEN];
  90. /*
  91. * tspec - Traffic Stream Specification, will be used to compare the
  92. * sent TSPEC in ADDTS request to the received TSPEC in ADDTS response
  93. * and act accordingly in ADDTS response handling
  94. */
  95. struct wmm_tspec_element tspec;
  96. };
  97. /**
  98. * struct wmm_ac_ts_setup_params - TS setup parameters
  99. *
  100. * This struct holds parameters which should be provided
  101. * to wmm_ac_ts_setup in order to setup a traffic stream
  102. */
  103. struct wmm_ac_ts_setup_params {
  104. /*
  105. * tsid - Traffic ID
  106. * TID and address are used to identify the TS
  107. */
  108. int tsid;
  109. /*
  110. * direction - Traffic Stream's direction
  111. */
  112. enum wmm_ac_dir direction;
  113. /*
  114. * user_priority - Traffic Stream's user priority
  115. */
  116. int user_priority;
  117. /*
  118. * nominal_msdu_size - Nominal MAC service data unit size
  119. */
  120. int nominal_msdu_size;
  121. /*
  122. * fixed_nominal_msdu - Whether the size is fixed
  123. * 0 = Nominal MSDU size is not fixed
  124. * 1 = Nominal MSDU size is fixed
  125. */
  126. int fixed_nominal_msdu;
  127. /*
  128. * surplus_bandwidth_allowance - Specifies excess time allocation
  129. */
  130. int mean_data_rate;
  131. /*
  132. * minimum_phy_rate - Specifies the minimum supported PHY rate in bps
  133. */
  134. int minimum_phy_rate;
  135. /*
  136. * surplus_bandwidth_allowance - Specifies excess time allocation
  137. */
  138. int surplus_bandwidth_allowance;
  139. };
  140. void wmm_ac_notify_assoc(struct wpa_supplicant *wpa_s, const u8 *ies,
  141. size_t ies_len, const struct wmm_params *wmm_params);
  142. void wmm_ac_notify_disassoc(struct wpa_supplicant *wpa_s);
  143. int wpas_wmm_ac_addts(struct wpa_supplicant *wpa_s,
  144. struct wmm_ac_ts_setup_params *params);
  145. int wpas_wmm_ac_delts(struct wpa_supplicant *wpa_s, u8 tsid);
  146. void wmm_ac_rx_action(struct wpa_supplicant *wpa_s, const u8 *da,
  147. const u8 *sa, const u8 *data, size_t len);
  148. int wpas_wmm_ac_status(struct wpa_supplicant *wpa_s, char *buf, size_t buflen);
  149. void wmm_ac_save_tspecs(struct wpa_supplicant *wpa_s);
  150. void wmm_ac_clear_saved_tspecs(struct wpa_supplicant *wpa_s);
  151. int wmm_ac_restore_tspecs(struct wpa_supplicant *wpa_s);
  152. #endif /* WMM_AC_H */