1 /*
2  * Copyright (c) 2012-2015,2020-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: osif_cm_req.h
20  *
21  * This header file maintains declarations of connect, disconnect, roam
22  * request apis.
23  */
24 
25 #ifndef __OSIF_CM_REQ_H
26 #define __OSIF_CM_REQ_H
27 
28 #include "qdf_status.h"
29 #include "wlan_cm_public_struct.h"
30 #include <net/cfg80211.h>
31 #include "wlan_objmgr_vdev_obj.h"
32 #include "wlan_osif_features.h"
33 
34 #define FEATURE_DRIVER_DISCONNECT_REASON				\
35 	[QCA_NL80211_VENDOR_SUBCMD_DRIVER_DISCONNECT_REASON_INDEX] = {	\
36 	.vendor_id = QCA_NL80211_VENDOR_ID,				\
37 	.subcmd = QCA_NL80211_VENDOR_SUBCMD_DRIVER_DISCONNECT_REASON,	\
38 },
39 
40 /**
41  * struct osif_connect_params - extra connect params
42  * @scan_ie: default scan ie to be used in connect scan and unicast probe req
43  * during connect
44  * @force_rsne_override: force the arbitrary rsne received in connect req to be
45  * used with out validation, used for the scenarios where the device is used
46  * as a testbed device with special functionality and not recommended
47  * for production.
48  * @dot11mode_filter: dot11mode filter used to restrict connection to
49  * 11n/11ac/11ax.
50  * @sae_pwe: SAE mechanism for PWE derivation
51  *           0 = hunting-and-pecking loop only
52  *           1 = hash-to-element only
53  *           2 = both hunting-and-pecking loop and hash-to-element enabled
54  * @prev_bssid: Previous bssid in case of roam scenario
55  */
56 struct osif_connect_params {
57 	struct element_info scan_ie;
58 	bool force_rsne_override;
59 	enum dot11_mode_filter dot11mode_filter;
60 	uint8_t sae_pwe;
61 	struct qdf_mac_addr prev_bssid;
62 };
63 
64 #ifdef CFG80211_MULTI_AKM_CONNECT_SUPPORT
65 #define WLAN_CM_MAX_CONNECT_AKMS 5
66 #endif
67 
68 #if defined(WLAN_FEATURE_FILS_SK) && \
69 	(defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \
70 		 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)))
71 /**
72  * osif_cm_get_fils_auth_type() - get fils auth type
73  * @auth: nl auth type
74  *
75  * Return: enum wlan_fils_auth_type
76  */
77 enum wlan_fils_auth_type
78 osif_cm_get_fils_auth_type(enum nl80211_auth_type auth);
79 #endif
80 
81 /**
82  * osif_cm_connect() - Connect start request
83  * @dev: net dev
84  * @vdev: vdev pointer
85  * @req: connect req
86  * @params: connect params
87  *
88  * Return: int
89  */
90 int osif_cm_connect(struct net_device *dev, struct wlan_objmgr_vdev *vdev,
91 		    const struct cfg80211_connect_params *req,
92 		    const struct osif_connect_params *params);
93 
94 /**
95  * osif_cm_disconnect() - Disconnect start request
96  * @dev: net dev
97  * @vdev: vdev pointer
98  * @reason: disconnect reason
99  *
100  * Return: int
101  */
102 int osif_cm_disconnect(struct net_device *dev, struct wlan_objmgr_vdev *vdev,
103 		       uint16_t reason);
104 
105 /**
106  * osif_cm_disconnect_sync() - Disconnect vdev and wait for it to complete
107  * @vdev: vdev pointer
108  * @reason: disconnect reason
109  *
110  * Return: int
111  */
112 int osif_cm_disconnect_sync(struct wlan_objmgr_vdev *vdev, uint16_t reason);
113 
114 #endif /* __OSIF_CM_REQ_H */
115