Module Name: src Committed By: mrg Date: Thu Oct 19 23:43:40 UTC 2023
Modified Files: src/sys/dev/pci: if_rge.c Log Message: rge: properly handle mbuf allocation failures in rx interrupts several changes that should fix crashes seen after an mbuf allocation failure: - create RX ring dma maps with BUS_DMA_ALLOCNOW, so that any future bus_dmamap_load*() call will succeed. this avoids one error case in rge_newbuf(), that similar cases in eg wm(4) actually call panic for now (i think this idea can be copied into wm(4) as well.) - extract the RX descriptor set into a common function that both rge_newbuf() and rge_rxeof() can both use. it's almost identical to the old rge_discard_rxbuf() except it also sets the rge_addr (this is needed for the newbuf case.) - move the bus_dmamap_unload() into rge_newbuf(), so that the existing mbuf will remain mapped until a new mbuf is allocated. (this part is what should fix crashes seen by wiz and Chavdar, as the unload follow by sync is what triggers the assert in x86 bus_dma. without the assert, it will would have shortly triggered a page fault.) remove the assignment to NULL for the rxq mbuf pointer, it is required for reload. - add a couple of missing if_statinc() calls. tested on amd64 and arm64. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/if_rge.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.