Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Call bus_dmamap_unload(9) via ixgbe_dmamap...



details:   https://anonhg.NetBSD.org/src/rev/d71850e4e4a5
branches:  trunk
changeset: 379097:d71850e4e4a5
user:      rin <rin%NetBSD.org@localhost>
date:      Tue May 11 01:30:30 2021 +0000

description:
Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
DMA buffer. Also, when the buffer is already freed, do not call
bus_dmamap_unload(9) (no resource leaks with this change).

Otherwise, MMU fault occurs for some bus_dma(9) implementations.

With this fix, X550-T1 and X540-T1 work fine on alpha (at least
DS10 with PCI-PCIe reverse bridge).

Discussed with msaitoh. Thanks!

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 8d05a7f6646f -r d71850e4e4a5 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Tue May 11 01:27:45 2021 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Tue May 11 01:30:30 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.71 2021/04/30 06:55:32 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.72 2021/05/11 01:30:30 rin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.71 2021/04/30 06:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.72 2021/05/11 01:30:30 rin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1766,16 +1766,17 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
        if (rbuf->fmp != NULL) {/* Partial chain ? */
                bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
                    rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
+               ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
                m_freem(rbuf->fmp);
                rbuf->fmp = NULL;
                rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */
        } else if (rbuf->buf) {
                bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
                    rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
+               ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
                m_free(rbuf->buf);
                rbuf->buf = NULL;
        }
-       ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
 
        rbuf->flags = 0;
 



Home | Main Index | Thread Index | Old Index