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