[U-Boot] [PATCH] arm:kirkwood See to it that sent data is 8-byte aligned

Prafulla Wadaskar prafulla at marvell.com
Tue Aug 18 12:12:07 CEST 2009


 

> -----Original Message-----
> From: u-boot-bounces at lists.denx.de 
> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Simon Kagstrom
> Sent: Tuesday, August 18, 2009 3:02 PM
> To: U-Boot ML
> Subject: [U-Boot] [PATCH] arm:kirkwood See to it that sent 
> data is 8-byte aligned
> 
> See to it that sent data is 8-byte aligned
> 
> U-boot might use non-8-byte-aligned addresses for sending data, which
> the kwgbe_send doesn't accept (bootp does this for me). This patch
> copies the data to be sent to a malloced temporary buffer if it is
> non-aligned.
> 
> v2: Malloc send buffer (comment from Stefan Roese)
Malloc will always be an overhead.
I strongly recommend- we should pass aligned buffers from upper layers to avoid such rework in all low level drivers, (few are already aligned).

> v3: No need to use jumbo frames, use 1518 bytes buffer instead
Better to use PKTSIZE_ALIGN here, avoid magic numbers

>     (comment from Ben Warren)
> 
> Signed-off-by: Simon Kagstrom <simon.kagstrom at netinsight.net>
> ---
>  drivers/net/kirkwood_egiga.c |   26 ++++++++++++++++++++++----
>  1 files changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/kirkwood_egiga.c 
> b/drivers/net/kirkwood_egiga.c
> index f31fefc..6627412 100644
> --- a/drivers/net/kirkwood_egiga.c
> +++ b/drivers/net/kirkwood_egiga.c
> @@ -481,24 +481,42 @@ static int kwgbe_halt(struct eth_device *dev)
>  	return 0;
>  }
>  
> +#define KWGBE_SEND_BUF_SIZE 1518
Better to use PKTSIZE_ALIGN here, avoid magic numbers
Regards..
Prafulla . .


More information about the U-Boot mailing list