blob: eeee39294123176a4ebf8bf4b2051870a5332de2 [file] [log] [blame]
Nachiket Kukaded0dd62e2018-05-21 18:39:22 +05301/*
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 Kukade177b5b02018-05-22 20:52:17 +053034#ifdef FEATURE_WLAN_APF
35
36#include <net/cfg80211.h>
Nachiket Kukaded0dd62e2018-05-21 18:39:22 +053037#include "sir_api.h"
38#include "wlan_hdd_main.h"
Nachiket Kukade177b5b02018-05-22 20:52:17 +053039#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 Kukaded0dd62e2018-05-21 18:39:22 +053049/**
Nachiket Kukadee547a482018-05-22 16:43:30 +053050 * wlan_hdd_cfg80211_apf_offload() - SSR Wrapper to APF Offload
Nachiket Kukaded0dd62e2018-05-21 18:39:22 +053051 * @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 Kukadee547a482018-05-22 16:43:30 +053059int wlan_hdd_cfg80211_apf_offload(struct wiphy *wiphy,
Nachiket Kukaded0dd62e2018-05-21 18:39:22 +053060 struct wireless_dev *wdev,
61 const void *data, int data_len);
Nachiket Kukade177b5b02018-05-22 20:52:17 +053062
63/**
64 * hdd_apf_context_init - APF Context initialization operations
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +053065 * @adapter: hdd adapter
Nachiket Kukade177b5b02018-05-22 20:52:17 +053066 *
67 * Return: None
68 */
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +053069void hdd_apf_context_init(struct hdd_adapter *adapter);
Nachiket Kukade177b5b02018-05-22 20:52:17 +053070
71/**
72 * hdd_apf_context_destroy - APF Context de-init operations
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +053073 * @adapter: hdd adapter
Nachiket Kukade177b5b02018-05-22 20:52:17 +053074 *
75 * Return: None
76 */
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +053077void hdd_apf_context_destroy(struct hdd_adapter *adapter);
Nachiket Kukade177b5b02018-05-22 20:52:17 +053078
79/**
80 * hdd_get_apf_capabilities_cb() - Callback function to get APF capabilities
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +053081 * @hdd_context: pointer to the hdd context
Nachiket Kukade177b5b02018-05-22 20:52:17 +053082 * @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 */
90void hdd_get_apf_capabilities_cb(void *hdd_context,
91 struct sir_apf_get_offload *data);
92#else /* FEATURE_WLAN_APF */
93
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +053094static inline void hdd_apf_context_init(struct hdd_adapter *adapter)
Nachiket Kukade177b5b02018-05-22 20:52:17 +053095{
96}
97
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +053098static inline void hdd_apf_context_destroy(struct hdd_adapter *adapter)
Nachiket Kukade177b5b02018-05-22 20:52:17 +053099{
100}
101
102#endif /* FEATURE_WLAN_APF */
103
Nachiket Kukaded0dd62e2018-05-21 18:39:22 +0530104#endif /* WLAN_HDD_APF_H */