summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver/rtl8139.c
diff options
context:
space:
mode:
authordzwdz2022-08-17 15:16:26 +0200
committerdzwdz2022-08-17 15:16:26 +0200
commit227f0aaf14844d951375cdf7ca81f98315222ca0 (patch)
tree631a1f43b20458ae3d91ea591c95ce3a25eae926 /src/kernel/arch/amd64/driver/rtl8139.c
parent5eabc4872ecd883feb80b6517e0fd137fa702cc1 (diff)
amd64/rtl8139: expose CRC when reading packets
Diffstat (limited to 'src/kernel/arch/amd64/driver/rtl8139.c')
-rw-r--r--src/kernel/arch/amd64/driver/rtl8139.c7
1 files changed, 3 insertions, 4 deletions
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) {