xref: /wlan-driver/qca-wifi-host-cmn/target_if/mgmt_txrx/src/target_if_mgmt_txrx.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for any
5*5113495bSYour Name  * purpose with or without fee is hereby granted, provided that the above
6*5113495bSYour Name  * copyright notice and this permission notice appear in all copies.
7*5113495bSYour Name  *
8*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*5113495bSYour Name  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*5113495bSYour Name  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*5113495bSYour Name  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*5113495bSYour Name  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*5113495bSYour Name  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*5113495bSYour Name  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*5113495bSYour Name  */
16*5113495bSYour Name 
17*5113495bSYour Name /**
18*5113495bSYour Name  *  DOC: target_if_mgmt_txrx.c
19*5113495bSYour Name  *  This file contains mgmt txrx module's target related function definitions
20*5113495bSYour Name  */
21*5113495bSYour Name 
22*5113495bSYour Name #include <target_if_mgmt_txrx.h>
23*5113495bSYour Name #include <target_if_mgmt_txrx_rx_reo.h>
24*5113495bSYour Name 
25*5113495bSYour Name /**
26*5113495bSYour Name  * target_if_mgmt_txrx_unregister_event_handler() - Unregister event handlers
27*5113495bSYour Name  * for mgmt txrx module
28*5113495bSYour Name  * @psoc: pointer to psoc
29*5113495bSYour Name  *
30*5113495bSYour Name  * Unregister event handlers for management rx-reorder module
31*5113495bSYour Name  *
32*5113495bSYour Name  * return: QDF_STATUS
33*5113495bSYour Name  */
34*5113495bSYour Name static QDF_STATUS
target_if_mgmt_txrx_unregister_event_handler(struct wlan_objmgr_psoc * psoc)35*5113495bSYour Name target_if_mgmt_txrx_unregister_event_handler(struct wlan_objmgr_psoc *psoc)
36*5113495bSYour Name {
37*5113495bSYour Name 	QDF_STATUS status;
38*5113495bSYour Name 
39*5113495bSYour Name 	if (!psoc) {
40*5113495bSYour Name 		mgmt_txrx_err("psoc is null");
41*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
42*5113495bSYour Name 	}
43*5113495bSYour Name 
44*5113495bSYour Name 	status = target_if_mgmt_rx_reo_unregister_event_handlers(psoc);
45*5113495bSYour Name 	if (QDF_IS_STATUS_ERROR(status)) {
46*5113495bSYour Name 		mgmt_txrx_err("Failed to unregister mgmt rx reo events");
47*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
48*5113495bSYour Name 	}
49*5113495bSYour Name 
50*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
51*5113495bSYour Name }
52*5113495bSYour Name 
53*5113495bSYour Name /**
54*5113495bSYour Name  * target_if_mgmt_txrx_register_event_handler() - Register event handlers for
55*5113495bSYour Name  * mgmt txrx module
56*5113495bSYour Name  * @psoc: pointer to psoc
57*5113495bSYour Name  *
58*5113495bSYour Name  * Register event handlers for management rx-reorder module
59*5113495bSYour Name  *
60*5113495bSYour Name  * return: QDF_STATUS
61*5113495bSYour Name  */
62*5113495bSYour Name static QDF_STATUS
target_if_mgmt_txrx_register_event_handler(struct wlan_objmgr_psoc * psoc)63*5113495bSYour Name target_if_mgmt_txrx_register_event_handler(struct wlan_objmgr_psoc *psoc)
64*5113495bSYour Name {
65*5113495bSYour Name 	QDF_STATUS status;
66*5113495bSYour Name 
67*5113495bSYour Name 	status = target_if_mgmt_rx_reo_register_event_handlers(psoc);
68*5113495bSYour Name 	if (QDF_IS_STATUS_ERROR(status)) {
69*5113495bSYour Name 		mgmt_txrx_err("Failed to register mgmt rx reo events");
70*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
71*5113495bSYour Name 	}
72*5113495bSYour Name 
73*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
74*5113495bSYour Name }
75*5113495bSYour Name 
76*5113495bSYour Name QDF_STATUS
target_if_mgmt_txrx_tx_ops_register(struct wlan_lmac_if_tx_ops * tx_ops)77*5113495bSYour Name target_if_mgmt_txrx_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
78*5113495bSYour Name {
79*5113495bSYour Name 	struct wlan_lmac_if_mgmt_txrx_tx_ops *mgmt_txrx_tx_ops;
80*5113495bSYour Name 	QDF_STATUS status;
81*5113495bSYour Name 
82*5113495bSYour Name 	if (!tx_ops) {
83*5113495bSYour Name 		mgmt_txrx_err("txops is NULL");
84*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
85*5113495bSYour Name 	}
86*5113495bSYour Name 
87*5113495bSYour Name 	mgmt_txrx_tx_ops = &tx_ops->mgmt_txrx_tx_ops;
88*5113495bSYour Name 	mgmt_txrx_tx_ops->reg_ev_handler =
89*5113495bSYour Name 		target_if_mgmt_txrx_register_event_handler;
90*5113495bSYour Name 	mgmt_txrx_tx_ops->unreg_ev_handler =
91*5113495bSYour Name 		target_if_mgmt_txrx_unregister_event_handler;
92*5113495bSYour Name 
93*5113495bSYour Name 	status = target_if_mgmt_rx_reo_tx_ops_register(mgmt_txrx_tx_ops);
94*5113495bSYour Name 	if (QDF_IS_STATUS_ERROR(status)) {
95*5113495bSYour Name 		mgmt_txrx_err("Failed to register mgmt Rx REO tx ops");
96*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
97*5113495bSYour Name 	}
98*5113495bSYour Name 
99*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
100*5113495bSYour Name }
101