1 /* 2 * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: Contains p2p public data structure definitions 22 */ 23 24 #ifndef _WLAN_P2P_PUBLIC_STRUCT_H_ 25 #define _WLAN_P2P_PUBLIC_STRUCT_H_ 26 27 #include <qdf_types.h> 28 29 #define P2P_MAX_NOA_DESC 4 30 31 #define HEADER_LEN_P2P_IE 6 32 #define OUI_SIZE_P2P 4 33 34 #define P2P_1X1_WAR_OUI "\x00\x50\xf2\x04" 35 #define P2P_1X1_OUI_LEN 4 36 37 #define MAX_CONFIG_METHODS_LEN 2 38 #define DEVICE_CATEGORY_MAX_LEN 1 39 40 /** 41 * struct p2p_ps_params - P2P powersave related params 42 * @opp_ps: opportunistic power save 43 * @ctwindow: CT window 44 * @count: count 45 * @duration: duration 46 * @interval: interval 47 * @single_noa_duration: single shot noa duration 48 * @ps_selection: power save selection 49 * @session_id: session id 50 * @start: start time 51 */ 52 struct p2p_ps_params { 53 uint8_t opp_ps; 54 uint32_t ctwindow; 55 uint8_t count; 56 uint32_t duration; 57 uint32_t interval; 58 uint32_t single_noa_duration; 59 uint8_t ps_selection; 60 uint8_t session_id; 61 uint32_t start; 62 }; 63 64 /** 65 * struct p2p_roc_req - P2P roc request 66 * @vdev_id: Vdev id on which this request has come 67 * @chan_freq: Chan frequency for which this RoC has been requested 68 * @phy_mode: PHY mode 69 * @duration: Duration for the RoC 70 */ 71 struct p2p_roc_req { 72 uint32_t vdev_id; 73 qdf_freq_t chan_freq; 74 uint32_t phy_mode; 75 uint32_t duration; 76 }; 77 78 /** 79 * enum p2p_roc_event - P2P RoC event 80 * @ROC_EVENT_READY_ON_CHAN: RoC has started now 81 * @ROC_EVENT_COMPLETED: RoC has been completed 82 * @ROC_EVENT_INAVLID: Invalid event 83 */ 84 enum p2p_roc_event { 85 ROC_EVENT_READY_ON_CHAN = 0, 86 ROC_EVENT_COMPLETED, 87 ROC_EVENT_INAVLID, 88 }; 89 90 /** 91 * struct p2p_event - p2p event 92 * @vdev_id: Vdev id 93 * @roc_event: RoC event 94 * @cookie: Cookie which is given to supplicant for this roc req 95 * @chan_freq: Chan frequency for which this RoC has been requested 96 * @duration: Duration for the RoC 97 */ 98 struct p2p_event { 99 uint32_t vdev_id; 100 enum p2p_roc_event roc_event; 101 uint64_t cookie; 102 qdf_freq_t chan_freq; 103 uint32_t duration; 104 }; 105 106 /** 107 * struct p2p_rx_mgmt_frame - rx mgmt frame structure 108 * @frame_len: Frame length 109 * @rx_freq: RX Frequency 110 * @vdev_id: Vdev id 111 * @frm_type: Frame type 112 * @rx_rssi: RX rssi 113 * @buf: Buffer address 114 */ 115 struct p2p_rx_mgmt_frame { 116 uint32_t frame_len; 117 uint32_t rx_freq; 118 uint32_t vdev_id; 119 uint32_t frm_type; 120 uint32_t rx_rssi; 121 QDF_FLEX_ARRAY(uint8_t, buf); 122 }; 123 124 /** 125 * struct p2p_tx_cnf - tx confirm structure 126 * @vdev_id: Vdev id 127 * @action_cookie: TX cookie for this action frame 128 * @buf_len: Frame length 129 * @status: TX status 130 * @buf: Buffer address 131 */ 132 struct p2p_tx_cnf { 133 uint32_t vdev_id; 134 uint64_t action_cookie; 135 uint32_t buf_len; 136 uint32_t status; 137 uint8_t *buf; 138 }; 139 140 /** 141 * struct p2p_mgmt_tx - p2p mgmt tx structure 142 * @vdev_id: Vdev id 143 * @chan_freq: Chan frequency for which this RoC has been requested 144 * @wait: Duration for the RoC 145 * @len: Length of tx buffer 146 * @no_cck: Required cck or not 147 * @dont_wait_for_ack: Wait for ack or not 148 * @off_chan: Off channel tx or not 149 * @buf: TX buffer 150 */ 151 struct p2p_mgmt_tx { 152 uint32_t vdev_id; 153 qdf_freq_t chan_freq; 154 uint32_t wait; 155 uint32_t len; 156 uint32_t no_cck; 157 uint32_t dont_wait_for_ack; 158 uint32_t off_chan; 159 const uint8_t *buf; 160 }; 161 162 /** 163 * struct p2p_set_mac_filter_evt 164 * @vdev_id: Vdev id 165 * @status: target reported result of set mac addr filter 166 */ 167 struct p2p_set_mac_filter_evt { 168 uint32_t vdev_id; 169 uint32_t status; 170 }; 171 172 /** 173 * struct p2p_ps_config 174 * @vdev_id: Vdev id 175 * @opp_ps: Opportunistic power save 176 * @ct_window: CT window 177 * @count: Count 178 * @duration: Duration 179 * @interval: Interval 180 * @single_noa_duration: Single shot noa duration 181 * @ps_selection: power save selection 182 * @start: Start time 183 */ 184 struct p2p_ps_config { 185 uint32_t vdev_id; 186 uint32_t opp_ps; 187 uint32_t ct_window; 188 uint32_t count; 189 uint32_t duration; 190 uint32_t interval; 191 uint32_t single_noa_duration; 192 uint32_t ps_selection; 193 uint32_t start; 194 }; 195 196 /** 197 * struct p2p_lo_start - p2p listen offload start 198 * @vdev_id: Vdev id 199 * @ctl_flags: Control flag 200 * @freq: P2P listen frequency 201 * @period: Listen offload period 202 * @interval: Listen offload interval 203 * @count: Number listen offload intervals 204 * @dev_types_len: Device types length 205 * @probe_resp_len: Probe response template length 206 * @device_types: Device types 207 * @probe_resp_tmplt: Probe response template 208 */ 209 struct p2p_lo_start { 210 uint32_t vdev_id; 211 uint32_t ctl_flags; 212 uint32_t freq; 213 uint32_t period; 214 uint32_t interval; 215 uint32_t count; 216 uint32_t dev_types_len; 217 uint32_t probe_resp_len; 218 uint8_t *device_types; 219 uint8_t *probe_resp_tmplt; 220 }; 221 222 /** 223 * struct p2p_lo_event 224 * @vdev_id: vdev id 225 * @reason_code: reason code 226 */ 227 struct p2p_lo_event { 228 uint32_t vdev_id; 229 uint32_t reason_code; 230 }; 231 232 /** 233 * struct noa_descriptor - noa descriptor 234 * @type_count: 255: continuous schedule, 0: reserved 235 * @duration: Absent period duration in micro seconds 236 * @interval: Absent period interval in micro seconds 237 * @start_time: 32 bit tsf time when in starts 238 */ 239 struct noa_descriptor { 240 uint32_t type_count; 241 uint32_t duration; 242 uint32_t interval; 243 uint32_t start_time; 244 }; 245 246 /** 247 * struct p2p_noa_info - p2p noa information 248 * @index: identifies instance of NOA su element 249 * @opps_ps: opps ps state of the AP 250 * @ct_window: ct window in TUs 251 * @vdev_id: vdev id 252 * @num_desc: number of NOA descriptors 253 * @noa_desc: noa descriptors 254 */ 255 struct p2p_noa_info { 256 uint32_t index; 257 uint32_t opps_ps; 258 uint32_t ct_window; 259 uint32_t vdev_id; 260 uint32_t num_desc; 261 struct noa_descriptor noa_desc[P2P_MAX_NOA_DESC]; 262 }; 263 264 /** 265 * struct p2p_protocol_callbacks - callback to non-converged driver 266 * @is_mgmt_protected: func to get 11w mgmt protection status 267 */ 268 struct p2p_protocol_callbacks { 269 bool (*is_mgmt_protected)(uint32_t vdev_id, const uint8_t *peer_addr); 270 }; 271 272 /** 273 * enum p2p_attr_id - enum for P2P attributes ID in P2P IE 274 * @P2P_ATTR_STATUS: Attribute Status none 275 * @P2P_ATTR_MINOR_REASON_CODE: Minor reason code attribute 276 * @P2P_ATTR_CAPABILITY: Capability attribute 277 * @P2P_ATTR_DEVICE_ID: device ID attribute 278 * @P2P_ATTR_GROUP_OWNER_INTENT: Group owner intent attribute 279 * @P2P_ATTR_CONFIGURATION_TIMEOUT: Config timeout attribute 280 * @P2P_ATTR_LISTEN_CHANNEL: listen channel attribute 281 * @P2P_ATTR_GROUP_BSSID: Group BSSID attribute 282 * @P2P_ATTR_EXT_LISTEN_TIMING: Listen timing attribute 283 * @P2P_ATTR_INTENDED_INTERFACE_ADDR: Intended interface address attribute 284 * @P2P_ATTR_MANAGEABILITY: Manageability attribute 285 * @P2P_ATTR_CHANNEL_LIST: Channel list attribute 286 * @P2P_ATTR_NOTICE_OF_ABSENCE: Notice of Absence attribute 287 * @P2P_ATTR_DEVICE_INFO: Device Info attribute 288 * @P2P_ATTR_GROUP_INFO: Group Info attribute 289 * @P2P_ATTR_GROUP_ID: Group ID attribute 290 * @P2P_ATTR_INTERFACE: Interface attribute 291 * @P2P_ATTR_OPERATING_CHANNEL: Operating channel attribute 292 * @P2P_ATTR_INVITATION_FLAGS: Invitation flags attribute 293 * @P2P_ATTR_OOB_GO_NEG_CHANNEL: GO neg channel attribute 294 * @P2P_ATTR_SERVICE_HASH: Service HASH attribute 295 * @P2P_ATTR_SESSION_INFORMATION_DATA: Session Info data attribute 296 * @P2P_ATTR_CONNECTION_CAPABILITY: Connection capability attribute 297 * @P2P_ATTR_ADVERTISEMENT_ID: Advertisement ID attribute 298 * @P2P_ATTR_ADVERTISED_SERVICE: Advertised Service attribute 299 * @P2P_ATTR_SESSION_ID: Session ID attribute 300 * @P2P_ATTR_FEATURE_CAPABILITY: Feature capability attribute 301 * @P2P_ATTR_PERSISTENT_GROUP: Persistent group attribute 302 * @P2P_ATTR_VENDOR_SPECIFIC: Vendor specific attribute 303 */ 304 enum p2p_attr_id { 305 P2P_ATTR_STATUS = 0, 306 P2P_ATTR_MINOR_REASON_CODE = 1, 307 P2P_ATTR_CAPABILITY = 2, 308 P2P_ATTR_DEVICE_ID = 3, 309 P2P_ATTR_GROUP_OWNER_INTENT = 4, 310 P2P_ATTR_CONFIGURATION_TIMEOUT = 5, 311 P2P_ATTR_LISTEN_CHANNEL = 6, 312 P2P_ATTR_GROUP_BSSID = 7, 313 P2P_ATTR_EXT_LISTEN_TIMING = 8, 314 P2P_ATTR_INTENDED_INTERFACE_ADDR = 9, 315 P2P_ATTR_MANAGEABILITY = 10, 316 P2P_ATTR_CHANNEL_LIST = 11, 317 P2P_ATTR_NOTICE_OF_ABSENCE = 12, 318 P2P_ATTR_DEVICE_INFO = 13, 319 P2P_ATTR_GROUP_INFO = 14, 320 P2P_ATTR_GROUP_ID = 15, 321 P2P_ATTR_INTERFACE = 16, 322 P2P_ATTR_OPERATING_CHANNEL = 17, 323 P2P_ATTR_INVITATION_FLAGS = 18, 324 P2P_ATTR_OOB_GO_NEG_CHANNEL = 19, 325 P2P_ATTR_SERVICE_HASH = 21, 326 P2P_ATTR_SESSION_INFORMATION_DATA = 22, 327 P2P_ATTR_CONNECTION_CAPABILITY = 23, 328 P2P_ATTR_ADVERTISEMENT_ID = 24, 329 P2P_ATTR_ADVERTISED_SERVICE = 25, 330 P2P_ATTR_SESSION_ID = 26, 331 P2P_ATTR_FEATURE_CAPABILITY = 27, 332 P2P_ATTR_PERSISTENT_GROUP = 28, 333 P2P_ATTR_VENDOR_SPECIFIC = 221 334 }; 335 #endif /* _WLAN_P2P_PUBLIC_STRUCT_H_ */ 336