forked from KolibriOS/kolibrios
Network device error/missed/dropped packet counters.
+ Network buffer sanity checks. git-svn-id: svn://kolibrios.org@9017 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
88929629d3
commit
e32ea5d3c8
@ -4615,6 +4615,84 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
|||||||
eax - SF_NETWORK_GET (74)
|
eax - SF_NETWORK_GET (74)
|
||||||
bl - SSF_LINK_STATUS (10)
|
bl - SSF_LINK_STATUS (10)
|
||||||
======================================================================
|
======================================================================
|
||||||
|
==== Function 74, Subfunction 11, Get TX error packets counter. ======
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 11 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of erroneous packets received since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_TX_PACKET_ERROR_COUNT (11)
|
||||||
|
======================================================================
|
||||||
|
=== Function 74, Subfunction 12, Get TX dropped packets counter. =====
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 12 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of dropped packets since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_TX_PACKET_DROP_COUNT (12)
|
||||||
|
======================================================================
|
||||||
|
==== Function 74, Subfunction 13, Get TX missed packets counter. =====
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 13 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of missed packets since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_TX_PACKET_MISS_COUNT (13)
|
||||||
|
======================================================================
|
||||||
|
==== Function 74, Subfunction 14, Get RX error packets counter. ======
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 14 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of erroneous packets received since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_RX_PACKET_ERROR_COUNT (14)
|
||||||
|
======================================================================
|
||||||
|
=== Function 74, Subfunction 15, Get RX dropped packets counter. =====
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 15 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of dropped packets since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_RX_PACKET_DROP_COUNT (12)
|
||||||
|
======================================================================
|
||||||
|
==== Function 74, Subfunction 16, Get RX missed packets counter. =====
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 16 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of missed packets since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_RX_PACKET_MISS_COUNT (16)
|
||||||
|
======================================================================
|
||||||
============== Функция 75, подфункция 0, Открыть сокет. ==============
|
============== Функция 75, подфункция 0, Открыть сокет. ==============
|
||||||
======================================================================
|
======================================================================
|
||||||
Параметры:
|
Параметры:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@ -4590,6 +4590,84 @@ Returned value:
|
|||||||
eax - SF_NETWORK_GET (74)
|
eax - SF_NETWORK_GET (74)
|
||||||
bl - SSF_LINK_STATUS (10)
|
bl - SSF_LINK_STATUS (10)
|
||||||
======================================================================
|
======================================================================
|
||||||
|
==== Function 74, Subfunction 11, Get TX error packets counter. ======
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 11 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of erroneous packets received since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_TX_PACKET_ERROR_COUNT (11)
|
||||||
|
======================================================================
|
||||||
|
=== Function 74, Subfunction 12, Get TX dropped packets counter. =====
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 12 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of dropped packets since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_TX_PACKET_DROP_COUNT (12)
|
||||||
|
======================================================================
|
||||||
|
==== Function 74, Subfunction 13, Get TX missed packets counter. =====
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 13 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of missed packets since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_TX_PACKET_MISS_COUNT (13)
|
||||||
|
======================================================================
|
||||||
|
==== Function 74, Subfunction 14, Get RX error packets counter. ======
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 14 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of erroneous packets received since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_RX_PACKET_ERROR_COUNT (14)
|
||||||
|
======================================================================
|
||||||
|
=== Function 74, Subfunction 15, Get RX dropped packets counter. =====
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 15 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of dropped packets since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_RX_PACKET_DROP_COUNT (12)
|
||||||
|
======================================================================
|
||||||
|
==== Function 74, Subfunction 16, Get RX missed packets counter. =====
|
||||||
|
======================================================================
|
||||||
|
Parameters:
|
||||||
|
* eax = 74 - function number
|
||||||
|
* bl = 16 - subfunction number
|
||||||
|
* bh = device number
|
||||||
|
Returned value:
|
||||||
|
* eax = Number of missed packets since device start, -1 on error
|
||||||
|
|
||||||
|
---------------------- Constants for registers: ----------------------
|
||||||
|
eax - SF_NETWORK_GET (74)
|
||||||
|
bl - SSF_RX_PACKET_MISS_COUNT (16)
|
||||||
|
======================================================================
|
||||||
============== Function 75, Subfunction 0, Open socket. ==============
|
============== Function 75, Subfunction 0, Open socket. ==============
|
||||||
======================================================================
|
======================================================================
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2019. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; ETHERNET.INC ;;
|
;; ETHERNET.INC ;;
|
||||||
@ -76,8 +76,17 @@ align 4
|
|||||||
eth_input:
|
eth_input:
|
||||||
|
|
||||||
pop eax
|
pop eax
|
||||||
pushf
|
|
||||||
cli
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
cmp eax, [net_buffs_low]
|
||||||
|
jb .assert_mbuff
|
||||||
|
cmp eax, [net_buffs_high]
|
||||||
|
ja .assert_mbuff
|
||||||
|
test eax, 0x7ff
|
||||||
|
jnz .assert_mbuff
|
||||||
|
end if
|
||||||
|
|
||||||
|
spin_lock_irqsave
|
||||||
|
|
||||||
cmp [ETH_frame_queued], ETH_QUEUE_SIZE
|
cmp [ETH_frame_queued], ETH_QUEUE_SIZE
|
||||||
jae .full
|
jae .full
|
||||||
@ -92,7 +101,7 @@ eth_input:
|
|||||||
mov [ETH_frame_tail], eax
|
mov [ETH_frame_tail], eax
|
||||||
mov [ebx + NET_BUFF.NextPtr], eax
|
mov [ebx + NET_BUFF.NextPtr], eax
|
||||||
|
|
||||||
popf
|
spin_unlock_irqrestore
|
||||||
|
|
||||||
; Mark it as being an Ethernet Frame
|
; Mark it as being an Ethernet Frame
|
||||||
mov [eax + NET_BUFF.type], NET_BUFF_ETH
|
mov [eax + NET_BUFF.type], NET_BUFF_ETH
|
||||||
@ -107,12 +116,21 @@ eth_input:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.full:
|
.full:
|
||||||
DEBUGF DEBUG_NETWORK_ERROR, "ETH incoming queue is full, discarding packet!\n"
|
mov ebx, [eax + NET_BUFF.device]
|
||||||
popf
|
inc [ebx + NET_DEVICE.packets_rx_ovr]
|
||||||
push eax
|
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH incoming queue is full, discarding packet!\n"
|
||||||
call net_buff_free
|
spin_unlock_irqrestore
|
||||||
|
stdcall net_buff_free, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
.assert_mbuff:
|
||||||
|
DEBUGF DEBUG_NETWORK_ERROR, "eth_input: invalid buffer 0x%x\n", eax
|
||||||
|
DEBUGF DEBUG_NETWORK_ERROR, "eth_input: caller=0x%x\n", [esp+4]
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
|
end if
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;-----------------------------------------------------------------;
|
;-----------------------------------------------------------------;
|
||||||
@ -164,7 +182,7 @@ eth_process_input:
|
|||||||
|
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: size=%u\n", ecx
|
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: size=%u\n", ecx
|
||||||
sub ecx, sizeof.ETH_header
|
sub ecx, sizeof.ETH_header
|
||||||
jb .dump
|
jb .err
|
||||||
|
|
||||||
; Set registers for protocol handlers
|
; Set registers for protocol handlers
|
||||||
lea edx, [eax + sizeof.ETH_header]
|
lea edx, [eax + sizeof.ETH_header]
|
||||||
@ -188,11 +206,23 @@ eth_process_input:
|
|||||||
|
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: Unknown packet type=%x\n", ax
|
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: Unknown packet type=%x\n", ax
|
||||||
|
|
||||||
.dump:
|
.drop:
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: dumping\n"
|
mov eax, [esp]
|
||||||
|
mov eax, [eax + NET_BUFF.device]
|
||||||
|
inc [eax + NET_DEVICE.packets_rx_drop]
|
||||||
|
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: dropping\n"
|
||||||
call net_buff_free
|
call net_buff_free
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.err:
|
||||||
|
mov eax, [esp]
|
||||||
|
mov eax, [eax + NET_BUFF.device]
|
||||||
|
inc [eax + NET_DEVICE.packets_rx_err]
|
||||||
|
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: invalid frame received\n"
|
||||||
|
call net_buff_free
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;-----------------------------------------------------------------;
|
;-----------------------------------------------------------------;
|
||||||
@ -216,7 +246,7 @@ eth_output:
|
|||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: size=%u device=%x\n", ecx, ebx
|
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: size=%u device=%x\n", ecx, ebx
|
||||||
|
|
||||||
cmp ecx, [ebx + ETH_DEVICE.mtu]
|
cmp ecx, [ebx + ETH_DEVICE.mtu]
|
||||||
ja .exit
|
ja .too_large
|
||||||
|
|
||||||
push ecx
|
push ecx
|
||||||
push ax edx
|
push ax edx
|
||||||
@ -225,6 +255,7 @@ eth_output:
|
|||||||
stdcall net_buff_alloc, ecx
|
stdcall net_buff_alloc, ecx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .out_of_ram
|
jz .out_of_ram
|
||||||
|
|
||||||
mov [eax + NET_BUFF.type], NET_BUFF_ETH
|
mov [eax + NET_BUFF.type], NET_BUFF_ETH
|
||||||
mov [eax + NET_BUFF.device], ebx
|
mov [eax + NET_BUFF.device], ebx
|
||||||
mov [eax + NET_BUFF.offset], NET_BUFF.data
|
mov [eax + NET_BUFF.offset], NET_BUFF.data
|
||||||
@ -256,13 +287,16 @@ eth_output:
|
|||||||
jmp .done
|
jmp .done
|
||||||
|
|
||||||
.out_of_ram:
|
.out_of_ram:
|
||||||
DEBUGF DEBUG_NETWORK_ERROR, "ETH_output: Out of ram!\n"
|
inc [ebx + NET_DEVICE.packets_tx_drop]
|
||||||
add esp, 4+2+4
|
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: Out of ram!\n"
|
||||||
|
add esp, 4+2
|
||||||
|
pop ecx
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.exit:
|
.too_large:
|
||||||
DEBUGF DEBUG_NETWORK_ERROR, "ETH_output: Packet too large!\n"
|
inc [eax + NET_DEVICE.packets_tx_err]
|
||||||
|
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: Packet too large!\n"
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ endg
|
|||||||
|
|
||||||
DEBUG_NETWORK_ERROR = 1
|
DEBUG_NETWORK_ERROR = 1
|
||||||
DEBUG_NETWORK_VERBOSE = 0
|
DEBUG_NETWORK_VERBOSE = 0
|
||||||
|
NETWORK_SANITY_CHECKS = 1
|
||||||
|
|
||||||
NET_DEVICES_MAX = 16
|
NET_DEVICES_MAX = 16
|
||||||
NET_BUFFERS = 512
|
NET_BUFFERS = 512
|
||||||
@ -262,8 +263,13 @@ align 4
|
|||||||
net_device_count dd ?
|
net_device_count dd ?
|
||||||
net_device_list rd NET_DEVICES_MAX
|
net_device_list rd NET_DEVICES_MAX
|
||||||
|
|
||||||
net_buffs_free rd NET_BUFFERS
|
net_buffs_free rd NET_BUFFERS ; list of pointers to actual net buffs
|
||||||
.current dd ?
|
.current dd ? ; pointer to current element in net_buffs_free list
|
||||||
|
|
||||||
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
net_buffs_low dd ? ; actual net buff mem region start
|
||||||
|
net_buffs_high dd ? ; actual net buff mem region stop
|
||||||
|
end if
|
||||||
|
|
||||||
endg
|
endg
|
||||||
|
|
||||||
@ -284,6 +290,10 @@ stack_init:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
mov [net_buffs_low], eax
|
||||||
|
end if
|
||||||
|
|
||||||
mov edi, net_buffs_free
|
mov edi, net_buffs_free
|
||||||
mov ecx, NET_BUFFERS
|
mov ecx, NET_BUFFERS
|
||||||
cld
|
cld
|
||||||
@ -293,6 +303,11 @@ stack_init:
|
|||||||
dec ecx
|
dec ecx
|
||||||
jnz .loop
|
jnz .loop
|
||||||
|
|
||||||
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
sub eax, NET_BUFFER_SIZE
|
||||||
|
mov [net_buffs_high], eax
|
||||||
|
end if
|
||||||
|
|
||||||
mov eax, net_buffs_free
|
mov eax, net_buffs_free
|
||||||
stosd
|
stosd
|
||||||
|
|
||||||
@ -394,6 +409,16 @@ proc net_buff_alloc stdcall, buffersize
|
|||||||
|
|
||||||
spin_unlock_irqrestore
|
spin_unlock_irqrestore
|
||||||
|
|
||||||
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
cmp eax, [net_buffs_low]
|
||||||
|
cmp eax, [net_buffs_low]
|
||||||
|
jb .assert_mbuff
|
||||||
|
cmp eax, [net_buffs_high]
|
||||||
|
ja .assert_mbuff
|
||||||
|
test eax, 0x7ff
|
||||||
|
jnz .assert_mbuff
|
||||||
|
end if
|
||||||
|
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "net_buff_alloc: 0x%x\n", eax
|
DEBUGF DEBUG_NETWORK_VERBOSE, "net_buff_alloc: 0x%x\n", eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -408,6 +433,15 @@ proc net_buff_alloc stdcall, buffersize
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
DEBUGF DEBUG_NETWORK_ERROR, "net_buff_alloc: too large!\n"
|
DEBUGF DEBUG_NETWORK_ERROR, "net_buff_alloc: too large!\n"
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
.assert_mbuff:
|
||||||
|
DEBUGF DEBUG_NETWORK_ERROR, "net_buff_alloc: invalid buffer 0x%x\n", eax
|
||||||
|
DEBUGF DEBUG_NETWORK_ERROR, "net_buff_alloc: caller=0x%x\n", [esp+4]
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
|
end if
|
||||||
|
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
@ -416,6 +450,16 @@ proc net_buff_free stdcall, buffer
|
|||||||
|
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "net_buff_free: 0x%x\n", [buffer]
|
DEBUGF DEBUG_NETWORK_VERBOSE, "net_buff_free: 0x%x\n", [buffer]
|
||||||
|
|
||||||
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
mov eax, [buffer]
|
||||||
|
cmp eax, [net_buffs_low]
|
||||||
|
jb .assert_mbuff
|
||||||
|
cmp eax, [net_buffs_high]
|
||||||
|
ja .assert_mbuff
|
||||||
|
test eax, 0x7ff
|
||||||
|
jnz .assert_mbuff
|
||||||
|
end if
|
||||||
|
|
||||||
spin_lock_irqsave
|
spin_lock_irqsave
|
||||||
|
|
||||||
sub [net_buffs_free.current], 4 ; move pointer backwards
|
sub [net_buffs_free.current], 4 ; move pointer backwards
|
||||||
@ -426,6 +470,15 @@ proc net_buff_free stdcall, buffer
|
|||||||
spin_unlock_irqrestore
|
spin_unlock_irqrestore
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
if defined NETWORK_SANITY_CHECKS
|
||||||
|
.assert_mbuff:
|
||||||
|
DEBUGF DEBUG_NETWORK_ERROR, "net_buff_free: invalid buffer 0x%x\n", eax
|
||||||
|
DEBUGF DEBUG_NETWORK_ERROR, "net_buff_free: caller=0x%x\n", [esp+4]
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
|
end if
|
||||||
|
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
@ -760,6 +813,13 @@ sys_network:
|
|||||||
dd .bytes_tx ; 8
|
dd .bytes_tx ; 8
|
||||||
dd .bytes_rx ; 9
|
dd .bytes_rx ; 9
|
||||||
dd .state ; 10
|
dd .state ; 10
|
||||||
|
dd .packets_tx_err ; 11
|
||||||
|
dd .packets_tx_drop ; 12
|
||||||
|
dd .packets_tx_ovr ; 13
|
||||||
|
dd .packets_rx_err ; 14
|
||||||
|
dd .packets_rx_drop ; 15
|
||||||
|
dd .packets_rx_ovr ; 16
|
||||||
|
|
||||||
.number = ($ - .table) / 4 - 1
|
.number = ($ - .table) / 4 - 1
|
||||||
|
|
||||||
.get_type:
|
.get_type:
|
||||||
@ -768,12 +828,10 @@ sys_network:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.get_dev_name:
|
.get_dev_name:
|
||||||
; { Patch by Coldy, sanity check
|
mov ebx, eax
|
||||||
mov ebx, eax ; eax will used for is_region_userspace return
|
|
||||||
stdcall is_region_userspace, ecx, 64
|
stdcall is_region_userspace, ecx, 64
|
||||||
jz .bad_buffer
|
jz .bad_buffer
|
||||||
mov esi, [ebx + NET_DEVICE.name] ;mov esi, [eax + NET_DEVICE.name]
|
mov esi, [ebx + NET_DEVICE.name]
|
||||||
; } End patch by Coldy, sanity check
|
|
||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
|
|
||||||
mov ecx, 64/4 ; max length
|
mov ecx, 64/4 ; max length
|
||||||
@ -828,6 +886,36 @@ sys_network:
|
|||||||
mov [esp+32], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.packets_tx_err:
|
||||||
|
mov eax, [eax + NET_DEVICE.packets_tx_err]
|
||||||
|
mov [esp+32], eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
.packets_tx_drop:
|
||||||
|
mov eax, [eax + NET_DEVICE.packets_tx_drop]
|
||||||
|
mov [esp+32], eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
.packets_tx_ovr:
|
||||||
|
mov eax, [eax + NET_DEVICE.packets_tx_ovr]
|
||||||
|
mov [esp+32], eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
.packets_rx_err:
|
||||||
|
mov eax, [eax + NET_DEVICE.packets_rx_err]
|
||||||
|
mov [esp+32], eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
.packets_rx_drop:
|
||||||
|
mov eax, [eax + NET_DEVICE.packets_rx_drop]
|
||||||
|
mov [esp+32], eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
.packets_rx_ovr:
|
||||||
|
mov eax, [eax + NET_DEVICE.packets_rx_ovr]
|
||||||
|
mov [esp+32], eax
|
||||||
|
ret
|
||||||
|
|
||||||
.state:
|
.state:
|
||||||
mov eax, [eax + NET_DEVICE.link_state]
|
mov eax, [eax + NET_DEVICE.link_state]
|
||||||
mov [esp+32], eax
|
mov [esp+32], eax
|
||||||
|
@ -233,6 +233,12 @@ SF_NETWORK_DEVICE=74
|
|||||||
SSF_TX_BYTE_COUNT=8
|
SSF_TX_BYTE_COUNT=8
|
||||||
SSF_RX_BYTE_COUNT=9
|
SSF_RX_BYTE_COUNT=9
|
||||||
SSF_LINK_STATUS=10
|
SSF_LINK_STATUS=10
|
||||||
|
SSF_TX_PACKET_ERROR_COUNT=11
|
||||||
|
SSF_TX_PACKET_DROP_COUNT=12
|
||||||
|
SSF_TX_PACKET_MISS_COUNT=13
|
||||||
|
SSF_RX_PACKET_ERROR_COUNT=14
|
||||||
|
SSF_RX_PACKET_DROP_COUNT=15
|
||||||
|
SSF_RX_PACKET_MISS_COUNT=16
|
||||||
SF_NETWORK_SOCKET=75
|
SF_NETWORK_SOCKET=75
|
||||||
SSF_OPEN=0
|
SSF_OPEN=0
|
||||||
SSF_CLOSE=1
|
SSF_CLOSE=1
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2010-2018. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2010-2021. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; netstat.asm - Network Status Tool for KolibriOS ;;
|
;; netstat.asm - Network Status Tool for KolibriOS ;;
|
||||||
@ -144,6 +144,23 @@ redraw:
|
|||||||
cmp [mode], 101
|
cmp [mode], 101
|
||||||
jne .no_eth
|
jne .no_eth
|
||||||
|
|
||||||
|
mcall 4, 212 shl 16 + 35, 0x80000000, str_err
|
||||||
|
add ebx, 18
|
||||||
|
mov edx, str_dropped
|
||||||
|
mcall
|
||||||
|
add ebx, 18
|
||||||
|
mov edx, str_missed
|
||||||
|
mcall
|
||||||
|
add ebx, 18
|
||||||
|
mov edx, str_err
|
||||||
|
mcall
|
||||||
|
add ebx, 18
|
||||||
|
mov edx, str_dropped
|
||||||
|
mcall
|
||||||
|
add ebx, 18
|
||||||
|
mov edx, str_missed
|
||||||
|
mcall
|
||||||
|
|
||||||
mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx
|
mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx
|
||||||
add ebx, 18
|
add ebx, 18
|
||||||
mov edx, str_packets_rx
|
mov edx, str_packets_rx
|
||||||
@ -177,7 +194,7 @@ redraw:
|
|||||||
push eax
|
push eax
|
||||||
push bx
|
push bx
|
||||||
|
|
||||||
mov edx, 134 shl 16 + 35 + 7*18
|
mov edx, 115 shl 16 + 35 + 7*18
|
||||||
call draw_mac
|
call draw_mac
|
||||||
jmp end_of_draw
|
jmp end_of_draw
|
||||||
|
|
||||||
@ -224,7 +241,7 @@ redraw:
|
|||||||
mcall 76
|
mcall 76
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov edx, 134 shl 16 + 35 + 2*18
|
mov edx, 115 shl 16 + 35 + 2*18
|
||||||
call draw_ip
|
call draw_ip
|
||||||
|
|
||||||
add edx, 18
|
add edx, 18
|
||||||
@ -280,7 +297,7 @@ redraw:
|
|||||||
mcall
|
mcall
|
||||||
|
|
||||||
add ebx, 18
|
add ebx, 18
|
||||||
mov edx, str_dumped
|
mov edx, str_dropped
|
||||||
mcall
|
mcall
|
||||||
|
|
||||||
add ebx, 18
|
add ebx, 18
|
||||||
@ -305,9 +322,42 @@ draw_stats:
|
|||||||
pop ebx
|
pop ebx
|
||||||
push eax
|
push eax
|
||||||
inc bl
|
inc bl
|
||||||
cmp bl, 10
|
cmp bl, 16
|
||||||
jbe @r
|
jbe @r
|
||||||
|
|
||||||
|
; rx ovr
|
||||||
|
mov ebx, 0x000a0000
|
||||||
|
pop ecx
|
||||||
|
mov edx, 320 shl 16 + 35 + 5*18
|
||||||
|
mov esi, 0x40000000
|
||||||
|
mcall 47
|
||||||
|
|
||||||
|
; rx drop
|
||||||
|
sub edx, 18
|
||||||
|
pop ecx
|
||||||
|
mcall
|
||||||
|
|
||||||
|
; rx err
|
||||||
|
sub edx, 18
|
||||||
|
pop ecx
|
||||||
|
mcall
|
||||||
|
|
||||||
|
; tx ovr
|
||||||
|
sub edx, 18
|
||||||
|
pop ecx
|
||||||
|
mcall
|
||||||
|
|
||||||
|
; tx drop
|
||||||
|
sub edx, 18
|
||||||
|
pop ecx
|
||||||
|
mcall
|
||||||
|
|
||||||
|
; tx err
|
||||||
|
sub edx, 18
|
||||||
|
pop ecx
|
||||||
|
mcall
|
||||||
|
|
||||||
|
; Calculate speed
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
push [time]
|
push [time]
|
||||||
@ -376,19 +426,19 @@ draw_stats:
|
|||||||
mov edx, str_unknown
|
mov edx, str_unknown
|
||||||
|
|
||||||
.print_link:
|
.print_link:
|
||||||
mov ebx, 134 shl 16 + 35 + 6*18
|
mov ebx, 115 shl 16 + 35 + 6*18
|
||||||
mov ecx, 0xc0000000
|
mov ecx, 0xc0000000
|
||||||
mov edi, 0x00f3f3f3
|
mov edi, 0x00f3f3f3
|
||||||
mcall 4
|
mcall 4
|
||||||
|
|
||||||
; speed tx
|
; speed rx
|
||||||
mov ebx, 0x000a0000
|
mov ebx, 0x000a0000
|
||||||
pop ecx
|
pop ecx
|
||||||
mov edx, 134 shl 16 + 35 + 5*18
|
mov edx, 115 shl 16 + 35 + 5*18
|
||||||
mov esi, 0x40000000
|
mov esi, 0x40000000
|
||||||
mcall 47
|
mcall 47
|
||||||
|
|
||||||
; speed rx
|
; speed tx
|
||||||
sub edx, 18
|
sub edx, 18
|
||||||
pop ecx
|
pop ecx
|
||||||
mcall
|
mcall
|
||||||
@ -437,7 +487,7 @@ not_101:
|
|||||||
|
|
||||||
mov ebx, 0x000a0000
|
mov ebx, 0x000a0000
|
||||||
pop ecx
|
pop ecx
|
||||||
mov edx, 134 shl 16 + 35 + 18
|
mov edx, 115 shl 16 + 35 + 18
|
||||||
mov esi, 0x40000000
|
mov esi, 0x40000000
|
||||||
mov edi, 0x00F3F3F3
|
mov edi, 0x00F3F3F3
|
||||||
mcall 47
|
mcall 47
|
||||||
@ -481,7 +531,7 @@ not_102:
|
|||||||
|
|
||||||
mov ebx, 0x000a0000
|
mov ebx, 0x000a0000
|
||||||
pop ecx
|
pop ecx
|
||||||
mov edx, 134 shl 16 + 35 + 3*18
|
mov edx, 115 shl 16 + 35 + 3*18
|
||||||
mov esi, 0x40000000
|
mov esi, 0x40000000
|
||||||
mov edi, 0x00F3F3F3
|
mov edi, 0x00F3F3F3
|
||||||
mcall 47
|
mcall 47
|
||||||
@ -598,7 +648,7 @@ not_103:
|
|||||||
|
|
||||||
mov ebx, 0x000a0000
|
mov ebx, 0x000a0000
|
||||||
pop ecx
|
pop ecx
|
||||||
mov edx, 134 shl 16 + 35 + 18
|
mov edx, 115 shl 16 + 35 + 18
|
||||||
mov esi, 0x40000000
|
mov esi, 0x40000000
|
||||||
mov edi, 0x00F3F3F3
|
mov edi, 0x00F3F3F3
|
||||||
mcall 47
|
mcall 47
|
||||||
@ -629,7 +679,7 @@ not_104:
|
|||||||
|
|
||||||
mov ebx, 0x000a0000
|
mov ebx, 0x000a0000
|
||||||
pop ecx
|
pop ecx
|
||||||
mov edx, 134 shl 16 + 35 + 18
|
mov edx, 115 shl 16 + 35 + 18
|
||||||
mov esi, 0x40000000
|
mov esi, 0x40000000
|
||||||
mov edi, 0x00F3F3F3
|
mov edi, 0x00F3F3F3
|
||||||
mcall 47
|
mcall 47
|
||||||
@ -678,7 +728,7 @@ not_105:
|
|||||||
|
|
||||||
mov ebx, 0x000a0000
|
mov ebx, 0x000a0000
|
||||||
pop ecx
|
pop ecx
|
||||||
mov edx, 134 shl 16 + 35 + 18*4
|
mov edx, 115 shl 16 + 35 + 18*4
|
||||||
mov esi, 0x40000000
|
mov esi, 0x40000000
|
||||||
mov edi, 0x00F3F3F3
|
mov edi, 0x00F3F3F3
|
||||||
mcall 47
|
mcall 47
|
||||||
@ -945,7 +995,8 @@ str_gateway db 'Standard gateway: . . .', 0
|
|||||||
str_arp db 'ARP entrys:', 0
|
str_arp db 'ARP entrys:', 0
|
||||||
str_conflicts db 'ARP conflicts:', 0
|
str_conflicts db 'ARP conflicts:', 0
|
||||||
str_missed db 'Packets missed:', 0
|
str_missed db 'Packets missed:', 0
|
||||||
str_dumped db 'Packets dumped:', 0
|
str_dropped db 'Packets dropped:', 0
|
||||||
|
str_err db 'Packet errors:', 0
|
||||||
str_queued db 'Packets queued:', 0
|
str_queued db 'Packets queued:', 0
|
||||||
str_link db 'Link state:', 0
|
str_link db 'Link state:', 0
|
||||||
str_speed_tx db 'Upload (kb/s):', 0
|
str_speed_tx db 'Upload (kb/s):', 0
|
||||||
|
Loading…
Reference in New Issue
Block a user