lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] [lwip] pbuf questions


From: David Haas
Subject: [lwip-users] [lwip] pbuf questions
Date: Wed, 08 Jan 2003 23:48:10 -0000

This is a multi-part message in MIME format.

------=_NextPart_000_011B_01C28CCF.6C66F1C0
Content-Type: text/plain;
        charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hi,

I am confused about the types of pbuf payloads. When do you use =
PBUF_RAM, PBUF_ROM, or PBUF_POOL. I assume that PBUF_POOL pbufs are =
faster to allocate and deallocate than PBUF_RAM buffers, but why do you =
ever want to use a PBUF_RAM buffer? I see that PBUF_RAM buffers are =
generally used for headers, but why not just have two pool sizes? =
Would'nt that be much faster? Doing a mem_malloc and mem_free all the =
time really slows things down. Especially since the ethernet drivers =
seem to be using PBUF_RAM for ethernet headers on transmit. I guess I =
could implement a fixed size pool using PBUF_ROM buffers myself, but =
since I'm lazy and don't really have memory constraints, I probably just =
use PBUF_POOL buffers even for the link layer headers.

I worked on a BSD-based network stack some time ago and they used mbuf's =
which where the entire mbuf (header+payload) had to be aligned to a =
power-of-two boundary (128, 256, 512, etc). They were fixed size, but =
the really neat thing was that you always knew where the header was, =
even if you just had a pointer into the payload (just zero the low order =
address bits). Since the buffers were fixed size, it also made =
allocation and deallocation in a pool very very fast.

Anyway, I am not necessarily suggesting a change here, I just want to =
understand why the PBUF_RAM exists. I might very well not be =
understanding the issues well.

Thanks,
David.


David Haas
NBS Card Technology
70 Eisenhower Drive,
Paramus, NJ 07652
Voice: 201-845-7373 x183
Fax: 201-845-3337
email: address@hidden

------=_NextPart_000_011B_01C28CCF.6C66F1C0
Content-Type: text/html;
        charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Hi,</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I am confused about the types of pbuf payloads. When =
do you=20
use PBUF_RAM, PBUF_ROM, or PBUF_POOL. I assume that PBUF_POOL pbufs are =
faster=20
to allocate and deallocate than PBUF_RAM buffers, but why do you ever =
want to=20
use a PBUF_RAM buffer? I see that PBUF_RAM buffers are generally used =
for=20
headers, but why not just have two pool sizes? Would'nt that be much =
faster?=20
Doing a mem_malloc and mem_free all the time really slows things down.=20
Especially since the ethernet drivers seem to be using PBUF_RAM for =
ethernet=20
headers on transmit. I guess I could implement a fixed size pool using =
PBUF_ROM=20
buffers myself, but since I'm lazy and don't really have memory =
constraints, I=20
probably just use PBUF_POOL buffers even for the link layer=20
headers.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I worked on a BSD-based network stack some time ago =
and they=20
used mbuf's which where the entire mbuf (header+payload) had to be =
aligned to a=20
power-of-two boundary (128, 256, 512, etc). They were fixed size, but =
the really=20
neat thing was that you always knew where the header was, even if you =
just had a=20
pointer into the payload (just zero the low order address bits). Since =
the=20
buffers were fixed size, it also made allocation and deallocation in a =
pool very=20
very fast.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Anyway, I am not necessarily suggesting a change =
here, I just=20
want to understand why the PBUF_RAM exists. I might very well not be=20
understanding the issues well.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Thanks,</FONT></DIV>
<DIV><FONT size=3D2>David.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>David Haas<BR>NBS Card Technology<BR>70 Eisenhower=20
Drive,<BR>Paramus, NJ 07652<BR>Voice: 201-845-7373 x183<BR>Fax:=20
201-845-3337<BR>email: <A=20
href=3D"mailto:address@hidden";>address@hidden</A><BR></FONT></DIV><=
/BODY></HTML>

------=_NextPart_000_011B_01C28CCF.6C66F1C0--

[This message was sent through the lwip discussion list.]




reply via email to

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