1 /* 2 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 /** 19 * DOC: Declare various struct, macros which are used for private to DP. 20 * 21 * Note: This file shall not contain public API's prototype/declarations. 22 * 23 */ 24 25 #ifndef _WLAN_DP_PRIV_STRUCT_H_ 26 #define _WLAN_DP_PRIV_STRUCT_H_ 27 28 #include "wlan_dp_public_struct.h" 29 #include "cdp_txrx_cmn.h" 30 #include "wlan_dp_cfg.h" 31 #include "wlan_dp_objmgr.h" 32 #include <cdp_txrx_misc.h> 33 #include <wlan_dp_rx_thread.h> 34 #include "qdf_periodic_work.h" 35 #include <cds_api.h> 36 #include "pld_common.h" 37 #include "wlan_dp_nud_tracking.h" 38 #include <i_qdf_net_stats.h> 39 #include <qdf_types.h> 40 #include "htc_api.h" 41 #include "wlan_dp_wfds.h" 42 43 #ifndef NUM_TX_RX_HISTOGRAM 44 #define NUM_TX_RX_HISTOGRAM 128 45 #endif 46 47 #define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1) 48 49 #if defined(WLAN_FEATURE_DP_BUS_BANDWIDTH) && defined(FEATURE_RUNTIME_PM) 50 /** 51 * enum dp_rtpm_tput_policy_state - states to track runtime_pm tput policy 52 * @DP_RTPM_TPUT_POLICY_STATE_INVALID: invalid state 53 * @DP_RTPM_TPUT_POLICY_STATE_REQUIRED: state indicating runtime_pm is required 54 * @DP_RTPM_TPUT_POLICY_STATE_NOT_REQUIRED: state indicating runtime_pm is NOT 55 * required 56 */ 57 enum dp_rtpm_tput_policy_state { 58 DP_RTPM_TPUT_POLICY_STATE_INVALID, 59 DP_RTPM_TPUT_POLICY_STATE_REQUIRED, 60 DP_RTPM_TPUT_POLICY_STATE_NOT_REQUIRED 61 }; 62 63 /** 64 * struct dp_rtpm_tput_policy_context - RTPM throughput policy context 65 * @curr_state: current state of throughput policy (RTPM require or not) 66 * @wake_lock: wakelock for QDF wake_lock acquire/release APIs 67 * @rtpm_lock: lock use for QDF rutime PM prevent/allow APIs 68 * @high_tput_vote: atomic variable to keep track of voting 69 */ 70 struct dp_rtpm_tput_policy_context { 71 enum dp_rtpm_tput_policy_state curr_state; 72 qdf_wake_lock_t wake_lock; 73 qdf_runtime_lock_t rtpm_lock; 74 qdf_atomic_t high_tput_vote; 75 }; 76 #endif 77 78 #define FISA_FLOW_MAX_AGGR_COUNT 16 /* max flow aggregate count */ 79 80 /** 81 * struct wlan_dp_psoc_cfg - DP configuration parameters. 82 * @tx_orphan_enable: Enable/Disable tx orphan 83 * @rx_mode: rx mode for packet processing 84 * @tx_comp_loop_pkt_limit: max # of packets to be processed 85 * @rx_reap_loop_pkt_limit: max # of packets to be reaped 86 * @rx_hp_oos_update_limit: max # of HP OOS (out of sync) 87 * @rx_softirq_max_yield_duration_ns: max duration for RX softirq 88 * @periodic_stats_timer_interval: Print selective stats on this specified 89 * interval 90 * @periodic_stats_timer_duration: duration for which periodic timer should run 91 * @bus_bw_super_high_threshold: bus bandwidth super high threshold 92 * @bus_bw_ultra_high_threshold: bus bandwidth ultra high threshold 93 * @bus_bw_very_high_threshold: bus bandwidth very high threshold 94 * @bus_bw_mid_high_threshold: bus bandwidth mid high threshold 95 * @bus_bw_dbs_threshold: bus bandwidth for DBS mode threshold 96 * @bus_bw_high_threshold: bus bandwidth high threshold 97 * @bus_bw_medium_threshold: bandwidth threshold for medium bandwidth 98 * @bus_bw_low_threshold: bandwidth threshold for low bandwidth 99 * @bus_bw_compute_interval: bus bandwidth compute interval 100 * @enable_tcp_delack: enable Dynamic Configuration of Tcp Delayed Ack 101 * @enable_tcp_limit_output: enable TCP limit output 102 * @enable_tcp_adv_win_scale: enable TCP adv window scaling 103 * @tcp_delack_thres_high: High Threshold inorder to trigger TCP Del Ack 104 * indication 105 * @tcp_delack_thres_low: Low Threshold inorder to trigger TCP Del Ack 106 * indication 107 * @tcp_tx_high_tput_thres: High Threshold inorder to trigger High Tx 108 * Throughput requirement. 109 * @tcp_delack_timer_count: Del Ack Timer Count inorder to trigger TCP Del Ack 110 * indication 111 * @enable_tcp_param_update: enable tcp parameter update 112 * @bus_low_cnt_threshold: Threshold count to trigger low Tput GRO flush skip 113 * @enable_latency_crit_clients: Enable the handling of latency critical clients 114 * * @del_ack_enable: enable Dynamic Configuration of Tcp Delayed Ack 115 * @del_ack_threshold_high: High Threshold inorder to trigger TCP delay ack 116 * @del_ack_threshold_low: Low Threshold inorder to trigger TCP delay ack 117 * @del_ack_timer_value: Timeout value (ms) to send out all TCP del ack frames 118 * @del_ack_pkt_count: The maximum number of TCP delay ack frames 119 * @rx_thread_ul_affinity_mask: CPU mask to affine Rx_thread 120 * @rx_thread_affinity_mask: CPU mask to affine Rx_thread 121 * @cpu_map_list: RPS map for different RX queues 122 * @multicast_replay_filter: enable filtering of replayed multicast packets 123 * @rx_wakelock_timeout: Amount of time to hold wakelock for RX unicast packets 124 * @num_dp_rx_threads: number of dp rx threads 125 * @enable_dp_trace: Enable/Disable DP trace 126 * @dp_trace_config: DP trace configuration 127 * @enable_nud_tracking: Enable/Disable nud tracking 128 * @pkt_bundle_threshold_high: tx bundle high threshold 129 * @pkt_bundle_threshold_low: tx bundle low threshold 130 * @pkt_bundle_timer_value: tx bundle timer value in ms 131 * @pkt_bundle_size: tx bundle size 132 * @dp_proto_event_bitmap: Control for which protocol type diag log should be 133 * sent 134 * @fisa_enable: Enable/Disable FISA 135 * @icmp_req_to_fw_mark_interval: Interval to mark the ICMP Request packet to 136 * be sent to FW. 137 * @lro_enable: Enable/Disable lro 138 * @gro_enable: Enable/Disable gro 139 * @is_rx_fisa_enabled: flag to enable/disable FISA Rx 140 * @is_rx_fisa_lru_del_enabled: flag to enable/disable FST entry delete 141 */ 142 struct wlan_dp_psoc_cfg { 143 bool tx_orphan_enable; 144 145 uint32_t rx_mode; 146 uint32_t tx_comp_loop_pkt_limit; 147 uint32_t rx_reap_loop_pkt_limit; 148 uint32_t rx_hp_oos_update_limit; 149 uint64_t rx_softirq_max_yield_duration_ns; 150 #ifdef WLAN_FEATURE_PERIODIC_STA_STATS 151 uint32_t periodic_stats_timer_interval; 152 uint32_t periodic_stats_timer_duration; 153 #endif /* WLAN_FEATURE_PERIODIC_STA_STATS */ 154 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH 155 uint32_t bus_bw_super_high_threshold; 156 uint32_t bus_bw_ultra_high_threshold; 157 uint32_t bus_bw_very_high_threshold; 158 uint32_t bus_bw_dbs_threshold; 159 uint32_t bus_bw_mid_high_threshold; 160 uint32_t bus_bw_high_threshold; 161 uint32_t bus_bw_medium_threshold; 162 uint32_t bus_bw_low_threshold; 163 uint32_t bus_bw_compute_interval; 164 uint32_t enable_tcp_delack; 165 bool enable_tcp_limit_output; 166 uint32_t enable_tcp_adv_win_scale; 167 uint32_t tcp_delack_thres_high; 168 uint32_t tcp_delack_thres_low; 169 uint32_t tcp_tx_high_tput_thres; 170 uint32_t tcp_delack_timer_count; 171 bool enable_tcp_param_update; 172 uint32_t bus_low_cnt_threshold; 173 bool enable_latency_crit_clients; 174 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/ 175 176 #ifdef QCA_SUPPORT_TXRX_DRIVER_TCP_DEL_ACK 177 bool del_ack_enable; 178 uint32_t del_ack_threshold_high; 179 uint32_t del_ack_threshold_low; 180 uint16_t del_ack_timer_value; 181 uint16_t del_ack_pkt_count; 182 #endif 183 uint32_t rx_thread_ul_affinity_mask; 184 uint32_t rx_thread_affinity_mask; 185 uint8_t cpu_map_list[CFG_DP_RPS_RX_QUEUE_CPU_MAP_LIST_LEN]; 186 bool multicast_replay_filter; 187 uint32_t rx_wakelock_timeout; 188 uint8_t num_dp_rx_threads; 189 #ifdef CONFIG_DP_TRACE 190 bool enable_dp_trace; 191 uint8_t dp_trace_config[DP_TRACE_CONFIG_STRING_LENGTH]; 192 #endif 193 uint8_t enable_nud_tracking; 194 195 #ifdef WLAN_SUPPORT_TXRX_HL_BUNDLE 196 uint32_t pkt_bundle_threshold_high; 197 uint32_t pkt_bundle_threshold_low; 198 uint16_t pkt_bundle_timer_value; 199 uint16_t pkt_bundle_size; 200 #endif 201 uint32_t dp_proto_event_bitmap; 202 uint32_t fisa_enable; 203 204 int icmp_req_to_fw_mark_interval; 205 206 bool lro_enable; 207 bool gro_enable; 208 #ifdef WLAN_SUPPORT_RX_FISA 209 bool is_rx_fisa_enabled; 210 bool is_rx_fisa_lru_del_enabled; 211 #endif 212 }; 213 214 /** 215 * struct tx_rx_histogram: structure to keep track of tx and rx packets 216 * received over 100ms intervals 217 * @interval_rx: # of rx packets received in the last 100ms interval 218 * @interval_tx: # of tx packets received in the last 100ms interval 219 * @next_vote_level: pld_bus_width_type voting level (high or low) 220 * determined on the basis of total tx and rx packets 221 * received in the last 100ms interval 222 * @next_rx_level: pld_bus_width_type voting level (high or low) 223 * determined on the basis of rx packets received in the 224 * last 100ms interval 225 * @next_tx_level: pld_bus_width_type voting level (high or low) 226 * determined on the basis of tx packets received in the 227 * last 100ms interval 228 * @is_rx_pm_qos_high: Capture rx_pm_qos voting 229 * @is_tx_pm_qos_high: Capture tx_pm_qos voting 230 * @qtime: timestamp when the record is added 231 * 232 * The structure keeps track of throughput requirements of wlan driver. 233 * An entry is added if either of next_vote_level, next_rx_level or 234 * next_tx_level changes. An entry is not added for every 100ms interval. 235 */ 236 struct tx_rx_histogram { 237 uint64_t interval_rx; 238 uint64_t interval_tx; 239 uint32_t next_vote_level; 240 uint32_t next_rx_level; 241 uint32_t next_tx_level; 242 bool is_rx_pm_qos_high; 243 bool is_tx_pm_qos_high; 244 uint64_t qtime; 245 }; 246 247 /** 248 * struct dp_stats - DP stats 249 * @tx_rx_stats : Tx/Rx debug stats 250 * @arp_stats: arp debug stats 251 * @dns_stats: dns debug stats 252 * @tcp_stats: tcp debug stats 253 * @icmpv4_stats: icmpv4 debug stats 254 * @dhcp_stats: dhcp debug stats 255 * @eapol_stats: eapol debug stats 256 */ 257 struct dp_stats { 258 struct dp_tx_rx_stats tx_rx_stats; 259 struct dp_arp_stats arp_stats; 260 struct dp_dns_stats dns_stats; 261 struct dp_tcp_stats tcp_stats; 262 struct dp_icmpv4_stats icmpv4_stats; 263 struct dp_dhcp_stats dhcp_stats; 264 struct dp_eapol_stats eapol_stats; 265 }; 266 267 /** 268 * enum dhcp_phase - Per Peer DHCP Phases 269 * @DHCP_PHASE_ACK: upon receiving DHCP_ACK/NAK message in REQUEST phase or 270 * DHCP_DELINE message in OFFER phase 271 * @DHCP_PHASE_DISCOVER: upon receiving DHCP_DISCOVER message in ACK phase 272 * @DHCP_PHASE_OFFER: upon receiving DHCP_OFFER message in DISCOVER phase 273 * @DHCP_PHASE_REQUEST: upon receiving DHCP_REQUEST message in OFFER phase or 274 * ACK phase (Renewal process) 275 */ 276 enum dhcp_phase { 277 DHCP_PHASE_ACK, 278 DHCP_PHASE_DISCOVER, 279 DHCP_PHASE_OFFER, 280 DHCP_PHASE_REQUEST 281 }; 282 283 /** 284 * enum dhcp_nego_status - Per Peer DHCP Negotiation Status 285 * @DHCP_NEGO_STOP: when the peer is in ACK phase or client disassociated 286 * @DHCP_NEGO_IN_PROGRESS: when the peer is in DISCOVER or REQUEST 287 * (Renewal process) phase 288 */ 289 enum dhcp_nego_status { 290 DHCP_NEGO_STOP, 291 DHCP_NEGO_IN_PROGRESS 292 }; 293 294 /* 295 * Pending frame type of EAP_FAILURE, bit number used in "pending_eap_frm_type" 296 * of sta_info. 297 */ 298 #define DP_PENDING_TYPE_EAP_FAILURE 0 299 300 enum bss_intf_state { 301 BSS_INTF_STOP, 302 BSS_INTF_START, 303 }; 304 305 struct wlan_dp_sta_info { 306 struct qdf_mac_addr sta_mac; 307 unsigned long pending_eap_frm_type; 308 enum dhcp_phase dhcp_phase; 309 enum dhcp_nego_status dhcp_nego_status; 310 }; 311 312 struct wlan_dp_conn_info { 313 struct qdf_mac_addr bssid; 314 struct qdf_mac_addr peer_macaddr; 315 uint8_t proxy_arp_service; 316 uint8_t is_authenticated; 317 }; 318 319 /** 320 * struct link_monitoring - link speed monitoring related info 321 * @enabled: Is link speed monitoring feature enabled 322 * @rx_linkspeed_threshold: link speed good/bad threshold 323 * @is_rx_linkspeed_good: true means rx link speed good, false means bad 324 */ 325 struct link_monitoring { 326 uint8_t enabled; 327 uint32_t rx_linkspeed_threshold; 328 uint8_t is_rx_linkspeed_good; 329 }; 330 331 /** 332 * struct direct_link_info - direct link configuration items 333 * @config_set: is the direct link config active 334 * @low_latency: is low latency enabled 335 */ 336 struct direct_link_info { 337 bool config_set; 338 bool low_latency; 339 }; 340 341 /** 342 * struct dp_fisa_reo_mismatch_stats - reo mismatch sub-case stats for FISA 343 * @allow_cce_match: packet allowed due to cce mismatch 344 * @allow_fse_metdata_mismatch: packet allowed since it belongs to same flow, 345 * only fse_metadata is not same. 346 * @allow_non_aggr: packet allowed due to any other reason. 347 */ 348 struct dp_fisa_reo_mismatch_stats { 349 uint32_t allow_cce_match; 350 uint32_t allow_fse_metdata_mismatch; 351 uint32_t allow_non_aggr; 352 }; 353 354 /** 355 * struct dp_fisa_stats - FISA stats 356 * @invalid_flow_index: flow index invalid from RX HW TLV 357 * @update_deferred: workqueue deferred due to suspend 358 * @reo_mismatch: REO ID mismatch 359 * @incorrect_rdi: Incorrect REO dest indication in TLV 360 * (typically used for RDI = 0) 361 */ 362 struct dp_fisa_stats { 363 uint32_t invalid_flow_index; 364 uint32_t update_deferred; 365 struct dp_fisa_reo_mismatch_stats reo_mismatch; 366 uint32_t incorrect_rdi; 367 }; 368 369 /** 370 * enum fisa_aggr_ret - FISA aggregation return code 371 * @FISA_AGGR_DONE: FISA aggregation done 372 * @FISA_AGGR_NOT_ELIGIBLE: Not eligible for FISA aggregation 373 * @FISA_FLUSH_FLOW: FISA flow flushed 374 */ 375 enum fisa_aggr_ret { 376 FISA_AGGR_DONE, 377 FISA_AGGR_NOT_ELIGIBLE, 378 FISA_FLUSH_FLOW 379 }; 380 381 /** 382 * struct fisa_pkt_hist - FISA Packet history structure 383 * @tlv_hist: array of TLV history 384 * @ts_hist: array of timestamps of fisa packets 385 * @idx: index indicating the next location to be used in the array. 386 */ 387 struct fisa_pkt_hist { 388 uint8_t *tlv_hist; 389 qdf_time_t ts_hist[FISA_FLOW_MAX_AGGR_COUNT]; 390 uint32_t idx; 391 }; 392 393 /** 394 * struct dp_fisa_rx_sw_ft - FISA Flow table entry 395 * @hw_fse: HAL Rx Flow Search Entry which matches HW definition 396 * @flow_hash: Flow hash value 397 * @flow_id_toeplitz: toeplitz hash value 398 * @flow_id: Flow index, equivalent to hash value truncated to FST size 399 * @stats: Stats tracking for this flow 400 * @is_ipv4_addr_entry: Flag indicating whether flow is IPv4 address tuple 401 * @is_valid: Flag indicating whether flow is valid 402 * @is_populated: Flag indicating whether flow is populated 403 * @is_flow_udp: Flag indicating whether flow is UDP stream 404 * @is_flow_tcp: Flag indicating whether flow is TCP stream 405 * @head_skb: HEAD skb where flow is aggregated 406 * @cumulative_l4_checksum: Cumulative L4 checksum 407 * @adjusted_cumulative_ip_length: Cumulative IP length 408 * @cur_aggr: Current aggregate length of flow 409 * @napi_flush_cumulative_l4_checksum: Cumulative L4 chekcsum for current 410 * NAPI flush 411 * @napi_flush_cumulative_ip_length: Cumulative IP length 412 * @last_skb: The last skb aggregated in the FISA flow 413 * @head_skb_ip_hdr_offset: IP header offset 414 * @head_skb_l4_hdr_offset: L4 header offset 415 * @rx_flow_tuple_info: RX tuple information 416 * @napi_id: NAPI ID (REO ID) on which the flow is being received 417 * @vdev: VDEV handle corresponding to the FLOW 418 * @vdev_id: DP vdev id 419 * @dp_intf: DP interface handle corresponding to the flow 420 * @bytes_aggregated: Number of bytes currently aggregated 421 * @flush_count: Number of Flow flushes done 422 * @aggr_count: Aggregation count 423 * @do_not_aggregate: Flag to indicate not to aggregate this flow 424 * @hal_cumultive_ip_len: HAL cumulative IP length 425 * @dp_ctx: DP component handle 426 * @soc_hdl: DP SoC handle 427 * @last_hal_aggr_count: last aggregate count fetched from RX PKT TLV 428 * @cur_aggr_gso_size: Current aggreagtesd GSO size 429 * @head_skb_udp_hdr: UDP header address for HEAD skb 430 * @frags_cumulative_len: 431 * @cmem_offset: CMEM offset 432 * @metadata: 433 * @reo_dest_indication: REO destination indication for the FLOW 434 * @flow_init_ts: FLOW init timestamp 435 * @last_accessed_ts: Timestamp when the flow was last accessed 436 * @pkt_hist: FISA aggreagtion packets history 437 * @same_mld_vdev_mismatch: Packets flushed after vdev_mismatch on same MLD 438 * @add_timestamp: FISA entry created timestamp 439 */ 440 struct dp_fisa_rx_sw_ft { 441 void *hw_fse; 442 uint32_t flow_hash; 443 uint32_t flow_id_toeplitz; 444 uint32_t flow_id; 445 struct cdp_flow_stats stats; 446 uint8_t is_ipv4_addr_entry; 447 uint8_t is_valid; 448 uint8_t is_populated; 449 uint8_t is_flow_udp; 450 uint8_t is_flow_tcp; 451 qdf_nbuf_t head_skb; 452 uint16_t cumulative_l4_checksum; 453 uint16_t adjusted_cumulative_ip_length; 454 uint16_t cur_aggr; 455 uint16_t napi_flush_cumulative_l4_checksum; 456 uint16_t napi_flush_cumulative_ip_length; 457 qdf_nbuf_t last_skb; 458 uint32_t head_skb_ip_hdr_offset; 459 uint32_t head_skb_l4_hdr_offset; 460 struct cdp_rx_flow_tuple_info rx_flow_tuple_info; 461 uint8_t napi_id; 462 struct dp_vdev *vdev; 463 uint8_t vdev_id; 464 struct wlan_dp_intf *dp_intf; 465 uint64_t bytes_aggregated; 466 uint32_t flush_count; 467 uint32_t aggr_count; 468 uint8_t do_not_aggregate; 469 uint16_t hal_cumultive_ip_len; 470 struct wlan_dp_psoc_context *dp_ctx; 471 /* TODO - Only reference needed to this is to get vdev. 472 * Once that ref is removed, this field can be deleted 473 */ 474 struct dp_soc *soc_hdl; 475 uint32_t last_hal_aggr_count; 476 uint32_t cur_aggr_gso_size; 477 qdf_net_udphdr_t *head_skb_udp_hdr; 478 uint16_t frags_cumulative_len; 479 uint32_t cmem_offset; 480 uint32_t metadata; 481 uint32_t reo_dest_indication; 482 qdf_time_t flow_init_ts; 483 qdf_time_t last_accessed_ts; 484 #ifdef WLAN_SUPPORT_RX_FISA_HIST 485 struct fisa_pkt_hist pkt_hist; 486 #endif 487 uint64_t same_mld_vdev_mismatch; 488 uint64_t add_timestamp; 489 }; 490 491 #define DP_RX_GET_SW_FT_ENTRY_SIZE sizeof(struct dp_fisa_rx_sw_ft) 492 #define MAX_FSE_CACHE_FL_HST 10 493 /** 494 * struct fse_cache_flush_history - Debug history cache flush 495 * @timestamp: Entry update timestamp 496 * @flows_added: Number of flows added for this flush 497 * @flows_deleted: Number of flows deleted for this flush 498 */ 499 struct fse_cache_flush_history { 500 uint64_t timestamp; 501 uint32_t flows_added; 502 uint32_t flows_deleted; 503 }; 504 505 /** 506 * struct dp_rx_fst - FISA handle 507 * @base: Software (DP) FST 508 * @dp_ctx: DP component handle 509 * @hal_rx_fst: Pointer to HAL FST 510 * @hal_rx_fst_base_paddr: Base physical address of HAL RX HW FST 511 * @max_entries: Maximum number of flows FSE supports 512 * @num_entries: Num entries in flow table 513 * @max_skid_length: SKID Length 514 * @hash_mask: Hash mask to obtain legitimate hash entry 515 * @dp_rx_fst_lock: Lock for adding/deleting entries of FST 516 * @add_flow_count: Num of flows added 517 * @del_flow_count: Num of flows deleted 518 * @hash_collision_cnt: Num hash collisions 519 * @soc_hdl: DP SoC handle 520 * @fse_cache_flush_posted: Num FSE cache flush cmds posted 521 * @fse_cache_flush_timer: FSE cache flush timer 522 * @fse_cache_flush_allow: Flag to indicate if FSE cache flush is allowed 523 * @cache_fl_rec: FSE cache flush history 524 * @stats: FISA stats 525 * @fst_update_work: FST CMEM update work 526 * @fst_update_wq: FST CMEM update workqueue 527 * @fst_update_list: List to post event to CMEM update work 528 * @meta_counter: 529 * @cmem_ba: 530 * @dp_rx_sw_ft_lock: SW FST lock 531 * @cmem_resp_event: CMEM response event indicator 532 * @flow_deletion_supported: Flag to indicate if flow delete is supported 533 * @fst_in_cmem: Flag to indicate if FST is stored in CMEM 534 * @pm_suspended: Flag to indicate if driver is suspended 535 * @fst_wq_defer: 536 * @rx_hash_enabled: Flag to indicate if Hash based routing supported 537 * @rx_toeplitz_hash_key: hash key 538 * @rx_pkt_tlv_size: RX packet TLV size 539 */ 540 struct dp_rx_fst { 541 uint8_t *base; 542 struct wlan_dp_psoc_context *dp_ctx; 543 struct hal_rx_fst *hal_rx_fst; 544 uint64_t hal_rx_fst_base_paddr; 545 uint16_t max_entries; 546 uint16_t num_entries; 547 uint16_t max_skid_length; 548 uint32_t hash_mask; 549 qdf_spinlock_t dp_rx_fst_lock; 550 uint32_t add_flow_count; 551 uint32_t del_flow_count; 552 uint32_t hash_collision_cnt; 553 struct dp_soc *soc_hdl; 554 qdf_atomic_t fse_cache_flush_posted; 555 qdf_timer_t fse_cache_flush_timer; 556 bool fse_cache_flush_allow; 557 struct fse_cache_flush_history cache_fl_rec[MAX_FSE_CACHE_FL_HST]; 558 struct dp_fisa_stats stats; 559 560 /* CMEM params */ 561 qdf_work_t fst_update_work; 562 qdf_workqueue_t *fst_update_wq; 563 qdf_list_t fst_update_list; 564 uint32_t meta_counter; 565 uint32_t cmem_ba; 566 qdf_spinlock_t dp_rx_sw_ft_lock[MAX_REO_DEST_RINGS]; 567 qdf_event_t cmem_resp_event; 568 bool flow_deletion_supported; 569 bool fst_in_cmem; 570 qdf_atomic_t pm_suspended; 571 bool fst_wq_defer; 572 bool rx_hash_enabled; 573 uint8_t *rx_toeplitz_hash_key; 574 uint16_t rx_pkt_tlv_size; 575 }; 576 577 /** 578 * struct wlan_dp_intf - DP interface object related info 579 * @dp_ctx: DP context reference 580 * @link_monitoring: Link monitoring related info 581 * @mac_addr: Device MAC address 582 * @device_mode: Device Mode 583 * @intf_id: Interface ID 584 * @node: list node for membership in the interface list 585 * @dev: netdev reference 586 * @txrx_ops: Interface tx-rx ops 587 * @dp_stats: Device TX/RX statistics 588 * @is_sta_periodic_stats_enabled: Indicate whether to display sta periodic 589 * stats 590 * @periodic_stats_timer_count: count of periodic stats timer 591 * @periodic_stats_timer_counter: periodic stats timer counter 592 * @sta_periodic_stats_lock: sta periodic stats lock 593 * @stats: netdev stats 594 * @con_status: con_status value 595 * @dad: dad value 596 * @pkt_type_bitmap: packet type bitmap value 597 * @track_arp_ip: track ARP ip 598 * @dns_payload: dns payload 599 * @track_dns_domain_len: dns domain length 600 * @track_src_port: track source port value 601 * @track_dest_port: track destination port value 602 * @track_dest_ipv4: track destination ipv4 value 603 * @prev_rx_packets: Rx packets received N/W interface 604 * @prev_tx_packets: Tx packets transmitted on N/W interface 605 * @prev_tx_bytes: Tx bytes transmitted on N/W interface 606 * @prev_fwd_tx_packets: forwarded tx packets count 607 * @prev_fwd_rx_packets: forwarded rx packets count 608 * @nud_tracking: NUD tracking 609 * @mic_work: Work to handle MIC error 610 * @num_active_task: Active task count 611 * @sap_tx_block_mask: SAP TX block mask 612 * @gro_disallowed: GRO disallowed flag 613 * @gro_flushed: GRO flushed flag 614 * @fisa_disallowed: Flag to indicate fisa aggregation not to be done for a 615 * particular rx_context 616 * @fisa_force_flushed: Flag to indicate FISA flow has been flushed for a 617 * particular rx_context 618 * @runtime_disable_rx_thread: Runtime Rx thread flag 619 * @rx_stack: function pointer Rx packet handover 620 * @tx_fn: function pointer to send Tx packet 621 * @bss_state: AP BSS state 622 * @qdf_sta_eap_frm_done_event: EAP frame event management 623 * @traffic_end_ind: store traffic end indication info 624 * @direct_link_config: direct link configuration parameters 625 * @num_links: Number of links for this DP interface 626 * @def_link: Pointer to default link (usually used for TX operation) 627 * @dp_link_list_lock: Lock to protect dp_link_list operatiosn 628 * @dp_link_list: List of dp_links for this DP interface 629 */ 630 struct wlan_dp_intf { 631 struct wlan_dp_psoc_context *dp_ctx; 632 633 struct link_monitoring link_monitoring; 634 635 struct qdf_mac_addr mac_addr; 636 637 enum QDF_OPMODE device_mode; 638 639 qdf_list_node_t node; 640 641 qdf_netdev_t dev; 642 struct ol_txrx_ops txrx_ops; 643 struct dp_stats dp_stats; 644 #ifdef WLAN_FEATURE_PERIODIC_STA_STATS 645 bool is_sta_periodic_stats_enabled; 646 uint16_t periodic_stats_timer_count; 647 uint32_t periodic_stats_timer_counter; 648 qdf_mutex_t sta_periodic_stats_lock; 649 #endif /* WLAN_FEATURE_PERIODIC_STA_STATS */ 650 qdf_net_dev_stats stats; 651 bool con_status; 652 bool dad; 653 uint32_t pkt_type_bitmap; 654 uint32_t track_arp_ip; 655 uint8_t dns_payload[256]; 656 uint32_t track_dns_domain_len; 657 uint32_t track_src_port; 658 uint32_t track_dest_port; 659 uint32_t track_dest_ipv4; 660 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH 661 unsigned long prev_rx_packets; 662 unsigned long prev_tx_packets; 663 unsigned long prev_tx_bytes; 664 uint64_t prev_fwd_tx_packets; 665 uint64_t prev_fwd_rx_packets; 666 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/ 667 struct dp_mic_work mic_work; 668 #ifdef WLAN_NUD_TRACKING 669 struct dp_nud_tracking_info nud_tracking; 670 #endif 671 qdf_atomic_t num_active_task; 672 uint32_t sap_tx_block_mask; 673 674 qdf_atomic_t gro_disallowed; 675 uint8_t gro_flushed[DP_MAX_RX_THREADS]; 676 677 #ifdef WLAN_SUPPORT_RX_FISA 678 /* 679 * Params used for controlling the fisa aggregation dynamically 680 */ 681 uint8_t fisa_disallowed[MAX_REO_DEST_RINGS]; 682 uint8_t fisa_force_flushed[MAX_REO_DEST_RINGS]; 683 #endif 684 685 bool runtime_disable_rx_thread; 686 687 enum bss_intf_state bss_state; 688 qdf_event_t qdf_sta_eap_frm_done_event; 689 struct dp_traffic_end_indication traffic_end_ind; 690 #ifdef FEATURE_DIRECT_LINK 691 struct direct_link_info direct_link_config; 692 #endif 693 uint8_t num_links; 694 struct wlan_dp_link *def_link; 695 qdf_spinlock_t dp_link_list_lock; 696 qdf_list_t dp_link_list; 697 }; 698 699 #define WLAN_DP_LINK_MAGIC 0x5F44505F4C494E4B /* "_DP_LINK" in ASCII */ 700 701 /** 702 * struct wlan_dp_link - DP link (corresponds to objmgr vdev) 703 * @node: list node for membership in the DP links list 704 * @magic: magic number to identify validity of dp_link 705 * @link_id: ID for this DP link (Same as vdev_id) 706 * @mac_addr: mac address of this link 707 * @dp_intf: Parent DP interface for this DP link 708 * @vdev: object manager vdev context 709 * @vdev_lock: vdev spin lock 710 * @conn_info: STA connection information 711 * @destroyed: flag to indicate dp_link destroyed (logical delete) 712 * @cdp_vdev_registered: flag to indicate if corresponding CDP vdev 713 * is registered 714 * @cdp_vdev_deleted: flag to indicate if corresponding CDP vdev is deleted 715 * @inactive_list_elem: list node for membership in dp link inactive list 716 */ 717 struct wlan_dp_link { 718 qdf_list_node_t node; 719 uint64_t magic; 720 uint8_t link_id; 721 struct qdf_mac_addr mac_addr; 722 struct wlan_dp_intf *dp_intf; 723 struct wlan_objmgr_vdev *vdev; 724 qdf_spinlock_t vdev_lock; 725 struct wlan_dp_conn_info conn_info; 726 uint8_t destroyed; 727 uint8_t cdp_vdev_registered; 728 uint8_t cdp_vdev_deleted; 729 TAILQ_ENTRY(wlan_dp_link) inactive_list_elem; 730 }; 731 732 /** 733 * enum RX_OFFLOAD - Receive offload modes 734 * @CFG_LRO_ENABLED: Large Rx offload 735 * @CFG_GRO_ENABLED: Generic Rx Offload 736 */ 737 enum RX_OFFLOAD { 738 CFG_LRO_ENABLED = 1, 739 CFG_GRO_ENABLED, 740 }; 741 742 #ifdef FEATURE_DIRECT_LINK 743 /** 744 * struct dp_direct_link_context - Datapath Direct Link context 745 * @dp_ctx: pointer to DP psoc priv context 746 * @lpass_ep_id: LPASS data msg service endpoint id 747 * @direct_link_refill_ring_hdl: Direct Link refill ring handle 748 * @dl_wfds: pointer to direct link WFDS context 749 */ 750 struct dp_direct_link_context { 751 struct wlan_dp_psoc_context *dp_ctx; 752 HTC_ENDPOINT_ID lpass_ep_id; 753 struct dp_srng *direct_link_refill_ring_hdl; 754 struct dp_direct_link_wfds_context *dl_wfds; 755 }; 756 #endif 757 758 /** 759 * struct wlan_dp_psoc_context - psoc related data required for DP 760 * @psoc: object manager psoc context 761 * @pdev: object manager pdev context 762 * @qdf_dev: qdf device 763 * @dp_cfg: place holder for DP configuration 764 * @cdp_soc: CDP SoC handle 765 * @hif_handle: HIF handle 766 * @hal_soc: HAL SoC handle 767 * @intf_list_lock: DP interfaces list lock 768 * @intf_list: DP interfaces list 769 * @rps: rps 770 * @dynamic_rps: dynamic rps 771 * @enable_rxthread: Enable/Disable rx thread 772 * @enable_dp_rx_threads: Enable/Disable DP rx threads 773 * @napi_enable: Enable/Disable napi 774 * @dp_ops: DP callbacks registered from other modules 775 * @sb_ops: South bound direction call backs registered in DP 776 * @nb_ops: North bound direction call backs registered in DP 777 * @en_tcp_delack_no_lro: Enable/Disable tcp delack no lro 778 * @no_rx_offload_pkt_cnt: no of rx offload packet count 779 * @no_tx_offload_pkt_cnt: no of tx offload packet count 780 * @is_suspend: to check whether syetem suspend or not 781 * @is_wiphy_suspended: to check whether wiphy suspend or not 782 * @num_latency_critical_clients: num latency critical clients 783 * @high_bus_bw_request: high bus bandwidth request 784 * @bw_vote_time: bus bandwidth vote time 785 * @bus_bw_work: work for periodically computing DDR bus bandwidth requirements 786 * @cur_vote_level: Current vote level 787 * @prev_no_rx_offload_pkts: no of previous rx offload packets 788 * @prev_rx_offload_pkts: previous rx offload packets 789 * @prev_no_tx_offload_pkts: no of previous tx offload packets 790 * @prev_tx_offload_pkts: previous tx offload packets 791 * @cur_tx_level: Current Tx level 792 * @prev_tx: previous tx 793 * @low_tput_gro_enable: Enable/Disable low tput gro 794 * @bus_bw_lock: Bus bandwidth work lock 795 * @cur_rx_level: Current Rx level 796 * @bus_low_vote_cnt: bus low level count 797 * @disable_rx_ol_in_concurrency: disable RX offload in concurrency scenarios 798 * @disable_rx_ol_in_low_tput: disable RX offload in tput scenarios 799 * @txrx_hist_idx: txrx histogram index 800 * @rx_high_ind_cnt: rx high_ind count 801 * @receive_offload_cb: receive offload cb 802 * @dp_agg_param: DP aggregation parameter 803 * @dp_agg_param.rx_aggregation: 804 * @dp_agg_param.gro_force_flush: 805 * @dp_agg_param.tc_based_dyn_gro: 806 * @dp_agg_param.tc_ingress_prio: 807 * @rtpm_tput_policy_ctx: Runtime Tput policy context 808 * @txrx_hist: TxRx histogram 809 * @bbm_ctx: bus bandwidth manager context 810 * @dp_direct_link_lock: Direct link mutex lock 811 * @dp_direct_link_ctx: DP Direct Link context 812 * @arp_connectivity_map: ARP connectivity map 813 * @rx_wake_lock: rx wake lock 814 * @ol_enable: Enable/Disable offload 815 * @rx_fst: FST handle 816 * @fst_cmem_base: FST base in CMEM 817 * @fst_in_cmem: Flag indicating if FST is in CMEM or not 818 * @fisa_enable: Flag to indicate if FISA is enabled or not 819 * @fisa_lru_del_enable: Flag to indicate if LRU flow delete is enabled 820 * @fisa_dynamic_aggr_size_support: Indicate dynamic aggr size programming support 821 * @skip_fisa_param: FISA skip params structure 822 * @skip_fisa_param.skip_fisa: Flag to skip FISA aggr inside @skip_fisa_param 823 * @skip_fisa_param.fisa_force_flush: Force flush inside @skip_fisa_param 824 * @fst_cmem_size: CMEM size for FISA flow table 825 * @inactive_dp_link_list: inactive DP links list 826 * @dp_link_del_lock: DP link delete operation lock 827 */ 828 struct wlan_dp_psoc_context { 829 struct wlan_objmgr_psoc *psoc; 830 struct wlan_objmgr_pdev *pdev; 831 qdf_device_t qdf_dev; 832 struct wlan_dp_psoc_cfg dp_cfg; 833 ol_txrx_soc_handle cdp_soc; 834 struct hif_opaque_softc *hif_handle; 835 void *hal_soc; 836 837 qdf_spinlock_t intf_list_lock; 838 qdf_list_t intf_list; 839 840 bool rps; 841 bool dynamic_rps; 842 bool enable_rxthread; 843 bool enable_dp_rx_threads; 844 bool napi_enable; 845 846 struct wlan_dp_psoc_callbacks dp_ops; 847 struct wlan_dp_psoc_sb_ops sb_ops; 848 struct wlan_dp_psoc_nb_ops nb_ops; 849 850 bool en_tcp_delack_no_lro; 851 uint64_t no_rx_offload_pkt_cnt; 852 uint64_t no_tx_offload_pkt_cnt; 853 bool is_suspend; 854 bool is_wiphy_suspended; 855 qdf_atomic_t num_latency_critical_clients; 856 uint8_t high_bus_bw_request; 857 uint64_t bw_vote_time; 858 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH 859 struct qdf_periodic_work bus_bw_work; 860 int cur_vote_level; 861 qdf_spinlock_t bus_bw_lock; 862 int cur_rx_level; 863 uint64_t prev_no_rx_offload_pkts; 864 uint64_t prev_rx_offload_pkts; 865 uint64_t prev_no_tx_offload_pkts; 866 uint64_t prev_tx_offload_pkts; 867 int cur_tx_level; 868 uint64_t prev_tx; 869 qdf_atomic_t low_tput_gro_enable; 870 uint32_t bus_low_vote_cnt; 871 #ifdef FEATURE_RUNTIME_PM 872 struct dp_rtpm_tput_policy_context rtpm_tput_policy_ctx; 873 #endif 874 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/ 875 qdf_atomic_t disable_rx_ol_in_concurrency; 876 qdf_atomic_t disable_rx_ol_in_low_tput; 877 878 uint16_t txrx_hist_idx; 879 struct tx_rx_histogram *txrx_hist; 880 881 uint32_t rx_high_ind_cnt; 882 #ifdef FEATURE_BUS_BANDWIDTH_MGR 883 struct bbm_context *bbm_ctx; 884 #endif 885 886 QDF_STATUS(*receive_offload_cb)(struct wlan_dp_intf *, qdf_nbuf_t nbuf); 887 888 struct { 889 qdf_atomic_t rx_aggregation; 890 uint8_t gro_force_flush[DP_MAX_RX_THREADS]; 891 bool tc_based_dyn_gro; 892 uint32_t tc_ingress_prio; 893 } 894 dp_agg_param; 895 896 uint32_t arp_connectivity_map; 897 898 qdf_wake_lock_t rx_wake_lock; 899 900 enum RX_OFFLOAD ol_enable; 901 #ifdef FEATURE_DIRECT_LINK 902 qdf_mutex_t dp_direct_link_lock; 903 struct dp_direct_link_context *dp_direct_link_ctx; 904 #endif 905 #ifdef WLAN_SUPPORT_RX_FISA 906 struct dp_rx_fst *rx_fst; 907 uint64_t fst_cmem_base; 908 bool fst_in_cmem; 909 uint8_t fisa_enable; 910 uint8_t fisa_lru_del_enable; 911 bool fisa_dynamic_aggr_size_support; 912 /* 913 * Params used for controlling the fisa aggregation dynamically 914 */ 915 struct { 916 qdf_atomic_t skip_fisa; 917 uint8_t fisa_force_flush[MAX_REO_DEST_RINGS]; 918 } skip_fisa_param; 919 920 /* 921 * CMEM address and size for FST in CMEM, This is the address 922 * shared during init time. 923 */ 924 uint64_t fst_cmem_size; 925 926 #endif 927 TAILQ_HEAD(, wlan_dp_link) inactive_dp_link_list; 928 qdf_spinlock_t dp_link_del_lock; 929 }; 930 931 #ifdef WLAN_DP_PROFILE_SUPPORT 932 /** 933 * enum wlan_dp_cfg_param_type - param context type 934 * @DP_TX_DESC_NUM_CFG: Number of TX desc 935 * @DP_TX_EXT_DESC_NUM_CFG: Number of TX ext desc 936 * @DP_TX_RING_SIZE_CFG: TX ring size 937 * @DP_TX_COMPL_RING_SIZE_CFG: TX completion ring size 938 * @DP_RX_SW_DESC_NUM_CFG: Number of RX S.W descriptors 939 * @DP_REO_DST_RING_SIZE_CFG: RX ring size 940 * @DP_RXDMA_BUF_RING_SIZE_CFG: RXDMA BUF ring size 941 * @DP_RXDMA_REFILL_RING_SIZE_CFG: RXDMA refill ring size 942 * @DP_RX_REFILL_POOL_NUM_CFG: Refill buffer pool size 943 */ 944 enum wlan_dp_cfg_param_type { 945 DP_TX_DESC_NUM_CFG, 946 DP_TX_EXT_DESC_NUM_CFG, 947 DP_TX_RING_SIZE_CFG, 948 DP_TX_COMPL_RING_SIZE_CFG, 949 DP_RX_SW_DESC_NUM_CFG, 950 DP_REO_DST_RING_SIZE_CFG, 951 DP_RXDMA_BUF_RING_SIZE_CFG, 952 DP_RXDMA_REFILL_RING_SIZE_CFG, 953 DP_RX_REFILL_POOL_NUM_CFG, 954 }; 955 956 /** 957 * struct wlan_dp_memory_profile_ctx - element representing DP config param info 958 * @param_type: DP config param type 959 * @size: size/length of the param to be selected 960 */ 961 struct wlan_dp_memory_profile_ctx { 962 enum wlan_dp_cfg_param_type param_type; 963 uint32_t size; 964 }; 965 966 /** 967 * struct wlan_dp_memory_profile_info - Current memory profile info 968 * @is_selected: profile is selected or not 969 * @ctx: DP memory profile context 970 * @size: size of profile 971 */ 972 struct wlan_dp_memory_profile_info { 973 bool is_selected; 974 struct wlan_dp_memory_profile_ctx *ctx; 975 int size; 976 }; 977 #endif 978 979 #endif /* end of _WLAN_DP_PRIV_STRUCT_H_ */ 980