cdp_txrx_ops.h 27 KB

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