Debian Codegraph @

drivers/net/wireless/ath/ath11k/dbring.h

raw
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
4 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
5 */
6
7 #ifndef ATH11K_DBRING_H
8 #define ATH11K_DBRING_H
9
10 #include <linux/types.h>
11 #include <linux/idr.h>
12 #include <linux/spinlock.h>
13 #include "dp.h"
14
15 struct ath11k_dbring_element {
16 dma_addr_t paddr;
17 u8 *payload;
18 };
19
20 struct ath11k_dbring_data {
21 void *data;
22 u32 data_sz;
23 struct wmi_dma_buf_release_meta_data meta;
24 struct ath11k_dbring_element *buff;
25 u32 buf_id;
26 };
27
28 struct ath11k_dbring_buf_release_event {
29 struct ath11k_wmi_dma_buf_release_fixed_param fixed;
30 struct wmi_dma_buf_release_entry *buf_entry;
31 struct wmi_dma_buf_release_meta_data *meta_data;
32 u32 num_buf_entry;
33 u32 num_meta;
34 };
35
36 struct ath11k_dbring_cap {
37 u32 pdev_id;
38 enum wmi_direct_buffer_module id;
39 u32 min_elem;
40 u32 min_buf_sz;
41 u32 min_buf_align;
42 };
43
44 struct ath11k_dbring {
45 struct dp_srng refill_srng;
46 struct idr bufs_idr;
47 /* Protects bufs_idr */
48 spinlock_t idr_lock;
49 dma_addr_t tp_addr;
50 dma_addr_t hp_addr;
51 int bufs_max;
52 u32 pdev_id;
53 u32 buf_sz;
54 u32 buf_align;
55 u32 num_resp_per_event;
56 u32 event_timeout_ms;
57 int (*handler)(struct ath11k *, struct ath11k_dbring_data *);
58 };
59
60 int ath11k_dbring_set_cfg(struct ath11k *ar,
61 struct ath11k_dbring *ring,
62 u32 num_resp_per_event,
63 u32 event_timeout_ms,
64 int (*handler)(struct ath11k *,
65 struct ath11k_dbring_data *));
66 int ath11k_dbring_bufs_replenish(struct ath11k *ar,
67 struct ath11k_dbring *ring,
68 struct ath11k_dbring_element *buff,
69 enum wmi_direct_buffer_module id);
70 int ath11k_dbring_wmi_cfg_setup(struct ath11k *ar,
71 struct ath11k_dbring *ring,
72 enum wmi_direct_buffer_module id);
73 int ath11k_dbring_buf_setup(struct ath11k *ar,
74 struct ath11k_dbring *ring,
75 struct ath11k_dbring_cap *db_cap);
76 int ath11k_dbring_srng_setup(struct ath11k *ar, struct ath11k_dbring *ring,
77 int ring_num, int num_entries);
78 int ath11k_dbring_buffer_release_event(struct ath11k_base *ab,
79 struct ath11k_dbring_buf_release_event *ev);
80 int ath11k_dbring_get_cap(struct ath11k_base *ab,
81 u8 pdev_idx,
82 enum wmi_direct_buffer_module id,
83 struct ath11k_dbring_cap *db_cap);
84 void ath11k_dbring_srng_cleanup(struct ath11k *ar, struct ath11k_dbring *ring);
85 void ath11k_dbring_buf_cleanup(struct ath11k *ar, struct ath11k_dbring *ring);
86 int ath11k_dbring_validate_buffer(struct ath11k *ar, void *data, u32 size);
87
88 #endif /* ATH11K_DBRING_H */