xref: /freebsd/sys/contrib/dev/athk/ath12k/peer.h (revision 2008043f386721d58158e37e0d7e50df8095942d)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
5  */
6 
7 #ifndef ATH12K_PEER_H
8 #define ATH12K_PEER_H
9 
10 #include "dp_rx.h"
11 
12 struct ppdu_user_delayba {
13 	u16 sw_peer_id;
14 	u32 info0;
15 	u16 ru_end;
16 	u16 ru_start;
17 	u32 info1;
18 	u32 rate_flags;
19 	u32 resp_rate_flags;
20 };
21 
22 struct ath12k_peer {
23 	struct list_head list;
24 	struct ieee80211_sta *sta;
25 	int vdev_id;
26 	u8 addr[ETH_ALEN];
27 	int peer_id;
28 	u16 ast_hash;
29 	u8 pdev_idx;
30 	u16 hw_peer_id;
31 
32 	/* protected by ab->data_lock */
33 	struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
34 	struct ath12k_dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1];
35 
36 	/* Info used in MMIC verification of
37 	 * RX fragments
38 	 */
39 	struct crypto_shash *tfm_mmic;
40 	u8 mcast_keyidx;
41 	u8 ucast_keyidx;
42 	u16 sec_type;
43 	u16 sec_type_grp;
44 	struct ppdu_user_delayba ppdu_stats_delayba;
45 	bool delayba_flag;
46 	bool is_authorized;
47 };
48 
49 void ath12k_peer_unmap_event(struct ath12k_base *ab, u16 peer_id);
50 void ath12k_peer_map_event(struct ath12k_base *ab, u8 vdev_id, u16 peer_id,
51 			   u8 *mac_addr, u16 ast_hash, u16 hw_peer_id);
52 struct ath12k_peer *ath12k_peer_find(struct ath12k_base *ab, int vdev_id,
53 				     const u8 *addr);
54 struct ath12k_peer *ath12k_peer_find_by_addr(struct ath12k_base *ab,
55 					     const u8 *addr);
56 struct ath12k_peer *ath12k_peer_find_by_id(struct ath12k_base *ab, int peer_id);
57 void ath12k_peer_cleanup(struct ath12k *ar, u32 vdev_id);
58 int ath12k_peer_delete(struct ath12k *ar, u32 vdev_id, u8 *addr);
59 int ath12k_peer_create(struct ath12k *ar, struct ath12k_vif *arvif,
60 		       struct ieee80211_sta *sta,
61 		       struct ath12k_wmi_peer_create_arg *arg);
62 int ath12k_wait_for_peer_delete_done(struct ath12k *ar, u32 vdev_id,
63 				     const u8 *addr);
64 bool ath12k_peer_exist_by_vdev_id(struct ath12k_base *ab, int vdev_id);
65 struct ath12k_peer *ath12k_peer_find_by_ast(struct ath12k_base *ab, int ast_hash);
66 
67 #endif /* _PEER_H_ */
68