xref: /wlan-dirver/qca-wifi-host-cmn/target_if/son/src/target_if_son.c (revision eb134979c1cacbd1eb12caa116020b86fad96e1c)
1 /*
2  * Copyright (c) 2017-2020 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 <target_if_son.h>
21 #include <target_if.h>
22 #include <wlan_lmac_if_def.h>
23 #include <wmi_unified_api.h>
24 #include <cdp_txrx_ctrl.h>
25 
26 #if QCA_SUPPORT_SON
27 
28 u_int32_t son_ol_get_peer_rate(struct wlan_objmgr_peer *peer, u_int8_t type)
29 {
30 	return ol_if_peer_get_rate(peer, type);
31 }
32 
33 QDF_STATUS son_ol_send_null(struct wlan_objmgr_pdev *pdev,
34 			 u_int8_t *macaddr,
35 			 struct wlan_objmgr_vdev *vdev)
36 {
37 	struct stats_request_params param = {0};
38 	struct wlan_objmgr_psoc *psoc = NULL;
39 	wmi_unified_t wmi_handle;
40 
41 	psoc = wlan_pdev_get_psoc(pdev);
42 	if (!psoc)
43 		return QDF_STATUS_E_FAILURE;
44 
45 	param.vdev_id = wlan_vdev_get_id(vdev);
46 	param.stats_id = WMI_HOST_REQUEST_INST_STAT;
47 
48 	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
49 	if (!wmi_handle)
50 		return QDF_STATUS_E_FAILURE;
51 
52 	return wmi_unified_stats_request_send(wmi_handle, macaddr, &param);
53 }
54 
55 void target_if_son_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
56 {
57 	/* wlan son related function handler */
58 	tx_ops->son_tx_ops.son_send_null = son_ol_send_null;
59 	tx_ops->son_tx_ops.get_peer_rate = son_ol_get_peer_rate;
60 	return;
61 }
62 
63 #else
64 
65 u_int32_t son_ol_get_peer_rate(struct wlan_objmgr_peer *peer, u_int8_t type)
66 {
67 	return 0;
68 }
69 
70 void target_if_son_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
71 {
72 	return;
73 }
74 
75 QDF_STATUS son_ol_send_null(struct wlan_objmgr_pdev *pdev,
76 			    u_int8_t *macaddr,
77 			    struct wlan_objmgr_vdev *vdev)
78 {
79 	return QDF_STATUS_SUCCESS;
80 }
81 
82 #endif
83