aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/async_tx.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-09-08 20:42:29 -0400
committerDan Williams <dan.j.williams@intel.com>2009-09-08 20:42:29 -0400
commitf9dd2134374c8de6b911e2b8652c6c9622eaa658 (patch)
treec1b8f8d622941606b9e7247ab31d811ba4295011 /include/linux/async_tx.h
parent4b652f0db3be891c7b76b109c3b55003b920fc96 (diff)
parent07a3b417dc3d00802bd7b4874c3e811f0b015a7d (diff)
Merge branch 'md-raid6-accel' into ioat3.2
Conflicts: include/linux/dmaengine.h
Diffstat (limited to 'include/linux/async_tx.h')
-rw-r--r--include/linux/async_tx.h126
1 files changed, 94 insertions, 32 deletions
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 5fc2ef8d97fa..866e61c4e2e0 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -58,25 +58,57 @@ struct dma_chan_ref {
58 * array. 58 * array.
59 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a 59 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a
60 * dependency chain 60 * dependency chain
61 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining.
62 */ 61 */
63enum async_tx_flags { 62enum async_tx_flags {
64 ASYNC_TX_XOR_ZERO_DST = (1 << 0), 63 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
65 ASYNC_TX_XOR_DROP_DST = (1 << 1), 64 ASYNC_TX_XOR_DROP_DST = (1 << 1),
66 ASYNC_TX_ACK = (1 << 3), 65 ASYNC_TX_ACK = (1 << 2),
67 ASYNC_TX_DEP_ACK = (1 << 4), 66};
67
68/**
69 * struct async_submit_ctl - async_tx submission/completion modifiers
70 * @flags: submission modifiers
71 * @depend_tx: parent dependency of the current operation being submitted
72 * @cb_fn: callback routine to run at operation completion
73 * @cb_param: parameter for the callback routine
74 * @scribble: caller provided space for dma/page address conversions
75 */
76struct async_submit_ctl {
77 enum async_tx_flags flags;
78 struct dma_async_tx_descriptor *depend_tx;
79 dma_async_tx_callback cb_fn;
80 void *cb_param;
81 void *scribble;
68}; 82};
69 83
70#ifdef CONFIG_DMA_ENGINE 84#ifdef CONFIG_DMA_ENGINE
71#define async_tx_issue_pending_all dma_issue_pending_all 85#define async_tx_issue_pending_all dma_issue_pending_all
86
87/**
88 * async_tx_issue_pending - send pending descriptor to the hardware channel
89 * @tx: descriptor handle to retrieve hardware context
90 *
91 * Note: any dependent operations will have already been issued by
92 * async_tx_channel_switch, or (in the case of no channel switch) will
93 * be already pending on this channel.
94 */
95static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
96{
97 if (likely(tx)) {
98 struct dma_chan *chan = tx->chan;
99 struct dma_device *dma = chan->device;
100
101 dma->device_issue_pending(chan);
102 }
103}
72#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL 104#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
73#include <asm/async_tx.h> 105#include <asm/async_tx.h>
74#else 106#else
75#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ 107#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \
76 __async_tx_find_channel(dep, type) 108 __async_tx_find_channel(dep, type)
77struct dma_chan * 109struct dma_chan *
78__async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 110__async_tx_find_channel(struct async_submit_ctl *submit,
79 enum dma_transaction_type tx_type); 111 enum dma_transaction_type tx_type);
80#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ 112#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */
81#else 113#else
82static inline void async_tx_issue_pending_all(void) 114static inline void async_tx_issue_pending_all(void)
@@ -84,10 +116,16 @@ static inline void async_tx_issue_pending_all(void)
84 do { } while (0); 116 do { } while (0);
85} 117}
86 118
119static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
120{
121 do { } while (0);
122}
123
87static inline struct dma_chan * 124static inline struct dma_chan *
88async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 125async_tx_find_channel(struct async_submit_ctl *submit,
89 enum dma_transaction_type tx_type, struct page **dst, int dst_count, 126 enum dma_transaction_type tx_type, struct page **dst,
90 struct page **src, int src_count, size_t len) 127 int dst_count, struct page **src, int src_count,
128 size_t len)
91{ 129{
92 return NULL; 130 return NULL;
93} 131}
@@ -99,46 +137,70 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
99 * @cb_fn_param: parameter to pass to the callback routine 137 * @cb_fn_param: parameter to pass to the callback routine
100 */ 138 */
101static inline void 139static inline void
102async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) 140async_tx_sync_epilog(struct async_submit_ctl *submit)
103{ 141{
104 if (cb_fn) 142 if (submit->cb_fn)
105 cb_fn(cb_fn_param); 143 submit->cb_fn(submit->cb_param);
106} 144}
107 145
108void 146typedef union {
109async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, 147 unsigned long addr;
110 enum async_tx_flags flags, struct dma_async_tx_descriptor *depend_tx, 148 struct page *page;
111 dma_async_tx_callback cb_fn, void *cb_fn_param); 149 dma_addr_t dma;
150} addr_conv_t;
151
152static inline void
153init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags,
154 struct dma_async_tx_descriptor *tx,
155 dma_async_tx_callback cb_fn, void *cb_param,
156 addr_conv_t *scribble)
157{
158 args->flags = flags;
159 args->depend_tx = tx;
160 args->cb_fn = cb_fn;
161 args->cb_param = cb_param;
162 args->scribble = scribble;
163}
164
165void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx,
166 struct async_submit_ctl *submit);
112 167
113struct dma_async_tx_descriptor * 168struct dma_async_tx_descriptor *
114async_xor(struct page *dest, struct page **src_list, unsigned int offset, 169async_xor(struct page *dest, struct page **src_list, unsigned int offset,
115 int src_cnt, size_t len, enum async_tx_flags flags, 170 int src_cnt, size_t len, struct async_submit_ctl *submit);
116 struct dma_async_tx_descriptor *depend_tx,
117 dma_async_tx_callback cb_fn, void *cb_fn_param);
118 171
119struct dma_async_tx_descriptor * 172struct dma_async_tx_descriptor *
120async_xor_zero_sum(struct page *dest, struct page **src_list, 173async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
121 unsigned int offset, int src_cnt, size_t len, 174 int src_cnt, size_t len, enum sum_check_flags *result,
122 u32 *result, enum async_tx_flags flags, 175 struct async_submit_ctl *submit);
123 struct dma_async_tx_descriptor *depend_tx,
124 dma_async_tx_callback cb_fn, void *cb_fn_param);
125 176
126struct dma_async_tx_descriptor * 177struct dma_async_tx_descriptor *
127async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, 178async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
128 unsigned int src_offset, size_t len, enum async_tx_flags flags, 179 unsigned int src_offset, size_t len,
129 struct dma_async_tx_descriptor *depend_tx, 180 struct async_submit_ctl *submit);
130 dma_async_tx_callback cb_fn, void *cb_fn_param);
131 181
132struct dma_async_tx_descriptor * 182struct dma_async_tx_descriptor *
133async_memset(struct page *dest, int val, unsigned int offset, 183async_memset(struct page *dest, int val, unsigned int offset,
134 size_t len, enum async_tx_flags flags, 184 size_t len, struct async_submit_ctl *submit);
135 struct dma_async_tx_descriptor *depend_tx, 185
136 dma_async_tx_callback cb_fn, void *cb_fn_param); 186struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit);
187
188struct dma_async_tx_descriptor *
189async_gen_syndrome(struct page **blocks, unsigned int offset, int src_cnt,
190 size_t len, struct async_submit_ctl *submit);
191
192struct dma_async_tx_descriptor *
193async_syndrome_val(struct page **blocks, unsigned int offset, int src_cnt,
194 size_t len, enum sum_check_flags *pqres, struct page *spare,
195 struct async_submit_ctl *submit);
196
197struct dma_async_tx_descriptor *
198async_raid6_2data_recov(int src_num, size_t bytes, int faila, int failb,
199 struct page **ptrs, struct async_submit_ctl *submit);
137 200
138struct dma_async_tx_descriptor * 201struct dma_async_tx_descriptor *
139async_trigger_callback(enum async_tx_flags flags, 202async_raid6_datap_recov(int src_num, size_t bytes, int faila,
140 struct dma_async_tx_descriptor *depend_tx, 203 struct page **ptrs, struct async_submit_ctl *submit);
141 dma_async_tx_callback cb_fn, void *cb_fn_param);
142 204
143void async_tx_quiesce(struct dma_async_tx_descriptor **tx); 205void async_tx_quiesce(struct dma_async_tx_descriptor **tx);
144#endif /* _ASYNC_TX_H_ */ 206#endif /* _ASYNC_TX_H_ */