Skip to contentSkip to conversation

wifi: rtw89: 8852b: change debug mask of message of no TX resource

PATCH Superseded Ping-Ke Shih 2 participants 3 messages Nov 3, 2022 – Nov 8, 2022 Realtek wireless driver (rtw89)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

PATCH 1/1 wifi: rtw89: 8852b: change debug mask of message of no TX resource

8852B has smaller TX FIFO than others in WiFi chip, so it would be buffer full frequently, but it doesn't affect TX performance. However, it shows verbose debug messages with RTW89_DBG_UNEXP mask that is to show up abnormal behavior, so change debug mask to RTW89_DBG_TXRX for 8852B.

---
 drivers/net/wireless/realtek/rtw89/pci.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/pci.c +10 -2
index 07a2e23759f0b..99a254d7ba5ed 100644
@@ -971,8 +971,10 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
 	struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
 	struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch];
 	struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring;
+	const struct rtw89_chip_info *chip = rtwdev->chip;
 	u32 bd_cnt, wd_cnt, min_cnt = 0;
 	struct rtw89_pci_rx_ring *rx_ring;
+	enum rtw89_debug_mask debug_mask;
 	u32 cnt;
 
 	rx_ring = &rtwpci->rx_rings[RTW89_RXCH_RPQ];
@@ -996,10 +998,16 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
 	bd_cnt = rtw89_pci_get_avail_txbd_num(tx_ring);
 	wd_cnt = wd_ring->curr_num;
 	min_cnt = min(bd_cnt, wd_cnt);
-	if (min_cnt == 0)
-		rtw89_debug(rtwdev, rtwpci->low_power ? RTW89_DBG_TXRX : RTW89_DBG_UNEXP,
+	if (min_cnt == 0) {
+		if (rtwpci->low_power || chip->chip_id == RTL8852B)
+			debug_mask = RTW89_DBG_TXRX;
+		else
+			debug_mask = RTW89_DBG_UNEXP;
+
+		rtw89_debug(rtwdev, debug_mask,
 			    "still no tx resource after reclaim: wd_cnt=%d bd_cnt=%d\n",
 			    wd_cnt, bd_cnt);
+	}
 
 out_unlock:
 	spin_unlock_bh(&rtwpci->trx_lock);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 31 lines · Ping-Ke Shih

8852B has smaller TX FIFO than others in WiFi chip, so it would be buffer full frequently, but it doesn't affect TX performance. However, it shows verbose debug messages with RTW89_DBG_UNEXP mask that is to show up abnormal behavior, so change debug mask to RTW89_DBG_TXRX for 8852B.

---
 drivers/net/wireless/realtek/rtw89/pci.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/pci.c +2 -2
index 07a2e23759f0b..99a254d7ba5ed 100644
@@ -971,8 +971,10 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
 	struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
 	struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch];
 	struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring;
+	const struct rtw89_chip_info *chip = rtwdev->chip;
 	u32 bd_cnt, wd_cnt, min_cnt = 0;
 	struct rtw89_pci_rx_ring *rx_ring;
+	enum rtw89_debug_mask debug_mask;
 	u32 cnt;
 
 	rx_ring = &rtwpci->rx_rings[RTW89_RXCH_RPQ];
@@ -996,10 +998,16 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
 	bd_cnt = rtw89_pci_get_avail_txbd_num(tx_ring);
 	wd_cnt = wd_ring->curr_num;
 	min_cnt = min(bd_cnt, wd_cnt);
-	if (min_cnt == 0)
-		rtw89_debug(rtwdev, rtwpci->low_power ? RTW89_DBG_TXRX : RTW89_DBG_UNEXP,

drivers/net/wireless/realtek/rtw89/pci.c static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev, · line 1010

Quoted 10 lines
drivers/net/wireless/realtek/rtw89/pci.c +8 -0
+	if (min_cnt == 0) {
+		if (rtwpci->low_power || chip->chip_id == RTL8852B)
+			debug_mask = RTW89_DBG_TXRX;
+		else
+			debug_mask = RTW89_DBG_UNEXP;
+
+		rtw89_debug(rtwdev, debug_mask,
 			    "still no tx resource after reclaim: wd_cnt=%d bd_cnt=%d\n",
 			    wd_cnt, bd_cnt);
+	}

Changing the debug mask like this looks a bit weird to me. At least it would be good to have a comment in the code explainin why this is done like this.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author maintainer
#2 lore raw
Quoted 48 lines

-----Original Message-----
From: Kalle Valo <[email protected]>
Sent: Monday, November 7, 2022 8:33 PM
To: Ping-Ke Shih <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] wifi: rtw89: 8852b: change debug mask of message of no TX resource

Quoted 37 lines · Ping-Ke Shih

8852B has smaller TX FIFO than others in WiFi chip, so it would be buffer full frequently, but it doesn't affect TX performance. However, it shows verbose debug messages with RTW89_DBG_UNEXP mask that is to show up abnormal behavior, so change debug mask to RTW89_DBG_TXRX for 8852B.

---
 drivers/net/wireless/realtek/rtw89/pci.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/pci.c +8 -2
index 07a2e23759f0b..99a254d7ba5ed 100644
@@ -971,8 +971,10 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
 	struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
 	struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch];
 	struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring;
+	const struct rtw89_chip_info *chip = rtwdev->chip;
 	u32 bd_cnt, wd_cnt, min_cnt = 0;
 	struct rtw89_pci_rx_ring *rx_ring;
+	enum rtw89_debug_mask debug_mask;
 	u32 cnt;
 
 	rx_ring = &rtwpci->rx_rings[RTW89_RXCH_RPQ];
@@ -996,10 +998,16 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
 	bd_cnt = rtw89_pci_get_avail_txbd_num(tx_ring);
 	wd_cnt = wd_ring->curr_num;
 	min_cnt = min(bd_cnt, wd_cnt);
-	if (min_cnt == 0)
-		rtw89_debug(rtwdev, rtwpci->low_power ? RTW89_DBG_TXRX : RTW89_DBG_UNEXP,
+	if (min_cnt == 0) {
+		if (rtwpci->low_power || chip->chip_id == RTL8852B)
+			debug_mask = RTW89_DBG_TXRX;
+		else
+			debug_mask = RTW89_DBG_UNEXP;
+
Quoted 9 lines

drivers/net/wireless/realtek/rtw89/pci.c static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev, · line 1010

Quoted 4 lines
drivers/net/wireless/realtek/rtw89/pci.c +2 -0
+		rtw89_debug(rtwdev, debug_mask,
 			    "still no tx resource after reclaim: wd_cnt=%d bd_cnt=%d\n",
 			    wd_cnt, bd_cnt);
+	}

Changing the debug mask like this looks a bit weird to me. At least it would be good to have a comment in the code explainin why this is done like this.

I will add a comment to figure out the reason.

Ping-Ke