diff mbox

[PATCHv2] fix: incorrect pmr_term_value update in odp_pmr_create_xxx() function

Message ID 1427376631-9906-1-git-send-email-bala.manoharan@linaro.org
State Accepted
Commit e850f5d26eb5bacc9c71c6a5d1806c2e362d9386
Headers show

Commit Message

Balasubramanian Manoharan March 26, 2015, 1:30 p.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>

Fix for incorrect pmr_term_value update in odp_pmr_create_match() and odp_pmr_create_range() functions.
Fixes https://bugs.linaro.org/show_bug.cgi?id=1381

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
v2: Fixes checkpatch issue pointed by Bill

 platform/linux-generic/odp_classification.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Bill Fischofer March 26, 2015, 10:10 p.m. UTC | #1
On Thu, Mar 26, 2015 at 8:30 AM, <bala.manoharan@linaro.org> wrote:

> From: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>

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


>
> Fix for incorrect pmr_term_value update in odp_pmr_create_match() and
> odp_pmr_create_range() functions.
> Fixes https://bugs.linaro.org/show_bug.cgi?id=1381
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> ---
> v2: Fixes checkpatch issue pointed by Bill
>
>  platform/linux-generic/odp_classification.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/odp_classification.c
> b/platform/linux-generic/odp_classification.c
> index 9fb034f..609faa9 100644
> --- a/platform/linux-generic/odp_classification.c
> +++ b/platform/linux-generic/odp_classification.c
> @@ -438,6 +438,7 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
>         pmr->s.pmr_term_value[0].mask.mask =  0;
>         memcpy(&pmr->s.pmr_term_value[0].mask.val, val, val_sz);
>         memcpy(&pmr->s.pmr_term_value[0].mask.mask, mask, val_sz);
> +       pmr->s.pmr_term_value[0].mask.val &=
> pmr->s.pmr_term_value[0].mask.mask;
>         UNLOCK(&pmr->s.lock);
>         return id;
>  }
> @@ -460,7 +461,7 @@ odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term,
>                 return ODP_PMR_INVAL;
>
>         pmr->s.num_pmr = 1;
> -       pmr->s.pmr_term_value[0].match_type = ODP_PMR_MASK;
> +       pmr->s.pmr_term_value[0].match_type = ODP_PMR_RANGE;
>         pmr->s.pmr_term_value[0].term = term;
>         pmr->s.pmr_term_value[0].range.val1 =  0;
>         pmr->s.pmr_term_value[0].range.val2 =  0;
> @@ -601,6 +602,8 @@ int odp_pmr_match_set_create(int num_terms,
> odp_pmr_match_t *terms,
>                                terms[i].mask.val, val_sz);
>                         memcpy(&pmr->s.pmr_term_value[i].mask.mask,
>                                terms[i].mask.mask, val_sz);
> +                       pmr->s.pmr_term_value[i].mask.val &= pmr->s
> +                               .pmr_term_value[i].mask.mask;
>                 } else {
>                         val_sz = terms[i].range.val_sz;
>                         if (val_sz > ODP_PMR_TERM_BYTES_MAX)
> --
> 2.0.1.472.g6f92e5f
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov March 27, 2015, 2:34 p.m. UTC | #2
Merged,
Maxim.

On 03/27/15 01:10, Bill Fischofer wrote:
>
>
> On Thu, Mar 26, 2015 at 8:30 AM, <bala.manoharan@linaro.org 
> <mailto:bala.manoharan@linaro.org>> wrote:
>
>     From: Balasubramanian Manoharan <bala.manoharan@linaro.org
>     <mailto:bala.manoharan@linaro.org>>
>
>
> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>
>     Fix for incorrect pmr_term_value update in odp_pmr_create_match()
>     and odp_pmr_create_range() functions.
>     Fixes https://bugs.linaro.org/show_bug.cgi?id=1381
>
>     Signed-off-by: Balasubramanian Manoharan
>     <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>>
>     ---
>     v2: Fixes checkpatch issue pointed by Bill
>
>      platform/linux-generic/odp_classification.c | 5 ++++-
>      1 file changed, 4 insertions(+), 1 deletion(-)
>
>     diff --git a/platform/linux-generic/odp_classification.c
>     b/platform/linux-generic/odp_classification.c
>     index 9fb034f..609faa9 100644
>     --- a/platform/linux-generic/odp_classification.c
>     +++ b/platform/linux-generic/odp_classification.c
>     @@ -438,6 +438,7 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e
>     term,
>             pmr->s.pmr_term_value[0].mask.mask =  0;
>             memcpy(&pmr->s.pmr_term_value[0].mask.val, val, val_sz);
>             memcpy(&pmr->s.pmr_term_value[0].mask.mask, mask, val_sz);
>     +       pmr->s.pmr_term_value[0].mask.val &=
>     pmr->s.pmr_term_value[0].mask.mask;
>             UNLOCK(&pmr->s.lock);
>             return id;
>      }
>     @@ -460,7 +461,7 @@ odp_pmr_t odp_pmr_create_range(odp_pmr_term_e
>     term,
>                     return ODP_PMR_INVAL;
>
>             pmr->s.num_pmr = 1;
>     -       pmr->s.pmr_term_value[0].match_type = ODP_PMR_MASK;
>     +       pmr->s.pmr_term_value[0].match_type = ODP_PMR_RANGE;
>             pmr->s.pmr_term_value[0].term = term;
>             pmr->s.pmr_term_value[0].range.val1 =  0;
>             pmr->s.pmr_term_value[0].range.val2 =  0;
>     @@ -601,6 +602,8 @@ int odp_pmr_match_set_create(int num_terms,
>     odp_pmr_match_t *terms,
>                                    terms[i].mask.val, val_sz);
>     memcpy(&pmr->s.pmr_term_value[i].mask.mask,
>                                    terms[i].mask.mask, val_sz);
>     +  pmr->s.pmr_term_value[i].mask.val &= pmr->s
>     +  .pmr_term_value[i].mask.mask;
>                     } else {
>                             val_sz = terms[i].range.val_sz;
>                             if (val_sz > ODP_PMR_TERM_BYTES_MAX)
>     --
>     2.0.1.472.g6f92e5f
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
index 9fb034f..609faa9 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -438,6 +438,7 @@  odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
 	pmr->s.pmr_term_value[0].mask.mask =  0;
 	memcpy(&pmr->s.pmr_term_value[0].mask.val, val, val_sz);
 	memcpy(&pmr->s.pmr_term_value[0].mask.mask, mask, val_sz);
+	pmr->s.pmr_term_value[0].mask.val &= pmr->s.pmr_term_value[0].mask.mask;
 	UNLOCK(&pmr->s.lock);
 	return id;
 }
@@ -460,7 +461,7 @@  odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term,
 		return ODP_PMR_INVAL;
 
 	pmr->s.num_pmr = 1;
-	pmr->s.pmr_term_value[0].match_type = ODP_PMR_MASK;
+	pmr->s.pmr_term_value[0].match_type = ODP_PMR_RANGE;
 	pmr->s.pmr_term_value[0].term = term;
 	pmr->s.pmr_term_value[0].range.val1 =  0;
 	pmr->s.pmr_term_value[0].range.val2 =  0;
@@ -601,6 +602,8 @@  int odp_pmr_match_set_create(int num_terms, odp_pmr_match_t *terms,
 			       terms[i].mask.val, val_sz);
 			memcpy(&pmr->s.pmr_term_value[i].mask.mask,
 			       terms[i].mask.mask, val_sz);
+			pmr->s.pmr_term_value[i].mask.val &= pmr->s
+				.pmr_term_value[i].mask.mask;
 		} else {
 			val_sz = terms[i].range.val_sz;
 			if (val_sz > ODP_PMR_TERM_BYTES_MAX)