Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jun 2022 16:43:14 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 806f82499a35 - stable/13 - rtw88: deal with debug messages
Message-ID:  <202206031643.253GhEJc021847@gitrepo.freebsd.org>

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

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

commit 806f82499a35d020bc258b3a025cd78e6f93ea8a
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-04-27 15:20:34 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-06-03 15:51:30 +0000

    rtw88: deal with debug messages
    
    The 'failed to write TX skb to HCI' error message is twice in the code.
    Print the function name and along with the message and also the reported
    error so it can possibly be helpful.
    
    The 'failed to get tx report from firmware' was purposefully changed
    away from debugging in the upstream Linux driver in
    584dce175f0461d5d9d63952a1e7955678c91086 . Revert that decision and
    extend the logging by the actual queue length so we get an idea how
    sever the problem is (see PR for a report).
    
    PR:             248235
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit e140d551b78670fbf99c83a59438cb13de50420f)
---
 sys/contrib/dev/rtw88/tx.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/sys/contrib/dev/rtw88/tx.c b/sys/contrib/dev/rtw88/tx.c
index efcc1b0371a8..c6c43331b140 100644
--- a/sys/contrib/dev/rtw88/tx.c
+++ b/sys/contrib/dev/rtw88/tx.c
@@ -159,6 +159,7 @@ void rtw_tx_report_purge_timer(struct timer_list *t)
 	struct rtw_tx_report *tx_report = &rtwdev->tx_report;
 	unsigned long flags;
 
+#if defined(__linux__)
 	if (skb_queue_len(&tx_report->queue) == 0)
 		return;
 
@@ -167,6 +168,25 @@ void rtw_tx_report_purge_timer(struct timer_list *t)
 	spin_lock_irqsave(&tx_report->q_lock, flags);
 	skb_queue_purge(&tx_report->queue);
 	spin_unlock_irqrestore(&tx_report->q_lock, flags);
+#elif defined(__FreeBSD__)
+	uint32_t qlen;
+
+	spin_lock_irqsave(&tx_report->q_lock, flags);
+	qlen = skb_queue_len(&tx_report->queue);
+	if (qlen > 0)
+		skb_queue_purge(&tx_report->queue);
+	spin_unlock_irqrestore(&tx_report->q_lock, flags);
+
+	/*
+	 * XXX while there could be a new enqueue in the queue
+	 * simply not yet processed given the timer is updated without
+	 * locks after enqueue in rtw_tx_report_enqueue(), the numbers
+	 * seen can be in the 100s.  We revert to rtw_dbg from
+	 * Linux git 584dce175f0461d5d9d63952a1e7955678c91086 .
+	 */
+	rtw_dbg(rtwdev, RTW_DBG_TX, "failed to get tx report from firmware: "
+	    "txreport qlen %u\n", qlen);
+#endif
 }
 
 void rtw_tx_report_enqueue(struct rtw_dev *rtwdev, struct sk_buff *skb, u8 sn)
@@ -515,7 +535,11 @@ void rtw_tx(struct rtw_dev *rtwdev,
 	rtw_tx_pkt_info_update(rtwdev, &pkt_info, control->sta, skb);
 	ret = rtw_hci_tx_write(rtwdev, &pkt_info, skb);
 	if (ret) {
+#if defined(__linux__)
 		rtw_err(rtwdev, "failed to write TX skb to HCI\n");
+#elif defined(__FreeBSD__)
+		rtw_err(rtwdev, "%s: failed to write TX skb to HCI: %d\n", __func__, ret);
+#endif
 		goto out;
 	}
 
@@ -572,7 +596,11 @@ static int rtw_txq_push_skb(struct rtw_dev *rtwdev,
 	rtw_tx_pkt_info_update(rtwdev, &pkt_info, txq->sta, skb);
 	ret = rtw_hci_tx_write(rtwdev, &pkt_info, skb);
 	if (ret) {
+#if defined(__linux__)
 		rtw_err(rtwdev, "failed to write TX skb to HCI\n");
+#elif defined(__FreeBSD__)
+		rtw_err(rtwdev, "%s: failed to write TX skb to HCI: %d\n", __func__, ret);
+#endif
 		return ret;
 	}
 	rtwtxq->last_push = jiffies;



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