[dpdk-dev] [EXT] Re: [PATCH v1 22/38] net/mvpp2: flow: add support for RAW type

Liron Himi lironh at marvell.com
Tue Jan 19 11:44:23 CET 2021


-----Original Message-----
From: Jerin Jacob <jerinjacobk at gmail.com> 
Sent: Monday, 11 January 2021 18:18
To: Michael Shamis <michaelsh at marvell.com>
Cc: Liron Himi <lironh at marvell.com>; Jerin Jacob Kollanukkaran <jerinj at marvell.com>; dev at dpdk.org
Subject: [EXT] Re: [dpdk-dev] [PATCH v1 22/38] net/mvpp2: flow: add support for RAW type

External Email

----------------------------------------------------------------------
On Wed, Dec 23, 2020 at 2:58 PM Michael Shamis <michaelsh at marvell.com> wrote:
>
> Reviewed-by: Michael Shamis <michaelsh at marvell.com>
>
> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of lironh at marvell.com
> Sent: Wednesday, December 2, 2020 12:12 PM
> To: Jerin Jacob Kollanukkaran <jerinj at marvell.com>
> Cc: dev at dpdk.org; Liron Himi <lironh at marvell.com>
> Subject: [dpdk-dev] [PATCH v1 22/38] net/mvpp2: flow: add support for 
> RAW type
>
> From: Liron Himi <lironh at marvell.com>
>
> add support for RAW type and connect it to MUSDK UDF
>
> Signed-off-by: Liron Himi <lironh at marvell.com>
> Reviewed-by: Liron Himi <lironh at marvell.com>
> ---
>  drivers/net/mvpp2/mrvl_ethdev.h |   1 +
>  drivers/net/mvpp2/mrvl_flow.c   | 141 ++++++++++++++++++++++++++++++++
>  2 files changed, 142 insertions(+)
>
> diff --git a/drivers/net/mvpp2/mrvl_ethdev.h 
> b/drivers/net/mvpp2/mrvl_ethdev.h index e7f75067f..be5e5a51b 100644
> --- a/drivers/net/mvpp2/mrvl_ethdev.h
> +++ b/drivers/net/mvpp2/mrvl_ethdev.h
> @@ -92,6 +92,7 @@ struct rte_flow {
>         struct pp2_cls_tbl_rule rule;
>         struct pp2_cls_cos_desc cos;
>         struct pp2_cls_tbl_action action;
> +       uint8_t next_udf_id;
>  };
>
>  struct mrvl_mtr_profile {
> diff --git a/drivers/net/mvpp2/mrvl_flow.c 
> b/drivers/net/mvpp2/mrvl_flow.c index ffa47a12e..3c8052f06 100644
> --- a/drivers/net/mvpp2/mrvl_flow.c
> +++ b/drivers/net/mvpp2/mrvl_flow.c
> @@ -1196,6 +1196,146 @@ mrvl_parse_udp(const struct rte_flow_item *item,
>         return -rte_errno;
>  }
>
> +static int
> +mrvl_string_to_hex_values(const uint8_t *input_string,
> +                         uint8_t *hex_key,
> +                         uint8_t *length) {
> +       char tmp_arr[3], tmp_string[MRVL_CLS_STR_SIZE_MAX], *string_iter;
> +       int i;
> +
> +       strcpy(tmp_string, (const char *)input_string);
> +       string_iter = tmp_string;
> +
> +       string_iter += 2; /* skip the '0x' */
> +       *length = ((*length - 2) + 1) / 2;
> +
> +       for (i = 0; i < *length; i++) {
> +               strncpy(tmp_arr, string_iter, 2);
> +               tmp_arr[2] = '\0';
> +               if (get_val_securely8(tmp_arr, 16,
> +                                     &hex_key[*length - 1 - i]) < 0)
> +                       return -1;
> +               string_iter += 2;
> +       }
> +
> +       return 0;
> +}

Is standard strtol()  not enough?
[L.H.] I have just checked it and strtol is working only when up to 64bit numbers.
i.e. if given string is "0xaabbccddaabbccdd" it is working, but not "0xaabbccddaabbccdd11".


More information about the dev mailing list