Hi,

i wish you would consider this:

diff --git a/sys/arch/arm/arm/cpufunc.c b/sys/arch/arm/arm/cpufunc.c
index 00c683e..924cf67 100644
--- a/sys/arch/arm/arm/cpufunc.c
+++ b/sys/arch/arm/arm/cpufunc.c
@@ -575,7 +575,6 @@ armv7_setup()
            | CPU_CONTROL_AFE;
 
        cpuctrl = CPU_CONTROL_MMU_ENABLE
-           | CPU_CONTROL_AFLT_ENABLE
            | CPU_CONTROL_DC_ENABLE
            | CPU_CONTROL_BPRD_ENABLE
            | CPU_CONTROL_IC_ENABLE;


(fwiw. also FreeBSD did ^above recently.)
Here is example of embarrassing code it would allow fixing:

diff --git a/sys/arch/armv7/sunxi/sxie.c b/sys/arch/armv7/sunxi/sxie.c
index ff607c1..fea695c 100644
--- a/sys/arch/armv7/sunxi/sxie.c
+++ b/sys/arch/armv7/sunxi/sxie.c
@@ -146,8 +146,6 @@
 #define SXIE_MAX_RXD           8
 #define SXIE_MAX_PKT_SIZE      ETHER_MAX_DIX_LEN
 
-#define SXIE_ROUNDUP(size, unit) (((size) + (unit) - 1) & ~((unit) - 1))
-
 struct sxie_softc {
        struct device                   sc_dev;
        struct arpcom                   sc_ac;
@@ -454,10 +452,7 @@ sxie_start(struct ifnet *ifp)
 {
        struct sxie_softc *sc = ifp->if_softc;
        struct mbuf *m;
-       struct mbuf *head;
-       uint8_t *td;
        uint32_t fifo;
-       uint32_t txbuf[SXIE_MAX_PKT_SIZE / sizeof(uint32_t)]; /* XXX !!! */
 
        if (sc->txf_inuse > 1)
                ifq_set_oactive(&ifp->if_snd);
@@ -465,9 +460,7 @@ sxie_start(struct ifnet *ifp)
        if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
                return;
 
-       td = (uint8_t *)&txbuf[0];
        m = NULL;
-       head = NULL;
 trynext:
        m = ifq_deq_begin(&ifp->if_snd);
        if (m == NULL)
@@ -496,11 +489,10 @@ trynext:
        /* set packet length */
        SXIWRITE4(sc, SXIE_TXPKTLEN0 + (fifo * 4), m->m_pkthdr.len);
 
-       /* copy the actual packet to fifo XXX through 'align buffer'.. */
-       m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)td);
+       /* write the actual packet to fifo */
        bus_space_write_multi_4(sc->sc_iot, sc->sc_ioh,
            SXIE_TXIO0 + (fifo * 4),
-           (uint32_t *)td, SXIE_ROUNDUP(m->m_pkthdr.len, 4) >> 2);
+           mtod(m, uint32_t *), (m->m_pkthdr.len + 3) >> 2);
 
        /* transmit to PHY from fifo */
        SXISET4(sc, SXIE_TXCR0 + (fifo * 4), 1);
@@ -564,8 +556,6 @@ sxie_recv(struct sxie_softc *sc)
        struct mbuf *m;
        uint16_t pktstat;
        int16_t pktlen;
-       int rlen;
-       char rxbuf[SXIE_MAX_PKT_SIZE]; /* XXX !!! */
 trynext:
        fbc = SXIREAD4(sc, SXIE_RXFBC);
        if (!fbc)
@@ -596,6 +586,9 @@ trynext:
 
        if (pktstat & SXIE_RX_ERRMASK || pktlen < ETHER_MIN_LEN) {
                ifp->if_ierrors++;
+               /* drain here to implicitly avoid the flushing above */
+               while (SXIREAD4(sc, SXIE_RXFBC) > 0 && pktlen-- > 0)
+                       reg = SXIREAD4(sc, SXIE_RXIO);  /* drain fifo */
                goto trynext;
        }
        if (pktlen > SXIE_MAX_PKT_SIZE)
@@ -605,14 +598,9 @@ trynext:
        /* XXX m->m_pkthdr.csum_flags ? */
        m_adj(m, ETHER_ALIGN);
 
-       /* read the actual packet from fifo XXX through 'align buffer'.. */
-       if (pktlen & 3)
-               rlen = SXIE_ROUNDUP(pktlen, 4);
-       else
-               rlen = pktlen;
+       /* read the actual packet from fifo */
        bus_space_read_multi_4(sc->sc_iot, sc->sc_ioh,
-           SXIE_RXIO, (uint32_t *)&rxbuf[0], rlen >> 2);
-       memcpy(mtod(m, char *), (char *)&rxbuf[0], pktlen);
+           SXIE_RXIO, mtod(m, uint32_t *), (pktlen + 3) >> 2);
 
        ml_enqueue(&ml, m);
        goto trynext;



-Artturi

Reply via email to