lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: [lwip] Re: Re: [lwip] free memory.


From: David Haas
Subject: [lwip-users] Re: [lwip] Re: Re: [lwip] free memory.
Date: Thu, 09 Jan 2003 01:56:43 -0000

What you did is very similar to the way mbuf queues can be created in BSD.
It sounds just fine and might make a fine addition to the pbuf structure.

In my particular code, I am using a descriptor ring (like a circular buffer)
and I keep a ring of pbuf pointers as well. So basically I am doing the same
thing with arrays instead of link-lists.

David.

----- Original Message -----
From: "Ñà×Ó" <address@hidden>
To: <address@hidden>
Sent: Tuesday, December 17, 2002 8:12 PM
Subject: [lwip] Re: Re: [lwip] free memory.


> thank you very much.
> I have another idea.I put a "struct pbuf pkt_nxt" in the structure pbuf.
and when I put the output packet(a list of pbufs) in the output list of an
interface, I use ->pkt_nxt to chain the head of the packets, I let the
passed-down pbufs' head points to NULL. and I'll free the list of pbufs of a
packet when the packet is sent through the interface successfully.
> Is it right?
> > I am doing something similar in my 5272 driver. You can use pbuf->ref to
> > know when to free the buffer. My low_level_output() function increments
> > pbuf->ref when the packet is put on the hardware queue. pbuf_free() is
> > called both from the application and then (presumably later) from the
driver
> > cleanup routine. The last call really frees the buffer, when pbuf->ref
is
> > decremented to zero.
> >
> > Note that when I did this, I found that I needed better critical region
> > protection in pbuf.c.
> >
> > David.
> >
> > ----- Original Message -----
> > From: "Ñà×Ó" <address@hidden>
> > To: <address@hidden>
> > Sent: Friday, December 13, 2002 8:50 PM
> > Subject: [lwip] free memory.
> >
> >
> > > hi all,
> > > I not only queue the packets in the global list "mbox", but also queue
> > them
> > > in the waiting list of every interface(I've made some changes of the
> > "struct netif", and there's a field "if_queue" to hold the packets). The
> > question takes place--where can I free the buffers(They're malloced by
the
> > user in the application.) I can't let the user free them because when
the
> > output of the interface returns ERR_OK to the user, it only means that
the
> > packet is on the waiting queue of the interface. And it seems there's
only
> > one way out--copy the packets to the queue of the interface, and so the
user
> > can free the buffers when queuing success returns ERR_OK to the user.
> > > Can anyone give me any other advices?
> > >                          denffle
> > >
> > > =============================================================
> > > Ê¡¸ÛÊ¥µ®ÇãÇéÒ¹:Ïã¸Û˧¸ç±¾µØÃÀüÓëÄã½»ÓÑÔ¼»á http://dating.163.com/
> > > ÍøÒ×¾ãÀÖ²¿ÎªÄ㽨ÔìÒ»¸ö³¬¼¶µÄ˽ÈËÉçÇø£¡ http://our.163.com
> > > Ãâ·ÑÓÊÏ佡¿µÉ±¶¾´óÐж¯£¡
http://popme.163.com/freemail/index.html
> > > [This message was sent through the lwip discussion list.]
> >
> > [This message was sent through the lwip discussion list.]
> >
> =============================================================
> Ê¡¸ÛÊ¥µ®ÇãÇéÒ¹:Ïã¸Û˧¸ç±¾µØÃÀüÓëÄã½»ÓÑÔ¼»á http://dating.163.com/
> ÍøÒ×¾ãÀÖ²¿ÎªÄ㽨ÔìÒ»¸ö³¬¼¶µÄ˽ÈËÉçÇø£¡ http://our.163.com
> Ãâ·ÑÓÊÏ佡¿µÉ±¶¾´óÐж¯£¡         http://popme.163.com/freemail/index.html
> [This message was sent through the lwip discussion list.]

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




reply via email to

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