1 /*
2 * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18 /**
19 * DOC: target_if_pmo_static.c
20 *
21 * Target interface file for pmo component to
22 * send wow related cmd and process event.
23 */
24
25
26 #include "target_if.h"
27 #include "target_if_pmo.h"
28 #include "wmi_unified_api.h"
29
target_if_pmo_send_ra_filter_req(struct wlan_objmgr_vdev * vdev,uint8_t default_pattern,uint16_t rate_limit_interval)30 QDF_STATUS target_if_pmo_send_ra_filter_req(struct wlan_objmgr_vdev *vdev,
31 uint8_t default_pattern, uint16_t rate_limit_interval)
32 {
33 uint8_t vdev_id;
34 struct wlan_objmgr_psoc *psoc;
35 QDF_STATUS status;
36 wmi_unified_t wmi_handle;
37
38 if (!vdev) {
39 target_if_err("vdev ptr passed is NULL");
40 return QDF_STATUS_E_INVAL;
41 }
42
43 psoc = wlan_vdev_get_psoc(vdev);
44 vdev_id = wlan_vdev_get_id(vdev);
45 if (!psoc) {
46 target_if_err("psoc handle is NULL");
47 return QDF_STATUS_E_INVAL;
48 }
49
50 wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
51 if (!wmi_handle) {
52 target_if_err("Invalid wmi handle");
53 return QDF_STATUS_E_INVAL;
54 }
55
56 status = wmi_unified_wow_sta_ra_filter_cmd(wmi_handle,
57 vdev_id,
58 default_pattern,
59 rate_limit_interval);
60 if (status)
61 target_if_err("Failed to send RA rate limit to fw");
62
63 return status;
64 }
65
target_if_pmo_send_action_frame_patterns(struct wlan_objmgr_vdev * vdev,struct pmo_action_wakeup_set_params * ip_cmd)66 QDF_STATUS target_if_pmo_send_action_frame_patterns(
67 struct wlan_objmgr_vdev *vdev,
68 struct pmo_action_wakeup_set_params *ip_cmd)
69 {
70 uint8_t vdev_id;
71 struct wlan_objmgr_psoc *psoc;
72 QDF_STATUS status;
73 wmi_unified_t wmi_handle;
74
75 if (!vdev) {
76 target_if_err("vdev ptr passed is NULL");
77 return QDF_STATUS_E_INVAL;
78 }
79
80 psoc = wlan_vdev_get_psoc(vdev);
81 vdev_id = wlan_vdev_get_id(vdev);
82 if (!psoc) {
83 target_if_err("psoc handle is NULL");
84 return QDF_STATUS_E_INVAL;
85 }
86
87 wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
88 if (!wmi_handle) {
89 target_if_err("Invalid wmi handle");
90 return QDF_STATUS_E_INVAL;
91 }
92
93 status = wmi_unified_action_frame_patterns_cmd(wmi_handle, ip_cmd);
94 if (status != QDF_STATUS_SUCCESS)
95 target_if_err("Failed to config wow action frame map, ret %d",
96 status);
97
98 return status;
99 }
100
target_if_pmo_send_enhance_mc_offload_req(struct wlan_objmgr_vdev * vdev,bool enable)101 QDF_STATUS target_if_pmo_send_enhance_mc_offload_req(
102 struct wlan_objmgr_vdev *vdev, bool enable)
103 {
104 uint8_t vdev_id;
105 struct wlan_objmgr_psoc *psoc;
106 QDF_STATUS status;
107 wmi_unified_t wmi_handle;
108
109 if (!vdev) {
110 target_if_err("vdev ptr passed is NULL");
111 return QDF_STATUS_E_INVAL;
112 }
113
114 psoc = wlan_vdev_get_psoc(vdev);
115 vdev_id = wlan_vdev_get_id(vdev);
116 if (!psoc) {
117 target_if_err("psoc handle is NULL");
118 return QDF_STATUS_E_INVAL;
119 }
120
121 wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
122 if (!wmi_handle) {
123 target_if_err("Invalid wmi handle");
124 return QDF_STATUS_E_INVAL;
125 }
126
127 status = wmi_unified_enable_enhance_multicast_offload_cmd(wmi_handle,
128 vdev_id,
129 enable);
130 if (status)
131 target_if_err("Failed to config wow wakeup event");
132
133 return status;
134 }
135
136