Skip to content

Commit a1504a2

Browse files
author
Ian Seyler
committed
i8259x - Check DD bit first
1 parent 0a45ad9 commit a1504a2

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/drivers/net/i8259x.asm

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ net_i8259x_reset_wait:
149149
;FDIRCTRL - Clear PBALLOC
150150
;SRRCTL[n].BSIZEPACKET field defines the data buffer size. Section 7.1.2
151151
;Aggregation - Section 7.1.7
152-
;Receive Coalescing (RSC) - Section 7.11.5.1
152+
;Receive Coalescing (RSC) - Section 7.11.5.1
153153

154154
; Wait for EEPROM auto read completion (4.6.3)
155155
mov eax, [rsi+i8259x_EEC] ; Read current value
@@ -486,18 +486,20 @@ net_i8259x_poll:
486486
mov eax, [rdx+nt_rx_head] ; Get rx_head
487487
shl eax, 4 ; Quick multiply by 16
488488
add rdi, rax ; Add offset to RX descriptor base
489-
mov rbx, [rdi] ; Load the buffer address (where the packet is)
490-
add rdi, 8 ; Offset to bytes received
491-
; Todo: Check Errors (Bits 47:40) should be clear
492-
mov rcx, [rdi] ; Get the packet length
489+
490+
; Check packet Status
491+
; Todo: Check Errors (Bits 47:40) - should be clear
492+
mov rcx, [rdi+8] ; Get the packet length
493493
bt rcx, 32 ; DD set?
494494
jnc net_i8259x_poll_end_nodata
495-
and ecx, 0x0000FFFF
495+
and ecx, 0x0000FFFF ; Keep bits 15:0 for the packet length
496496
; cmp cx, 0
497-
; je net_i8259x_poll_end_nodata ; No data? Bail out
497+
; je net_i8259x_poll_end_nodata ; No data? Bail out
498498

499+
; Load the buffer address and clear the status
499500
xor eax, eax
500-
mov [rdi], rax ; Clear the descriptor length and status
501+
mov rbx, [rdi] ; Load the buffer address (where the packet is)
502+
mov [rdi+8], rax ; Clear the descriptor length and status
501503
mov rdi, rbx ; Copy the buffer address to RDI
502504

503505
; Increment rx_head

0 commit comments

Comments
 (0)