ieee802_11_he.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * hostapd / IEEE 802.11ax HE
  3. * Copyright (c) 2016-2017, Qualcomm Atheros, Inc.
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #include "utils/includes.h"
  9. #include "utils/common.h"
  10. #include "common/ieee802_11_defs.h"
  11. #include "hostapd.h"
  12. #include "ap_config.h"
  13. #include "beacon.h"
  14. #include "ieee802_11.h"
  15. #include "dfs.h"
  16. u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid)
  17. {
  18. struct ieee80211_he_capabilities *cap;
  19. u8 *pos = eid;
  20. if (!hapd->iface->current_mode)
  21. return eid;
  22. *pos++ = WLAN_EID_EXTENSION;
  23. *pos++ = 1 + sizeof(struct ieee80211_he_capabilities);
  24. *pos++ = WLAN_EID_EXT_HE_CAPABILITIES;
  25. cap = (struct ieee80211_he_capabilities *) pos;
  26. os_memset(cap, 0, sizeof(*cap));
  27. if (hapd->iface->conf->he_phy_capab.he_su_beamformer)
  28. cap->he_phy_capab_info[HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX] |=
  29. HE_PHYCAP_SU_BEAMFORMER_CAPAB;
  30. if (hapd->iface->conf->he_phy_capab.he_su_beamformee)
  31. cap->he_phy_capab_info[HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX] |=
  32. HE_PHYCAP_SU_BEAMFORMEE_CAPAB;
  33. if (hapd->iface->conf->he_phy_capab.he_mu_beamformer)
  34. cap->he_phy_capab_info[HE_PHYCAP_MU_BEAMFORMER_CAPAB_IDX] |=
  35. HE_PHYCAP_MU_BEAMFORMER_CAPAB;
  36. pos += sizeof(*cap);
  37. return pos;
  38. }
  39. u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid)
  40. {
  41. struct ieee80211_he_operation *oper;
  42. u8 *pos = eid;
  43. if (!hapd->iface->current_mode)
  44. return eid;
  45. *pos++ = WLAN_EID_EXTENSION;
  46. *pos++ = 1 + sizeof(struct ieee80211_he_operation);
  47. *pos++ = WLAN_EID_EXT_HE_OPERATION;
  48. oper = (struct ieee80211_he_operation *) pos;
  49. os_memset(oper, 0, sizeof(*oper));
  50. if (hapd->iface->conf->he_op.he_bss_color)
  51. oper->he_oper_params |= hapd->iface->conf->he_op.he_bss_color;
  52. if (hapd->iface->conf->he_op.he_default_pe_duration)
  53. oper->he_oper_params |=
  54. (hapd->iface->conf->he_op.he_default_pe_duration <<
  55. HE_OPERATION_DFLT_PE_DURATION_OFFSET);
  56. if (hapd->iface->conf->he_op.he_twt_required)
  57. oper->he_oper_params |= HE_OPERATION_TWT_REQUIRED;
  58. if (hapd->iface->conf->he_op.he_rts_threshold)
  59. oper->he_oper_params |=
  60. (hapd->iface->conf->he_op.he_rts_threshold <<
  61. HE_OPERATION_RTS_THRESHOLD_OFFSET);
  62. /* TODO: conditional MaxBSSID Indicator subfield */
  63. pos += sizeof(*oper);
  64. return pos;
  65. }