wlan_mlo_t2lm.h 25 KB

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