Skip to content

Commit ad283ea

Browse files
committed
async_tx: add sum check flags
Replace the flat zero_sum_result with a collection of flags to contain the P (xor) zero-sum result, and the soon to be utilized Q (raid6 reed solomon syndrome) zero-sum result. Use the SUM_CHECK_ namespace instead of DMA_ since these flags will be used on non-dma-zero-sum enabled platforms. 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>
1 parent d6f38f3 commit ad283ea

File tree

7 files changed

+37
-14
lines changed

7 files changed

+37
-14
lines changed

arch/arm/include/asm/hardware/iop3xx-adma.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,13 +756,14 @@ static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc,
756756
hw_desc->src[0] = val;
757757
}
758758

759-
static inline int iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
759+
static inline enum sum_check_flags
760+
iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
760761
{
761762
struct iop3xx_desc_aau *hw_desc = desc->hw_desc;
762763
struct iop3xx_aau_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field;
763764

764765
iop_paranoia(!(desc_ctrl.tx_complete && desc_ctrl.zero_result_en));
765-
return desc_ctrl.zero_result_err;
766+
return desc_ctrl.zero_result_err << SUM_CHECK_P;
766767
}
767768

768769
static inline void iop_chan_append(struct iop_adma_chan *chan)

arch/arm/mach-iop13xx/include/mach/adma.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,18 +428,20 @@ static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc,
428428
hw_desc->block_fill_data = val;
429429
}
430430

431-
static inline int iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
431+
static inline enum sum_check_flags
432+
iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
432433
{
433434
struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
434435
struct iop13xx_adma_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field;
435436
struct iop13xx_adma_byte_count byte_count = hw_desc->byte_count_field;
437+
enum sum_check_flags flags;
436438

437439
BUG_ON(!(byte_count.tx_complete && desc_ctrl.zero_result));
438440

439-
if (desc_ctrl.pq_xfer_en)
440-
return byte_count.zero_result_err_q;
441-
else
442-
return byte_count.zero_result_err;
441+
flags = byte_count.zero_result_err_q << SUM_CHECK_Q;
442+
flags |= byte_count.zero_result_err << SUM_CHECK_P;
443+
444+
return flags;
443445
}
444446

445447
static inline void iop_chan_append(struct iop_adma_chan *chan)

crypto/async_tx/async_xor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int page_is_zero(struct page *p, unsigned int offset, size_t len)
246246
*/
247247
struct dma_async_tx_descriptor *
248248
async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
249-
int src_cnt, size_t len, u32 *result,
249+
int src_cnt, size_t len, enum sum_check_flags *result,
250250
struct async_submit_ctl *submit)
251251
{
252252
struct dma_chan *chan = async_tx_find_channel(submit, DMA_XOR_VAL,
@@ -304,7 +304,7 @@ async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
304304

305305
async_tx_quiesce(&tx);
306306

307-
*result = page_is_zero(dest, offset, len) ? 0 : 1;
307+
*result = !page_is_zero(dest, offset, len) << SUM_CHECK_P;
308308

309309
async_tx_sync_epilog(submit);
310310
submit->flags = flags_orig;

drivers/md/raid5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2590,7 +2590,7 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
25902590
* we are done. Otherwise update the mismatch count and repair
25912591
* parity if !MD_RECOVERY_CHECK
25922592
*/
2593-
if (sh->ops.zero_sum_result == 0)
2593+
if ((sh->ops.zero_sum_result & SUM_CHECK_P_RESULT) == 0)
25942594
/* parity is correct (on disc,
25952595
* not in buffer any more)
25962596
*/

drivers/md/raid5.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define _RAID5_H
33

44
#include <linux/raid/xor.h>
5+
#include <linux/dmaengine.h>
56

67
/*
78
*
@@ -215,8 +216,8 @@ struct stripe_head {
215216
* @target - STRIPE_OP_COMPUTE_BLK target
216217
*/
217218
struct stripe_operations {
218-
int target;
219-
u32 zero_sum_result;
219+
int target;
220+
enum sum_check_flags zero_sum_result;
220221
} ops;
221222
struct r5dev {
222223
struct bio req;

include/linux/async_tx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ async_xor(struct page *dest, struct page **src_list, unsigned int offset,
148148

149149
struct dma_async_tx_descriptor *
150150
async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
151-
int src_cnt, size_t len, u32 *result,
151+
int src_cnt, size_t len, enum sum_check_flags *result,
152152
struct async_submit_ctl *submit);
153153

154154
struct dma_async_tx_descriptor *

include/linux/dmaengine.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,25 @@ enum dma_ctrl_flags {
8686
DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3),
8787
};
8888

89+
/**
90+
* enum sum_check_bits - bit position of pq_check_flags
91+
*/
92+
enum sum_check_bits {
93+
SUM_CHECK_P = 0,
94+
SUM_CHECK_Q = 1,
95+
};
96+
97+
/**
98+
* enum pq_check_flags - result of async_{xor,pq}_zero_sum operations
99+
* @SUM_CHECK_P_RESULT - 1 if xor zero sum error, 0 otherwise
100+
* @SUM_CHECK_Q_RESULT - 1 if reed-solomon zero sum error, 0 otherwise
101+
*/
102+
enum sum_check_flags {
103+
SUM_CHECK_P_RESULT = (1 << SUM_CHECK_P),
104+
SUM_CHECK_Q_RESULT = (1 << SUM_CHECK_Q),
105+
};
106+
107+
89108
/**
90109
* dma_cap_mask_t - capabilities bitmap modeled after cpumask_t.
91110
* See linux/cpumask.h
@@ -245,7 +264,7 @@ struct dma_device {
245264
unsigned int src_cnt, size_t len, unsigned long flags);
246265
struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)(
247266
struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt,
248-
size_t len, u32 *result, unsigned long flags);
267+
size_t len, enum sum_check_flags *result, unsigned long flags);
249268
struct dma_async_tx_descriptor *(*device_prep_dma_memset)(
250269
struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
251270
unsigned long flags);

0 commit comments

Comments
 (0)