This source file includes following definitions.
- async_tx_issue_pending
- async_tx_issue_pending_all
- async_tx_issue_pending
- async_tx_find_channel
- async_tx_sync_epilog
- init_async_submit
1
2
3
4
5 #ifndef _ASYNC_TX_H_
6 #define _ASYNC_TX_H_
7 #include <linux/dmaengine.h>
8 #include <linux/spinlock.h>
9 #include <linux/interrupt.h>
10
11
12
13
14 #ifdef CONFIG_HAS_DMA
15 #define __async_inline
16 #else
17 #define __async_inline __always_inline
18 #endif
19
20
21
22
23
24
25
26
27
28
29 struct dma_chan_ref {
30 struct dma_chan *chan;
31 struct list_head node;
32 struct rcu_head rcu;
33 atomic_t count;
34 };
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 enum async_tx_flags {
54 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
55 ASYNC_TX_XOR_DROP_DST = (1 << 1),
56 ASYNC_TX_ACK = (1 << 2),
57 ASYNC_TX_FENCE = (1 << 3),
58 ASYNC_TX_PQ_XOR_DST = (1 << 4),
59 };
60
61
62
63
64
65
66
67
68
69 struct async_submit_ctl {
70 enum async_tx_flags flags;
71 struct dma_async_tx_descriptor *depend_tx;
72 dma_async_tx_callback cb_fn;
73 void *cb_param;
74 void *scribble;
75 };
76
77 #if defined(CONFIG_DMA_ENGINE) && !defined(CONFIG_ASYNC_TX_CHANNEL_SWITCH)
78 #define async_tx_issue_pending_all dma_issue_pending_all
79
80
81
82
83
84
85
86
87
88 static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
89 {
90 if (likely(tx)) {
91 struct dma_chan *chan = tx->chan;
92 struct dma_device *dma = chan->device;
93
94 dma->device_issue_pending(chan);
95 }
96 }
97 #ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
98 #include <asm/async_tx.h>
99 #else
100 #define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \
101 __async_tx_find_channel(dep, type)
102 struct dma_chan *
103 __async_tx_find_channel(struct async_submit_ctl *submit,
104 enum dma_transaction_type tx_type);
105 #endif
106 #else
107 static inline void async_tx_issue_pending_all(void)
108 {
109 do { } while (0);
110 }
111
112 static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
113 {
114 do { } while (0);
115 }
116
117 static inline struct dma_chan *
118 async_tx_find_channel(struct async_submit_ctl *submit,
119 enum dma_transaction_type tx_type, struct page **dst,
120 int dst_count, struct page **src, int src_count,
121 size_t len)
122 {
123 return NULL;
124 }
125 #endif
126
127
128
129
130
131
132 static inline void
133 async_tx_sync_epilog(struct async_submit_ctl *submit)
134 {
135 if (submit->cb_fn)
136 submit->cb_fn(submit->cb_param);
137 }
138
139 typedef union {
140 unsigned long addr;
141 struct page *page;
142 dma_addr_t dma;
143 } addr_conv_t;
144
145 static inline void
146 init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags,
147 struct dma_async_tx_descriptor *tx,
148 dma_async_tx_callback cb_fn, void *cb_param,
149 addr_conv_t *scribble)
150 {
151 args->flags = flags;
152 args->depend_tx = tx;
153 args->cb_fn = cb_fn;
154 args->cb_param = cb_param;
155 args->scribble = scribble;
156 }
157
158 void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx,
159 struct async_submit_ctl *submit);
160
161 struct dma_async_tx_descriptor *
162 async_xor(struct page *dest, struct page **src_list, unsigned int offset,
163 int src_cnt, size_t len, struct async_submit_ctl *submit);
164
165 struct dma_async_tx_descriptor *
166 async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
167 int src_cnt, size_t len, enum sum_check_flags *result,
168 struct async_submit_ctl *submit);
169
170 struct dma_async_tx_descriptor *
171 async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
172 unsigned int src_offset, size_t len,
173 struct async_submit_ctl *submit);
174
175 struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit);
176
177 struct dma_async_tx_descriptor *
178 async_gen_syndrome(struct page **blocks, unsigned int offset, int src_cnt,
179 size_t len, struct async_submit_ctl *submit);
180
181 struct dma_async_tx_descriptor *
182 async_syndrome_val(struct page **blocks, unsigned int offset, int src_cnt,
183 size_t len, enum sum_check_flags *pqres, struct page *spare,
184 struct async_submit_ctl *submit);
185
186 struct dma_async_tx_descriptor *
187 async_raid6_2data_recov(int src_num, size_t bytes, int faila, int failb,
188 struct page **ptrs, struct async_submit_ctl *submit);
189
190 struct dma_async_tx_descriptor *
191 async_raid6_datap_recov(int src_num, size_t bytes, int faila,
192 struct page **ptrs, struct async_submit_ctl *submit);
193
194 void async_tx_quiesce(struct dma_async_tx_descriptor **tx);
195 #endif