Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Arun Khandavalli | cc544b3 | 2017-01-30 19:52:16 +0530 | [diff] [blame] | 2 | * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #ifndef HDD_IPA_H__ |
| 29 | #define HDD_IPA_H__ |
| 30 | |
| 31 | /** |
| 32 | * DOC: wlan_hdd_ipa.h |
| 33 | * |
| 34 | * WLAN IPA interface module headers |
| 35 | * Originally written by Qualcomm Atheros, Inc |
| 36 | */ |
| 37 | |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 38 | /** |
| 39 | * enum hdd_ipa_wlan_event - HDD IPA events |
| 40 | * @HDD_IPA_CLIENT_CONNECT: Client Connects |
| 41 | * @HDD_IPA_CLIENT_DISCONNECT: Client Disconnects |
| 42 | * @HDD_IPA_AP_CONNECT: SoftAP is started |
| 43 | * @HDD_IPA_AP_DISCONNECT: SoftAP is stopped |
| 44 | * @HDD_IPA_STA_CONNECT: STA associates to AP |
| 45 | * @HDD_IPA_STA_DISCONNECT: STA dissociates from AP |
| 46 | * @HDD_IPA_CLIENT_CONNECT_EX: Peer associates/re-associates to softap |
| 47 | * @HDD_IPA_WLAN_EVENT_MAX: Max value for the enum |
| 48 | */ |
| 49 | enum hdd_ipa_wlan_event { |
| 50 | HDD_IPA_CLIENT_CONNECT, |
| 51 | HDD_IPA_CLIENT_DISCONNECT, |
| 52 | HDD_IPA_AP_CONNECT, |
| 53 | HDD_IPA_AP_DISCONNECT, |
| 54 | HDD_IPA_STA_CONNECT, |
| 55 | HDD_IPA_STA_DISCONNECT, |
| 56 | HDD_IPA_CLIENT_CONNECT_EX, |
| 57 | HDD_IPA_WLAN_EVENT_MAX |
| 58 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 59 | |
| 60 | #ifdef IPA_OFFLOAD |
| 61 | /* Include files */ |
Houston Hoffman | 43d47fa | 2016-02-24 16:34:30 -0800 | [diff] [blame] | 62 | #include <wlan_hdd_assoc.h> /* hdd_context_t */ |
| 63 | |
| 64 | /** |
Prakash Dhavali | 87b38e3 | 2016-11-14 16:22:53 -0800 | [diff] [blame] | 65 | * enum hdd_ipa_forward_type: Type of forward packet received from IPA |
| 66 | * @HDD_IPA_FORWARD_PKT_NONE: No forward packet |
| 67 | * @HDD_IPA_FORWARD_PKT_LOCAL_STACK: Packet forwarded to kernel network stack |
| 68 | * @HDD_IPA_FORWARD_PKT_DISCARD: Discarded packet before sending to kernel stack |
| 69 | */ |
| 70 | enum hdd_ipa_forward_type { |
| 71 | HDD_IPA_FORWARD_PKT_NONE = 0, |
| 72 | HDD_IPA_FORWARD_PKT_LOCAL_STACK = 1, |
| 73 | HDD_IPA_FORWARD_PKT_DISCARD = 2 |
| 74 | }; |
| 75 | |
| 76 | /** |
Houston Hoffman | 43d47fa | 2016-02-24 16:34:30 -0800 | [diff] [blame] | 77 | * FIXME: Temporary hack - until IPA functionality gets restored |
| 78 | * |
| 79 | */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 80 | typedef void (*hdd_ipa_nbuf_cb_fn)(qdf_nbuf_t); |
| 81 | void hdd_ipa_nbuf_cb(qdf_nbuf_t skb); /* Fwd declare */ |
Houston Hoffman | 43d47fa | 2016-02-24 16:34:30 -0800 | [diff] [blame] | 82 | static inline hdd_ipa_nbuf_cb_fn wlan_hdd_stub_ipa_fn(void) |
| 83 | { |
| 84 | return hdd_ipa_nbuf_cb; |
| 85 | }; |
| 86 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 87 | QDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx); |
| 88 | QDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 89 | QDF_STATUS hdd_ipa_process_rxt(void *cds_context, qdf_nbuf_t rxBuf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 90 | uint8_t sta_id); |
| 91 | int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 92 | enum hdd_ipa_wlan_event type, uint8_t *mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 93 | int hdd_ipa_set_perf_level(hdd_context_t *hdd_ctx, uint64_t tx_packets, |
| 94 | uint64_t rx_packets); |
| 95 | int hdd_ipa_suspend(hdd_context_t *hdd_ctx); |
| 96 | int hdd_ipa_resume(hdd_context_t *hdd_ctx); |
| 97 | void hdd_ipa_uc_stat_query(hdd_context_t *hdd_ctx, uint32_t *ipa_tx_diff, |
| 98 | uint32_t *ipa_rx_diff); |
| 99 | void hdd_ipa_uc_rt_debug_host_dump(hdd_context_t *hdd_ctx); |
| 100 | void hdd_ipa_uc_stat_request(hdd_adapter_t *adapter, uint8_t reason); |
Yun Park | 637d648 | 2016-10-05 10:51:33 -0700 | [diff] [blame^] | 101 | void hdd_ipa_uc_sharing_stats_request(hdd_adapter_t *adapter, |
| 102 | uint8_t reset_stats); |
| 103 | void hdd_ipa_uc_set_quota(hdd_adapter_t *adapter, uint8_t set_quota, |
| 104 | uint64_t quota_bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 105 | bool hdd_ipa_is_enabled(hdd_context_t *pHddCtx); |
| 106 | bool hdd_ipa_uc_is_enabled(hdd_context_t *pHddCtx); |
Yun Park | a27049a | 2016-10-11 12:30:49 -0700 | [diff] [blame] | 107 | #ifndef QCA_LL_TX_FLOW_CONTROL_V2 |
| 108 | int hdd_ipa_send_mcc_scc_msg(hdd_context_t *hdd_ctx, bool mcc_mode); |
| 109 | #else |
| 110 | static inline int hdd_ipa_send_mcc_scc_msg(hdd_context_t *hdd_ctx, |
| 111 | bool mcc_mode) |
| 112 | { |
| 113 | return 0; |
| 114 | } |
| 115 | #endif |
Arun Khandavalli | cc544b3 | 2017-01-30 19:52:16 +0530 | [diff] [blame] | 116 | int hdd_ipa_uc_ssr_reinit(hdd_context_t *hdd_ctx); |
Leo Chang | e3e4944 | 2015-10-26 20:07:13 -0700 | [diff] [blame] | 117 | int hdd_ipa_uc_ssr_deinit(void); |
| 118 | void hdd_ipa_uc_force_pipe_shutdown(hdd_context_t *hdd_ctx); |
Leo Chang | 3bc8fed | 2015-11-13 10:59:47 -0800 | [diff] [blame] | 119 | struct sk_buff *hdd_ipa_tx_packet_ipa(hdd_context_t *hdd_ctx, |
| 120 | struct sk_buff *skb, uint8_t session_id); |
Leo Chang | 11545d6 | 2016-10-17 14:53:50 -0700 | [diff] [blame] | 121 | bool hdd_ipa_is_present(hdd_context_t *hdd_ctx); |
Yun Park | b187d54 | 2016-11-14 18:10:04 -0800 | [diff] [blame] | 122 | void hdd_ipa_dump_info(hdd_context_t *hdd_ctx); |
Manikandan Mohan | bb8a7ee | 2017-02-09 11:26:53 -0800 | [diff] [blame] | 123 | QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 124 | void hdd_ipa_set_tx_flow_info(void); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 125 | #else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 126 | static inline QDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 127 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 128 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 129 | } |
| 130 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 131 | static inline QDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 132 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 133 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 134 | } |
| 135 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 136 | static inline QDF_STATUS hdd_ipa_process_rxt(void *cds_context, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 137 | qdf_nbuf_t rxBuf, uint8_t sta_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 138 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 139 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | static inline int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 143 | enum hdd_ipa_wlan_event type, uint8_t *mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 144 | { |
| 145 | return 0; |
| 146 | } |
| 147 | |
| 148 | static inline int hdd_ipa_send_mcc_scc_msg(hdd_context_t *hdd_ctx, |
| 149 | bool mcc_mode) |
| 150 | { |
| 151 | return 0; |
| 152 | } |
| 153 | |
| 154 | static inline int hdd_ipa_set_perf_level(hdd_context_t *hdd_ctx, |
| 155 | uint64_t tx_packets, |
| 156 | uint64_t rx_packets) |
| 157 | { |
| 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | static inline int hdd_ipa_suspend(hdd_context_t *hdd_ctx) |
| 162 | { |
| 163 | return 0; |
| 164 | } |
| 165 | |
| 166 | static inline int hdd_ipa_resume(hdd_context_t *hdd_ctx) |
| 167 | { |
| 168 | return 0; |
| 169 | } |
| 170 | |
| 171 | static inline void hdd_ipa_uc_stat_query(hdd_context_t *hdd_ctx, |
| 172 | uint32_t *ipa_tx_diff, |
| 173 | uint32_t *ipa_rx_diff) |
| 174 | { |
| 175 | *ipa_tx_diff = 0; |
| 176 | *ipa_rx_diff = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | static inline void hdd_ipa_uc_stat_request(hdd_adapter_t *adapter, |
| 180 | uint8_t reason) |
| 181 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 182 | } |
| 183 | |
Leo Chang | 3bc8fed | 2015-11-13 10:59:47 -0800 | [diff] [blame] | 184 | static inline void hdd_ipa_uc_rt_debug_host_dump(hdd_context_t *hdd_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 185 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | static inline bool hdd_ipa_is_enabled(hdd_context_t *pHddCtx) |
| 189 | { |
| 190 | return false; |
| 191 | } |
| 192 | |
| 193 | static inline bool hdd_ipa_uc_is_enabled(hdd_context_t *pHddCtx) |
| 194 | { |
| 195 | return false; |
| 196 | } |
Yun Park | b187d54 | 2016-11-14 18:10:04 -0800 | [diff] [blame] | 197 | |
| 198 | static inline void hdd_ipa_dump_info(hdd_context_t *hdd_ctx) |
| 199 | { |
Yun Park | b187d54 | 2016-11-14 18:10:04 -0800 | [diff] [blame] | 200 | } |
| 201 | |
Arun Khandavalli | cc544b3 | 2017-01-30 19:52:16 +0530 | [diff] [blame] | 202 | static inline int hdd_ipa_uc_ssr_reinit(hdd_context_t *hdd_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 203 | { |
| 204 | return false; |
| 205 | } |
| 206 | |
| 207 | static inline int hdd_ipa_uc_ssr_deinit(void) |
| 208 | { |
| 209 | return false; |
| 210 | } |
Leo Chang | e3e4944 | 2015-10-26 20:07:13 -0700 | [diff] [blame] | 211 | static inline void hdd_ipa_uc_force_pipe_shutdown(hdd_context_t *hdd_ctx) |
| 212 | { |
Leo Chang | e3e4944 | 2015-10-26 20:07:13 -0700 | [diff] [blame] | 213 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 214 | |
Leo Chang | 3bc8fed | 2015-11-13 10:59:47 -0800 | [diff] [blame] | 215 | /** |
| 216 | * hdd_ipa_tx_packet_ipa() - send packet to IPA |
| 217 | * @hdd_ctx: Global HDD context |
| 218 | * @skb: skb sent to IPA |
| 219 | * @session_id: send packet instance session id |
| 220 | * |
| 221 | * Send TX packet which generated by system to IPA. |
| 222 | * This routine only will be used for function verification |
| 223 | * |
| 224 | * Return: NULL packet sent to IPA properly |
| 225 | * skb packet not sent to IPA. legacy data path should handle |
| 226 | */ |
| 227 | static inline struct sk_buff *hdd_ipa_tx_packet_ipa(hdd_context_t *hdd_ctx, |
| 228 | struct sk_buff *skb, uint8_t session_id) |
| 229 | { |
| 230 | return skb; |
| 231 | } |
Leo Chang | 11545d6 | 2016-10-17 14:53:50 -0700 | [diff] [blame] | 232 | |
| 233 | /** |
| 234 | * hdd_ipa_is_present() - get IPA hw status |
| 235 | * @hdd_ctx: pointer to hdd context |
| 236 | * |
| 237 | * ipa_uc_reg_rdyCB is not directly designed to check |
| 238 | * ipa hw status. This is an undocumented function which |
| 239 | * has confirmed with IPA team. |
| 240 | * |
| 241 | * Return: true - ipa hw present |
| 242 | * false - ipa hw not present |
| 243 | */ |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 244 | static inline bool hdd_ipa_is_present(hdd_context_t *hdd_ctx) |
Leo Chang | 11545d6 | 2016-10-17 14:53:50 -0700 | [diff] [blame] | 245 | { |
| 246 | return false; |
| 247 | } |
Manikandan Mohan | bb8a7ee | 2017-02-09 11:26:53 -0800 | [diff] [blame] | 248 | |
| 249 | /** |
| 250 | * hdd_ipa_uc_ol_init() - Initialize IPA uC offload |
| 251 | * @hdd_ctx: Global HDD context |
| 252 | * |
| 253 | * Return: QDF_STATUS |
| 254 | */ |
Yun Park | ec84530 | 2016-12-15 09:22:57 -0800 | [diff] [blame] | 255 | static inline QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx) |
Manikandan Mohan | bb8a7ee | 2017-02-09 11:26:53 -0800 | [diff] [blame] | 256 | { |
| 257 | return QDF_STATUS_SUCCESS; |
| 258 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 259 | |
| 260 | static inline void hdd_ipa_set_tx_flow_info(void) |
| 261 | { |
| 262 | return; |
| 263 | } |
| 264 | |
Leo Chang | 3bc8fed | 2015-11-13 10:59:47 -0800 | [diff] [blame] | 265 | #endif /* IPA_OFFLOAD */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 266 | #endif /* #ifndef HDD_IPA_H__ */ |