wlan_mlo_t2lm.h 24 KB

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