wmm.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Marvell Wireless LAN device driver: WMM
  3. *
  4. * Copyright (C) 2011-2014, Marvell International Ltd.
  5. *
  6. * This software file (the "File") is distributed by Marvell International
  7. * Ltd. under the terms of the GNU General Public License Version 2, June 1991
  8. * (the "License"). You may use, redistribute and/or modify this File in
  9. * accordance with the terms and conditions of the License, a copy of which
  10. * is available by writing to the Free Software Foundation, Inc.,
  11. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
  12. * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
  13. *
  14. * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
  15. * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
  16. * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
  17. * this warranty disclaimer.
  18. */
  19. #ifndef _MWIFIEX_WMM_H_
  20. #define _MWIFIEX_WMM_H_
  21. enum ieee_types_wmm_aciaifsn_bitmasks {
  22. MWIFIEX_AIFSN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
  23. MWIFIEX_ACM = BIT(4),
  24. MWIFIEX_ACI = (BIT(5) | BIT(6)),
  25. };
  26. enum ieee_types_wmm_ecw_bitmasks {
  27. MWIFIEX_ECW_MIN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)),
  28. MWIFIEX_ECW_MAX = (BIT(4) | BIT(5) | BIT(6) | BIT(7)),
  29. };
  30. static const u16 mwifiex_1d_to_wmm_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 };
  31. /*
  32. * This table inverses the tos_to_tid operation to get a priority
  33. * which is in sequential order, and can be compared.
  34. * Use this to compare the priority of two different TIDs.
  35. */
  36. static const u8 tos_to_tid_inv[] = {
  37. 0x02, /* from tos_to_tid[2] = 0 */
  38. 0x00, /* from tos_to_tid[0] = 1 */
  39. 0x01, /* from tos_to_tid[1] = 2 */
  40. 0x03,
  41. 0x04,
  42. 0x05,
  43. 0x06,
  44. 0x07};
  45. /*
  46. * This function retrieves the TID of the given RA list.
  47. */
  48. static inline int
  49. mwifiex_get_tid(struct mwifiex_ra_list_tbl *ptr)
  50. {
  51. struct sk_buff *skb;
  52. if (skb_queue_empty(&ptr->skb_head))
  53. return 0;
  54. skb = skb_peek(&ptr->skb_head);
  55. return skb->priority;
  56. }
  57. /*
  58. * This function gets the length of a list.
  59. */
  60. static inline int
  61. mwifiex_wmm_list_len(struct list_head *head)
  62. {
  63. struct list_head *pos;
  64. int count = 0;
  65. list_for_each(pos, head)
  66. ++count;
  67. return count;
  68. }
  69. /*
  70. * This function checks if a RA list is empty or not.
  71. */
  72. static inline u8
  73. mwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead)
  74. {
  75. struct mwifiex_ra_list_tbl *ra_list;
  76. int is_list_empty;
  77. list_for_each_entry(ra_list, ra_list_hhead, list) {
  78. is_list_empty = skb_queue_empty(&ra_list->skb_head);
  79. if (!is_list_empty)
  80. return false;
  81. }
  82. return true;
  83. }
  84. void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
  85. struct sk_buff *skb);
  86. void mwifiex_wmm_add_buf_bypass_txqueue(struct mwifiex_private *priv,
  87. struct sk_buff *skb);
  88. void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra);
  89. void mwifiex_rotate_priolists(struct mwifiex_private *priv,
  90. struct mwifiex_ra_list_tbl *ra, int tid);
  91. int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter);
  92. int mwifiex_bypass_txlist_empty(struct mwifiex_adapter *adapter);
  93. void mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter);
  94. void mwifiex_process_bypass_tx(struct mwifiex_adapter *adapter);
  95. int mwifiex_is_ralist_valid(struct mwifiex_private *priv,
  96. struct mwifiex_ra_list_tbl *ra_list, int tid);
  97. u8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv,
  98. const struct sk_buff *skb);
  99. void mwifiex_wmm_init(struct mwifiex_adapter *adapter);
  100. u32 mwifiex_wmm_process_association_req(struct mwifiex_private *priv,
  101. u8 **assoc_buf,
  102. struct ieee_types_wmm_parameter *wmmie,
  103. struct ieee80211_ht_cap *htcap);
  104. void mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv,
  105. struct ieee_types_wmm_parameter *wmm_ie);
  106. void mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv);
  107. int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
  108. const struct host_cmd_ds_command *resp);
  109. struct mwifiex_ra_list_tbl *
  110. mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid,
  111. const u8 *ra_addr);
  112. u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid);
  113. void mwifiex_update_ralist_tx_pause(struct mwifiex_private *priv, u8 *mac,
  114. u8 tx_pause);
  115. void mwifiex_update_ralist_tx_pause_in_tdls_cs(struct mwifiex_private *priv,
  116. u8 *mac, u8 tx_pause);
  117. struct mwifiex_ra_list_tbl *mwifiex_wmm_get_ralist_node(struct mwifiex_private
  118. *priv, u8 tid, const u8 *ra_addr);
  119. #endif /* !_MWIFIEX_WMM_H_ */