xref: /wlan-driver/qcacld-3.0/components/denylist_mgr/dispatcher/inc/wlan_dlm_public_struct.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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  * DOC: define public structures of denylist mgr.
21  */
22 
23 #ifndef _WLAN_DLM_PUBLIC_STRUCT_H
24 #define _WLAN_DLM_PUBLIC_STRUCT_H
25 
26 #include <qdf_types.h>
27 #include "wlan_objmgr_pdev_obj.h"
28 
29 #define MAX_BAD_AP_LIST_SIZE               28
30 #define MAX_RSSI_AVOID_BSSID_LIST          10
31 #define PDEV_MAX_NUM_BSSID_DISALLOW_LIST   28
32 
33 /**
34  * enum dlm_reject_ap_source - Source of adding BSSID to DLM
35  * @ADDED_BY_DRIVER: Source adding this BSSID is driver
36  * @ADDED_BY_TARGET: Source adding this BSSID is target
37  */
38 enum dlm_reject_ap_source {
39 	ADDED_BY_DRIVER = 1,
40 	ADDED_BY_TARGET,
41 };
42 
43 /**
44  * struct dlm_rssi_disallow_params - structure to specify params for RSSI
45  * reject
46  * @retry_delay: Time before which the AP doesn't expect a connection.
47  * @expected_rssi: RSSI less than which only the STA should try association
48  * @received_time: Time at which the AP was added to denylist.
49  * @original_timeout: Original timeout which the AP sent while denylisting.
50  * @source: Source of adding this BSSID to RSSI reject list
51  */
52 struct dlm_rssi_disallow_params {
53 	uint32_t retry_delay;
54 	int8_t expected_rssi;
55 	qdf_time_t received_time;
56 	uint32_t original_timeout;
57 	enum dlm_reject_ap_source source;
58 };
59 
60 /**
61  * enum dlm_reject_ap_type - Rejection type of the AP
62  * @USERSPACE_AVOID_TYPE: userspace wants the AP to be avoided.
63  * @USERSPACE_DENYLIST_TYPE: userspace wants the AP to be denylisted.
64  * @DRIVER_AVOID_TYPE: driver wants the AP to be avoided.
65  * @DRIVER_DENYLIST_TYPE: driver wants the AP to be denylisted.
66  * @DRIVER_RSSI_REJECT_TYPE: driver wants the AP to be in driver rssi
67  * reject.
68  * @DRIVER_MONITOR_TYPE: driver wants the AP to be in monitor list.
69  * @REJECT_REASON_UNKNOWN: Rejection reason unknown
70  */
71 enum dlm_reject_ap_type {
72 	USERSPACE_AVOID_TYPE     = 0,
73 	USERSPACE_DENYLIST_TYPE  = 1,
74 	DRIVER_AVOID_TYPE        = 2,
75 	DRIVER_DENYLIST_TYPE     = 3,
76 	DRIVER_RSSI_REJECT_TYPE  = 4,
77 	DRIVER_MONITOR_TYPE      = 5,
78 	REJECT_REASON_UNKNOWN    = 6,
79 };
80 
81 /**
82  * enum dlm_reject_ap_reason - Rejection reason for adding BSSID to DLM
83  * @REASON_UNKNOWN: Unknown reason
84  * @REASON_NUD_FAILURE: NUD failure happened with this BSSID
85  * @REASON_STA_KICKOUT: STA kickout happened with this BSSID
86  * @REASON_ROAM_HO_FAILURE: HO failure happenend with this BSSID
87  * @REASON_ASSOC_REJECT_POOR_RSSI: assoc rsp with reason 71 received from
88  * AP.
89  * @REASON_ASSOC_REJECT_OCE: OCE assoc reject received from the AP.
90  * @REASON_USERSPACE_BL: Userspace wants to denylist this AP.
91  * @REASON_USERSPACE_AVOID_LIST: Userspace wants to avoid this AP.
92  * @REASON_BTM_DISASSOC_IMMINENT: BTM IE received with disassoc imminent
93  * set.
94  * @REASON_BTM_BSS_TERMINATION: BTM IE received with BSS termination set.
95  * @REASON_BTM_MBO_RETRY: BTM IE received from AP with MBO retry set.
96  * @REASON_REASSOC_RSSI_REJECT: Re-Assoc resp received with reason code 34
97  * @REASON_REASSOC_NO_MORE_STAS: Re-assoc reject received with reason code
98  * 17
99  */
100 enum dlm_reject_ap_reason {
101 	REASON_UNKNOWN = 0,
102 	REASON_NUD_FAILURE,
103 	REASON_STA_KICKOUT,
104 	REASON_ROAM_HO_FAILURE,
105 	REASON_ASSOC_REJECT_POOR_RSSI,
106 	REASON_ASSOC_REJECT_OCE,
107 	REASON_USERSPACE_BL,
108 	REASON_USERSPACE_AVOID_LIST,
109 	REASON_BTM_DISASSOC_IMMINENT,
110 	REASON_BTM_BSS_TERMINATION,
111 	REASON_BTM_MBO_RETRY,
112 	REASON_REASSOC_RSSI_REJECT,
113 	REASON_REASSOC_NO_MORE_STAS,
114 };
115 
116 /**
117  * enum dlm_connection_state - State with AP (Connected, Disconnected)
118  * @DLM_AP_CONNECTED: Connected with the AP
119  * @DLM_AP_DISCONNECTED: Disconnected with the AP
120  */
121 enum dlm_connection_state {
122 	DLM_AP_CONNECTED,
123 	DLM_AP_DISCONNECTED,
124 };
125 
126 /**
127  * struct reject_ap_config_params - Structure to send reject ap list to FW
128  * @bssid: BSSID of the AP
129  * @reject_ap_type: Type of the rejection done with the BSSID
130  * @reject_duration: time left till the AP is in the reject list.
131  * @expected_rssi: expected RSSI when the AP expects the connection to be
132  * made.
133  * @reject_reason: reason to add the BSSID to DLM
134  * @source: Source of adding the BSSID to DLM
135  * @received_time: Time at which the AP was added to denylist.
136  * @original_timeout: Original timeout which the AP sent while denylisting.
137  */
138 struct reject_ap_config_params {
139 	struct qdf_mac_addr bssid;
140 	enum dlm_reject_ap_type reject_ap_type;
141 	uint32_t reject_duration;
142 	int32_t expected_rssi;
143 	enum dlm_reject_ap_reason reject_reason;
144 	enum dlm_reject_ap_source source;
145 	qdf_time_t received_time;
146 	uint32_t original_timeout;
147 };
148 
149 /**
150  * struct reject_ap_params - Struct to send bssid list and there num to FW
151  * @num_of_reject_bssid: num of bssid params there in bssid config.
152  * @bssid_list: Pointer to the bad bssid list
153  */
154 struct reject_ap_params {
155 	uint8_t num_of_reject_bssid;
156 	struct reject_ap_config_params *bssid_list;
157 };
158 
159 /**
160  * struct wlan_dlm_tx_ops - structure of tx operation function
161  * pointers for denylist manager component
162  * @dlm_send_reject_ap_list: send reject ap list to fw
163  */
164 struct wlan_dlm_tx_ops {
165 	QDF_STATUS (*dlm_send_reject_ap_list)(struct wlan_objmgr_pdev *pdev,
166 					struct reject_ap_params *reject_params);
167 };
168 
169 /**
170  * struct reject_ap_info - structure to specify the reject ap info.
171  * @bssid: BSSID of the AP.
172  * @rssi_reject_params: RSSI reject params of the AP is of type RSSI reject
173  * @reject_ap_type: Reject type of AP (eg. avoid, denylist, rssi reject
174  * etc.)
175  * @reject_reason: reason to add the BSSID to DLM
176  * @source: Source of adding the BSSID to DLM
177  */
178 struct reject_ap_info {
179 	struct qdf_mac_addr bssid;
180 	struct dlm_rssi_disallow_params rssi_reject_params;
181 	enum dlm_reject_ap_type reject_ap_type;
182 	enum dlm_reject_ap_reason reject_reason;
183 	enum dlm_reject_ap_source source;
184 };
185 
186 #endif
187