summaryrefslogtreecommitdiff
path: root/nuttx/net/iob/iob_free_chain.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/net/iob/iob_free_chain.c')
-rw-r--r--nuttx/net/iob/iob_free_chain.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/nuttx/net/iob/iob_free_chain.c b/nuttx/net/iob/iob_free_chain.c
index db9fc408c..d09a0ca97 100644
--- a/nuttx/net/iob/iob_free_chain.c
+++ b/nuttx/net/iob/iob_free_chain.c
@@ -39,6 +39,13 @@
#include <nuttx/config.h>
+#if defined(CONFIG_DEBUG) && defined(CONFIG_NET_IOB_DEBUG)
+/* Force debug output (from this file only) */
+
+# undef CONFIG_DEBUG_NET
+# define CONFIG_DEBUG_NET 1
+#endif
+
#include <nuttx/arch.h>
#include <nuttx/net/iob.h>
@@ -75,20 +82,12 @@
void iob_free_chain(FAR struct iob_s *iob)
{
- FAR struct iob_s *last;
- irqstate_t flags;
-
- /* Find the last entry in the I/O buffer list */
-
- for (last = iob; last->io_flink; last = last->io_flink);
+ FAR struct iob_s *next;
- /* Free the I/O buffer chain by adding it to the head of the free list. We
- * don't know what context we are called from so we use extreme measures to
- * protect the free list: We disable interrupts very briefly.
- */
+ /* Free each IOB in the chain -- one at a time to keep the count straight */
- flags = irqsave();
- last->io_flink = g_iob_freelist;
- g_iob_freelist = iob;
- irqrestore(flags);
+ for (; iob; iob = next)
+ {
+ next = iob_free(iob);
+ }
}