1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
7 #ifndef ATH11K_DBRING_H
8 #define ATH11K_DBRING_H
10 #include <linux/types.h>
11 #include <linux/idr.h>
12 #include <linux/spinlock.h>
15 struct ath11k_dbring_element {
20 struct ath11k_dbring_data {
23 struct wmi_dma_buf_release_meta_data meta;
26 struct ath11k_dbring_buf_release_event {
27 struct ath11k_wmi_dma_buf_release_fixed_param fixed;
28 struct wmi_dma_buf_release_entry *buf_entry;
29 struct wmi_dma_buf_release_meta_data *meta_data;
34 struct ath11k_dbring_cap {
36 enum wmi_direct_buffer_module id;
42 struct ath11k_dbring {
43 struct dp_srng refill_srng;
45 /* Protects bufs_idr */
53 u32 num_resp_per_event;
55 int (*handler)(struct ath11k *, struct ath11k_dbring_data *);
58 int ath11k_dbring_set_cfg(struct ath11k *ar,
59 struct ath11k_dbring *ring,
60 u32 num_resp_per_event,
62 int (*handler)(struct ath11k *,
63 struct ath11k_dbring_data *));
64 int ath11k_dbring_wmi_cfg_setup(struct ath11k *ar,
65 struct ath11k_dbring *ring,
66 enum wmi_direct_buffer_module id);
67 int ath11k_dbring_buf_setup(struct ath11k *ar,
68 struct ath11k_dbring *ring,
69 struct ath11k_dbring_cap *db_cap);
70 int ath11k_dbring_srng_setup(struct ath11k *ar, struct ath11k_dbring *ring,
71 int ring_num, int num_entries);
72 int ath11k_dbring_buffer_release_event(struct ath11k_base *ab,
73 struct ath11k_dbring_buf_release_event *ev);
74 int ath11k_dbring_get_cap(struct ath11k_base *ab,
76 enum wmi_direct_buffer_module id,
77 struct ath11k_dbring_cap *db_cap);
78 void ath11k_dbring_srng_cleanup(struct ath11k *ar, struct ath11k_dbring *ring);
79 void ath11k_dbring_buf_cleanup(struct ath11k *ar, struct ath11k_dbring *ring);
80 int ath11k_dbring_validate_buffer(struct ath11k *ar, void *data, u32 size);
82 #endif /* ATH11K_DBRING_H */