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 	/* protected by ab->data_lock */
49 	bool dp_setup_done;
50 };
51 
52 void ath12k_peer_unmap_event(struct ath12k_base *ab, u16 peer_id);
53 void ath12k_peer_map_event(struct ath12k_base *ab, u8 vdev_id, u16 peer_id,
54 			   u8 *mac_addr, u16 ast_hash, u16 hw_peer_id);
55 struct ath12k_peer *ath12k_peer_find(struct ath12k_base *ab, int vdev_id,
56 				     const u8 *addr);
57 struct ath12k_peer *ath12k_peer_find_by_addr(struct ath12k_base *ab,
58 					     const u8 *addr);
59 struct ath12k_peer *ath12k_peer_find_by_id(struct ath12k_base *ab, int peer_id);
60 void ath12k_peer_cleanup(struct ath12k *ar, u32 vdev_id);
61 int ath12k_peer_delete(struct ath12k *ar, u32 vdev_id, u8 *addr);
62 int ath12k_peer_create(struct ath12k *ar, struct ath12k_vif *arvif,
63 		       struct ieee80211_sta *sta,
64 		       struct ath12k_wmi_peer_create_arg *arg);
65 int ath12k_wait_for_peer_delete_done(struct ath12k *ar, u32 vdev_id,
66 				     const u8 *addr);
67 bool ath12k_peer_exist_by_vdev_id(struct ath12k_base *ab, int vdev_id);
68 struct ath12k_peer *ath12k_peer_find_by_ast(struct ath12k_base *ab, int ast_hash);
69 
70 #endif /* _PEER_H_ */
71