xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_ctrl.h (revision 4865edfd190c086bbe2c69aae12a8226f877b91e)
1 /*
2  * Copyright (c) 2016-2018 The Linux Foundation. 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 /**
20  * @file cdp_txrx_ctrl.h
21  * @brief Define the host data path control API functions
22  * called by the host control SW and the OS interface module
23  */
24 
25 #ifndef _CDP_TXRX_CTRL_H_
26 #define _CDP_TXRX_CTRL_H_
27 #include "cdp_txrx_handle.h"
28 #include "cdp_txrx_cmn_struct.h"
29 #include "cdp_txrx_ops.h"
30 
31 static inline int cdp_is_target_ar900b
32 	(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
33 {
34 	if (!soc || !soc->ops) {
35 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
36 				"%s: Invalid Instance:", __func__);
37 		QDF_BUG(0);
38 		return 0;
39 	}
40 
41 	if (!soc->ops->ctrl_ops ||
42 	    !soc->ops->ctrl_ops->txrx_is_target_ar900b)
43 		return 0;
44 
45 	return soc->ops->ctrl_ops->txrx_is_target_ar900b(vdev);
46 }
47 
48 
49 /* WIN */
50 static inline int
51 cdp_mempools_attach(ol_txrx_soc_handle soc, void *ctrl_pdev)
52 {
53 	if (!soc || !soc->ops) {
54 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
55 				"%s: Invalid Instance:", __func__);
56 		QDF_BUG(0);
57 		return 0;
58 	}
59 
60 	if (!soc->ops->ctrl_ops ||
61 	    !soc->ops->ctrl_ops->txrx_mempools_attach)
62 		return 0;
63 
64 	return soc->ops->ctrl_ops->txrx_mempools_attach(ctrl_pdev);
65 }
66 
67 /**
68  * @brief set filter neighbour peers
69  * @details
70  *  This defines interface function to set neighbour peer filtering.
71  *
72  * @param soc - the pointer to soc object
73  * @param pdev - the pointer physical device object
74  * @param val - the enable/disable value
75  * @return - int
76  */
77 static inline int
78 cdp_set_filter_neighbour_peers(ol_txrx_soc_handle soc,
79 	struct cdp_pdev *pdev, u_int32_t val)
80 {
81 	if (!soc || !soc->ops) {
82 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
83 				"%s: Invalid Instance:", __func__);
84 		QDF_BUG(0);
85 		return 0;
86 	}
87 
88 	if (!soc->ops->ctrl_ops ||
89 	    !soc->ops->ctrl_ops->txrx_set_filter_neighbour_peers)
90 		return 0;
91 
92 	return soc->ops->ctrl_ops->txrx_set_filter_neighbour_peers
93 			(pdev, val);
94 }
95 
96 /**
97  * @brief update the neighbour peer addresses
98  * @details
99  *  This defines interface function to update neighbour peers addresses
100  *  which needs to be filtered
101  *
102  * @param soc - the pointer to soc object
103  * @param pdev - the pointer to physical device object
104  * @param cmd - add/del entry into peer table
105  * @param macaddr - the address of neighbour peer
106  * @return - int
107  */
108 static inline int
109 cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc,
110 	struct cdp_pdev *pdev, uint32_t cmd, uint8_t *macaddr)
111 {
112 	if (!soc || !soc->ops) {
113 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
114 				"%s: Invalid Instance:", __func__);
115 		QDF_BUG(0);
116 		return 0;
117 	}
118 
119 	if (!soc->ops->ctrl_ops ||
120 	    !soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers)
121 		return 0;
122 
123 	return soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers
124 			(pdev, cmd, macaddr);
125 }
126 
127 /**
128  * @brief set the safemode of the device
129  * @details
130  *  This flag is used to bypass the encrypt and decrypt processes when send and
131  *  receive packets. It works like open AUTH mode, HW will treate all packets
132  *  as non-encrypt frames because no key installed. For rx fragmented frames,
133  *  it bypasses all the rx defragmentaion.
134  *
135  * @param vdev - the data virtual device object
136  * @param val - the safemode state
137  * @return - void
138  */
139 static inline void
140 cdp_set_safemode(ol_txrx_soc_handle soc,
141 	struct cdp_vdev *vdev, u_int32_t val)
142 {
143 	if (!soc || !soc->ops) {
144 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
145 				"%s: Invalid Instance:", __func__);
146 		QDF_BUG(0);
147 		return;
148 	}
149 
150 	if (!soc->ops->ctrl_ops ||
151 	    !soc->ops->ctrl_ops->txrx_set_safemode)
152 		return;
153 
154 	soc->ops->ctrl_ops->txrx_set_safemode(vdev, val);
155 }
156 /**
157  * @brief configure the drop unencrypted frame flag
158  * @details
159  *  Rx related. When set this flag, all the unencrypted frames
160  *  received over a secure connection will be discarded
161  *
162  * @param vdev - the data virtual device object
163  * @param val - flag
164  * @return - void
165  */
166 static inline void
167 cdp_set_drop_unenc(ol_txrx_soc_handle soc,
168 	struct cdp_vdev *vdev, u_int32_t val)
169 {
170 	if (!soc || !soc->ops) {
171 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
172 				"%s: Invalid Instance:", __func__);
173 		QDF_BUG(0);
174 		return;
175 	}
176 
177 	if (!soc->ops->ctrl_ops ||
178 	    !soc->ops->ctrl_ops->txrx_set_drop_unenc)
179 		return;
180 
181 	soc->ops->ctrl_ops->txrx_set_drop_unenc(vdev, val);
182 }
183 
184 
185 /**
186  * @brief set the Tx encapsulation type of the VDEV
187  * @details
188  *  This will be used to populate the HTT desc packet type field during Tx
189  *
190  * @param vdev - the data virtual device object
191  * @param val - the Tx encap type (htt_cmn_pkt_type)
192  * @return - void
193  */
194 static inline void
195 cdp_set_tx_encap_type(ol_txrx_soc_handle soc,
196 	struct cdp_vdev *vdev, enum htt_cmn_pkt_type val)
197 {
198 	if (!soc || !soc->ops) {
199 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
200 				"%s: Invalid Instance:", __func__);
201 		QDF_BUG(0);
202 		return;
203 	}
204 
205 	if (!soc->ops->ctrl_ops ||
206 	    !soc->ops->ctrl_ops->txrx_set_tx_encap_type)
207 		return;
208 
209 	soc->ops->ctrl_ops->txrx_set_tx_encap_type(vdev, val);
210 }
211 
212 /**
213  * @brief set the Rx decapsulation type of the VDEV
214  * @details
215  *  This will be used to configure into firmware and hardware which format to
216  *  decap all Rx packets into, for all peers under the VDEV.
217  *
218  * @param vdev - the data virtual device object
219  * @param val - the Rx decap mode (htt_cmn_pkt_type)
220  * @return - void
221  */
222 static inline void
223 cdp_set_vdev_rx_decap_type(ol_txrx_soc_handle soc,
224 	struct cdp_vdev *vdev, enum htt_cmn_pkt_type val)
225 {
226 	if (!soc || !soc->ops) {
227 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
228 				"%s: Invalid Instance:", __func__);
229 		QDF_BUG(0);
230 		return;
231 	}
232 
233 	if (!soc->ops->ctrl_ops ||
234 	    !soc->ops->ctrl_ops->txrx_set_vdev_rx_decap_type)
235 		return;
236 
237 	soc->ops->ctrl_ops->txrx_set_vdev_rx_decap_type
238 			(vdev, val);
239 }
240 
241 /**
242  * @brief get the Rx decapsulation type of the VDEV
243  *
244  * @param vdev - the data virtual device object
245  * @return - the Rx decap type (htt_cmn_pkt_type)
246  */
247 static inline enum htt_cmn_pkt_type
248 cdp_get_vdev_rx_decap_type(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
249 {
250 	if (!soc || !soc->ops) {
251 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
252 				"%s: Invalid Instance:", __func__);
253 		QDF_BUG(0);
254 		return 0;
255 	}
256 
257 	if (!soc->ops->ctrl_ops ||
258 	    !soc->ops->ctrl_ops->txrx_get_vdev_rx_decap_type)
259 		return 0;
260 
261 	return soc->ops->ctrl_ops->txrx_get_vdev_rx_decap_type(vdev);
262 }
263 
264 /**
265  * @brief set the Reo Destination ring for the pdev
266  * @details
267  *  This will be used to configure the Reo Destination ring for this pdev.
268  *
269  * @param soc - pointer to the soc
270  * @param pdev - the data physical device object
271  * @param val - the Reo destination ring index (1 to 4)
272  * @return - void
273  */
274 static inline void
275 cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc,
276 	struct cdp_pdev *pdev, enum cdp_host_reo_dest_ring val)
277 {
278 	if (!soc || !soc->ops) {
279 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
280 				"%s: Invalid Instance:", __func__);
281 		QDF_BUG(0);
282 		return;
283 	}
284 
285 	if (!soc->ops->ctrl_ops ||
286 	    !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest)
287 		return;
288 
289 	soc->ops->ctrl_ops->txrx_set_pdev_reo_dest
290 			(pdev, val);
291 }
292 
293 /**
294  * @brief get the Reo Destination ring for the pdev
295  *
296  * @param soc - pointer to the soc
297  * @param pdev - the data physical device object
298  * @return - the Reo destination ring index (1 to 4), 0 if not supported.
299  */
300 static inline enum cdp_host_reo_dest_ring
301 cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
302 {
303 	if (!soc || !soc->ops) {
304 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
305 				"%s: Invalid Instance:", __func__);
306 		QDF_BUG(0);
307 		return cdp_host_reo_dest_ring_unknown;
308 	}
309 
310 	if (!soc->ops->ctrl_ops ||
311 	    !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest)
312 		return cdp_host_reo_dest_ring_unknown;
313 
314 	return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(pdev);
315 }
316 
317 /* Is this similar to ol_txrx_peer_state_update() in MCL */
318 /**
319  * @brief Update the authorize peer object at association time
320  * @details
321  *  For the host-based implementation of rate-control, it
322  *  updates the peer/node-related parameters within rate-control
323  *  context of the peer at association.
324  *
325  * @param peer - pointer to the node's object
326  * @authorize - either to authorize or unauthorize peer
327  *
328  * @return none
329  */
330 static inline void
331 cdp_peer_authorize(ol_txrx_soc_handle soc,
332 	struct cdp_peer *peer, u_int32_t authorize)
333 {
334 	if (!soc || !soc->ops) {
335 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
336 				"%s: Invalid Instance:", __func__);
337 		QDF_BUG(0);
338 		return;
339 	}
340 
341 	if (!soc->ops->ctrl_ops ||
342 	    !soc->ops->ctrl_ops->txrx_peer_authorize)
343 		return;
344 
345 	soc->ops->ctrl_ops->txrx_peer_authorize
346 			(peer, authorize);
347 }
348 
349 static inline bool
350 cdp_set_inact_params(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
351 			u_int16_t inact_check_interval,
352 			u_int16_t inact_normal,
353 			u_int16_t inact_overload)
354 {
355 	if (!soc || !pdev || !soc->ops) {
356 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
357 				"%s: Invalid Instance:", __func__);
358 		QDF_BUG(0);
359 		return false;
360 	}
361 
362 	if (!soc->ops->ctrl_ops ||
363 	    !soc->ops->ctrl_ops->txrx_set_inact_params)
364 		return false;
365 
366 	return soc->ops->ctrl_ops->txrx_set_inact_params
367 			(pdev, inact_check_interval, inact_normal,
368 			inact_overload);
369 }
370 
371 static inline bool
372 cdp_start_inact_timer(ol_txrx_soc_handle soc,
373 	struct cdp_pdev *pdev,
374 	bool enable)
375 {
376 	if (!soc || !pdev || !soc->ops) {
377 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
378 				"%s: Invalid Instance:", __func__);
379 		QDF_BUG(0);
380 		return false;
381 	}
382 
383 	if (!soc->ops->ctrl_ops ||
384 	    !soc->ops->ctrl_ops->txrx_start_inact_timer)
385 		return false;
386 
387 	return soc->ops->ctrl_ops->txrx_start_inact_timer
388 			(pdev, enable);
389 }
390 
391 /**
392  * @brief Set the overload status of the radio
393  * @details
394  *   Set the overload status of the radio, updating the inactivity
395  *   threshold and inactivity count for each node.
396  *
397  * @param pdev - the data physical device object
398  * @param overload - whether the radio is overloaded or not
399  */
400 static inline void
401 cdp_set_overload(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
402 	bool overload)
403 {
404 	if (!soc || !pdev || !soc->ops) {
405 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
406 				"%s: Invalid Instance:", __func__);
407 		QDF_BUG(0);
408 		return;
409 	}
410 
411 	if (!soc->ops->ctrl_ops ||
412 	    !soc->ops->ctrl_ops->txrx_set_overload)
413 		return;
414 
415 	soc->ops->ctrl_ops->txrx_set_overload(pdev, overload);
416 }
417 
418 /**
419  * @brief Check the inactivity status of the peer/node
420  *
421  * @param peer - pointer to the node's object
422  * @return true if the node is inactive; otherwise return false
423  */
424 static inline bool
425 cdp_peer_is_inact(ol_txrx_soc_handle soc, void *peer)
426 {
427 	if (!soc || !peer || !soc->ops) {
428 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
429 				"%s: Invalid Instance:", __func__);
430 		QDF_BUG(0);
431 		return false;
432 	}
433 
434 	if (!soc->ops->ctrl_ops ||
435 	    !soc->ops->ctrl_ops->txrx_peer_is_inact)
436 		return false;
437 
438 	return soc->ops->ctrl_ops->txrx_peer_is_inact(peer);
439 }
440 
441 /**
442  * @brief Mark inactivity status of the peer/node
443  * @details
444  *   If it becomes active, reset inactivity count to reload value;
445  *   if the inactivity status changed, notify umac band steering.
446  *
447  * @param peer - pointer to the node's object
448  * @param inactive - whether the node is inactive or not
449  */
450 static inline void
451 cdp_mark_peer_inact(ol_txrx_soc_handle soc,
452 	void *peer,
453 	bool inactive)
454 {
455 	if (!soc || !soc->ops) {
456 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
457 				"%s: Invalid Instance:", __func__);
458 		QDF_BUG(0);
459 		return;
460 	}
461 
462 	if (!soc->ops->ctrl_ops ||
463 	    !soc->ops->ctrl_ops->txrx_mark_peer_inact)
464 		return;
465 
466 	soc->ops->ctrl_ops->txrx_mark_peer_inact
467 			(peer, inactive);
468 }
469 
470 
471 /* Should be ol_txrx_ctrl_api.h */
472 static inline void cdp_set_mesh_mode
473 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, u_int32_t val)
474 {
475 	if (!soc || !soc->ops) {
476 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
477 				"%s: Invalid Instance:", __func__);
478 		QDF_BUG(0);
479 		return;
480 	}
481 
482 	if (!soc->ops->ctrl_ops ||
483 	    !soc->ops->ctrl_ops->txrx_set_mesh_mode)
484 		return;
485 
486 	soc->ops->ctrl_ops->txrx_set_mesh_mode(vdev, val);
487 }
488 
489 /**
490  * @brief set mesh rx filter
491  * @details based on the bits enabled in the filter packets has to be dropped.
492  *
493  * @param soc - pointer to the soc
494  * @param vdev - the data virtual device object
495  * @param val - value to be set
496  * @return - void
497  */
498 static inline
499 void cdp_set_mesh_rx_filter(ol_txrx_soc_handle soc,
500 				struct cdp_vdev *vdev, uint32_t val)
501 {
502 	if (!soc || !soc->ops) {
503 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
504 				"%s: Invalid Instance:", __func__);
505 		QDF_BUG(0);
506 		return;
507 	}
508 
509 	if (!soc->ops->ctrl_ops ||
510 	    !soc->ops->ctrl_ops->txrx_set_mesh_rx_filter)
511 		return;
512 
513 	soc->ops->ctrl_ops->txrx_set_mesh_rx_filter(vdev, val);
514 }
515 
516 static inline void cdp_tx_flush_buffers
517 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
518 {
519 	if (!soc || !soc->ops) {
520 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
521 				"%s: Invalid Instance:", __func__);
522 		QDF_BUG(0);
523 		return;
524 	}
525 
526 	if (!soc->ops->ctrl_ops ||
527 	    !soc->ops->ctrl_ops->tx_flush_buffers)
528 		return;
529 
530 	soc->ops->ctrl_ops->tx_flush_buffers(vdev);
531 }
532 
533 static inline void cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc,
534 		struct cdp_vdev *vdev, enum cdp_vdev_param_type type,
535 		uint32_t val)
536 {
537 	if (!soc || !soc->ops) {
538 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
539 				"%s: Invalid Instance:", __func__);
540 		QDF_BUG(0);
541 		return;
542 	}
543 
544 	if (!soc->ops->ctrl_ops ||
545 	    !soc->ops->ctrl_ops->txrx_set_vdev_param)
546 		return;
547 
548 	soc->ops->ctrl_ops->txrx_set_vdev_param(vdev, type, val);
549 }
550 
551 static inline void
552 cdp_peer_set_nawds(ol_txrx_soc_handle soc,
553 		struct cdp_peer *peer, uint8_t value)
554 {
555 	if (!soc || !soc->ops) {
556 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
557 				"%s: Invalid Instance:", __func__);
558 		QDF_BUG(0);
559 		return;
560 	}
561 
562 	if (!soc->ops->ctrl_ops ||
563 	    !soc->ops->ctrl_ops->txrx_peer_set_nawds)
564 		return;
565 
566 	soc->ops->ctrl_ops->txrx_peer_set_nawds
567 			(peer, value);
568 }
569 
570 static inline void cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
571 		struct cdp_pdev *pdev, enum cdp_pdev_param_type type,
572 		uint8_t val)
573 {
574 	if (!soc || !soc->ops) {
575 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
576 				"%s: Invalid Instance:", __func__);
577 		QDF_BUG(0);
578 		return;
579 	}
580 
581 	if (!soc->ops->ctrl_ops ||
582 	    !soc->ops->ctrl_ops->txrx_set_pdev_param)
583 		return;
584 
585 	soc->ops->ctrl_ops->txrx_set_pdev_param
586 			(pdev, type, val);
587 }
588 
589 /**
590  * @brief Subscribe to a specified WDI event.
591  * @details
592  *  This function adds the provided wdi_event_subscribe object to a list of
593  *  subscribers for the specified WDI event.
594  *  When the event in question happens, each subscriber for the event will
595  *  have their callback function invoked.
596  *  The order in which callback functions from multiple subscribers are
597  *  invoked is unspecified.
598  *
599  * @param soc - pointer to the soc
600  * @param pdev - the data physical device object
601  * @param event_cb_sub - the callback and context for the event subscriber
602  * @param event - which event's notifications are being subscribed to
603  * @return - int
604  */
605 static inline int
606 cdp_wdi_event_sub(ol_txrx_soc_handle soc,
607 		struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
608 {
609 
610 	if (!soc || !soc->ops) {
611 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
612 			"%s invalid instance", __func__);
613 		QDF_BUG(0);
614 		return 0;
615 	}
616 
617 	if (!soc->ops->ctrl_ops ||
618 	    !soc->ops->ctrl_ops->txrx_wdi_event_sub)
619 		return 0;
620 
621 	return soc->ops->ctrl_ops->txrx_wdi_event_sub
622 			(pdev, event_cb_sub, event);
623 }
624 
625 /**
626  * @brief Unsubscribe from a specified WDI event.
627  * @details
628  *  This function removes the provided event subscription object from the
629  *  list of subscribers for its event.
630  *  This function shall only be called if there was a successful prior call
631  *  to event_sub() on the same wdi_event_subscribe object.
632  *
633  * @param soc - pointer to the soc
634  * @param pdev - the data physical device object
635  * @param event_cb_sub - the callback and context for the event subscriber
636  * @param event - which event's notifications are being subscribed to
637  * @return - int
638  */
639 static inline int
640 cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
641 		struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
642 {
643 
644 	if (!soc || !soc->ops) {
645 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
646 			"%s invalid instance", __func__);
647 		QDF_BUG(0);
648 		return 0;
649 	}
650 
651 	if (!soc->ops->ctrl_ops ||
652 	    !soc->ops->ctrl_ops->txrx_wdi_event_unsub)
653 		return 0;
654 
655 	return soc->ops->ctrl_ops->txrx_wdi_event_unsub
656 			(pdev, event_cb_sub, event);
657 }
658 
659 /**
660  * @brief Get security type from the from peer.
661  * @details
662  * This function gets the Security information from the peer handler.
663  * The security information is got from the rx descriptor and filled in
664  * to the peer handler.
665  *
666  * @param soc - pointer to the soc
667  * @param peer - peer handler
668  * @param sec_idx - mcast or ucast frame type.
669  * @return - int
670  */
671 static inline int
672 cdp_get_sec_type(ol_txrx_soc_handle soc, struct cdp_peer *peer, uint8_t sec_idx)
673 {
674 	if (!soc || !soc->ops) {
675 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
676 			"%s invalid instance", __func__);
677 		QDF_BUG(0);
678 		return A_ERROR;
679 	}
680 
681 	if (!soc->ops->ctrl_ops ||
682 	    !soc->ops->ctrl_ops->txrx_get_sec_type)
683 		return A_ERROR;
684 
685 	return soc->ops->ctrl_ops->txrx_get_sec_type
686 			(peer, sec_idx);
687 }
688 
689 /**
690   * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames
691   * @vdev_handle: vdev handle
692   * @subtype_index: subtype
693   * @tx_power: Tx power
694   * Return: None
695   */
696 static inline int cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
697 	struct cdp_vdev *vdev, uint8_t subtype, uint8_t tx_power)
698 {
699 	if (!soc || !soc->ops) {
700 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
701 				"%s: Invalid Instance:", __func__);
702 		QDF_BUG(0);
703 		return 0;
704 	}
705 
706 	if (!soc->ops->ctrl_ops ||
707 	    !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev)
708 		return 0;
709 
710 	soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(vdev,
711 							subtype, tx_power);
712 	return 0;
713 }
714 
715 static inline void *
716 cdp_get_pldev(ol_txrx_soc_handle soc,
717 		struct cdp_pdev *pdev)
718 {
719 	if (!soc || !soc->ops) {
720 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
721 			"%s invalid instance", __func__);
722 		QDF_BUG(0);
723 		return NULL;
724 	}
725 
726 	if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev)
727 		return NULL;
728 
729 	return soc->ops->ctrl_ops->txrx_get_pldev(pdev);
730 }
731 
732 #ifdef ATH_SUPPORT_NAC_RSSI
733 /**
734   * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config
735   * @soc: soc pointer
736   * @vdev: vdev pointer
737   * @nac_cmd: specfies nac_rss config action add, del, list
738   * @bssid: Neighbour bssid
739   * @client_macaddr: Non-Associated client MAC
740   * @chan_num: channel number to scan
741   *
742   * Return: QDF_STATUS
743   */
744 static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
745 		struct cdp_vdev *vdev, enum cdp_nac_param_cmd nac_cmd,
746 		char *bssid, char *client_macaddr, uint8_t chan_num)
747 {
748 	if (!soc || !soc->ops) {
749 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
750 			"%s invalid instance", __func__);
751 		QDF_BUG(0);
752 		return QDF_STATUS_E_FAILURE;
753 	}
754 
755 	if (!soc->ops->ctrl_ops ||
756 			!soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi)
757 		return QDF_STATUS_E_FAILURE;
758 
759 	return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(vdev,
760 			nac_cmd, bssid, client_macaddr, chan_num);
761 }
762 #endif
763 #endif
764