xref: /wlan-driver/qcacld-3.0/components/pmo/dispatcher/src/wlan_pmo_tgt_static_config.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2018, 2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
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 /**
21  * DOC: Implements public API for pmo to interact with target/WMI
22  */
23 
24 #include "wlan_pmo_tgt_api.h"
25 #include "wlan_pmo_wow.h"
26 #include "wlan_pmo_obj_mgmt_public_struct.h"
27 #include "wlan_pmo_main.h"
28 
pmo_tgt_send_enhance_multicast_offload_req(struct wlan_objmgr_vdev * vdev,uint8_t action)29 QDF_STATUS pmo_tgt_send_enhance_multicast_offload_req(
30 	struct wlan_objmgr_vdev *vdev,
31 	uint8_t action)
32 {
33 	QDF_STATUS status;
34 	struct wlan_objmgr_psoc *psoc;
35 	struct wlan_pmo_tx_ops pmo_tx_ops;
36 
37 	psoc = pmo_vdev_get_psoc(vdev);
38 
39 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
40 	if (!pmo_tx_ops.send_enhance_mc_offload_req) {
41 		pmo_err("send_enhance_multicast_offload is null");
42 		status = QDF_STATUS_E_NULL_VALUE;
43 		goto out;
44 	}
45 
46 	status = pmo_tx_ops.send_enhance_mc_offload_req(vdev, action);
47 	if (status != QDF_STATUS_SUCCESS)
48 		pmo_err("Failed to config enhance multicast offload");
49 out:
50 
51 	return status;
52 }
53 
pmo_tgt_send_ra_filter_req(struct wlan_objmgr_vdev * vdev)54 QDF_STATUS pmo_tgt_send_ra_filter_req(struct wlan_objmgr_vdev *vdev)
55 {
56 
57 	QDF_STATUS status;
58 	uint8_t default_pattern;
59 	uint16_t ra_interval;
60 	struct pmo_vdev_priv_obj *vdev_ctx;
61 	uint8_t vdev_id;
62 	struct wlan_objmgr_psoc *psoc;
63 	struct wlan_pmo_tx_ops pmo_tx_ops;
64 
65 	pmo_enter();
66 
67 	psoc = pmo_vdev_get_psoc(vdev);
68 
69 	vdev_ctx = pmo_vdev_get_priv(vdev);
70 
71 	vdev_id = pmo_vdev_get_id(vdev);
72 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
73 	ra_interval = vdev_ctx->pmo_psoc_ctx->psoc_cfg.ra_ratelimit_interval;
74 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
75 
76 	pmo_debug("send RA rate limit [%d] to fw vdev = %d",
77 		 ra_interval, vdev_id);
78 
79 	default_pattern = pmo_get_and_increment_wow_default_ptrn(vdev_ctx);
80 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
81 	if (!pmo_tx_ops.send_ra_filter_req) {
82 		pmo_err("send_ra_filter_cmd is null");
83 		status = QDF_STATUS_E_INVAL;
84 		goto out;
85 	}
86 
87 	status = pmo_tx_ops.send_ra_filter_req(
88 			vdev, default_pattern, ra_interval);
89 	if (status != QDF_STATUS_SUCCESS) {
90 		pmo_err("Failed to send RA rate limit to fw");
91 		pmo_decrement_wow_default_ptrn(vdev_ctx);
92 	}
93 out:
94 	pmo_exit();
95 
96 	return status;
97 }
98 
pmo_tgt_send_action_frame_pattern_req(struct wlan_objmgr_vdev * vdev,struct pmo_action_wakeup_set_params * cmd)99 QDF_STATUS pmo_tgt_send_action_frame_pattern_req(
100 		struct wlan_objmgr_vdev *vdev,
101 		struct pmo_action_wakeup_set_params *cmd)
102 {
103 	QDF_STATUS status;
104 	struct wlan_objmgr_psoc *psoc;
105 	struct wlan_pmo_tx_ops pmo_tx_ops;
106 
107 	psoc = pmo_vdev_get_psoc(vdev);
108 
109 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
110 	if (!pmo_tx_ops.send_action_frame_pattern_req) {
111 		pmo_err("send_add_action_frame_pattern_cmd is null");
112 		status = QDF_STATUS_E_NULL_VALUE;
113 		goto out;
114 	}
115 
116 	status = pmo_tx_ops.send_action_frame_pattern_req(vdev, cmd);
117 	if (status != QDF_STATUS_SUCCESS)
118 		pmo_err("Failed to add  filter");
119 out:
120 	return status;
121 }
122 
123