diff mbox

[API-NEXTv2,4/4] example: classifier: incorporates capability and PMR range

Message ID 1461346194-16534-4-git-send-email-bala.manoharan@linaro.org
State Superseded
Headers show

Commit Message

Balasubramanian Manoharan April 22, 2016, 5:29 p.m. UTC
Modifies the classifier example to support classification capability and
PMR range funcionality.

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 example/classifier/odp_classifier.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Bill Fischofer April 25, 2016, 1:26 a.m. UTC | #1
On Fri, Apr 22, 2016 at 12:29 PM, Balasubramanian Manoharan <
bala.manoharan@linaro.org> wrote:

> Modifies the classifier example to support classification capability and

> PMR range funcionality.

>


Typo: functionality


>

> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

> ---

>  example/classifier/odp_classifier.c | 28 ++++++++++++++--------------

>  1 file changed, 14 insertions(+), 14 deletions(-)

>

> diff --git a/example/classifier/odp_classifier.c

> b/example/classifier/odp_classifier.c

> index 612ce22..6d228b0 100644

> --- a/example/classifier/odp_classifier.c

> +++ b/example/classifier/odp_classifier.c

> @@ -56,7 +56,7 @@ typedef struct {

>         odp_atomic_u64_t pool_pkt_count; /**< count of received packets */

>         char cos_name[ODP_COS_NAME_LEN];        /**< cos name */

>         struct {

> -               odp_pmr_term_t term;    /**< odp pmr term value */

> +               odp_cls_pmr_term_e term;        /**< odp pmr term value */

>                 uint64_t val;   /**< pmr term value */

>                 uint64_t mask;  /**< pmr term mask */

>                 uint32_t val_sz;        /**< size of the pmr term */

> @@ -89,7 +89,7 @@ static void print_info(char *progname, appl_args_t

> *appl_args);

>  static void usage(char *progname);

>  static void configure_cos(odp_cos_t default_cos, appl_args_t *args);

>  static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t

> *args);

> -static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,

> +static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e *term,

>                                    uint32_t *offset);

>  static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char

> *optarg);

>

> @@ -393,6 +393,7 @@ static void configure_cos(odp_cos_t default_cos,

> appl_args_t *args)

>         char pool_name[ODP_POOL_NAME_LEN];

>         odp_pool_param_t pool_params;

>         odp_cls_cos_param_t cls_param;

> +       odp_pmr_param_t pmr_param;

>         int i;

>         global_statistics *stats;

>         odp_queue_param_t qparam;

> @@ -438,15 +439,14 @@ static void configure_cos(odp_cos_t default_cos,

> appl_args_t *args)

>                 cls_param.drop_policy = ODP_COS_DROP_POOL;

>                 stats->cos = odp_cls_cos_create(cos_name, &cls_param);

>

> -               const odp_pmr_match_t match = {

> -                       .term = stats->rule.term,

> -                       .val = &stats->rule.val,

> -                       .mask = &stats->rule.mask,

> -                       .val_sz = stats->rule.val_sz,

> -                       .offset = stats->rule.offset

> -               };

> +               odp_cls_pmr_param_init(&pmr_param);

> +               pmr_param.term = stats->rule.term;

> +               pmr_param.match.value = &stats->rule.val;

> +               pmr_param.match.mask = &stats->rule.mask;

> +               pmr_param.val_sz = stats->rule.val_sz;

> +               pmr_param.offset = stats->rule.offset;

>

> -               stats->pmr = odp_cls_pmr_create(&match, 1, default_cos,

> +               stats->pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos,

>                                                 stats->cos);

>                 if (stats->pmr == ODP_PMR_INVAL) {

>                         EXAMPLE_ERR("odp_pktio_pmr_cos failed");

> @@ -665,7 +665,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[],

> unsigned len)

>         }

>  }

>

> -static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,

> +static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e *term,

>                                    uint32_t *offset)

