diff options
Diffstat (limited to 'Documentation/crypto')
-rw-r--r-- | Documentation/crypto/async-tx-api.txt | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/Documentation/crypto/async-tx-api.txt b/Documentation/crypto/async-tx-api.txt index dfe0475f7919..6b15e488c0e7 100644 --- a/Documentation/crypto/async-tx-api.txt +++ b/Documentation/crypto/async-tx-api.txt | |||
@@ -115,29 +115,42 @@ of an operation. | |||
115 | Perform a xor->copy->xor operation where each operation depends on the | 115 | Perform a xor->copy->xor operation where each operation depends on the |
116 | result from the previous operation: | 116 | result from the previous operation: |
117 | 117 | ||
118 | void complete_xor_copy_xor(void *param) | 118 | void callback(void *param) |
119 | { | 119 | { |
120 | printk("complete\n"); | 120 | struct completion *cmp = param; |
121 | |||
122 | complete(cmp); | ||
121 | } | 123 | } |
122 | 124 | ||
123 | int run_xor_copy_xor(struct page **xor_srcs, | 125 | void run_xor_copy_xor(struct page **xor_srcs, |
124 | int xor_src_cnt, | 126 | int xor_src_cnt, |
125 | struct page *xor_dest, | 127 | struct page *xor_dest, |
126 | size_t xor_len, | 128 | size_t xor_len, |
127 | struct page *copy_src, | 129 | struct page *copy_src, |
128 | struct page *copy_dest, | 130 | struct page *copy_dest, |
129 | size_t copy_len) | 131 | size_t copy_len) |
130 | { | 132 | { |
131 | struct dma_async_tx_descriptor *tx; | 133 | struct dma_async_tx_descriptor *tx; |
134 | addr_conv_t addr_conv[xor_src_cnt]; | ||
135 | struct async_submit_ctl submit; | ||
136 | addr_conv_t addr_conv[NDISKS]; | ||
137 | struct completion cmp; | ||
138 | |||
139 | init_async_submit(&submit, ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL, | ||
140 | addr_conv); | ||
141 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, &submit) | ||
132 | 142 | ||
133 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, | 143 | submit->depend_tx = tx; |
134 | ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL); | 144 | tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, &submit); |
135 | tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, tx, NULL, NULL); | 145 | |
136 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, | 146 | init_completion(&cmp); |
137 | ASYNC_TX_XOR_DROP_DST | ASYNC_TX_ACK, | 147 | init_async_submit(&submit, ASYNC_TX_XOR_DROP_DST | ASYNC_TX_ACK, tx, |
138 | tx, complete_xor_copy_xor, NULL); | 148 | callback, &cmp, addr_conv); |
149 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, &submit); | ||
139 | 150 | ||
140 | async_tx_issue_pending_all(); | 151 | async_tx_issue_pending_all(); |
152 | |||
153 | wait_for_completion(&cmp); | ||
141 | } | 154 | } |
142 | 155 | ||
143 | See include/linux/async_tx.h for more information on the flags. See the | 156 | See include/linux/async_tx.h for more information on the flags. See the |