Skip to content

Commit 1b6dd7d

Browse files
author
Ian Seyler
committed
Move packet/byte counter to b_net_tx and b_net_rx
1 parent a4b26ca commit 1b6dd7d

File tree

4 files changed

+13
-29
lines changed

4 files changed

+13
-29
lines changed

src/drivers/net/i8254x.asm

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ net_i8254x_reset_nextdesc:
215215

216216

217217
; -----------------------------------------------------------------------------
218-
; net_i8254x_config -
218+
; net_i8254x_config -
219219
; IN: RAX = Base address to store packets
220220
; RDX = Interface ID
221221
; OUT: Nothing
@@ -289,10 +289,6 @@ net_i8254x_transmit:
289289
mov rdi, [rdx+nt_base] ; Load the base MMIO of the NIC
290290
mov [rdi+i8254x_TDT], eax ; TDL - Transmit Descriptor Tail
291291

292-
; Increment interface counters
293-
inc qword [rdx+nt_tx_packets]
294-
add qword [rdx+nt_tx_bytes], rcx
295-
296292
pop rax
297293
pop rdi
298294
ret
@@ -348,10 +344,6 @@ net_i8254x_poll:
348344
and eax, i8254x_MAX_DESC - 1
349345
mov [rsi+i8254x_RDT], eax ; Write the updated Receive Descriptor Tail
350346

351-
; Increment interface counters
352-
inc qword [rdx+nt_rx_packets]
353-
add qword [rdx+nt_rx_bytes], rcx
354-
355347
net_i8254x_poll_end:
356348
pop rax
357349
pop rbx

src/drivers/net/i8257x.asm

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ net_i8257x_init_reset_wait:
162162
shl eax, 15
163163
mov rdi, os_rx_desc
164164
add rdi, rax
165-
net_i8257x_reset_nextdesc:
165+
net_i8257x_reset_nextdesc:
166166
mov rax, os_PacketBuffers ; Default packet will go here
167167
stosq
168168
xor eax, eax
@@ -217,7 +217,7 @@ net_i8257x_reset_nextdesc:
217217

218218

219219
; -----------------------------------------------------------------------------
220-
; net_i8257x_config -
220+
; net_i8257x_config -
221221
; IN: RAX = Base address to store packets
222222
; RDX = Interface ID
223223
; OUT: Nothing
@@ -291,10 +291,6 @@ net_i8257x_transmit:
291291
mov rdi, [rdx+nt_base] ; Load the base MMIO of the NIC
292292
mov [rdi+i8257x_TDT], eax ; TDL - Transmit Descriptor Tail
293293

294-
; Increment interface counters
295-
inc qword [rdx+nt_tx_packets]
296-
add qword [rdx+nt_tx_bytes], rcx
297-
298294
pop rax
299295
pop rdi
300296
ret
@@ -350,10 +346,6 @@ net_i8257x_poll:
350346
and eax, i8257x_MAX_DESC - 1
351347
mov [rsi+i8257x_RDT], eax ; Write the updated Receive Descriptor Tail
352348

353-
; Increment interface counters
354-
inc qword [rdx+nt_rx_packets]
355-
add qword [rdx+nt_rx_bytes], rcx
356-
357349
net_i8257x_poll_end:
358350
pop rax
359351
pop rbx

src/drivers/net/i8259x.asm

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ net_i8259x_reset_dma_wait:
188188
shl eax, 15
189189
mov rdi, os_rx_desc
190190
add rdi, rax
191-
net_i8259x_reset_nextdesc:
191+
net_i8259x_reset_nextdesc:
192192
mov rax, os_PacketBuffers ; Default packet will go here
193193
stosq
194194
xor eax, eax
@@ -377,7 +377,7 @@ net_i8259x_init_tx_enable_wait:
377377

378378

379379
; -----------------------------------------------------------------------------
380-
; net_i8259x_config -
380+
; net_i8259x_config -
381381
; IN: RAX = Base address to store packets
382382
; RDX = Interface ID
383383
; OUT: Nothing
@@ -445,10 +445,6 @@ 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-
452448
pop rax
453449
pop rdi
454450
ret
@@ -499,10 +495,6 @@ net_i8259x_poll:
499495
and eax, i8259x_MAX_DESC - 1
500496
mov [rsi+i8259x_RDT], eax ; Write the updated Receive Descriptor Tail
501497

502-
; Increment interface counters
503-
inc qword [rdx+nt_rx_packets]
504-
add qword [rdx+nt_rx_bytes], rcx
505-
506498
net_i8259x_poll_end:
507499
pop rax
508500
pop rbx

src/syscalls/net.asm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ b_net_tx_maxcheck:
103103
add rax, nt_lock
104104
call b_smp_unlock
105105

106+
; Increment interface counters
107+
inc qword [rdx+nt_tx_packets]
108+
add qword [rdx+nt_tx_bytes], rcx
109+
106110
b_net_tx_fail:
107111
pop rax
108112
pop rcx
@@ -134,6 +138,10 @@ b_net_rx:
134138
; Call the driver poll function
135139
call [rdx+nt_poll] ; Call driver poll function passing RDX as interface
136140

141+
; Increment interface counters
142+
inc qword [rdx+nt_rx_packets]
143+
add qword [rdx+nt_rx_bytes], rcx
144+
137145
b_net_rx_end:
138146
pop rdx
139147
ret

0 commit comments

Comments
 (0)