Nachiket Kukade | d0dd62e | 2018-05-21 18:39:22 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012-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 | /* |
| 20 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 21 | * under proprietary terms before Copyright ownership was assigned |
| 22 | * to the Linux Foundation. |
| 23 | */ |
| 24 | |
| 25 | /** |
| 26 | * DOC: wlan_hdd_apf.h |
| 27 | * |
| 28 | * Android Packet Filter related API's and definitions |
| 29 | */ |
| 30 | |
| 31 | #ifndef __WLAN_HDD_APF_H |
| 32 | #define __WLAN_HDD_APF_H |
| 33 | |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 34 | #ifdef FEATURE_WLAN_APF |
| 35 | |
| 36 | #include <net/cfg80211.h> |
Nachiket Kukade | d0dd62e | 2018-05-21 18:39:22 +0530 | [diff] [blame] | 37 | #include "sir_api.h" |
| 38 | #include "wlan_hdd_main.h" |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 39 | #include "wmi_unified_param.h" |
| 40 | |
| 41 | #define APF_CONTEXT_MAGIC 0x4575354 |
| 42 | |
| 43 | #define MAX_APF_MEMORY_LEN 4096 |
| 44 | |
| 45 | /* APF commands wait times in msec */ |
| 46 | #define WLAN_WAIT_TIME_APF_GET_CAPS 1000 |
| 47 | #define WLAN_WAIT_TIME_APF_READ_MEM 10000 |
| 48 | |
Nachiket Kukade | d0dd62e | 2018-05-21 18:39:22 +0530 | [diff] [blame] | 49 | /** |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 50 | * wlan_hdd_cfg80211_apf_offload() - SSR Wrapper to APF Offload |
Nachiket Kukade | d0dd62e | 2018-05-21 18:39:22 +0530 | [diff] [blame] | 51 | * @wiphy: wiphy structure pointer |
| 52 | * @wdev: Wireless device structure pointer |
| 53 | * @data: Pointer to the data received |
| 54 | * @data_len: Length of @data |
| 55 | * |
| 56 | * Return: 0 on success; errno on failure |
| 57 | */ |
| 58 | |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 59 | int wlan_hdd_cfg80211_apf_offload(struct wiphy *wiphy, |
Nachiket Kukade | d0dd62e | 2018-05-21 18:39:22 +0530 | [diff] [blame] | 60 | struct wireless_dev *wdev, |
| 61 | const void *data, int data_len); |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 62 | |
| 63 | /** |
| 64 | * hdd_apf_context_init - APF Context initialization operations |
Nachiket Kukade | 5f0ce4f | 2018-06-15 19:47:37 +0530 | [diff] [blame] | 65 | * @adapter: hdd adapter |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 66 | * |
| 67 | * Return: None |
| 68 | */ |
Nachiket Kukade | 5f0ce4f | 2018-06-15 19:47:37 +0530 | [diff] [blame] | 69 | void hdd_apf_context_init(struct hdd_adapter *adapter); |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * hdd_apf_context_destroy - APF Context de-init operations |
Nachiket Kukade | 5f0ce4f | 2018-06-15 19:47:37 +0530 | [diff] [blame] | 73 | * @adapter: hdd adapter |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 74 | * |
| 75 | * Return: None |
| 76 | */ |
Nachiket Kukade | 5f0ce4f | 2018-06-15 19:47:37 +0530 | [diff] [blame] | 77 | void hdd_apf_context_destroy(struct hdd_adapter *adapter); |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 78 | |
| 79 | /** |
| 80 | * hdd_get_apf_capabilities_cb() - Callback function to get APF capabilities |
Nachiket Kukade | 5f0ce4f | 2018-06-15 19:47:37 +0530 | [diff] [blame] | 81 | * @hdd_context: pointer to the hdd context |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 82 | * @apf_get_offload: struct for get offload |
| 83 | * |
| 84 | * This function receives the response/data from the lower layer and |
| 85 | * checks to see if the thread is still waiting then post the results to |
| 86 | * upper layer, if the request has timed out then ignore. |
| 87 | * |
| 88 | * Return: None |
| 89 | */ |
| 90 | void hdd_get_apf_capabilities_cb(void *hdd_context, |
| 91 | struct sir_apf_get_offload *data); |
| 92 | #else /* FEATURE_WLAN_APF */ |
| 93 | |
Nachiket Kukade | 5f0ce4f | 2018-06-15 19:47:37 +0530 | [diff] [blame] | 94 | static inline void hdd_apf_context_init(struct hdd_adapter *adapter) |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 95 | { |
| 96 | } |
| 97 | |
Nachiket Kukade | 5f0ce4f | 2018-06-15 19:47:37 +0530 | [diff] [blame] | 98 | static inline void hdd_apf_context_destroy(struct hdd_adapter *adapter) |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 99 | { |
| 100 | } |
| 101 | |
| 102 | #endif /* FEATURE_WLAN_APF */ |
| 103 | |
Nachiket Kukade | d0dd62e | 2018-05-21 18:39:22 +0530 | [diff] [blame] | 104 | #endif /* WLAN_HDD_APF_H */ |