DEC21X4X: dont copy data when receiving.

git-svn-id: svn://kolibrios.org@5184 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-11-21 12:26:02 +00:00
parent 7199705b05
commit e54f076e14

View File

@ -1134,7 +1134,7 @@ proc transmit stdcall bufferptr, buffersize
mov [esi + desc.length], eax mov [esi + desc.length], eax
; set descriptor status ; set descriptor status
mov [esi + desc.status], DES0_OWN ; say it is now owned by the 21x4x mov [esi + desc.status], DES0_OWN ; say it is now owned by the 21x4x
; Check if transmitter is running ; Check if transmitter is running
set_io [ebx + device.io_addr], 0 set_io [ebx + device.io_addr], 0
@ -1227,7 +1227,7 @@ int_handler:
push eax esi ecx push eax esi ecx
DEBUGF 1,"TX ok!\n" DEBUGF 1,"TX ok!\n"
.loop_tx: .loop_tx:
; go to last descriptor ; get last descriptor
mov eax, [ebx + device.last_tx] mov eax, [ebx + device.last_tx]
mov edx, sizeof.desc mov edx, sizeof.desc
mul edx mul edx
@ -1240,10 +1240,10 @@ int_handler:
je .end_tx je .end_tx
mov [eax + desc.buffer1], 0 mov [eax + desc.buffer1], 0
DEBUGF 1, "Free buffer 0x%x\n", [eax + TX_RING_SIZE*sizeof.desc] DEBUGF 1,"Free buffer 0x%x\n", [eax + TX_RING_SIZE*sizeof.desc]
invoke KernelFree, [eax + TX_RING_SIZE*sizeof.desc] invoke KernelFree, [eax + TX_RING_SIZE*sizeof.desc]
; next descriptor ; advance to next descriptor
inc [ebx + device.last_tx] inc [ebx + device.last_tx]
and [ebx + device.last_tx], TX_RING_SIZE-1 and [ebx + device.last_tx], TX_RING_SIZE-1
@ -1254,6 +1254,7 @@ int_handler:
;---------------------------------- ;----------------------------------
; RX irq ; RX irq
test eax, CSR5_RI test eax, CSR5_RI
jz .not_rx jz .not_rx
push eax esi ecx push eax esi ecx
@ -1264,13 +1265,13 @@ int_handler:
.rx_loop: .rx_loop:
pop ebx pop ebx
; get current descriptor ; get current descriptor
mov eax, [ebx + device.cur_rx] mov eax, [ebx + device.cur_rx]
mov edx, sizeof.desc mov edx, sizeof.desc
mul edx mul edx
lea edi, [ebx + device.rx_ring + eax] lea edi, [ebx + device.rx_ring + eax]
; now check status ; Check current RX descriptor status
mov eax, [edi + desc.status] mov eax, [edi + desc.status]
test eax, DES0_OWN test eax, DES0_OWN
@ -1282,51 +1283,39 @@ int_handler:
test eax, RDES0_ES test eax, RDES0_ES
jnz .end_rx jnz .end_rx
mov esi, [edi + RX_RING_SIZE*sizeof.desc] ; Calculate length
mov ecx, [edi + desc.status] mov ecx, [edi + desc.status]
shr ecx, RDES0_FL_SH shr ecx, RDES0_FL_SH
and ecx, RDES0_FL_MASK and ecx, RDES0_FL_MASK
sub ecx, 4 ; crc, we dont need it sub ecx, 4 ; throw away the CRC
DEBUGF 1,"got %u bytes\n", ecx
DEBUGF 1,"size=%u, addr:0x%x\n", ecx, esi
push esi edi ecx
invoke KernelAlloc, ecx ; Allocate a buffer to put packet into
pop ecx edi esi
test eax, eax
jz .fail
; Push arguments for Eth_input (and some more...)
push ebx push ebx
push dword .rx_loop push .rx_loop ; return addr
push ecx eax push ecx ; packet size
xchg edi, eax push dword[edi + RX_RING_SIZE*sizeof.desc] ; packet ptr
; update statistics ; update statistics
inc [ebx + device.packets_rx] inc [ebx + device.packets_rx]
add dword[ebx + device.bytes_rx], ecx add dword[ebx + device.bytes_rx], ecx
adc dword[ebx + device.bytes_rx + 4], 0 adc dword[ebx + device.bytes_rx + 4], 0
; copy packet data ; Allocate new descriptor
shr cx, 1 push edi ebx
jnc .nb invoke KernelAlloc, 1536 ; Allocate a buffer to put packet into
movsb pop ebx edi
.nb: mov [edi + RX_RING_SIZE*sizeof.desc], eax
shr cx, 1 invoke GetPhysAddr
jnc .nw mov [edi + desc.buffer1], eax
movsw mov [edi + desc.status], DES0_OWN ; mark descriptor as being free
.nw:
rep movsd
mov [eax + desc.status], DES0_OWN ; free descriptor
; Move to next rx desc
inc [ebx + device.cur_rx] ; next descriptor inc [ebx + device.cur_rx] ; next descriptor
and [ebx + device.cur_rx], RX_RING_SIZE-1 and [ebx + device.cur_rx], RX_RING_SIZE-1
jmp [Eth_input] jmp [Eth_input]
.end_rx: .end_rx:
.fail:
pop ecx esi eax
.not_rx: .not_rx:
pop edi esi ebx pop edi esi ebx