>  {

>         if (NULL == token)

> @@ -691,7 +691,7 @@ static int parse_pmr_policy(appl_args_t *appl_args,

> char *argv[], char *optarg)

>         int policy_count;

>         char *token;

>         size_t len;

> -       odp_pmr_term_t term;

> +       odp_cls_pmr_term_e term;

>         global_statistics *stats;

>         char *pmr_str;

>         uint32_t offset;

> @@ -904,9 +904,9 @@ static void usage(char *progname)

>                         "\n"

>                         "Mandatory OPTIONS:\n"

>                         "  -i, --interface Eth interface\n"

> -                       "  -p, --policy

> [<odp_pmr_term_t>|<offset>]:<value>:<mask bits>:<queue name>\n"

> +                       "  -p, --policy

> [<odp_cls_pmr_term_e>|<offset>]:<value>:<mask bits>:<queue name>\n"

>                         "\n"

> -                       "<odp_pmr_term_t>       Packet Matching Rule

> defined with odp_pmr_term_t "

> +                       "<odp_cls_pmr_term_e>   Packet Matching Rule

> defined with odp_cls_pmr_term_e "

>                         "for the policy\n"

>                         "<offset>               Absolute offset in bytes

> from frame start to define a "

>                         "ODP_PMR_CUSTOM_FRAME Packet Matching Rule for the

> policy\n"

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Balasubramanian Manoharan April 25, 2016, 8:16 a.m. UTC | #2
Hi Bill,

If this is the only review comment then you can provide your Reviewed-by
and we can change this during merge.

Regards,
Bala

On 25 April 2016 at 06:56, Bill Fischofer <bill.fischofer@linaro.org> wrote:

>

>

> On Fri, Apr 22, 2016 at 12:29 PM, Balasubramanian Manoharan <

> bala.manoharan@linaro.org> wrote:

>

>> Modifies the classifier example to support classification capability and

>> PMR range funcionality.

>>

>

> Typo: functionality

>

>

>>

>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

>> ---

>>  example/classifier/odp_classifier.c | 28 ++++++++++++++--------------

>>  1 file changed, 14 insertions(+), 14 deletions(-)

>>

>> diff --git a/example/classifier/odp_classifier.c

>> b/example/classifier/odp_classifier.c

>> index 612ce22..6d228b0 100644

>> --- a/example/classifier/odp_classifier.c

>> +++ b/example/classifier/odp_classifier.c

>> @@ -56,7 +56,7 @@ typedef struct {

>>         odp_atomic_u64_t pool_pkt_count; /**< count of received packets */

>>         char cos_name[ODP_COS_NAME_LEN];        /**< cos name */

>>         struct {

>> -               odp_pmr_term_t term;    /**< odp pmr term value */

>> +               odp_cls_pmr_term_e term;        /**< odp pmr term value */

>>                 uint64_t val;   /**< pmr term value */

>>                 uint64_t mask;  /**< pmr term mask */

>>                 uint32_t val_sz;        /**< size of the pmr term */

>> @@ -89,7 +89,7 @@ static void print_info(char *progname, appl_args_t

>> *appl_args);

>>  static void usage(char *progname);

>>  static void configure_cos(odp_cos_t default_cos, appl_args_t *args);

>>  static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t

>> *args);

>> -static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,

>> +static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e *term,

>>                                    uint32_t *offset);

>>  static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char

>> *optarg);

>>

>> @@ -393,6 +393,7 @@ static void configure_cos(odp_cos_t default_cos,

>> appl_args_t *args)

>>         char pool_name[ODP_POOL_NAME_LEN];

>>         odp_pool_param_t pool_params;

>>         odp_cls_cos_param_t cls_param;

>> +       odp_pmr_param_t pmr_param;

>>         int i;

>>         global_statistics *stats;

>>         odp_queue_param_t qparam;

>> @@ -438,15 +439,14 @@ static void configure_cos(odp_cos_t default_cos,

>> appl_args_t *args)

>>                 cls_param.drop_policy = ODP_COS_DROP_POOL;

>>                 stats->cos = odp_cls_cos_create(cos_name, &cls_param);

>>

>> -               const odp_pmr_match_t match = {

>> -                       .term = stats->rule.term,

>> -                       .val = &stats->rule.val,

>> -                       .mask = &stats->rule.mask,

>> -                       .val_sz = stats->rule.val_sz,

>> -                       .offset = stats->rule.offset

>> -               };

