[U-Boot] [PATCH] net: See to it that sent data is aligned to the ethernet controllers wishes

Ben Warren biggerbadderben at gmail.com
Wed Aug 19 18:55:46 CEST 2009


Simon Kagstrom wrote:
> On Wed, 19 Aug 2009 16:06:12 +0800
> "Liu Dave-R63238" <DaveLiu at freescale.com> wrote:
>
>   
>>> Well, that's what the other patch I sent does (the link above), but
>>> there were wishes then to handle this above the driver layer, hence
>>> this patch :-)
>>>
>>> I'm fine with either way, but if there are other drivers with 
>>> alignment requirements, I'd prefer this variant.
>>>       
>> I believe some Freescale's CPM/QE controllers need care the
>> alignement requirement.
>>
>> If you don't care the performance, you can malloc memory to
>> get the aligned buffer pool in the initiaize phase,
>> then use the buffer pool to resolve your alignment issue, of course
>> It needs a copy, but it avoids to malloc/free buffer in run-time.
>>     
>
> The malloc is only done once - the first time a non-aligned send is
> done. After that it's just reused until the alignment requirement
> exceeds the current allocation (if another interface is set
> as current).
>
> So I think the performance impact is very small.
>
> // Simon
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>   
My preference is for the drivers to handle alignment.  I like Dave's 
idea of creating a buffer (or multiple buffers) in initialization(), 
then memcpy'ing to to it in the send() routine.  You could make it smart 
to only memcpy if the frame is not aligned as needed.

Your original patch created a buffer of size 9000, which I commented was 
probably bigger than necessary.  I didn't see a response to that (which 
doesn't mean you didn't send one, but I get a lot of e-mail :)

regards,
Ben


More information about the U-Boot mailing list