xref: /wlan-driver/qca-wifi-host-cmn/umac/wifi_pos/inc/wifi_pos_public_struct.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: wifi_pos_public_struct.h
19  * This file declares public structures of wifi positioning component
20  */
21 #ifndef _WIFI_POS_PUBLIC_STRUCT_H_
22 #define _WIFI_POS_PUBLIC_STRUCT_H_
23 
24 /* Include files */
25 #include "qdf_types.h"
26 #include "qdf_status.h"
27 #include "qdf_trace.h"
28 #include <wlan_cmn.h>
29 
30 #define WLAN_MAX_11AZ_PEERS 16
31 
32 /**
33  * enum wifi_pos_pasn_peer_type  - PASN peer type
34  * @WLAN_WIFI_POS_PASN_UNSECURE_PEER: Unsecure ranging peer
35  * @WLAN_WIFI_POS_PASN_SECURE_PEER: Secure ranging peer
36  * @WLAN_WIFI_POS_PASN_PEER_TYPE_MAX: Max peer type
37  */
38 enum wifi_pos_pasn_peer_type {
39 	WLAN_WIFI_POS_PASN_UNSECURE_PEER,
40 	WLAN_WIFI_POS_PASN_SECURE_PEER,
41 	WLAN_WIFI_POS_PASN_PEER_TYPE_MAX,
42 };
43 
44 /**
45  * enum wifi_pos_pasn_peer_delete_actions  - Actions on receiving a peer
46  * delete event for PASN peer
47  * @WIFI_POS_PEER_DELETE_ACTION_ALREADY_DELETED: Peer is already deleted at
48  * target. Cleanup the host objmgr peer.
49  * @WIFI_POS_PEER_DELETE_ACTION_FLUSH_KEYS: Flush the derived keys for this
50  * peer at userspace.
51  */
52 enum wifi_pos_pasn_peer_delete_actions {
53 	WIFI_POS_PEER_DELETE_ACTION_ALREADY_DELETED = BIT(0),
54 	WIFI_POS_PEER_DELETE_ACTION_FLUSH_KEYS = BIT(1),
55 };
56 
57 #define WIFI_POS_IS_PEER_ALREADY_DELETED(flag) \
58 			((flag) & WIFI_POS_PEER_DELETE_ACTION_ALREADY_DELETED)
59 #define WIFI_POS_IS_FLUSH_KEYS_REQUIRED(flag) \
60 			((flag) & WIFI_POS_PEER_DELETE_ACTION_FLUSH_KEYS)
61 
62 #define CFG_RESPONDER_11AZ_NTB_SUPPORT 0x1
63 #define CFG_RESPONDER_11AZ_TB_SUPPORT 0x2
64 #define CFG_RESPONDER_11AZ_MAX_SUPPORT (CFG_RESPONDER_11AZ_NTB_SUPPORT | \
65 		CFG_RESPONDER_11AZ_TB_SUPPORT)
66 /**
67  * struct wlan_pasn_request  - PASN peer create request data
68  * @peer_mac: Peer mac address
69  * @peer_type: Peer type of enum wifi_pos_pasn_peer_type
70  * @self_mac: Self mac address to be used for frame exchange & key
71  * derivation
72  * @force_self_mac_usage: If this flag is true, the supplicant
73  * should use the provided self mac address
74  * @is_ltf_keyseed_required: Is set LTF keyseed required
75  * @control_flags: Control flags to indicate if its required to flush
76  * the keys
77  */
78 struct wlan_pasn_request {
79 	struct qdf_mac_addr peer_mac;
80 	enum wifi_pos_pasn_peer_type peer_type;
81 	struct qdf_mac_addr self_mac;
82 	bool force_self_mac_usage;
83 	bool is_ltf_keyseed_required;
84 	uint16_t control_flags;
85 };
86 
87 /**
88  * struct wifi_pos_11az_context  - 11az Security context
89  * @secure_peer_list: Mac address list of secure peers
90  * @num_secure_peers: Total number of secure peers
91  * @unsecure_peer_list: Mac address list of unsecure peers
92  * @num_unsecure_peers: Total number of unsecure peers
93  * @failed_peer_list: List of failed peers
94  * @num_failed_peers: Total number of failed peers
95  * @num_pending_peer_creation: Number of pending peer create commands for which
96  * peer create confirmation is pending.
97  */
98 struct wifi_pos_11az_context {
99 	struct wlan_pasn_request secure_peer_list[WLAN_MAX_11AZ_PEERS];
100 	uint8_t num_secure_peers;
101 	struct wlan_pasn_request unsecure_peer_list[WLAN_MAX_11AZ_PEERS];
102 	uint8_t num_unsecure_peers;
103 	struct qdf_mac_addr failed_peer_list[WLAN_MAX_11AZ_PEERS];
104 	uint8_t num_failed_peers;
105 	uint8_t num_pending_peer_creation;
106 };
107 
108 /**
109  * struct wifi_pos_vdev_priv_obj  - Wifi Pos module vdev private object
110  * @pasn_context: 11az security peers context.
111  * @num_pasn_peers: Total number of PASN peers
112  * @is_delete_all_pasn_peer_in_progress: Delete all the VDEV PASN peers in
113  * progress
114  */
115 struct wifi_pos_vdev_priv_obj {
116 	struct wifi_pos_11az_context pasn_context;
117 	uint8_t num_pasn_peers;
118 	bool is_delete_all_pasn_peer_in_progress;
119 };
120 
121 /**
122  * enum wlan_pasn_auth_status_code  - PASN auth status code
123  * @WLAN_PASN_AUTH_STATUS_SUCCESS: PASN auth is successful
124  * @WLAN_PASN_AUTH_STATUS_PASN_FAILED: PASN authentication failed
125  * @WLAN_PASN_AUTH_STATUS_PEER_CREATE_FAILED: PASN peer create confirm received
126  * with failure status.
127  * @WLAN_PASN_AUTH_STATUS_PEER_ALREADY_EXISTS: Peer already exists
128  * @WLAN_PASN_AUTH_STATUS_HOST_INTERNAL_ERROR: WLAN driver internal error
129  */
130 enum wlan_pasn_auth_status_code {
131 	WLAN_PASN_AUTH_STATUS_SUCCESS = 0,
132 	WLAN_PASN_AUTH_STATUS_PASN_FAILED = 1,
133 	WLAN_PASN_AUTH_STATUS_PEER_CREATE_FAILED = 2,
134 	WLAN_PASN_AUTH_STATUS_PEER_ALREADY_EXISTS = 3,
135 	WLAN_PASN_AUTH_STATUS_HOST_INTERNAL_ERROR = 4,
136 };
137 
138 /**
139  * struct wlan_pasn_auth_status_peer_info - PASN authentication status peer
140  * info
141  * @peer_mac: Peer mac address
142  * @self_mac: Self mac address
143  * @status: PASN auth status code
144  */
145 struct wlan_pasn_auth_status_peer_info {
146 	struct qdf_mac_addr peer_mac;
147 	struct qdf_mac_addr self_mac;
148 	enum wlan_pasn_auth_status_code status;
149 };
150 
151 /**
152  * struct wlan_pasn_auth_status  - PASN authentication status
153  * @vdev_id:  vdev_id
154  * @num_peers: Number of peers for which auth status is to be sent
155  * @auth_status: Auth status details
156  */
157 struct wlan_pasn_auth_status {
158 	uint8_t vdev_id;
159 	uint8_t num_peers;
160 	struct wlan_pasn_auth_status_peer_info auth_status[WLAN_MAX_11AZ_PEERS];
161 };
162 
163 /**
164  * struct wlan_wifi_pos_peer_priv_obj - WLAN wifi pos peer private object
165  * @is_ltf_keyseed_required: Is LTF keyseed required for peer
166  */
167 struct wlan_wifi_pos_peer_priv_obj {
168 	bool is_ltf_keyseed_required;
169 };
170 #endif /* _WIFI_POS_PUBLIC_STRUCT_H_ */
171