xref: /dpdk/drivers/net/ntnic/ntnic_mod_reg.c (revision 87b3bb06d918af82092b4aadecb9d19ac354606d)
1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * Copyright(c) 2023 Napatech A/S
4  */
5 
6 #include "ntnic_mod_reg.h"
7 
8 static struct sg_ops_s *sg_ops;
9 
10 void register_sg_ops(struct sg_ops_s *ops)
11 {
12 	sg_ops = ops;
13 }
14 
15 const struct sg_ops_s *get_sg_ops(void)
16 {
17 	if (sg_ops == NULL)
18 		sg_init();
19 	return sg_ops;
20 }
21 
22 /*
23  *
24  */
25 static struct meter_ops_s *meter_ops;
26 
27 void register_meter_ops(struct meter_ops_s *ops)
28 {
29 	meter_ops = ops;
30 }
31 
32 const struct meter_ops_s *get_meter_ops(void)
33 {
34 	if (meter_ops == NULL)
35 		meter_init();
36 
37 	return meter_ops;
38 }
39 
40 /*
41  *
42  */
43 static const struct ntnic_filter_ops *ntnic_filter_ops;
44 
45 void register_ntnic_filter_ops(const struct ntnic_filter_ops *ops)
46 {
47 	ntnic_filter_ops = ops;
48 }
49 
50 const struct ntnic_filter_ops *get_ntnic_filter_ops(void)
51 {
52 	if (ntnic_filter_ops == NULL)
53 		ntnic_filter_init();
54 
55 	return ntnic_filter_ops;
56 }
57 
58 static struct link_ops_s *link_100g_ops;
59 
60 void register_100g_link_ops(struct link_ops_s *ops)
61 {
62 	link_100g_ops = ops;
63 }
64 
65 const struct link_ops_s *get_100g_link_ops(void)
66 {
67 	if (link_100g_ops == NULL)
68 		link_100g_init();
69 	return link_100g_ops;
70 }
71 
72 static const struct port_ops *port_ops;
73 
74 void register_port_ops(const struct port_ops *ops)
75 {
76 	port_ops = ops;
77 }
78 
79 const struct port_ops *get_port_ops(void)
80 {
81 	if (port_ops == NULL)
82 		port_init();
83 	return port_ops;
84 }
85 
86 static const struct nt4ga_stat_ops *nt4ga_stat_ops;
87 
88 void register_nt4ga_stat_ops(const struct nt4ga_stat_ops *ops)
89 {
90 	nt4ga_stat_ops = ops;
91 }
92 
93 const struct nt4ga_stat_ops *get_nt4ga_stat_ops(void)
94 {
95 	if (nt4ga_stat_ops == NULL)
96 		nt4ga_stat_ops_init();
97 
98 	return nt4ga_stat_ops;
99 }
100 
101 static const struct adapter_ops *adapter_ops;
102 
103 void register_adapter_ops(const struct adapter_ops *ops)
104 {
105 	adapter_ops = ops;
106 }
107 
108 const struct adapter_ops *get_adapter_ops(void)
109 {
110 	if (adapter_ops == NULL)
111 		adapter_init();
112 	return adapter_ops;
113 }
114 
115 static struct clk9563_ops *clk9563_ops;
116 
117 void register_clk9563_ops(struct clk9563_ops *ops)
118 {
119 	clk9563_ops = ops;
120 }
121 
122 struct clk9563_ops *get_clk9563_ops(void)
123 {
124 	if (clk9563_ops == NULL)
125 		clk9563_ops_init();
126 	return clk9563_ops;
127 }
128 
129 static struct rst_nt200a0x_ops *rst_nt200a0x_ops;
130 
131 void register_rst_nt200a0x_ops(struct rst_nt200a0x_ops *ops)
132 {
133 	rst_nt200a0x_ops = ops;
134 }
135 
136 struct rst_nt200a0x_ops *get_rst_nt200a0x_ops(void)
137 {
138 	if (rst_nt200a0x_ops == NULL)
139 		rst_nt200a0x_ops_init();
140 	return rst_nt200a0x_ops;
141 }
142 
143 static struct rst9563_ops *rst9563_ops;
144 
145 void register_rst9563_ops(struct rst9563_ops *ops)
146 {
147 	rst9563_ops = ops;
148 }
149 
150 struct rst9563_ops *get_rst9563_ops(void)
151 {
152 	if (rst9563_ops == NULL)
153 		rst9563_ops_init();
154 	return rst9563_ops;
155 }
156 
157 static const struct flow_backend_ops *flow_backend_ops;
158 
159 void register_flow_backend_ops(const struct flow_backend_ops *ops)
160 {
161 	flow_backend_ops = ops;
162 }
163 
164 const struct flow_backend_ops *get_flow_backend_ops(void)
165 {
166 	if (flow_backend_ops == NULL)
167 		flow_backend_init();
168 
169 	return flow_backend_ops;
170 }
171 
172 static const struct profile_inline_ops *profile_inline_ops;
173 
174 void register_profile_inline_ops(const struct profile_inline_ops *ops)
175 {
176 	profile_inline_ops = ops;
177 }
178 
179 const struct profile_inline_ops *get_profile_inline_ops(void)
180 {
181 	if (profile_inline_ops == NULL)
182 		profile_inline_init();
183 
184 	return profile_inline_ops;
185 }
186 
187 static const struct flow_filter_ops *flow_filter_ops;
188 
189 void register_flow_filter_ops(const struct flow_filter_ops *ops)
190 {
191 	flow_filter_ops = ops;
192 }
193 
194 const struct flow_filter_ops *get_flow_filter_ops(void)
195 {
196 	if (flow_filter_ops == NULL)
197 		init_flow_filter();
198 
199 	return flow_filter_ops;
200 }
201 
202 static const struct rte_flow_fp_ops *dev_fp_flow_ops;
203 
204 void register_dev_fp_flow_ops(const struct rte_flow_fp_ops *ops)
205 {
206 	dev_fp_flow_ops = ops;
207 }
208 
209 const struct rte_flow_fp_ops *get_dev_fp_flow_ops(void)
210 {
211 	if (dev_fp_flow_ops == NULL)
212 		dev_fp_flow_init();
213 
214 	return dev_fp_flow_ops;
215 }
216 
217 static const struct rte_flow_ops *dev_flow_ops;
218 
219 void register_dev_flow_ops(const struct rte_flow_ops *ops)
220 {
221 	dev_flow_ops = ops;
222 }
223 
224 const struct rte_flow_ops *get_dev_flow_ops(void)
225 {
226 	if (dev_flow_ops == NULL)
227 		dev_flow_init();
228 
229 	return dev_flow_ops;
230 }
231 
232 static struct ntnic_xstats_ops *ntnic_xstats_ops;
233 
234 void register_ntnic_xstats_ops(struct ntnic_xstats_ops *ops)
235 {
236 	ntnic_xstats_ops = ops;
237 }
238 
239 struct ntnic_xstats_ops *get_ntnic_xstats_ops(void)
240 {
241 	if (ntnic_xstats_ops == NULL)
242 		ntnic_xstats_ops_init();
243 
244 	return ntnic_xstats_ops;
245 }
246