Re: [PATCH v2 4/4] accel-config/test: Convert the key word IAX to IAA
by Dave Jiang
On 4/28/2022 8:13 PM, Li Zhang wrote:
> In names of function, variable, enum and macro, convert all
> the IAX to IAA.
>
> Signed-off-by: Li Zhang <li4.zhang(a)intel.com>
> Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
> ---
> accfg/config.c | 2 +-
> accfg/idxd.h | 144 +++++++++++++++++------------------
> accfg/lib/libaccfg.c | 4 +-
> accfg/libaccel_config.h | 2 +-
> accfg/list.c | 2 +-
> test/accel_test.h | 18 ++---
> test/algorithms/iaa_crc64.c | 2 +-
> test/algorithms/iaa_crc64.h | 8 +-
> test/common | 6 +-
> test/dsa.c | 2 +-
> test/iaa.c | 40 +++++-----
> test/iaa.h | 16 ++--
> test/iaa_prep.c | 8 +-
> test/iaa_test.c | 42 +++++-----
> test/iaa_user_test_runner.sh | 34 ++++-----
> util/json.c | 4 +-
> 16 files changed, 167 insertions(+), 167 deletions(-)
>
> diff --git a/accfg/config.c b/accfg/config.c
> index 3e7d48b..7e8dea3 100644
> --- a/accfg/config.c
> +++ b/accfg/config.c
> @@ -351,7 +351,7 @@ static int group_json_set_val(struct accfg_group *group,
> || (val < 0))
> return -EINVAL;
>
> - if ((accfg_device_get_type(dev) == ACCFG_DEVICE_IAX)
> + if ((accfg_device_get_type(dev) == ACCFG_DEVICE_IAA)
> && ((!strcmp(group_table[i].name,
> "tokens_reserved"))
> || (!strcmp(group_table[i].name,
> diff --git a/accfg/idxd.h b/accfg/idxd.h
> index 718fdad..08e6378 100644
> --- a/accfg/idxd.h
> +++ b/accfg/idxd.h
I would leave this file alone. This is the copy from the kernel source.
Should not be changed. Otherwise you'll run into issues later on when we
copy over a new copy
> @@ -49,7 +49,7 @@ enum idxd_scmd_stat {
> #define IDXD_OP_FLAG_DRDBK 0x4000
> #define IDXD_OP_FLAG_DSTS 0x8000
>
> -/* IAX */
> +/* IAA */
> #define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000
>
> /* Opcode */
> @@ -73,24 +73,24 @@ enum dsa_opcode {
> DSA_OPCODE_CFLUSH = 0x20,
> };
>
> -enum iax_opcode {
> - IAX_OPCODE_NOOP = 0,
> - IAX_OPCODE_DRAIN = 2,
> - IAX_OPCODE_MEMMOVE,
> - IAX_OPCODE_DECOMPRESS = 0x42,
> - IAX_OPCODE_COMPRESS,
> - IAX_OPCODE_CRC64 = 0x44,
> - IAX_OPCODE_ZDECOMPRESS32 = 0x48,
> - IAX_OPCODE_ZDECOMPRESS16,
> - IAX_OPCODE_ZCOMPRESS32 = 0x4c,
> - IAX_OPCODE_ZCOMPRESS16,
> - IAX_OPCODE_SCAN = 0x50,
> - IAX_OPCODE_SET_MEMBERSHIP,
> - IAX_OPCODE_EXTRACT,
> - IAX_OPCODE_SELECT,
> - IAX_OPCODE_RLE_BURST,
> - IAX_OPCODE_FIND_UNIQUE,
> - IAX_OPCODE_EXPAND,
> +enum iaa_opcode {
> + IAA_OPCODE_NOOP = 0,
> + IAA_OPCODE_DRAIN = 2,
> + IAA_OPCODE_MEMMOVE,
> + IAA_OPCODE_DECOMPRESS = 0x42,
> + IAA_OPCODE_COMPRESS,
> + IAA_OPCODE_CRC64 = 0x44,
> + IAA_OPCODE_ZDECOMPRESS32 = 0x48,
> + IAA_OPCODE_ZDECOMPRESS16,
> + IAA_OPCODE_ZCOMPRESS32 = 0x4c,
> + IAA_OPCODE_ZCOMPRESS16,
> + IAA_OPCODE_SCAN = 0x50,
> + IAA_OPCODE_SET_MEMBERSHIP,
> + IAA_OPCODE_EXTRACT,
> + IAA_OPCODE_SELECT,
> + IAA_OPCODE_RLE_BURST,
> + IAA_OPCODE_FIND_UNIQUE,
> + IAA_OPCODE_EXPAND,
> };
>
> /* Completion record status */
> @@ -126,31 +126,31 @@ enum dsa_completion_status {
> DSA_COMP_TRANSLATION_FAIL,
> };
>
> -enum iax_completion_status {
> - IAX_COMP_NONE = 0,
> - IAX_COMP_SUCCESS,
> - IAX_COMP_PAGE_FAULT_IR = 0x04,
> - IAX_COMP_OUTBUF_OVERFLOW,
> - IAX_COMP_BAD_OPCODE = 0x10,
> - IAX_COMP_INVALID_FLAGS,
> - IAX_COMP_NOZERO_RESERVE,
> - IAX_COMP_INVALID_SIZE,
> - IAX_COMP_OVERLAP_BUFFERS = 0x16,
> - IAX_COMP_INT_HANDLE_INVAL = 0x19,
> - IAX_COMP_CRA_XLAT,
> - IAX_COMP_CRA_ALIGN,
> - IAX_COMP_ADDR_ALIGN,
> - IAX_COMP_PRIV_BAD,
> - IAX_COMP_TRAFFIC_CLASS_CONF,
> - IAX_COMP_PFAULT_RDBA,
> - IAX_COMP_HW_ERR1,
> - IAX_COMP_HW_ERR_DRB,
> - IAX_COMP_TRANSLATION_FAIL,
> - IAX_COMP_PRS_TIMEOUT,
> - IAX_COMP_WATCHDOG,
> - IAX_COMP_INVALID_COMP_FLAG = 0x30,
> - IAX_COMP_INVALID_FILTER_FLAG,
> - IAX_COMP_INVALID_NUM_ELEMS = 0x33,
> +enum iaa_completion_status {
> + IAA_COMP_NONE = 0,
> + IAA_COMP_SUCCESS,
> + IAA_COMP_PAGE_FAULT_IR = 0x04,
> + IAA_COMP_OUTBUF_OVERFLOW,
> + IAA_COMP_BAD_OPCODE = 0x10,
> + IAA_COMP_INVALID_FLAGS,
> + IAA_COMP_NOZERO_RESERVE,
> + IAA_COMP_INVALID_SIZE,
> + IAA_COMP_OVERLAP_BUFFERS = 0x16,
> + IAA_COMP_INT_HANDLE_INVAL = 0x19,
> + IAA_COMP_CRA_XLAT,
> + IAA_COMP_CRA_ALIGN,
> + IAA_COMP_ADDR_ALIGN,
> + IAA_COMP_PRIV_BAD,
> + IAA_COMP_TRAFFIC_CLASS_CONF,
> + IAA_COMP_PFAULT_RDBA,
> + IAA_COMP_HW_ERR1,
> + IAA_COMP_HW_ERR_DRB,
> + IAA_COMP_TRANSLATION_FAIL,
> + IAA_COMP_PRS_TIMEOUT,
> + IAA_COMP_WATCHDOG,
> + IAA_COMP_INVALID_COMP_FLAG = 0x30,
> + IAA_COMP_INVALID_FILTER_FLAG,
> + IAA_COMP_INVALID_NUM_ELEMS = 0x33,
> };
>
> #define DSA_COMP_STATUS_MASK 0x7f
> @@ -182,9 +182,9 @@ struct hw_desc {
> uint16_t int_handle;
> union {
> uint16_t rsvd1;
> - uint16_t iax_compr_flags;
> - uint16_t iax_decompr_flags;
> - uint16_t iax_crc64_flags;
> + uint16_t iaa_compr_flags;
> + uint16_t iaa_decompr_flags;
> + uint16_t iaa_crc64_flags;
> };
> union {
> uint8_t expected_res;
> @@ -236,19 +236,19 @@ struct hw_desc {
> uint16_t dest_app_tag_mask;
> uint16_t dest_app_tag_seed;
> };
> - /* IAX common */
> + /* IAA common */
> struct {
> - uint64_t iax_src2_addr;
> - uint32_t iax_max_dst_size;
> - uint32_t iax_src2_xfer_size;
> - uint32_t iax_filter_flags;
> - uint32_t iax_num_inputs;
> + uint64_t iaa_src2_addr;
> + uint32_t iaa_max_dst_size;
> + uint32_t iaa_src2_xfer_size;
> + uint32_t iaa_filter_flags;
> + uint32_t iaa_num_inputs;
> };
> /* CRC64 */
> struct {
> - uint64_t iax_crc64_rsvd;
> - uint64_t iax_crc64_rsvd2;
> - uint64_t iax_crc64_poly;
> + uint64_t iaa_crc64_rsvd;
> + uint64_t iaa_crc64_rsvd2;
> + uint64_t iaa_crc64_poly;
> };
>
> uint8_t op_specific[24];
> @@ -307,26 +307,26 @@ struct completion_record {
> uint16_t dif_upd_dest_app_tag;
> };
>
> - /* IAX common */
> + /* IAA common */
> struct {
> - uint32_t iax_invalid_flags;
> - uint32_t iax_rsvd;
> - uint32_t iax_output_size;
> - uint8_t iax_output_bits;
> - uint8_t iax_rsvd2;
> - uint16_t iax_xor_chksum;
> - uint32_t iax_crc;
> + uint32_t iaa_invalid_flags;
> + uint32_t iaa_rsvd;
> + uint32_t iaa_output_size;
> + uint8_t iaa_output_bits;
> + uint8_t iaa_rsvd2;
> + uint16_t iaa_xor_chksum;
> + uint32_t iaa_crc;
> union {
> - uint32_t iax_min;
> - uint32_t iax_first;
> + uint32_t iaa_min;
> + uint32_t iaa_first;
> };
> union {
> - uint32_t iax_max;
> - uint32_t iax_last;
> + uint32_t iaa_max;
> + uint32_t iaa_last;
> };
> union {
> - uint32_t iax_sum;
> - uint32_t iax_population_cnt;
> + uint32_t iaa_sum;
> + uint32_t iaa_population_cnt;
> };
> };
>
> @@ -339,13 +339,13 @@ struct completion_record {
> uint64_t crc64_result;
> };
>
> - /* To be compatible with IAX, alloc 64 bytes*/
> + /* To be compatible with IAA, alloc 64 bytes*/
> uint8_t op_specific[48];
> };
> } __attribute__((packed));
>
> struct raw_completion_record {
> - /* To be compatible with IAX, alloc 64 bytes*/
> + /* To be compatible with IAA, alloc 64 bytes*/
> uint64_t field[8];
> } __attribute__((packed));
>
> diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
> index be3be69..573bba4 100644
> --- a/accfg/lib/libaccfg.c
> +++ b/accfg/lib/libaccfg.c
> @@ -59,13 +59,13 @@ static int filename_prefix_len;
>
> ACCFG_EXPORT char *accfg_basenames[] = {
> [ACCFG_DEVICE_DSA] = "dsa",
> - [ACCFG_DEVICE_IAX] = "iax",
> + [ACCFG_DEVICE_IAA] = "iax",
> NULL
> };
>
> static unsigned int accfg_device_compl_size[] = {
> [ACCFG_DEVICE_DSA] = 32,
> - [ACCFG_DEVICE_IAX] = 64,
> + [ACCFG_DEVICE_IAA] = 64,
> };
>
> ACCFG_EXPORT char *accfg_mdev_basenames[] = {
> diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
> index fcfcf31..12869e2 100644
> --- a/accfg/libaccel_config.h
> +++ b/accfg/libaccel_config.h
> @@ -35,7 +35,7 @@ enum accfg_device_version {
> /* no need to save device state */
> enum accfg_device_type {
> ACCFG_DEVICE_DSA = 0,
> - ACCFG_DEVICE_IAX = 1,
> + ACCFG_DEVICE_IAA = 1,
> ACCFG_DEVICE_TYPE_UNKNOWN = -1,
> };
>
> diff --git a/accfg/list.c b/accfg/list.c
> index c2c6798..9aa7b3f 100644
> --- a/accfg/list.c
> +++ b/accfg/list.c
> @@ -67,7 +67,7 @@ static struct json_object *group_to_json(struct accfg_group *group,
>
> json_object_object_add(jgroup, "dev", jobj);
>
> - if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAX) {
> + if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAA) {
> jobj = json_object_new_int(accfg_group_get_read_buffers_reserved(group));
> if (!jobj)
> goto err;
> diff --git a/test/accel_test.h b/test/accel_test.h
> index d05176c..dc9f56b 100644
> --- a/test/accel_test.h
> +++ b/test/accel_test.h
> @@ -67,18 +67,18 @@ struct task {
>
> /* Dedicate for IAA test */
> union {
> - uint16_t iax_compr_flags;
> - uint16_t iax_decompr_flags;
> - uint16_t iax_crc64_flags;
> + uint16_t iaa_compr_flags;
> + uint16_t iaa_decompr_flags;
> + uint16_t iaa_crc64_flags;
> };
> - uint32_t iax_max_dst_size;
> - uint32_t iax_src2_xfer_size;
> + uint32_t iaa_max_dst_size;
> + uint32_t iaa_src2_xfer_size;
> union {
> struct {
> - uint32_t iax_filter_flags;
> - uint32_t iax_num_inputs;
> + uint32_t iaa_filter_flags;
> + uint32_t iaa_num_inputs;
> };
> - uint64_t iax_crc64_poly;
> + uint64_t iaa_crc64_poly;
> };
> };
>
> @@ -201,7 +201,7 @@ static inline void dump_compl_rec(struct completion_record *compl, int compl_siz
>
> dbg("completion record addr: %p\n", compl);
>
> - /* To be compatible with IAX, completion record was allocated 64 bytes*/
> + /* To be compatible with IAA, completion record was allocated 64 bytes*/
> for (i = 0; i < num_qword; i++)
> dbg("compl[%d]: 0x%016lx\n", i, rcompl->field[i]);
> }
> diff --git a/test/algorithms/iaa_crc64.c b/test/algorithms/iaa_crc64.c
> index f4c0bec..13980cd 100644
> --- a/test/algorithms/iaa_crc64.c
> +++ b/test/algorithms/iaa_crc64.c
> @@ -119,7 +119,7 @@ static uint64_t read_qword(uint8_t *in, uint32_t len)
> return qword;
> }
>
> -uint64_t iax_calculate_crc64(uint64_t poly, uint8_t *buf, uint32_t len,
> +uint64_t iaa_calculate_crc64(uint64_t poly, uint8_t *buf, uint32_t len,
> uint8_t msb, uint8_t invcrc)
> {
> uint64_t data;
> diff --git a/test/algorithms/iaa_crc64.h b/test/algorithms/iaa_crc64.h
> index d0bc5f9..848d964 100644
> --- a/test/algorithms/iaa_crc64.h
> +++ b/test/algorithms/iaa_crc64.h
> @@ -6,13 +6,13 @@
> #include <stdint.h>
> #include <stdbool.h>
>
> -#define IAX_CRC64_EXTRA_FLAGS_BIT_ORDER 0x8000
> -#define IAX_CRC64_EXTRA_FLAGS_INVERT_CRC 0x4000
> +#define IAA_CRC64_EXTRA_FLAGS_BIT_ORDER 0x8000
> +#define IAA_CRC64_EXTRA_FLAGS_INVERT_CRC 0x4000
>
> /* crc64-ecma-182 */
> -#define IAX_CRC64_POLYNOMIAL 0x42F0E1EBA9EA3693
> +#define IAA_CRC64_POLYNOMIAL 0x42F0E1EBA9EA3693
>
> -uint64_t iax_calculate_crc64(uint64_t poly, uint8_t *buf, uint32_t len,
> +uint64_t iaa_calculate_crc64(uint64_t poly, uint8_t *buf, uint32_t len,
> uint8_t msb, uint8_t invcrc);
>
> #endif
> diff --git a/test/common b/test/common
> index bab4cc4..2f0d1bb 100644
> --- a/test/common
> +++ b/test/common
> @@ -39,12 +39,12 @@ else
> exit "$EXIT_FAILURE"
> fi
>
> -# IAXTEST
> +# IAATEST
> #
> if [ -f "./iaa_test" ] && [ -x "./iaa_test" ]; then
> - export IAXTEST=./iaa_test
> + export IAATEST=./iaa_test
> elif [ -f "$TESTDIR/iaa_test" ] && [ -x "$TESTDIR/iaa_test" ]; then
> - export IAXTEST="$TESTDIR"/iaa_test
> + export IAATEST="$TESTDIR"/iaa_test
> else
> echo "Couldn't find an iaa_test binary"
> exit "$EXIT_FAILURE"
> diff --git a/test/dsa.c b/test/dsa.c
> index 3d982d0..b553434 100644
> --- a/test/dsa.c
> +++ b/test/dsa.c
> @@ -568,7 +568,7 @@ int alloc_batch_task(struct acctest_context *ctx, unsigned int task_num, int num
> return -ENOMEM;
> memset(btsk->sub_descs, 0, task_num * sizeof(struct hw_desc));
>
> - /* To be compatible with IAX, completion record need to be 64-byte aligned */
> + /* To be compatible with IAA, completion record need to be 64-byte aligned */
> btsk->sub_comps =
> aligned_alloc(64, task_num * sizeof(struct completion_record));
> if (!btsk->sub_comps)
> diff --git a/test/iaa.c b/test/iaa.c
> index f5c2f71..3b07464 100644
> --- a/test/iaa.c
> +++ b/test/iaa.c
> @@ -29,7 +29,7 @@ static int init_crc64(struct task *tsk, int tflags, int opcode, unsigned long sr
> if (!tsk->src1)
> return -ENOMEM;
> memset_pattern(tsk->src1, tsk->pattern, src1_xfer_size);
> - tsk->iax_crc64_poly = IAX_CRC64_POLYNOMIAL;
> + tsk->iaa_crc64_poly = IAA_CRC64_POLYNOMIAL;
>
> return ACCTEST_STATUS_OK;
> }
> @@ -43,7 +43,7 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_
>
> /* allocate memory: src1*/
> switch (opcode) {
> - case IAX_OPCODE_CRC64: /* intentionally empty */
> + case IAA_OPCODE_CRC64: /* intentionally empty */
> rc = init_crc64(tsk, tflags, opcode, src1_xfer_size);
> break;
> }
> @@ -59,7 +59,7 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_
> return ACCTEST_STATUS_OK;
> }
>
> -static int iax_wait_noop(struct acctest_context *ctx, struct task *tsk)
> +static int iaa_wait_noop(struct acctest_context *ctx, struct task *tsk)
> {
> struct completion_record *comp = tsk->comp;
> int rc;
> @@ -73,7 +73,7 @@ static int iax_wait_noop(struct acctest_context *ctx, struct task *tsk)
> return ACCTEST_STATUS_OK;
> }
>
> -int iax_noop_multi_task_nodes(struct acctest_context *ctx)
> +int iaa_noop_multi_task_nodes(struct acctest_context *ctx)
> {
> struct task_node *tsk_node = ctx->multi_task_node;
> int ret = ACCTEST_STATUS_OK;
> @@ -81,7 +81,7 @@ int iax_noop_multi_task_nodes(struct acctest_context *ctx)
> while (tsk_node) {
> tsk_node->tsk->dflags |= (IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR);
>
> - iax_prep_noop(tsk_node->tsk);
> + iaa_prep_noop(tsk_node->tsk);
> tsk_node = tsk_node->next;
> }
>
> @@ -94,7 +94,7 @@ int iax_noop_multi_task_nodes(struct acctest_context *ctx)
> info("Submitted all noop jobs\n");
>
> while (tsk_node) {
> - ret = iax_wait_noop(ctx, tsk_node->tsk);
> + ret = iaa_wait_noop(ctx, tsk_node->tsk);
> if (ret != ACCTEST_STATUS_OK)
> info("Desc: %p failed with ret: %d\n",
> tsk_node->tsk->desc, tsk_node->tsk->comp->status);
> @@ -103,7 +103,7 @@ int iax_noop_multi_task_nodes(struct acctest_context *ctx)
> return ret;
> }
>
> -static int iax_wait_crc64(struct acctest_context *ctx, struct task *tsk)
> +static int iaa_wait_crc64(struct acctest_context *ctx, struct task *tsk)
> {
> struct completion_record *comp = tsk->comp;
> int rc;
> @@ -117,7 +117,7 @@ static int iax_wait_crc64(struct acctest_context *ctx, struct task *tsk)
> return ACCTEST_STATUS_OK;
> }
>
> -int iax_crc64_multi_task_nodes(struct acctest_context *ctx)
> +int iaa_crc64_multi_task_nodes(struct acctest_context *ctx)
> {
> struct task_node *tsk_node = ctx->multi_task_node;
> int ret = ACCTEST_STATUS_OK;
> @@ -127,7 +127,7 @@ int iax_crc64_multi_task_nodes(struct acctest_context *ctx)
> if ((tsk_node->tsk->test_flags & TEST_FLAGS_BOF) && ctx->bof)
> tsk_node->tsk->dflags |= IDXD_OP_FLAG_BOF;
>
> - iax_prep_crc64(tsk_node->tsk);
> + iaa_prep_crc64(tsk_node->tsk);
> tsk_node = tsk_node->next;
> }
>
> @@ -140,7 +140,7 @@ int iax_crc64_multi_task_nodes(struct acctest_context *ctx)
>
> tsk_node = ctx->multi_task_node;
> while (tsk_node) {
> - ret = iax_wait_crc64(ctx, tsk_node->tsk);
> + ret = iaa_wait_crc64(ctx, tsk_node->tsk);
> if (ret != ACCTEST_STATUS_OK)
> info("Desc: %p failed with ret: %d\n",
> tsk_node->tsk->desc, tsk_node->tsk->comp->status);
> @@ -151,17 +151,17 @@ int iax_crc64_multi_task_nodes(struct acctest_context *ctx)
> }
>
> /* mismatch_expected: expect mismatched buffer with success status 0x1 */
> -int iax_task_result_verify(struct task *tsk, int mismatch_expected)
> +int iaa_task_result_verify(struct task *tsk, int mismatch_expected)
> {
> int ret = ACCTEST_STATUS_OK;
>
> info("verifying task result for %#lx\n", tsk);
>
> - if (tsk->comp->status != IAX_COMP_SUCCESS)
> + if (tsk->comp->status != IAA_COMP_SUCCESS)
> return tsk->comp->status;
>
> switch (tsk->opcode) {
> - case IAX_OPCODE_CRC64:
> + case IAA_OPCODE_CRC64:
> ret = task_result_verify_crc64(tsk, mismatch_expected);
> }
>
> @@ -171,13 +171,13 @@ int iax_task_result_verify(struct task *tsk, int mismatch_expected)
> return ret;
> }
>
> -int iax_task_result_verify_task_nodes(struct acctest_context *ctx, int mismatch_expected)
> +int iaa_task_result_verify_task_nodes(struct acctest_context *ctx, int mismatch_expected)
> {
> struct task_node *tsk_node = ctx->multi_task_node;
> int ret = ACCTEST_STATUS_OK;
>
> while (tsk_node) {
> - ret = iax_task_result_verify(tsk_node->tsk, mismatch_expected);
> + ret = iaa_task_result_verify(tsk_node->tsk, mismatch_expected);
> if (ret != ACCTEST_STATUS_OK) {
> err("memory result verify failed %d\n", ret);
> return ret;
> @@ -196,14 +196,14 @@ int task_result_verify_crc64(struct task *tsk, int mismatch_expected)
> if (mismatch_expected)
> warn("invalid arg mismatch_expected for %d\n", tsk->opcode);
>
> - if (tsk->iax_crc64_flags == IAX_CRC64_EXTRA_FLAGS_BIT_ORDER) {
> - crc = iax_calculate_crc64(tsk->iax_crc64_poly, tsk->src1,
> + if (tsk->iaa_crc64_flags == IAA_CRC64_EXTRA_FLAGS_BIT_ORDER) {
> + crc = iaa_calculate_crc64(tsk->iaa_crc64_poly, tsk->src1,
> tsk->xfer_size, 1, 0);
> - } else if (tsk->iax_crc64_flags == IAX_CRC64_EXTRA_FLAGS_INVERT_CRC) {
> - crc = iax_calculate_crc64(tsk->iax_crc64_poly, tsk->src1,
> + } else if (tsk->iaa_crc64_flags == IAA_CRC64_EXTRA_FLAGS_INVERT_CRC) {
> + crc = iaa_calculate_crc64(tsk->iaa_crc64_poly, tsk->src1,
> tsk->xfer_size, 0, 1);
> } else {
> - err("Unsupported extra flags %#x\n", tsk->iax_crc64_flags);
> + err("Unsupported extra flags %#x\n", tsk->iaa_crc64_flags);
> return -EINVAL;
> }
>
> diff --git a/test/iaa.h b/test/iaa.h
> index e0bbad2..40e1e29 100644
> --- a/test/iaa.h
> +++ b/test/iaa.h
> @@ -1,7 +1,7 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> /* Copyright(c) 2019 Intel Corporation. All rights reserved. */
> -#ifndef __TEST_IAX_H__
> -#define __TEST_IAX_H__
> +#ifndef __TEST_IAA_H__
> +#define __TEST_IAA_H__
> #include <accfg/libaccel_config.h>
> #include <accfg/idxd.h>
> #include "accel_test.h"
> @@ -9,13 +9,13 @@
>
> int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_size);
>
> -int iax_noop_multi_task_nodes(struct acctest_context *ctx);
> -int iax_crc64_multi_task_nodes(struct acctest_context *ctx);
> -void iax_prep_noop(struct task *tsk);
> -void iax_prep_crc64(struct task *tsk);
> +int iaa_noop_multi_task_nodes(struct acctest_context *ctx);
> +int iaa_crc64_multi_task_nodes(struct acctest_context *ctx);
> +void iaa_prep_noop(struct task *tsk);
> +void iaa_prep_crc64(struct task *tsk);
>
> -int iax_task_result_verify(struct task *tsk, int mismatch_expected);
> -int iax_task_result_verify_task_nodes(struct acctest_context *ctx, int mismatch_expected);
> +int iaa_task_result_verify(struct task *tsk, int mismatch_expected);
> +int iaa_task_result_verify_task_nodes(struct acctest_context *ctx, int mismatch_expected);
> int task_result_verify_crc64(struct task *tsk, int mismatch_expected);
>
> #endif
> diff --git a/test/iaa_prep.c b/test/iaa_prep.c
> index 8522353..d6d46ca 100644
> --- a/test/iaa_prep.c
> +++ b/test/iaa_prep.c
> @@ -9,7 +9,7 @@
> #include "accel_test.h"
> #include "iaa.h"
>
> -void iax_prep_noop(struct task *tsk)
> +void iaa_prep_noop(struct task *tsk)
> {
> info("preparing descriptor for noop\n");
>
> @@ -20,14 +20,14 @@ void iax_prep_noop(struct task *tsk)
> tsk->comp->status = 0;
> }
>
> -void iax_prep_crc64(struct task *tsk)
> +void iaa_prep_crc64(struct task *tsk)
> {
> info("preparing descriptor for memcpy\n");
>
> acctest_prep_desc_common(tsk->desc, tsk->opcode, 0,
> (uint64_t)(tsk->src1), tsk->xfer_size, tsk->dflags);
> tsk->desc->completion_addr = (uint64_t)(tsk->comp);
> - tsk->desc->iax_crc64_flags = tsk->iax_crc64_flags;
> - tsk->desc->iax_crc64_poly = tsk->iax_crc64_poly;
> + tsk->desc->iaa_crc64_flags = tsk->iaa_crc64_flags;
> + tsk->desc->iaa_crc64_poly = tsk->iaa_crc64_poly;
> tsk->comp->status = 0;
> }
> diff --git a/test/iaa_test.c b/test/iaa_test.c
> index cd16949..509498a 100644
> --- a/test/iaa_test.c
> +++ b/test/iaa_test.c
> @@ -8,7 +8,7 @@
> #include "accel_test.h"
> #include "iaa.h"
>
> -#define IAX_TEST_SIZE 20000
> +#define IAA_TEST_SIZE 20000
>
> static void usage(void)
> {
> @@ -19,7 +19,7 @@ static void usage(void)
> " ; 0x4: reserved\n"
> " ; 0x8: prefault buffers\n"
> "-e <extra_flags> ; specified by each opcpde\n"
> - "-o <opcode> ; opcode, same value as in IAX spec\n"
> + "-o <opcode> ; opcode, same value as in IAA spec\n"
> "-d ; wq device such as iax1/wq1.0\n"
> "-n <number of descriptors> ;descriptor count to submit\n"
> "-t <ms timeout> ; ms to wait for descs to complete\n"
> @@ -52,19 +52,19 @@ static int test_noop(struct acctest_context *ctx, int tflags, int num_desc)
> /* allocate memory to src and dest buffers and fill in the desc for all the nodes*/
> tsk_node = ctx->multi_task_node;
> while (tsk_node) {
> - tsk_node->tsk->opcode = IAX_OPCODE_NOOP;
> + tsk_node->tsk->opcode = IAA_OPCODE_NOOP;
> tsk_node->tsk->test_flags = tflags;
> tsk_node = tsk_node->next;
> }
>
> - rc = iax_noop_multi_task_nodes(ctx);
> + rc = iaa_noop_multi_task_nodes(ctx);
> if (rc != ACCTEST_STATUS_OK)
> return rc;
>
> /* Verification of all the nodes*/
> tsk_node = ctx->multi_task_node;
> while (tsk_node) {
> - rc = iax_task_result_verify(tsk_node->tsk, 0);
> + rc = iaa_task_result_verify(tsk_node->tsk, 0);
> tsk_node = tsk_node->next;
> }
>
> @@ -102,7 +102,7 @@ static int test_crc64(struct acctest_context *ctx, size_t buf_size, int tflags,
> /* allocate memory to src and dest buffers and fill in the desc for all the nodes*/
> tsk_node = ctx->multi_task_node;
> while (tsk_node) {
> - tsk_node->tsk->iax_crc64_flags = extra_flags;
> + tsk_node->tsk->iaa_crc64_flags = extra_flags;
>
> rc = init_task(tsk_node->tsk, tflags, opcode, buf_size);
> if (rc != ACCTEST_STATUS_OK)
> @@ -112,13 +112,13 @@ static int test_crc64(struct acctest_context *ctx, size_t buf_size, int tflags,
> }
>
> switch (opcode) {
> - case IAX_OPCODE_CRC64:
> - rc = iax_crc64_multi_task_nodes(ctx);
> + case IAA_OPCODE_CRC64:
> + rc = iaa_crc64_multi_task_nodes(ctx);
> if (rc != ACCTEST_STATUS_OK)
> return rc;
>
> /* Verification of all the nodes*/
> - rc = iax_task_result_verify_task_nodes(ctx, 0);
> + rc = iaa_task_result_verify_task_nodes(ctx, 0);
> if (rc != ACCTEST_STATUS_OK)
> return rc;
> break;
> @@ -136,13 +136,13 @@ static int test_crc64(struct acctest_context *ctx, size_t buf_size, int tflags,
>
> int main(int argc, char *argv[])
> {
> - struct acctest_context *iax;
> + struct acctest_context *iaa;
> int rc = 0;
> int wq_type = SHARED;
> - unsigned long buf_size = IAX_TEST_SIZE;
> + unsigned long buf_size = IAA_TEST_SIZE;
> int tflags = TEST_FLAGS_BOF;
> int extra_flags = 0;
> - int opcode = IAX_OPCODE_NOOP;
> + int opcode = IAA_OPCODE_NOOP;
> int opt;
> char dev_type[MAX_DEV_LEN];
> int wq_id = ACCTEST_DEVICE_ID_NO_INPUT;
> @@ -192,29 +192,29 @@ int main(int argc, char *argv[])
> }
> }
>
> - iax = acctest_init(tflags);
> + iaa = acctest_init(tflags);
>
> - if (!iax)
> + if (!iaa)
> return -ENOMEM;
>
> - rc = acctest_alloc(iax, wq_type, dev_id, wq_id);
> + rc = acctest_alloc(iaa, wq_type, dev_id, wq_id);
> if (rc < 0)
> return -ENOMEM;
>
> - if (buf_size > iax->max_xfer_size) {
> + if (buf_size > iaa->max_xfer_size) {
> err("invalid transfer size: %lu\n", buf_size);
> return -EINVAL;
> }
>
> switch (opcode) {
> - case IAX_OPCODE_NOOP:
> - rc = test_noop(iax, tflags, num_desc);
> + case IAA_OPCODE_NOOP:
> + rc = test_noop(iaa, tflags, num_desc);
> if (rc != ACCTEST_STATUS_OK)
> goto error;
> break;
>
> - case IAX_OPCODE_CRC64:
> - rc = test_crc64(iax, buf_size, tflags, extra_flags, opcode, num_desc);
> + case IAA_OPCODE_CRC64:
> + rc = test_crc64(iaa, buf_size, tflags, extra_flags, opcode, num_desc);
> if (rc != ACCTEST_STATUS_OK)
> goto error;
> break;
> @@ -225,6 +225,6 @@ int main(int argc, char *argv[])
> }
>
> error:
> - acctest_free(iax);
> + acctest_free(iaa);
> return rc;
> }
> diff --git a/test/iaa_user_test_runner.sh b/test/iaa_user_test_runner.sh
> index 4d229c6..532939e 100755
> --- a/test/iaa_user_test_runner.sh
> +++ b/test/iaa_user_test_runner.sh
> @@ -6,48 +6,48 @@
>
> rc="$EXIT_SKIP"
>
> -IAX=iax1
> +IAA=iax1
> WQ0=wq1.4
> WQ1=wq1.1
>
> trap 'err $LINENO' ERR
>
> -[ ! -f "$IAXTEST" ] && echo "fail: $LINENO" && exit 1
> +[ ! -f "$IAATEST" ] && echo "fail: $LINENO" && exit 1
>
> check_min_kver "5.6" || do_skip "kernel does not support idxd"
>
> # skip if no pasid support as iaa_test does not support operation w/o pasid yet.
> -[ ! -f "/sys/bus/dsa/devices/$IAX/pasid_enabled" ] && echo "No SVM support" && exit "$EXIT_SKIP"
> +[ ! -f "/sys/bus/dsa/devices/$IAA/pasid_enabled" ] && echo "No SVM support" && exit "$EXIT_SKIP"
>
> -pasid_en=$(cat /sys/bus/dsa/devices/$IAX/pasid_enabled)
> +pasid_en=$(cat /sys/bus/dsa/devices/$IAA/pasid_enabled)
> if [ "$pasid_en" -ne 1 ]; then
> exit "$EXIT_SKIP"
> fi
>
> -start_iax()
> +start_iaa()
> {
> - configurable=$(cat /sys/bus/dsa/devices/$IAX/configurable)
> + configurable=$(cat /sys/bus/dsa/devices/$IAA/configurable)
> if [ "$configurable" ]; then
> "$ACCFG" load-config -c "$CONFIG2"
> fi
> - "$ACCFG" enable-device "$IAX"
> + "$ACCFG" enable-device "$IAA"
> }
>
> -stop_iax()
> +stop_iaa()
> {
> - "$ACCFG" disable-device "$IAX"
> + "$ACCFG" disable-device "$IAA"
> }
>
> enable_wqs()
> {
> - "$ACCFG" enable-wq "$IAX"/"$WQ0"
> - "$ACCFG" enable-wq "$IAX"/"$WQ1"
> + "$ACCFG" enable-wq "$IAA"/"$WQ0"
> + "$ACCFG" enable-wq "$IAA"/"$WQ1"
> }
>
> disable_wqs()
> {
> - "$ACCFG" disable-wq "$IAX"/"$WQ0"
> - "$ACCFG" disable-wq "$IAX"/"$WQ1"
> + "$ACCFG" disable-wq "$IAA"/"$WQ0"
> + "$ACCFG" disable-wq "$IAA"/"$WQ1"
> }
>
> # Test operation with a given opcode
> @@ -71,10 +71,10 @@ test_op()
> echo "Testing $xfer_size bytes"
> if [ "$extra_flag" != "" ]
> then
> - "$IAXTEST" -w "$wq_mode_code" -l "$xfer_size" -o "$opcode" \
> + "$IAATEST" -w "$wq_mode_code" -l "$xfer_size" -o "$opcode" \
> -f "$flag" -e "$extra_flag" -t 5000 -v
> else
> - "$IAXTEST" -w "$wq_mode_code" -l "$xfer_size" -o "$opcode" \
> + "$IAATEST" -w "$wq_mode_code" -l "$xfer_size" -o "$opcode" \
> -f "$flag" -t 5000 -v
> fi
> done
> @@ -82,7 +82,7 @@ test_op()
> }
>
> _cleanup
> -start_iax
> +start_iaa
> enable_wqs
> # shellcheck disable=SC2034
> rc="$EXIT_FAILURE"
> @@ -114,6 +114,6 @@ for opcode in "0x44"; do
> done
>
> disable_wqs
> -stop_iax
> +stop_iaa
> _cleanup
> exit 0
> diff --git a/util/json.c b/util/json.c
> index e99ca31..3d2c8a4 100644
> --- a/util/json.c
> +++ b/util/json.c
> @@ -168,7 +168,7 @@ struct json_object *util_device_to_json(struct accfg_device *device,
> jobj = json_object_new_int(accfg_device_get_read_buffer_limit(device));
> if (!jobj)
> goto err;
> - if (accfg_device_get_type(device) != ACCFG_DEVICE_IAX)
> + if (accfg_device_get_type(device) != ACCFG_DEVICE_IAA)
> json_object_object_add(jdevice, "read_buffer_limit", jobj);
>
> if (flags & UTIL_JSON_SAVE) {
> @@ -273,7 +273,7 @@ struct json_object *util_device_to_json(struct accfg_device *device,
> jobj = json_object_new_int(accfg_device_get_max_read_buffers(device));
> if (!jobj)
> goto err;
> - if (accfg_device_get_type(device) != ACCFG_DEVICE_IAX)
> + if (accfg_device_get_type(device) != ACCFG_DEVICE_IAA)
> json_object_object_add(jdevice, "max_read_buffers", jobj);
>
> ulong_val = accfg_device_get_max_batch_size(device);
2 months
Re: [PATCH v2 1/4] accel-config/test: Add a software CRC64 algorithm
by Dave Jiang
On 4/28/2022 8:13 PM, Li Zhang wrote:
> Create a new folder for placing all software algorithms, such as
> CRC64, Compress, Decompress, Zcompress, Zdecompress, etc. Add
> CRC64 algorithm and modify Makefile.
Still see lots of IAX and iaa in this patch. Was that missed?
> Signed-off-by: Li Zhang <li4.zhang(a)intel.com>
> Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
Please remove my review tag until I've explicitly given that. Thanks.
> ---
> test/Makefile.am | 2 +-
> test/algorithms/iaa_crc64.c | 152 ++++++++++++++++++++++++++++++++++++
> test/algorithms/iaa_crc64.h | 18 +++++
> 3 files changed, 171 insertions(+), 1 deletion(-)
> create mode 100644 test/algorithms/iaa_crc64.c
> create mode 100644 test/algorithms/iaa_crc64.h
>
> diff --git a/test/Makefile.am b/test/Makefile.am
> index b02436c..07f8d24 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -38,5 +38,5 @@ libaccfg_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS)
> dsa_test_SOURCES = dsa_test.c dsa.c dsa_prep.c accel_test.c
> dsa_test_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS)
>
> -iaa_test_SOURCES = iaa_test.c iaa.c iaa_prep.c accel_test.c
> +iaa_test_SOURCES = iaa_test.c iaa.c iaa_prep.c accel_test.c algorithms/iaa_crc64.c algorithms/iaa_crc64.h
> iaa_test_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS)
> diff --git a/test/algorithms/iaa_crc64.c b/test/algorithms/iaa_crc64.c
> new file mode 100644
> index 0000000..f4c0bec
> --- /dev/null
> +++ b/test/algorithms/iaa_crc64.c
> @@ -0,0 +1,152 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright(c) 2019 Intel Corporation. All rights reserved. */
> +#include <stdio.h>
> +#include <stdint.h>
> +#include "iaa_crc64.h"
> +
> +static const uint8_t bitrev8[0x100] = {
> +0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
> +0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
> +0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
> +0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
> +0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
> +0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
> +0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
> +0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
> +0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
> +0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
> +0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
> +0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
> +0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
> +0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
> +0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
> +0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF,
> +};
> +
> +static uint64_t bit_byte_swap64(uint64_t x)
> +{
> + uint64_t y;
> +
> + y = bitrev8[x >> 56];
> + y |= ((uint64_t)bitrev8[(x >> 48) & 0xff]) << 8;
> + y |= ((uint64_t)bitrev8[(x >> 40) & 0xff]) << 16;
> + y |= ((uint64_t)bitrev8[(x >> 32) & 0xff]) << 24;
> + y |= ((uint64_t)bitrev8[(x >> 24) & 0xff]) << 32;
> + y |= ((uint64_t)bitrev8[(x >> 16) & 0xff]) << 40;
> + y |= ((uint64_t)bitrev8[(x >> 8) & 0xff]) << 48;
> + y |= ((uint64_t)bitrev8[(x >> 0) & 0xff]) << 56;
> + return y;
> +}
> +
> +static void crc64_init_tbl(uint64_t *tbl, uint64_t poly, uint8_t msb)
> +{
> + uint64_t crc, i;
> + uint32_t j;
> +
> + tbl[0] = 0;
> +
> + if (msb) {
> + poly = bit_byte_swap64(poly);
> + for (i = 1; i < 256; i++) {
> + crc = i;
> + for (j = 0; j < 8; j++)
> + if (crc & 0x0000000000000001ULL)
> + crc = (crc >> 1) ^ poly;
> + else
> + crc = (crc >> 1);
> + tbl[i] = crc;
> + }
> + } else {
> + for (i = 1; i < 256; i++) {
> + crc = i << 56;
> + for (j = 0; j < 8; j++)
> + if (crc & 0x8000000000000000ULL)
> + crc = (crc << 1) ^ poly;
> + else
> + crc = (crc << 1);
> + tbl[i] = crc;
> + }
> + }
> +}
> +
> +static uint64_t crc64_init_crc(uint64_t poly, uint8_t msb, uint8_t invcrc)
> +{
> + if (!invcrc)
> + return 0;
> + poly |= (poly << 1);
> + poly |= (poly << 2);
> + poly |= (poly << 4);
> + poly |= (poly << 8);
> + poly |= (poly << 16);
> + poly |= (poly << 32);
> + if (!msb)
> + return poly;
> + return bit_byte_swap64(poly);
> +}
> +
> +static uint64_t crc64_update(uint8_t data, uint64_t *tbl, uint64_t crc, uint8_t msb)
> +{
> + if (msb)
> + return tbl[data ^ (crc & 0xff)] ^ (crc >> 8);
> + else
> + return tbl[data ^ (crc >> 56)] ^ (crc << 8);
> +}
> +
> +static uint64_t crc64_finalize(uint64_t crc, uint64_t poly, uint8_t msb, uint8_t invcrc)
> +{
> + if (!invcrc)
> + return crc;
> + poly |= (poly << 1);
> + poly |= (poly << 2);
> + poly |= (poly << 4);
> + poly |= (poly << 8);
> + poly |= (poly << 16);
> + poly |= (poly << 32);
> + if (!msb)
> + return crc ^ poly;
> + return crc ^ bit_byte_swap64(poly);
> +}
> +
> +/* convert 8 bytes array to uint64_t, if not aligned, fill up with 0*/
> +static uint64_t read_qword(uint8_t *in, uint32_t len)
> +{
> + uint32_t i;
> + uint64_t qword = 0;
> +
> + for (i = 0; i < len; i++)
> + qword |= ((((uint64_t)in[i]) & 0xFF) << (8 * i));
> +
> + return qword;
> +}
> +
> +uint64_t iax_calculate_crc64(uint64_t poly, uint8_t *buf, uint32_t len,
> + uint8_t msb, uint8_t invcrc)
> +{
> + uint64_t data;
> + uint32_t data_size, i = 0, j = 0;
> + uint64_t tbl[256], crc;
> + uint8_t *ptr;
> + uint32_t aligned_len = len & 0xfffffff8;
> + uint32_t remain_len = len - aligned_len;
> +
> + crc64_init_tbl(tbl, poly, msb);
> + crc = crc64_init_crc(poly, msb, invcrc);
> +
> + for (i = 0; i < aligned_len; i += sizeof(uint64_t)) {
> + ptr = &buf[i];
> + data = read_qword(ptr, sizeof(uint64_t));
> + data_size = sizeof(uint64_t) * 8;
> + for (j = 0; j < data_size; j += 8)
> + crc = crc64_update((uint8_t)(data >> j), tbl, crc, msb);
> + }
> +
> + if (remain_len) {
> + ptr = &buf[i];
> + data = read_qword(ptr, remain_len);
> + data_size = remain_len * 8;
> + for (j = 0; j < data_size; j += 8)
> + crc = crc64_update((uint8_t)(data >> j), tbl, crc, msb);
> + }
> + crc = crc64_finalize(crc, poly, msb, invcrc);
> + return crc;
> +}
> diff --git a/test/algorithms/iaa_crc64.h b/test/algorithms/iaa_crc64.h
> new file mode 100644
> index 0000000..d0bc5f9
> --- /dev/null
> +++ b/test/algorithms/iaa_crc64.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright(c) 2019 Intel Corporation. All rights reserved. */
> +#ifndef _USR_CRC64_H_
> +#define _USR_CRC64_H_
> +
> +#include <stdint.h>
> +#include <stdbool.h>
> +
> +#define IAX_CRC64_EXTRA_FLAGS_BIT_ORDER 0x8000
> +#define IAX_CRC64_EXTRA_FLAGS_INVERT_CRC 0x4000
> +
> +/* crc64-ecma-182 */
> +#define IAX_CRC64_POLYNOMIAL 0x42F0E1EBA9EA3693
> +
> +uint64_t iax_calculate_crc64(uint64_t poly, uint8_t *buf, uint32_t len,
> + uint8_t msb, uint8_t invcrc);
> +
> +#endif
2 months
Re: [PATCH] accel-config/test: Remove unused global variable ms_timeout
by Ramesh Thomas
This gives compilation error
/usr/local/bin/ld: dsa_test.o: in function `main':
/home/rt/dsa/idxd-config/test/dsa_test.c:687: undefined reference to
`ms_timeout'
/usr/local/bin/ld: dsa.o: in function `dsa_wait_noop':
/home/rt/dsa/idxd-config/test/dsa.c:617: undefined reference to `ms_timeout'
/usr/local/bin/ld: dsa.o: in function `dsa_wait_batch':
/home/rt/dsa/idxd-config/test/dsa.c:664: undefined reference to `ms_timeout'
/usr/local/bin/ld: dsa.o: in function `dsa_wait_drain':
/home/rt/dsa/idxd-config/test/dsa.c:679: undefined reference to `ms_timeout'
/usr/local/bin/ld: dsa.o: in function `dsa_wait_memcpy':
/home/rt/dsa/idxd-config/test/dsa.c:726: undefined reference to `ms_timeout'
/usr/local/bin/ld: dsa.o:/home/rt/dsa/idxd-config/test/dsa.c:782: more
undefined references to `ms_timeout' follow
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:697: dsa_test] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/local/bin/ld: iaa_test.o: in function `main':
/home/rt/dsa/idxd-config/test/iaa_test.c:118: undefined reference to
`ms_timeout'
/usr/local/bin/ld: iaa.o: in function `iax_wait_noop':
/home/rt/dsa/idxd-config/test/iaa.c:25: undefined reference to `ms_timeout'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:701: iaa_test] Error 1
make[1]: *** [Makefile:754: all-recursive] Error 1
make: *** [Makefile:532: all] Error 2
On 4/28/2022 8:49 AM, Dave Jiang wrote:
> ms_timeout is not used by anything. Remove.
>
> Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
> ---
> test/accel_test.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/test/accel_test.c b/test/accel_test.c
> index 84ab13e77fa5..24652c7c05d3 100644
> --- a/test/accel_test.c
> +++ b/test/accel_test.c
> @@ -15,7 +15,6 @@
> #include <accfg/idxd.h>
> #include "accel_test.h"
>
> -unsigned int ms_timeout = 5000;
> int debug_logging;
> static int umwait_support;
>
>
> _______________________________________________
> Accel-config mailing list -- accel-config(a)lists.01.org
> To unsubscribe send an email to accel-config-leave(a)lists.01.org
2 months
Re: [PATCH v1 2/3] accel-config/test: Add source code of operation CRC64
by Dave Jiang
On 4/28/2022 2:56 AM, Li Zhang wrote:
> Add source code of operation CRC64 into IAA test.
Do we want to convert all the IAX to IAA since this is new code?
>
> Signed-off-by: Li Zhang <li4.zhang(a)intel.com>
> Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
> ---
> test/iaa.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++-
> test/iaa.h | 7 ++-
> test/iaa_prep.c | 12 ++++
> test/iaa_test.c | 70 +++++++++++++++++++++
> 4 files changed, 244 insertions(+), 3 deletions(-)
>
> diff --git a/test/iaa.c b/test/iaa.c
> index 639d82f..f5c2f71 100644
> --- a/test/iaa.c
> +++ b/test/iaa.c
> @@ -16,6 +16,48 @@
> #include <accfg/idxd.h>
> #include "accel_test.h"
> #include "iaa.h"
> +#include "algorithms/iaa_crc64.h"
> +
> +static int init_crc64(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_size)
> +{
> + tsk->pattern = 0x98765432abcdef01;
> + tsk->opcode = opcode;
> + tsk->test_flags = tflags;
> + tsk->xfer_size = src1_xfer_size;
> +
> + tsk->src1 = malloc(src1_xfer_size);
> + if (!tsk->src1)
> + return -ENOMEM;
> + memset_pattern(tsk->src1, tsk->pattern, src1_xfer_size);
> + tsk->iax_crc64_poly = IAX_CRC64_POLYNOMIAL;
> +
> + return ACCTEST_STATUS_OK;
> +}
> +
> +/* this function is re-used by batch task */
> +int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_size)
> +{
> + int rc = 0;
> +
> + dbg("initilizing single task %#lx\n", tsk);
> +
> + /* allocate memory: src1*/
> + switch (opcode) {
> + case IAX_OPCODE_CRC64: /* intentionally empty */
> + rc = init_crc64(tsk, tflags, opcode, src1_xfer_size);
> + break;
> + }
> +
> + if (rc != ACCTEST_STATUS_OK) {
> + err("init: opcode %d data failed\n", opcode);
> + return rc;
> + }
> +
> + dbg("Mem allocated: s1 %#lx s2 %#lx d %#lx\n",
> + tsk->src1, tsk->src2, tsk->dst1);
> +
> + return ACCTEST_STATUS_OK;
> +}
>
> static int iax_wait_noop(struct acctest_context *ctx, struct task *tsk)
> {
> @@ -61,15 +103,127 @@ int iax_noop_multi_task_nodes(struct acctest_context *ctx)
> return ret;
> }
>
> +static int iax_wait_crc64(struct acctest_context *ctx, struct task *tsk)
> +{
> + struct completion_record *comp = tsk->comp;
> + int rc;
> +
> + rc = acctest_wait_on_desc_timeout(comp, ctx, ms_timeout);
> + if (rc < 0) {
> + err("crc64 desc timeout\n");
> + return ACCTEST_STATUS_TIMEOUT;
> + }
> +
> + return ACCTEST_STATUS_OK;
> +}
> +
> +int iax_crc64_multi_task_nodes(struct acctest_context *ctx)
> +{
> + struct task_node *tsk_node = ctx->multi_task_node;
> + int ret = ACCTEST_STATUS_OK;
> +
> + while (tsk_node) {
> + tsk_node->tsk->dflags |= (IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR);
> + if ((tsk_node->tsk->test_flags & TEST_FLAGS_BOF) && ctx->bof)
> + tsk_node->tsk->dflags |= IDXD_OP_FLAG_BOF;
> +
> + iax_prep_crc64(tsk_node->tsk);
> + tsk_node = tsk_node->next;
> + }
> +
> + info("Submitted all crc64 jobs\n");
> + tsk_node = ctx->multi_task_node;
> + while (tsk_node) {
> + acctest_desc_submit(ctx, tsk_node->tsk->desc);
> + tsk_node = tsk_node->next;
> + }
> +
> + tsk_node = ctx->multi_task_node;
> + while (tsk_node) {
> + ret = iax_wait_crc64(ctx, tsk_node->tsk);
> + if (ret != ACCTEST_STATUS_OK)
> + info("Desc: %p failed with ret: %d\n",
> + tsk_node->tsk->desc, tsk_node->tsk->comp->status);
> + tsk_node = tsk_node->next;
> + }
> +
> + return ret;
> +}
> +
> /* mismatch_expected: expect mismatched buffer with success status 0x1 */
> int iax_task_result_verify(struct task *tsk, int mismatch_expected)
> {
> + int ret = ACCTEST_STATUS_OK;
> +
> info("verifying task result for %#lx\n", tsk);
>
> if (tsk->comp->status != IAX_COMP_SUCCESS)
> return tsk->comp->status;
>
> - info("test with op %d passed\n", tsk->opcode);
> + switch (tsk->opcode) {
> + case IAX_OPCODE_CRC64:
> + ret = task_result_verify_crc64(tsk, mismatch_expected);
> + }
>
> - return ACCTEST_STATUS_OK;
> + if (ret == ACCTEST_STATUS_OK)
> + info("test with op %d passed\n", tsk->opcode);
> +
> + return ret;
> +}
> +
> +int iax_task_result_verify_task_nodes(struct acctest_context *ctx, int mismatch_expected)
> +{
> + struct task_node *tsk_node = ctx->multi_task_node;
> + int ret = ACCTEST_STATUS_OK;
> +
> + while (tsk_node) {
> + ret = iax_task_result_verify(tsk_node->tsk, mismatch_expected);
> + if (ret != ACCTEST_STATUS_OK) {
> + err("memory result verify failed %d\n", ret);
> + return ret;
> + }
> + tsk_node = tsk_node->next;
> + }
> +
> + return ret;
> +}
> +
> +int task_result_verify_crc64(struct task *tsk, int mismatch_expected)
> +{
> + int rc;
> + uint64_t crc;
> +
> + if (mismatch_expected)
> + warn("invalid arg mismatch_expected for %d\n", tsk->opcode);
> +
> + if (tsk->iax_crc64_flags == IAX_CRC64_EXTRA_FLAGS_BIT_ORDER) {
> + crc = iax_calculate_crc64(tsk->iax_crc64_poly, tsk->src1,
> + tsk->xfer_size, 1, 0);
> + } else if (tsk->iax_crc64_flags == IAX_CRC64_EXTRA_FLAGS_INVERT_CRC) {
> + crc = iax_calculate_crc64(tsk->iax_crc64_poly, tsk->src1,
> + tsk->xfer_size, 0, 1);
> + } else {
> + err("Unsupported extra flags %#x\n", tsk->iax_crc64_flags);
> + return -EINVAL;
> + }
> +
> + rc = memcmp((void *)(&tsk->comp->crc64_result), (void *)(&crc), sizeof(uint64_t));
> +
> + if (!mismatch_expected) {
> + if (rc) {
> + err("crc64 mismatch, memcmp rc %d\n", rc);
> + err("expected crc=0x%llX, actual crc=0x%llX\n",
> + crc, tsk->comp->crc64_result);
> + return -ENXIO;
> + }
> + return ACCTEST_STATUS_OK;
> + }
> +
> + /* mismatch_expected */
> + if (rc) {
> + info("expected mismatch in crc 0x%llX\n", tsk->comp->crc64_result);
> + return ACCTEST_STATUS_OK;
> + }
> +
> + return -ENXIO;
> }
> diff --git a/test/iaa.h b/test/iaa.h
> index 0560d2c..e0bbad2 100644
> --- a/test/iaa.h
> +++ b/test/iaa.h
> @@ -7,10 +7,15 @@
> #include "accel_test.h"
> #include "accfg_test.h"
>
> -int iax_noop_multi_task_nodes(struct acctest_context *ctx);
> +int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_size);
>
> +int iax_noop_multi_task_nodes(struct acctest_context *ctx);
> +int iax_crc64_multi_task_nodes(struct acctest_context *ctx);
> void iax_prep_noop(struct task *tsk);
> +void iax_prep_crc64(struct task *tsk);
>
> int iax_task_result_verify(struct task *tsk, int mismatch_expected);
> +int iax_task_result_verify_task_nodes(struct acctest_context *ctx, int mismatch_expected);
> +int task_result_verify_crc64(struct task *tsk, int mismatch_expected);
>
> #endif
> diff --git a/test/iaa_prep.c b/test/iaa_prep.c
> index f7f8712..8522353 100644
> --- a/test/iaa_prep.c
> +++ b/test/iaa_prep.c
> @@ -19,3 +19,15 @@ void iax_prep_noop(struct task *tsk)
> tsk->desc->completion_addr = (uint64_t)(tsk->comp);
> tsk->comp->status = 0;
> }
> +
> +void iax_prep_crc64(struct task *tsk)
> +{
> + info("preparing descriptor for memcpy\n");
> +
> + acctest_prep_desc_common(tsk->desc, tsk->opcode, 0,
> + (uint64_t)(tsk->src1), tsk->xfer_size, tsk->dflags);
> + tsk->desc->completion_addr = (uint64_t)(tsk->comp);
> + tsk->desc->iax_crc64_flags = tsk->iax_crc64_flags;
> + tsk->desc->iax_crc64_poly = tsk->iax_crc64_poly;
> + tsk->comp->status = 0;
> +}
> diff --git a/test/iaa_test.c b/test/iaa_test.c
> index b398378..cd16949 100644
> --- a/test/iaa_test.c
> +++ b/test/iaa_test.c
> @@ -18,6 +18,7 @@ static void usage(void)
> "-f <test_flags> ; 0x1: block-on-fault\n"
> " ; 0x4: reserved\n"
> " ; 0x8: prefault buffers\n"
> + "-e <extra_flags> ; specified by each opcpde\n"
> "-o <opcode> ; opcode, same value as in IAX spec\n"
> "-d ; wq device such as iax1/wq1.0\n"
> "-n <number of descriptors> ;descriptor count to submit\n"
> @@ -74,6 +75,65 @@ static int test_noop(struct acctest_context *ctx, int tflags, int num_desc)
> return rc;
> }
>
> +static int test_crc64(struct acctest_context *ctx, size_t buf_size, int tflags,
> + int extra_flags, uint32_t opcode, int num_desc)
> +{
> + struct task_node *tsk_node;
> + int rc = ACCTEST_STATUS_OK;
> + int itr = num_desc, i = 0, range = 0;
> +
> + info("testcrc64: opcode %d len %#lx tflags %#x num_desc %ld extra_flags %#lx\n",
> + opcode, buf_size, tflags, num_desc, extra_flags);
> +
> + ctx->is_batch = 0;
> +
> + if (ctx->dedicated == ACCFG_WQ_SHARED)
> + range = ctx->threshold;
> + else
> + range = ctx->wq_size;
> +
> + while (itr > 0 && rc == ACCTEST_STATUS_OK) {
> + i = (itr < range) ? itr : range;
> + /* Allocate memory to all the task nodes, desc, completion record*/
> + rc = acctest_alloc_multiple_tasks(ctx, i);
> + if (rc != ACCTEST_STATUS_OK)
> + return rc;
> +
> + /* allocate memory to src and dest buffers and fill in the desc for all the nodes*/
> + tsk_node = ctx->multi_task_node;
> + while (tsk_node) {
> + tsk_node->tsk->iax_crc64_flags = extra_flags;
> +
> + rc = init_task(tsk_node->tsk, tflags, opcode, buf_size);
> + if (rc != ACCTEST_STATUS_OK)
> + return rc;
> +
> + tsk_node = tsk_node->next;
> + }
> +
> + switch (opcode) {
> + case IAX_OPCODE_CRC64:
> + rc = iax_crc64_multi_task_nodes(ctx);
> + if (rc != ACCTEST_STATUS_OK)
> + return rc;
> +
> + /* Verification of all the nodes*/
> + rc = iax_task_result_verify_task_nodes(ctx, 0);
> + if (rc != ACCTEST_STATUS_OK)
> + return rc;
> + break;
> + default:
> + err("Unsupported op %#x\n", opcode);
> + return -EINVAL;
> + }
> +
> + acctest_free_task(ctx);
> + itr = itr - range;
> + }
> +
> + return rc;
> +}
> +
> int main(int argc, char *argv[])
> {
> struct acctest_context *iax;
> @@ -81,6 +141,7 @@ int main(int argc, char *argv[])
> int wq_type = SHARED;
> unsigned long buf_size = IAX_TEST_SIZE;
> int tflags = TEST_FLAGS_BOF;
> + int extra_flags = 0;
> int opcode = IAX_OPCODE_NOOP;
> int opt;
> char dev_type[MAX_DEV_LEN];
> @@ -100,6 +161,9 @@ int main(int argc, char *argv[])
> case 'f':
> tflags = strtoul(optarg, NULL, 0);
> break;
> + case 'e':
> + extra_flags = strtoul(optarg, NULL, 0);
> + break;
> case 'o':
> opcode = strtoul(optarg, NULL, 0);
> break;
> @@ -149,6 +213,12 @@ int main(int argc, char *argv[])
> goto error;
> break;
>
> + case IAX_OPCODE_CRC64:
> + rc = test_crc64(iax, buf_size, tflags, extra_flags, opcode, num_desc);
> + if (rc != ACCTEST_STATUS_OK)
> + goto error;
> + break;
> +
> default:
> rc = -EINVAL;
> break;
2 months
Re: [PATCH v1 1/3] accel-config/test: Add a software CRC64 algorithm
by Dave Jiang
On 4/28/2022 2:56 AM, Li Zhang wrote:
> Create a new folder for placing all software algorithms, such as
> CRC64, Compress, Decompress, Zcompress, Zdecompress, etc. Add
> CRC64 algorithm and modify Makefile.
>
> Signed-off-by: Li Zhang <li4.zhang(a)intel.com>
> Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
> ---
> test/Makefile.am | 2 +-
> test/algorithms/iaa_crc64.c | 152 ++++++++++++++++++++++++++++++++++++
> test/algorithms/iaa_crc64.h | 18 +++++
> 3 files changed, 171 insertions(+), 1 deletion(-)
> create mode 100644 test/algorithms/iaa_crc64.c
> create mode 100644 test/algorithms/iaa_crc64.h
>
> diff --git a/test/Makefile.am b/test/Makefile.am
> index b02436c..07f8d24 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -38,5 +38,5 @@ libaccfg_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS)
> dsa_test_SOURCES = dsa_test.c dsa.c dsa_prep.c accel_test.c
> dsa_test_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS)
>
> -iaa_test_SOURCES = iaa_test.c iaa.c iaa_prep.c accel_test.c
> +iaa_test_SOURCES = iaa_test.c iaa.c iaa_prep.c accel_test.c algorithms/iaa_crc64.c algorithms/iaa_crc64.h
> iaa_test_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS)
> diff --git a/test/algorithms/iaa_crc64.c b/test/algorithms/iaa_crc64.c
> new file mode 100644
> index 0000000..f4c0bec
> --- /dev/null
> +++ b/test/algorithms/iaa_crc64.c
> @@ -0,0 +1,152 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright(c) 2019 Intel Corporation. All rights reserved. */
> +#include <stdio.h>
> +#include <stdint.h>
> +#include "iaa_crc64.h"
> +
> +static const uint8_t bitrev8[0x100] = {
> +0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
> +0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
> +0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
> +0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
> +0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
> +0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
> +0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
> +0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
> +0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
> +0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
> +0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
> +0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
> +0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
> +0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
> +0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
> +0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF,
> +};
> +
> +static uint64_t bit_byte_swap64(uint64_t x)
> +{
> + uint64_t y;
> +
> + y = bitrev8[x >> 56];
> + y |= ((uint64_t)bitrev8[(x >> 48) & 0xff]) << 8;
> + y |= ((uint64_t)bitrev8[(x >> 40) & 0xff]) << 16;
> + y |= ((uint64_t)bitrev8[(x >> 32) & 0xff]) << 24;
> + y |= ((uint64_t)bitrev8[(x >> 24) & 0xff]) << 32;
> + y |= ((uint64_t)bitrev8[(x >> 16) & 0xff]) << 40;
> + y |= ((uint64_t)bitrev8[(x >> 8) & 0xff]) << 48;
> + y |= ((uint64_t)bitrev8[(x >> 0) & 0xff]) << 56;
> + return y;
> +}
> +
> +static void crc64_init_tbl(uint64_t *tbl, uint64_t poly, uint8_t msb)
> +{
> + uint64_t crc, i;
> + uint32_t j;
> +
> + tbl[0] = 0;
> +
> + if (msb) {
> + poly = bit_byte_swap64(poly);
> + for (i = 1; i < 256; i++) {
> + crc = i;
> + for (j = 0; j < 8; j++)
> + if (crc & 0x0000000000000001ULL)
> + crc = (crc >> 1) ^ poly;
> + else
> + crc = (crc >> 1);
> + tbl[i] = crc;
> + }
> + } else {
> + for (i = 1; i < 256; i++) {
> + crc = i << 56;
> + for (j = 0; j < 8; j++)
> + if (crc & 0x8000000000000000ULL)
> + crc = (crc << 1) ^ poly;
> + else
> + crc = (crc << 1);
> + tbl[i] = crc;
> + }
> + }
> +}
> +
> +static uint64_t crc64_init_crc(uint64_t poly, uint8_t msb, uint8_t invcrc)
> +{
> + if (!invcrc)
> + return 0;
> + poly |= (poly << 1);
> + poly |= (poly << 2);
> + poly |= (poly << 4);
> + poly |= (poly << 8);
> + poly |= (poly << 16);
> + poly |= (poly << 32);
> + if (!msb)
> + return poly;
> + return bit_byte_swap64(poly);
> +}
> +
> +static uint64_t crc64_update(uint8_t data, uint64_t *tbl, uint64_t crc, uint8_t msb)
> +{
> + if (msb)
> + return tbl[data ^ (crc & 0xff)] ^ (crc >> 8);
> + else
> + return tbl[data ^ (crc >> 56)] ^ (crc << 8);
> +}
> +
> +static uint64_t crc64_finalize(uint64_t crc, uint64_t poly, uint8_t msb, uint8_t invcrc)
> +{
> + if (!invcrc)
> + return crc;
> + poly |= (poly << 1);
> + poly |= (poly << 2);
> + poly |= (poly << 4);
> + poly |= (poly << 8);
> + poly |= (poly << 16);
> + poly |= (poly << 32);
> + if (!msb)
> + return crc ^ poly;
> + return crc ^ bit_byte_swap64(poly);
> +}
> +
> +/* convert 8 bytes array to uint64_t, if not aligned, fill up with 0*/
> +static uint64_t read_qword(uint8_t *in, uint32_t len)
> +{
> + uint32_t i;
> + uint64_t qword = 0;
> +
> + for (i = 0; i < len; i++)
> + qword |= ((((uint64_t)in[i]) & 0xFF) << (8 * i));
> +
> + return qword;
> +}
> +
> +uint64_t iax_calculate_crc64(uint64_t poly, uint8_t *buf, uint32_t len,
iaa_calculate_crc64?
> + uint8_t msb, uint8_t invcrc)
> +{
> + uint64_t data;
> + uint32_t data_size, i = 0, j = 0;
> + uint64_t tbl[256], crc;
> + uint8_t *ptr;
> + uint32_t aligned_len = len & 0xfffffff8;
> + uint32_t remain_len = len - aligned_len;
> +
> + crc64_init_tbl(tbl, poly, msb);
> + crc = crc64_init_crc(poly, msb, invcrc);
> +
> + for (i = 0; i < aligned_len; i += sizeof(uint64_t)) {
> + ptr = &buf[i];
> + data = read_qword(ptr, sizeof(uint64_t));
> + data_size = sizeof(uint64_t) * 8;
> + for (j = 0; j < data_size; j += 8)
> + crc = crc64_update((uint8_t)(data >> j), tbl, crc, msb);
> + }
> +
> + if (remain_len) {
> + ptr = &buf[i];
> + data = read_qword(ptr, remain_len);
> + data_size = remain_len * 8;
> + for (j = 0; j < data_size; j += 8)
> + crc = crc64_update((uint8_t)(data >> j), tbl, crc, msb);
> + }
> + crc = crc64_finalize(crc, poly, msb, invcrc);
> + return crc;
> +}
> diff --git a/test/algorithms/iaa_crc64.h b/test/algorithms/iaa_crc64.h
> new file mode 100644
> index 0000000..d0bc5f9
> --- /dev/null
> +++ b/test/algorithms/iaa_crc64.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright(c) 2019 Intel Corporation. All rights reserved. */
> +#ifndef _USR_CRC64_H_
> +#define _USR_CRC64_H_
> +
> +#include <stdint.h>
> +#include <stdbool.h>
> +
> +#define IAX_CRC64_EXTRA_FLAGS_BIT_ORDER 0x8000
> +#define IAX_CRC64_EXTRA_FLAGS_INVERT_CRC 0x4000
IAA_?
> +
> +/* crc64-ecma-182 */
> +#define IAX_CRC64_POLYNOMIAL 0x42F0E1EBA9EA3693
IAA_
> +
> +uint64_t iax_calculate_crc64(uint64_t poly, uint8_t *buf, uint32_t len,
> + uint8_t msb, uint8_t invcrc);
> +
> +#endif
2 months
[PATCH] accel-config/test: Remove unused global variable ms_timeout
by Dave Jiang
ms_timeout is not used by anything. Remove.
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
test/accel_test.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/test/accel_test.c b/test/accel_test.c
index 84ab13e77fa5..24652c7c05d3 100644
--- a/test/accel_test.c
+++ b/test/accel_test.c
@@ -15,7 +15,6 @@
#include <accfg/idxd.h>
#include "accel_test.h"
-unsigned int ms_timeout = 5000;
int debug_logging;
static int umwait_support;
2 months
[PATCH v2] accel-config/test: Fix descriptor timeout calculation to not overflow
by Dave Jiang
Testing has shown that when using large transfer size, the mwait value is
not working correctly. The dsa_test application will fail due to constant
value converted by compiler to integer and cause the math to overflow on
large values. Explicitly declare constant to UL in order to force type
casting of unsigned long. Also, the calculation should use the passed in
timeout parameter and not the global constant.
Signed-off-by: Ken Buchanan <kenneth.buchanan(a)intel.com>
Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
---
v2:
- Fixed up commit subject and commit log (Dave)
- Resend for Tony with the added sign-off tags
test/accel_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/accel_test.c b/test/accel_test.c
index 84870996ac68..84ab13e77fa5 100644
--- a/test/accel_test.c
+++ b/test/accel_test.c
@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp,
j++;
}
} else {
- unsigned long timeout = (ms_timeout * 1000000) * 3;
+ unsigned long timeout = (msec_timeout * 1000000UL) * 3;
int r = 1;
unsigned long t = 0;
2 months
[PATCH v1 1/1] accel-config/test: Fix description timeout calculation to overflow
by Tony Zhu
Dsa_test application will fail when when utilizing memory sizes larger
than 128MiB against multiple devices. The init of timeout should use
the input msec_timeout.
Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
---
test/accel_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/accel_test.c b/test/accel_test.c
index 8487099..0468a00 100644
--- a/test/accel_test.c
+++ b/test/accel_test.c
@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp,
j++;
}
} else {
- unsigned long timeout = (ms_timeout * 1000000) * 3;
+ unsigned long timeout = (msec_timeout * 1000000ul) * 3;
int r = 1;
unsigned long t = 0;
--
2.27.0
2 months
Re: [PATCH v1 0/4] Init IAA test and add No-op operation
by Dave Jiang
On 4/19/2022 7:04 PM, Li Zhang wrote:
> Initialize C source code, Makefile, configuration and scripts
> of IAA test and add No-op test.
>
> Li Zhang (4):
> accel-config/test: Add IAA test basic framework of C source code.
> accel-config/test: Add C source code of operation No-op
> accel-config/test: Add configuration file for IAA test
> accel-config/test: Modify scripts about operation No-op
>
> accfg/idxd.h | 12 +++
> test/Makefile.am | 15 ++--
> test/common | 22 +++++
> test/configs/2g2q_user_2.conf | 91 +++++++++++++++++++
> test/iaa.c | 75 ++++++++++++++++
> test/iaa.h | 16 ++++
> test/iaa_prep.c | 21 +++++
> test/iaa_test.c | 160 ++++++++++++++++++++++++++++++++++
> test/iaa_user_test_runner.sh | 105 ++++++++++++++++++++++
> 9 files changed, 512 insertions(+), 5 deletions(-)
> create mode 100644 test/configs/2g2q_user_2.conf
> create mode 100644 test/iaa.c
> create mode 100644 test/iaa.h
> create mode 100644 test/iaa_prep.c
> create mode 100644 test/iaa_test.c
> create mode 100755 test/iaa_user_test_runner.sh
LGTM
Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
2 months, 1 week