Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | c45168b | 2018-07-04 14:23:08 -0700 | [diff] [blame] | 2 | * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | #ifndef __WLAN_HDD_NAN_H |
| 20 | #define __WLAN_HDD_NAN_H |
| 21 | |
| 22 | /** |
| 23 | * DOC: wlan_hdd_nan.h |
| 24 | * |
| 25 | * WLAN Host Device Driver NAN API specification |
| 26 | */ |
| 27 | |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 28 | struct hdd_context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 29 | |
| 30 | #ifdef WLAN_FEATURE_NAN |
| 31 | struct wiphy; |
| 32 | struct wireless_dev; |
| 33 | |
| 34 | int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 35 | struct wireless_dev *wdev, |
| 36 | const void *data, |
| 37 | int data_len); |
| 38 | |
| 39 | bool wlan_hdd_nan_is_supported(void); |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 40 | /** |
| 41 | * hdd_nan_populate_cds_config() - Populate NAN cds configuration |
| 42 | * @cds_cfg: CDS Configuration |
| 43 | * @hdd_ctx: Pointer to hdd context |
| 44 | * |
| 45 | * Return: none |
| 46 | */ |
| 47 | static inline void hdd_nan_populate_cds_config(struct cds_config_info *cds_cfg, |
Jeff Johnson | f049e74 | 2017-08-28 11:52:28 -0700 | [diff] [blame] | 48 | struct hdd_context *hdd_ctx) |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 49 | { |
| 50 | cds_cfg->is_nan_enabled = hdd_ctx->config->enable_nan_support; |
| 51 | } |
Mukul Sharma | 9223f23 | 2017-03-08 18:42:27 +0530 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * hdd_nan_populate_pmo_config() - Populate NAN pmo configuration |
| 55 | * @pmo_cfg: PMO Configuration |
| 56 | * @hdd_ctx: Pointer to hdd context |
| 57 | * |
| 58 | * Return: none |
| 59 | */ |
| 60 | static inline void hdd_nan_populate_pmo_config(struct pmo_psoc_cfg *pmo_cfg, |
Jeff Johnson | f049e74 | 2017-08-28 11:52:28 -0700 | [diff] [blame] | 61 | struct hdd_context *hdd_ctx) |
Mukul Sharma | 9223f23 | 2017-03-08 18:42:27 +0530 | [diff] [blame] | 62 | { |
| 63 | pmo_cfg->nan_enable = hdd_ctx->config->enable_nan_support; |
| 64 | } |
| 65 | |
Jeff Johnson | c45168b | 2018-07-04 14:23:08 -0700 | [diff] [blame] | 66 | /** |
| 67 | * wlan_hdd_cfg80211_nan_callback() - cfg80211 NAN event handler |
| 68 | * @hdd_handle: opaque handle to the global HDD context |
| 69 | * @msg: NAN event message |
| 70 | * |
| 71 | * This is a callback function and it gets called when we need to report |
| 72 | * a nan event to userspace. The wlan host driver simply encapsulates the |
| 73 | * event into a netlink payload and then forwards it to userspace via a |
| 74 | * cfg80211 vendor event. |
| 75 | * |
| 76 | * Return: nothing |
| 77 | */ |
| 78 | void wlan_hdd_cfg80211_nan_callback(hdd_handle_t hdd_handle, tSirNanEvent *msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 79 | #else |
| 80 | static inline bool wlan_hdd_nan_is_supported(void) |
| 81 | { |
| 82 | return false; |
| 83 | } |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 84 | static inline void hdd_nan_populate_cds_config(struct cds_config_info *cds_cfg, |
Jeff Johnson | f049e74 | 2017-08-28 11:52:28 -0700 | [diff] [blame] | 85 | struct hdd_context *hdd_ctx) |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 86 | { |
| 87 | } |
Mukul Sharma | 9223f23 | 2017-03-08 18:42:27 +0530 | [diff] [blame] | 88 | |
| 89 | static inline void hdd_nan_populate_pmo_config(struct pmo_psoc_cfg *pmo_cfg, |
Jeff Johnson | f049e74 | 2017-08-28 11:52:28 -0700 | [diff] [blame] | 90 | struct hdd_context *hdd_ctx) |
Mukul Sharma | 9223f23 | 2017-03-08 18:42:27 +0530 | [diff] [blame] | 91 | { |
| 92 | } |
| 93 | |
Jeff Johnson | c45168b | 2018-07-04 14:23:08 -0700 | [diff] [blame] | 94 | static inline |
| 95 | void wlan_hdd_cfg80211_nan_callback(hdd_handle_t hdd_handle, tSirNanEvent *msg) |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 96 | { |
| 97 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 98 | #endif /* WLAN_FEATURE_NAN */ |
| 99 | #endif /* __WLAN_HDD_NAN_H */ |