xref: /linux/drivers/net/wireless/ath/ath11k/peer.h (revision 40d269c000bda9fcd276a0412a9cebd3f6e344c5)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
5  */
6 
7 #ifndef ATH11K_PEER_H
8 #define ATH11K_PEER_H
9 
10 struct ath11k_peer {
11 	struct list_head list;
12 	struct ieee80211_sta *sta;
13 	int vdev_id;
14 	u8 addr[ETH_ALEN];
15 	int peer_id;
16 	u16 ast_hash;
17 	u8 pdev_idx;
18 	u16 hw_peer_id;
19 
20 	/* protected by ab->data_lock */
21 	struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
22 	struct dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1];
23 
24 	/* peer id based rhashtable list pointer */
25 	struct rhash_head rhash_id;
26 	/* peer addr based rhashtable list pointer */
27 	struct rhash_head rhash_addr;
28 
29 	/* Info used in MMIC verification of
30 	 * RX fragments
31 	 */
32 	struct crypto_shash *tfm_mmic;
33 	u8 mcast_keyidx;
34 	u8 ucast_keyidx;
35 	u16 sec_type;
36 	u16 sec_type_grp;
37 	bool is_authorized;
38 	bool dp_setup_done;
39 };
40 
41 void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id);
42 void ath11k_peer_map_event(struct ath11k_base *ab, u8 vdev_id, u16 peer_id,
43 			   u8 *mac_addr, u16 ast_hash, u16 hw_peer_id);
44 struct ath11k_peer *ath11k_peer_find(struct ath11k_base *ab, int vdev_id,
45 				     const u8 *addr);
46 struct ath11k_peer *ath11k_peer_find_by_addr(struct ath11k_base *ab,
47 					     const u8 *addr);
48 struct ath11k_peer *ath11k_peer_find_by_id(struct ath11k_base *ab, int peer_id);
49 void ath11k_peer_cleanup(struct ath11k *ar, u32 vdev_id);
50 int ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, u8 *addr);
51 int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif,
52 		       struct ieee80211_sta *sta, struct peer_create_params *param);
53 int ath11k_wait_for_peer_delete_done(struct ath11k *ar, u32 vdev_id,
54 				     const u8 *addr);
55 struct ath11k_peer *ath11k_peer_find_by_vdev_id(struct ath11k_base *ab,
56 						int vdev_id);
57 int ath11k_peer_rhash_tbl_init(struct ath11k_base *ab);
58 void ath11k_peer_rhash_tbl_destroy(struct ath11k_base *ab);
59 int ath11k_peer_rhash_delete(struct ath11k_base *ab, struct ath11k_peer *peer);
60 #endif /* _PEER_H_ */
61