p2p.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. /**
  21. * enum p2p_bss_type - different type of BSS configurations.
  22. *
  23. * @P2PAPI_BSSCFG_PRIMARY: maps to driver's primary bsscfg.
  24. * @P2PAPI_BSSCFG_DEVICE: maps to driver's P2P device discovery bsscfg.
  25. * @P2PAPI_BSSCFG_CONNECTION: maps to driver's P2P connection bsscfg.
  26. * @P2PAPI_BSSCFG_MAX: used for range checking.
  27. */
  28. enum p2p_bss_type {
  29. P2PAPI_BSSCFG_PRIMARY, /* maps to driver's primary bsscfg */
  30. P2PAPI_BSSCFG_DEVICE, /* maps to driver's P2P device discovery bsscfg */
  31. P2PAPI_BSSCFG_CONNECTION, /* maps to driver's P2P connection bsscfg */
  32. P2PAPI_BSSCFG_MAX
  33. };
  34. /**
  35. * struct p2p_bss - peer-to-peer bss related information.
  36. *
  37. * @vif: virtual interface of this P2P bss.
  38. * @private_data: TBD
  39. */
  40. struct p2p_bss {
  41. struct brcmf_cfg80211_vif *vif;
  42. void *private_data;
  43. };
  44. /**
  45. * enum brcmf_p2p_status - P2P specific dongle status.
  46. *
  47. * @BRCMF_P2P_STATUS_IF_ADD: peer-to-peer vif add sent to dongle.
  48. * @BRCMF_P2P_STATUS_IF_DEL: NOT-USED?
  49. * @BRCMF_P2P_STATUS_IF_DELETING: peer-to-peer vif delete sent to dongle.
  50. * @BRCMF_P2P_STATUS_IF_CHANGING: peer-to-peer vif change sent to dongle.
  51. * @BRCMF_P2P_STATUS_IF_CHANGED: peer-to-peer vif change completed on dongle.
  52. * @BRCMF_P2P_STATUS_ACTION_TX_COMPLETED: action frame tx completed.
  53. * @BRCMF_P2P_STATUS_ACTION_TX_NOACK: action frame tx not acked.
  54. * @BRCMF_P2P_STATUS_GO_NEG_PHASE: P2P GO negotiation ongoing.
  55. * @BRCMF_P2P_STATUS_DISCOVER_LISTEN: P2P listen, remaining on channel.
  56. * @BRCMF_P2P_STATUS_SENDING_ACT_FRAME: In the process of sending action frame.
  57. * @BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN: extra listen time for af tx.
  58. * @BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME: waiting for action frame response.
  59. * @BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL: search channel for AF active.
  60. */
  61. enum brcmf_p2p_status {
  62. BRCMF_P2P_STATUS_ENABLED,
  63. BRCMF_P2P_STATUS_IF_ADD,
  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. BRCMF_P2P_STATUS_SENDING_ACT_FRAME,
  73. BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,
  74. BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME,
  75. BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL
  76. };
  77. /**
  78. * struct afx_hdl - action frame off channel storage.
  79. *
  80. * @afx_work: worker thread for searching channel
  81. * @act_frm_scan: thread synchronizing struct.
  82. * @is_active: channel searching active.
  83. * @peer_chan: current channel.
  84. * @is_listen: sets mode for afx worker.
  85. * @my_listen_chan: this peers listen channel.
  86. * @peer_listen_chan: remote peers listen channel.
  87. * @tx_dst_addr: mac address where tx af should be sent to.
  88. */
  89. struct afx_hdl {
  90. struct work_struct afx_work;
  91. struct completion act_frm_scan;
  92. bool is_active;
  93. s32 peer_chan;
  94. bool is_listen;
  95. u16 my_listen_chan;
  96. u16 peer_listen_chan;
  97. u8 tx_dst_addr[ETH_ALEN];
  98. };
  99. /**
  100. * struct brcmf_p2p_info - p2p specific driver information.
  101. *
  102. * @cfg: driver private data for cfg80211 interface.
  103. * @status: status of P2P (see enum brcmf_p2p_status).
  104. * @dev_addr: P2P device address.
  105. * @int_addr: P2P interface address.
  106. * @bss_idx: informate for P2P bss types.
  107. * @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state.
  108. * @ssid: ssid for P2P GO.
  109. * @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state.
  110. * @remain_on_channel: contains copy of struct used by cfg80211.
  111. * @remain_on_channel_cookie: cookie counter for remain on channel cmd
  112. * @next_af_subtype: expected action frame subtype.
  113. * @send_af_done: indication that action frame tx is complete.
  114. * @afx_hdl: action frame search handler info.
  115. * @af_sent_channel: channel action frame is sent.
  116. * @af_tx_sent_jiffies: jiffies time when af tx was transmitted.
  117. * @wait_next_af: thread synchronizing struct.
  118. * @gon_req_action: about to send go negotiation requets frame.
  119. * @block_gon_req_tx: drop tx go negotiation requets frame.
  120. * @p2pdev_dynamically: is p2p device if created by module param or supplicant.
  121. */
  122. struct brcmf_p2p_info {
  123. struct brcmf_cfg80211_info *cfg;
  124. unsigned long status;
  125. u8 dev_addr[ETH_ALEN];
  126. u8 int_addr[ETH_ALEN];
  127. struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];
  128. struct timer_list listen_timer;
  129. struct brcmf_ssid ssid;
  130. u8 listen_channel;
  131. struct ieee80211_channel remain_on_channel;
  132. u32 remain_on_channel_cookie;
  133. u8 next_af_subtype;
  134. struct completion send_af_done;
  135. struct afx_hdl afx_hdl;
  136. u32 af_sent_channel;
  137. unsigned long af_tx_sent_jiffies;
  138. struct completion wait_next_af;
  139. bool gon_req_action;
  140. bool block_gon_req_tx;
  141. bool p2pdev_dynamically;
  142. };
  143. s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);
  144. void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);
  145. struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
  146. unsigned char name_assign_type,
  147. enum nl80211_iftype type, u32 *flags,
  148. struct vif_params *params);
  149. int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  150. int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  151. enum brcmf_fil_p2p_if_types if_type);
  152. void brcmf_p2p_ifp_removed(struct brcmf_if *ifp);
  153. int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  154. void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  155. int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  156. struct cfg80211_scan_request *request,
  157. struct brcmf_cfg80211_vif *vif);
  158. int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
  159. struct ieee80211_channel *channel,
  160. unsigned int duration, u64 *cookie);
  161. int brcmf_p2p_notify_listen_complete(struct brcmf_if *ifp,
  162. const struct brcmf_event_msg *e,
  163. void *data);
  164. void brcmf_p2p_cancel_remain_on_channel(struct brcmf_if *ifp);
  165. int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
  166. const struct brcmf_event_msg *e,
  167. void *data);
  168. int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp,
  169. const struct brcmf_event_msg *e,
  170. void *data);
  171. bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
  172. struct net_device *ndev,
  173. struct brcmf_fil_af_params_le *af_params);
  174. bool brcmf_p2p_scan_finding_common_channel(struct brcmf_cfg80211_info *cfg,
  175. struct brcmf_bss_info_le *bi);
  176. s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
  177. const struct brcmf_event_msg *e,
  178. void *data);
  179. #endif /* WL_CFGP2P_H_ */