lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [task #6735] Provide new pbuf type: PBUF_RAM_NOCOPY


From: EVS Hardware Dpt
Subject: [lwip-devel] [task #6735] Provide new pbuf type: PBUF_RAM_NOCOPY
Date: Fri, 19 Oct 2007 13:43:52 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

Follow-up Comment #31, task #6735 (project lwip):

After reading the whole discussion my conclusion is that you want to be sure
that each time you call an output function (tcp_write, udp_send,...) the
buffer is free for re-use ?

In our port, we use Dma functionnality, so low_level_output makes a
pbuf_ref(p), put it on dma chain and return, then the TX Isr free this pbuf.
If nobody has a ref on it, it's freed, else the buffer is still allocated and
owned by it's creator.

For tcp_write, it seems obvious that if you want to be sure you can reuse a
buffer, either you send it with the Copy flag, or you wait the associated
data_sent callback.

For Udp, why not simply free the buffer directly after sending, either the
ethernet driver has already sent the buffer and it is effectively freed, or
the driver has still a reference on it and thus the buffer is not freed. Now
if you want to send another bunch of data, simply ask for a new pBuf.

The basic schema would be :

while(MustSendData == TRUE)
{
   pbuf = pbuf_alloc()
   fill_buf_with_data()
   udp_send(pbuf)
   pbuf_free(pbuf)
}

Now for udp, if you don't want to free pbuf everytime, why not create a Macro
like PBUF_CAN_REUSE that check that ref_count is 1, so this buffer is free for
reuse. So the schema would be:

pbuf = pbuf_alloc()

while(MustSendData == TRUE)
{
   if(PBUF_CAN_REUSE(pbuf))
   {
      fill_buf_with_data()
      udp_send(pbuf)
   }
}

pbuf_free(pbuf)

A nice side effect would be that we can wait for previous data sent before
sending another one.

I like the current state of stack, and I think we must not change to
something with lot of copies just to make sure that we can use it without
prior knownledge. In our design we are able to get 950Mbps throughput and
certainly don't want to go below that.

Fred.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?6735>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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