Skip to content

Commit 1654010

Browse files
author
Ian Seyler
committed
Remove branch in b_net_rx
1 parent e6358ca commit 1654010

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/drivers/net/i8259x.asm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ net_i8259x_init_rx_enable_wait:
268268
jnc net_i8259x_init_rx_enable_wait
269269
xor eax, eax
270270
mov [rsi+i8259x_RDH], eax
271-
mov eax, i8259x_MAX_DESC - 1
271+
mov eax, i8259x_MAX_DESC / 2
272272
mov [rsi+i8259x_RDT], eax
273273

274274
; ; Set SECRXCTRL_RX_DIS
@@ -445,6 +445,10 @@ net_i8259x_transmit:
445445

446446
; TDESC.STA.DD (bit 32) should be 1 once the hardware has sent the packet
447447

448+
; Increment interface counters
449+
inc qword [rdx+nt_tx_packets]
450+
add qword [rdx+nt_tx_bytes], rcx
451+
448452
pop rax
449453
pop rdi
450454
ret
@@ -495,6 +499,10 @@ net_i8259x_poll:
495499
and eax, i8259x_MAX_DESC - 1
496500
mov [rsi+i8259x_RDT], eax ; Write the updated Receive Descriptor Tail
497501

502+
; Increment interface counters
503+
inc qword [rdx+nt_rx_packets]
504+
add qword [rdx+nt_rx_bytes], rcx
505+
498506
net_i8259x_poll_end:
499507
pop rax
500508
pop rbx

src/syscalls/net.asm

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ b_net_tx_maxcheck:
9898
; Call the driver transmit function
9999
call [rdx+nt_transmit] ; Call driver transmit function passing RDX as interface
100100

101-
; Increment interface counters
102-
inc qword [rdx+nt_tx_packets]
103-
add qword [rdx+nt_tx_bytes], rcx
104-
105101
; Unlock the network interface
106102
mov rax, rdx
107103
add rax, nt_lock
@@ -138,13 +134,6 @@ b_net_rx:
138134
; Call the driver poll function
139135
call [rdx+nt_poll] ; Call driver poll function passing RDX as interface
140136

141-
cmp cx, 0
142-
je b_net_rx_end
143-
144-
; Increment interface counters
145-
inc qword [rdx+nt_rx_packets]
146-
add qword [rdx+nt_rx_bytes], rcx
147-
148137
b_net_rx_end:
149138
pop rdx
150139
ret

0 commit comments

Comments
 (0)