>> +               odp_cls_pmr_param_init(&pmr_param);

>> +               pmr_param.term = stats->rule.term;

>> +               pmr_param.match.value = &stats->rule.val;

>> +               pmr_param.match.mask = &stats->rule.mask;

>> +               pmr_param.val_sz = stats->rule.val_sz;

>> +               pmr_param.offset = stats->rule.offset;

>>

>> -               stats->pmr = odp_cls_pmr_create(&match, 1, default_cos,

>> +               stats->pmr = odp_cls_pmr_create(&pmr_param, 1,

>> default_cos,

>>                                                 stats->cos);

>>                 if (stats->pmr == ODP_PMR_INVAL) {

>>                         EXAMPLE_ERR("odp_pktio_pmr_cos failed");

>> @@ -665,7 +665,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[],

>> unsigned len)

>>         }

>>  }

>>

>> -static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,

>> +static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e *term,

>>                                    uint32_t *offset)

>>  {

>>         if (NULL == token)

>> @@ -691,7 +691,7 @@ static int parse_pmr_policy(appl_args_t *appl_args,

>> char *argv[], char *optarg)

>>         int policy_count;

>>         char *token;

>>         size_t len;

>> -       odp_pmr_term_t term;

>> +       odp_cls_pmr_term_e term;

>>         global_statistics *stats;

>>         char *pmr_str;

>>         uint32_t offset;

>> @@ -904,9 +904,9 @@ static void usage(char *progname)

>>                         "\n"

>>                         "Mandatory OPTIONS:\n"

>>                         "  -i, --interface Eth interface\n"

>> -                       "  -p, --policy

>> [<odp_pmr_term_t>|<offset>]:<value>:<mask bits>:<queue name>\n"

>> +                       "  -p, --policy

>> [<odp_cls_pmr_term_e>|<offset>]:<value>:<mask bits>:<queue name>\n"

>>                         "\n"

>> -                       "<odp_pmr_term_t>       Packet Matching Rule

>> defined with odp_pmr_term_t "

>> +                       "<odp_cls_pmr_term_e>   Packet Matching Rule

>> defined with odp_cls_pmr_term_e "

>>                         "for the policy\n"

>>                         "<offset>               Absolute offset in bytes

>> from frame start to define a "

>>                         "ODP_PMR_CUSTOM_FRAME Packet Matching Rule for

>> the policy\n"

>> --

>> 1.9.1

>>

>> _______________________________________________

>> lng-odp mailing list

>> lng-odp@lists.linaro.org

>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>

>
Bill Fischofer April 25, 2016, 11:48 a.m. UTC | #3
Sure.  However Petri still needs to sign off on the API.  But for the rest:

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>


On Mon, Apr 25, 2016 at 3:16 AM, Bala Manoharan <bala.manoharan@linaro.org>
wrote:

> Hi Bill,

>

> If this is the only review comment then you can provide your Reviewed-by

> and we can change this during merge.

>

> Regards,

> Bala

>

> On 25 April 2016 at 06:56, Bill Fischofer <bill.fischofer@linaro.org>

> wrote:

>

>>

>>

>> On Fri, Apr 22, 2016 at 12:29 PM, Balasubramanian Manoharan <

>> bala.manoharan@linaro.org> wrote:

>>

>>> Modifies the classifier example to support classification capability and

>>> PMR range funcionality.

>>>

>>

>> Typo: functionality

>>

>>

>>>

>>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

>>> ---

>>>  example/classifier/odp_classifier.c | 28 ++++++++++++++--------------

>>>  1 file changed, 14 insertions(+), 14 deletions(-)

>>>

>>> diff --git a/example/classifier/odp_classifier.c

>>> b/example/classifier/odp_classifier.c

>>> index 612ce22..6d228b0 100644

>>> --- a/example/classifier/odp_classifier.c

>>> +++ b/example/classifier/odp_classifier.c

>>> @@ -56,7 +56,7 @@ typedef struct {

>>>         odp_atomic_u64_t pool_pkt_count; /**< count of received packets

>>> */

>>>         char cos_name[ODP_COS_NAME_LEN];        /**< cos name */

>>>         struct {

>>> -               odp_pmr_term_t term;    /**< odp pmr term value */

>>> +               odp_cls_pmr_term_e term;        /**< odp pmr term value

>>> */

>>>                 uint64_t val;   /**< pmr term value */

>>>                 uint64_t mask;  /**< pmr term mask */

>>>                 uint32_t val_sz;        /**< size of the pmr term */

>>> @@ -89,7 +89,7 @@ static void print_info(char *progname, appl_args_t

>>> *appl_args);

>>>  static void usage(char *progname);

>>>  static void configure_cos(odp_cos_t default_cos, appl_args_t *args);

>>>  static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t

>>> *args);

>>> -static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,

>>> +static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e

>>> *term,

>>>                                    uint32_t *offset);

>>>  static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char

>>> *optarg);

