diff mbox

[4/7] net: emaclite: Add support for little-endian platforms

Message ID 1285739538-29058-5-git-send-email-monstr@monstr.eu
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Michal Simek Sept. 29, 2010, 5:52 a.m. UTC
Upcomming Microblaze is little endian that's why is necessary
to fix protocol and length loading.

Signed-off-by: Michal Simek <monstr@monstr.eu>
CC: "David S. Miller" <davem@davemloft.net>
CC: Grant Likely <grant.likely@secretlab.ca>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: devicetree-discuss@lists.ozlabs.org
---
 drivers/net/xilinx_emaclite.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Comments

Grant Likely Sept. 29, 2010, 6:11 a.m. UTC | #1
On Wed, Sep 29, 2010 at 03:52:15PM +1000, Michal Simek wrote:
> Upcomming Microblaze is little endian that's why is necessary
> to fix protocol and length loading.
> 
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> CC: "David S. Miller" <davem@davemloft.net>
> CC: Grant Likely <grant.likely@secretlab.ca>
> CC: Eric Dumazet <eric.dumazet@gmail.com>
> CC: netdev@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> CC: devicetree-discuss@lists.ozlabs.org

This should go via davem, but it looks correct to me.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  drivers/net/xilinx_emaclite.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
> index 71122ee..533ebb1 100644
> --- a/drivers/net/xilinx_emaclite.c
> +++ b/drivers/net/xilinx_emaclite.c
> @@ -430,8 +430,8 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data)
>  	}
>  
>  	/* Get the protocol type of the ethernet frame that arrived */
> -	proto_type = ((in_be32(addr + XEL_HEADER_OFFSET +
> -			XEL_RXBUFF_OFFSET) >> XEL_HEADER_SHIFT) &
> +	proto_type = ((ntohl(in_be32(addr + XEL_HEADER_OFFSET +
> +			XEL_RXBUFF_OFFSET)) >> XEL_HEADER_SHIFT) &
>  			XEL_RPLR_LENGTH_MASK);
>  
>  	/* Check if received ethernet frame is a raw ethernet frame
> @@ -439,9 +439,9 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data)
>  	if (proto_type > (ETH_FRAME_LEN + ETH_FCS_LEN)) {
>  
>  		if (proto_type == ETH_P_IP) {
> -			length = ((in_be32(addr +
> +			length = ((ntohl(in_be32(addr +
>  					XEL_HEADER_IP_LENGTH_OFFSET +
> -					XEL_RXBUFF_OFFSET) >>
> +					XEL_RXBUFF_OFFSET)) >>
>  					XEL_HEADER_SHIFT) &
>  					XEL_RPLR_LENGTH_MASK);
>  			length += ETH_HLEN + ETH_FCS_LEN;
> -- 
> 1.5.5.1
> 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 29, 2010, 6:27 a.m. UTC | #2
From: Grant Likely <grant.likely@secretlab.ca>
Date: Wed, 29 Sep 2010 15:11:46 +0900

> On Wed, Sep 29, 2010 at 03:52:15PM +1000, Michal Simek wrote:
>> Upcomming Microblaze is little endian that's why is necessary
>> to fix protocol and length loading.
>> 
>> Signed-off-by: Michal Simek <monstr@monstr.eu>
>> CC: "David S. Miller" <davem@davemloft.net>
>> CC: Grant Likely <grant.likely@secretlab.ca>
>> CC: Eric Dumazet <eric.dumazet@gmail.com>
>> CC: netdev@vger.kernel.org
>> CC: linux-kernel@vger.kernel.org
>> CC: devicetree-discuss@lists.ozlabs.org
> 
> This should go via davem, but it looks correct to me.
> 
> Acked-by: Grant Likely <grant.likely@secretlab.ca>

It doesn't need to, the microblaze guys can integrate this directly:

Acked-by: David S. Miller <davem@davemloft.net>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Simek Sept. 29, 2010, 7:33 a.m. UTC | #3
David Miller wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Wed, 29 Sep 2010 15:11:46 +0900
> 
>> On Wed, Sep 29, 2010 at 03:52:15PM +1000, Michal Simek wrote:
>>> Upcomming Microblaze is little endian that's why is necessary
>>> to fix protocol and length loading.
>>>
>>> Signed-off-by: Michal Simek <monstr@monstr.eu>
>>> CC: "David S. Miller" <davem@davemloft.net>
>>> CC: Grant Likely <grant.likely@secretlab.ca>
>>> CC: Eric Dumazet <eric.dumazet@gmail.com>
>>> CC: netdev@vger.kernel.org
>>> CC: linux-kernel@vger.kernel.org
>>> CC: devicetree-discuss@lists.ozlabs.org
>> This should go via davem, but it looks correct to me.
>>
>> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> 
> It doesn't need to, the microblaze guys can integrate this directly:
> 
> Acked-by: David S. Miller <davem@davemloft.net>

Thanks for ACKs. I will add them and will take care about it.

Michal
diff mbox

Patch

diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 71122ee..533ebb1 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -430,8 +430,8 @@  static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data)
 	}
 
 	/* Get the protocol type of the ethernet frame that arrived */
-	proto_type = ((in_be32(addr + XEL_HEADER_OFFSET +
-			XEL_RXBUFF_OFFSET) >> XEL_HEADER_SHIFT) &
+	proto_type = ((ntohl(in_be32(addr + XEL_HEADER_OFFSET +
+			XEL_RXBUFF_OFFSET)) >> XEL_HEADER_SHIFT) &
 			XEL_RPLR_LENGTH_MASK);
 
 	/* Check if received ethernet frame is a raw ethernet frame
@@ -439,9 +439,9 @@  static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data)
 	if (proto_type > (ETH_FRAME_LEN + ETH_FCS_LEN)) {
 
 		if (proto_type == ETH_P_IP) {
-			length = ((in_be32(addr +
+			length = ((ntohl(in_be32(addr +
 					XEL_HEADER_IP_LENGTH_OFFSET +
-					XEL_RXBUFF_OFFSET) >>
+					XEL_RXBUFF_OFFSET)) >>
 					XEL_HEADER_SHIFT) &
 					XEL_RPLR_LENGTH_MASK);
 			length += ETH_HLEN + ETH_FCS_LEN;