aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2026-02-03 22:13:24 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2026-07-17 15:48:52 +0000
commite5bcf7b99fcbe06d381525ffdd5027b846cdc1d3 (patch)
tree769e917ac73e9916d548e7203a5b39ea6b0ba554
parentd0b1a389003b1e6ff5bcf35a7c04654ea7ff87bd (diff)
LinuxKPI: skbuff: improve debugging
Deal with SKB_TRACE_FMT optional arguments; while here properly indent. Add KASSERT to __skb_unlink() to catch incorrect skbuffs encountered while debugging a wireless driver (which had other pre-conditions failing). Sponsored by: The FreeBSD Foundation MFC after: 3 days
-rw-r--r--sys/compat/linuxkpi/common/include/linux/skbuff.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index c43d6daff5ee..3133944ed72e 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2020-2025 The FreeBSD Foundation
+ * Copyright (c) 2020-2026 The FreeBSD Foundation
* Copyright (c) 2021-2025 Bjoern A. Zeeb
*
* This software was developed by Björn Zeeb under sponsorship from
@@ -74,9 +74,9 @@ extern int linuxkpi_debug_skb;
if (linuxkpi_debug_skb & DSKB_TRACE) \
printf("SKB_TRACE %s:%d %p, %p\n", __func__, __LINE__, _s, _p)
#define SKB_TRACE_FMT(_s, _fmt, ...) \
- if (linuxkpi_debug_skb & DSKB_TRACE) \
+ if ((linuxkpi_debug_skb & DSKB_TRACE) != 0) \
printf("SKB_TRACE %s:%d %p " _fmt "\n", __func__, __LINE__, _s, \
- __VA_ARGS__)
+ ##__VA_ARGS__)
#else
#define SKB_TODO() do { } while(0)
#define SKB_IMPROVE(...) do { } while(0)
@@ -653,6 +653,8 @@ __skb_unlink(struct sk_buff *skb, struct sk_buff_head *q)
WRITE_ONCE(q->qlen, q->qlen - 1);
p = skb->prev;
n = skb->next;
+ KASSERT(p != NULL && n != NULL,
+ ("%s: skb %p q %p p %p n %p\n", __func__, skb, q, p, n));
WRITE_ONCE(n->prev, p);
WRITE_ONCE(p->next, n);
skb->prev = skb->next = NULL;