Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/marvell Correct byte-order for bufsize field of RX d...



details:   https://anonhg.NetBSD.org/src/rev/0e91bfe5d975
branches:  trunk
changeset: 366269:0e91bfe5d975
user:      rin <rin%NetBSD.org@localhost>
date:      Sat May 21 10:33:05 2022 +0000

description:
Correct byte-order for bufsize field of RX descriptor.

XXX
This bug affected only armeb. Unfortunately, the systems including
armel still lock up eventually with NFS root on mvgbe(4)...

diffstat:

 sys/dev/marvell/if_mvgbe.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (51 lines):

diff -r 1c742685bdd7 -r 0e91bfe5d975 sys/dev/marvell/if_mvgbe.c
--- a/sys/dev/marvell/if_mvgbe.c        Sat May 21 10:27:30 2022 +0000
+++ b/sys/dev/marvell/if_mvgbe.c        Sat May 21 10:33:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin Exp $        */
+/*     $NetBSD: if_mvgbe.c,v 1.66 2022/05/21 10:33:05 rin Exp $        */
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.66 2022/05/21 10:33:05 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1587,6 +1587,7 @@
        struct mvgbe_rx_desc *r;
        int align;
        vaddr_t offset;
+       uint16_t bufsize;
 
        if (m == NULL) {
                void *buf = NULL;
@@ -1631,12 +1632,13 @@
        c->mvgbe_mbuf = m_new;
        offset = (vaddr_t)m_new->m_data - (vaddr_t)sc->sc_cdata.mvgbe_jumbo_buf;
        r->bufptr = H2MVGBE32(dmamap->dm_segs[0].ds_addr + offset);
-       r->bufsize = MVGBE_JLEN & ~MVGBE_RXBUF_MASK;
+       bufsize = MVGBE_JLEN & ~MVGBE_RXBUF_MASK;
+       r->bufsize = H2MVGBE16(bufsize);
        r->cmdsts =
            H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_RX_ENABLE_INTERRUPT);
 
        /* Invalidate RX buffer */
-       bus_dmamap_sync(sc->sc_dmat, dmamap, offset, r->bufsize,
+       bus_dmamap_sync(sc->sc_dmat, dmamap, offset, bufsize,
            BUS_DMASYNC_PREREAD);
 
        MVGBE_CDRXSYNC(sc, i, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -1991,7 +1993,7 @@
                m = cdata->mvgbe_rx_chain[idx].mvgbe_mbuf;
                cdata->mvgbe_rx_chain[idx].mvgbe_mbuf = NULL;
                total_len = MVGBE2H16(cur_rx->bytecnt) - ETHER_CRC_LEN;
-               bufsize = cur_rx->bufsize;
+               bufsize = MVGBE2H16(cur_rx->bufsize);
 
                cdata->mvgbe_rx_map[idx] = NULL;
 



Home | Main Index | Thread Index | Old Index