wlan_p2p_public_struct.h 9.5 KB

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