ath9K驱动使用客户端模式连接热点,出现ctrl-event-beacon-loss异常,导致无线断流。
经搜索,发现此patch补丁可以修复此问题:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bddac7c1e02ba47f0570e494c9289acea3062cc1
但不适用于openwrt 19.06(kernel 4.14) ,经参照修改,在MT7621A架构下运行良好。将补丁文件保存到./target/linux/ramips/patches-4.14目录下,重新编译,即可生成打过补丁的固件。

--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -601,7 +601,7 @@
     for (i = 0; i < nslots; i++)
         io_tlb_orig_addr[index+i] = orig_addr + (i << IO_TLB_SHIFT);
     if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) &&
-        (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL))
+        (!(attrs & DMA_ATTR_OVERWRITE) || dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL))
         swiotlb_bounce(orig_addr, tlb_addr, size, DMA_TO_DEVICE);
 
     return tlb_addr;

 
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -70,6 +70,14 @@
  */
 #define DMA_ATTR_PRIVILEGED        (1UL << 9)
 
+ /*
+ * This is a hint to the DMA-mapping subsystem that the device is expected
+ * to overwrite the entire mapped size, thus the caller does not require any
+ * of the previous buffer contents to be preserved. This allows
+ * bounce-buffering implementations to optimise DMA_FROM_DEVICE transfers.
+ */
+#define DMA_ATTR_OVERWRITE        (1UL << 10)
+
 /*
  * A dma_addr_t can hold any valid DMA or bus address for the platform.
  * It can be given to a device to use as a DMA source or target.  A CPU cannot

下载地址:999-Revert-swiotlb-rework-DMA_FROM_DEVICE.zip

标签: ath9k, ctrl-event-beacon-loss

添加新评论