[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/23] dp8393x: Update LLFA and CRDA registers from rx descriptor
From: |
Jason Wang |
Subject: |
[PULL 05/23] dp8393x: Update LLFA and CRDA registers from rx descriptor |
Date: |
Mon, 2 Mar 2020 15:40:18 +0800 |
From: Finn Thain <address@hidden>
Follow the algorithm given in the National Semiconductor DP83932C
datasheet in section 3.4.7:
At the next reception, the SONIC re-reads the last RXpkt.link field,
and updates its CRDA register to point to the next descriptor.
The chip is designed to allow the host to provide a new list of
descriptors in this way.
Signed-off-by: Finn Thain <address@hidden>
Tested-by: Laurent Vivier <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
hw/net/dp8393x.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index ed57f5f..9604623 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -786,12 +786,13 @@ static ssize_t dp8393x_receive(NetClientState *nc, const
uint8_t * buf,
address = dp8393x_crda(s) + sizeof(uint16_t) * 5 * width;
address_space_read(&s->as, address, MEMTXATTRS_UNSPECIFIED,
s->data, size);
- if (dp8393x_get(s, width, 0) & SONIC_DESC_EOL) {
+ s->regs[SONIC_LLFA] = dp8393x_get(s, width, 0);
+ if (s->regs[SONIC_LLFA] & SONIC_DESC_EOL) {
/* Still EOL ; stop reception */
return -1;
- } else {
- s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA];
}
+ /* Link has been updated by host */
+ s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA];
}
/* Save current position */
@@ -840,7 +841,7 @@ static ssize_t dp8393x_receive(NetClientState *nc, const
uint8_t * buf,
MEMTXATTRS_UNSPECIFIED,
s->data, size);
- /* Move to next descriptor */
+ /* Check link field */
size = sizeof(uint16_t) * width;
address_space_read(&s->as,
dp8393x_crda(s) + sizeof(uint16_t) * 5 * width,
@@ -856,6 +857,8 @@ static ssize_t dp8393x_receive(NetClientState *nc, const
uint8_t * buf,
dp8393x_put(s, width, 0, 0);
address_space_write(&s->as, address, MEMTXATTRS_UNSPECIFIED,
s->data, size);
+
+ /* Move to next descriptor */
s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA];
s->regs[SONIC_ISR] |= SONIC_ISR_PKTRX;
s->regs[SONIC_RSC] = (s->regs[SONIC_RSC] & 0xff00) |
(((s->regs[SONIC_RSC] & 0x00ff) + 1) & 0x00ff);
--
2.5.0
- [PULL 00/23] Net patches, Jason Wang, 2020/03/02
- [PULL 00/23] Net patches, Jason Wang, 2020/03/02
- [PULL 01/23] dp8393x: Mask EOL bit from descriptor addresses, Jason Wang, 2020/03/02
- [PULL 03/23] dp8393x: Clean up endianness hacks, Jason Wang, 2020/03/02
- [PULL 02/23] dp8393x: Always use 32-bit accesses, Jason Wang, 2020/03/02
- [PULL 07/23] dp8393x: Implement packet size limit and RBAE interrupt, Jason Wang, 2020/03/02
- [PULL 04/23] dp8393x: Have dp8393x_receive() return the packet size, Jason Wang, 2020/03/02
- [PULL 05/23] dp8393x: Update LLFA and CRDA registers from rx descriptor,
Jason Wang <=
- [PULL 08/23] dp8393x: Don't clobber packet checksum, Jason Wang, 2020/03/02
- [PULL 06/23] dp8393x: Clear RRRA command register bit only when appropriate, Jason Wang, 2020/03/02
- [PULL 11/23] dp8393x: Clear descriptor in_use field to release packet, Jason Wang, 2020/03/02
- [PULL 10/23] dp8393x: Pad frames to word or long word boundary, Jason Wang, 2020/03/02
- [PULL 13/23] dp8393x: Don't reset Silicon Revision register, Jason Wang, 2020/03/02
- [PULL 16/23] NetRxPkt: Introduce support for additional hash types, Jason Wang, 2020/03/02
- [PULL 18/23] hw: net: cadence_gem: Fix build errors in DB_PRINT(), Jason Wang, 2020/03/02
- [PULL 09/23] dp8393x: Use long-word-aligned RRA pointers in 32-bit mode, Jason Wang, 2020/03/02
- [PULL 15/23] e1000e: Avoid hw_error if legacy mode used, Jason Wang, 2020/03/02
- [PULL 14/23] dp8393x: Don't stop reception upon RBE interrupt assertion, Jason Wang, 2020/03/02