xref: /wlan-dirver/qca-wifi-host-cmn/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c (revision 99a10d078d8c08bacd095650c5bfcdcef8f8bf20)
1 /*
2  * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
3  *
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 #include "qdf_mem.h"
21 #include "wlan_lmac_if_def.h"
22 #include "wlan_lmac_if_api.h"
23 #include "wlan_mgmt_txrx_tgt_api.h"
24 #include "wlan_scan_tgt_api.h"
25 
26 /* Function pointer for OL/WMA specific UMAC tx_ops
27  * registration.
28  */
29 QDF_STATUS (*wlan_lmac_if_umac_tx_ops_register)
30 				(struct wlan_lmac_if_tx_ops *tx_ops);
31 EXPORT_SYMBOL(wlan_lmac_if_umac_tx_ops_register);
32 
33 /**
34  * wlan_lmac_if_umac_rx_ops_register() - UMAC rx handler register
35  * @rx_ops: Pointer to rx_ops structure to be populated
36  *
37  * Register umac RX callabacks which will be called by DA/OL/WMA/WMI
38  *
39  * Return: QDF_STATUS_SUCCESS - in case of success
40  */
41 QDF_STATUS
42 wlan_lmac_if_umac_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
43 {
44 	/* Component specific public api's to be called to register
45 	 * respective callbacks
46 	 * Ex: rx_ops->fp = function;
47 	 */
48 	struct wlan_lmac_if_mgmt_txrx_rx_ops *mgmt_txrx_rx_ops;
49 
50 	if (!rx_ops) {
51 		qdf_print("%s: lmac if rx ops pointer is NULL", __func__);
52 		return QDF_STATUS_E_INVAL;
53 	}
54 
55 	/* mgmt txrx rx ops */
56 	mgmt_txrx_rx_ops = &rx_ops->mgmt_txrx_rx_ops;
57 
58 	mgmt_txrx_rx_ops->mgmt_tx_completion_handler =
59 			tgt_mgmt_txrx_tx_completion_handler;
60 	mgmt_txrx_rx_ops->mgmt_rx_frame_handler =
61 			tgt_mgmt_txrx_rx_frame_handler;
62 	mgmt_txrx_rx_ops->mgmt_txrx_get_nbuf_from_desc_id =
63 			tgt_mgmt_txrx_get_nbuf_from_desc_id;
64 	mgmt_txrx_rx_ops->mgmt_txrx_get_peer_from_desc_id =
65 			tgt_mgmt_txrx_get_peer_from_desc_id;
66 	mgmt_txrx_rx_ops->mgmt_txrx_get_vdev_id_from_desc_id =
67 			tgt_mgmt_txrx_get_vdev_id_from_desc_id;
68 	/* scan rx ops */
69 	rx_ops->scan.scan_ev_handler = tgt_scan_event_handler;
70 
71 	return QDF_STATUS_SUCCESS;
72 }
73 
74 /**
75  * wlan_lmac_if_set_umac_txops_registration_cb() - tx registration
76  * callback assignment
77  * @dev_type: Dev type can be either Direct attach or Offload
78  * @handler: handler to be called for LMAC tx ops registration
79  *
80  * API to assign appropriate tx registration callback handler based on the
81  * device type(Offload or Direct attach)
82  *
83  * Return: QDF_STATUS_SUCCESS - in case of success
84  */
85 QDF_STATUS wlan_lmac_if_set_umac_txops_registration_cb(QDF_STATUS (*handler)
86 				(struct wlan_lmac_if_tx_ops *))
87 {
88 	wlan_lmac_if_umac_tx_ops_register = handler;
89 	return QDF_STATUS_SUCCESS;
90 }
91 EXPORT_SYMBOL(wlan_lmac_if_set_umac_txops_registration_cb);
92 
93