blob: 25505713c6de4ee785d8c558924f1f65c7114d59 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnsonc45168b2018-07-04 14:23:08 -07002 * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * 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 Dhavali7090c5f2015-11-02 17:55:19 -080019#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 Johnson82797b62017-08-11 15:31:27 -070028struct hdd_context;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080029
30#ifdef WLAN_FEATURE_NAN
31struct wiphy;
32struct wireless_dev;
33
34int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
35 struct wireless_dev *wdev,
36 const void *data,
37 int data_len);
38
39bool wlan_hdd_nan_is_supported(void);
Arun Khandavallic811dcc2016-06-26 07:37:21 +053040/**
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 */
47static inline void hdd_nan_populate_cds_config(struct cds_config_info *cds_cfg,
Jeff Johnsonf049e742017-08-28 11:52:28 -070048 struct hdd_context *hdd_ctx)
Arun Khandavallic811dcc2016-06-26 07:37:21 +053049{
50 cds_cfg->is_nan_enabled = hdd_ctx->config->enable_nan_support;
51}
Mukul Sharma9223f232017-03-08 18:42:27 +053052
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 */
60static inline void hdd_nan_populate_pmo_config(struct pmo_psoc_cfg *pmo_cfg,
Jeff Johnsonf049e742017-08-28 11:52:28 -070061 struct hdd_context *hdd_ctx)
Mukul Sharma9223f232017-03-08 18:42:27 +053062{
63 pmo_cfg->nan_enable = hdd_ctx->config->enable_nan_support;
64}
65
Jeff Johnsonc45168b2018-07-04 14:23:08 -070066/**
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 */
78void wlan_hdd_cfg80211_nan_callback(hdd_handle_t hdd_handle, tSirNanEvent *msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079#else
80static inline bool wlan_hdd_nan_is_supported(void)
81{
82 return false;
83}
Arun Khandavallic811dcc2016-06-26 07:37:21 +053084static inline void hdd_nan_populate_cds_config(struct cds_config_info *cds_cfg,
Jeff Johnsonf049e742017-08-28 11:52:28 -070085 struct hdd_context *hdd_ctx)
Arun Khandavallic811dcc2016-06-26 07:37:21 +053086{
87}
Mukul Sharma9223f232017-03-08 18:42:27 +053088
89static inline void hdd_nan_populate_pmo_config(struct pmo_psoc_cfg *pmo_cfg,
Jeff Johnsonf049e742017-08-28 11:52:28 -070090 struct hdd_context *hdd_ctx)
Mukul Sharma9223f232017-03-08 18:42:27 +053091{
92}
93
Jeff Johnsonc45168b2018-07-04 14:23:08 -070094static inline
95void wlan_hdd_cfg80211_nan_callback(hdd_handle_t hdd_handle, tSirNanEvent *msg)
Arun Khandavalli4b55da72016-07-19 19:55:01 +053096{
97}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080098#endif /* WLAN_FEATURE_NAN */
99#endif /* __WLAN_HDD_NAN_H */