1 /*
2 * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 #ifndef __WLAN_HDD_NAN_H
21 #define __WLAN_HDD_NAN_H
22
23 /**
24 * DOC: wlan_hdd_nan.h
25 *
26 * WLAN Host Device Driver NAN API specification
27 */
28
29 struct hdd_context;
30
31 #ifdef WLAN_FEATURE_NAN
32 struct wiphy;
33 struct wireless_dev;
34
35 bool wlan_hdd_nan_is_supported(struct hdd_context *hdd_ctx);
36
37 /**
38 * wlan_hdd_cfg80211_nan_ext_request() - handle NAN Extended request
39 * @wiphy: pointer to wireless wiphy structure.
40 * @wdev: pointer to wireless_dev structure.
41 * @data: Pointer to the data to be passed via vendor interface
42 * @data_len:Length of the data to be passed
43 *
44 * This function is called by userspace to send a NAN request to
45 * firmware. This is an SSR-protected wrapper function.
46 *
47 * Return: 0 on success, negative errno on failure
48 */
49 int wlan_hdd_cfg80211_nan_ext_request(struct wiphy *wiphy,
50 struct wireless_dev *wdev,
51 const void *data,
52 int data_len);
53
54 #ifdef WLAN_FEATURE_SR
55 /**
56 * hdd_nan_sr_concurrency_update() - NAN Spatial Reuse concurrency
57 * @nan_evt: nan event params
58 *
59 * Return: None
60 */
61 void hdd_nan_sr_concurrency_update(struct nan_event_params *nan_evt);
62 #endif
63 #define FEATURE_NAN_VENDOR_COMMANDS \
64 { \
65 .info.vendor_id = QCA_NL80211_VENDOR_ID, \
66 .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN_EXT, \
67 .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \
68 WIPHY_VENDOR_CMD_NEED_NETDEV | \
69 WIPHY_VENDOR_CMD_NEED_RUNNING, \
70 .doit = wlan_hdd_cfg80211_nan_ext_request, \
71 vendor_command_policy(nan_attr_policy, \
72 QCA_WLAN_VENDOR_ATTR_NAN_PARAMS_MAX) \
73 }, \
74 { \
75 .info.vendor_id = QCA_NL80211_VENDOR_ID, \
76 .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NDP, \
77 .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \
78 WIPHY_VENDOR_CMD_NEED_NETDEV | \
79 WIPHY_VENDOR_CMD_NEED_RUNNING, \
80 .doit = wlan_hdd_cfg80211_process_ndp_cmd, \
81 vendor_command_policy(vendor_attr_policy, \
82 QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX) \
83 },
84
85 #else /* WLAN_FEATURE_NAN */
86 #define FEATURE_NAN_VENDOR_COMMANDS
87
wlan_hdd_nan_is_supported(struct hdd_context * hdd_ctx)88 static inline bool wlan_hdd_nan_is_supported(struct hdd_context *hdd_ctx)
89 {
90 return false;
91 }
92 #endif /* WLAN_FEATURE_NAN */
93
94 /**
95 * hdd_nan_concurrency_update() - NAN concurrency
96 *
97 * Return: None
98 */
99 void hdd_nan_concurrency_update(void);
100
101 #endif /* __WLAN_HDD_NAN_H */
102