>>>

>>> @@ -393,6 +393,7 @@ static void configure_cos(odp_cos_t default_cos,

>>> appl_args_t *args)

>>>         char pool_name[ODP_POOL_NAME_LEN];

>>>         odp_pool_param_t pool_params;

>>>         odp_cls_cos_param_t cls_param;

>>> +       odp_pmr_param_t pmr_param;

>>>         int i;

>>>         global_statistics *stats;

>>>         odp_queue_param_t qparam;

>>> @@ -438,15 +439,14 @@ static void configure_cos(odp_cos_t default_cos,

>>> appl_args_t *args)

>>>                 cls_param.drop_policy = ODP_COS_DROP_POOL;

>>>                 stats->cos = odp_cls_cos_create(cos_name, &cls_param);

>>>

>>> -               const odp_pmr_match_t match = {

>>> -                       .term = stats->rule.term,

>>> -                       .val = &stats->rule.val,

>>> -                       .mask = &stats->rule.mask,

>>> -                       .val_sz = stats->rule.val_sz,

>>> -                       .offset = stats->rule.offset

>>> -               };

>>> +               odp_cls_pmr_param_init(&pmr_param);

>>> +               pmr_param.term = stats->rule.term;

>>> +               pmr_param.match.value = &stats->rule.val;

>>> +               pmr_param.match.mask = &stats->rule.mask;

>>> +               pmr_param.val_sz = stats->rule.val_sz;

>>> +               pmr_param.offset = stats->rule.offset;

>>>

>>> -               stats->pmr = odp_cls_pmr_create(&match, 1, default_cos,

>>> +               stats->pmr = odp_cls_pmr_create(&pmr_param, 1,

>>> default_cos,

>>>                                                 stats->cos);

>>>                 if (stats->pmr == ODP_PMR_INVAL) {

>>>                         EXAMPLE_ERR("odp_pktio_pmr_cos failed");

>>> @@ -665,7 +665,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[],

>>> unsigned len)

>>>         }

>>>  }

>>>

>>> -static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,

>>> +static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e

>>> *term,

>>>                                    uint32_t *offset)

>>>  {

>>>         if (NULL == token)

>>> @@ -691,7 +691,7 @@ static int parse_pmr_policy(appl_args_t *appl_args,

>>> char *argv[], char *optarg)

>>>         int policy_count;

>>>         char *token;

>>>         size_t len;

>>> -       odp_pmr_term_t term;

>>> +       odp_cls_pmr_term_e term;

>>>         global_statistics *stats;

>>>         char *pmr_str;

>>>         uint32_t offset;

>>> @@ -904,9 +904,9 @@ static void usage(char *progname)

>>>                         "\n"

>>>                         "Mandatory OPTIONS:\n"

>>>                         "  -i, --interface Eth interface\n"

>>> -                       "  -p, --policy

>>> [<odp_pmr_term_t>|<offset>]:<value>:<mask bits>:<queue name>\n"

>>> +                       "  -p, --policy

>>> [<odp_cls_pmr_term_e>|<offset>]:<value>:<mask bits>:<queue name>\n"

>>>                         "\n"

>>> -                       "<odp_pmr_term_t>       Packet Matching Rule

>>> defined with odp_pmr_term_t "

>>> +                       "<odp_cls_pmr_term_e>   Packet Matching Rule

>>> defined with odp_cls_pmr_term_e "

>>>                         "for the policy\n"

>>>                         "<offset>               Absolute offset in bytes

>>> from frame start to define a "

>>>                         "ODP_PMR_CUSTOM_FRAME Packet Matching Rule for

>>> the policy\n"

>>> --

>>> 1.9.1

>>>

>>> _______________________________________________

>>> lng-odp mailing list

>>> lng-odp@lists.linaro.org

>>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>>

>>

>>

>
diff mbox

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 612ce22..6d228b0 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -56,7 +56,7 @@  typedef struct {
 	odp_atomic_u64_t pool_pkt_count; /**< count of received packets */
 	char cos_name[ODP_COS_NAME_LEN];	/**< cos name */
 	struct {
-		odp_pmr_term_t term;	/**< odp pmr term value */
+		odp_cls_pmr_term_e term;	/**< odp pmr term value */
 		uint64_t val;	/**< pmr term value */
 		uint64_t mask;	/**< pmr term mask */
 		uint32_t val_sz;	/**< size of the pmr term */
@@ -89,7 +89,7 @@  static void print_info(char *progname, appl_args_t *appl_args);
 static void usage(char *progname);
 static void configure_cos(odp_cos_t default_cos, appl_args_t *args);
 static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t *args);
-static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,
+static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e *term,
 				   uint32_t *offset);
 static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg);
 
