cdp_txrx_ops.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  1. /*
  2. * Copyright (c) 2017 The Linux Foundation. All rights reserved.
  3. *
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * @file cdp_txrx_ops.h
  21. * @brief Define the host data path converged API functions
  22. * called by the host control SW and the OS interface module
  23. */
  24. #ifndef _CDP_TXRX_CMN_OPS_H_
  25. #define _CDP_TXRX_CMN_OPS_H_
  26. #include <cdp_txrx_cmn_struct.h>
  27. #ifdef CONFIG_WIN
  28. #include <cdp_txrx_stats_struct.h>
  29. #endif
  30. #include "cdp_txrx_handle.h"
  31. #include <cdp_txrx_mon_struct.h>
  32. #include "wlan_objmgr_psoc_obj.h"
  33. #ifdef IPA_OFFLOAD
  34. #include <qdf_ipa.h>
  35. #endif
  36. /**
  37. * bitmap values to indicate special handling of peer_delete
  38. */
  39. #define CDP_PEER_DELETE_NO_SPECIAL 0
  40. #define CDP_PEER_DO_NOT_START_UNMAP_TIMER 1
  41. /******************************************************************************
  42. *
  43. * Control Interface (A Interface)
  44. *
  45. *****************************************************************************/
  46. struct cdp_cmn_ops {
  47. int (*txrx_soc_attach_target)(ol_txrx_soc_handle soc);
  48. int (*txrx_pdev_attach_target)(struct cdp_pdev *pdev);
  49. struct cdp_vdev *(*txrx_vdev_attach)
  50. (struct cdp_pdev *pdev, uint8_t *vdev_mac_addr,
  51. uint8_t vdev_id, enum wlan_op_mode op_mode);
  52. void (*txrx_vdev_detach)
  53. (struct cdp_vdev *vdev, ol_txrx_vdev_delete_cb callback,
  54. void *cb_context);
  55. struct cdp_pdev *(*txrx_pdev_attach)
  56. (ol_txrx_soc_handle soc, struct cdp_cfg *ctrl_pdev,
  57. HTC_HANDLE htc_pdev, qdf_device_t osdev, uint8_t pdev_id);
  58. int (*txrx_pdev_post_attach)(struct cdp_pdev *pdev);
  59. void (*txrx_pdev_pre_detach)(struct cdp_pdev *pdev, int force);
  60. void (*txrx_pdev_detach)(struct cdp_pdev *pdev, int force);
  61. void *(*txrx_peer_create)
  62. (struct cdp_vdev *vdev, uint8_t *peer_mac_addr);
  63. void (*txrx_peer_setup)
  64. (struct cdp_vdev *vdev_hdl, void *peer_hdl);
  65. void (*txrx_peer_teardown)
  66. (struct cdp_vdev *vdev_hdl, void *peer_hdl);
  67. void (*txrx_peer_delete)(void *peer, uint32_t bitmap);
  68. int (*txrx_set_monitor_mode)(struct cdp_vdev *vdev,
  69. uint8_t smart_monitor);
  70. void (*txrx_set_curchan)(struct cdp_pdev *pdev, uint32_t chan_mhz);
  71. void (*txrx_set_privacy_filters)
  72. (struct cdp_vdev *vdev, void *filter, uint32_t num);
  73. /********************************************************************
  74. * Data Interface (B Interface)
  75. ********************************************************************/
  76. void (*txrx_vdev_register)(struct cdp_vdev *vdev,
  77. void *osif_vdev, struct ol_txrx_ops *txrx_ops);
  78. int (*txrx_mgmt_send)(struct cdp_vdev *vdev,
  79. qdf_nbuf_t tx_mgmt_frm, uint8_t type);
  80. int (*txrx_mgmt_send_ext)(struct cdp_vdev *vdev,
  81. qdf_nbuf_t tx_mgmt_frm, uint8_t type, uint8_t use_6mbps,
  82. uint16_t chanfreq);
  83. /**
  84. * ol_txrx_mgmt_tx_cb - tx management delivery notification
  85. * callback function
  86. */
  87. void (*txrx_mgmt_tx_cb_set)(struct cdp_pdev *pdev, uint8_t type,
  88. ol_txrx_mgmt_tx_cb download_cb,
  89. ol_txrx_mgmt_tx_cb ota_ack_cb,
  90. void *ctxt);
  91. int (*txrx_get_tx_pending)(struct cdp_pdev *pdev);
  92. /**
  93. * ol_txrx_data_tx_cb - Function registered with the data path
  94. * that is called when tx frames marked as "no free" are
  95. * done being transmitted
  96. */
  97. void (*txrx_data_tx_cb_set)(struct cdp_vdev *data_vdev,
  98. ol_txrx_data_tx_cb callback, void *ctxt);
  99. /*******************************************************************
  100. * Statistics and Debugging Interface (C Inteface)
  101. ********************************************************************/
  102. int (*txrx_aggr_cfg)(struct cdp_vdev *vdev, int max_subfrms_ampdu,
  103. int max_subfrms_amsdu);
  104. A_STATUS (*txrx_fw_stats_get)(struct cdp_vdev *vdev,
  105. struct ol_txrx_stats_req *req,
  106. bool per_vdev, bool response_expected);
  107. int (*txrx_debug)(struct cdp_vdev *vdev, int debug_specs);
  108. void (*txrx_fw_stats_cfg)(struct cdp_vdev *vdev,
  109. uint8_t cfg_stats_type, uint32_t cfg_val);
  110. void (*txrx_print_level_set)(unsigned level);
  111. /**
  112. * ol_txrx_get_vdev_mac_addr() - Return mac addr of vdev
  113. * @vdev: vdev handle
  114. *
  115. * Return: vdev mac address
  116. */
  117. uint8_t * (*txrx_get_vdev_mac_addr)(struct cdp_vdev *vdev);
  118. /**
  119. * ol_txrx_get_vdev_struct_mac_addr() - Return handle to struct qdf_mac_addr of
  120. * vdev
  121. * @vdev: vdev handle
  122. *
  123. * Return: Handle to struct qdf_mac_addr
  124. */
  125. struct qdf_mac_addr *
  126. (*txrx_get_vdev_struct_mac_addr)(struct cdp_vdev *vdev);
  127. /**
  128. * ol_txrx_get_pdev_from_vdev() - Return handle to pdev of vdev
  129. * @vdev: vdev handle
  130. *
  131. * Return: Handle to pdev
  132. */
  133. struct cdp_pdev *(*txrx_get_pdev_from_vdev)
  134. (struct cdp_vdev *vdev);
  135. /**
  136. * ol_txrx_get_ctrl_pdev_from_vdev() - Return control pdev of vdev
  137. * @vdev: vdev handle
  138. *
  139. * Return: Handle to control pdev
  140. */
  141. struct cdp_cfg *
  142. (*txrx_get_ctrl_pdev_from_vdev)(struct cdp_vdev *vdev);
  143. struct cdp_vdev *
  144. (*txrx_get_vdev_from_vdev_id)(struct cdp_pdev *pdev,
  145. uint8_t vdev_id);
  146. void (*txrx_soc_detach)(void *soc);
  147. int (*addba_requestprocess)(void *peer_handle, uint8_t dialogtoken,
  148. uint16_t tid, uint16_t batimeout, uint16_t buffersize,
  149. uint16_t startseqnum);
  150. void (*addba_responsesetup)(void *peer_handle, uint8_t tid,
  151. uint8_t *dialogtoken, uint16_t *statuscode,
  152. uint16_t *buffersize, uint16_t *batimeout);
  153. int (*delba_process)(void *peer_handle,
  154. int tid, uint16_t reasoncode);
  155. uint8_t (*get_peer_mac_addr_frm_id)(struct cdp_soc_t *soc_handle,
  156. uint16_t peer_id, uint8_t *mac_addr);
  157. void (*set_vdev_dscp_tid_map)(struct cdp_vdev *vdev_handle,
  158. uint8_t map_id);
  159. void (*flush_cache_rx_queue)(void);
  160. void (*set_pdev_dscp_tid_map)(struct cdp_pdev *pdev, uint8_t map_id,
  161. uint8_t tos, uint8_t tid);
  162. int (*txrx_stats)(struct cdp_vdev *vdev, enum cdp_stats stats);
  163. int (*txrx_stats_request)(struct cdp_vdev *vdev,
  164. struct cdp_txrx_stats_req *req);
  165. QDF_STATUS (*display_stats)(void *psoc, uint16_t value,
  166. enum qdf_stats_verbosity_level level);
  167. void (*txrx_soc_set_nss_cfg)(ol_txrx_soc_handle soc, int config);
  168. int(*txrx_soc_get_nss_cfg)(ol_txrx_soc_handle soc);
  169. QDF_STATUS (*txrx_intr_attach)(void *soc);
  170. void (*txrx_intr_detach)(void *soc);
  171. void (*set_pn_check)(struct cdp_vdev *vdev,
  172. struct cdp_peer *peer_handle, enum cdp_sec_type sec_type,
  173. uint32_t *rx_pn);
  174. QDF_STATUS (*update_config_parameters)(struct cdp_soc *psoc,
  175. struct cdp_config_params *params);
  176. };
  177. struct cdp_ctrl_ops {
  178. int
  179. (*txrx_mempools_attach)(void *ctrl_pdev);
  180. int
  181. (*txrx_set_filter_neighbour_peers)(
  182. struct cdp_pdev *pdev,
  183. uint32_t val);
  184. int
  185. (*txrx_update_filter_neighbour_peers)(
  186. struct cdp_pdev *pdev,
  187. uint32_t cmd, uint8_t *macaddr);
  188. /**
  189. * @brief set the safemode of the device
  190. * @details
  191. * This flag is used to bypass the encrypt and decrypt processes when
  192. * send and receive packets. It works like open AUTH mode, HW will
  193. * ctreate all packets as non-encrypt frames because no key installed.
  194. * For rx fragmented frames,it bypasses all the rx defragmentaion.
  195. *
  196. * @param vdev - the data virtual device object
  197. * @param val - the safemode state
  198. * @return - void
  199. */
  200. void
  201. (*txrx_set_safemode)(
  202. struct cdp_vdev *vdev,
  203. u_int32_t val);
  204. /**
  205. * @brief configure the drop unencrypted frame flag
  206. * @details
  207. * Rx related. When set this flag, all the unencrypted frames
  208. * received over a secure connection will be discarded
  209. *
  210. * @param vdev - the data virtual device object
  211. * @param val - flag
  212. * @return - void
  213. */
  214. void
  215. (*txrx_set_drop_unenc)(
  216. struct cdp_vdev *vdev,
  217. u_int32_t val);
  218. /**
  219. * @brief set the Tx encapsulation type of the VDEV
  220. * @details
  221. * This will be used to populate the HTT desc packet type field
  222. * during Tx
  223. * @param vdev - the data virtual device object
  224. * @param val - the Tx encap type
  225. * @return - void
  226. */
  227. void
  228. (*txrx_set_tx_encap_type)(
  229. struct cdp_vdev *vdev,
  230. enum htt_cmn_pkt_type val);
  231. /**
  232. * @brief set the Rx decapsulation type of the VDEV
  233. * @details
  234. * This will be used to configure into firmware and hardware
  235. * which format to decap all Rx packets into, for all peers under
  236. * the VDEV.
  237. * @param vdev - the data virtual device object
  238. * @param val - the Rx decap mode
  239. * @return - void
  240. */
  241. void
  242. (*txrx_set_vdev_rx_decap_type)(
  243. struct cdp_vdev *vdev,
  244. enum htt_cmn_pkt_type val);
  245. /**
  246. * @brief get the Rx decapsulation type of the VDEV
  247. *
  248. * @param vdev - the data virtual device object
  249. * @return - the Rx decap type
  250. */
  251. enum htt_cmn_pkt_type
  252. (*txrx_get_vdev_rx_decap_type)(struct cdp_vdev *vdev);
  253. /* Is this similar to ol_txrx_peer_state_update() in MCL */
  254. /**
  255. * @brief Update the authorize peer object at association time
  256. * @details
  257. * For the host-based implementation of rate-control, it
  258. * updates the peer/node-related parameters within rate-control
  259. * context of the peer at association.
  260. *
  261. * @param peer - pointer to the node's object
  262. * @authorize - either to authorize or unauthorize peer
  263. *
  264. * @return none
  265. */
  266. void
  267. (*txrx_peer_authorize)(struct cdp_peer *peer,
  268. u_int32_t authorize);
  269. bool
  270. (*txrx_set_inact_params)(struct cdp_pdev *pdev,
  271. u_int16_t inact_check_interval,
  272. u_int16_t inact_normal,
  273. u_int16_t inact_overload);
  274. bool
  275. (*txrx_start_inact_timer)(
  276. struct cdp_pdev *pdev,
  277. bool enable);
  278. /**
  279. * @brief Set the overload status of the radio
  280. * @details
  281. * Set the overload status of the radio, updating the inactivity
  282. * threshold and inactivity count for each node.
  283. *
  284. * @param pdev - the data physical device object
  285. * @param overload - whether the radio is overloaded or not
  286. */
  287. void (*txrx_set_overload)(
  288. struct cdp_pdev *pdev,
  289. bool overload);
  290. /**
  291. * @brief Check the inactivity status of the peer/node
  292. *
  293. * @param peer - pointer to the node's object
  294. * @return true if the node is inactive; otherwise return false
  295. */
  296. bool
  297. (*txrx_peer_is_inact)(void *peer);
  298. /**
  299. * @brief Mark inactivity status of the peer/node
  300. * @details
  301. * If it becomes active, reset inactivity count to reload value;
  302. * if the inactivity status changed, notify umac band steering.
  303. *
  304. * @param peer - pointer to the node's object
  305. * @param inactive - whether the node is inactive or not
  306. */
  307. void (*txrx_mark_peer_inact)(
  308. void *peer,
  309. bool inactive);
  310. /* Should be ol_txrx_ctrl_api.h */
  311. void (*txrx_set_mesh_mode)(struct cdp_vdev *vdev, u_int32_t val);
  312. /**
  313. * @brief setting mesh rx filter
  314. * @details
  315. * based on the bits enabled in the filter packets has to be dropped.
  316. *
  317. * @param vdev - the data virtual device object
  318. * @param val - value to set
  319. */
  320. void (*txrx_set_mesh_rx_filter)(struct cdp_vdev *vdev, uint32_t val);
  321. void (*tx_flush_buffers)(struct cdp_vdev *vdev);
  322. int (*txrx_is_target_ar900b)(struct cdp_vdev *vdev);
  323. void (*txrx_set_vdev_param)(struct cdp_vdev *vdev,
  324. enum cdp_vdev_param_type param, uint32_t val);
  325. void (*txrx_peer_set_nawds)(struct cdp_peer *peer, uint8_t value);
  326. /**
  327. * @brief Set the reo dest ring num of the radio
  328. * @details
  329. * Set the reo destination ring no on which we will receive
  330. * pkts for this radio.
  331. *
  332. * @param pdev - the data physical device object
  333. * @param reo_dest_ring_num - value ranges between 1 - 4
  334. */
  335. void (*txrx_set_pdev_reo_dest)(
  336. struct cdp_pdev *pdev,
  337. enum cdp_host_reo_dest_ring reo_dest_ring_num);
  338. /**
  339. * @brief Get the reo dest ring num of the radio
  340. * @details
  341. * Get the reo destination ring no on which we will receive
  342. * pkts for this radio.
  343. *
  344. * @param pdev - the data physical device object
  345. * @return the reo destination ring number
  346. */
  347. enum cdp_host_reo_dest_ring (*txrx_get_pdev_reo_dest)(
  348. struct cdp_pdev *pdev);
  349. int (*txrx_wdi_event_sub)(struct cdp_pdev *pdev, void *event_cb_sub,
  350. uint32_t event);
  351. int (*txrx_wdi_event_unsub)(struct cdp_pdev *pdev, void *event_cb_sub,
  352. uint32_t event);
  353. int (*txrx_get_sec_type)(struct cdp_peer *peer, uint8_t sec_idx);
  354. void (*txrx_update_mgmt_txpow_vdev)(struct cdp_vdev *vdev,
  355. uint8_t subtype, uint8_t tx_power);
  356. void (*txrx_set_pdev_param)(struct cdp_pdev *pdev,
  357. enum cdp_pdev_param_type type, uint8_t val);
  358. };
  359. struct cdp_me_ops {
  360. u_int16_t (*tx_desc_alloc_and_mark_for_mcast_clone)
  361. (struct cdp_pdev *pdev, u_int16_t buf_count);
  362. u_int16_t (*tx_desc_free_and_unmark_for_mcast_clone)(
  363. struct cdp_pdev *pdev,
  364. u_int16_t buf_count);
  365. u_int16_t
  366. (*tx_get_mcast_buf_allocated_marked)
  367. (struct cdp_pdev *pdev);
  368. void
  369. (*tx_me_alloc_descriptor)(struct cdp_pdev *pdev);
  370. void
  371. (*tx_me_free_descriptor)(struct cdp_pdev *pdev);
  372. uint16_t
  373. (*tx_me_convert_ucast)(struct cdp_vdev *vdev,
  374. qdf_nbuf_t wbuf, u_int8_t newmac[][6],
  375. uint8_t newmaccnt);
  376. /* Should be a function pointer in ol_txrx_osif_ops{} */
  377. /**
  378. * @brief notify mcast frame indication from FW.
  379. * @details
  380. * This notification will be used to convert
  381. * multicast frame to unicast.
  382. *
  383. * @param pdev - handle to the ctrl SW's physical device object
  384. * @param vdev_id - ID of the virtual device received the special data
  385. * @param msdu - the multicast msdu returned by FW for host inspect
  386. */
  387. int (*mcast_notify)(struct cdp_pdev *pdev,
  388. u_int8_t vdev_id, qdf_nbuf_t msdu);
  389. };
  390. struct cdp_mon_ops {
  391. void (*txrx_monitor_set_filter_ucast_data)
  392. (struct cdp_pdev *, u_int8_t val);
  393. void (*txrx_monitor_set_filter_mcast_data)
  394. (struct cdp_pdev *, u_int8_t val);
  395. void (*txrx_monitor_set_filter_non_data)
  396. (struct cdp_pdev *, u_int8_t val);
  397. u_int8_t (*txrx_monitor_get_filter_ucast_data)
  398. (struct cdp_vdev *vdev_txrx_handle);
  399. u_int8_t (*txrx_monitor_get_filter_mcast_data)
  400. (struct cdp_vdev *vdev_txrx_handle);
  401. u_int8_t (*txrx_monitor_get_filter_non_data)
  402. (struct cdp_vdev *vdev_txrx_handle);
  403. int (*txrx_reset_monitor_mode)(struct cdp_pdev *pdev);
  404. };
  405. struct cdp_host_stats_ops {
  406. int (*txrx_host_stats_get)(struct cdp_vdev *vdev,
  407. struct ol_txrx_stats_req *req);
  408. void (*txrx_host_stats_clr)(struct cdp_vdev *vdev);
  409. void (*txrx_host_ce_stats)(struct cdp_vdev *vdev);
  410. int (*txrx_stats_publish)(struct cdp_pdev *pdev,
  411. void *buf);
  412. /**
  413. * @brief Enable enhanced stats functionality.
  414. *
  415. * @param pdev - the physical device object
  416. * @return - void
  417. */
  418. void (*txrx_enable_enhanced_stats)(struct cdp_pdev *pdev);
  419. /**
  420. * @brief Disable enhanced stats functionality.
  421. *
  422. * @param pdev - the physical device object
  423. * @return - void
  424. */
  425. void (*txrx_disable_enhanced_stats)(struct cdp_pdev *pdev);
  426. /**
  427. * @brief Get the desired stats from the message.
  428. *
  429. * @param pdev - the physical device object
  430. * @param stats_base - stats buffer recieved from FW
  431. * @param type - stats type.
  432. * @return - pointer to requested stat identified by type
  433. */
  434. uint32_t * (*txrx_get_stats_base)(struct cdp_pdev *pdev,
  435. uint32_t *stats_base, uint32_t msg_len, uint8_t type);
  436. void
  437. (*tx_print_tso_stats)(struct cdp_vdev *vdev);
  438. void
  439. (*tx_rst_tso_stats)(struct cdp_vdev *vdev);
  440. void
  441. (*tx_print_sg_stats)(struct cdp_vdev *vdev);
  442. void
  443. (*tx_rst_sg_stats)(struct cdp_vdev *vdev);
  444. void
  445. (*print_rx_cksum_stats)(struct cdp_vdev *vdev);
  446. void
  447. (*rst_rx_cksum_stats)(struct cdp_vdev *vdev);
  448. A_STATUS
  449. (*txrx_host_me_stats)(struct cdp_vdev *vdev);
  450. void
  451. (*txrx_per_peer_stats)(struct cdp_pdev *pdev, char *addr);
  452. int (*txrx_host_msdu_ttl_stats)(struct cdp_vdev *vdev,
  453. struct ol_txrx_stats_req *req);
  454. void
  455. (*print_lro_stats)(struct cdp_vdev *vdev);
  456. void
  457. (*reset_lro_stats)(struct cdp_vdev *vdev);
  458. void
  459. (*get_fw_peer_stats)(struct cdp_pdev *pdev, uint8_t *addr,
  460. uint32_t cap);
  461. };
  462. struct cdp_wds_ops {
  463. void
  464. (*txrx_set_wds_rx_policy)(struct cdp_vdev *vdev,
  465. u_int32_t val);
  466. int (*vdev_set_wds)(void *vdev, uint32_t val);
  467. };
  468. struct cdp_raw_ops {
  469. int (*txrx_get_nwifi_mode)(struct cdp_vdev *vdev);
  470. void (*rsim_get_astentry)(struct cdp_vdev *vdev,
  471. qdf_nbuf_t *pnbuf,
  472. struct cdp_raw_ast *raw_ast);
  473. };
  474. #ifdef CONFIG_WIN
  475. struct cdp_pflow_ops {
  476. uint32_t(*pflow_update_pdev_params)(void *,
  477. enum _ol_ath_param_t, uint32_t, void *);
  478. };
  479. #endif /* CONFIG_WIN */
  480. #define LRO_IPV4_SEED_ARR_SZ 5
  481. #define LRO_IPV6_SEED_ARR_SZ 11
  482. /**
  483. * struct cdp_lro_config - set LRO init parameters
  484. * @lro_enable: indicates whether lro is enabled
  485. * @tcp_flag: If the TCP flags from the packet do not match
  486. * the values in this field after masking with TCP flags mask
  487. * below, packet is not LRO eligible
  488. * @tcp_flag_mask: field for comparing the TCP values provided
  489. * above with the TCP flags field in the received packet
  490. * @toeplitz_hash_ipv4: contains seed needed to compute the flow id
  491. * 5-tuple toeplitz hash for ipv4 packets
  492. * @toeplitz_hash_ipv6: contains seed needed to compute the flow id
  493. * 5-tuple toeplitz hash for ipv6 packets
  494. */
  495. struct cdp_lro_hash_config {
  496. uint32_t lro_enable;
  497. uint32_t tcp_flag:9,
  498. tcp_flag_mask:9;
  499. uint32_t toeplitz_hash_ipv4[LRO_IPV4_SEED_ARR_SZ];
  500. uint32_t toeplitz_hash_ipv6[LRO_IPV6_SEED_ARR_SZ];
  501. };
  502. struct ol_if_ops {
  503. void (*peer_set_default_routing)(void *scn_handle,
  504. uint8_t *peer_macaddr, uint8_t vdev_id,
  505. bool hash_based, uint8_t ring_num);
  506. int (*peer_rx_reorder_queue_setup)(void *scn_handle,
  507. uint8_t vdev_id, uint8_t *peer_mac,
  508. qdf_dma_addr_t hw_qdesc, int tid, uint16_t queue_num);
  509. int (*peer_rx_reorder_queue_remove)(void *scn_handle,
  510. uint8_t vdev_id, uint8_t *peer_macaddr,
  511. uint32_t tid_mask);
  512. int (*peer_unref_delete)(void *scn_handle, uint8_t vdev_id,
  513. uint8_t *peer_macaddr);
  514. bool (*is_hw_dbs_2x2_capable)(struct wlan_objmgr_psoc *psoc);
  515. int (*peer_add_wds_entry)(void *ol_soc_handle,
  516. const uint8_t *dest_macaddr, uint8_t *peer_macaddr,
  517. uint32_t flags);
  518. int (*peer_update_wds_entry)(void *ol_soc_handle,
  519. uint8_t *dest_macaddr, uint8_t *peer_macaddr,
  520. uint32_t flags);
  521. void (*peer_del_wds_entry)(void *ol_soc_handle,
  522. uint8_t *wds_macaddr);
  523. QDF_STATUS (*lro_hash_config)(void *scn_handle,
  524. struct cdp_lro_hash_config *lro_hash);
  525. void (*update_dp_stats)(void *soc, void *stats, uint16_t id,
  526. uint8_t type);
  527. uint8_t (*rx_invalid_peer)(void *osif_pdev, void *msg);
  528. int (*peer_map_event)(void *ol_soc_handle, uint16_t peer_id, uint16_t hw_peer_id,
  529. uint8_t vdev_id, uint8_t *peer_mac_addr,
  530. enum cdp_txrx_ast_entry_type peer_type);
  531. int (*peer_unmap_event)(void *ol_soc_handle, uint16_t peer_id);
  532. int (*get_dp_cfg_param)(void *ol_soc_handle, enum cdp_cfg_param_type param_num);
  533. void (*rx_mic_error)(void *ol_soc_handle,
  534. uint16_t vdev_id, void *wh);
  535. uint8_t (*freq_to_channel)(void *ol_soc_handle, uint16_t vdev_id);
  536. /* TODO: Add any other control path calls required to OL_IF/WMA layer */
  537. };
  538. #ifndef CONFIG_WIN
  539. /* From here MCL specific OPs */
  540. /**
  541. * struct cdp_misc_ops - mcl ops not classified
  542. * @set_ibss_vdev_heart_beat_timer:
  543. * @bad_peer_txctl_set_setting:
  544. * @bad_peer_txctl_update_threshold:
  545. * @hl_tdls_flag_reset:
  546. * @tx_non_std:
  547. * @get_vdev_id:
  548. * @set_wisa_mode:
  549. * @txrx_data_stall_cb_register:
  550. * @txrx_data_stall_cb_deregister:
  551. * @txrx_post_data_stall_event
  552. * @runtime_suspend:
  553. * @runtime_resume:
  554. */
  555. struct cdp_misc_ops {
  556. uint16_t (*set_ibss_vdev_heart_beat_timer)(struct cdp_vdev *vdev,
  557. uint16_t timer_value_sec);
  558. void (*set_wmm_param)(struct cdp_pdev *cfg_pdev,
  559. struct ol_tx_wmm_param_t wmm_param);
  560. void (*bad_peer_txctl_set_setting)(struct cdp_pdev *pdev, int enable,
  561. int period, int txq_limit);
  562. void (*bad_peer_txctl_update_threshold)(struct cdp_pdev *pdev,
  563. int level, int tput_thresh, int tx_limit);
  564. void (*hl_tdls_flag_reset)(struct cdp_vdev *vdev, bool flag);
  565. qdf_nbuf_t (*tx_non_std)(struct cdp_vdev *vdev,
  566. enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list);
  567. uint16_t (*get_vdev_id)(struct cdp_vdev *vdev);
  568. QDF_STATUS (*set_wisa_mode)(struct cdp_vdev *vdev, bool enable);
  569. QDF_STATUS (*txrx_data_stall_cb_register)(data_stall_detect_cb cb);
  570. QDF_STATUS (*txrx_data_stall_cb_deregister)(data_stall_detect_cb cb);
  571. void (*txrx_post_data_stall_event)(
  572. enum data_stall_log_event_indicator indicator,
  573. enum data_stall_log_event_type data_stall_type,
  574. uint32_t pdev_id, uint32_t vdev_id_bitmap,
  575. enum data_stall_log_recovery_type recovery_type);
  576. QDF_STATUS (*runtime_suspend)(struct cdp_pdev *pdev);
  577. QDF_STATUS (*runtime_resume)(struct cdp_pdev *pdev);
  578. int (*get_opmode)(struct cdp_vdev *vdev);
  579. void (*mark_first_wakeup_packet)(uint8_t value);
  580. void (*update_mac_id)(uint8_t vdev_id, uint8_t mac_id);
  581. void (*flush_rx_frames)(void *peer, bool drop);
  582. A_STATUS (*get_intra_bss_fwd_pkts_count)(uint8_t vdev_id,
  583. uint64_t *fwd_tx_packets, uint64_t *fwd_rx_packets);
  584. void (*pkt_log_init)(struct cdp_pdev *handle, void *scn);
  585. void (*pkt_log_con_service)(struct cdp_pdev *pdev, void *scn);
  586. };
  587. /**
  588. * struct cdp_tx_delay_ops - mcl tx delay ops
  589. * @tx_delay:
  590. * @tx_delay_hist:
  591. * @tx_packet_count:
  592. * @tx_set_compute_interval:
  593. */
  594. struct cdp_tx_delay_ops {
  595. void (*tx_delay)(struct cdp_pdev *pdev, uint32_t *queue_delay_microsec,
  596. uint32_t *tx_delay_microsec, int category);
  597. void (*tx_delay_hist)(struct cdp_pdev *pdev,
  598. uint16_t *bin_values, int category);
  599. void (*tx_packet_count)(struct cdp_pdev *pdev,
  600. uint16_t *out_packet_count,
  601. uint16_t *out_packet_loss_count, int category);
  602. void (*tx_set_compute_interval)(struct cdp_pdev *pdev,
  603. uint32_t interval);
  604. };
  605. /**
  606. * struct cdp_pmf_ops - mcl protected management frame ops
  607. * @get_pn_info:
  608. */
  609. struct cdp_pmf_ops {
  610. void (*get_pn_info)(void *peer, uint8_t **last_pn_valid,
  611. uint64_t **last_pn, uint32_t **rmf_pn_replays);
  612. };
  613. /**
  614. * struct cdp_cfg_ops - mcl configuration ops
  615. * @set_cfg_rx_fwd_disabled:
  616. * @set_cfg_packet_log_enabled:
  617. * @cfg_attach:
  618. * @vdev_rx_set_intrabss_fwd:
  619. * @get_opmode:
  620. * @is_rx_fwd_disabled:
  621. * @tx_set_is_mgmt_over_wmi_enabled:
  622. * @is_high_latency:
  623. * @set_flow_control_parameters:
  624. */
  625. struct cdp_cfg_ops {
  626. void (*set_cfg_rx_fwd_disabled)(struct cdp_cfg *cfg_pdev,
  627. uint8_t disable_rx_fwd);
  628. void (*set_cfg_packet_log_enabled)(struct cdp_cfg *cfg_pdev,
  629. uint8_t val);
  630. struct cdp_cfg * (*cfg_attach)(qdf_device_t osdev, void *cfg_param);
  631. void (*vdev_rx_set_intrabss_fwd)(struct cdp_vdev *vdev, bool val);
  632. uint8_t (*is_rx_fwd_disabled)(struct cdp_vdev *vdev);
  633. void (*tx_set_is_mgmt_over_wmi_enabled)(uint8_t value);
  634. int (*is_high_latency)(struct cdp_cfg *cfg_pdev);
  635. void (*set_flow_control_parameters)(struct cdp_cfg *cfg_pdev,
  636. void *param);
  637. void (*set_flow_steering)(struct cdp_cfg *cfg_pdev, uint8_t val);
  638. void (*set_ptp_rx_opt_enabled)(struct cdp_cfg *cfg_pdev, uint8_t val);
  639. };
  640. /**
  641. * struct cdp_flowctl_ops - mcl flow control
  642. * @register_pause_cb:
  643. * @set_desc_global_pool_size:
  644. * @dump_flow_pool_info:
  645. */
  646. struct cdp_flowctl_ops {
  647. QDF_STATUS (*register_pause_cb)(struct cdp_soc_t *soc,
  648. tx_pause_callback);
  649. void (*set_desc_global_pool_size)(uint32_t num_msdu_desc);
  650. void (*dump_flow_pool_info)(void *);
  651. };
  652. /**
  653. * struct cdp_lflowctl_ops - mcl legacy flow control ops
  654. * @register_tx_flow_control:
  655. * @deregister_tx_flow_control_cb:
  656. * @flow_control_cb:
  657. * @get_tx_resource:
  658. * @ll_set_tx_pause_q_depth:
  659. * @vdev_flush:
  660. * @vdev_pause:
  661. * @vdev_unpause:
  662. */
  663. struct cdp_lflowctl_ops {
  664. int (*register_tx_flow_control)(uint8_t vdev_id,
  665. ol_txrx_tx_flow_control_fp flowControl, void *osif_fc_ctx,
  666. ol_txrx_tx_flow_control_is_pause_fp flow_control_is_pause);
  667. int (*deregister_tx_flow_control_cb)(uint8_t vdev_id);
  668. void (*flow_control_cb)(struct cdp_vdev *vdev, bool tx_resume);
  669. bool (*get_tx_resource)(uint8_t sta_id,
  670. unsigned int low_watermark,
  671. unsigned int high_watermark_offset);
  672. int (*ll_set_tx_pause_q_depth)(uint8_t vdev_id, int pause_q_depth);
  673. void (*vdev_flush)(struct cdp_vdev *vdev);
  674. void (*vdev_pause)(struct cdp_vdev *vdev, uint32_t reason);
  675. void (*vdev_unpause)(struct cdp_vdev *vdev, uint32_t reason);
  676. };
  677. #ifdef IPA_OFFLOAD
  678. /**
  679. * struct cdp_ipa_ops - mcl ipa data path ops
  680. * @ipa_get_resource:
  681. * @ipa_set_doorbell_paddr:
  682. * @ipa_set_active:
  683. * @ipa_op_response:
  684. * @ipa_register_op_cb:
  685. * @ipa_get_stat:
  686. * @ipa_tx_data_frame:
  687. */
  688. struct cdp_ipa_ops {
  689. QDF_STATUS (*ipa_get_resource)(struct cdp_pdev *pdev);
  690. QDF_STATUS (*ipa_set_doorbell_paddr)(struct cdp_pdev *pdev);
  691. QDF_STATUS (*ipa_set_active)(struct cdp_pdev *pdev, bool uc_active,
  692. bool is_tx);
  693. QDF_STATUS (*ipa_op_response)(struct cdp_pdev *pdev, uint8_t *op_msg);
  694. QDF_STATUS (*ipa_register_op_cb)(struct cdp_pdev *pdev,
  695. void (*ipa_uc_op_cb_type)(uint8_t *op_msg, void *osif_ctxt),
  696. void *usr_ctxt);
  697. QDF_STATUS (*ipa_get_stat)(struct cdp_pdev *pdev);
  698. qdf_nbuf_t (*ipa_tx_data_frame)(struct cdp_vdev *vdev, qdf_nbuf_t skb);
  699. void (*ipa_set_uc_tx_partition_base)(struct cdp_cfg *pdev,
  700. uint32_t value);
  701. #ifdef FEATURE_METERING
  702. QDF_STATUS (*ipa_uc_get_share_stats)(struct cdp_pdev *pdev,
  703. uint8_t reset_stats);
  704. QDF_STATUS (*ipa_uc_set_quota)(struct cdp_pdev *pdev,
  705. uint64_t quota_bytes);
  706. #endif
  707. QDF_STATUS (*ipa_enable_autonomy)(struct cdp_pdev *pdev);
  708. QDF_STATUS (*ipa_disable_autonomy)(struct cdp_pdev *pdev);
  709. QDF_STATUS (*ipa_setup)(struct cdp_pdev *pdev, void *ipa_i2w_cb,
  710. void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
  711. uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
  712. uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle);
  713. QDF_STATUS (*ipa_cleanup)(uint32_t tx_pipe_handle,
  714. uint32_t rx_pipe_handle);
  715. QDF_STATUS (*ipa_setup_iface)(char *ifname, uint8_t *mac_addr,
  716. qdf_ipa_client_type_t prod_client,
  717. qdf_ipa_client_type_t cons_client,
  718. uint8_t session_id, bool is_ipv6_enabled);
  719. QDF_STATUS (*ipa_cleanup_iface)(char *ifname, bool is_ipv6_enabled);
  720. QDF_STATUS (*ipa_enable_pipes)(struct cdp_pdev *pdev);
  721. QDF_STATUS (*ipa_disable_pipes)(struct cdp_pdev *pdev);
  722. QDF_STATUS (*ipa_set_perf_level)(int client,
  723. uint32_t max_supported_bw_mbps);
  724. };
  725. #endif
  726. /**
  727. * struct cdp_bus_ops - mcl bus suspend/resume ops
  728. * @bus_suspend:
  729. * @bus_resume:
  730. */
  731. struct cdp_bus_ops {
  732. QDF_STATUS (*bus_suspend)(struct cdp_pdev *opaque_pdev);
  733. QDF_STATUS (*bus_resume)(struct cdp_pdev *opaque_pdev);
  734. };
  735. /**
  736. * struct cdp_ocb_ops - mcl ocb ops
  737. * @set_ocb_chan_info:
  738. * @get_ocb_chan_info:
  739. */
  740. struct cdp_ocb_ops {
  741. void (*set_ocb_chan_info)(struct cdp_vdev *vdev,
  742. struct ol_txrx_ocb_set_chan ocb_set_chan);
  743. struct ol_txrx_ocb_chan_info *
  744. (*get_ocb_chan_info)(struct cdp_vdev *vdev);
  745. };
  746. /**
  747. * struct cdp_peer_ops - mcl peer related ops
  748. * @register_peer:
  749. * @clear_peer:
  750. * @cfg_attach:
  751. * @find_peer_by_addr:
  752. * @find_peer_by_addr_and_vdev:
  753. * @local_peer_id:
  754. * @peer_find_by_local_id:
  755. * @peer_state_update:
  756. * @get_vdevid:
  757. * @get_vdev_by_sta_id:
  758. * @register_ocb_peer:
  759. * @peer_get_peer_mac_addr:
  760. * @get_peer_state:
  761. * @get_vdev_for_peer:
  762. * @update_ibss_add_peer_num_of_vdev:
  763. * @remove_peers_for_vdev:
  764. * @remove_peers_for_vdev_no_lock:
  765. * @copy_mac_addr_raw:
  766. * @add_last_real_peer:
  767. * @last_assoc_received:
  768. * @last_disassoc_received:
  769. * @last_deauth_received:
  770. * @is_vdev_restore_last_peer:
  771. * @update_last_real_peer:
  772. */
  773. struct cdp_peer_ops {
  774. QDF_STATUS (*register_peer)(struct cdp_pdev *pdev,
  775. struct ol_txrx_desc_type *sta_desc);
  776. QDF_STATUS (*clear_peer)(struct cdp_pdev *pdev, uint8_t sta_id);
  777. QDF_STATUS (*change_peer_state)(uint8_t sta_id,
  778. enum ol_txrx_peer_state sta_state,
  779. bool roam_synch_in_progress);
  780. void * (*find_peer_by_addr)(struct cdp_pdev *pdev,
  781. uint8_t *peer_addr, uint8_t *peer_id);
  782. void * (*find_peer_by_addr_and_vdev)(struct cdp_pdev *pdev,
  783. struct cdp_vdev *vdev,
  784. uint8_t *peer_addr, uint8_t *peer_id);
  785. uint16_t (*local_peer_id)(void *peer);
  786. void * (*peer_find_by_local_id)(struct cdp_pdev *pdev,
  787. uint8_t local_peer_id);
  788. QDF_STATUS (*peer_state_update)(struct cdp_pdev *pdev,
  789. uint8_t *peer_addr,
  790. enum ol_txrx_peer_state state);
  791. QDF_STATUS (*get_vdevid)(void *peer, uint8_t *vdev_id);
  792. struct cdp_vdev * (*get_vdev_by_sta_id)(struct cdp_pdev *pdev,
  793. uint8_t sta_id);
  794. QDF_STATUS (*register_ocb_peer)(uint8_t *mac_addr, uint8_t *peer_id);
  795. uint8_t * (*peer_get_peer_mac_addr)(void *peer);
  796. int (*get_peer_state)(void *peer);
  797. struct cdp_vdev * (*get_vdev_for_peer)(void *peer);
  798. int16_t (*update_ibss_add_peer_num_of_vdev)(struct cdp_vdev *vdev,
  799. int16_t peer_num_delta);
  800. void (*remove_peers_for_vdev)(struct cdp_vdev *vdev,
  801. ol_txrx_vdev_peer_remove_cb callback,
  802. void *callback_context, bool remove_last_peer);
  803. void (*remove_peers_for_vdev_no_lock)(struct cdp_vdev *vdev,
  804. ol_txrx_vdev_peer_remove_cb callback,
  805. void *callback_context);
  806. void (*copy_mac_addr_raw)(struct cdp_vdev *vdev, uint8_t *bss_addr);
  807. void (*add_last_real_peer)(struct cdp_pdev *pdev,
  808. struct cdp_vdev *vdev, uint8_t *peer_id);
  809. qdf_time_t * (*last_assoc_received)(void *peer);
  810. qdf_time_t * (*last_disassoc_received)(void *peer);
  811. qdf_time_t * (*last_deauth_received)(void *peer);
  812. bool (*is_vdev_restore_last_peer)(void *peer);
  813. void (*update_last_real_peer)(struct cdp_pdev *pdev, void *peer,
  814. uint8_t *peer_id, bool restore_last_peer);
  815. void (*peer_detach_force_delete)(void *peer);
  816. };
  817. /**
  818. * struct cdp_ocb_ops - mcl ocb ops
  819. * @throttle_init_period:
  820. * @throttle_set_level:
  821. */
  822. struct cdp_throttle_ops {
  823. void (*throttle_init_period)(struct cdp_pdev *pdev, int period,
  824. uint8_t *dutycycle_level);
  825. void (*throttle_set_level)(struct cdp_pdev *pdev, int level);
  826. };
  827. /**
  828. * struct cdp_ocb_ops - mcl ocb ops
  829. * @clear_stats:
  830. * @stats:
  831. */
  832. struct cdp_mob_stats_ops {
  833. void (*clear_stats)(uint16_t bitmap);
  834. int (*stats)(uint8_t vdev_id, char *buffer, unsigned buf_len);
  835. };
  836. #endif /* CONFIG_WIN */
  837. struct cdp_ops {
  838. struct cdp_cmn_ops *cmn_drv_ops;
  839. struct cdp_ctrl_ops *ctrl_ops;
  840. struct cdp_me_ops *me_ops;
  841. struct cdp_mon_ops *mon_ops;
  842. struct cdp_host_stats_ops *host_stats_ops;
  843. struct cdp_wds_ops *wds_ops;
  844. struct cdp_raw_ops *raw_ops;
  845. struct cdp_pflow_ops *pflow_ops;
  846. #ifndef CONFIG_WIN
  847. struct cdp_misc_ops *misc_ops;
  848. struct cdp_cfg_ops *cfg_ops;
  849. struct cdp_flowctl_ops *flowctl_ops;
  850. struct cdp_lflowctl_ops *l_flowctl_ops;
  851. #ifdef IPA_OFFLOAD
  852. struct cdp_ipa_ops *ipa_ops;
  853. #endif
  854. struct cdp_bus_ops *bus_ops;
  855. struct cdp_ocb_ops *ocb_ops;
  856. struct cdp_peer_ops *peer_ops;
  857. struct cdp_throttle_ops *throttle_ops;
  858. struct cdp_mob_stats_ops *mob_stats_ops;
  859. struct cdp_tx_delay_ops *delay_ops;
  860. struct cdp_pmf_ops *pmf_ops;
  861. #endif /* CONFIG_WIN */
  862. };
  863. #endif