From 227f0aaf14844d951375cdf7ca81f98315222ca0 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 17 Aug 2022 15:16:26 +0200 Subject: amd64/rtl8139: expose CRC when reading packets --- src/kernel/arch/amd64/driver/rtl8139.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/kernel/arch/amd64/driver/rtl8139.c') diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c index d9e5af0..3f6d07f 100644 --- a/src/kernel/arch/amd64/driver/rtl8139.c +++ b/src/kernel/arch/amd64/driver/rtl8139.c @@ -92,7 +92,7 @@ void rtl8139_irq(void) { } static int try_rx(struct pagedir *pages, void __user *dest, size_t dlen) { - uint16_t flags, size, pktsize; + uint16_t flags, size; /* bit 0 - Rx Buffer Empty */ if (port_in8(iobase + CMD) & 1) return -1; @@ -107,17 +107,16 @@ static int try_rx(struct pagedir *pages, void __user *dest, size_t dlen) { size = *(uint16_t*)(rxbuf + rxpos); rxpos += 2; if (size == 0) panic_invalid_state(); - pktsize = size - 4; // kprintf("packet size 0x%x, flags 0x%x, rxpos %x\n", size, flags, rxpos - 4); - virt_cpy_to(pages, dest, rxbuf + rxpos, pktsize); + virt_cpy_to(pages, dest, rxbuf + rxpos, size); rxpos += size; rxpos = (rxpos + 3) & ~3; while (rxpos >= rxbuf_baselen) rxpos -= rxbuf_baselen; /* the device adds the 0x10 back, it's supposed to avoid overflow */ port_out16(iobase + CAPR, rxpos - 0x10); - return pktsize; + return size; } static void accept(struct vfs_request *req) { -- cgit v1.2.3