1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 /* 3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 4 * Copyright (c) 2021-2024 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 #define ATH12K_PEER_ML_ID_VALID BIT(13) 23 24 struct ath12k_peer { 25 struct list_head list; 26 struct ieee80211_sta *sta; 27 int vdev_id; 28 u8 addr[ETH_ALEN]; 29 int peer_id; 30 u16 ast_hash; 31 u8 pdev_idx; 32 u16 hw_peer_id; 33 34 /* protected by ab->data_lock */ 35 struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1]; 36 struct ath12k_dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1]; 37 38 /* Info used in MMIC verification of 39 * RX fragments 40 */ 41 struct crypto_shash *tfm_mmic; 42 u8 mcast_keyidx; 43 u8 ucast_keyidx; 44 u16 sec_type; 45 u16 sec_type_grp; 46 struct ppdu_user_delayba ppdu_stats_delayba; 47 bool delayba_flag; 48 bool is_authorized; 49 bool mlo; 50 /* protected by ab->data_lock */ 51 bool dp_setup_done; 52 53 u16 ml_id; 54 55 /* any other ML info common for all partners can be added 56 * here and would be same for all partner peers. 57 */ 58 u8 ml_addr[ETH_ALEN]; 59 60 /* To ensure only certain work related to dp is done once */ 61 bool primary_link; 62 63 /* for reference to ath12k_link_sta */ 64 u8 link_id; 65 }; 66 67 struct ath12k_ml_peer { 68 struct list_head list; 69 u8 addr[ETH_ALEN]; 70 u16 id; 71 }; 72 73 void ath12k_peer_unmap_event(struct ath12k_base *ab, u16 peer_id); 74 void ath12k_peer_map_event(struct ath12k_base *ab, u8 vdev_id, u16 peer_id, 75 u8 *mac_addr, u16 ast_hash, u16 hw_peer_id); 76 struct ath12k_peer *ath12k_peer_find(struct ath12k_base *ab, int vdev_id, 77 const u8 *addr); 78 struct ath12k_peer *ath12k_peer_find_by_addr(struct ath12k_base *ab, 79 const u8 *addr); 80 struct ath12k_peer *ath12k_peer_find_by_id(struct ath12k_base *ab, int peer_id); 81 void ath12k_peer_cleanup(struct ath12k *ar, u32 vdev_id); 82 int ath12k_peer_delete(struct ath12k *ar, u32 vdev_id, u8 *addr); 83 int ath12k_peer_create(struct ath12k *ar, struct ath12k_link_vif *arvif, 84 struct ieee80211_sta *sta, 85 struct ath12k_wmi_peer_create_arg *arg); 86 int ath12k_wait_for_peer_delete_done(struct ath12k *ar, u32 vdev_id, 87 const u8 *addr); 88 bool ath12k_peer_exist_by_vdev_id(struct ath12k_base *ab, int vdev_id); 89 struct ath12k_peer *ath12k_peer_find_by_ast(struct ath12k_base *ab, int ast_hash); 90 int ath12k_peer_ml_create(struct ath12k_hw *ah, struct ieee80211_sta *sta); 91 int ath12k_peer_ml_delete(struct ath12k_hw *ah, struct ieee80211_sta *sta); 92 int ath12k_peer_mlo_link_peers_delete(struct ath12k_vif *ahvif, struct ath12k_sta *ahsta); 93 94 #endif /* _PEER_H_ */ 95