Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Feb 2025 23:27:11 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: bcf1d8ee3552 - main - LinuxKPI: 802.11/skb: add extra information for skb alloc failures
Message-ID:  <202502162327.51GNRBo3022769@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=bcf1d8ee355213eef4a125c0b8518f1cb4f35df4

commit bcf1d8ee355213eef4a125c0b8518f1cb4f35df4
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-12-27 21:26:52 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-02-16 23:04:24 +0000

    LinuxKPI: 802.11/skb: add extra information for skb alloc failures
    
    rtw88 seems to have an skb leak still.
    
    Add a WARN_ONCE to __skb_queue_purge() just to make sure there is no
    glitch due to missing locking.
    
    Also add a rolling error reporting for skb allocation failures in
    LinuxKPI to gather some more information if possible about queue
    states.
    
    This is a corrected version of what was initially part of D48474.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/include/linux/skbuff.h |  2 ++
 sys/compat/linuxkpi/common/src/linux_80211.c      | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index 341ed33ddfcd..43f35d8f065f 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -706,6 +706,8 @@ __skb_queue_purge(struct sk_buff_head *q)
 	SKB_TRACE(q);
         while ((skb = __skb_dequeue(q)) != NULL)
 		kfree_skb(skb);
+	WARN_ONCE(skb_queue_len(q) != 0, "%s: queue %p not empty: %u",
+	    __func__, q, skb_queue_len(q));
 }
 
 static inline void
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 1d834673fa74..f695aa4cfc7d 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -3854,7 +3854,22 @@ lkpi_80211_txq_tx_one(struct lkpi_sta *lsta, struct mbuf *m)
 	 */
 	skb = dev_alloc_skb(hw->extra_tx_headroom + m->m_pkthdr.len);
 	if (skb == NULL) {
-		ic_printf(ic, "ERROR %s: skb alloc failed\n", __func__);
+		static uint8_t skb_alloc_failures = 0;
+
+		if (skb_alloc_failures++ == 0) {
+			int tid;
+
+			sta = LSTA_TO_STA(lsta);
+			ic_printf(ic, "ERROR %s: skb alloc failed %d + %d, lsta %p sta %p ni %p\n",
+			    __func__, hw->extra_tx_headroom, m->m_pkthdr.len, lsta, sta, ni);
+			for (tid = 0; tid < nitems(sta->txq); tid++) {
+				if (sta->txq[tid] == NULL)
+					continue;
+				ltxq = TXQ_TO_LTXQ(sta->txq[tid]);
+				ic_printf(ic, "  tid %d ltxq %p seen_dequeue %d stopped %d skb_queue_len %u\n",
+				    tid, ltxq, ltxq->seen_dequeue, ltxq-> stopped, skb_queue_len(&ltxq->skbq));
+			}
+		}
 		ieee80211_free_node(ni);
 		m_freem(m);
 		return;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502162327.51GNRBo3022769>