162306a36Sopenharmony_ci/* SPDX-License-Identifier: BSD-3-Clause-Clear */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
462306a36Sopenharmony_ci * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef ATH12K_PEER_H
862306a36Sopenharmony_ci#define ATH12K_PEER_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include "dp_rx.h"
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cistruct ppdu_user_delayba {
1362306a36Sopenharmony_ci	u16 sw_peer_id;
1462306a36Sopenharmony_ci	u32 info0;
1562306a36Sopenharmony_ci	u16 ru_end;
1662306a36Sopenharmony_ci	u16 ru_start;
1762306a36Sopenharmony_ci	u32 info1;
1862306a36Sopenharmony_ci	u32 rate_flags;
1962306a36Sopenharmony_ci	u32 resp_rate_flags;
2062306a36Sopenharmony_ci};
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cistruct ath12k_peer {
2362306a36Sopenharmony_ci	struct list_head list;
2462306a36Sopenharmony_ci	struct ieee80211_sta *sta;
2562306a36Sopenharmony_ci	int vdev_id;
2662306a36Sopenharmony_ci	u8 addr[ETH_ALEN];
2762306a36Sopenharmony_ci	int peer_id;
2862306a36Sopenharmony_ci	u16 ast_hash;
2962306a36Sopenharmony_ci	u8 pdev_idx;
3062306a36Sopenharmony_ci	u16 hw_peer_id;
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci	/* protected by ab->data_lock */
3362306a36Sopenharmony_ci	struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
3462306a36Sopenharmony_ci	struct ath12k_dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1];
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	/* Info used in MMIC verification of
3762306a36Sopenharmony_ci	 * RX fragments
3862306a36Sopenharmony_ci	 */
3962306a36Sopenharmony_ci	struct crypto_shash *tfm_mmic;
4062306a36Sopenharmony_ci	u8 mcast_keyidx;
4162306a36Sopenharmony_ci	u8 ucast_keyidx;
4262306a36Sopenharmony_ci	u16 sec_type;
4362306a36Sopenharmony_ci	u16 sec_type_grp;
4462306a36Sopenharmony_ci	struct ppdu_user_delayba ppdu_stats_delayba;
4562306a36Sopenharmony_ci	bool delayba_flag;
4662306a36Sopenharmony_ci	bool is_authorized;
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci	/* protected by ab->data_lock */
4962306a36Sopenharmony_ci	bool dp_setup_done;
5062306a36Sopenharmony_ci};
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_civoid ath12k_peer_unmap_event(struct ath12k_base *ab, u16 peer_id);
5362306a36Sopenharmony_civoid ath12k_peer_map_event(struct ath12k_base *ab, u8 vdev_id, u16 peer_id,
5462306a36Sopenharmony_ci			   u8 *mac_addr, u16 ast_hash, u16 hw_peer_id);
5562306a36Sopenharmony_cistruct ath12k_peer *ath12k_peer_find(struct ath12k_base *ab, int vdev_id,
5662306a36Sopenharmony_ci				     const u8 *addr);
5762306a36Sopenharmony_cistruct ath12k_peer *ath12k_peer_find_by_addr(struct ath12k_base *ab,
5862306a36Sopenharmony_ci					     const u8 *addr);
5962306a36Sopenharmony_cistruct ath12k_peer *ath12k_peer_find_by_id(struct ath12k_base *ab, int peer_id);
6062306a36Sopenharmony_civoid ath12k_peer_cleanup(struct ath12k *ar, u32 vdev_id);
6162306a36Sopenharmony_ciint ath12k_peer_delete(struct ath12k *ar, u32 vdev_id, u8 *addr);
6262306a36Sopenharmony_ciint ath12k_peer_create(struct ath12k *ar, struct ath12k_vif *arvif,
6362306a36Sopenharmony_ci		       struct ieee80211_sta *sta,
6462306a36Sopenharmony_ci		       struct ath12k_wmi_peer_create_arg *arg);
6562306a36Sopenharmony_ciint ath12k_wait_for_peer_delete_done(struct ath12k *ar, u32 vdev_id,
6662306a36Sopenharmony_ci				     const u8 *addr);
6762306a36Sopenharmony_cibool ath12k_peer_exist_by_vdev_id(struct ath12k_base *ab, int vdev_id);
6862306a36Sopenharmony_cistruct ath12k_peer *ath12k_peer_find_by_ast(struct ath12k_base *ab, int ast_hash);
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#endif /* _PEER_H_ */
71