Rate This Document
Findability
Accuracy
Completeness
Readability

Interfaces Related to CoMP

  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
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
enum wcrypto_comp_flush_type {
WCRYPTO_INVALID_FLUSH,

/* output as much data as we can to improve performance */
WCRYPTO_NO_FLUSH,

/* output as bytes aligning or some other conditions satisfied */
WCRYPTO_SYNC_FLUSH,

/* indicates the end of the file/data */
WCRYPTO_FINISH,
};
enum wcrypto_comp_level {
WCRYPTO_COMP_L1 = 1,/* Compression level 1 */
WCRYPTO_COMP_L2,    /* Compression level 2 */
WCRYPTO_COMP_L3,    /* Compression level 3 */
WCRYPTO_COMP_L4, /* Compression level 4 */
WCRYPTO_COMP_L5, /* Compression level 5 */
WCRYPTO_COMP_L6, /* Compression level 6 */
WCRYPTO_COMP_L7, /* Compression level 7 */
WCRYPTO_COMP_L8, /* Compression level 8 */
WCRYPTO_COMP_L9 /* Compression level 9 */
};

enum wcrypto_comp_win_type {
WCRYPTO_COMP_WS_4K, /* 4k bytes window size */
WCRYPTO_COMP_WS_8K, /* 8k bytes window size */
WCRYPTO_COMP_WS_16K, /* 16k bytes window size */
WCRYPTO_COMP_WS_32K, /* 32k bytes window size */
};
/* Comp message format of Warpdrive */
struct wcrypto_comp_msg {
__u8 alg_type;/* Denoted by enum wcrypto_comp_alg_type */
__u8 op_type;/* Denoted by enum wcrypto_comp_op_type */
__u8 flush_type;/* indicates the output mode, from enum wcrypto_comp_flush_type */
__u8 stream_mode;/* Denoted by enum wcrypto_comp_state */
__u8 stream_pos;/* Denoted by enum wcrypto_stream_status */
__u8 comp_lv;/* Denoted by enum wcrypto_comp_level */
__u8 data_fmt;/* Data format, denoted by enum wd_buff_type */
__u8 win_sz;/* Denoted by enum wcrypto_comp_win_type */
__u32 in_size;    /* Input data bytes */
__u32 avail_out;/* Output buffer size */
__u32 in_cons;/* consumed bytes of input data */
__u32 produced;/* produced bytes of current operation */
__u8 *src;/* Input data VA, buf should be DMA-able. */
__u8 *dst;/* Output data VA pointer */
__u32 tag;       /* User-defined request identifier */
__u32 win_size;/* Denoted by enum wcrypto_comp_win_type */
__u32 status;/* Data format, denoted by WD error code and enum wcrypto_op_result */
__u32 isize;/* Denoted by gzip isize */
__u32 checksum;/* Denoted by zlib/gzip CRC */
__u32 ctx_priv0;/* Denoted HW priv */
__u32 ctx_priv1;/* Denoted HW priv */
__u32 ctx_priv2;/* Denoted HW priv */
void *ctx_buf;/* Denoted HW ctx cache */
__u64 udata;/* Input user tag, used for identifying data stream/user: struct wcrypto_cb_tag */
};

enum wcrypto_comp_alg_type {
WCRYPTO_ZLIB,
WCRYPTO_GZIP,
};

/* Compression operational types */
enum wcrypto_comp_op_type {
WCRYPTO_DEFLATE,/* Data Compression */
WCRYPTO_INFLATE, /* Data Decompression */
};

enum wcrypto_comp_state {
WCRYPTO_COMP_STATELESS,
WCRYPTO_COMP_STATEFUL,
};

enum wcrypto_stream_status {
WCRYPTO_COMP_STREAM_OLD,
WCRYPTO_COMP_STREAM_NEW,  /* indicates the first packet */
};

/* context setup parameters */
struct wcrypto_comp_ctx_setup {
wcrypto_cb cb;/* User call back */
__u8 alg_type; /* wcrypto_comp_alg_type */
__u8 op_type; /* wcrypto_comp_op_type */
__u8 stream_mode; /* wcrypto_comp_state */
__u8 comp_lv; /* compression level */
__u16 win_size; /* window size */
__u16 data_fmt;/* buffer format */
struct wd_mm_br br;  /* memory operations from user */
};

struct wcrypto_comp_op_data {
__u8 alg_type;/* Denoted by enum wcrypto_comp_alg_type */
__u8 flush; /* indicates from enum wcrypto_comp_flush_type */
__u8 stream_pos;  /* Denoted by enum wcrypto_stream_status */
__u8 status;/* Denoted by WD error code and enum wcrypto_op_result */
__u8 *in; /* Input VA, buffer should be DMA buffer. */
__u8 *out;/* Output data VA pointer, buffer should be DMA-able */
__u32 in_len;/* input data bytes */
__u32 avail_out; /* output buffer size */
__u32 consumed;  /* bytes consumed by the operation */
__u32 produced; /* bytes output by the operation */
__u32 isize;/* gzip isize */
__u32 checksum; /* Will be updated to the checksum of data produced by the operation */
void *priv;       /* private field for extend */
};

Prototype

void * wcrypto_create_comp_ctx (struct wd_queue *q, struct wcrypto_comp_ctx_setup *setup);

Function

Create a CoMP 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_comp(void *ctx, struct wcrypto_comp_op_data *opdata, void *tag);

Function

Perform CoMP operations based on the CoMP context.

Input Description

ctx: COMP context

opdata: CoMP 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 (For details about error codes, see WD Message Error Code Interface.)

Usage Instruction

One ctx supports only one thread.

Precautions

  

Prototype

int wcrypto_comp_poll(struct wd_queue *q, unsigned int num);

Function

Perform CoMP poll operations based on the WD queue.

Input Description

q: WD CoMP 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_comp_ctx (void *ctx);

Function

Delete a CoMP context.

Input Description

ctx: CoMP context to be deleted

Output Description

None

Return Value Description

None

Usage Instruction

  

Precautions