@@ -393,6 +393,7 @@  static void configure_cos(odp_cos_t default_cos, appl_args_t *args)
 	char pool_name[ODP_POOL_NAME_LEN];
 	odp_pool_param_t pool_params;
 	odp_cls_cos_param_t cls_param;
+	odp_pmr_param_t pmr_param;
 	int i;
 	global_statistics *stats;
 	odp_queue_param_t qparam;
@@ -438,15 +439,14 @@  static void configure_cos(odp_cos_t default_cos, appl_args_t *args)
 		cls_param.drop_policy = ODP_COS_DROP_POOL;
 		stats->cos = odp_cls_cos_create(cos_name, &cls_param);
 
-		const odp_pmr_match_t match = {
-			.term = stats->rule.term,
-			.val = &stats->rule.val,
-			.mask = &stats->rule.mask,
-			.val_sz = stats->rule.val_sz,
-			.offset = stats->rule.offset
-		};
+		odp_cls_pmr_param_init(&pmr_param);
+		pmr_param.term = stats->rule.term;
+		pmr_param.match.value = &stats->rule.val;
+		pmr_param.match.mask = &stats->rule.mask;
+		pmr_param.val_sz = stats->rule.val_sz;
+		pmr_param.offset = stats->rule.offset;
 
-		stats->pmr = odp_cls_pmr_create(&match, 1, default_cos,
+		stats->pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos,
 						stats->cos);
 		if (stats->pmr == ODP_PMR_INVAL) {
 			EXAMPLE_ERR("odp_pktio_pmr_cos failed");
@@ -665,7 +665,7 @@  static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len)
 	}
 }
 
-static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,
+static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e *term,
 				   uint32_t *offset)
 {
 	if (NULL == token)
@@ -691,7 +691,7 @@  static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg)
 	int policy_count;
 	char *token;
 	size_t len;
-	odp_pmr_term_t term;
+	odp_cls_pmr_term_e term;
 	global_statistics *stats;
 	char *pmr_str;
 	uint32_t offset;
@@ -904,9 +904,9 @@  static void usage(char *progname)
 			"\n"
 			"Mandatory OPTIONS:\n"
 			"  -i, --interface Eth interface\n"
-			"  -p, --policy [<odp_pmr_term_t>|<offset>]:<value>:<mask bits>:<queue name>\n"
+			"  -p, --policy [<odp_cls_pmr_term_e>|<offset>]:<value>:<mask bits>:<queue name>\n"
 			"\n"
-			"<odp_pmr_term_t>	Packet Matching Rule defined with odp_pmr_term_t "
+			"<odp_cls_pmr_term_e>	Packet Matching Rule defined with odp_cls_pmr_term_e "
 			"for the policy\n"
 			"<offset>		Absolute offset in bytes from frame start to define a "
 			"ODP_PMR_CUSTOM_FRAME Packet Matching Rule for the policy\n"