From: Mark Kettenis Subject: Re: bounce buffer mbuf defrag To: Alexander Bluhm Cc: tech@openbsd.org Date: Thu, 29 Aug 2024 16:57:41 +0200 > Date: Wed, 28 Aug 2024 14:37:45 +0200 > From: Alexander Bluhm > > Hi, > > In my tests I have seen packet drops vio_encap() when using bounce > buffers. Some mbufs seem to be too fragmented for the pre allocated > bounce buffer pages. Calling m_defrag() fixes the problem. Hmm. How does this happen? Is this a case for which the function would have return EFBIG at the end in the non-bounce-buffer case? > ok? > > bluhm > > Index: arch/amd64/amd64/bus_dma.c > =================================================================== > RCS file: /data/mirror/openbsd/cvs/src/sys/arch/amd64/amd64/bus_dma.c,v > diff -u -p -r1.57 bus_dma.c > --- arch/amd64/amd64/bus_dma.c 22 Aug 2024 11:36:24 -0000 1.57 > +++ arch/amd64/amd64/bus_dma.c 27 Aug 2024 20:48:12 -0000 > @@ -726,7 +726,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, > > if (use_bounce_buffer) { > if (page >= map->_dm_npages) > - return (ENOMEM); > + return (EFBIG); > > off = vaddr & PAGE_MASK; > pg = map->_dm_pages[page]; > >