lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] p->payload == iphdr failed...


From: Ed Sutter
Subject: Re: [lwip-users] p->payload == iphdr failed...
Date: Fri, 07 Nov 2008 19:31:56 -0500
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)

Jonathan Larmour wrote:
Ed Sutter wrote:
What frees ipacket's memory? Is there any chance that memory can be
reused
before the pbuf is freed?

You may also need to consider the alignment of ipacket.
Jonathan,
Thanks for the response.  The underlying driver releases the buffer.
This is coordinated with details outside the scope of this problem.
It is the same packet buffer used in the working method that uses
PBUF_POOL for allocation.

Ah I see in the implementation of pbuf_header, that it can't expand
PBUF_REFs to the front. That will be your problem.

I think the only reason it doesn't do it is because there's no way to
sanity check that it's a valid thing to do.

Hmmmm...
If I can't use PBUF_RAW/PBUF_REF to allocate the pbuf, then does that
mean I have no choice but to do the loop of memcpy's like this...

+     p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
+     if (p) {
+         for(q = p; q != NULL; q = q->next) {
+             memcpy(q->payload,ipkt, q->len);
+             ipkt += q->len;
+         }
+         ethernet_input(p, mynetifp);
+     }

to transfer the incoming buffer into the pbuf->payload buffers?
Or is there some other way to avoid that copy loop?
Ed




reply via email to

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