xref: /wlan-dirver/qcacld-3.0/components/dp/core/inc/wlan_dp_priv.h (revision e41e8755738c61945e20243db946b67646275f7c)
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  * @dp_intf: DP interface handle corresponding to the flow
419  * @bytes_aggregated: Number of bytes currently aggregated
420  * @flush_count: Number of Flow flushes done
421  * @aggr_count: Aggregation count
422  * @do_not_aggregate: Flag to indicate not to aggregate this flow
423  * @hal_cumultive_ip_len: HAL cumulative IP length
424  * @dp_ctx: DP component handle
425  * @soc_hdl: DP SoC handle
426  * @last_hal_aggr_count: last aggregate count fetched from RX PKT TLV
427  * @cur_aggr_gso_size: Current aggreagtesd GSO size
428  * @head_skb_udp_hdr: UDP header address for HEAD skb
429  * @frags_cumulative_len:
430  * @cmem_offset: CMEM offset
431  * @metadata:
432  * @reo_dest_indication: REO destination indication for the FLOW
433  * @flow_init_ts: FLOW init timestamp
434  * @last_accessed_ts: Timestamp when the flow was last accessed
435  * @pkt_hist: FISA aggreagtion packets history
436  * @same_mld_vdev_mismatch: Packets flushed after vdev_mismatch on same MLD
437  * @add_timestamp: FISA entry created timestamp
438  */
439 struct dp_fisa_rx_sw_ft {
440 	void *hw_fse;
441 	uint32_t flow_hash;
442 	uint32_t flow_id_toeplitz;
443 	uint32_t flow_id;
444 	struct cdp_flow_stats stats;
445 	uint8_t is_ipv4_addr_entry;
446 	uint8_t is_valid;
447 	uint8_t is_populated;
448 	uint8_t is_flow_udp;
449 	uint8_t is_flow_tcp;
450 	qdf_nbuf_t head_skb;
451 	uint16_t cumulative_l4_checksum;
452 	uint16_t adjusted_cumulative_ip_length;
453 	uint16_t cur_aggr;
454 	uint16_t napi_flush_cumulative_l4_checksum;
455 	uint16_t napi_flush_cumulative_ip_length;
456 	qdf_nbuf_t last_skb;
457 	uint32_t head_skb_ip_hdr_offset;
458 	uint32_t head_skb_l4_hdr_offset;
459 	struct cdp_rx_flow_tuple_info rx_flow_tuple_info;
460 	uint8_t napi_id;
461 	struct dp_vdev *vdev;
462 	struct wlan_dp_intf *dp_intf;
463 	uint64_t bytes_aggregated;
464 	uint32_t flush_count;
465 	uint32_t aggr_count;
466 	uint8_t do_not_aggregate;
467 	uint16_t hal_cumultive_ip_len;
468 	struct wlan_dp_psoc_context *dp_ctx;
469 	/* TODO - Only reference needed to this is to get vdev.
470 	 * Once that ref is removed, this field can be deleted
471 	 */
472 	struct dp_soc *soc_hdl;
473 	uint32_t last_hal_aggr_count;
474 	uint32_t cur_aggr_gso_size;
475 	qdf_net_udphdr_t *head_skb_udp_hdr;
476 	uint16_t frags_cumulative_len;
477 	uint32_t cmem_offset;
478 	uint32_t metadata;
479 	uint32_t reo_dest_indication;
480 	qdf_time_t flow_init_ts;
481 	qdf_time_t last_accessed_ts;
482 #ifdef WLAN_SUPPORT_RX_FISA_HIST
483 	struct fisa_pkt_hist pkt_hist;
484 #endif
485 	uint64_t same_mld_vdev_mismatch;
486 	uint64_t add_timestamp;
487 };
488 
489 #define DP_RX_GET_SW_FT_ENTRY_SIZE sizeof(struct dp_fisa_rx_sw_ft)
490 #define MAX_FSE_CACHE_FL_HST 10
491 /**
492  * struct fse_cache_flush_history - Debug history cache flush
493  * @timestamp: Entry update timestamp
494  * @flows_added: Number of flows added for this flush
495  * @flows_deleted: Number of flows deleted for this flush
496  */
497 struct fse_cache_flush_history {
498 	uint64_t timestamp;
499 	uint32_t flows_added;
500 	uint32_t flows_deleted;
501 };
502 
503 /**
504  * struct dp_rx_fst - FISA handle
505  * @base: Software (DP) FST
506  * @dp_ctx: DP component handle
507  * @hal_rx_fst: Pointer to HAL FST
508  * @hal_rx_fst_base_paddr: Base physical address of HAL RX HW FST
509  * @max_entries: Maximum number of flows FSE supports
510  * @num_entries: Num entries in flow table
511  * @max_skid_length: SKID Length
512  * @hash_mask: Hash mask to obtain legitimate hash entry
513  * @dp_rx_fst_lock: Lock for adding/deleting entries of FST
514  * @add_flow_count: Num of flows added
515  * @del_flow_count: Num of flows deleted
516  * @hash_collision_cnt: Num hash collisions
517  * @soc_hdl: DP SoC handle
518  * @fse_cache_flush_posted: Num FSE cache flush cmds posted
519  * @fse_cache_flush_timer: FSE cache flush timer
520  * @fse_cache_flush_allow: Flag to indicate if FSE cache flush is allowed
521  * @cache_fl_rec: FSE cache flush history
522  * @stats: FISA stats
523  * @fst_update_work: FST CMEM update work
524  * @fst_update_wq: FST CMEM update workqueue
525  * @fst_update_list: List to post event to CMEM update work
526  * @meta_counter:
527  * @cmem_ba:
528  * @dp_rx_sw_ft_lock: SW FST lock
529  * @cmem_resp_event: CMEM response event indicator
530  * @flow_deletion_supported: Flag to indicate if flow delete is supported
531  * @fst_in_cmem: Flag to indicate if FST is stored in CMEM
532  * @pm_suspended: Flag to indicate if driver is suspended
533  * @fst_wq_defer:
534  * @rx_hash_enabled: Flag to indicate if Hash based routing supported
535  * @rx_toeplitz_hash_key: hash key
536  * @rx_pkt_tlv_size: RX packet TLV size
537  */
538 struct dp_rx_fst {
539 	uint8_t *base;
540 	struct wlan_dp_psoc_context *dp_ctx;
541 	struct hal_rx_fst *hal_rx_fst;
542 	uint64_t hal_rx_fst_base_paddr;
543 	uint16_t max_entries;
544 	uint16_t num_entries;
545 	uint16_t max_skid_length;
546 	uint32_t hash_mask;
547 	qdf_spinlock_t dp_rx_fst_lock;
548 	uint32_t add_flow_count;
549 	uint32_t del_flow_count;
550 	uint32_t hash_collision_cnt;
551 	struct dp_soc *soc_hdl;
552 	qdf_atomic_t fse_cache_flush_posted;
553 	qdf_timer_t fse_cache_flush_timer;
554 	bool fse_cache_flush_allow;
555 	struct fse_cache_flush_history cache_fl_rec[MAX_FSE_CACHE_FL_HST];
556 	struct dp_fisa_stats stats;
557 
558 	/* CMEM params */
559 	qdf_work_t fst_update_work;
560 	qdf_workqueue_t *fst_update_wq;
561 	qdf_list_t fst_update_list;
562 	uint32_t meta_counter;
563 	uint32_t cmem_ba;
564 	qdf_spinlock_t dp_rx_sw_ft_lock[MAX_REO_DEST_RINGS];
565 	qdf_event_t cmem_resp_event;
566 	bool flow_deletion_supported;
567 	bool fst_in_cmem;
568 	qdf_atomic_t pm_suspended;
569 	bool fst_wq_defer;
570 	bool rx_hash_enabled;
571 	uint8_t *rx_toeplitz_hash_key;
572 	uint16_t rx_pkt_tlv_size;
573 };
574 
575 /**
576  * struct wlan_dp_intf - DP interface object related info
577  * @dp_ctx: DP context reference
578  * @link_monitoring: Link monitoring related info
579  * @mac_addr: Device MAC address
580  * @device_mode: Device Mode
581  * @intf_id: Interface ID
582  * @node: list node for membership in the interface list
583  * @dev: netdev reference
584  * @txrx_ops: Interface tx-rx ops
585  * @dp_stats: Device TX/RX statistics
586  * @is_sta_periodic_stats_enabled: Indicate whether to display sta periodic
587  * stats
588  * @periodic_stats_timer_count: count of periodic stats timer
589  * @periodic_stats_timer_counter: periodic stats timer counter
590  * @sta_periodic_stats_lock: sta periodic stats lock
591  * @stats: netdev stats
592  * @con_status: con_status value
593  * @dad: dad value
594  * @pkt_type_bitmap: packet type bitmap value
595  * @track_arp_ip: track ARP ip
596  * @dns_payload: dns payload
597  * @track_dns_domain_len: dns domain length
598  * @track_src_port: track source port value
599  * @track_dest_port: track destination port value
600  * @track_dest_ipv4: track destination ipv4 value
601  * @prev_rx_packets: Rx packets received N/W interface
602  * @prev_tx_packets: Tx packets transmitted on N/W interface
603  * @prev_tx_bytes: Tx bytes transmitted on N/W interface
604  * @prev_fwd_tx_packets: forwarded tx packets count
605  * @prev_fwd_rx_packets: forwarded rx packets count
606  * @nud_tracking: NUD tracking
607  * @mic_work: Work to handle MIC error
608  * @num_active_task: Active task count
609  * @sap_tx_block_mask: SAP TX block mask
610  * @gro_disallowed: GRO disallowed flag
611  * @gro_flushed: GRO flushed flag
612  * @fisa_disallowed: Flag to indicate fisa aggregation not to be done for a
613  *		     particular rx_context
614  * @fisa_force_flushed: Flag to indicate FISA flow has been flushed for a
615  *			particular rx_context
616  * @runtime_disable_rx_thread: Runtime Rx thread flag
617  * @rx_stack: function pointer Rx packet handover
618  * @tx_fn: function pointer to send Tx packet
619  * @bss_state: AP BSS state
620  * @qdf_sta_eap_frm_done_event: EAP frame event management
621  * @traffic_end_ind: store traffic end indication info
622  * @direct_link_config: direct link configuration parameters
623  * @num_links: Number of links for this DP interface
624  * @def_link: Pointer to default link (usually used for TX operation)
625  * @dp_link_list_lock: Lock to protect dp_link_list operatiosn
626  * @dp_link_list: List of dp_links for this DP interface
627  */
628 struct wlan_dp_intf {
629 	struct wlan_dp_psoc_context *dp_ctx;
630 
631 	struct link_monitoring link_monitoring;
632 
633 	struct qdf_mac_addr mac_addr;
634 
635 	enum QDF_OPMODE device_mode;
636 
637 	qdf_list_node_t node;
638 
639 	qdf_netdev_t dev;
640 	struct ol_txrx_ops txrx_ops;
641 	struct dp_stats dp_stats;
642 #ifdef WLAN_FEATURE_PERIODIC_STA_STATS
643 	bool is_sta_periodic_stats_enabled;
644 	uint16_t periodic_stats_timer_count;
645 	uint32_t periodic_stats_timer_counter;
646 	qdf_mutex_t sta_periodic_stats_lock;
647 #endif /* WLAN_FEATURE_PERIODIC_STA_STATS */
648 	qdf_net_dev_stats stats;
649 	bool con_status;
650 	bool dad;
651 	uint32_t pkt_type_bitmap;
652 	uint32_t track_arp_ip;
653 	uint8_t dns_payload[256];
654 	uint32_t track_dns_domain_len;
655 	uint32_t track_src_port;
656 	uint32_t track_dest_port;
657 	uint32_t track_dest_ipv4;
658 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
659 	unsigned long prev_rx_packets;
660 	unsigned long prev_tx_packets;
661 	unsigned long prev_tx_bytes;
662 	uint64_t prev_fwd_tx_packets;
663 	uint64_t prev_fwd_rx_packets;
664 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
665 	struct dp_mic_work mic_work;
666 #ifdef WLAN_NUD_TRACKING
667 	struct dp_nud_tracking_info nud_tracking;
668 #endif
669 	qdf_atomic_t num_active_task;
670 	uint32_t sap_tx_block_mask;
671 
672 	qdf_atomic_t gro_disallowed;
673 	uint8_t gro_flushed[DP_MAX_RX_THREADS];
674 
675 #ifdef WLAN_SUPPORT_RX_FISA
676 	/*
677 	 * Params used for controlling the fisa aggregation dynamically
678 	 */
679 	uint8_t fisa_disallowed[MAX_REO_DEST_RINGS];
680 	uint8_t fisa_force_flushed[MAX_REO_DEST_RINGS];
681 #endif
682 
683 	bool runtime_disable_rx_thread;
684 
685 	enum bss_intf_state bss_state;
686 	qdf_event_t qdf_sta_eap_frm_done_event;
687 	struct dp_traffic_end_indication traffic_end_ind;
688 #ifdef FEATURE_DIRECT_LINK
689 	struct direct_link_info direct_link_config;
690 #endif
691 	uint8_t num_links;
692 	struct wlan_dp_link *def_link;
693 	qdf_spinlock_t dp_link_list_lock;
694 	qdf_list_t dp_link_list;
695 };
696 
697 /**
698  * struct wlan_dp_link - DP link (corresponds to objmgr vdev)
699  * @node: list node for membership in the DP links list
700  * @link_id: ID for this DP link (Same as vdev_id)
701  * @mac_addr: mac address of this link
702  * @dp_intf: Parent DP interface for this DP link
703  * @vdev: object manager vdev context
704  * @vdev_lock: vdev spin lock
705  * @conn_info: STA connection information
706  * @destroyed: flag to indicate dp_link destroyed (logical delete)
707  * @cdp_vdev_registered: flag to indicate if corresponding CDP vdev
708  *			 is registered
709  * @cdp_vdev_deleted: flag to indicate if corresponding CDP vdev is deleted
710  * @inactive_list_elem: list node for membership in dp link inactive list
711  */
712 struct wlan_dp_link {
713 	qdf_list_node_t node;
714 	uint8_t link_id;
715 	struct qdf_mac_addr mac_addr;
716 	struct wlan_dp_intf *dp_intf;
717 	struct wlan_objmgr_vdev *vdev;
718 	qdf_spinlock_t vdev_lock;
719 	struct wlan_dp_conn_info conn_info;
720 	uint8_t destroyed : 1,
721 		cdp_vdev_registered : 1,
722 		cdp_vdev_deleted : 1;
723 	TAILQ_ENTRY(wlan_dp_link) inactive_list_elem;
724 };
725 
726 /**
727  * enum RX_OFFLOAD - Receive offload modes
728  * @CFG_LRO_ENABLED: Large Rx offload
729  * @CFG_GRO_ENABLED: Generic Rx Offload
730  */
731 enum RX_OFFLOAD {
732 	CFG_LRO_ENABLED = 1,
733 	CFG_GRO_ENABLED,
734 };
735 
736 #ifdef FEATURE_DIRECT_LINK
737 /**
738  * struct dp_direct_link_context - Datapath Direct Link context
739  * @dp_ctx: pointer to DP psoc priv context
740  * @lpass_ep_id: LPASS data msg service endpoint id
741  * @direct_link_refill_ring_hdl: Direct Link refill ring handle
742  * @dl_wfds: pointer to direct link WFDS context
743  */
744 struct dp_direct_link_context {
745 	struct wlan_dp_psoc_context *dp_ctx;
746 	HTC_ENDPOINT_ID lpass_ep_id;
747 	struct dp_srng *direct_link_refill_ring_hdl;
748 	struct dp_direct_link_wfds_context *dl_wfds;
749 };
750 #endif
751 
752 /**
753  * struct wlan_dp_psoc_context - psoc related data required for DP
754  * @psoc: object manager psoc context
755  * @pdev: object manager pdev context
756  * @qdf_dev: qdf device
757  * @dp_cfg: place holder for DP configuration
758  * @cdp_soc: CDP SoC handle
759  * @hif_handle: HIF handle
760  * @hal_soc: HAL SoC handle
761  * @intf_list_lock: DP interfaces list lock
762  * @intf_list: DP interfaces list
763  * @rps: rps
764  * @dynamic_rps: dynamic rps
765  * @enable_rxthread: Enable/Disable rx thread
766  * @enable_dp_rx_threads: Enable/Disable DP rx threads
767  * @napi_enable: Enable/Disable napi
768  * @dp_ops: DP callbacks registered from other modules
769  * @sb_ops: South bound direction call backs registered in DP
770  * @nb_ops: North bound direction call backs registered in DP
771  * @en_tcp_delack_no_lro: Enable/Disable tcp delack no lro
772  * @no_rx_offload_pkt_cnt: no of rx offload packet count
773  * @no_tx_offload_pkt_cnt: no of tx offload packet count
774  * @is_suspend: to check whether syetem suspend or not
775  * @is_wiphy_suspended: to check whether wiphy suspend or not
776  * @num_latency_critical_clients: num latency critical clients
777  * @high_bus_bw_request: high bus bandwidth request
778  * @bw_vote_time: bus bandwidth vote time
779  * @bus_bw_work: work for periodically computing DDR bus bandwidth requirements
780  * @cur_vote_level: Current vote level
781  * @prev_no_rx_offload_pkts: no of previous rx offload packets
782  * @prev_rx_offload_pkts: previous rx offload packets
783  * @prev_no_tx_offload_pkts: no of previous tx offload packets
784  * @prev_tx_offload_pkts: previous tx offload packets
785  * @cur_tx_level: Current Tx level
786  * @prev_tx: previous tx
787  * @low_tput_gro_enable: Enable/Disable low tput gro
788  * @bus_bw_lock: Bus bandwidth work lock
789  * @cur_rx_level: Current Rx level
790  * @bus_low_vote_cnt: bus low level count
791  * @disable_rx_ol_in_concurrency: disable RX offload in concurrency scenarios
792  * @disable_rx_ol_in_low_tput: disable RX offload in tput scenarios
793  * @txrx_hist_idx: txrx histogram index
794  * @rx_high_ind_cnt: rx high_ind count
795  * @receive_offload_cb: receive offload cb
796  * @dp_agg_param: DP aggregation parameter
797  * @dp_agg_param.rx_aggregation:
798  * @dp_agg_param.gro_force_flush:
799  * @dp_agg_param.tc_based_dyn_gro:
800  * @dp_agg_param.tc_ingress_prio:
801  * @rtpm_tput_policy_ctx: Runtime Tput policy context
802  * @txrx_hist: TxRx histogram
803  * @bbm_ctx: bus bandwidth manager context
804  * @dp_direct_link_lock: Direct link mutex lock
805  * @dp_direct_link_ctx: DP Direct Link context
806  * @arp_connectivity_map: ARP connectivity map
807  * @rx_wake_lock: rx wake lock
808  * @ol_enable: Enable/Disable offload
809  * @rx_fst: FST handle
810  * @fst_cmem_base: FST base in CMEM
811  * @fst_in_cmem: Flag indicating if FST is in CMEM or not
812  * @fisa_enable: Flag to indicate if FISA is enabled or not
813  * @fisa_lru_del_enable: Flag to indicate if LRU flow delete is enabled
814  * @fisa_dynamic_aggr_size_support: Indicate dynamic aggr size programming support
815  * @skip_fisa_param: FISA skip params structure
816  * @skip_fisa_param.skip_fisa: Flag to skip FISA aggr inside @skip_fisa_param
817  * @skip_fisa_param.fisa_force_flush: Force flush inside @skip_fisa_param
818  * @fst_cmem_size: CMEM size for FISA flow table
819  * @inactive_dp_link_list: inactive DP links list
820  * @dp_link_del_lock: DP link delete operation lock
821  */
822 struct wlan_dp_psoc_context {
823 	struct wlan_objmgr_psoc *psoc;
824 	struct wlan_objmgr_pdev *pdev;
825 	qdf_device_t qdf_dev;
826 	struct wlan_dp_psoc_cfg dp_cfg;
827 	ol_txrx_soc_handle cdp_soc;
828 	struct hif_opaque_softc *hif_handle;
829 	void *hal_soc;
830 
831 	qdf_spinlock_t intf_list_lock;
832 	qdf_list_t intf_list;
833 
834 	bool rps;
835 	bool dynamic_rps;
836 	bool enable_rxthread;
837 	bool enable_dp_rx_threads;
838 	bool napi_enable;
839 
840 	struct wlan_dp_psoc_callbacks dp_ops;
841 	struct wlan_dp_psoc_sb_ops sb_ops;
842 	struct wlan_dp_psoc_nb_ops nb_ops;
843 
844 	bool en_tcp_delack_no_lro;
845 	uint64_t no_rx_offload_pkt_cnt;
846 	uint64_t no_tx_offload_pkt_cnt;
847 	bool is_suspend;
848 	bool is_wiphy_suspended;
849 	qdf_atomic_t num_latency_critical_clients;
850 	uint8_t high_bus_bw_request;
851 	uint64_t bw_vote_time;
852 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
853 	struct qdf_periodic_work bus_bw_work;
854 	int cur_vote_level;
855 	qdf_spinlock_t bus_bw_lock;
856 	int cur_rx_level;
857 	uint64_t prev_no_rx_offload_pkts;
858 	uint64_t prev_rx_offload_pkts;
859 	uint64_t prev_no_tx_offload_pkts;
860 	uint64_t prev_tx_offload_pkts;
861 	int cur_tx_level;
862 	uint64_t prev_tx;
863 	qdf_atomic_t low_tput_gro_enable;
864 	uint32_t bus_low_vote_cnt;
865 #ifdef FEATURE_RUNTIME_PM
866 	struct dp_rtpm_tput_policy_context rtpm_tput_policy_ctx;
867 #endif
868 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
869 	qdf_atomic_t disable_rx_ol_in_concurrency;
870 	qdf_atomic_t disable_rx_ol_in_low_tput;
871 
872 	uint16_t txrx_hist_idx;
873 	struct tx_rx_histogram *txrx_hist;
874 
875 	uint32_t rx_high_ind_cnt;
876 #ifdef FEATURE_BUS_BANDWIDTH_MGR
877 	struct bbm_context *bbm_ctx;
878 #endif
879 
880 	QDF_STATUS(*receive_offload_cb)(struct wlan_dp_intf *, qdf_nbuf_t nbuf);
881 
882 	struct {
883 		qdf_atomic_t rx_aggregation;
884 		uint8_t gro_force_flush[DP_MAX_RX_THREADS];
885 		bool tc_based_dyn_gro;
886 		uint32_t tc_ingress_prio;
887 	}
888 	dp_agg_param;
889 
890 	uint32_t arp_connectivity_map;
891 
892 	qdf_wake_lock_t rx_wake_lock;
893 
894 	enum RX_OFFLOAD ol_enable;
895 #ifdef FEATURE_DIRECT_LINK
896 	qdf_mutex_t dp_direct_link_lock;
897 	struct dp_direct_link_context *dp_direct_link_ctx;
898 #endif
899 #ifdef WLAN_SUPPORT_RX_FISA
900 	struct dp_rx_fst *rx_fst;
901 	uint64_t fst_cmem_base;
902 	bool fst_in_cmem;
903 	uint8_t fisa_enable;
904 	uint8_t fisa_lru_del_enable;
905 	bool fisa_dynamic_aggr_size_support;
906 	/*
907 	 * Params used for controlling the fisa aggregation dynamically
908 	 */
909 	struct {
910 		qdf_atomic_t skip_fisa;
911 		uint8_t fisa_force_flush[MAX_REO_DEST_RINGS];
912 	} skip_fisa_param;
913 
914 	/*
915 	 * CMEM address and size for FST in CMEM, This is the address
916 	 * shared during init time.
917 	 */
918 	uint64_t fst_cmem_size;
919 
920 #endif
921 	TAILQ_HEAD(, wlan_dp_link) inactive_dp_link_list;
922 	qdf_spinlock_t dp_link_del_lock;
923 };
924 
925 #ifdef WLAN_DP_PROFILE_SUPPORT
926 /**
927  * enum wlan_dp_cfg_param_type - param context type
928  * @DP_TX_DESC_NUM_CFG: Number of TX desc
929  * @DP_TX_EXT_DESC_NUM_CFG: Number of TX ext desc
930  * @DP_TX_RING_SIZE_CFG: TX ring size
931  * @DP_TX_COMPL_RING_SIZE_CFG: TX completion ring size
932  * @DP_RX_SW_DESC_NUM_CFG: Number of RX S.W descriptors
933  * @DP_REO_DST_RING_SIZE_CFG: RX ring size
934  * @DP_RXDMA_BUF_RING_SIZE_CFG: RXDMA BUF ring size
935  * @DP_RXDMA_REFILL_RING_SIZE_CFG: RXDMA refill ring size
936  * @DP_RX_REFILL_POOL_NUM_CFG: Refill buffer pool size
937  */
938 enum wlan_dp_cfg_param_type {
939 	DP_TX_DESC_NUM_CFG,
940 	DP_TX_EXT_DESC_NUM_CFG,
941 	DP_TX_RING_SIZE_CFG,
942 	DP_TX_COMPL_RING_SIZE_CFG,
943 	DP_RX_SW_DESC_NUM_CFG,
944 	DP_REO_DST_RING_SIZE_CFG,
945 	DP_RXDMA_BUF_RING_SIZE_CFG,
946 	DP_RXDMA_REFILL_RING_SIZE_CFG,
947 	DP_RX_REFILL_POOL_NUM_CFG,
948 };
949 
950 /**
951  * struct wlan_dp_memory_profile_ctx - element representing DP config param info
952  * @param_type: DP config param type
953  * @size: size/length of the param to be selected
954  */
955 struct wlan_dp_memory_profile_ctx {
956 	enum wlan_dp_cfg_param_type param_type;
957 	uint32_t size;
958 };
959 
960 /**
961  * struct wlan_dp_memory_profile_info - Current memory profile info
962  * @is_selected: profile is selected or not
963  * @ctx: DP memory profile context
964  * @size: size of profile
965  */
966 struct wlan_dp_memory_profile_info {
967 	bool is_selected;
968 	struct wlan_dp_memory_profile_ctx *ctx;
969 	int size;
970 };
971 #endif
972 
973 #endif /* end  of _WLAN_DP_PRIV_STRUCT_H_ */
974