diff mbox

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

Message ID 1426833116-26580-1-git-send-email-bala.manoharan@linaro.org
State Accepted
Commit 0047979b69807cf489158bb3a7f8f9f4841637cb
Headers show

Commit Message

Balasubramanian Manoharan March 20, 2015, 6:31 a.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>
---
 platform/linux-generic/odp_classification.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Bill Fischofer March 21, 2015, 12:11 a.m. UTC | #1
On Fri, Mar 20, 2015 at 1:31 AM, <bala.manoharan@linaro.org> wrote:

> 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>
> ---
>  platform/linux-generic/odp_classification.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/odp_classification.c
> b/platform/linux-generic/odp_classification.c
> index 9fb034f..b7a4fe6 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,7 @@ 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;
>

Fails checkpatch:
WARNING: line over 80 characters
#41: FILE: platform/linux-generic/odp_classification.c:605:
+ 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 25, 2015, 2:29 p.m. UTC | #2
Bala, are you going to send updated version?

Thanks,
Maxim.

On 03/21/15 03:11, Bill Fischofer wrote:
>
>
> On Fri, Mar 20, 2015 at 1:31 AM, <bala.manoharan@linaro.org 
> <mailto:bala.manoharan@linaro.org>> wrote:
>
>     From: Balasubramanian Manoharan <bala.manoharan@linaro.org
>     <mailto: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 <mailto:bala.manoharan@linaro.org>>
>     ---
>      platform/linux-generic/odp_classification.c | 4 +++-
>      1 file changed, 3 insertions(+), 1 deletion(-)
>
>     diff --git a/platform/linux-generic/odp_classification.c
>     b/platform/linux-generic/odp_classification.c
>     index 9fb034f..b7a4fe6 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,7 @@ 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;
>
>
> Fails checkpatch:
> WARNING: line over 80 characters
> #41: FILE: platform/linux-generic/odp_classification.c:605:
> +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
Balasubramanian Manoharan March 25, 2015, 3:31 p.m. UTC | #3
Yes. I will send a new version of this patch.

Regards,
Bala

> On 25-Mar-2015, at 7:59 pm, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> 
> Bala, are you going to send updated version?
> 
> Thanks,
> Maxim.
> 
>> On 03/21/15 03:11, Bill Fischofer wrote:
>> 
>> 
>> On Fri, Mar 20, 2015 at 1:31 AM, <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> wrote:
>> 
>>    From: Balasubramanian Manoharan <bala.manoharan@linaro.org
>>    <mailto: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 <mailto:bala.manoharan@linaro.org>>
>>    ---
>>     platform/linux-generic/odp_classification.c | 4 +++-
>>     1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>>    diff --git a/platform/linux-generic/odp_classification.c
>>    b/platform/linux-generic/odp_classification.c
>>    index 9fb034f..b7a4fe6 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,7 @@ 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;
>> 
>> 
>> Fails checkpatch:
>> WARNING: line over 80 characters
>> #41: FILE: platform/linux-generic/odp_classification.c:605:
>> +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..b7a4fe6 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,7 @@  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)