p2p.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. */
  57. enum brcmf_p2p_status {
  58. BRCMF_P2P_STATUS_ENABLED,
  59. BRCMF_P2P_STATUS_IF_ADD,
  60. BRCMF_P2P_STATUS_IF_DEL,
  61. BRCMF_P2P_STATUS_IF_DELETING,
  62. BRCMF_P2P_STATUS_IF_CHANGING,
  63. BRCMF_P2P_STATUS_IF_CHANGED,
  64. BRCMF_P2P_STATUS_ACTION_TX_COMPLETED,
  65. BRCMF_P2P_STATUS_ACTION_TX_NOACK,
  66. BRCMF_P2P_STATUS_GO_NEG_PHASE,
  67. BRCMF_P2P_STATUS_DISCOVER_LISTEN
  68. };
  69. /**
  70. * struct brcmf_p2p_info - p2p specific driver information.
  71. *
  72. * @cfg: driver private data for cfg80211 interface.
  73. * @status: status of P2P (see enum brcmf_p2p_status).
  74. * @dev_addr: P2P device address.
  75. * @int_addr: P2P interface address.
  76. * @bss_idx: informate for P2P bss types.
  77. * @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state.
  78. * @ssid: ssid for P2P GO.
  79. * @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state.
  80. * @remain_on_channel: contains copy of struct used by cfg80211.
  81. * @remain_on_channel_cookie: cookie counter for remain on channel cmd
  82. * @next_af_subtype: expected action frame subtype.
  83. * @send_af_done: indication that action frame tx is complete.
  84. */
  85. struct brcmf_p2p_info {
  86. struct brcmf_cfg80211_info *cfg;
  87. unsigned long status;
  88. u8 dev_addr[ETH_ALEN];
  89. u8 int_addr[ETH_ALEN];
  90. struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];
  91. struct timer_list listen_timer;
  92. struct brcmf_ssid ssid;
  93. u8 listen_channel;
  94. struct ieee80211_channel remain_on_channel;
  95. u32 remain_on_channel_cookie;
  96. u8 next_af_subtype;
  97. struct completion send_af_done;
  98. };
  99. s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg);
  100. void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);
  101. struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
  102. enum nl80211_iftype type, u32 *flags,
  103. struct vif_params *params);
  104. int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  105. int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  106. enum brcmf_fil_p2p_if_types if_type);
  107. int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  108. void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  109. int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  110. struct cfg80211_scan_request *request,
  111. struct brcmf_cfg80211_vif *vif);
  112. int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
  113. struct ieee80211_channel *channel,
  114. unsigned int duration, u64 *cookie);
  115. int brcmf_p2p_notify_listen_complete(struct brcmf_if *ifp,
  116. const struct brcmf_event_msg *e,
  117. void *data);
  118. void brcmf_p2p_cancel_remain_on_channel(struct brcmf_if *ifp);
  119. int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
  120. const struct brcmf_event_msg *e,
  121. void *data);
  122. int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp,
  123. const struct brcmf_event_msg *e,
  124. void *data);
  125. bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
  126. struct net_device *ndev,
  127. struct brcmf_fil_af_params_le *af_params);
  128. #endif /* WL_CFGP2P_H_ */