1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4  * Copyright (c) 2021-2022 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 };
39 
40 void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id);
41 void ath11k_peer_map_event(struct ath11k_base *ab, u8 vdev_id, u16 peer_id,
42 			   u8 *mac_addr, u16 ast_hash, u16 hw_peer_id);
43 struct ath11k_peer *ath11k_peer_find(struct ath11k_base *ab, int vdev_id,
44 				     const u8 *addr);
45 struct ath11k_peer *ath11k_peer_find_by_addr(struct ath11k_base *ab,
46 					     const u8 *addr);
47 struct ath11k_peer *ath11k_peer_find_by_id(struct ath11k_base *ab, int peer_id);
48 void ath11k_peer_cleanup(struct ath11k *ar, u32 vdev_id);
49 int ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, u8 *addr);
50 int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif,
51 		       struct ieee80211_sta *sta, struct peer_create_params *param);
52 int ath11k_wait_for_peer_delete_done(struct ath11k *ar, u32 vdev_id,
53 				     const u8 *addr);
54 struct ath11k_peer *ath11k_peer_find_by_vdev_id(struct ath11k_base *ab,
55 						int vdev_id);
56 int ath11k_peer_rhash_tbl_init(struct ath11k_base *ab);
57 void ath11k_peer_rhash_tbl_destroy(struct ath11k_base *ab);
58 int ath11k_peer_rhash_delete(struct ath11k_base *ab, struct ath11k_peer *peer);
59 #endif /* _PEER_H_ */
60