blob: f6bbe727ac66cdf3d8e6c8f8a06b5b5ff3064f42 [file] [log] [blame]
Mukul Sharmad75a6672017-06-22 15:40:53 +05301/*
Jeff Johnsonb4c29962017-10-07 19:35:14 -07002 * Copyright (c) 2017 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 */
Mukul Sharmad75a6672017-06-22 15:40:53 +053018/**
19 * DOC: Implements public API for pmo to interact with target/WMI
20 */
21
22#include "wlan_pmo_tgt_api.h"
23#include "wlan_pmo_wow.h"
24#include "wlan_pmo_obj_mgmt_public_struct.h"
25#include "wlan_pmo_main.h"
26
27QDF_STATUS pmo_tgt_send_enhance_multicast_offload_req(
Dustin Brown8d8d9fe2017-07-18 16:01:25 -070028 struct wlan_objmgr_vdev *vdev,
29 uint8_t action)
Mukul Sharmad75a6672017-06-22 15:40:53 +053030{
31 QDF_STATUS status;
32 struct wlan_objmgr_psoc *psoc;
33 struct wlan_pmo_tx_ops pmo_tx_ops;
34
35 PMO_ENTER();
36 psoc = pmo_vdev_get_psoc(vdev);
37
38 pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
39 if (!pmo_tx_ops.send_enhance_mc_offload_req) {
40 pmo_err("send_enhance_multicast_offload is null");
41 status = QDF_STATUS_E_NULL_VALUE;
42 goto out;
43 }
44
45 status = pmo_tx_ops.send_enhance_mc_offload_req(vdev, action);
46 if (status != QDF_STATUS_SUCCESS)
47 pmo_err("Failed to config enhance multicast offload");
48out:
49 PMO_EXIT();
50
51 return status;
52}
53
54QDF_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 }
93out:
94 PMO_EXIT();
95
96 return status;
97}
98
99QDF_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 PMO_ENTER();
108
109 psoc = pmo_vdev_get_psoc(vdev);
110
111 pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
112 if (!pmo_tx_ops.send_action_frame_pattern_req) {
113 pmo_err("send_add_action_frame_pattern_cmd is null");
114 status = QDF_STATUS_E_NULL_VALUE;
115 goto out;
116 }
117
118 status = pmo_tx_ops.send_action_frame_pattern_req(vdev, cmd);
119 if (status != QDF_STATUS_SUCCESS)
120 pmo_err("Failed to add filter");
121out:
122 PMO_EXIT();
123
124 return status;
125}
126