wlan_mlo_t2lm.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. /*
  2. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  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
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /**
  17. * DOC: contains T2LM APIs
  18. */
  19. #ifndef _WLAN_MLO_T2LM_H_
  20. #define _WLAN_MLO_T2LM_H_
  21. #include <wlan_cmn_ieee80211.h>
  22. #include <wlan_mlo_mgr_public_structs.h>
  23. #ifdef WMI_AP_SUPPORT
  24. #include <wlan_cmn.h>
  25. #endif
  26. struct mlo_vdev_host_tid_to_link_map_resp;
  27. struct wlan_mlo_dev_context;
  28. /* Max T2LM TIDS count */
  29. #define T2LM_MAX_NUM_TIDS 8
  30. #ifdef WMI_AP_SUPPORT
  31. /* Max no. of Preferred links */
  32. #define MAX_PREFERRED_LINKS 4
  33. #endif
  34. /* Max T2LM callback handlers */
  35. #define MAX_T2LM_HANDLERS 50
  36. #define T2LM_EXPECTED_DURATION_MAX_VALUE 0xFFFFFF
  37. /* Mapping switch time represented as bits 10 to 25 of the TSF value */
  38. #define WLAN_T2LM_MAPPING_SWITCH_TSF_BITS 0x3FFFC00
  39. /* There is a delay involved to receive and process the beacon/probe response
  40. * T2LM IE from AP. To match mapping switch timer expiry in both AP and STA,
  41. * advance timer expiry in STA by 100ms (= 98 * 1024 / 1000 = 100).
  42. */
  43. #define WLAN_T2LM_MAPPING_SWITCH_TIME_DELAY 98
  44. /**
  45. * enum wlan_t2lm_direction - Indicates the direction for which TID-to-link
  46. * mapping is available.
  47. *
  48. * @WLAN_T2LM_DL_DIRECTION: Downlink
  49. * @WLAN_T2LM_UL_DIRECTION: Uplink
  50. * @WLAN_T2LM_BIDI_DIRECTION: Both downlink and uplink
  51. * @WLAN_T2LM_MAX_DIRECTION: Max direction, this is used only internally
  52. * @WLAN_T2LM_INVALID_DIRECTION: Invalid, this is used only internally to check
  53. * if the mapping present in wlan_t2lm_info
  54. * structure is valid or not.
  55. */
  56. enum wlan_t2lm_direction {
  57. WLAN_T2LM_DL_DIRECTION,
  58. WLAN_T2LM_UL_DIRECTION,
  59. WLAN_T2LM_BIDI_DIRECTION,
  60. WLAN_T2LM_MAX_DIRECTION,
  61. WLAN_T2LM_INVALID_DIRECTION,
  62. };
  63. #ifdef WMI_AP_SUPPORT
  64. /**
  65. * enum wlan_link_band_caps - Represents the band capability of
  66. * a link.
  67. *
  68. * @WLAN_LINK_BAND_INVALID: Invalid band
  69. * @WLAN_LINK_BAND_2GHZ: 2GHz link
  70. * @WLAN_LINK_BAND_5GHZ: 5GHz link
  71. * @WLAN_LINK_BAND_5GHZ_LOW: 5GHz Low band link
  72. * @WLAN_LINK_BAND_5GHZ_HIGH: 5GHz High band link
  73. * @WLAN_LINK_BAND_6GHZ: 6GHz link
  74. * @WLAN_LINK_BAND_6GHZ_LOW: 6GHz Low band link
  75. * @WLAN_LINK_BAND_6GHZ_HIGH: 6GHz High band link
  76. */
  77. enum wlan_link_band_caps {
  78. WLAN_LINK_BAND_INVALID = 0,
  79. WLAN_LINK_BAND_2GHZ = 1,
  80. WLAN_LINK_BAND_5GHZ = 2,
  81. WLAN_LINK_BAND_5GHZ_LOW = 3,
  82. WLAN_LINK_BAND_5GHZ_HIGH = 4,
  83. WLAN_LINK_BAND_6GHZ = 5,
  84. WLAN_LINK_BAND_6GHZ_LOW = 6,
  85. WLAN_LINK_BAND_6GHZ_HIGH = 7,
  86. };
  87. /**
  88. * struct wlan_link_preference - Preferred link structure
  89. * @num_pref_links: non-zero values indicate that preferred link order
  90. * is present.
  91. * @pref_order: Preferred links in order.it is in form of hardware link id.
  92. * @timeout: timeout values for all the access categories.
  93. * @tlt_characterization_params: Bitmask to select Tx-Link Tuple from ordered
  94. * list.
  95. * Bit 0-15: Each bit maps to the corresponding Link ID
  96. * Bit 16-31: Reserved
  97. * @qualifier_flags: u32 flags to check that link order is
  98. * for TLT or link preference. Bit definition for the flags.
  99. * Bit 0: TLT bit
  100. * Bit 1: Preferred Link bit
  101. * Bit 2-31: Reserved
  102. */
  103. struct wlan_link_preference {
  104. uint8_t num_pref_links;
  105. uint8_t pref_order[MAX_PREFERRED_LINKS];
  106. uint32_t timeout[WIFI_AC_MAX];
  107. uint32_t tlt_characterization_params;
  108. uint32_t qualifier_flags;
  109. };
  110. /**
  111. * struct wlan_t2lm_of_tids - TID-to-link mapping for a given direction
  112. * @direction: direction from 'enum wlan_t2lm_direction'
  113. * @t2lm_provisioned_links: Link mapping for all the TIDs. Represented as
  114. * bitmap of type wlan_link_band_caps enum.
  115. */
  116. struct wlan_t2lm_of_tids {
  117. enum wlan_t2lm_direction direction;
  118. uint16_t t2lm_provisioned_links[T2LM_MAX_NUM_TIDS];
  119. };
  120. /**
  121. * struct wlan_preferred_links - Preferred link structure
  122. * @peer_mld_mac_addr: STA MLD macaddr
  123. * @num_t2lm_of_tids: non-zero value indicates that this structure is
  124. * carrying the TID-to-link mapping.It indicates for how many directions,
  125. * the TID-to-link mapping is present.
  126. * @homogeneous_mapping: non-zero value indicates the provided mapping
  127. * is homogeneous.
  128. * @t2lm: Valid TID-to-link mapping for the directions
  129. * @num_pref_links: non-zero values indicate that preferred link order is
  130. * present.
  131. * @preffered_link_order: Preferred links in order.
  132. * The links will be represented interms of wlan_link_band_caps enum.
  133. * @timeout: Timeout values for all the access categories.
  134. */
  135. struct wlan_preferred_links {
  136. uint8_t peer_mld_mac_addr[6];
  137. uint8_t num_t2lm_of_tids;
  138. int8_t homogeneous_mapping;
  139. struct wlan_t2lm_of_tids t2lm[WLAN_T2LM_MAX_DIRECTION];
  140. uint8_t num_pref_links;
  141. enum wlan_link_band_caps preffered_link_order[MAX_PREFERRED_LINKS];
  142. uint32_t timeout[WIFI_AC_MAX];
  143. };
  144. #endif
  145. /**
  146. * struct wlan_t2lm_info - TID-to-Link mapping information for the frames
  147. * transmitted on the uplink, downlink and bidirectional.
  148. *
  149. * @direction: 0 - Downlink, 1 - uplink 2 - Both uplink and downlink
  150. * @default_link_mapping: value 1 indicates the default T2LM, where all the TIDs
  151. * are mapped to all the links.
  152. * value 0 indicates the preferred T2LM mapping
  153. * @mapping_switch_time_present: Indicates if mapping switch time field present
  154. * in the T2LM IE
  155. * @expected_duration_present: Indicates if expected duration present in the
  156. * T2LM IE
  157. * @mapping_switch_time: Mapping switch time of this T2LM IE
  158. * @expected_duration: Expected duration of this T2LM IE
  159. * @ieee_link_map_tid: Indicates ieee link id mapping of all the TIDS
  160. * @hw_link_map_tid: Indicates hw link id mapping of all the TIDS
  161. * @timer_started: flag to check if T2LM timer is started for this T2LM IE
  162. * @link_mapping_size: value 1 indicates the length of Link Mapping Of TIDn
  163. * field is 1 octet, value 0 indicates the length of the
  164. * Link Mapping of TIDn field is 2 octets
  165. */
  166. struct wlan_t2lm_info {
  167. enum wlan_t2lm_direction direction;
  168. bool default_link_mapping;
  169. bool mapping_switch_time_present;
  170. bool expected_duration_present;
  171. uint16_t mapping_switch_time;
  172. uint32_t expected_duration;
  173. uint16_t ieee_link_map_tid[T2LM_MAX_NUM_TIDS];
  174. uint16_t hw_link_map_tid[T2LM_MAX_NUM_TIDS];
  175. bool timer_started;
  176. bool link_mapping_size;
  177. };
  178. /**
  179. * enum wlan_t2lm_category - T2LM category
  180. *
  181. * @WLAN_T2LM_CATEGORY_NONE: none
  182. * @WLAN_T2LM_CATEGORY_REQUEST: T2LM request
  183. * @WLAN_T2LM_CATEGORY_RESPONSE: T2LM response
  184. * @WLAN_T2LM_CATEGORY_TEARDOWN: T2LM teardown
  185. * @WLAN_T2LM_CATEGORY_INVALID: Invalid
  186. */
  187. enum wlan_t2lm_category {
  188. WLAN_T2LM_CATEGORY_NONE = 0,
  189. WLAN_T2LM_CATEGORY_REQUEST = 1,
  190. WLAN_T2LM_CATEGORY_RESPONSE = 2,
  191. WLAN_T2LM_CATEGORY_TEARDOWN = 3,
  192. WLAN_T2LM_CATEGORY_INVALID,
  193. };
  194. /**
  195. * enum wlan_t2lm_tx_status - Status code applicable for the T2LM frames
  196. * transmitted by the current peer.
  197. *
  198. * @WLAN_T2LM_TX_STATUS_NONE: Status code is not applicable
  199. * @WLAN_T2LM_TX_STATUS_SUCCESS: AP/STA successfully transmitted the T2LM frame
  200. * @WLAN_T2LM_TX_STATUS_FAILURE: Tx failure received from the FW.
  201. * @WLAN_T2LM_TX_STATUS_RX_TIMEOUT: T2LM response frame not received from the
  202. * peer for the transmitted T2LM request frame.
  203. * @WLAN_T2LM_TX_STATUS_INVALID: Invalid status code
  204. */
  205. enum wlan_t2lm_tx_status {
  206. WLAN_T2LM_TX_STATUS_NONE = 0,
  207. WLAN_T2LM_TX_STATUS_SUCCESS = 1,
  208. WLAN_T2LM_TX_STATUS_FAILURE = 2,
  209. WLAN_T2LM_TX_STATUS_RX_TIMEOUT = 3,
  210. WLAN_T2LM_TX_STATUS_INVALID,
  211. };
  212. /**
  213. * enum wlan_t2lm_resp_frm_type - T2LM status corresponds to T2LM response frame
  214. *
  215. * @WLAN_T2LM_RESP_TYPE_SUCCESS: T2LM mapping provided in the T2LM request is
  216. * accepted either by the AP or STA
  217. * @WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING: T2LM Request denied because
  218. * the requested TID-to-link mapping is unacceptable.
  219. * @WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING: T2LM Request rejected and
  220. * preferred TID-to-link mapping is suggested.
  221. * @WLAN_T2LM_RESP_TYPE_INVALID: Status code is not applicable.
  222. */
  223. enum wlan_t2lm_resp_frm_type {
  224. WLAN_T2LM_RESP_TYPE_SUCCESS = 0,
  225. WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING = 133,
  226. WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING = 134,
  227. WLAN_T2LM_RESP_TYPE_INVALID,
  228. };
  229. /**
  230. * enum wlan_t2lm_enable - TID-to-link negotiation supported by the mlo peer
  231. *
  232. * @WLAN_T2LM_NOT_SUPPORTED: T2LM is not supported by the MLD
  233. * @WLAN_T2LM_MAP_ALL_TIDS_TO_SAME_LINK_SET: MLD only supports the mapping of
  234. * all TIDs to the same link set.
  235. * @WLAN_T2LM_MAP_RESERVED: reserved value
  236. * @WLAN_T2LM_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET: MLD supports the
  237. * mapping of each TID to the same or different link set (Disjoint mapping).
  238. * @WLAN_T2LM_ENABLE_INVALID: invalid
  239. */
  240. enum wlan_t2lm_enable {
  241. WLAN_T2LM_NOT_SUPPORTED = 0,
  242. WLAN_T2LM_MAP_ALL_TIDS_TO_SAME_LINK_SET = 1,
  243. WLAN_T2LM_MAP_RESERVED = 2,
  244. WLAN_T2LM_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET = 3,
  245. WLAN_T2LM_ENABLE_INVALID,
  246. };
  247. /**
  248. * struct wlan_prev_t2lm_negotiated_info - Previous successful T2LM negotiation
  249. * is saved here.
  250. *
  251. * @dialog_token: Save the dialog token used in T2LM request and response frame.
  252. * @t2lm_info: Provides the TID to LINK mapping information
  253. * @link_preference: Provides the preferred link information
  254. */
  255. struct wlan_prev_t2lm_negotiated_info {
  256. uint16_t dialog_token;
  257. struct wlan_t2lm_info t2lm_info[WLAN_T2LM_MAX_DIRECTION];
  258. #ifdef WMI_AP_SUPPORT
  259. struct wlan_link_preference link_preference;
  260. #endif
  261. };
  262. /**
  263. * struct wlan_t2lm_onging_negotiation_info - Current ongoing T2LM negotiation
  264. * (information about transmitted T2LM request/response frame)
  265. *
  266. * @category: T2LM category as T2LM request frame
  267. * @dialog_token: Save the dialog token used in T2LM request and response frame.
  268. * @t2lm_info: Provides the TID-to-link mapping info for UL/DL/BiDi
  269. * @t2lm_tx_status: Status code corresponds to the transmitted T2LM frames
  270. * @t2lm_resp_type: T2LM status corresponds to T2LM response frame.
  271. * @link_preference: Provides the preferred link information
  272. * @t2lm_info_present: It will show the t2lm_info present or not
  273. * @pref_link_present: It will show the preference link is present or not
  274. * @ml_grp_id: MLO Group id which it belongs to
  275. */
  276. struct wlan_t2lm_onging_negotiation_info {
  277. enum wlan_t2lm_category category;
  278. uint8_t dialog_token;
  279. struct wlan_t2lm_info t2lm_info[WLAN_T2LM_MAX_DIRECTION];
  280. enum wlan_t2lm_tx_status t2lm_tx_status;
  281. enum wlan_t2lm_resp_frm_type t2lm_resp_type;
  282. #ifdef WMI_AP_SUPPORT
  283. struct wlan_link_preference link_preference;
  284. bool t2lm_info_present;
  285. bool pref_link_present;
  286. uint8_t ml_grp_id;
  287. #endif
  288. };
  289. /**
  290. * struct wlan_mlo_peer_t2lm_policy - TID-to-link mapping information
  291. *
  292. * @self_gen_dialog_token: self generated dialog token used to send T2LM request
  293. * frame;
  294. * @t2lm_enable_val: TID-to-link enable value supported by this peer.
  295. * @t2lm_negotiated_info: Previous successful T2LM negotiation is saved here.
  296. * @ongoing_tid_to_link_mapping: This has the ongoing TID-to-link mapping info
  297. * transmitted by this peer to the connected peer.
  298. */
  299. struct wlan_mlo_peer_t2lm_policy {
  300. uint8_t self_gen_dialog_token;
  301. enum wlan_t2lm_enable t2lm_enable_val;
  302. struct wlan_prev_t2lm_negotiated_info t2lm_negotiated_info;
  303. struct wlan_t2lm_onging_negotiation_info ongoing_tid_to_link_mapping;
  304. };
  305. /**
  306. * struct wlan_mlo_t2lm_ie - T2LM information
  307. *
  308. * @disabled_link_bitmap: Bitmap of disabled links. This is used to update the
  309. * disabled link field of RNR IE
  310. * @t2lm: T2LM info structure
  311. */
  312. struct wlan_mlo_t2lm_ie {
  313. uint16_t disabled_link_bitmap;
  314. struct wlan_t2lm_info t2lm;
  315. };
  316. /*
  317. * In a beacon or probe response frame, at max two T2LM IEs can be present
  318. * first one to represent the already existing mapping and the other one
  319. * represents the new T2LM mapping that is yet to establish.
  320. */
  321. #define WLAN_MAX_T2LM_IE 2
  322. /**
  323. * struct wlan_t2lm_timer - T2LM timer information
  324. *
  325. * @t2lm_timer: T2LM timer
  326. * @timer_interval: T2LM Timer value
  327. * @timer_started: T2LM timer started or not
  328. * @timer_out_time: T2LM timer target out time
  329. * @t2lm_dev_lock: lock to access struct
  330. */
  331. struct wlan_t2lm_timer {
  332. qdf_timer_t t2lm_timer;
  333. uint32_t timer_interval;
  334. uint32_t timer_out_time;
  335. bool timer_started;
  336. #ifdef WLAN_MLO_USE_SPINLOCK
  337. qdf_spinlock_t t2lm_dev_lock;
  338. #else
  339. qdf_mutex_t t2lm_dev_lock;
  340. #endif
  341. };
  342. struct wlan_mlo_dev_context;
  343. /**
  344. * typedef wlan_mlo_t2lm_link_update_handler - T2LM handler API to notify the
  345. * link update.
  346. * @vdev: Pointer to vdev context
  347. * @t2lm: Pointer to wlan_t2lm_info
  348. *
  349. * Return: QDF_STATUS
  350. */
  351. typedef QDF_STATUS (*wlan_mlo_t2lm_link_update_handler)(
  352. struct wlan_objmgr_vdev *vdev,
  353. struct wlan_t2lm_info *t2lm);
  354. /**
  355. * struct wlan_t2lm_context - T2LM IE information
  356. *
  357. * @established_t2lm: Indicates the already established broadcast T2LM IE
  358. * advertised by the AP in beacon/probe response frames.
  359. * In this T2LM IE, expected duration flag is set to 1 and
  360. * mapping switch time present flag is set to 0 when the
  361. * mapping is non-default.
  362. * @upcoming_t2lm: Indicates the new broadcast T2LM IE advertised by the AP in
  363. * beacon/probe response frames. STA needs to use this mapping
  364. * when expected duration in the established T2LM is expires.
  365. * @t2lm_timer: T2LM timer information
  366. * @t2lm_dev_lock: t2lm dev context lock
  367. * @tsf: time sync func value received via beacon
  368. * @link_update_handler: handler to update T2LM link
  369. * @is_valid_handler: T2LM handler is valid or not
  370. * @mst_start_tsf: calculated mapping switch start tsf
  371. * @mst_end_tsf: calculated mapping switch end tsf
  372. */
  373. struct wlan_t2lm_context {
  374. struct wlan_mlo_t2lm_ie established_t2lm;
  375. struct wlan_mlo_t2lm_ie upcoming_t2lm;
  376. struct wlan_t2lm_timer t2lm_timer;
  377. #ifdef WLAN_MLO_USE_SPINLOCK
  378. qdf_spinlock_t t2lm_dev_lock;
  379. #else
  380. qdf_mutex_t t2lm_dev_lock;
  381. #endif
  382. uint64_t tsf;
  383. wlan_mlo_t2lm_link_update_handler
  384. link_update_handler[MAX_T2LM_HANDLERS];
  385. bool is_valid_handler[MAX_T2LM_HANDLERS];
  386. #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
  387. uint64_t mst_start_tsf;
  388. uint64_t mst_end_tsf;
  389. #endif
  390. };
  391. #ifdef WLAN_FEATURE_11BE
  392. #define t2lm_alert(format, args...) \
  393. QDF_TRACE_FATAL(QDF_MODULE_ID_T2LM, format, ## args)
  394. #define t2lm_err(format, args...) \
  395. QDF_TRACE_ERROR(QDF_MODULE_ID_T2LM, format, ## args)
  396. #define t2lm_warn(format, args...) \
  397. QDF_TRACE_WARN(QDF_MODULE_ID_T2LM, format, ## args)
  398. #define t2lm_info(format, args...) \
  399. QDF_TRACE_INFO(QDF_MODULE_ID_T2LM, format, ## args)
  400. #define t2lm_debug(format, args...) \
  401. QDF_TRACE_DEBUG(QDF_MODULE_ID_T2LM, format, ## args)
  402. #define t2lm_rl_debug(format, args...) \
  403. QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_T2LM, format, ## args)
  404. #define WLAN_T2LM_MAX_NUM_LINKS 16
  405. #ifdef WLAN_MLO_USE_SPINLOCK
  406. /**
  407. * t2lm_dev_lock_create - Create T2LM device mutex/spinlock
  408. * @t2lm_ctx: T2LM context
  409. *
  410. * Creates mutex/spinlock
  411. *
  412. * Return: void
  413. */
  414. static inline void
  415. t2lm_dev_lock_create(struct wlan_t2lm_context *t2lm_ctx)
  416. {
  417. qdf_spinlock_create(&t2lm_ctx->t2lm_dev_lock);
  418. }
  419. /**
  420. * t2lm_dev_lock_destroy - Destroy T2LM mutex/spinlock
  421. * @t2lm_ctx: T2LM context
  422. *
  423. * Destroy mutex/spinlock
  424. *
  425. * Return: void
  426. */
  427. static inline void
  428. t2lm_dev_lock_destroy(struct wlan_t2lm_context *t2lm_ctx)
  429. {
  430. qdf_spinlock_destroy(&t2lm_ctx->t2lm_dev_lock);
  431. }
  432. /**
  433. * t2lm_dev_lock_acquire - acquire T2LM mutex/spinlock
  434. * @t2lm_ctx: T2LM context
  435. *
  436. * acquire mutex/spinlock
  437. *
  438. * return: void
  439. */
  440. static inline
  441. void t2lm_dev_lock_acquire(struct wlan_t2lm_context *t2lm_ctx)
  442. {
  443. qdf_spin_lock_bh(&t2lm_ctx->t2lm_dev_lock);
  444. }
  445. /**
  446. * t2lm_dev_lock_release - release T2LM dev mutex/spinlock
  447. * @t2lm_ctx: T2LM context
  448. *
  449. * release mutex/spinlock
  450. *
  451. * return: void
  452. */
  453. static inline
  454. void t2lm_dev_lock_release(struct wlan_t2lm_context *t2lm_ctx)
  455. {
  456. qdf_spin_unlock_bh(&t2lm_ctx->t2lm_dev_lock);
  457. }
  458. #else /* WLAN_MLO_USE_SPINLOCK */
  459. static inline
  460. void t2lm_dev_lock_create(struct wlan_t2lm_context *t2lm_ctx)
  461. {
  462. qdf_mutex_create(&t2lm_ctx->t2lm_dev_lock);
  463. }
  464. static inline
  465. void t2lm_dev_lock_destroy(struct wlan_t2lm_context *t2lm_ctx)
  466. {
  467. qdf_mutex_destroy(&t2lm_ctx->t2lm_dev_lock);
  468. }
  469. static inline void t2lm_dev_lock_acquire(struct wlan_t2lm_context *t2lm_ctx)
  470. {
  471. qdf_mutex_acquire(&t2lm_ctx->t2lm_dev_lock);
  472. }
  473. static inline void t2lm_dev_lock_release(struct wlan_t2lm_context *t2lm_ctx)
  474. {
  475. qdf_mutex_release(&t2lm_ctx->t2lm_dev_lock);
  476. }
  477. #endif
  478. /**
  479. * wlan_register_t2lm_link_update_notify_handler() - API to register the
  480. * handlers to receive link update notification
  481. * @handler: handler for T2LM link update
  482. * @mldev: Pointer to mlo context
  483. *
  484. * Return: Index on which handler is registered
  485. */
  486. int wlan_register_t2lm_link_update_notify_handler(
  487. wlan_mlo_t2lm_link_update_handler handler,
  488. struct wlan_mlo_dev_context *mldev);
  489. /**
  490. * wlan_unregister_t2lm_link_update_notify_handler() - API to unregister the
  491. * T2LM related handlers
  492. * @mldev: Pointer to mlo context
  493. * @index: Index on which the handler was registered
  494. *
  495. * Return: None
  496. */
  497. void wlan_unregister_t2lm_link_update_notify_handler(
  498. struct wlan_mlo_dev_context *mldev, uint8_t index);
  499. /**
  500. * wlan_mlo_dev_t2lm_notify_link_update() - API to call the registered handlers
  501. * when there is a link update happens using T2LM
  502. * @vdev: Pointer to vdev
  503. * @t2lm: Pointer to T2LM info
  504. *
  505. * Return: QDF_STATUS
  506. */
  507. QDF_STATUS wlan_mlo_dev_t2lm_notify_link_update(
  508. struct wlan_objmgr_vdev *vdev,
  509. struct wlan_t2lm_info *t2lm);
  510. /**
  511. * wlan_mlo_parse_t2lm_ie() - API to parse the T2LM IE
  512. * @t2lm: Pointer to T2LM structure
  513. * @ie: Pointer to T2LM IE
  514. * @frame_len: Action Frame length
  515. *
  516. * Return: QDF_STATUS
  517. */
  518. QDF_STATUS wlan_mlo_parse_t2lm_ie(
  519. struct wlan_t2lm_onging_negotiation_info *t2lm, uint8_t *ie,
  520. uint32_t frame_len);
  521. /**
  522. * wlan_mlo_add_t2lm_ie() - API to add TID-to-link mapping IE
  523. * @frm: Pointer to buffer
  524. * @t2lm: Pointer to t2lm mapping structure
  525. * @vdev: Pointer to vdev structure
  526. *
  527. * Return: Updated frame pointer
  528. */
  529. uint8_t *wlan_mlo_add_t2lm_ie(uint8_t *frm,
  530. struct wlan_t2lm_onging_negotiation_info *t2lm,
  531. struct wlan_objmgr_vdev *vdev);
  532. /**
  533. * wlan_mlo_vdev_tid_to_link_map_event() - API to process the revceived T2LM
  534. * event.
  535. * @psoc: psoc object
  536. * @event: Pointer to received T2LM info
  537. *
  538. * Return: QDF_STATUS
  539. */
  540. QDF_STATUS wlan_mlo_vdev_tid_to_link_map_event(
  541. struct wlan_objmgr_psoc *psoc,
  542. struct mlo_vdev_host_tid_to_link_map_resp *event);
  543. /**
  544. * wlan_mlo_parse_t2lm_action_frame() - API to parse T2LM action frame
  545. * @t2lm: Pointer to T2LM structure
  546. * @action_frm: Pointer to action frame
  547. * @frame_len: Action frame length
  548. * @category: T2LM action frame category
  549. *
  550. * Return: 0 - success, else failure
  551. */
  552. int wlan_mlo_parse_t2lm_action_frame(
  553. struct wlan_t2lm_onging_negotiation_info *t2lm,
  554. struct wlan_action_frame *action_frm,
  555. uint32_t frame_len,
  556. enum wlan_t2lm_category category);
  557. /**
  558. * wlan_mlo_add_t2lm_action_frame() - API to add T2LM action frame
  559. * @frm: Pointer to a frame to add T2LM IE
  560. * @args: T2LM action frame related info
  561. * @buf: Pointer to T2LM IE values
  562. * @category: T2LM action frame category
  563. *
  564. * Return: Pointer to the updated frame buffer
  565. */
  566. uint8_t *wlan_mlo_add_t2lm_action_frame(
  567. uint8_t *frm, struct wlan_action_frame_args *args,
  568. uint8_t *buf, enum wlan_t2lm_category category);
  569. /**
  570. * wlan_mlo_parse_bcn_prbresp_t2lm_ie() - API to parse the T2LM IE from beacon/
  571. * probe response frame
  572. * @t2lm_ctx: T2LM context
  573. * @ie: Pointer to T2LM IE
  574. *
  575. * Return: QDF_STATUS
  576. */
  577. QDF_STATUS wlan_mlo_parse_bcn_prbresp_t2lm_ie(
  578. struct wlan_t2lm_context *t2lm_ctx, uint8_t *ie);
  579. /**
  580. * wlan_mlo_parse_t2lm_info() - Parse T2LM IE fields
  581. * @ie: Pointer to T2LM IE
  582. * @t2lm: Pointer to T2LM structure
  583. *
  584. * Return: QDF_STATUS
  585. */
  586. QDF_STATUS wlan_mlo_parse_t2lm_info(uint8_t *ie,
  587. struct wlan_t2lm_info *t2lm);
  588. /**
  589. * wlan_mlo_add_t2lm_info_ie() - Add T2LM IE for UL/DL/Bidirection
  590. * @frm: Pointer to buffer
  591. * @t2lm: Pointer to t2lm mapping structure
  592. * @vdev: Pointer to vdev structure
  593. *
  594. * Return: Updated frame pointer
  595. */
  596. uint8_t *wlan_mlo_add_t2lm_info_ie(uint8_t *frm, struct wlan_t2lm_info *t2lm,
  597. struct wlan_objmgr_vdev *vdev);
  598. /**
  599. * wlan_mlo_t2lm_timer_init() - API to initialize t2lm timer
  600. * @vdev: Pointer to vdev
  601. *
  602. * Return: qdf status
  603. */
  604. QDF_STATUS
  605. wlan_mlo_t2lm_timer_init(struct wlan_objmgr_vdev *vdev);
  606. /**
  607. * wlan_mlo_t2lm_timer_deinit() - API to deinit t2lm timer
  608. * @vdev: Pointer to vdev
  609. *
  610. * Return: qdf status
  611. */
  612. QDF_STATUS
  613. wlan_mlo_t2lm_timer_deinit(struct wlan_objmgr_vdev *vdev);
  614. /**
  615. * wlan_mlo_t2lm_timer_start() - API to start T2LM timer
  616. * @vdev: Pointer to vdev
  617. * @interval: T2LM timer interval
  618. *
  619. * Return: qdf status
  620. */
  621. QDF_STATUS
  622. wlan_mlo_t2lm_timer_start(struct wlan_objmgr_vdev *vdev,
  623. uint32_t interval);
  624. /**
  625. * wlan_mlo_t2lm_timer_stop() - API to stop TID-to-link mapping timer
  626. * @vdev: Pointer to vdev
  627. *
  628. * Return: qdf status
  629. */
  630. QDF_STATUS
  631. wlan_mlo_t2lm_timer_stop(struct wlan_objmgr_vdev *vdev);
  632. /**
  633. * wlan_mlo_t2lm_timer_expiry_handler() - API to handle t2lm timer expiry
  634. * @vdev: Pointer to vdev structure
  635. *
  636. * Return: none
  637. */
  638. void
  639. wlan_mlo_t2lm_timer_expiry_handler(void *vdev);
  640. /**
  641. * wlan_handle_t2lm_timer() - API to handle TID-to-link mapping timer
  642. * @vdev: Pointer to vdev
  643. *
  644. * Return: qdf status
  645. */
  646. QDF_STATUS
  647. wlan_handle_t2lm_timer(struct wlan_objmgr_vdev *vdev);
  648. /**
  649. * wlan_process_bcn_prbrsp_t2lm_ie() - API to process the received T2LM IE from
  650. * beacon/probe response.
  651. * @vdev: Pointer to vdev
  652. * @rx_t2lm_ie: Received T2LM IE
  653. * @tsf: Local TSF value
  654. *
  655. * Return QDF_STATUS
  656. */
  657. QDF_STATUS wlan_process_bcn_prbrsp_t2lm_ie(struct wlan_objmgr_vdev *vdev,
  658. struct wlan_t2lm_context *rx_t2lm_ie,
  659. uint64_t tsf);
  660. /**
  661. * wlan_send_tid_to_link_mapping() - API to send T2LM info received from beacon,
  662. * probe response or action frame to FW.
  663. *
  664. * @vdev: Pointer to vdev
  665. * @t2lm: T2LM info
  666. *
  667. * Return QDF_STATUS
  668. */
  669. QDF_STATUS wlan_send_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev,
  670. struct wlan_t2lm_info *t2lm);
  671. /**
  672. * wlan_get_t2lm_mapping_status() - API to get T2LM info
  673. * @vdev: Pointer to vdev
  674. * @t2lm: T2LM info
  675. *
  676. * Return: QDF_STATUS
  677. */
  678. QDF_STATUS wlan_get_t2lm_mapping_status(struct wlan_objmgr_vdev *vdev,
  679. struct wlan_t2lm_info *t2lm);
  680. /**
  681. * wlan_send_peer_level_tid_to_link_mapping() - API to send peer level T2LM info
  682. * negotiated using action frames to FW.
  683. *
  684. * @vdev: Pointer to vdev
  685. * @peer: pointer to peer
  686. *
  687. * Return QDF_STATUS
  688. */
  689. QDF_STATUS
  690. wlan_send_peer_level_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev,
  691. struct wlan_objmgr_peer *peer);
  692. #else
  693. static inline QDF_STATUS wlan_mlo_parse_t2lm_ie(
  694. struct wlan_t2lm_onging_negotiation_info *t2lm, uint8_t *ie,
  695. uint32_t frame_len)
  696. {
  697. return QDF_STATUS_E_FAILURE;
  698. }
  699. static inline
  700. int8_t *wlan_mlo_add_t2lm_ie(uint8_t *frm,
  701. struct wlan_t2lm_onging_negotiation_info *t2lm,
  702. struct wlan_objmgr_vdev *vdev)
  703. {
  704. return frm;
  705. }
  706. static inline
  707. int wlan_mlo_parse_t2lm_action_frame(
  708. struct wlan_t2lm_onging_negotiation_info *t2lm,
  709. struct wlan_action_frame *action_frm,
  710. uint32_t frame_len,
  711. enum wlan_t2lm_category category)
  712. {
  713. return 0;
  714. }
  715. static inline
  716. uint8_t *wlan_mlo_add_t2lm_action_frame(
  717. uint8_t *frm, struct wlan_action_frame_args *args,
  718. uint8_t *buf, enum wlan_t2lm_category category)
  719. {
  720. return frm;
  721. }
  722. static inline
  723. QDF_STATUS wlan_mlo_parse_bcn_prbresp_t2lm_ie(
  724. struct wlan_t2lm_context *t2lm_ctx, uint8_t *ie)
  725. {
  726. return QDF_STATUS_E_FAILURE;
  727. }
  728. static inline
  729. QDF_STATUS wlan_mlo_parse_t2lm_info(uint8_t *ie,
  730. struct wlan_t2lm_info *t2lm)
  731. {
  732. return QDF_STATUS_E_FAILURE;
  733. }
  734. static inline
  735. uint8_t *wlan_mlo_add_t2lm_info_ie(uint8_t *frm, struct wlan_t2lm_info *t2lm,
  736. struct wlan_objmgr_vdev *vdev)
  737. {
  738. return frm;
  739. }
  740. static inline QDF_STATUS
  741. wlan_mlo_t2lm_timer_init(struct wlan_objmgr_vdev *vdev)
  742. {
  743. return QDF_STATUS_E_NOSUPPORT;
  744. }
  745. static inline QDF_STATUS
  746. wlan_mlo_t2lm_timer_deinit(struct wlan_objmgr_vdev *vdev)
  747. {
  748. return QDF_STATUS_E_NOSUPPORT;
  749. }
  750. static inline QDF_STATUS
  751. wlan_mlo_t2lm_timer_start(struct wlan_objmgr_vdev *vdev,
  752. uint32_t interval)
  753. {
  754. return QDF_STATUS_E_NOSUPPORT;
  755. }
  756. static inline QDF_STATUS
  757. wlan_mlo_t2lm_timer_stop(struct wlan_objmgr_vdev *vdev)
  758. {
  759. return QDF_STATUS_E_NOSUPPORT;
  760. }
  761. static inline void
  762. wlan_mlo_t2lm_timer_expiry_handler(void *vdev)
  763. {}
  764. static inline QDF_STATUS
  765. wlan_handle_t2lm_timer(struct wlan_objmgr_vdev *vdev)
  766. {
  767. return QDF_STATUS_E_NOSUPPORT;
  768. }
  769. static inline QDF_STATUS
  770. wlan_process_bcn_prbrsp_t2lm_ie(struct wlan_objmgr_vdev *vdev,
  771. struct wlan_t2lm_context *rx_t2lm_ie,
  772. uint64_t tsf)
  773. {
  774. return QDF_STATUS_SUCCESS;
  775. }
  776. static inline
  777. int wlan_register_t2lm_link_update_notify_handler(
  778. wlan_mlo_t2lm_link_update_handler handler,
  779. struct wlan_mlo_dev_context *mldev)
  780. {
  781. return 0;
  782. }
  783. static inline
  784. void wlan_unregister_t2lm_link_update_notify_handler(
  785. struct wlan_mlo_dev_context *mldev, uint8_t index)
  786. {
  787. }
  788. static inline QDF_STATUS wlan_mlo_dev_t2lm_notify_link_update(
  789. struct wlan_objmgr_vdev *vdev,
  790. struct wlan_t2lm_info *t2lm)
  791. {
  792. return QDF_STATUS_SUCCESS;
  793. }
  794. static inline
  795. QDF_STATUS wlan_send_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev,
  796. struct wlan_t2lm_info *t2lm)
  797. {
  798. return QDF_STATUS_SUCCESS;
  799. }
  800. static inline QDF_STATUS
  801. wlan_send_peer_level_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev,
  802. struct wlan_objmgr_peer *peer)
  803. {
  804. return QDF_STATUS_SUCCESS;
  805. }
  806. #endif /* WLAN_FEATURE_11BE */
  807. #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_FEATURE_11BE_MLO_ADV_FEATURE)
  808. /**
  809. * wlan_clear_peer_level_tid_to_link_mapping() - API to clear peer level T2LM
  810. * info negotiated using action frames to FW.
  811. *
  812. * @vdev: Pointer to vdev
  813. *
  814. * Return: none
  815. */
  816. void
  817. wlan_clear_peer_level_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev);
  818. /**
  819. * wlan_mlo_link_disable_request_handler() - API to handle mlo link disable
  820. * request handler.
  821. *
  822. * @psoc: Pointer to psoc
  823. * @evt_params: MLO Link disable request params
  824. *
  825. * Return QDF_STATUS
  826. */
  827. QDF_STATUS
  828. wlan_mlo_link_disable_request_handler(struct wlan_objmgr_psoc *psoc,
  829. void *evt_params);
  830. #else
  831. static inline void
  832. wlan_clear_peer_level_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev)
  833. {
  834. }
  835. static inline QDF_STATUS
  836. wlan_mlo_link_disable_request_handler(struct wlan_objmgr_psoc *psoc,
  837. void *evt_params)
  838. {
  839. return QDF_STATUS_E_NOSUPPORT;
  840. }
  841. #endif
  842. #endif /* _WLAN_MLO_T2LM_H_ */