diff mbox

[API-NEXT/PATCH] fix: build fix in arm platform

Message ID 1449492052-3804-1-git-send-email-bala.manoharan@linaro.org
State New
Headers show

Commit Message

Balasubramanian Manoharan Dec. 7, 2015, 12:40 p.m. UTC
Fixes arm build failure due to wrong typecast of 'const' variable

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
Reviewed-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 platform/linux-generic/odp_packet.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Comments

Maxim Uvarov Dec. 7, 2015, 3:06 p.m. UTC | #1
Merged with rename to:
linux-generic: packet: _odp_parse_common: arm build fix

Maxim.

On 12/07/2015 15:40, Balasubramanian Manoharan wrote:
> Fixes arm build failure due to wrong typecast of 'const' variable
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> Reviewed-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>   platform/linux-generic/odp_packet.c | 19 ++++++++++++-------
>   1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
> index 80901c9..db85b5e 100644
> --- a/platform/linux-generic/odp_packet.c
> +++ b/platform/linux-generic/odp_packet.c
> @@ -946,11 +946,13 @@ int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *ptr)
>   	if (ptr == NULL) {
>   		eth = (odph_ethhdr_t *)packet_map(pkt_hdr, 0, &seglen);
>   		parseptr = (const uint8_t *)&eth->type;
> -		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
> +		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
> +					   (const void *)parseptr));
>   	} else {
>   		eth = (const odph_ethhdr_t *)ptr;
>   		parseptr = (const uint8_t *)&eth->type;
> -		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
> +		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
> +					   (const void *)parseptr));
>   	}
>   
>   
> @@ -959,22 +961,24 @@ int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *ptr)
>   		pkt_hdr->input_flags.vlan_qinq = 1;
>   		pkt_hdr->input_flags.vlan = 1;
>   
> -		vlan = (const odph_vlanhdr_t *)parseptr;
> +		vlan = (const odph_vlanhdr_t *)(const void *)parseptr;
>   		pkt_hdr->vlan_s_tag = ((ethtype << 16) |
>   				       odp_be_to_cpu_16(vlan->tci));
>   		offset += sizeof(odph_vlanhdr_t);
>   		parseptr += sizeof(odph_vlanhdr_t);
> -		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
> +		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
> +					   (const void *)parseptr));
>   	}
>   
>   	if (ethtype == ODPH_ETHTYPE_VLAN) {
>   		pkt_hdr->input_flags.vlan = 1;
> -		vlan = (const odph_vlanhdr_t *)parseptr;
> +		vlan = (const odph_vlanhdr_t *)(const void *)parseptr;
>   		pkt_hdr->vlan_c_tag = ((ethtype << 16) |
>   				       odp_be_to_cpu_16(vlan->tci));
>   		offset += sizeof(odph_vlanhdr_t);
>   		parseptr += sizeof(odph_vlanhdr_t);
> -		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
> +		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
> +					   (const void *)parseptr));
>   	}
>   
>   	/* Check for SNAP vs. DIX */
> @@ -986,7 +990,8 @@ int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *ptr)
>   		}
>   		offset   += 8;
>   		parseptr += 8;
> -		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
> +		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
> +					   (const void *)parseptr));
>   	}
>   
>   	/* Consume Ethertype for Layer 3 parse */
diff mbox

Patch

diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 80901c9..db85b5e 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -946,11 +946,13 @@  int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *ptr)
 	if (ptr == NULL) {
 		eth = (odph_ethhdr_t *)packet_map(pkt_hdr, 0, &seglen);
 		parseptr = (const uint8_t *)&eth->type;
-		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
+		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
+					   (const void *)parseptr));
 	} else {
 		eth = (const odph_ethhdr_t *)ptr;
 		parseptr = (const uint8_t *)&eth->type;
-		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
+		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
+					   (const void *)parseptr));
 	}
 
 
@@ -959,22 +961,24 @@  int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *ptr)
 		pkt_hdr->input_flags.vlan_qinq = 1;
 		pkt_hdr->input_flags.vlan = 1;
 
-		vlan = (const odph_vlanhdr_t *)parseptr;
+		vlan = (const odph_vlanhdr_t *)(const void *)parseptr;
 		pkt_hdr->vlan_s_tag = ((ethtype << 16) |
 				       odp_be_to_cpu_16(vlan->tci));
 		offset += sizeof(odph_vlanhdr_t);
 		parseptr += sizeof(odph_vlanhdr_t);
-		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
+		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
+					   (const void *)parseptr));
 	}
 
 	if (ethtype == ODPH_ETHTYPE_VLAN) {
 		pkt_hdr->input_flags.vlan = 1;
-		vlan = (const odph_vlanhdr_t *)parseptr;
+		vlan = (const odph_vlanhdr_t *)(const void *)parseptr;
 		pkt_hdr->vlan_c_tag = ((ethtype << 16) |
 				       odp_be_to_cpu_16(vlan->tci));
 		offset += sizeof(odph_vlanhdr_t);
 		parseptr += sizeof(odph_vlanhdr_t);
-		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
+		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
+					   (const void *)parseptr));
 	}
 
 	/* Check for SNAP vs. DIX */
@@ -986,7 +990,8 @@  int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *ptr)
 		}
 		offset   += 8;
 		parseptr += 8;
-		ethtype = odp_be_to_cpu_16(*((const uint16_t *)parseptr));
+		ethtype = odp_be_to_cpu_16(*((const uint16_t *)
+					   (const void *)parseptr));
 	}
 
 	/* Consume Ethertype for Layer 3 parse */