1 /*
2  * Copyright (c) 2017-2021 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  * DOC: Target interface file for pmo component to
21  * Implement api's which shall be used by pmo component
22  * in target if internally.
23  */
24 
25 #include "target_if_pmo.h"
26 #include "wlan_pmo_common_public_struct.h"
27 #include "wlan_pmo_icmp.h"
28 
29 #ifdef WLAN_FEATURE_PACKET_FILTERING
30 static inline
tgt_if_pmo_reg_pkt_filter_ops(struct wlan_pmo_tx_ops * pmo_tx_ops)31 void tgt_if_pmo_reg_pkt_filter_ops(struct wlan_pmo_tx_ops *pmo_tx_ops)
32 {
33 	pmo_tx_ops->send_set_pkt_filter =
34 		target_if_pmo_send_pkt_filter_req;
35 	pmo_tx_ops->send_clear_pkt_filter =
36 		target_if_pmo_clear_pkt_filter_req;
37 }
38 #else
39 static inline void
tgt_if_pmo_reg_pkt_filter_ops(struct wlan_pmo_tx_ops * pmo_tx_ops)40 tgt_if_pmo_reg_pkt_filter_ops(struct wlan_pmo_tx_ops *pmo_tx_ops)
41 {
42 }
43 #endif
44 #ifdef WLAN_FEATURE_IGMP_OFFLOAD
45 static void
update_pmo_igmp_tx_ops(struct wlan_pmo_tx_ops * pmo_tx_ops)46 update_pmo_igmp_tx_ops(struct wlan_pmo_tx_ops *pmo_tx_ops)
47 {
48 	pmo_tx_ops->send_igmp_offload_req =
49 		target_if_pmo_send_igmp_offload_req;
50 }
51 #else
52 static inline void
update_pmo_igmp_tx_ops(struct wlan_pmo_tx_ops * pmo_tx_ops)53 update_pmo_igmp_tx_ops(struct wlan_pmo_tx_ops *pmo_tx_ops)
54 {}
55 #endif
56 #ifdef WLAN_FEATURE_ICMP_OFFLOAD
tgt_if_pmo_icmp_tx_ops(struct wlan_pmo_tx_ops * pmo_tx_ops)57 static void tgt_if_pmo_icmp_tx_ops(struct wlan_pmo_tx_ops *pmo_tx_ops)
58 {
59 	pmo_tx_ops->send_icmp_offload_req =
60 		target_if_pmo_send_icmp_offload_req;
61 }
62 #else
63 static inline void
tgt_if_pmo_icmp_tx_ops(struct wlan_pmo_tx_ops * pmo_tx_ops)64 tgt_if_pmo_icmp_tx_ops(struct wlan_pmo_tx_ops *pmo_tx_ops)
65 {}
66 #endif
target_if_pmo_register_tx_ops(struct wlan_pmo_tx_ops * pmo_tx_ops)67 void target_if_pmo_register_tx_ops(struct wlan_pmo_tx_ops *pmo_tx_ops)
68 {
69 	if (!pmo_tx_ops) {
70 		target_if_err("pmo_tx_ops is null");
71 		return;
72 	}
73 
74 	pmo_tx_ops->send_arp_offload_req =
75 		target_if_pmo_send_arp_offload_req;
76 	pmo_tx_ops->send_conf_hw_filter_req =
77 		target_if_pmo_conf_hw_filter;
78 	pmo_tx_ops->send_ns_offload_req =
79 		target_if_pmo_send_ns_offload_req;
80 	pmo_tx_ops->send_enable_wow_wakeup_event_req =
81 		target_if_pmo_enable_wow_wakeup_event;
82 	pmo_tx_ops->send_disable_wow_wakeup_event_req =
83 		target_if_pmo_disable_wow_wakeup_event;
84 	pmo_tx_ops->send_add_wow_pattern =
85 		target_if_pmo_send_wow_patterns_to_fw;
86 	pmo_tx_ops->del_wow_pattern =
87 		target_if_pmo_del_wow_patterns_to_fw;
88 	pmo_tx_ops->send_enhance_mc_offload_req =
89 		target_if_pmo_send_enhance_mc_offload_req;
90 	pmo_tx_ops->send_set_mc_filter_req =
91 		target_if_pmo_set_mc_filter_req;
92 	pmo_tx_ops->send_clear_mc_filter_req =
93 		target_if_pmo_clear_mc_filter_req;
94 	pmo_tx_ops->get_multiple_mc_filter_support =
95 		target_if_pmo_get_multiple_mc_filter_support;
96 	pmo_tx_ops->send_set_multiple_mc_filter_req =
97 		target_if_pmo_set_multiple_mc_filter_req;
98 	pmo_tx_ops->send_clear_multiple_mc_filter_req =
99 		target_if_pmo_clear_multiple_mc_filter_req;
100 	pmo_tx_ops->send_ra_filter_req =
101 		target_if_pmo_send_ra_filter_req;
102 	pmo_tx_ops->send_gtk_offload_req =
103 		target_if_pmo_send_gtk_offload_req;
104 	pmo_tx_ops->send_get_gtk_rsp_cmd =
105 		target_if_pmo_send_gtk_response_req;
106 	pmo_tx_ops->send_action_frame_pattern_req =
107 		target_if_pmo_send_action_frame_patterns;
108 	pmo_tx_ops->send_lphb_enable =
109 		target_if_pmo_send_lphb_enable;
110 	pmo_tx_ops->send_lphb_tcp_params =
111 		target_if_pmo_send_lphb_tcp_params;
112 	pmo_tx_ops->send_lphb_tcp_filter_req =
113 		target_if_pmo_send_lphb_tcp_pkt_filter;
114 	pmo_tx_ops->send_lphb_upd_params =
115 		target_if_pmo_send_lphb_udp_params;
116 	pmo_tx_ops->send_lphb_udp_filter_req =
117 		target_if_pmo_send_lphb_udp_pkt_filter;
118 	pmo_tx_ops->send_vdev_param_update_req =
119 		target_if_pmo_send_vdev_update_param_req;
120 	pmo_tx_ops->send_vdev_sta_ps_param_req =
121 		target_if_pmo_send_vdev_ps_param_req;
122 	pmo_tx_ops->psoc_update_wow_bus_suspend =
123 		target_if_pmo_psoc_update_bus_suspend;
124 	pmo_tx_ops->psoc_get_host_credits =
125 		target_if_pmo_psoc_get_host_credits;
126 	update_pmo_igmp_tx_ops(pmo_tx_ops);
127 	pmo_tx_ops->psoc_get_pending_cmnds =
128 		target_if_pmo_psoc_get_pending_cmnds;
129 	pmo_tx_ops->update_target_suspend_flag =
130 		target_if_pmo_update_target_suspend_flag;
131 	pmo_tx_ops->update_target_suspend_acked_flag =
132 		target_if_pmo_update_target_suspend_acked_flag;
133 	pmo_tx_ops->is_target_suspended =
134 		target_if_pmo_is_target_suspended;
135 	pmo_tx_ops->psoc_send_wow_enable_req =
136 		target_if_pmo_psoc_send_wow_enable_req;
137 	pmo_tx_ops->psoc_send_supend_req =
138 		target_if_pmo_psoc_send_suspend_req;
139 	pmo_tx_ops->psoc_set_runtime_pm_in_progress =
140 		target_if_pmo_set_runtime_pm_in_progress;
141 	pmo_tx_ops->psoc_get_runtime_pm_in_progress =
142 		target_if_pmo_get_runtime_pm_in_progress;
143 	pmo_tx_ops->psoc_send_host_wakeup_ind =
144 		target_if_pmo_psoc_send_host_wakeup_ind;
145 	pmo_tx_ops->psoc_send_target_resume_req =
146 		target_if_pmo_psoc_send_target_resume_req;
147 	pmo_tx_ops->psoc_send_d0wow_enable_req =
148 		target_if_pmo_psoc_send_d0wow_enable_req;
149 	pmo_tx_ops->psoc_send_d0wow_disable_req =
150 		target_if_pmo_psoc_send_d0wow_disable_req;
151 	pmo_tx_ops->psoc_send_idle_roam_suspend_mode =
152 		target_if_pmo_psoc_send_idle_monitor_cmd;
153 	tgt_if_pmo_reg_pkt_filter_ops(pmo_tx_ops);
154 	tgt_if_pmo_icmp_tx_ops(pmo_tx_ops);
155 	pmo_tx_ops->psoc_set_wow_enable_ack_failed =
156 		target_if_pmo_set_wow_enable_ack_failed;
157 
158 }
159 
160