Message ID | 20210413051715.26430-8-hemant.agrawal@nxp.com |
---|---|
State | New |
Headers | show |
Series | baseband: add NXP LA12xx driver | expand |
If you want this, should this be a new BBDEV capability option? If not how can you enforce compatibility if you just bypass this in the test vector parsing? > -----Original Message----- > From: Hemant Agrawal <hemant.agrawal@nxp.com> > Sent: Monday, April 12, 2021 10:17 PM > To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas > <nicolas.chautru@intel.com> > Cc: david.marchand@redhat.com; Nipun Gupta <nipun.gupta@nxp.com> > Subject: [PATCH v3 7/8] app/bbdev: add parameter to take input in network > order > > From: Nipun Gupta <nipun.gupta@nxp.com> > > Test bbdev application is reading the input and output from the test vector > files in the same endianness which is of the system. > This patch adds an option to provide data in the network order i.e. big > endian format > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > app/test-bbdev/test_bbdev_vector.c | 18 ++++++++++++++++-- app/test- > bbdev/test_bbdev_vector.h | 2 ++ > 2 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test- > bbdev/test_bbdev_vector.c > index 50d1da00f7..fe04bd6b95 100644 > --- a/app/test-bbdev/test_bbdev_vector.c > +++ b/app/test-bbdev/test_bbdev_vector.c > @@ -53,7 +53,8 @@ starts_with(const char *str, const char *pre) > > /* tokenization test values separated by a comma */ static int - > parse_values(char *tokens, uint32_t **data, uint32_t *data_length) > +parse_values(char *tokens, uint32_t **data, uint32_t *data_length, > + int network_order) > { > uint32_t n_tokens = 0; > uint32_t data_size = 32; > @@ -94,6 +95,14 @@ parse_values(char *tokens, uint32_t **data, uint32_t > *data_length) > } > > *data_length = *data_length + (strlen(tok) - strlen("0x"))/2; > + if (network_order) { > + if ((strlen(tok) - strlen("0x"))/2 == 4) > + values[n_tokens] = > + rte_cpu_to_be_32(values[n_tokens]); > + else if ((strlen(tok) - strlen("0x"))/2 == 2) > + values[n_tokens] = > + rte_cpu_to_be_16(values[n_tokens]); > + } > > tok = strtok(NULL, VALUE_DELIMITER); > if (tok == NULL) > @@ -416,7 +425,8 @@ parse_data_entry(const char *key_token, char > *token, > /* Clear new op data struct */ > memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf)); > > - ret = parse_values(token, &data, &data_length); > + ret = parse_values(token, &data, &data_length, > + vector->network_order); > if (!ret) { > op_data[*nb_ops].addr = data; > op_data[*nb_ops].length = data_length; @@ -728,6 +738,10 > @@ parse_ldpc_encoder_params(const char *key_token, char *token, > ret = parse_expected_status(token, &status, vector- > >op_type); > if (!ret) > vector->expected_status = status; > + } else if (!strcmp(key_token, "network_order")) { > + vector->mask |= TEST_BBDEV_VF_NETWORK_ORDER; > + vector->network_order = (uint8_t) strtoul(token, &err, 0); > + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; > } else { > printf("Not valid ldpc enc key: '%s'\n", key_token); > return -1; > diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test- > bbdev/test_bbdev_vector.h > index 4e5dbf5d50..aa53f0bb0d 100644 > --- a/app/test-bbdev/test_bbdev_vector.h > +++ b/app/test-bbdev/test_bbdev_vector.h > @@ -35,6 +35,7 @@ enum { > TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23), > TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24), > TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25), > + TEST_BBDEV_VF_NETWORK_ORDER = (1ULL << 26), > }; > > enum op_data_type { > @@ -60,6 +61,7 @@ struct test_bbdev_vector { > enum rte_bbdev_op_type op_type; > int expected_status; > int mask; > + int network_order; > union { > struct rte_bbdev_op_turbo_dec turbo_dec; > struct rte_bbdev_op_turbo_enc turbo_enc; > -- > 2.17.1
> -----Original Message----- > From: Chautru, Nicolas <nicolas.chautru@intel.com> > Sent: Wednesday, April 14, 2021 6:30 AM > To: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org; > gakhil@marvell.com > Cc: david.marchand@redhat.com; Nipun Gupta <nipun.gupta@nxp.com> > Subject: RE: [PATCH v3 7/8] app/bbdev: add parameter to take input in network > order > > If you want this, should this be a new BBDEV capability option? > If not how can you enforce compatibility if you just bypass this in the test vector > parsing? Agree, we can add BBDEV capability option. > > > -----Original Message----- > > From: Hemant Agrawal <hemant.agrawal@nxp.com> > > Sent: Monday, April 12, 2021 10:17 PM > > To: dev@dpdk.org; gakhil@marvell.com; Chautru, Nicolas > > <nicolas.chautru@intel.com> > > Cc: david.marchand@redhat.com; Nipun Gupta <nipun.gupta@nxp.com> > > Subject: [PATCH v3 7/8] app/bbdev: add parameter to take input in network > > order > > > > From: Nipun Gupta <nipun.gupta@nxp.com> > > > > Test bbdev application is reading the input and output from the test vector > > files in the same endianness which is of the system. > > This patch adds an option to provide data in the network order i.e. big > > endian format > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > > --- > > app/test-bbdev/test_bbdev_vector.c | 18 ++++++++++++++++-- app/test- > > bbdev/test_bbdev_vector.h | 2 ++ > > 2 files changed, 18 insertions(+), 2 deletions(-) > > > > diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test- > > bbdev/test_bbdev_vector.c > > index 50d1da00f7..fe04bd6b95 100644 > > --- a/app/test-bbdev/test_bbdev_vector.c > > +++ b/app/test-bbdev/test_bbdev_vector.c > > @@ -53,7 +53,8 @@ starts_with(const char *str, const char *pre) > > > > /* tokenization test values separated by a comma */ static int - > > parse_values(char *tokens, uint32_t **data, uint32_t *data_length) > > +parse_values(char *tokens, uint32_t **data, uint32_t *data_length, > > + int network_order) > > { > > uint32_t n_tokens = 0; > > uint32_t data_size = 32; > > @@ -94,6 +95,14 @@ parse_values(char *tokens, uint32_t **data, uint32_t > > *data_length) > > } > > > > *data_length = *data_length + (strlen(tok) - strlen("0x"))/2; > > + if (network_order) { > > + if ((strlen(tok) - strlen("0x"))/2 == 4) > > + values[n_tokens] = > > + rte_cpu_to_be_32(values[n_tokens]); > > + else if ((strlen(tok) - strlen("0x"))/2 == 2) > > + values[n_tokens] = > > + rte_cpu_to_be_16(values[n_tokens]); > > + } > > > > tok = strtok(NULL, VALUE_DELIMITER); > > if (tok == NULL) > > @@ -416,7 +425,8 @@ parse_data_entry(const char *key_token, char > > *token, > > /* Clear new op data struct */ > > memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf)); > > > > - ret = parse_values(token, &data, &data_length); > > + ret = parse_values(token, &data, &data_length, > > + vector->network_order); > > if (!ret) { > > op_data[*nb_ops].addr = data; > > op_data[*nb_ops].length = data_length; @@ -728,6 +738,10 > > @@ parse_ldpc_encoder_params(const char *key_token, char *token, > > ret = parse_expected_status(token, &status, vector- > > >op_type); > > if (!ret) > > vector->expected_status = status; > > + } else if (!strcmp(key_token, "network_order")) { > > + vector->mask |= TEST_BBDEV_VF_NETWORK_ORDER; > > + vector->network_order = (uint8_t) strtoul(token, &err, 0); > > + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; > > } else { > > printf("Not valid ldpc enc key: '%s'\n", key_token); > > return -1; > > diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test- > > bbdev/test_bbdev_vector.h > > index 4e5dbf5d50..aa53f0bb0d 100644 > > --- a/app/test-bbdev/test_bbdev_vector.h > > +++ b/app/test-bbdev/test_bbdev_vector.h > > @@ -35,6 +35,7 @@ enum { > > TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23), > > TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24), > > TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25), > > + TEST_BBDEV_VF_NETWORK_ORDER = (1ULL << 26), > > }; > > > > enum op_data_type { > > @@ -60,6 +61,7 @@ struct test_bbdev_vector { > > enum rte_bbdev_op_type op_type; > > int expected_status; > > int mask; > > + int network_order; > > union { > > struct rte_bbdev_op_turbo_dec turbo_dec; > > struct rte_bbdev_op_turbo_enc turbo_enc; > > -- > > 2.17.1
diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c index 50d1da00f7..fe04bd6b95 100644 --- a/app/test-bbdev/test_bbdev_vector.c +++ b/app/test-bbdev/test_bbdev_vector.c @@ -53,7 +53,8 @@ starts_with(const char *str, const char *pre) /* tokenization test values separated by a comma */ static int -parse_values(char *tokens, uint32_t **data, uint32_t *data_length) +parse_values(char *tokens, uint32_t **data, uint32_t *data_length, + int network_order) { uint32_t n_tokens = 0; uint32_t data_size = 32; @@ -94,6 +95,14 @@ parse_values(char *tokens, uint32_t **data, uint32_t *data_length) } *data_length = *data_length + (strlen(tok) - strlen("0x"))/2; + if (network_order) { + if ((strlen(tok) - strlen("0x"))/2 == 4) + values[n_tokens] = + rte_cpu_to_be_32(values[n_tokens]); + else if ((strlen(tok) - strlen("0x"))/2 == 2) + values[n_tokens] = + rte_cpu_to_be_16(values[n_tokens]); + } tok = strtok(NULL, VALUE_DELIMITER); if (tok == NULL) @@ -416,7 +425,8 @@ parse_data_entry(const char *key_token, char *token, /* Clear new op data struct */ memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf)); - ret = parse_values(token, &data, &data_length); + ret = parse_values(token, &data, &data_length, + vector->network_order); if (!ret) { op_data[*nb_ops].addr = data; op_data[*nb_ops].length = data_length; @@ -728,6 +738,10 @@ parse_ldpc_encoder_params(const char *key_token, char *token, ret = parse_expected_status(token, &status, vector->op_type); if (!ret) vector->expected_status = status; + } else if (!strcmp(key_token, "network_order")) { + vector->mask |= TEST_BBDEV_VF_NETWORK_ORDER; + vector->network_order = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else { printf("Not valid ldpc enc key: '%s'\n", key_token); return -1; diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h index 4e5dbf5d50..aa53f0bb0d 100644 --- a/app/test-bbdev/test_bbdev_vector.h +++ b/app/test-bbdev/test_bbdev_vector.h @@ -35,6 +35,7 @@ enum { TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23), TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24), TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25), + TEST_BBDEV_VF_NETWORK_ORDER = (1ULL << 26), }; enum op_data_type { @@ -60,6 +61,7 @@ struct test_bbdev_vector { enum rte_bbdev_op_type op_type; int expected_status; int mask; + int network_order; union { struct rte_bbdev_op_turbo_dec turbo_dec; struct rte_bbdev_op_turbo_enc turbo_enc;