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