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