summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2017-02-21 14:00:18 +0200
committerAnas Nashif <anas.nashif@intel.com>2017-02-22 08:47:39 -0800
commit7635965b1a79cbf882dc25957fb9085acf3be3e2 (patch)
tree6e2508d345a942dc413334cbce3f6bf2d463d4a3
parent781e6c388a0ba8adc52b215ec819ff9c1053a843 (diff)
net: buf: net_buf_frag_del() had insufficient debugging
In order to see who is freeing the fragment, add function and line information to net_buf_frag_del() when net_buf debugging is activated. Change-Id: I732f579fab2390cb16804cb35b83f46e65fca342 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
-rw-r--r--include/net/buf.h8
-rw-r--r--subsys/net/buf.c11
2 files changed, 19 insertions, 0 deletions
diff --git a/include/net/buf.h b/include/net/buf.h
index 9f2bd6859..0e4079a3d 100644
--- a/include/net/buf.h
+++ b/include/net/buf.h
@@ -939,7 +939,15 @@ struct net_buf *net_buf_frag_add(struct net_buf *head, struct net_buf *frag);
* @return Pointer to the buffer following the fragment, or NULL if it
* had no further fragments.
*/
+#if defined(CONFIG_NET_BUF_LOG)
+struct net_buf *net_buf_frag_del_debug(struct net_buf *parent,
+ struct net_buf *frag,
+ const char *func, int line);
+#define net_buf_frag_del(_parent, _frag) \
+ net_buf_frag_del_debug(_parent, _frag, __func__, __LINE__)
+#else
struct net_buf *net_buf_frag_del(struct net_buf *parent, struct net_buf *frag);
+#endif
/** @brief Calculate amount of bytes stored in fragments.
*
diff --git a/subsys/net/buf.c b/subsys/net/buf.c
index ff33161d4..a282ec6ce 100644
--- a/subsys/net/buf.c
+++ b/subsys/net/buf.c
@@ -294,7 +294,13 @@ struct net_buf *net_buf_frag_add(struct net_buf *head, struct net_buf *frag)
return head;
}
+#if defined(CONFIG_NET_BUF_LOG)
+struct net_buf *net_buf_frag_del_debug(struct net_buf *parent,
+ struct net_buf *frag,
+ const char *func, int line)
+#else
struct net_buf *net_buf_frag_del(struct net_buf *parent, struct net_buf *frag)
+#endif
{
struct net_buf *next_frag;
@@ -309,7 +315,12 @@ struct net_buf *net_buf_frag_del(struct net_buf *parent, struct net_buf *frag)
next_frag = frag->frags;
frag->frags = NULL;
+
+#if defined(CONFIG_NET_BUF_LOG)
+ net_buf_unref_debug(frag, func, line);
+#else
net_buf_unref(frag);
+#endif
return next_frag;
}