cdp_txrx_ops.h 29 KB

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