[U-Boot] [PATCH] nios2: nios2-generic: do not allocate rx buf in net.c

Marek Vasut marex at denx.de
Fri Nov 6 02:40:03 CET 2015


On Friday, November 06, 2015 at 12:47:13 AM, Thomas Chou wrote:
> Hi Marek,

Hi!

> On 2015年11月06日 00:16, Marek Vasut wrote:
> > On Thursday, November 05, 2015 at 09:42:43 AM, Thomas Chou wrote:
> >> Do not allocate rx buf in net.c, because altera_tse allocates
> >> its own rx buf in driver. This can save 6KB memory.
> >> 
> >> Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
> > 
> > Shouldn't we instead fix the altera driver to use the pre-allocated
> > buffer ?
> 
> It should not. The drivers and devices are dynamically binding in driver
> model. The buffers used by devices should be allocated per device. Eg,
> there may be multiple ethernet devices and they should not use the same
> pre-allocated rx bufs.

Oh ok, I see your point now. But then, this allocation of buffers in the
ethernet drivers becomes a boilerplate code, right ? So maybe there should
be some mechanism in the network stack to allocate the buffers for the drivers
to prevent duplication of code.

What do you think?

Best regards,
Marek Vasut


More information about the U-Boot mailing list