if_ffec_mpc8xx: Fix incoming data invalidation

With a write-back cache dirty cache lines may be evicted which could
overwrite new data.

Close #3523.
This commit is contained in:
Sebastian Huber
2018-09-14 13:33:34 +02:00
parent 1b70957bd1
commit 610349693d

View File

@@ -521,6 +521,7 @@ static void fec_rxDaemon (void *arg)
rxBd = sc->rxBdBase + rxBdIndex;
m = m_getcl(M_WAITOK, MT_DATA, M_PKTHDR);
m->m_pkthdr.rcvif = ifp;
rtems_cache_invalidate_multiple_data_lines(mtod(m, void *), RBUF_SIZE);
sc->rxMbuf[rxBdIndex] = m;
rxBd->buffer = mtod (m, void *);
rxBd->status = M8xx_BD_EMPTY;
@@ -578,19 +579,15 @@ static void fec_rxDaemon (void *arg)
if (n != NULL) {
/*
* Pass the packet up the chain.
* FIXME: Packet filtering hook could be done here.
*/
/*
* Invalidate the buffer for this descriptor
*/
rtems_cache_invalidate_multiple_data_lines(rxBd->buffer, rxBd->length);
m = sc->rxMbuf[rxBdIndex];
m->m_len = m->m_pkthdr.len = rxBd->length - ETHER_CRC_LEN;
FEC_UNLOCK(sc);
(*sc->ifp->if_input)(sc->ifp, m);
FEC_LOCK(sc);
n->m_pkthdr.rcvif = ifp;
rtems_cache_invalidate_multiple_data_lines(mtod(n, void *), RBUF_SIZE);
} else {
/* Drop incoming frame if no new mbuf is available */
n = m;
@@ -618,7 +615,6 @@ static void fec_rxDaemon (void *arg)
sc->rxCollision++;
}
n->m_pkthdr.rcvif = ifp;
sc->rxMbuf[rxBdIndex] = n;
rxBd->buffer = mtod (n, void *);