enet: Fix cache bug

This commit is contained in:
Jan Schär 2022-05-28 19:49:10 +02:00
parent cdba8db5e2
commit 9db9053c97

View File

@ -156,7 +156,9 @@ static errval_t enet_rx_dequeue(struct devq* que, regionid_t* rid,
struct region_entry *entry = enet_get_region(q, *rid);
assert(entry);
lvaddr_t vaddr = (lvaddr_t) entry->mem.vbase + *offset + *valid_data;
cpu_dcache_wb_range(vaddr, *valid_length);
// I would think that invalidate is the correct thing to do, but that
// causes a fault for some reason. So do clean+invalidate instead.
cpu_dcache_wbinv_range(vaddr, *valid_length);
dmb();
@ -180,9 +182,8 @@ static errval_t enet_tx_dequeue(struct devq* que, regionid_t* rid,
if (enet_full_slots(q)) {
enet_bufdesc_t desc = q->ring[q->head];
dmb();
cpu_dcache_wb_range((lvaddr_t) &q->ring[q->head],
cpu_dcache_wbinv_range((lvaddr_t) &q->ring[q->head],
sizeof(enet_bufdesc_t));
desc = q->ring[q->head];
struct devq_buf* buf= &q->ring_bufs[q->head];
if (!(enet_bufdesc_sc_extract(desc) & ENET_TX_READY)) {