597 |
|
|
598 |
PERF_START; |
PERF_START; |
599 |
|
|
600 |
LWIP_ASSERT("pbuf_free: sane flags", p->flags == PBUF_FLAG_POOL || |
LWIP_ASSERT("pbuf_free: sane flags", |
601 |
p->flags == PBUF_FLAG_ROM || |
p->flags == PBUF_FLAG_RAM || p->flags == PBUF_FLAG_ROM || |
602 |
p->flags == PBUF_FLAG_RAM || |
p->flags == PBUF_FLAG_REF || p->flags == PBUF_FLAG_POOL); |
|
p->flags == PBUF_FLAG_REF ); |
|
603 |
|
|
|
q = p; |
|
604 |
count = 0; |
count = 0; |
605 |
/* Since decrementing ref cannot be guaranteed to be a single machine operation |
/* Since decrementing ref cannot be guaranteed to be a single machine operation |
606 |
* we must protect it. Also, the later test of ref must be protected. |
* we must protect it. Also, the later test of ref must be protected. |
610 |
* obtain a zero reference count */ |
* obtain a zero reference count */ |
611 |
while (p != NULL) { |
while (p != NULL) { |
612 |
/* all pbufs in a chain are referenced at least once */ |
/* all pbufs in a chain are referenced at least once */ |
613 |
LWIP_ASSERT("pbuf_free: q->ref > 0", q->ref > 0); |
LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0); |
614 |
p->ref--; |
p->ref--; |
615 |
/* this pbuf is no longer referenced to? */ |
/* this pbuf is no longer referenced to? */ |
616 |
if (p->ref == 0) |
if (p->ref == 0) |
677 |
{ |
{ |
678 |
SYS_ARCH_DECL_PROTECT(old_level); |
SYS_ARCH_DECL_PROTECT(old_level); |
679 |
/* pbuf given? */ |
/* pbuf given? */ |
680 |
if(p != NULL) { |
if (p != NULL) { |
681 |
SYS_ARCH_PROTECT(old_level); |
SYS_ARCH_PROTECT(old_level); |
682 |
++(p->ref); |
++(p->ref); |
683 |
SYS_ARCH_UNPROTECT(old_level); |
SYS_ARCH_UNPROTECT(old_level); |