xref: /wlan-driver/qca-wifi-host-cmn/dp/wifi3.0/rh/dp_rh.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2023 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 #ifndef __DP_RH_H
19 #define __DP_RH_H
20 
21 #include <dp_types.h>
22 #include <dp_mon.h>
23 #include <dp_htt.h>
24 #include <hal_rh_tx.h>
25 #include <hal_rh_rx.h>
26 #include <qdf_pkt_add_timestamp.h>
27 #include "dp_rh_tx.h"
28 
29 /**
30  * struct dp_soc_rh - Extended DP soc for RH targets
31  * @soc: dp soc structure
32  * @tcl_desc_pool: A pool of TCL descriptors that are allocated for RH targets
33  * @tx_endpoint: HTC endpoint ID for TX
34  */
35 struct dp_soc_rh {
36 	struct dp_soc soc;
37 	struct dp_tx_tcl_desc_pool_s tcl_desc_pool[MAX_TXDESC_POOLS];
38 	HTC_ENDPOINT_ID tx_endpoint;
39 };
40 
41 /**
42  * struct dp_tx_ep_info_rh - TX endpoint info
43  * @tx_endpoint: HTC endpoint ID for TX
44  * @ce_tx_hdl: CE TX handle for enqueueing TX commands
45  * @download_len: Length of the packet that gets downloaded over CE
46  */
47 struct dp_tx_ep_info_rh {
48 	HTC_ENDPOINT_ID tx_endpoint;
49 	struct CE_handle *ce_tx_hdl;
50 	uint32_t download_len;
51 };
52 
53 /**
54  * struct dp_pdev_rh - Extended DP pdev for RH targets
55  * @pdev: dp_pdev structure
56  * @tx_ep_info: TX endpoint info
57  */
58 struct dp_pdev_rh {
59 	struct dp_pdev pdev;
60 	struct dp_tx_ep_info_rh tx_ep_info;
61 };
62 
63 /**
64  * struct dp_vdev_rh - Extended DP vdev for RH targets
65  * @vdev: dp_vdev structure
66  */
67 struct dp_vdev_rh {
68 	struct dp_vdev vdev;
69 };
70 
71 /**
72  * struct dp_peer_rh - Extended DP peer for RH targets
73  * @peer: dp_peer structure
74  */
75 struct dp_peer_rh {
76 	struct dp_peer peer;
77 };
78 
79 /**
80  * struct dp_mon_soc_rh - Extended DP mon soc for RH targets
81  * @mon_soc: dp_mon_soc structure
82  */
83 struct dp_mon_soc_rh {
84 	struct dp_mon_soc mon_soc;
85 };
86 
87 /**
88  * struct dp_mon_pdev_rh - Extended DP mon pdev for RH targets
89  * @mon_pdev: dp_mon_pdev structure
90  */
91 struct dp_mon_pdev_rh {
92 	struct dp_mon_pdev mon_pdev;
93 };
94 
95 /**
96  * dp_get_soc_context_size_rh() - get context size for dp_soc_rh
97  *
98  * Return: value in bytes for RH specific soc structure
99  */
100 qdf_size_t dp_get_soc_context_size_rh(void);
101 
102 /**
103  * dp_initialize_arch_ops_rh() - initialize RH specific arch ops
104  * @arch_ops: arch ops pointer
105  *
106  * Return: none
107  */
108 void dp_initialize_arch_ops_rh(struct dp_arch_ops *arch_ops);
109 
110 /**
111  * dp_get_context_size_rh() - get RH specific size for peer/vdev/pdev/soc
112  * @context_type: Context type to get size
113  *
114  * Return: size in bytes for the context_type
115  */
116 
117 qdf_size_t dp_get_context_size_rh(enum dp_context_type context_type);
118 
119 /**
120  * dp_mon_get_context_size_rh() - get RH specific size for mon pdev/soc
121  * @context_type: Mon context type to get size
122  *
123  * Return: size in bytes for the context_type
124  */
125 
126 qdf_size_t dp_mon_get_context_size_rh(enum dp_context_type context_type);
127 
128 /**
129  * dp_get_rh_pdev_from_dp_pdev() - get dp_pdev_rh from dp_pdev
130  * @pdev: dp_pdev pointer
131  *
132  * Return: dp_pdev_rh pointer
133  */
134 static inline
dp_get_rh_pdev_from_dp_pdev(struct dp_pdev * pdev)135 struct dp_pdev_rh *dp_get_rh_pdev_from_dp_pdev(struct dp_pdev *pdev)
136 {
137 	return (struct dp_pdev_rh *)pdev;
138 }
139 
140 /**
141  * dp_get_rh_soc_from_dp_soc() - get dp_soc_rh from dp_soc
142  * @soc: dp_soc pointer
143  *
144  * Return: dp_soc_rh pointer
145  */
dp_get_rh_soc_from_dp_soc(struct dp_soc * soc)146 static inline struct dp_soc_rh *dp_get_rh_soc_from_dp_soc(struct dp_soc *soc)
147 {
148 	return (struct dp_soc_rh *)soc;
149 }
150 #endif
151