xref: /wlan-driver/qca-wifi-host-cmn/dp/wifi3.0/dp_rings.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
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 #ifndef _DP_RINGS_H_
21 #define _DP_RINGS_H_
22 
23 #include <dp_types.h>
24 #include <dp_internal.h>
25 #ifdef WIFI_MONITOR_SUPPORT
26 #include <dp_mon.h>
27 #endif
28 
29 #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
dp_is_mon_mask_valid(struct dp_soc * soc,struct dp_intr * intr_ctx)30 static inline bool dp_is_mon_mask_valid(struct dp_soc *soc,
31 					struct dp_intr *intr_ctx)
32 {
33 	if (intr_ctx->rx_mon_ring_mask)
34 		return true;
35 
36 	return false;
37 }
38 #else
dp_is_mon_mask_valid(struct dp_soc * soc,struct dp_intr * intr_ctx)39 static inline bool dp_is_mon_mask_valid(struct dp_soc *soc,
40 					struct dp_intr *intr_ctx)
41 {
42 	return false;
43 }
44 #endif
45 
46 #ifndef QCA_HOST_MODE_WIFI_DISABLED
47 
48 /**
49  * dp_srng_get_cpu() - Get the smp processor id for srng processing
50  *
51  * Return: smp processor id
52  */
dp_srng_get_cpu(void)53 static inline int dp_srng_get_cpu(void)
54 {
55 	return qdf_get_cpu();
56 }
57 
58 #else /* QCA_HOST_MODE_WIFI_DISABLED */
59 
60 /**
61  * dp_srng_get_cpu() - Get the smp processor id for srng processing
62  *
63  * Return: smp processor id
64  */
dp_srng_get_cpu(void)65 static inline int dp_srng_get_cpu(void)
66 {
67 	return 0;
68 }
69 
70 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
71 
72 /**
73  * dp_interrupt_timer() - timer poll for interrupts
74  * @arg: SoC Handle
75  *
76  * Return:
77  *
78  */
79 void dp_interrupt_timer(void *arg);
80 
81 /**
82  * dp_soc_print_inactive_objects() - prints inactive peer and vdev list
83  * @soc: DP SOC handle
84  *
85  */
86 void dp_soc_print_inactive_objects(struct dp_soc *soc);
87 
88 /**
89  * dp_get_tx_pending() - read pending tx
90  * @pdev_handle: Datapath PDEV handle
91  *
92  * Return: outstanding tx
93  */
94 int32_t dp_get_tx_pending(struct cdp_pdev *pdev_handle);
95 
96 /**
97  * dp_find_missing_tx_comp() - check for leaked descriptor in tx path
98  * @soc: DP SOC context
99  *
100  * Parse through descriptors in all pools and validate magic number and
101  * completion time. Trigger self recovery if magic value is corrupted.
102  *
103  * Return: None.
104  */
105 void dp_find_missing_tx_comp(struct dp_soc *soc);
106 
107 void dp_enable_verbose_debug(struct dp_soc *soc);
108 
109 QDF_STATUS dp_peer_legacy_setup(struct dp_soc *soc, struct dp_peer *peer);
110 
111 uint32_t dp_service_srngs_wrapper(void *dp_ctx, uint32_t dp_budget, int cpu);
112 
113 void dp_soc_interrupt_map_calculate(struct dp_soc *soc, int intr_ctx_num,
114 				    int *irq_id_map, int *num_irq);
115 void dp_srng_msi_setup(struct dp_soc *soc, struct dp_srng *srng,
116 		       struct hal_srng_params *ring_params,
117 		       int ring_type, int ring_num);
118 void
119 dp_srng_configure_interrupt_thresholds(struct dp_soc *soc,
120 				       struct hal_srng_params *ring_params,
121 				       int ring_type, int ring_num,
122 				       int num_entries);
123 
124 int dp_process_lmac_rings(struct dp_intr *int_ctx, int total_budget);
125 
126 /**
127  * dp_service_lmac_rings()- timer to reap lmac rings
128  * @arg: SoC Handle
129  *
130  * Return:
131  *
132  */
133 void dp_service_lmac_rings(void *arg);
134 
135 /**
136  * dp_service_srngs() - Top level interrupt handler for DP Ring interrupts
137  * @dp_ctx: DP SOC handle
138  * @dp_budget: Number of frames/descriptors that can be processed in one shot
139  * @cpu: CPU on which this instance is running
140  *
141  * Return: remaining budget/quota for the soc device
142  */
143 uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget, int cpu);
144 
145 /**
146  * dp_soc_set_interrupt_mode() - Set the interrupt mode in soc
147  * @soc: DP soc handle
148  *
149  * Set the appropriate interrupt mode flag in the soc
150  */
151 void dp_soc_set_interrupt_mode(struct dp_soc *soc);
152 
153 /**
154  * dp_srng_find_ring_in_mask() - find which ext_group a ring belongs
155  * @ring_num: ring num of the ring being queried
156  * @grp_mask: the grp_mask array for the ring type in question.
157  *
158  * The grp_mask array is indexed by group number and the bit fields correspond
159  * to ring numbers.  We are finding which interrupt group a ring belongs to.
160  *
161  * Return: the index in the grp_mask array with the ring number.
162  * -QDF_STATUS_E_NOENT if no entry is found
163  */
dp_srng_find_ring_in_mask(int ring_num,uint8_t * grp_mask)164 static inline int dp_srng_find_ring_in_mask(int ring_num, uint8_t *grp_mask)
165 {
166 	int ext_group_num;
167 	uint8_t mask = 1 << ring_num;
168 
169 	for (ext_group_num = 0; ext_group_num < WLAN_CFG_INT_NUM_CONTEXTS;
170 	     ext_group_num++) {
171 		if (mask & grp_mask[ext_group_num])
172 			return ext_group_num;
173 	}
174 
175 	return -QDF_STATUS_E_NOENT;
176 }
177 
178 /* MCL specific functions */
179 #if defined(DP_CON_MON)
180 
181 #ifdef DP_CON_MON_MSI_ENABLED
182 /**
183  * dp_soc_get_mon_mask_for_interrupt_mode() - get mon mode mask for intr mode
184  * @soc: pointer to dp_soc handle
185  * @intr_ctx_num: interrupt context number for which mon mask is needed
186  *
187  * For MCL, monitor mode rings are being processed in timer contexts (polled).
188  * This function is returning 0, since in interrupt mode(softirq based RX),
189  * we donot want to process monitor mode rings in a softirq.
190  *
191  * So, in case packet log is enabled for SAP/STA/P2P modes,
192  * regular interrupt processing will not process monitor mode rings. It would be
193  * done in a separate timer context.
194  *
195  * Return: 0
196  */
197 static inline uint32_t
dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc * soc,int intr_ctx_num)198 dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc *soc, int intr_ctx_num)
199 {
200 	return wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num);
201 }
202 #else
203 /**
204  * dp_soc_get_mon_mask_for_interrupt_mode() - get mon mode mask for intr mode
205  * @soc: pointer to dp_soc handle
206  * @intr_ctx_num: interrupt context number for which mon mask is needed
207  *
208  * For MCL, monitor mode rings are being processed in timer contexts (polled).
209  * This function is returning 0, since in interrupt mode(softirq based RX),
210  * we donot want to process monitor mode rings in a softirq.
211  *
212  * So, in case packet log is enabled for SAP/STA/P2P modes,
213  * regular interrupt processing will not process monitor mode rings. It would be
214  * done in a separate timer context.
215  *
216  * Return: 0
217  */
218 static inline uint32_t
dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc * soc,int intr_ctx_num)219 dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc *soc, int intr_ctx_num)
220 {
221 	return 0;
222 }
223 #endif
224 
225 #else
226 
227 /**
228  * dp_soc_get_mon_mask_for_interrupt_mode() - get mon mode mask for intr mode
229  * @soc: pointer to dp_soc handle
230  * @intr_ctx_num: interrupt context number for which mon mask is needed
231  *
232  * Return: mon mask value
233  */
234 static inline
dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc * soc,int intr_ctx_num)235 uint32_t dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc *soc,
236 						int intr_ctx_num)
237 {
238 	return wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num);
239 }
240 #endif
241 
242 #ifdef DISABLE_MON_RING_MSI_CFG
243 /**
244  * dp_skip_msi_cfg() - Check if msi cfg has to be skipped for ring_type
245  * @soc: DP SoC context
246  * @ring_type: sring type
247  *
248  * Return: True if msi cfg should be skipped for srng type else false
249  */
dp_skip_msi_cfg(struct dp_soc * soc,int ring_type)250 static inline bool dp_skip_msi_cfg(struct dp_soc *soc, int ring_type)
251 {
252 	if (ring_type == RXDMA_MONITOR_STATUS)
253 		return true;
254 
255 	return false;
256 }
257 #else
258 #ifdef DP_CON_MON_MSI_ENABLED
259 #ifdef WLAN_SOFTUMAC_SUPPORT
dp_skip_msi_cfg(struct dp_soc * soc,int ring_type)260 static inline bool dp_skip_msi_cfg(struct dp_soc *soc, int ring_type)
261 {
262 	if (soc->cdp_soc.ol_ops->get_con_mode &&
263 	    soc->cdp_soc.ol_ops->get_con_mode() == QDF_GLOBAL_MONITOR_MODE) {
264 		if (ring_type != RXDMA_MONITOR_STATUS)
265 			return true;
266 	} else if (ring_type == RXDMA_MONITOR_STATUS &&
267 		   !dp_mon_mode_local_pkt_capture(soc)) {
268 		return true;
269 	}
270 
271 	return false;
272 }
273 #else
dp_skip_msi_cfg(struct dp_soc * soc,int ring_type)274 static inline bool dp_skip_msi_cfg(struct dp_soc *soc, int ring_type)
275 {
276 	if (soc->cdp_soc.ol_ops->get_con_mode &&
277 	    soc->cdp_soc.ol_ops->get_con_mode() == QDF_GLOBAL_MONITOR_MODE) {
278 		if (ring_type == REO_DST || ring_type == RXDMA_DST)
279 			return true;
280 	} else if (ring_type == RXDMA_MONITOR_STATUS &&
281 		  !dp_mon_mode_local_pkt_capture(soc)) {
282 		return true;
283 	}
284 
285 	return false;
286 }
287 #endif
288 #else
dp_skip_msi_cfg(struct dp_soc * soc,int ring_type)289 static inline bool dp_skip_msi_cfg(struct dp_soc *soc, int ring_type)
290 {
291 	return false;
292 }
293 #endif /* DP_CON_MON_MSI_ENABLED */
294 #endif /* DISABLE_MON_RING_MSI_CFG */
295 
296 /**
297  * dp_is_msi_group_number_invalid() - check msi_group_number valid or not
298  * @soc: dp_soc
299  * @msi_group_number: MSI group number.
300  * @msi_data_count: MSI data count.
301  *
302  * Return: true if msi_group_number is invalid.
303  */
dp_is_msi_group_number_invalid(struct dp_soc * soc,int msi_group_number,int msi_data_count)304 static inline bool dp_is_msi_group_number_invalid(struct dp_soc *soc,
305 						  int msi_group_number,
306 						  int msi_data_count)
307 {
308 	if (soc && soc->osdev && soc->osdev->dev &&
309 	    pld_is_one_msi(soc->osdev->dev))
310 		return false;
311 
312 	return msi_group_number > msi_data_count;
313 }
314 
315 #ifndef WLAN_SOFTUMAC_SUPPORT
316 /**
317  * dp_soc_attach_poll() - Register handlers for DP interrupts
318  * @txrx_soc: DP SOC handle
319  *
320  * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI
321  * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and
322  * rx_monitor_ring mask to indicate the rings that are processed by the handler.
323  *
324  * Return: 0 for success, nonzero for failure.
325  */
326 QDF_STATUS dp_soc_attach_poll(struct cdp_soc_t *txrx_soc);
327 
328 /**
329  * dp_soc_interrupt_attach() - Register handlers for DP interrupts
330  * @txrx_soc: DP SOC handle
331  *
332  * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI
333  * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and
334  * rx_monitor_ring mask to indicate the rings that are processed by the handler.
335  *
336  * Return: 0 for success. nonzero for failure.
337  */
338 QDF_STATUS dp_soc_interrupt_attach(struct cdp_soc_t *txrx_soc);
339 
340 /**
341  * dp_hw_link_desc_ring_free() - Free h/w link desc rings
342  * @soc: DP SOC handle
343  *
344  * Return: none
345  */
346 void dp_hw_link_desc_ring_free(struct dp_soc *soc);
347 
348 /**
349  * dp_hw_link_desc_ring_alloc() - Allocate hw link desc rings
350  * @soc: DP SOC handle
351  *
352  * Allocate memory for WBM_IDLE_LINK srng ring if the number of
353  * link descriptors is less then the max_allocated size. else
354  * allocate memory for wbm_idle_scatter_buffer.
355  *
356  * Return: QDF_STATUS_SUCCESS: success
357  *         QDF_STATUS_E_NO_MEM: No memory (Failure)
358  */
359 QDF_STATUS dp_hw_link_desc_ring_alloc(struct dp_soc *soc);
360 
361 /**
362  * dp_hw_link_desc_ring_init() - Initialize hw link desc rings
363  * @soc: DP SOC handle
364  *
365  * Return: QDF_STATUS_SUCCESS: success
366  *         QDF_STATUS_E_FAILURE: failure
367  */
368 QDF_STATUS dp_hw_link_desc_ring_init(struct dp_soc *soc);
369 
370 /**
371  * dp_hw_link_desc_ring_deinit() - Reset hw link desc rings
372  * @soc: DP SOC handle
373  *
374  * Return: None
375  */
376 void dp_hw_link_desc_ring_deinit(struct dp_soc *soc);
377 
378 /**
379  * dp_ipa_hal_tx_init_alt_data_ring() - IPA hal init data rings
380  * @soc: DP SOC handle
381  *
382  * Return: None
383  */
384 void dp_ipa_hal_tx_init_alt_data_ring(struct dp_soc *soc);
385 
386 /*
387  * dp_soc_reset_ring_map() - Reset cpu ring map
388  * @soc: Datapath soc handler
389  *
390  * This api resets the default cpu ring map
391  */
392 void dp_soc_reset_cpu_ring_map(struct dp_soc *soc);
393 
394 /*
395  * dp_soc_reset_ipa_vlan_intr_mask() - reset interrupt mask for IPA offloaded
396  * ring for vlan tagged traffic
397  * @dp_soc - DP Soc handle
398  *
399  * Return: Return void
400  */
401 void dp_soc_reset_ipa_vlan_intr_mask(struct dp_soc *soc);
402 
403 /*
404  * dp_soc_reset_intr_mask() - reset interrupt mask
405  * @dp_soc - DP Soc handle
406  *
407  * Return: Return void
408  */
409 void dp_soc_reset_intr_mask(struct dp_soc *soc);
410 
411 /*
412  * dp_reo_frag_dst_set() - configure reo register to set the
413  *                        fragment destination ring
414  * @soc : Datapath soc
415  * @frag_dst_ring : output parameter to set fragment destination ring
416  *
417  * Based on offload_radio below fragment destination rings is selected
418  * 0 - TCL
419  * 1 - SW1
420  * 2 - SW2
421  * 3 - SW3
422  * 4 - SW4
423  * 5 - Release
424  * 6 - FW
425  * 7 - alternate select
426  *
427  * return: void
428  */
429 void dp_reo_frag_dst_set(struct dp_soc *soc, uint8_t *frag_dst_ring);
430 
431 /**
432  * dp_dscp_tid_map_setup(): Initialize the dscp-tid maps
433  * @pdev:  DP_PDEV handle
434  *
435  * Return: void
436  */
437 void
438 dp_dscp_tid_map_setup(struct dp_pdev *pdev);
439 
440 /**
441  * dp_pcp_tid_map_setup(): Initialize the pcp-tid maps
442  * @pdev: DP_PDEV handle
443  *
444  * Return: void
445  */
446 void
447 dp_pcp_tid_map_setup(struct dp_pdev *pdev);
448 
449 /**
450  * dp_soc_deinit() - Deinitialize txrx SOC
451  * @txrx_soc: Opaque DP SOC handle
452  *
453  * Return: None
454  */
455 void dp_soc_deinit(void *txrx_soc);
456 
457 #ifdef QCA_HOST2FW_RXBUF_RING
458 void
459 dp_htt_setup_rxdma_err_dst_ring(struct dp_soc *soc, int mac_id,
460 				int lmac_id);
461 #endif
462 
463 /*
464  * dp_peer_setup_wifi3() - initialize the peer
465  * @soc_hdl: soc handle object
466  * @vdev_id : vdev_id of vdev object
467  * @peer_mac: Peer's mac address
468  * @peer_setup_info: peer setup info for MLO
469  *
470  * Return: QDF_STATUS
471  */
472 QDF_STATUS
473 dp_peer_setup_wifi3(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
474 		    uint8_t *peer_mac,
475 		    struct cdp_peer_setup_info *setup_info);
476 
477 uint32_t dp_get_tx_rings_grp_bitmap(struct cdp_soc_t *soc_hdl);
478 
479 /*
480  * dp_set_ba_aging_timeout() - set ba aging timeout per AC
481  * @txrx_soc: cdp soc handle
482  * @ac: Access category
483  * @value: timeout value in millisec
484  *
485  * Return: void
486  */
487 void dp_set_ba_aging_timeout(struct cdp_soc_t *txrx_soc,
488 			     uint8_t ac, uint32_t value);
489 
490 /*
491  * dp_get_ba_aging_timeout() - get ba aging timeout per AC
492  * @txrx_soc: cdp soc handle
493  * @ac: access category
494  * @value: timeout value in millisec
495  *
496  * Return: void
497  */
498 void dp_get_ba_aging_timeout(struct cdp_soc_t *txrx_soc,
499 			     uint8_t ac, uint32_t *value);
500 
501 /*
502  * dp_set_pdev_reo_dest() - set the reo destination ring for this pdev
503  * @txrx_soc: cdp soc handle
504  * @pdev_id: id of physical device object
505  * @val: reo destination ring index (1 - 4)
506  *
507  * Return: QDF_STATUS
508  */
509 QDF_STATUS
510 dp_set_pdev_reo_dest(struct cdp_soc_t *txrx_soc, uint8_t pdev_id,
511 		     enum cdp_host_reo_dest_ring val);
512 
513 /*
514  * dp_get_pdev_reo_dest() - get the reo destination for this pdev
515  * @txrx_soc: cdp soc handle
516  * @pdev_id: id of physical device object
517  *
518  * Return: reo destination ring index
519  */
520 enum cdp_host_reo_dest_ring
521 dp_get_pdev_reo_dest(struct cdp_soc_t *txrx_soc, uint8_t pdev_id);
522 
523 /**
524  * dp_set_pdev_pcp_tid_map_wifi3(): update pcp tid map in pdev
525  * @psoc: dp soc handle
526  * @pdev_id: id of DP_PDEV handle
527  * @pcp: pcp value
528  * @tid: tid value passed by the user
529  *
530  * Return: QDF_STATUS_SUCCESS on success
531  */
532 QDF_STATUS dp_set_pdev_pcp_tid_map_wifi3(ol_txrx_soc_handle psoc,
533 					 uint8_t pdev_id,
534 					 uint8_t pcp, uint8_t tid);
535 
536 /**
537  * dp_set_vdev_pcp_tid_map_wifi3(): update pcp tid map in vdev
538  * @soc_hdl: DP soc handle
539  * @vdev_id: id of DP_VDEV handle
540  * @pcp: pcp value
541  * @tid: tid value passed by the user
542  *
543  * Return: QDF_STATUS_SUCCESS on success
544  */
545 QDF_STATUS dp_set_vdev_pcp_tid_map_wifi3(struct cdp_soc_t *soc_hdl,
546 					 uint8_t vdev_id,
547 					 uint8_t pcp, uint8_t tid);
548 
549 /* *
550  * dp_dump_wbm_idle_hptp() -dump wbm idle ring, hw hp tp info.
551  * @soc: dp soc.
552  * @pdev: dp pdev.
553  *
554  * Return: None.
555  */
556 void
557 dp_dump_wbm_idle_hptp(struct dp_soc *soc, struct dp_pdev *pdev);
558 
559 /**
560  * dp_display_srng_info() - Dump the srng HP TP info
561  * @soc_hdl: CDP Soc handle
562  *
563  * This function dumps the SW hp/tp values for the important rings.
564  * HW hp/tp values are not being dumped, since it can lead to
565  * READ NOC error when UMAC is in low power state. MCC does not have
566  * device force wake working yet.
567  *
568  * Return: rings are empty
569  */
570 bool dp_display_srng_info(struct cdp_soc_t *soc_hdl);
571 
572 #if defined(DP_POWER_SAVE) || defined(FEATURE_RUNTIME_PM)
573 QDF_STATUS dp_drain_txrx(struct cdp_soc_t *soc_handle, uint8_t rx_only);
574 
575 /*
576  * dp_update_ring_hptp() - update dp rings hptp
577  * @soc: dp soc handler
578  * @force_flush_tx: force flush the Tx ring hp
579  */
580 void dp_update_ring_hptp(struct dp_soc *soc, bool force_flush_tx);
581 #endif
582 
583 /*
584  * dp_flush_tcl_ring() - flush TCL ring hp
585  * @pdev: dp pdev
586  * @ring_id: TCL ring id
587  *
588  * Return: 0 on success and error code on failure
589  */
590 int dp_flush_tcl_ring(struct dp_pdev *pdev, int ring_id);
591 
592 #ifdef WLAN_FEATURE_STATS_EXT
593 /**
594  * dp_request_rx_hw_stats - request rx hardware stats
595  * @soc_hdl: soc handle
596  * @vdev_id: vdev id
597  *
598  * Return: None
599  */
600 QDF_STATUS
601 dp_request_rx_hw_stats(struct cdp_soc_t *soc_hdl, uint8_t vdev_id);
602 #endif
603 
604 /**
605  * dp_reset_rx_hw_ext_stats - Reset rx hardware ext stats
606  * @soc_hdl: soc handle
607  *
608  * Return: None
609  */
610 void dp_reset_rx_hw_ext_stats(struct cdp_soc_t *soc_hdl);
611 
612 void dp_pdev_set_default_reo(struct dp_pdev *pdev);
613 
614 /**
615  * dp_soc_init() - Initialize txrx SOC
616  * @soc: Opaque DP SOC handle
617  * @htc_handle: Opaque HTC handle
618  * @hif_handle: Opaque HIF handle
619  *
620  * Return: DP SOC handle on success, NULL on failure
621  */
622 void *dp_soc_init(struct dp_soc *soc, HTC_HANDLE htc_handle,
623 		  struct hif_opaque_softc *hif_handle);
624 
625 void dp_tx_init_cmd_credit_ring(struct dp_soc *soc);
626 
627 /**
628  * dp_soc_srng_deinit() - de-initialize soc srng rings
629  * @soc: Datapath soc handle
630  *
631  */
632 void dp_soc_srng_deinit(struct dp_soc *soc);
633 
634 /**
635  * dp_soc_srng_init() - Initialize soc level srng rings
636  * @soc: Datapath soc handle
637  *
638  * return: QDF_STATUS_SUCCESS on success
639  *	   QDF_STATUS_E_FAILURE on failure
640  */
641 QDF_STATUS dp_soc_srng_init(struct dp_soc *soc);
642 
643 /**
644  * dp_soc_srng_free() - free soc level srng rings
645  * @soc: Datapath soc handle
646  *
647  */
648 void dp_soc_srng_free(struct dp_soc *soc);
649 
650 /**
651  * dp_soc_srng_alloc() - Allocate memory for soc level srng rings
652  * @soc: Datapath soc handle
653  *
654  * return: QDF_STATUS_SUCCESS on success
655  *	   QDF_STATUS_E_NOMEM on failure
656  */
657 QDF_STATUS dp_soc_srng_alloc(struct dp_soc *soc);
658 
659 /**
660  * dp_soc_cfg_attach() - set target specific configuration in
661  *			 dp soc cfg.
662  * @soc: dp soc handle
663  */
664 void dp_soc_cfg_attach(struct dp_soc *soc);
665 
666 #else /* WLAN_SOFTUMAC_SUPPORT */
dp_hw_link_desc_ring_free(struct dp_soc * soc)667 static inline void dp_hw_link_desc_ring_free(struct dp_soc *soc)
668 {
669 }
670 
dp_hw_link_desc_ring_alloc(struct dp_soc * soc)671 static inline QDF_STATUS dp_hw_link_desc_ring_alloc(struct dp_soc *soc)
672 {
673 	return QDF_STATUS_SUCCESS;
674 }
675 
dp_hw_link_desc_ring_init(struct dp_soc * soc)676 static inline QDF_STATUS dp_hw_link_desc_ring_init(struct dp_soc *soc)
677 {
678 	return QDF_STATUS_SUCCESS;
679 }
680 
dp_hw_link_desc_ring_deinit(struct dp_soc * soc)681 static inline void dp_hw_link_desc_ring_deinit(struct dp_soc *soc)
682 {
683 }
684 
dp_ipa_hal_tx_init_alt_data_ring(struct dp_soc * soc)685 static inline void dp_ipa_hal_tx_init_alt_data_ring(struct dp_soc *soc)
686 {
687 }
688 
dp_soc_reset_cpu_ring_map(struct dp_soc * soc)689 static inline void dp_soc_reset_cpu_ring_map(struct dp_soc *soc)
690 {
691 }
692 
dp_soc_reset_ipa_vlan_intr_mask(struct dp_soc * soc)693 static inline void dp_soc_reset_ipa_vlan_intr_mask(struct dp_soc *soc)
694 {
695 }
696 
dp_soc_reset_intr_mask(struct dp_soc * soc)697 static inline void dp_soc_reset_intr_mask(struct dp_soc *soc)
698 {
699 }
700 
701 static inline
dp_reo_frag_dst_set(struct dp_soc * soc,uint8_t * frag_dst_ring)702 void dp_reo_frag_dst_set(struct dp_soc *soc, uint8_t *frag_dst_ring)
703 {
704 }
705 
706 /**
707  * dp_dscp_tid_map_setup(): Initialize the dscp-tid maps
708  * @pdev: DP_PDEV handle
709  *
710  * Return: void
711  */
712 static inline void
dp_dscp_tid_map_setup(struct dp_pdev * pdev)713 dp_dscp_tid_map_setup(struct dp_pdev *pdev)
714 {
715 }
716 
717 /**
718  * dp_pcp_tid_map_setup(): Initialize the pcp-tid maps
719  * @pdev: DP_PDEV handle
720  *
721  * Return: void
722  */
723 static inline void
dp_pcp_tid_map_setup(struct dp_pdev * pdev)724 dp_pcp_tid_map_setup(struct dp_pdev *pdev)
725 {
726 }
727 
728 #ifdef QCA_HOST2FW_RXBUF_RING
729 static inline void
dp_htt_setup_rxdma_err_dst_ring(struct dp_soc * soc,int mac_id,int lmac_id)730 dp_htt_setup_rxdma_err_dst_ring(struct dp_soc *soc, int mac_id,
731 				int lmac_id)
732 {
733 	if ((soc->cdp_soc.ol_ops->get_con_mode &&
734 	     soc->cdp_soc.ol_ops->get_con_mode() == QDF_GLOBAL_MONITOR_MODE) &&
735 	    soc->rxdma_err_dst_ring[lmac_id].hal_srng)
736 		htt_srng_setup(soc->htt_handle, mac_id,
737 			       soc->rxdma_err_dst_ring[lmac_id].hal_srng,
738 			       RXDMA_DST);
739 }
740 #endif
741 
742 /* *
743  * dp_dump_wbm_idle_hptp() -dump wbm idle ring, hw hp tp info.
744  * @soc: dp soc.
745  * @pdev: dp pdev.
746  *
747  * Return: None.
748  */
749 static inline void
dp_dump_wbm_idle_hptp(struct dp_soc * soc,struct dp_pdev * pdev)750 dp_dump_wbm_idle_hptp(struct dp_soc *soc, struct dp_pdev *pdev)
751 {
752 }
753 
dp_pdev_set_default_reo(struct dp_pdev * pdev)754 static inline void dp_pdev_set_default_reo(struct dp_pdev *pdev)
755 {
756 }
757 
dp_tx_init_cmd_credit_ring(struct dp_soc * soc)758 static inline void dp_tx_init_cmd_credit_ring(struct dp_soc *soc)
759 {
760 }
761 
762 /**
763  * dp_soc_srng_deinit() - de-initialize soc srng rings
764  * @soc: Datapath soc handle
765  *
766  */
dp_soc_srng_deinit(struct dp_soc * soc)767 static inline void dp_soc_srng_deinit(struct dp_soc *soc)
768 {
769 }
770 
771 /**
772  * dp_soc_srng_init() - Initialize soc level srng rings
773  * @soc: Datapath soc handle
774  *
775  * return: QDF_STATUS_SUCCESS on success
776  *	   QDF_STATUS_E_FAILURE on failure
777  */
dp_soc_srng_init(struct dp_soc * soc)778 static inline QDF_STATUS dp_soc_srng_init(struct dp_soc *soc)
779 {
780 	dp_enable_verbose_debug(soc);
781 
782 	return QDF_STATUS_SUCCESS;
783 }
784 
785 /**
786  * dp_soc_srng_free() - free soc level srng rings
787  * @soc: Datapath soc handle
788  *
789  */
dp_soc_srng_free(struct dp_soc * soc)790 static inline void dp_soc_srng_free(struct dp_soc *soc)
791 {
792 }
793 
794 /**
795  * dp_soc_srng_alloc() - Allocate memory for soc level srng rings
796  * @soc: Datapath soc handle
797  *
798  * return: QDF_STATUS_SUCCESS on success
799  *	   QDF_STATUS_E_NOMEM on failure
800  */
dp_soc_srng_alloc(struct dp_soc * soc)801 static inline QDF_STATUS dp_soc_srng_alloc(struct dp_soc *soc)
802 {
803 	return QDF_STATUS_SUCCESS;
804 }
805 
806 /**
807  * dp_display_srng_info() - Dump the ring Read/Write idx info
808  * @soc_hdl: CDP Soc handle
809  *
810  * This function dumps the SW Read/Write idx for the important rings.
811  *
812  * Return:  rings are empty
813  */
dp_display_srng_info(struct cdp_soc_t * soc_hdl)814 static inline bool dp_display_srng_info(struct cdp_soc_t *soc_hdl)
815 {
816 /*TODO add support display SOFTUMAC data rings info*/
817 	return true;
818 }
819 
820 #if defined(DP_POWER_SAVE) || defined(FEATURE_RUNTIME_PM)
dp_drain_txrx(struct cdp_soc_t * soc_handle,uint8_t rx_only)821 static inline QDF_STATUS dp_drain_txrx(struct cdp_soc_t *soc_handle,
822 				       uint8_t rx_only)
823 {
824 	return QDF_STATUS_SUCCESS;
825 }
826 #endif
827 #endif /* WLAN_SOFTUMAC_SUPPORT */
828 
829 #if defined(WLAN_FEATURE_NEAR_FULL_IRQ) && !defined(WLAN_SOFTUMAC_SUPPORT)
830 void dp_srng_msi2_setup(struct dp_soc *soc,
831 			struct hal_srng_params *ring_params,
832 			int ring_type, int ring_num, int nf_msi_grp_num);
833 void dp_srng_set_msi2_ring_params(struct dp_soc *soc,
834 				  struct hal_srng_params *ring_params,
835 				  qdf_dma_addr_t msi2_addr,
836 				  uint32_t msi2_data);
837 uint8_t *dp_srng_get_near_full_irq_mask(struct dp_soc *soc,
838 					enum hal_ring_type ring_type,
839 					int ring_num);
840 void
841 dp_srng_configure_nf_interrupt_thresholds(struct dp_soc *soc,
842 					  struct hal_srng_params *ring_params,
843 					  int ring_type);
844 #else
845 static inline void
dp_srng_msi2_setup(struct dp_soc * soc,struct hal_srng_params * ring_params,int ring_type,int ring_num,int nf_msi_grp_num)846 dp_srng_msi2_setup(struct dp_soc *soc,
847 		   struct hal_srng_params *ring_params,
848 		   int ring_type, int ring_num, int nf_msi_grp_num)
849 {
850 }
851 
852 static inline void
dp_srng_set_msi2_ring_params(struct dp_soc * soc,struct hal_srng_params * ring_params,qdf_dma_addr_t msi2_addr,uint32_t msi2_data)853 dp_srng_set_msi2_ring_params(struct dp_soc *soc,
854 			     struct hal_srng_params *ring_params,
855 			     qdf_dma_addr_t msi2_addr,
856 			     uint32_t msi2_data)
857 {
858 }
859 
860 static inline
dp_srng_get_near_full_irq_mask(struct dp_soc * soc,enum hal_ring_type ring_type,int ring_num)861 uint8_t *dp_srng_get_near_full_irq_mask(struct dp_soc *soc,
862 					enum hal_ring_type ring_type,
863 					int ring_num)
864 {
865 	return NULL;
866 }
867 
868 static inline void
dp_srng_configure_nf_interrupt_thresholds(struct dp_soc * soc,struct hal_srng_params * ring_params,int ring_type)869 dp_srng_configure_nf_interrupt_thresholds(struct dp_soc *soc,
870 					  struct hal_srng_params *ring_params,
871 					  int ring_type)
872 {
873 }
874 #endif
875 
876 #ifdef WLAN_SUPPORT_DPDK
877 /*
878  * dp_soc_reset_dpdk_intr_mask() - reset interrupt mask
879  * @dp_soc - DP Soc handle
880  *
881  * Return: Return void
882  */
883 void dp_soc_reset_dpdk_intr_mask(struct dp_soc *soc);
884 #else
dp_soc_reset_dpdk_intr_mask(struct dp_soc * soc)885 static inline void dp_soc_reset_dpdk_intr_mask(struct dp_soc *soc)
886 { }
887 #endif
888 #endif /* _DP_RINGS_H_ */
889