diff mbox series

[v2,2/3] wifi: rtw88: Handle C2H_ADAPTIVITY in rtw_fw_c2h_cmd_handle()

Message ID 96e52b03-be8d-4050-ae71-bfdb478ff42f@gmail.com (mailing list archive)
State New
Delegated to: Ping-Ke Shih
Headers show
Series [v2,1/3] wifi: rtw88: usb: Copy instead of cloning the RX skb | expand

Commit Message

Bitterblue Smith Dec. 18, 2024, 10:34 p.m. UTC
The firmware message C2H_ADAPTIVITY is currently handled in
rtw_fw_c2h_cmd_rx_irqsafe(), which runs in the RX workqueue, but it's
not "irqsafe" with USB because it sleeps (reads hardware registers).
This becomes a problem after the next patch, which will create the RX
workqueue with the flag WQ_BH.

To avoid sleeping when it's not allowed, handle C2H_ADAPTIVITY in
rtw_fw_c2h_cmd_handle(), which runs in the c2h workqueue.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
 - Patch is new in v2.
---
 drivers/net/wireless/realtek/rtw88/fw.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Ping-Ke Shih Dec. 19, 2024, 6:19 a.m. UTC | #1
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> The firmware message C2H_ADAPTIVITY is currently handled in
> rtw_fw_c2h_cmd_rx_irqsafe(), which runs in the RX workqueue, but it's
> not "irqsafe" with USB because it sleeps (reads hardware registers).
> This becomes a problem after the next patch, which will create the RX
> workqueue with the flag WQ_BH.
> 
> To avoid sleeping when it's not allowed, handle C2H_ADAPTIVITY in
> rtw_fw_c2h_cmd_handle(), which runs in the c2h workqueue.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index e6e9946fbf44..02389b7c6876 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -332,6 +332,9 @@  void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb)
 	case C2H_RA_RPT:
 		rtw_fw_ra_report_handle(rtwdev, c2h->payload, len);
 		break;
+	case C2H_ADAPTIVITY:
+		rtw_fw_adaptivity_result(rtwdev, c2h->payload, len);
+		break;
 	default:
 		rtw_dbg(rtwdev, RTW_DBG_FW, "C2H 0x%x isn't handled\n", c2h->id);
 		break;
@@ -367,10 +370,6 @@  void rtw_fw_c2h_cmd_rx_irqsafe(struct rtw_dev *rtwdev, u32 pkt_offset,
 		rtw_fw_scan_result(rtwdev, c2h->payload, len);
 		dev_kfree_skb_any(skb);
 		break;
-	case C2H_ADAPTIVITY:
-		rtw_fw_adaptivity_result(rtwdev, c2h->payload, len);
-		dev_kfree_skb_any(skb);
-		break;
 	default:
 		/* pass offset for further operation */
 		*((u32 *)skb->cb) = pkt_offset;