Interfaces Related to EC Storage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | /* EC message format of Warpdrive */ struct wcrypto_ec_msg { __u8 alg_type;/* Denoted by enum wcrypto_alg_type */ __u8 ec_type; /* Denoted by enum wcrypto_ec_type */ __u8 op_type; /* Denoted by enum wcrypto_ec_op_type */ __u8 data_fmt; /* Data format, denoted by enum wd_buff_type */ __u8 result;/* Data format, denoted by WD error code */ __u8 *coef_matrix; /* Coefficient matrix */ __u8 coef_matrix_load; /* coef_matrix reload control, 0: do not load, 1: load */ __u8 coef_matrix_len; /* length of loaded coe_matrix, equal to src_num*/ __u8 alg_blk_size; /* algorithm granularity, 0: 512 gran, 1: 4096 gran*/ __u16 block_size;/* support 512,520,4096,4104,4160 */ __u16 block_num;/*number of sector*/ __u8 *in; /* Input address, should be dma buffer */ __u8 in_disk_num;/* number of source disks */ __u8 *out; /* Result address should be dma buffer */ __u8 out_disk_num; /* number of destination disks */ __u64 usr_data; /* user identifier: for example: struct wcrypto_cb_tag */ }; enum wcrypto_ec_type { WCRYPTO_EC_FLEXEC, WCRYPTO_EC_MPCC, }; enum wcrypto_ec_op_type { WCRYPTO_EC_GENERATE, WCRYPTO_EC_VALIDATE, WCRYPTO_EC_UPDATE, WCRYPTO_EC_RECONSTRUCT, }; struct wcrypto_ec_ctx_setup { enum wcrypto_ec_type ec_type; wcrypto_cb cb; __u16 data_fmt; struct wd_mm_br br; }; struct wcrypto_ec_op_data { enum wcrypto_ec_op_type op_type; int status; __u8 *coef_matrix; /* Coefficient matrix */ __u8 coef_matrix_load; /* coef_matrix reload control, 0: do not load, 1: load */ __u8 coef_matrix_len; /* length of loaded coe_matrix, equal to src_num*/ __u8 alg_blk_size; /* algorithm granularity, 0: 512 gran, 1: 4096 gran*/ __u16 block_size;/*support 512,520,4096,4104,4160*/ __u16 block_num;/*number of sector*/ void *in; /* Input address */ __u8 in_disk_num;/* number of source disks */ void *out; /* Result address */ __u8 out_disk_num; /* number of destination disks */ void *priv; }; |
Prototype |
void * wcrypto_create_ec_ctx (struct wd_queue *q, struct wcrypto_ec_ctx_setup *setup); |
|---|---|
Function |
Create an EC context based on the WD queue. |
Input Description |
q: WD queue setup: context creation input parameter |
Output Description |
None |
Return Value Description |
Context address. NULL: failure A non-NULL value: success |
Usage Instruction |
Multiple threads are supported. |
Precautions |
Prototype |
int wcrypto_do_ec(void *ctx, struct wcrypto_ec_op_data *opdata, void *tag); |
|---|---|
Function |
Perform EC operations based on the EC context. |
Input Description |
ctx: EC context opdata: EC operation parameters, including the input, output, and operation types tag: user callback. If the value is NULL, the interface is a synchronous interface. Otherwise, the interface is an asynchronous interface. |
Output Description |
None |
Return Value Description |
0: success Others: failure |
Usage Instruction |
One ctx supports only one thread. |
Precautions |
Prototype |
int wcrypto_ec_poll(struct wd_queue *q, unsigned int num); |
|---|---|
Function |
Perform EC poll operations based on the WD queue. |
Input Description |
q: WD EC queue num: 0 indicates that all response messages in queue q are received. A non-0 value indicates the number of response messages received in queue q. |
Output Description |
None |
Return Value Description |
A value greater than 0: number of the received response messages 0: No response message is received. A negative value: poll error |
Usage Instruction |
One q supports only one thread. |
Precautions |
Prototype |
void wcrypto_del_ec_ctx(void *ctx); |
|---|---|
Function |
Delete an EC context. |
Input Description |
ctx: EC context to be deleted |
Output Description |
None |
Return Value Description |
None |
Usage Instruction |
|
Precautions |