diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-08-29 22:09:27 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-08-29 22:09:27 -0400 |
commit | 58691d64c44ae41ddf098ecb31e9a994026e3cff (patch) | |
tree | 93c36b2d244648a9b5880dc97de3cb945fdebda7 /drivers/dma | |
parent | 0a82a6239beecc95db6e05fe43ee62d16b381d38 (diff) |
dmatest: add pq support
Test raid6 p+q operations with a simple "always multiply by 1" q
calculation to fit into dmatest's current destination verification
scheme.
Reviewed-by: Andre Noll <maan@systemlinux.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/dmatest.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index a27c0fb1bc11..a5ee54139050 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
@@ -43,6 +43,11 @@ module_param(xor_sources, uint, S_IRUGO); | |||
43 | MODULE_PARM_DESC(xor_sources, | 43 | MODULE_PARM_DESC(xor_sources, |
44 | "Number of xor source buffers (default: 3)"); | 44 | "Number of xor source buffers (default: 3)"); |
45 | 45 | ||
46 | static unsigned int pq_sources = 3; | ||
47 | module_param(pq_sources, uint, S_IRUGO); | ||
48 | MODULE_PARM_DESC(pq_sources, | ||
49 | "Number of p+q source buffers (default: 3)"); | ||
50 | |||
46 | /* | 51 | /* |
47 | * Initialization patterns. All bytes in the source buffer has bit 7 | 52 | * Initialization patterns. All bytes in the source buffer has bit 7 |
48 | * set, all bytes in the destination buffer has bit 7 cleared. | 53 | * set, all bytes in the destination buffer has bit 7 cleared. |
@@ -227,6 +232,7 @@ static int dmatest_func(void *data) | |||
227 | dma_cookie_t cookie; | 232 | dma_cookie_t cookie; |
228 | enum dma_status status; | 233 | enum dma_status status; |
229 | enum dma_ctrl_flags flags; | 234 | enum dma_ctrl_flags flags; |
235 | u8 pq_coefs[pq_sources]; | ||
230 | int ret; | 236 | int ret; |
231 | int src_cnt; | 237 | int src_cnt; |
232 | int dst_cnt; | 238 | int dst_cnt; |
@@ -243,6 +249,11 @@ static int dmatest_func(void *data) | |||
243 | else if (thread->type == DMA_XOR) { | 249 | else if (thread->type == DMA_XOR) { |
244 | src_cnt = xor_sources | 1; /* force odd to ensure dst = src */ | 250 | src_cnt = xor_sources | 1; /* force odd to ensure dst = src */ |
245 | dst_cnt = 1; | 251 | dst_cnt = 1; |
252 | } else if (thread->type == DMA_PQ) { | ||
253 | src_cnt = pq_sources | 1; /* force odd to ensure dst = src */ | ||
254 | dst_cnt = 2; | ||
255 | for (i = 0; i < pq_sources; i++) | ||
256 | pq_coefs[i] = 1; | ||
246 | } else | 257 | } else |
247 | goto err_srcs; | 258 | goto err_srcs; |
248 | 259 | ||
@@ -310,6 +321,15 @@ static int dmatest_func(void *data) | |||
310 | dma_dsts[0] + dst_off, | 321 | dma_dsts[0] + dst_off, |
311 | dma_srcs, xor_sources, | 322 | dma_srcs, xor_sources, |
312 | len, flags); | 323 | len, flags); |
324 | else if (thread->type == DMA_PQ) { | ||
325 | dma_addr_t dma_pq[dst_cnt]; | ||
326 | |||
327 | for (i = 0; i < dst_cnt; i++) | ||
328 | dma_pq[i] = dma_dsts[i] + dst_off; | ||
329 | tx = dev->device_prep_dma_pq(chan, dma_pq, dma_srcs, | ||
330 | pq_sources, pq_coefs, | ||
331 | len, flags); | ||
332 | } | ||
313 | 333 | ||
314 | if (!tx) { | 334 | if (!tx) { |
315 | for (i = 0; i < src_cnt; i++) | 335 | for (i = 0; i < src_cnt; i++) |
@@ -446,6 +466,8 @@ static int dmatest_add_threads(struct dmatest_chan *dtc, enum dma_transaction_ty | |||
446 | op = "copy"; | 466 | op = "copy"; |
447 | else if (type == DMA_XOR) | 467 | else if (type == DMA_XOR) |
448 | op = "xor"; | 468 | op = "xor"; |
469 | else if (type == DMA_PQ) | ||
470 | op = "pq"; | ||
449 | else | 471 | else |
450 | return -EINVAL; | 472 | return -EINVAL; |
451 | 473 | ||
@@ -501,6 +523,10 @@ static int dmatest_add_channel(struct dma_chan *chan) | |||
501 | cnt = dmatest_add_threads(dtc, DMA_XOR); | 523 | cnt = dmatest_add_threads(dtc, DMA_XOR); |
502 | thread_count += cnt > 0 ?: 0; | 524 | thread_count += cnt > 0 ?: 0; |
503 | } | 525 | } |
526 | if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) { | ||
527 | cnt = dmatest_add_threads(dtc, DMA_PQ); | ||
528 | thread_count += cnt > 0 ?: 0; | ||
529 | } | ||
504 | 530 | ||
505 | pr_info("dmatest: Started %u threads using %s\n", | 531 | pr_info("dmatest: Started %u threads using %s\n", |
506 | thread_count, dma_chan_name(chan)); | 532 | thread_count, dma_chan_name(chan)); |