xref: /wlan-driver/qcacld-3.0/components/pmo/dispatcher/src/wlan_pmo_tgt_lphb.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name /**
20*5113495bSYour Name  * DOC: Implements public API for pmo low power hear beat feature
21*5113495bSYour Name  * to interact with target/WMI.
22*5113495bSYour Name  */
23*5113495bSYour Name 
24*5113495bSYour Name #include "wlan_pmo_tgt_api.h"
25*5113495bSYour Name #include "wlan_pmo_lphb_public_struct.h"
26*5113495bSYour Name #include "wlan_pmo_obj_mgmt_public_struct.h"
27*5113495bSYour Name #include "wlan_pmo_main.h"
28*5113495bSYour Name 
pmo_tgt_send_lphb_enable(struct wlan_objmgr_psoc * psoc,struct pmo_lphb_enable_req * ts_lphb_enable)29*5113495bSYour Name QDF_STATUS pmo_tgt_send_lphb_enable(struct wlan_objmgr_psoc *psoc,
30*5113495bSYour Name 		struct pmo_lphb_enable_req *ts_lphb_enable)
31*5113495bSYour Name {
32*5113495bSYour Name 	QDF_STATUS status;
33*5113495bSYour Name 	struct wlan_pmo_tx_ops pmo_tx_ops;
34*5113495bSYour Name 
35*5113495bSYour Name 	pmo_enter();
36*5113495bSYour Name 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
37*5113495bSYour Name 	if (!pmo_tx_ops.send_lphb_enable) {
38*5113495bSYour Name 		pmo_err("send_lphb_enable is null");
39*5113495bSYour Name 		status = QDF_STATUS_E_NULL_VALUE;
40*5113495bSYour Name 		goto out;
41*5113495bSYour Name 	}
42*5113495bSYour Name 	status = pmo_tx_ops.send_lphb_enable(psoc, ts_lphb_enable);
43*5113495bSYour Name 	if (status != QDF_STATUS_SUCCESS)
44*5113495bSYour Name 		pmo_err("Failed to send lphb enable");
45*5113495bSYour Name out:
46*5113495bSYour Name 	pmo_exit();
47*5113495bSYour Name 
48*5113495bSYour Name 	return status;
49*5113495bSYour Name }
50*5113495bSYour Name 
pmo_tgt_send_lphb_tcp_params(struct wlan_objmgr_psoc * psoc,struct pmo_lphb_tcp_params * ts_lphb_tcp_param)51*5113495bSYour Name QDF_STATUS pmo_tgt_send_lphb_tcp_params(struct wlan_objmgr_psoc *psoc,
52*5113495bSYour Name 		struct pmo_lphb_tcp_params *ts_lphb_tcp_param)
53*5113495bSYour Name {
54*5113495bSYour Name 	QDF_STATUS status;
55*5113495bSYour Name 	struct wlan_pmo_tx_ops pmo_tx_ops;
56*5113495bSYour Name 
57*5113495bSYour Name 	pmo_enter();
58*5113495bSYour Name 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
59*5113495bSYour Name 	if (!pmo_tx_ops.send_lphb_tcp_params) {
60*5113495bSYour Name 		pmo_err("send_lphb_tcp_params is null");
61*5113495bSYour Name 		status = QDF_STATUS_E_NULL_VALUE;
62*5113495bSYour Name 		goto out;
63*5113495bSYour Name 	}
64*5113495bSYour Name 	status = pmo_tx_ops.send_lphb_tcp_params(psoc, ts_lphb_tcp_param);
65*5113495bSYour Name 	if (status != QDF_STATUS_SUCCESS)
66*5113495bSYour Name 		pmo_err("Failed to send lphb tcp params");
67*5113495bSYour Name out:
68*5113495bSYour Name 	pmo_exit();
69*5113495bSYour Name 
70*5113495bSYour Name 	return status;
71*5113495bSYour Name }
72*5113495bSYour Name 
pmo_tgt_send_lphb_tcp_pkt_filter(struct wlan_objmgr_psoc * psoc,struct pmo_lphb_tcp_filter_req * ts_lphb_tcp_filter)73*5113495bSYour Name QDF_STATUS pmo_tgt_send_lphb_tcp_pkt_filter(struct wlan_objmgr_psoc *psoc,
74*5113495bSYour Name 		struct pmo_lphb_tcp_filter_req *ts_lphb_tcp_filter)
75*5113495bSYour Name {
76*5113495bSYour Name 	QDF_STATUS status;
77*5113495bSYour Name 	struct wlan_pmo_tx_ops pmo_tx_ops;
78*5113495bSYour Name 
79*5113495bSYour Name 	pmo_enter();
80*5113495bSYour Name 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
81*5113495bSYour Name 	if (!pmo_tx_ops.send_lphb_tcp_filter_req) {
82*5113495bSYour Name 		pmo_err("send_lphb_tcp_filter_req is null");
83*5113495bSYour Name 		status = QDF_STATUS_E_NULL_VALUE;
84*5113495bSYour Name 		goto out;
85*5113495bSYour Name 	}
86*5113495bSYour Name 	status = pmo_tx_ops.send_lphb_tcp_filter_req(psoc, ts_lphb_tcp_filter);
87*5113495bSYour Name 	if (status != QDF_STATUS_SUCCESS)
88*5113495bSYour Name 		pmo_err("Failed to send lphb tcp filter req");
89*5113495bSYour Name out:
90*5113495bSYour Name 	pmo_exit();
91*5113495bSYour Name 
92*5113495bSYour Name 	return status;
93*5113495bSYour Name }
94*5113495bSYour Name 
pmo_tgt_send_lphb_udp_params(struct wlan_objmgr_psoc * psoc,struct pmo_lphb_udp_params * ts_lphb_udp_param)95*5113495bSYour Name QDF_STATUS pmo_tgt_send_lphb_udp_params(struct wlan_objmgr_psoc *psoc,
96*5113495bSYour Name 		struct pmo_lphb_udp_params *ts_lphb_udp_param)
97*5113495bSYour Name {
98*5113495bSYour Name 	QDF_STATUS status;
99*5113495bSYour Name 	struct wlan_pmo_tx_ops pmo_tx_ops;
100*5113495bSYour Name 
101*5113495bSYour Name 	pmo_enter();
102*5113495bSYour Name 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
103*5113495bSYour Name 	if (!pmo_tx_ops.send_lphb_upd_params) {
104*5113495bSYour Name 		pmo_err("send_lphb_upd_params is null");
105*5113495bSYour Name 		status = QDF_STATUS_E_NULL_VALUE;
106*5113495bSYour Name 		goto out;
107*5113495bSYour Name 	}
108*5113495bSYour Name 	status = pmo_tx_ops.send_lphb_upd_params(psoc, ts_lphb_udp_param);
109*5113495bSYour Name 	if (status != QDF_STATUS_SUCCESS)
110*5113495bSYour Name 		pmo_err("Failed to send lphb udp param");
111*5113495bSYour Name out:
112*5113495bSYour Name 	pmo_exit();
113*5113495bSYour Name 
114*5113495bSYour Name 	return status;
115*5113495bSYour Name }
116*5113495bSYour Name 
pmo_tgt_send_lphb_udp_pkt_filter(struct wlan_objmgr_psoc * psoc,struct pmo_lphb_udp_filter_req * ts_lphb_udp_filter)117*5113495bSYour Name QDF_STATUS pmo_tgt_send_lphb_udp_pkt_filter(struct wlan_objmgr_psoc *psoc,
118*5113495bSYour Name 		struct pmo_lphb_udp_filter_req *ts_lphb_udp_filter)
119*5113495bSYour Name {
120*5113495bSYour Name 	QDF_STATUS status;
121*5113495bSYour Name 	struct wlan_pmo_tx_ops pmo_tx_ops;
122*5113495bSYour Name 
123*5113495bSYour Name 	pmo_enter();
124*5113495bSYour Name 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
125*5113495bSYour Name 	if (!pmo_tx_ops.send_lphb_udp_filter_req) {
126*5113495bSYour Name 		pmo_err("send_lphb_udp_filter_req is null");
127*5113495bSYour Name 		status = QDF_STATUS_E_NULL_VALUE;
128*5113495bSYour Name 		goto out;
129*5113495bSYour Name 	}
130*5113495bSYour Name 	status = pmo_tx_ops.send_lphb_udp_filter_req(psoc, ts_lphb_udp_filter);
131*5113495bSYour Name 	if (status != QDF_STATUS_SUCCESS)
132*5113495bSYour Name 		pmo_err("Failed to send lphb udp filter req");
133*5113495bSYour Name out:
134*5113495bSYour Name 	pmo_exit();
135*5113495bSYour Name 
136*5113495bSYour Name 	return status;
137*5113495bSYour Name }
138*5113495bSYour Name 
pmo_tgt_lphb_rsp_evt(struct wlan_objmgr_psoc * psoc,struct pmo_lphb_rsp * rsp_param)139*5113495bSYour Name QDF_STATUS pmo_tgt_lphb_rsp_evt(struct wlan_objmgr_psoc *psoc,
140*5113495bSYour Name 			struct pmo_lphb_rsp *rsp_param)
141*5113495bSYour Name {
142*5113495bSYour Name 	struct pmo_psoc_priv_obj *psoc_ctx;
143*5113495bSYour Name 
144*5113495bSYour Name 	psoc_ctx = pmo_psoc_get_priv(psoc);
145*5113495bSYour Name 	if (psoc_ctx->wow.lphb_cb && psoc_ctx->wow.lphb_cb_ctx) {
146*5113495bSYour Name 		psoc_ctx->wow.lphb_cb(psoc_ctx->wow.lphb_cb_ctx, rsp_param);
147*5113495bSYour Name 	} else {
148*5113495bSYour Name 		pmo_err("lphb rsp callback/context is null for psoc %pK",
149*5113495bSYour Name 			psoc);
150*5113495bSYour Name 	}
151*5113495bSYour Name 
152*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
153*5113495bSYour Name }
154*5113495bSYour Name 
155