mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-09 09:03:49 +08:00
Fixed up and made work a PBUF_REF type. Most of the code uses this now
instead of PBUF_ROM. This addition allows support of copy-on-demand where the lower layers can call pbuf_unref() which tests for any PBUF_REF buffers and replaces them with PBUF_POOL buffers. This is now used everywhere. pbuf_unref() is called in ARP queueing and in the coldfire driver, which puts frames on a DMA queue and frees them later. Along with this change pbuf_free() now goes through the entire chain of buffers and tests all the ref counters, not just the first one. Generally now pbuf_ref_chain() should be called and not pbuf_ref(). This change was made because it is possible for the head of the pbuf chain to have a different count than the payload pbuf which might have been passed by the application.
This commit is contained in:
@@ -299,7 +299,7 @@ ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
|
||||
u16_t tmp;
|
||||
|
||||
/* Get a RAM based MTU sized pbuf */
|
||||
rambuf = pbuf_alloc(PBUF_LINK, 0, PBUF_ROM);
|
||||
rambuf = pbuf_alloc(PBUF_LINK, 0, PBUF_REF);
|
||||
rambuf->tot_len = rambuf->len = mtu;
|
||||
rambuf->payload = buf;
|
||||
|
||||
@@ -349,7 +349,6 @@ ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
|
||||
#ifdef IP_STATS
|
||||
++lwip_stats.ip_frag.xmit;
|
||||
#endif /* IP_STATS */
|
||||
pbuf_dechain(header);
|
||||
pbuf_free(header);
|
||||
|
||||
left -= cop;
|
||||
|
||||
Reference in New Issue
Block a user