[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/14] dp8393x: Clear descriptor in_use field to release packe
From: |
Finn Thain |
Subject: |
[PATCH v3 11/14] dp8393x: Clear descriptor in_use field to release packet |
Date: |
Mon, 20 Jan 2020 09:59:21 +1100 |
When the SONIC receives a packet into the last available descriptor, it
retains ownership of that descriptor for as long as necessary.
Section 3.4.7 of the datasheet says,
When the system appends more descriptors, the SONIC releases ownership
of the descriptor after writing 0000h to the RXpkt.in_use field.
The packet can now be processed by the host, so raise a PKTRX interrupt,
just like the normal case.
Signed-off-by: Finn Thain <address@hidden>
Tested-by: Laurent Vivier <address@hidden>
---
Changed since v2:
- Assert PKTRX interrupt when releasing withheld packet.
---
hw/net/dp8393x.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 13513986f0..99c5dad7c4 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -809,7 +809,17 @@ static ssize_t dp8393x_receive(NetClientState *nc, const
uint8_t * buf,
return -1;
}
/* Link has been updated by host */
+
+ /* Clear in_use */
+ size = sizeof(uint16_t) * width;
+ address = dp8393x_crda(s) + sizeof(uint16_t) * 6 * width;
+ dp8393x_put(s, width, 0, 0);
+ address_space_rw(&s->as, address, MEMTXATTRS_UNSPECIFIED,
+ (uint8_t *)s->data, size, 1);
+
+ /* Move to next descriptor */
s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA];
+ s->regs[SONIC_ISR] |= SONIC_ISR_PKTRX;
}
/* Save current position */
--
2.24.1
- [PATCH v3 00/14] Fixes for DP8393X SONIC device emulation, Finn Thain, 2020/01/19
- [PATCH v3 07/14] dp8393x: Implement packet size limit and RBAE interrupt, Finn Thain, 2020/01/19
- [PATCH v3 11/14] dp8393x: Clear descriptor in_use field to release packet,
Finn Thain <=
- [PATCH v3 01/14] dp8393x: Mask EOL bit from descriptor addresses, Finn Thain, 2020/01/19
- [PATCH v3 06/14] dp8393x: Clear RRRA command register bit only when appropriate, Finn Thain, 2020/01/19
- [PATCH v3 04/14] dp8393x: Have dp8393x_receive() return the packet size, Finn Thain, 2020/01/19
- [PATCH v3 02/14] dp8393x: Always use 32-bit accesses, Finn Thain, 2020/01/19
- [PATCH v3 08/14] dp8393x: Don't clobber packet checksum, Finn Thain, 2020/01/19
- [PATCH v3 05/14] dp8393x: Update LLFA and CRDA registers from rx descriptor, Finn Thain, 2020/01/19