wl12xx_80211.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __WL12XX_80211_H__
  3. #define __WL12XX_80211_H__
  4. #include <linux/if_ether.h> /* ETH_ALEN */
  5. /* RATES */
  6. #define IEEE80211_CCK_RATE_1MB 0x02
  7. #define IEEE80211_CCK_RATE_2MB 0x04
  8. #define IEEE80211_CCK_RATE_5MB 0x0B
  9. #define IEEE80211_CCK_RATE_11MB 0x16
  10. #define IEEE80211_OFDM_RATE_6MB 0x0C
  11. #define IEEE80211_OFDM_RATE_9MB 0x12
  12. #define IEEE80211_OFDM_RATE_12MB 0x18
  13. #define IEEE80211_OFDM_RATE_18MB 0x24
  14. #define IEEE80211_OFDM_RATE_24MB 0x30
  15. #define IEEE80211_OFDM_RATE_36MB 0x48
  16. #define IEEE80211_OFDM_RATE_48MB 0x60
  17. #define IEEE80211_OFDM_RATE_54MB 0x6C
  18. #define IEEE80211_BASIC_RATE_MASK 0x80
  19. #define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
  20. #define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
  21. #define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
  22. #define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
  23. #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
  24. #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
  25. #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
  26. #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
  27. #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
  28. #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
  29. #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
  30. #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
  31. #define IEEE80211_CCK_RATES_MASK 0x0000000F
  32. #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
  33. IEEE80211_CCK_RATE_2MB_MASK)
  34. #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
  35. IEEE80211_CCK_RATE_5MB_MASK | \
  36. IEEE80211_CCK_RATE_11MB_MASK)
  37. #define IEEE80211_OFDM_RATES_MASK 0x00000FF0
  38. #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
  39. IEEE80211_OFDM_RATE_12MB_MASK | \
  40. IEEE80211_OFDM_RATE_24MB_MASK)
  41. #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
  42. IEEE80211_OFDM_RATE_9MB_MASK | \
  43. IEEE80211_OFDM_RATE_18MB_MASK | \
  44. IEEE80211_OFDM_RATE_36MB_MASK | \
  45. IEEE80211_OFDM_RATE_48MB_MASK | \
  46. IEEE80211_OFDM_RATE_54MB_MASK)
  47. #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
  48. IEEE80211_CCK_DEFAULT_RATES_MASK)
  49. /* This really should be 8, but not for our firmware */
  50. #define MAX_SUPPORTED_RATES 32
  51. #define MAX_COUNTRY_TRIPLETS 32
  52. /* Headers */
  53. struct ieee80211_header {
  54. __le16 frame_ctl;
  55. __le16 duration_id;
  56. u8 da[ETH_ALEN];
  57. u8 sa[ETH_ALEN];
  58. u8 bssid[ETH_ALEN];
  59. __le16 seq_ctl;
  60. u8 payload[0];
  61. } __packed;
  62. struct wl12xx_ie_header {
  63. u8 id;
  64. u8 len;
  65. } __packed;
  66. /* IEs */
  67. struct wl12xx_ie_ssid {
  68. struct wl12xx_ie_header header;
  69. char ssid[IEEE80211_MAX_SSID_LEN];
  70. } __packed;
  71. struct wl12xx_ie_rates {
  72. struct wl12xx_ie_header header;
  73. u8 rates[MAX_SUPPORTED_RATES];
  74. } __packed;
  75. struct wl12xx_ie_ds_params {
  76. struct wl12xx_ie_header header;
  77. u8 channel;
  78. } __packed;
  79. struct country_triplet {
  80. u8 channel;
  81. u8 num_channels;
  82. u8 max_tx_power;
  83. } __packed;
  84. struct wl12xx_ie_country {
  85. struct wl12xx_ie_header header;
  86. u8 country_string[IEEE80211_COUNTRY_STRING_LEN];
  87. struct country_triplet triplets[MAX_COUNTRY_TRIPLETS];
  88. } __packed;
  89. /* Templates */
  90. struct wl12xx_beacon_template {
  91. struct ieee80211_header header;
  92. __le32 time_stamp[2];
  93. __le16 beacon_interval;
  94. __le16 capability;
  95. struct wl12xx_ie_ssid ssid;
  96. struct wl12xx_ie_rates rates;
  97. struct wl12xx_ie_rates ext_rates;
  98. struct wl12xx_ie_ds_params ds_params;
  99. struct wl12xx_ie_country country;
  100. } __packed;
  101. struct wl12xx_null_data_template {
  102. struct ieee80211_header header;
  103. } __packed;
  104. struct wl12xx_ps_poll_template {
  105. __le16 fc;
  106. __le16 aid;
  107. u8 bssid[ETH_ALEN];
  108. u8 ta[ETH_ALEN];
  109. } __packed;
  110. struct wl12xx_qos_null_data_template {
  111. struct ieee80211_header header;
  112. __le16 qos_ctl;
  113. } __packed;
  114. struct wl12xx_probe_req_template {
  115. struct ieee80211_header header;
  116. struct wl12xx_ie_ssid ssid;
  117. struct wl12xx_ie_rates rates;
  118. struct wl12xx_ie_rates ext_rates;
  119. } __packed;
  120. struct wl12xx_probe_resp_template {
  121. struct ieee80211_header header;
  122. __le32 time_stamp[2];
  123. __le16 beacon_interval;
  124. __le16 capability;
  125. struct wl12xx_ie_ssid ssid;
  126. struct wl12xx_ie_rates rates;
  127. struct wl12xx_ie_rates ext_rates;
  128. struct wl12xx_ie_ds_params ds_params;
  129. struct wl12xx_ie_country country;
  130. } __packed;
  131. #endif