From f4f5e760cfa67d96fe6939c4d0ee0f23b930394e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdurrahman=20Kaan=20Dike=C3=A7?= Date: Mon, 5 Oct 2026 03:06:38 +0300 Subject: [PATCH] Wi-Fi: the fork's PCIe post-init, ARP and DNS on the data queue in AP mode, two idle messages gone From kanoqwq/mu300-linux: pcie_post_init() restores the static channel table its own error path sets to NULL (a later power-on passed &NULL[chn]); its unwind now undoes channels 0..chn-1 (it took the failed one and never 0). ARP and DNS from an AP go through the data queue instead of one firmware command each (the fork saw the command channel wedge under an ARP burst); the DNS return now comes before the software checksum, after review. "to free list empty" (720 lines in 36 minutes on an idle F50) is gone. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DqKKtBQZCfxYnHuBCuDqqn --- .../modules/sprd_wlan_combo/sc2355/pcie.c | 26 ++++++++----------- upstream/modules/sprd_wlan_combo/sc2355/tx.c | 17 ++++++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/upstream/modules/sprd_wlan_combo/sc2355/pcie.c b/upstream/modules/sprd_wlan_combo/sc2355/pcie.c index 5e4e2c6b..c6f11ee4 100644 --- a/upstream/modules/sprd_wlan_combo/sc2355/pcie.c +++ b/upstream/modules/sprd_wlan_combo/sc2355/pcie.c @@ -1911,7 +1911,6 @@ int sc2355_pcie_fc_get_send_num(struct sprd_hif *hif, { int free_num = 0; struct tx_mgmt *tx_mgmt = hif->tx_mgmt; - static unsigned long caller_jiffies; /*send all data in buff with PCIe interface*/ unsigned int tx_buf_max = get_max_fw_tx_dscr() > pcie_get_tx_buf_num() ? @@ -1922,12 +1921,6 @@ int sc2355_pcie_fc_get_send_num(struct sprd_hif *hif, return 0; free_num = atomic_read(&tx_mgmt->xmit_msg_list.free_num); - if (printk_timed_ratelimit(&caller_jiffies, 1000)) { - pr_debug("%s, free_num=%d, data_num=%d\n", __func__, - free_num, data_num); - if (list_empty(&tx_mgmt->xmit_msg_list.to_free_list)) - pr_info("%s: to free list empty\n", __func__); - } if ((free_num + data_num) >= tx_buf_max) { pr_debug("%s, free_num=%d, data_num=%d\n", __func__, @@ -1944,7 +1937,6 @@ int sc2355_pcie_fc_test_send_num(struct sprd_hif *hif, { int free_num = 0; struct tx_mgmt *tx_mgmt = hif->tx_mgmt; - static unsigned long caller_jiffies; /*send all data in buff with PCIe interface, TODO*/ unsigned int tx_buf_max = get_max_fw_tx_dscr() > pcie_get_tx_buf_num() ? @@ -1955,12 +1947,6 @@ int sc2355_pcie_fc_test_send_num(struct sprd_hif *hif, return 0; free_num = atomic_read(&tx_mgmt->xmit_msg_list.free_num); - if (printk_timed_ratelimit(&caller_jiffies, 1000)) { - pr_debug("%s,%d free_num=%d, data_num=%d\n", __func__, - __LINE__, free_num, data_num); - if (list_empty(&tx_mgmt->xmit_msg_list.to_free_list)) - pr_info("%s: to free list empty\n", __func__); - } if ((free_num + data_num) >= tx_buf_max) { pr_err("%s,%d free_num=%d, data_num=%d\n", @@ -2034,6 +2020,14 @@ int pcie_post_init(struct sprd_hif *hif) int ret = -EINVAL, chn = 0; sc2355_hif.hif = (void *)hif; + /* + * MU300 (from kanoqwq/mu300-linux): a failed/aborted earlier power cycle clears this pointer in the + * error path below. The vendor driver only restores it in pcie_init(), + * but a later WCN power-on may call post_init directly. Passing + * &NULL[0] to mchn_init then makes Wi-Fi permanently fail until reboot. + * The channel table is static, so make every post-init self-contained. + */ + sc2355_hif.mchn_ops = sc2355_pcie_hif_ops; sc2355_hif.max_num = sizeof(sc2355_pcie_hif_ops) / sizeof(struct mchn_ops_t); @@ -2055,7 +2049,9 @@ int pcie_post_init(struct sprd_hif *hif) err: pr_err("%s: unregister %d ops\n", __func__, sc2355_hif.max_num); - for (; chn > 0; chn--) + /* MU300: undo the channels that were set up, 0 .. chn-1 (the vendor loop took chn, which failed, and + * never 0) */ + while (chn-- > 0) sprdwcn_bus_chn_deinit(&sc2355_hif.mchn_ops[chn]); sc2355_hif.mchn_ops = NULL; sc2355_hif.max_num = 0; diff --git a/upstream/modules/sprd_wlan_combo/sc2355/tx.c b/upstream/modules/sprd_wlan_combo/sc2355/tx.c index 71b4809d..871bbc1a 100644 --- a/upstream/modules/sprd_wlan_combo/sc2355/tx.c +++ b/upstream/modules/sprd_wlan_combo/sc2355/tx.c @@ -1060,6 +1060,17 @@ static int tx_filter_ip_pkt(struct sk_buff *skb, struct net_device *ndev) /*as CP request, send data with CMD */ if (is_data2cmd) { + /* AP DNS is ordinary client traffic. The board NVM can leave + * special_data_flag outside its 0..2 enum (observed: 32); using + * CMD_TX_DATA for every DNS reply can wedge the firmware command + * queue and assert CP2. Keep DHCP and VoWiFi on their paths. + */ + if ((vif->mode == SPRD_MODE_AP || + vif->mode == SPRD_MODE_P2P_GO) && + (is_ipv4_dns || is_ipv6_dns) && + !is_ipv4_dhcp && !is_ipv6_dhcp && !is_vowifi2cmd) + return 1; + if (is_ipv4_dhcp || is_ipv6_dhcp) pr_info("dhcp,check:%x,skb->ip_summed:%d\n", udphdr->check, skb->ip_summed); @@ -2251,6 +2262,12 @@ int sprd_tx_filter_packet(struct sk_buff *skb, struct net_device *ndev) #endif if (ethhdr->h_proto == htons(ETH_P_ARP)) { + /* ARP replies from an AP must use the regular data queue. Sending + * them one by one through CMD_TX_DATA exhausts the command channel + * under an ARP burst and can leave WCN stuck in carddump status. + */ + if (vif->mode == SPRD_MODE_AP || vif->mode == SPRD_MODE_P2P_GO) + return 1; pr_info("incoming ARP packet\n"); spin_lock_bh(&adap_info.adap_lock);