diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-07 01:28:35 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-07 01:29:22 -0500 |
commit | 6548698f929814375fa5d62ae1db96959b0418c1 (patch) | |
tree | 340924ae82cb0946aa15045b2b72186de52a8146 /include/linux/async_tx.h | |
parent | 1d2c6cfd40b2dece3bb958cbbc405a2c1536ab75 (diff) | |
parent | 22763c5cf3690a681551162c15d34d935308c8d7 (diff) |
Merge commit 'v2.6.32' into reiserfs/kill-bkl
Merge-reason: The tree was based 2.6.31. It's better to be up to date
with 2.6.32. Although no conflicting changes were made in between,
it gives benchmarking results closer to the lastest kernel behaviour.
Diffstat (limited to 'include/linux/async_tx.h')
-rw-r--r-- | include/linux/async_tx.h | 129 |
1 files changed, 97 insertions, 32 deletions
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h index 5fc2ef8d97fa..a1c486a88e88 100644 --- a/include/linux/async_tx.h +++ b/include/linux/async_tx.h | |||
@@ -58,25 +58,60 @@ 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. | 61 | * @ASYNC_TX_FENCE: specify that the next operation in the dependency |
62 | * chain uses this operation's result as an input | ||
62 | */ | 63 | */ |
63 | enum async_tx_flags { | 64 | enum async_tx_flags { |
64 | ASYNC_TX_XOR_ZERO_DST = (1 << 0), | 65 | ASYNC_TX_XOR_ZERO_DST = (1 << 0), |
65 | ASYNC_TX_XOR_DROP_DST = (1 << 1), | 66 | ASYNC_TX_XOR_DROP_DST = (1 << 1), |
66 | ASYNC_TX_ACK = (1 << 3), | 67 | ASYNC_TX_ACK = (1 << 2), |
67 | ASYNC_TX_DEP_ACK = (1 << 4), | 68 | ASYNC_TX_FENCE = (1 << 3), |
69 | }; | ||
70 | |||
71 | /** | ||
72 | * struct async_submit_ctl - async_tx submission/completion modifiers | ||
73 | * @flags: submission modifiers | ||
74 | * @depend_tx: parent dependency of the current operation being submitted | ||
75 | * @cb_fn: callback routine to run at operation completion | ||
76 | * @cb_param: parameter for the callback routine | ||
77 | * @scribble: caller provided space for dma/page address conversions | ||
78 | */ | ||
79 | struct async_submit_ctl { | ||
80 | enum async_tx_flags flags; | ||
81 | struct dma_async_tx_descriptor *depend_tx; | ||
82 | dma_async_tx_callback cb_fn; | ||
83 | void *cb_param; | ||
84 | void *scribble; | ||
68 | }; | 85 | }; |
69 | 86 | ||
70 | #ifdef CONFIG_DMA_ENGINE | 87 | #ifdef CONFIG_DMA_ENGINE |
71 | #define async_tx_issue_pending_all dma_issue_pending_all | 88 | #define async_tx_issue_pending_all dma_issue_pending_all |
89 | |||
90 | /** | ||
91 | * async_tx_issue_pending - send pending descriptor to the hardware channel | ||
92 | * @tx: descriptor handle to retrieve hardware context | ||
93 | * | ||
94 | * Note: any dependent operations will have already been issued by | ||
95 | * async_tx_channel_switch, or (in the case of no channel switch) will | ||
96 | * be already pending on this channel. | ||
97 | */ | ||
98 | static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx) | ||
99 | { | ||
100 | if (likely(tx)) { | ||
101 | struct dma_chan *chan = tx->chan; | ||
102 | struct dma_device *dma = chan->device; | ||
103 | |||
104 | dma->device_issue_pending(chan); | ||
105 | } | ||
106 | } | ||
72 | #ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL | 107 | #ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL |
73 | #include <asm/async_tx.h> | 108 | #include <asm/async_tx.h> |
74 | #else | 109 | #else |
75 | #define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ | 110 | #define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ |
76 | __async_tx_find_channel(dep, type) | 111 | __async_tx_find_channel(dep, type) |
77 | struct dma_chan * | 112 | struct dma_chan * |
78 | __async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | 113 | __async_tx_find_channel(struct async_submit_ctl *submit, |
79 | enum dma_transaction_type tx_type); | 114 | enum dma_transaction_type tx_type); |
80 | #endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ | 115 | #endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ |
81 | #else | 116 | #else |
82 | static inline void async_tx_issue_pending_all(void) | 117 | static inline void async_tx_issue_pending_all(void) |
@@ -84,10 +119,16 @@ static inline void async_tx_issue_pending_all(void) | |||
84 | do { } while (0); | 119 | do { } while (0); |
85 | } | 120 | } |
86 | 121 | ||
122 | static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx) | ||
123 | { | ||
124 | do { } while (0); | ||
125 | } | ||
126 | |||
87 | static inline struct dma_chan * | 127 | static inline struct dma_chan * |
88 | async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | 128 | async_tx_find_channel(struct async_submit_ctl *submit, |
89 | enum dma_transaction_type tx_type, struct page **dst, int dst_count, | 129 | enum dma_transaction_type tx_type, struct page **dst, |
90 | struct page **src, int src_count, size_t len) | 130 | int dst_count, struct page **src, int src_count, |
131 | size_t len) | ||
91 | { | 132 | { |
92 | return NULL; | 133 | return NULL; |
93 | } | 134 | } |
@@ -99,46 +140,70 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | |||
99 | * @cb_fn_param: parameter to pass to the callback routine | 140 | * @cb_fn_param: parameter to pass to the callback routine |
100 | */ | 141 | */ |
101 | static inline void | 142 | static inline void |
102 | async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) | 143 | async_tx_sync_epilog(struct async_submit_ctl *submit) |
103 | { | 144 | { |
104 | if (cb_fn) | 145 | if (submit->cb_fn) |
105 | cb_fn(cb_fn_param); | 146 | submit->cb_fn(submit->cb_param); |
106 | } | 147 | } |
107 | 148 | ||
108 | void | 149 | typedef union { |
109 | async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, | 150 | unsigned long addr; |
110 | enum async_tx_flags flags, struct dma_async_tx_descriptor *depend_tx, | 151 | struct page *page; |
111 | dma_async_tx_callback cb_fn, void *cb_fn_param); | 152 | dma_addr_t dma; |
153 | } addr_conv_t; | ||
154 | |||
155 | static inline void | ||
156 | init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags, | ||
157 | struct dma_async_tx_descriptor *tx, | ||
158 | dma_async_tx_callback cb_fn, void *cb_param, | ||
159 | addr_conv_t *scribble) | ||
160 | { | ||
161 | args->flags = flags; | ||
162 | args->depend_tx = tx; | ||
163 | args->cb_fn = cb_fn; | ||
164 | args->cb_param = cb_param; | ||
165 | args->scribble = scribble; | ||
166 | } | ||
167 | |||
168 | void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, | ||
169 | struct async_submit_ctl *submit); | ||
112 | 170 | ||
113 | struct dma_async_tx_descriptor * | 171 | struct dma_async_tx_descriptor * |
114 | async_xor(struct page *dest, struct page **src_list, unsigned int offset, | 172 | async_xor(struct page *dest, struct page **src_list, unsigned int offset, |
115 | int src_cnt, size_t len, enum async_tx_flags flags, | 173 | 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 | 174 | ||
119 | struct dma_async_tx_descriptor * | 175 | struct dma_async_tx_descriptor * |
120 | async_xor_zero_sum(struct page *dest, struct page **src_list, | 176 | async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, |
121 | unsigned int offset, int src_cnt, size_t len, | 177 | int src_cnt, size_t len, enum sum_check_flags *result, |
122 | u32 *result, enum async_tx_flags flags, | 178 | 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 | 179 | ||
126 | struct dma_async_tx_descriptor * | 180 | struct dma_async_tx_descriptor * |
127 | async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, | 181 | async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, |
128 | unsigned int src_offset, size_t len, enum async_tx_flags flags, | 182 | unsigned int src_offset, size_t len, |
129 | struct dma_async_tx_descriptor *depend_tx, | 183 | struct async_submit_ctl *submit); |
130 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
131 | 184 | ||
132 | struct dma_async_tx_descriptor * | 185 | struct dma_async_tx_descriptor * |
133 | async_memset(struct page *dest, int val, unsigned int offset, | 186 | async_memset(struct page *dest, int val, unsigned int offset, |
134 | size_t len, enum async_tx_flags flags, | 187 | size_t len, struct async_submit_ctl *submit); |
135 | struct dma_async_tx_descriptor *depend_tx, | 188 | |
136 | dma_async_tx_callback cb_fn, void *cb_fn_param); | 189 | struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit); |
190 | |||
191 | struct dma_async_tx_descriptor * | ||
192 | async_gen_syndrome(struct page **blocks, unsigned int offset, int src_cnt, | ||
193 | size_t len, struct async_submit_ctl *submit); | ||
194 | |||
195 | struct dma_async_tx_descriptor * | ||
196 | async_syndrome_val(struct page **blocks, unsigned int offset, int src_cnt, | ||
197 | size_t len, enum sum_check_flags *pqres, struct page *spare, | ||
198 | struct async_submit_ctl *submit); | ||
199 | |||
200 | struct dma_async_tx_descriptor * | ||
201 | async_raid6_2data_recov(int src_num, size_t bytes, int faila, int failb, | ||
202 | struct page **ptrs, struct async_submit_ctl *submit); | ||
137 | 203 | ||
138 | struct dma_async_tx_descriptor * | 204 | struct dma_async_tx_descriptor * |
139 | async_trigger_callback(enum async_tx_flags flags, | 205 | async_raid6_datap_recov(int src_num, size_t bytes, int faila, |
140 | struct dma_async_tx_descriptor *depend_tx, | 206 | struct page **ptrs, struct async_submit_ctl *submit); |
141 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
142 | 207 | ||
143 | void async_tx_quiesce(struct dma_async_tx_descriptor **tx); | 208 | void async_tx_quiesce(struct dma_async_tx_descriptor **tx); |
144 | #endif /* _ASYNC_TX_H_ */ | 209 | #endif /* _ASYNC_TX_H_ */ |