diff mbox

[v1,1/2] linux-generic: Fix incorrect L2 qos calculation

Message ID 1421821503-22936-1-git-send-email-bala.manoharan@linaro.org
State Accepted
Commit 0d33580b0149fe00a03acd69fbe369e713d34a28
Headers show

Commit Message

Balasubramanian Manoharan Jan. 21, 2015, 6:25 a.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>

Fixes the error in vlan qos calculation due to missing convertion of
odp_be_to_cpu_16()

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 platform/linux-generic/odp_classification.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bill Fischofer Jan. 21, 2015, 11:51 a.m. UTC | #1
On Wed, Jan 21, 2015 at 12:25 AM, <bala.manoharan@linaro.org> wrote:

> From: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>
> Fixes the error in vlan qos calculation due to missing convertion of
> odp_be_to_cpu_16()
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>

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


> ---
>  platform/linux-generic/odp_classification.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/odp_classification.c
> b/platform/linux-generic/odp_classification.c
> index 7d09cce..f6d482d 100644
> --- a/platform/linux-generic/odp_classification.c
> +++ b/platform/linux-generic/odp_classification.c
> @@ -881,7 +881,6 @@ cos_t *match_qos_l3_cos(pmr_l3_cos_t *l3_cos, uint8_t
> *pkt_addr,
>  cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, uint8_t *pkt_addr,
>                         odp_packet_hdr_t *hdr)
>  {
> -       uint8_t qos;
>         cos_t *cos = NULL;
>         odph_ethhdr_t *eth;
>         odph_vlanhdr_t *vlan;
> @@ -890,7 +889,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, uint8_t
> *pkt_addr,
>             hdr->input_flags.eth) {
>                 eth = (odph_ethhdr_t *)(pkt_addr + hdr->l2_offset);
>                 vlan = (odph_vlanhdr_t *)(&eth->type);
> -               qos = ((vlan->tci >> 13) & 0xFF);
> +               uint16_t qos = odp_be_to_cpu_16(vlan->tci);
> +               qos = ((qos >> 13) & 0x07);
>                 cos = l2_cos->cos[qos];
>         }
>         return cos;
> --
> 2.0.1.472.g6f92e5f
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Anders Roxell Jan. 21, 2015, 12:38 p.m. UTC | #2
Add classification into the short log:
linux-generic: classification: Fix incorrect L2 qos calculation

On 2015-01-21 11:55, bala.manoharan@linaro.org wrote:
> From: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> 
> Fixes the error in vlan qos calculation due to missing convertion of
> odp_be_to_cpu_16()
> 
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> ---
>  platform/linux-generic/odp_classification.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
> index 7d09cce..f6d482d 100644
> --- a/platform/linux-generic/odp_classification.c
> +++ b/platform/linux-generic/odp_classification.c
> @@ -881,7 +881,6 @@ cos_t *match_qos_l3_cos(pmr_l3_cos_t *l3_cos, uint8_t *pkt_addr,
>  cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, uint8_t *pkt_addr,
>  			odp_packet_hdr_t *hdr)
>  {
> -	uint8_t qos;
>  	cos_t *cos = NULL;
>  	odph_ethhdr_t *eth;
>  	odph_vlanhdr_t *vlan;
> @@ -890,7 +889,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, uint8_t *pkt_addr,
>  	    hdr->input_flags.eth) {
>  		eth = (odph_ethhdr_t *)(pkt_addr + hdr->l2_offset);
>  		vlan = (odph_vlanhdr_t *)(&eth->type);
> -		qos = ((vlan->tci >> 13) & 0xFF);
> +		uint16_t qos = odp_be_to_cpu_16(vlan->tci);

Declare "qos" where the other variables are declared.

Cheers,
Anders
Maxim Uvarov Jan. 22, 2015, 4:56 p.m. UTC | #3
Merged this patch.

Maxim.

On 01/21/2015 09:25 AM, bala.manoharan@linaro.org wrote:
> From: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>
> Fixes the error in vlan qos calculation due to missing convertion of
> odp_be_to_cpu_16()
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> ---
>   platform/linux-generic/odp_classification.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
> index 7d09cce..f6d482d 100644
> --- a/platform/linux-generic/odp_classification.c
> +++ b/platform/linux-generic/odp_classification.c
> @@ -881,7 +881,6 @@ cos_t *match_qos_l3_cos(pmr_l3_cos_t *l3_cos, uint8_t *pkt_addr,
>   cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, uint8_t *pkt_addr,
>   			odp_packet_hdr_t *hdr)
>   {
> -	uint8_t qos;
>   	cos_t *cos = NULL;
>   	odph_ethhdr_t *eth;
>   	odph_vlanhdr_t *vlan;
> @@ -890,7 +889,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, uint8_t *pkt_addr,
>   	    hdr->input_flags.eth) {
>   		eth = (odph_ethhdr_t *)(pkt_addr + hdr->l2_offset);
>   		vlan = (odph_vlanhdr_t *)(&eth->type);
> -		qos = ((vlan->tci >> 13) & 0xFF);
> +		uint16_t qos = odp_be_to_cpu_16(vlan->tci);
> +		qos = ((qos >> 13) & 0x07);
>   		cos = l2_cos->cos[qos];
>   	}
>   	return cos;
diff mbox

Patch

diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
index 7d09cce..f6d482d 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -881,7 +881,6 @@  cos_t *match_qos_l3_cos(pmr_l3_cos_t *l3_cos, uint8_t *pkt_addr,
 cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, uint8_t *pkt_addr,
 			odp_packet_hdr_t *hdr)
 {
-	uint8_t qos;
 	cos_t *cos = NULL;
 	odph_ethhdr_t *eth;
 	odph_vlanhdr_t *vlan;
@@ -890,7 +889,8 @@  cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, uint8_t *pkt_addr,
 	    hdr->input_flags.eth) {
 		eth = (odph_ethhdr_t *)(pkt_addr + hdr->l2_offset);
 		vlan = (odph_vlanhdr_t *)(&eth->type);
-		qos = ((vlan->tci >> 13) & 0xFF);
+		uint16_t qos = odp_be_to_cpu_16(vlan->tci);
+		qos = ((qos >> 13) & 0x07);
 		cos = l2_cos->cos[qos];
 	}
 	return cos;