p2p.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright (c) 2012 Broadcom Corporation
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef WL_CFGP2P_H_
  17. #define WL_CFGP2P_H_
  18. #include <net/cfg80211.h>
  19. struct brcmf_cfg80211_info;
  20. /* vendor ies max buffer length for probe response or beacon */
  21. #define VNDR_IES_MAX_BUF_LEN 1400
  22. /* normal vendor ies buffer length */
  23. #define VNDR_IES_BUF_LEN 512
  24. /* Structure to hold all saved P2P and WPS IEs for a BSSCFG */
  25. /**
  26. * enum p2p_bss_type - different type of BSS configurations.
  27. *
  28. * @P2PAPI_BSSCFG_PRIMARY: maps to driver's primary bsscfg.
  29. * @P2PAPI_BSSCFG_DEVICE: maps to driver's P2P device discovery bsscfg.
  30. * @P2PAPI_BSSCFG_CONNECTION: maps to driver's P2P connection bsscfg.
  31. * @P2PAPI_BSSCFG_MAX: used for range checking.
  32. */
  33. enum p2p_bss_type {
  34. P2PAPI_BSSCFG_PRIMARY, /* maps to driver's primary bsscfg */
  35. P2PAPI_BSSCFG_DEVICE, /* maps to driver's P2P device discovery bsscfg */
  36. P2PAPI_BSSCFG_CONNECTION, /* maps to driver's P2P connection bsscfg */
  37. P2PAPI_BSSCFG_MAX
  38. };
  39. /**
  40. * struct p2p_bss - peer-to-peer bss related information.
  41. *
  42. * @vif: virtual interface of this P2P bss.
  43. * @private_data: TBD
  44. */
  45. struct p2p_bss {
  46. struct brcmf_cfg80211_vif *vif;
  47. void *private_data;
  48. };
  49. /**
  50. * enum brcmf_p2p_status - P2P specific dongle status.
  51. *
  52. * @BRCMF_P2P_STATUS_IF_ADD: peer-to-peer vif add sent to dongle.
  53. * @BRCMF_P2P_STATUS_IF_DEL: NOT-USED?
  54. * @BRCMF_P2P_STATUS_IF_DELETING: peer-to-peer vif delete sent to dongle.
  55. * @BRCMF_P2P_STATUS_IF_CHANGING: peer-to-peer vif change sent to dongle.
  56. * @BRCMF_P2P_STATUS_IF_CHANGED: peer-to-peer vif change completed on dongle.
  57. * @BRCMF_P2P_STATUS_ACTION_TX_COMPLETED: action frame tx completed.
  58. * @BRCMF_P2P_STATUS_ACTION_TX_NOACK: action frame tx not acked.
  59. * @BRCMF_P2P_STATUS_GO_NEG_PHASE: P2P GO negotiation ongoing.
  60. * @BRCMF_P2P_STATUS_DISCOVER_LISTEN: P2P listen, remaining on channel.
  61. */
  62. enum brcmf_p2p_status {
  63. BRCMF_P2P_STATUS_IF_ADD = 0,
  64. BRCMF_P2P_STATUS_IF_DEL,
  65. BRCMF_P2P_STATUS_IF_DELETING,
  66. BRCMF_P2P_STATUS_IF_CHANGING,
  67. BRCMF_P2P_STATUS_IF_CHANGED,
  68. BRCMF_P2P_STATUS_ACTION_TX_COMPLETED,
  69. BRCMF_P2P_STATUS_ACTION_TX_NOACK,
  70. BRCMF_P2P_STATUS_GO_NEG_PHASE,
  71. BRCMF_P2P_STATUS_DISCOVER_LISTEN
  72. };
  73. /**
  74. * struct brcmf_p2p_info - p2p specific driver information.
  75. *
  76. * @cfg: driver private data for cfg80211 interface.
  77. * @status: status of P2P (see enum brcmf_p2p_status).
  78. * @dev_addr: P2P device address.
  79. * @int_addr: P2P interface address.
  80. * @bss_idx: informate for P2P bss types.
  81. * @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state.
  82. * @ssid: ssid for P2P GO.
  83. * @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state.
  84. * @remain_on_channel: contains copy of struct used by cfg80211.
  85. * @remain_on_channel_cookie: cookie counter for remain on channel cmd
  86. * @next_af_subtype: expected action frame subtype.
  87. * @send_af_done: indication that action frame tx is complete.
  88. */
  89. struct brcmf_p2p_info {
  90. struct brcmf_cfg80211_info *cfg;
  91. unsigned long status;
  92. u8 dev_addr[ETH_ALEN];
  93. u8 int_addr[ETH_ALEN];
  94. struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];
  95. struct timer_list listen_timer;
  96. struct brcmf_ssid ssid;
  97. u8 listen_channel;
  98. struct ieee80211_channel remain_on_channel;
  99. u32 remain_on_channel_cookie;
  100. u8 next_af_subtype;
  101. struct completion send_af_done;
  102. };
  103. void brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg,
  104. struct brcmf_cfg80211_vif *vif);
  105. void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);
  106. struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
  107. enum nl80211_iftype type, u32 *flags,
  108. struct vif_params *params);
  109. int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  110. int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  111. enum brcmf_fil_p2p_if_types if_type);
  112. int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  113. void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  114. int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  115. struct cfg80211_scan_request *request,
  116. struct brcmf_cfg80211_vif *vif);
  117. int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
  118. struct ieee80211_channel *channel,
  119. unsigned int duration, u64 *cookie);
  120. int brcmf_p2p_notify_listen_complete(struct brcmf_if *ifp,
  121. const struct brcmf_event_msg *e,
  122. void *data);
  123. void brcmf_p2p_cancel_remain_on_channel(struct brcmf_if *ifp);
  124. int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
  125. const struct brcmf_event_msg *e,
  126. void *data);
  127. int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp,
  128. const struct brcmf_event_msg *e,
  129. void *data);
  130. bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
  131. struct net_device *ndev,
  132. struct brcmf_fil_af_params_le *af_params);
  133. #endif /* WL_CFGP2P_H_ */