diff options
author | NeilBrown <neilb@suse.de> | 2009-09-23 04:31:11 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-09-23 04:31:11 -0400 |
commit | 4b3df5668c8ebaebd8d66a5a94374be3e3b2ef0c (patch) | |
tree | 51a231742e211143f5845edf4b09d1712dcd2771 /Documentation | |
parent | 1ef04fefe2241087d9db7e9615c3f11b516e36cf (diff) | |
parent | 1f6672d44c1ae7408b43c06170ec34eb0a0e9b9f (diff) |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx into for-linus
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/crypto/async-tx-api.txt | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/Documentation/crypto/async-tx-api.txt b/Documentation/crypto/async-tx-api.txt index 9f59fcbf5d82..ba046b8fa92f 100644 --- a/Documentation/crypto/async-tx-api.txt +++ b/Documentation/crypto/async-tx-api.txt | |||
@@ -54,20 +54,23 @@ features surfaced as a result: | |||
54 | 54 | ||
55 | 3.1 General format of the API: | 55 | 3.1 General format of the API: |
56 | struct dma_async_tx_descriptor * | 56 | struct dma_async_tx_descriptor * |
57 | async_<operation>(<op specific parameters>, | 57 | async_<operation>(<op specific parameters>, struct async_submit ctl *submit) |
58 | enum async_tx_flags flags, | ||
59 | struct dma_async_tx_descriptor *dependency, | ||
60 | dma_async_tx_callback callback_routine, | ||
61 | void *callback_parameter); | ||
62 | 58 | ||
63 | 3.2 Supported operations: | 59 | 3.2 Supported operations: |
64 | memcpy - memory copy between a source and a destination buffer | 60 | memcpy - memory copy between a source and a destination buffer |
65 | memset - fill a destination buffer with a byte value | 61 | memset - fill a destination buffer with a byte value |
66 | xor - xor a series of source buffers and write the result to a | 62 | xor - xor a series of source buffers and write the result to a |
67 | destination buffer | 63 | destination buffer |
68 | xor_zero_sum - xor a series of source buffers and set a flag if the | 64 | xor_val - xor a series of source buffers and set a flag if the |
69 | result is zero. The implementation attempts to prevent | 65 | result is zero. The implementation attempts to prevent |
70 | writes to memory | 66 | writes to memory |
67 | pq - generate the p+q (raid6 syndrome) from a series of source buffers | ||
68 | pq_val - validate that a p and or q buffer are in sync with a given series of | ||
69 | sources | ||
70 | datap - (raid6_datap_recov) recover a raid6 data block and the p block | ||
71 | from the given sources | ||
72 | 2data - (raid6_2data_recov) recover 2 raid6 data blocks from the given | ||
73 | sources | ||
71 | 74 | ||
72 | 3.3 Descriptor management: | 75 | 3.3 Descriptor management: |
73 | The return value is non-NULL and points to a 'descriptor' when the operation | 76 | The return value is non-NULL and points to a 'descriptor' when the operation |
@@ -80,8 +83,8 @@ acknowledged by the application before the offload engine driver is allowed to | |||
80 | recycle (or free) the descriptor. A descriptor can be acked by one of the | 83 | recycle (or free) the descriptor. A descriptor can be acked by one of the |
81 | following methods: | 84 | following methods: |
82 | 1/ setting the ASYNC_TX_ACK flag if no child operations are to be submitted | 85 | 1/ setting the ASYNC_TX_ACK flag if no child operations are to be submitted |
83 | 2/ setting the ASYNC_TX_DEP_ACK flag to acknowledge the parent | 86 | 2/ submitting an unacknowledged descriptor as a dependency to another |
84 | descriptor of a new operation. | 87 | async_tx call will implicitly set the acknowledged state. |
85 | 3/ calling async_tx_ack() on the descriptor. | 88 | 3/ calling async_tx_ack() on the descriptor. |
86 | 89 | ||
87 | 3.4 When does the operation execute? | 90 | 3.4 When does the operation execute? |
@@ -119,30 +122,42 @@ of an operation. | |||
119 | Perform a xor->copy->xor operation where each operation depends on the | 122 | Perform a xor->copy->xor operation where each operation depends on the |
120 | result from the previous operation: | 123 | result from the previous operation: |
121 | 124 | ||
122 | void complete_xor_copy_xor(void *param) | 125 | void callback(void *param) |
123 | { | 126 | { |
124 | printk("complete\n"); | 127 | struct completion *cmp = param; |
128 | |||
129 | complete(cmp); | ||
125 | } | 130 | } |
126 | 131 | ||
127 | int run_xor_copy_xor(struct page **xor_srcs, | 132 | void run_xor_copy_xor(struct page **xor_srcs, |
128 | int xor_src_cnt, | 133 | int xor_src_cnt, |
129 | struct page *xor_dest, | 134 | struct page *xor_dest, |
130 | size_t xor_len, | 135 | size_t xor_len, |
131 | struct page *copy_src, | 136 | struct page *copy_src, |
132 | struct page *copy_dest, | 137 | struct page *copy_dest, |
133 | size_t copy_len) | 138 | size_t copy_len) |
134 | { | 139 | { |
135 | struct dma_async_tx_descriptor *tx; | 140 | struct dma_async_tx_descriptor *tx; |
141 | addr_conv_t addr_conv[xor_src_cnt]; | ||
142 | struct async_submit_ctl submit; | ||
143 | addr_conv_t addr_conv[NDISKS]; | ||
144 | struct completion cmp; | ||
145 | |||
146 | init_async_submit(&submit, ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL, | ||
147 | addr_conv); | ||
148 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, &submit) | ||
136 | 149 | ||
137 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, | 150 | submit->depend_tx = tx; |
138 | ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL); | 151 | tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, &submit); |
139 | tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, | 152 | |
140 | ASYNC_TX_DEP_ACK, tx, NULL, NULL); | 153 | init_completion(&cmp); |
141 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, | 154 | init_async_submit(&submit, ASYNC_TX_XOR_DROP_DST | ASYNC_TX_ACK, tx, |
142 | ASYNC_TX_XOR_DROP_DST | ASYNC_TX_DEP_ACK | ASYNC_TX_ACK, | 155 | callback, &cmp, addr_conv); |
143 | tx, complete_xor_copy_xor, NULL); | 156 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, &submit); |
144 | 157 | ||
145 | async_tx_issue_pending_all(); | 158 | async_tx_issue_pending_all(); |
159 | |||
160 | wait_for_completion(&cmp); | ||
146 | } | 161 | } |
147 | 162 | ||
148 | See include/linux/async_tx.h for more information on the flags. See the | 163 | See include/linux/async_tx.h for more information on the flags. See the |