lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Zero Copy Ethernet interface


From: Andrew Dennison
Subject: Re: [lwip-users] Zero Copy Ethernet interface
Date: Thu, 20 Sep 2007 21:23:21 +1000

On 9/20/07, Goldschmidt Simon <address@hidden> wrote:
> [re andrew's mail:]
>
> > input_thread_loop:
> >     pbuf_alloc() 1514 bytes
> >     pass pbuf to driver and block waiting for packet then DMA from
> device
> >     pbuf_realloc() <- trim to actual length
> >     netif->input()
>
> Which pbuf type do you use here? If you use PBUF_POOL, then
> pbuf_realloc()
> effectively only adjuts the length information, so small packets still
> waste
> a significant amount of memory.

I'm using PBUF_POOL, as I started my driver from scratch based on
ethernetif.c. My issue was I wanted to locate my ethernet driver in my
rtos kernel but keep the rest of lwip in userspace. Preallocating a
max size pbuf to pass to the driver then adjusting it's size on return
seemed like the cleanest implementation to get started with LWIP.

I'm really just using pbuf_realloc to rewrite the length and truncate
the pbuf chain. Even with a PBUF_RAM realloc doesn't truncate the
payload any more.

To balance memory usage and number of bpufs I've set PBUF_POOL_BUFSIZE
to 512 so an ethernet frame will be 1-3 pbufs, but for now I'm happy
that it works at all.

I'm interested to hear if you have ideas on how to improve my implementation.

Andrew




reply via email to

[Prev in Thread] Current Thread [Next in Thread]