summaryrefslogtreecommitdiffstats
path: root/rtemsbsd
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-14 13:33:34 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-21 10:29:43 +0200
commit610349693dd31d8b0efd33776516b7187cc5cda2 (patch)
treecfe2af89b00de1cc629da911a868aff19da23c2c /rtemsbsd
parentif_ffec_mpc8xx: Use M_NOWAIT for incoming frames (diff)
downloadrtems-libbsd-610349693dd31d8b0efd33776516b7187cc5cda2.tar.bz2
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.
Diffstat (limited to 'rtemsbsd')
-rw-r--r--rtemsbsd/sys/dev/ffec/if_ffec_mpc8xx.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/rtemsbsd/sys/dev/ffec/if_ffec_mpc8xx.c b/rtemsbsd/sys/dev/ffec/if_ffec_mpc8xx.c
index a9d5eb46..bf204609 100644
--- a/rtemsbsd/sys/dev/ffec/if_ffec_mpc8xx.c
+++ b/rtemsbsd/sys/dev/ffec/if_ffec_mpc8xx.c
@@ -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 *);