xref: /wlan-dirver/qca-wifi-host-cmn/umac/wifi_pos/inc/wifi_pos_public_struct.h (revision 901120c066e139c7f8a2c8e4820561fdd83c67ef)
1 /*
2  * Copyright (c) 2022 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 /**
63  * struct wlan_pasn_request  - PASN peer create request data
64  * @peer_mac: Peer mac address
65  * @peer_type: Peer type of enum wifi_pos_pasn_peer_type
66  * @self_mac: Self mac address to be used for frame exchange & key
67  * derivation
68  * @force_self_mac_usage: If this flag is true, the supplicant
69  * should use the provided self mac address
70  * @is_ltf_keyseed_required: Is set LTF keyseed required
71  * @control_flags: Control flags to indicate if its required to flush
72  * the keys
73  */
74 struct wlan_pasn_request {
75 	struct qdf_mac_addr peer_mac;
76 	enum wifi_pos_pasn_peer_type peer_type;
77 	struct qdf_mac_addr self_mac;
78 	bool force_self_mac_usage;
79 	bool is_ltf_keyseed_required;
80 	uint16_t control_flags;
81 };
82 
83 /**
84  * struct wifi_pos_11az_context  - 11az Security context
85  * @secure_peer_list: Mac address list of secure peers
86  * @num_secure_peers: Total number of secure peers
87  * @unsecure_peer_list: Mac address list of unsecure peers
88  * @num_unsecure_peers: Total number of unsecure peers
89  * @failed_peer_list: List of failed peers
90  * @num_failed_peers: Total number of failed peers
91  * @num_pending_peer_creation: Number of pending peer create commands for which
92  * peer create confirmation is pending.
93  */
94 struct wifi_pos_11az_context {
95 	struct wlan_pasn_request secure_peer_list[WLAN_MAX_11AZ_PEERS];
96 	uint8_t num_secure_peers;
97 	struct wlan_pasn_request unsecure_peer_list[WLAN_MAX_11AZ_PEERS];
98 	uint8_t num_unsecure_peers;
99 	struct qdf_mac_addr failed_peer_list[WLAN_MAX_11AZ_PEERS];
100 	uint8_t num_failed_peers;
101 	uint8_t num_pending_peer_creation;
102 };
103 
104 /**
105  * struct wifi_pos_vdev_priv_obj  - Wifi Pos module vdev private object
106  * @pasn_context: 11az security peers context.
107  * @num_pasn_peers: Total number of PASN peers
108  * @is_delete_all_pasn_peer_in_progress: Delete all the VDEV PASN peers in
109  * progress
110  */
111 struct wifi_pos_vdev_priv_obj {
112 	struct wifi_pos_11az_context pasn_context;
113 	uint8_t num_pasn_peers;
114 	bool is_delete_all_pasn_peer_in_progress;
115 };
116 
117 /**
118  * enum wlan_pasn_auth_status_code  - PASN auth status code
119  * @WLAN_PASN_AUTH_STATUS_SUCCESS: PASN auth is successful
120  * @WLAN_PASN_AUTH_STATUS_PASN_FAILED: PASN authentication failed
121  * @WLAN_PASN_AUTH_STATUS_PEER_CREATE_FAILED: PASN peer create confirm received
122  * with failure status.
123  * @WLAN_PASN_AUTH_STATUS_PEER_ALREADY_EXISTS: Peer already exists
124  * @WLAN_PASN_AUTH_STATUS_HOST_INTERNAL_ERROR: WLAN driver internal error
125  */
126 enum wlan_pasn_auth_status_code {
127 	WLAN_PASN_AUTH_STATUS_SUCCESS = 0,
128 	WLAN_PASN_AUTH_STATUS_PASN_FAILED = 1,
129 	WLAN_PASN_AUTH_STATUS_PEER_CREATE_FAILED = 2,
130 	WLAN_PASN_AUTH_STATUS_PEER_ALREADY_EXISTS = 3,
131 	WLAN_PASN_AUTH_STATUS_HOST_INTERNAL_ERROR = 4,
132 };
133 
134 /**
135  * struct wlan_pasn_auth_status_peer_info - PASN authentication status peer
136  * info
137  * @peer_mac: Peer mac address
138  * @self_mac: Self mac address
139  * @status: PASN auth status code
140  */
141 struct wlan_pasn_auth_status_peer_info {
142 	struct qdf_mac_addr peer_mac;
143 	struct qdf_mac_addr self_mac;
144 	enum wlan_pasn_auth_status_code status;
145 };
146 
147 /**
148  * struct wlan_pasn_auth_status  - PASN authentication status
149  * @vdev_id:  vdev_id
150  * @num_peers: Number of peers for which auth status is to be sent
151  * @auth_status: Auth status details
152  */
153 struct wlan_pasn_auth_status {
154 	uint8_t vdev_id;
155 	uint8_t num_peers;
156 	struct wlan_pasn_auth_status_peer_info auth_status[WLAN_MAX_11AZ_PEERS];
157 };
158 
159 /**
160  * struct wlan_wifi_pos_peer_priv_obj - WLAN wifi pos peer private object
161  * @is_ltf_keyseed_required: Is LTF keyseed required for peer
162  */
163 struct wlan_wifi_pos_peer_priv_obj {
164 	bool is_ltf_keyseed_required;
165 };
166 #endif /* _WIFI_POS_PUBLIC_STRUCT_H_ */
167