Download raw body.
Intel AX210 DMA memory allocation fails
On my RK3588 board with an Intel AX210 wifi card I reliably get:
iwx0: could not allocate DMA memory for firmware image loader
iwx0: could not init context info
iwx0: failed to load init firmware
iwx0: could not allocate context info DMA memory
iwx0: could not init context info
iwx0: failed to load init firmware
Retrying to allocate the memory works and the error does not show up any
more. Another way to fix this would be look at the state of the wifi
connection after boot and retry in e.g. /etc/rc.local with some logic.
diff --git sys/dev/pci/if_iwx.c sys/dev/pci/if_iwx.c
index 2bf28bd4480..7c2ac7e9af6 100644
--- sys/dev/pci/if_iwx.c
+++ sys/dev/pci/if_iwx.c
@@ -143,6 +143,9 @@ int iwx_debug = 1;
#define DPRINTFN(n, x) do { ; } while (0)
#endif
+#define IWX_DMA_RETRY_MAX 100
+#define IWX_DMA_RETRY_DELAY 10000 /* usec (10ms) */
+
#include <dev/pci/if_iwxreg.h>
#include <dev/pci/if_iwxvar.h>
@@ -1869,9 +1872,10 @@ int
iwx_dma_contig_alloc(bus_dma_tag_t tag, struct iwx_dma_info *dma,
bus_size_t size, bus_size_t alignment)
{
- int nsegs, err;
+ int nsegs, err, retry = 0;
caddr_t va;
+again:
dma->tag = tag;
dma->size = size;
@@ -1907,6 +1911,10 @@ iwx_dma_contig_alloc(bus_dma_tag_t tag, struct iwx_dma_info *dma,
return 0;
fail: iwx_dma_contig_free(dma);
+ if (err == ENOMEM && retry++ < IWX_DMA_RETRY_MAX) {
+ DELAY(IWX_DMA_RETRY_DELAY);
+ goto again;
+ }
return err;
}
Intel AX210 DMA memory allocation fails