Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 1 | /* |
Jeff Johnson | b4c2996 | 2017-10-07 19:35:14 -0700 | [diff] [blame^] | 2 | * 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 Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 18 | /** |
| 19 | * DOC: Implements public API for pmo low power hear beat feature |
| 20 | * to interact with target/WMI. |
| 21 | */ |
| 22 | |
| 23 | #include "wlan_pmo_tgt_api.h" |
| 24 | #include "wlan_pmo_lphb_public_struct.h" |
| 25 | #include "wlan_pmo_obj_mgmt_public_struct.h" |
| 26 | #include "wlan_pmo_main.h" |
| 27 | |
| 28 | QDF_STATUS pmo_tgt_send_lphb_enable(struct wlan_objmgr_psoc *psoc, |
| 29 | struct pmo_lphb_enable_req *ts_lphb_enable) |
| 30 | { |
| 31 | QDF_STATUS status; |
| 32 | struct wlan_pmo_tx_ops pmo_tx_ops; |
| 33 | |
| 34 | PMO_ENTER(); |
| 35 | pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc); |
| 36 | if (!pmo_tx_ops.send_lphb_enable) { |
| 37 | pmo_err("send_lphb_enable is null"); |
| 38 | status = QDF_STATUS_E_NULL_VALUE; |
| 39 | goto out; |
| 40 | } |
| 41 | status = pmo_tx_ops.send_lphb_enable(psoc, ts_lphb_enable); |
| 42 | if (status != QDF_STATUS_SUCCESS) |
| 43 | pmo_err("Failed to send lphb enable"); |
| 44 | out: |
| 45 | PMO_EXIT(); |
| 46 | |
| 47 | return status; |
| 48 | } |
| 49 | |
| 50 | QDF_STATUS pmo_tgt_send_lphb_tcp_params(struct wlan_objmgr_psoc *psoc, |
| 51 | struct pmo_lphb_tcp_params *ts_lphb_tcp_param) |
| 52 | { |
| 53 | QDF_STATUS status; |
| 54 | struct wlan_pmo_tx_ops pmo_tx_ops; |
| 55 | |
| 56 | PMO_ENTER(); |
| 57 | pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc); |
| 58 | if (!pmo_tx_ops.send_lphb_tcp_params) { |
| 59 | pmo_err("send_lphb_tcp_params is null"); |
| 60 | status = QDF_STATUS_E_NULL_VALUE; |
| 61 | goto out; |
| 62 | } |
| 63 | status = pmo_tx_ops.send_lphb_tcp_params(psoc, ts_lphb_tcp_param); |
| 64 | if (status != QDF_STATUS_SUCCESS) |
| 65 | pmo_err("Failed to send lphb tcp params"); |
| 66 | out: |
| 67 | PMO_EXIT(); |
| 68 | |
| 69 | return status; |
| 70 | } |
| 71 | |
| 72 | QDF_STATUS pmo_tgt_send_lphb_tcp_pkt_filter(struct wlan_objmgr_psoc *psoc, |
| 73 | struct pmo_lphb_tcp_filter_req *ts_lphb_tcp_filter) |
| 74 | { |
| 75 | QDF_STATUS status; |
| 76 | struct wlan_pmo_tx_ops pmo_tx_ops; |
| 77 | |
| 78 | PMO_ENTER(); |
| 79 | pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc); |
| 80 | if (!pmo_tx_ops.send_lphb_tcp_filter_req) { |
| 81 | pmo_err("send_lphb_tcp_filter_req is null"); |
| 82 | status = QDF_STATUS_E_NULL_VALUE; |
| 83 | goto out; |
| 84 | } |
| 85 | status = pmo_tx_ops.send_lphb_tcp_filter_req(psoc, ts_lphb_tcp_filter); |
| 86 | if (status != QDF_STATUS_SUCCESS) |
| 87 | pmo_err("Failed to send lphb tcp filter req"); |
| 88 | out: |
| 89 | PMO_EXIT(); |
| 90 | |
| 91 | return status; |
| 92 | } |
| 93 | |
| 94 | QDF_STATUS pmo_tgt_send_lphb_udp_params(struct wlan_objmgr_psoc *psoc, |
| 95 | struct pmo_lphb_udp_params *ts_lphb_udp_param) |
| 96 | { |
| 97 | QDF_STATUS status; |
| 98 | struct wlan_pmo_tx_ops pmo_tx_ops; |
| 99 | |
| 100 | PMO_ENTER(); |
| 101 | pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc); |
| 102 | if (!pmo_tx_ops.send_lphb_upd_params) { |
| 103 | pmo_err("send_lphb_upd_params is null"); |
| 104 | status = QDF_STATUS_E_NULL_VALUE; |
| 105 | goto out; |
| 106 | } |
| 107 | status = pmo_tx_ops.send_lphb_upd_params(psoc, ts_lphb_udp_param); |
| 108 | if (status != QDF_STATUS_SUCCESS) |
| 109 | pmo_err("Failed to send lphb udp param"); |
| 110 | out: |
| 111 | PMO_EXIT(); |
| 112 | |
| 113 | return status; |
| 114 | } |
| 115 | |
| 116 | QDF_STATUS pmo_tgt_send_lphb_udp_pkt_filter(struct wlan_objmgr_psoc *psoc, |
| 117 | struct pmo_lphb_udp_filter_req *ts_lphb_udp_filter) |
| 118 | { |
| 119 | QDF_STATUS status; |
| 120 | struct wlan_pmo_tx_ops pmo_tx_ops; |
| 121 | |
| 122 | PMO_ENTER(); |
| 123 | pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc); |
| 124 | if (!pmo_tx_ops.send_lphb_udp_filter_req) { |
| 125 | pmo_err("send_lphb_udp_filter_req is null"); |
| 126 | status = QDF_STATUS_E_NULL_VALUE; |
| 127 | goto out; |
| 128 | } |
| 129 | status = pmo_tx_ops.send_lphb_udp_filter_req(psoc, ts_lphb_udp_filter); |
| 130 | if (status != QDF_STATUS_SUCCESS) |
| 131 | pmo_err("Failed to send lphb udp filter req"); |
| 132 | out: |
| 133 | PMO_EXIT(); |
| 134 | |
| 135 | return status; |
| 136 | } |
| 137 | |
| 138 | QDF_STATUS pmo_tgt_lphb_rsp_evt(struct wlan_objmgr_psoc *psoc, |
| 139 | struct pmo_lphb_rsp *rsp_param) |
| 140 | { |
| 141 | struct pmo_psoc_priv_obj *psoc_ctx; |
| 142 | |
| 143 | psoc_ctx = pmo_psoc_get_priv(psoc); |
| 144 | if (psoc_ctx->wow.lphb_cb && psoc_ctx->wow.lphb_cb_ctx) { |
Jeff Johnson | 0a64538 | 2017-09-18 08:17:59 -0700 | [diff] [blame] | 145 | pmo_info("callback:%pK context:%pK psoc:%pK", |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 146 | psoc_ctx->wow.lphb_cb, psoc_ctx->wow.lphb_cb_ctx, psoc); |
| 147 | psoc_ctx->wow.lphb_cb(psoc_ctx->wow.lphb_cb_ctx, rsp_param); |
| 148 | } else { |
Jeff Johnson | 0a64538 | 2017-09-18 08:17:59 -0700 | [diff] [blame] | 149 | pmo_err("lphb rsp callback/context is null for psoc %pK", |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 150 | psoc); |
| 151 | } |
| 152 | |
| 153 | return QDF_STATUS_SUCCESS; |
| 154 | } |
| 155 | |