ixl(4)/ixlv(4): Stop leaking every busdma entry in receive path

From Brett:

In short, busdma maps for received packets were not being unloaded in the
interrupt handler before the packets were passed up the network stack. The fix
was to add a busdma sync and unload for the two receive maps.

This bug is significant for certain busdma providers, for example IOMMUs,
where not unloading the maps means that 1) the IOMMU mappings that allow the
NIC to DMA the received packets into host memory stay open indefinitely,
potentially violating a desired security policy, and 2) resources such as
device address space addresses and host memory for bookkeeping are never freed.

Without an IOMMU or bounce buffering enabled for the ixl device, I don't think
adding these calls will have any significant performance impact. With the
IOMMU enabled, I have noticed a performance impact on the receive side, which
is expected.

Submitted by:	Brett Gutstein <bgutstein@rice.edu>
Reviewed by:	erj@
MFC after:	1 week
This commit is contained in:
erj 2017-07-13 22:12:41 +00:00
parent 5b63bcfc62
commit 922a5bb1f3

View File

@ -1578,6 +1578,18 @@ ixl_rxeof(struct ixl_queue *que, int count)
else
vtag = 0;
/* Remove device access to the rx buffers. */
if (rbuf->m_head != NULL) {
bus_dmamap_sync(rxr->htag, rbuf->hmap,
BUS_DMASYNC_POSTREAD);
bus_dmamap_unload(rxr->htag, rbuf->hmap);
}
if (rbuf->m_pack != NULL) {
bus_dmamap_sync(rxr->ptag, rbuf->pmap,
BUS_DMASYNC_POSTREAD);
bus_dmamap_unload(rxr->ptag, rbuf->pmap);
}
/*
** Make sure bad packets are discarded,
** note that only EOP descriptor has valid