Markup changes in net branch + updates in TCP_output

git-svn-id: svn://kolibrios.org@2362 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-02-21 08:44:51 +00:00
parent 8fd9581723
commit f156bb294d
5 changed files with 1652 additions and 1598 deletions

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; Written by hidnplayr@kolibrios.org, ;; ;; Written by hidnplayr@kolibrios.org, ;;
@ -157,8 +157,8 @@ ends
struct STREAM_SOCKET TCP_SOCKET struct STREAM_SOCKET TCP_SOCKET
rcv rd sizeof.RING_BUFFER/4 rcv RING_BUFFER
snd rd sizeof.RING_BUFFER/4 snd RING_BUFFER
ends ends
@ -1410,8 +1410,8 @@ SOCKET_free:
jnz .no_tcp jnz .no_tcp
mov ebx, eax mov ebx, eax
stdcall kernel_free, [ebx + STREAM_SOCKET.rcv + RING_BUFFER.start_ptr] stdcall kernel_free, [ebx + STREAM_SOCKET.rcv.start_ptr]
stdcall kernel_free, [ebx + STREAM_SOCKET.snd + RING_BUFFER.start_ptr] stdcall kernel_free, [ebx + STREAM_SOCKET.snd.start_ptr]
mov eax, ebx mov eax, ebx
.no_tcp: .no_tcp:

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; Part of the tcp/ip network stack for KolibriOS ;; ;; Part of the tcp/ip network stack for KolibriOS ;;

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; Part of the tcp/ip network stack for KolibriOS ;; ;; Part of the tcp/ip network stack for KolibriOS ;;
@ -434,7 +434,7 @@ TCP_input:
; Calculate receive window size ; Calculate receive window size
; mov eax, [ebx + STREAM_SOCKET.rcv + RING_BUFFER.size] ; mov eax, [ebx + STREAM_SOCKET.rcv.size]
; neg eax ; neg eax
; add eax, SOCKETBUFFSIZE ; add eax, SOCKETBUFFSIZE
; mov edx, [ebx + TCP_SOCKET.RCV_ADV] ; mov edx, [ebx + TCP_SOCKET.RCV_ADV]
@ -1306,7 +1306,7 @@ align 4
;;; 1040-1050 ;;; 1040-1050
movzx eax, [edx + TCP_header.UrgentPointer] movzx eax, [edx + TCP_header.UrgentPointer]
add eax, [ebx + STREAM_SOCKET.rcv + RING_BUFFER.size] add eax, [ebx + STREAM_SOCKET.rcv.size]
cmp eax, SOCKET_MAXDATA cmp eax, SOCKET_MAXDATA
jbe .not_urgent jbe .not_urgent

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; Part of the tcp/ip network stack for KolibriOS ;; ;; Part of the tcp/ip network stack for KolibriOS ;;
@ -75,7 +75,7 @@ TCP_output:
test ecx, ecx test ecx, ecx
jnz .no_zero_window jnz .no_zero_window
cmp ebx, [eax + STREAM_SOCKET.snd + RING_BUFFER.size] cmp ebx, [eax + STREAM_SOCKET.snd.size]
jae @f jae @f
and dl, not (TH_FIN) ; clear the FIN flag ??? how can it be set before? and dl, not (TH_FIN) ; clear the FIN flag ??? how can it be set before?
@ -93,7 +93,7 @@ TCP_output:
;-------------------------------- ;--------------------------------
; Calculate how much data to send (106) ; Calculate how much data to send (106)
mov esi, [eax + STREAM_SOCKET.snd + RING_BUFFER.size] mov esi, [eax + STREAM_SOCKET.snd.size]
cmp esi, ecx cmp esi, ecx
jb @f jb @f
mov esi, ecx mov esi, ecx
@ -146,7 +146,7 @@ TCP_output:
mov edi, [eax + TCP_SOCKET.SND_NXT] mov edi, [eax + TCP_SOCKET.SND_NXT]
add edi, esi add edi, esi
sub edi, [eax + TCP_SOCKET.SND_UNA] sub edi, [eax + TCP_SOCKET.SND_UNA]
sub edi, [eax + STREAM_SOCKET.snd + RING_BUFFER.size] sub edi, [eax + STREAM_SOCKET.snd.size]
jns @f jns @f
and dl, not (TH_FIN) and dl, not (TH_FIN)
@ -157,7 +157,7 @@ TCP_output:
; calculate window advertisement (130) ; calculate window advertisement (130)
mov ecx, SOCKET_MAXDATA mov ecx, SOCKET_MAXDATA
sub ecx, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size] sub ecx, [eax + STREAM_SOCKET.rcv.size]
;------------------------------ ;------------------------------
; Sender silly window avoidance (131) ; Sender silly window avoidance (131)
@ -168,7 +168,13 @@ TCP_output:
cmp esi, [eax + TCP_SOCKET.t_maxseg] cmp esi, [eax + TCP_SOCKET.t_maxseg]
je .send je .send
;;; if (idle or TF_NODELAY) && (esi + ebx >= so_snd.sb_cc), send test [eax + TCP_SOCKET.t_flags], TF_NODELAY
jnz @f
; TODO: if not 'idle', skip to next codeblock
@@:
add ebx, esi
cmp ebx, [eax + STREAM_SOCKET.snd.size]
jae .send
test [eax + TCP_SOCKET.t_force], -1 ;;; test [eax + TCP_SOCKET.t_force], -1 ;;;
jnz .send jnz .send
@ -190,7 +196,23 @@ TCP_output:
test ecx, ecx test ecx, ecx
jz .no_window jz .no_window
;;; TODO 167-172 push ecx
mov cl, [eax + TCP_SOCKET.RCV_SCALE]
inc cl ; we want it *2
mov ebx, TCP_max_win
shl ebx, cl
pop ecx
cmp ebx, ecx
cmovb ebx, ecx
; now ebx is TWICE the amount we can increase the window
; (with TCP_max_win shl rcv_scale as the maximum)
cmp ebx, [eax + TCP_SOCKET.t_maxseg]
jae .send
;;; cmp ebx, [eax + ] ;;; TODO: check receive buffer high water mark
;;; jae .send
.no_window: .no_window:
@ -224,10 +246,18 @@ TCP_output:
.enter_persist: .enter_persist:
cmp [eax + STREAM_SOCKET.snd.size], 0 ; Data ready to send?
jne @f
cmp [eax + TCP_SOCKET.timer_retransmission], 0
jne @f
cmp [eax + TCP_SOCKET.timer_persist], 0 ; Persist timer already expired?
jne @f
DEBUGF 1,"Entering persist state\n" DEBUGF 1,"Entering persist state\n"
mov [eax + TCP_SOCKET.t_rxtshift], 0
;;; 213 - 217 TCP_set_persist eax
@@:
;---------------------------- ;----------------------------
; No reason to send a segment (219) ; No reason to send a segment (219)
@ -463,9 +493,11 @@ TCP_output:
mov edx, [eax + TCP_SOCKET.t_rxtcur] mov edx, [eax + TCP_SOCKET.t_rxtcur]
mov [eax + TCP_SOCKET.timer_retransmission], dx mov [eax + TCP_SOCKET.timer_retransmission], dx
cmp [eax + TCP_SOCKET.timer_persist], 0
jne @f
mov [eax + TCP_SOCKET.timer_persist], 0 mov [eax + TCP_SOCKET.timer_persist], 0
mov [eax + TCP_SOCKET.t_rxtshift], 0 ;;; TODO: only do this if timer_persist was set mov [eax + TCP_SOCKET.t_rxtshift], 0
@@:
.retransmit_set: .retransmit_set:

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; Part of the tcp/ip network stack for KolibriOS ;; ;; Part of the tcp/ip network stack for KolibriOS ;;
@ -380,3 +380,25 @@ TCP_respond_segment:
add esp, 2+4 add esp, 2+4
ret ret
macro TCP_set_persist socket {
;int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
;int tt;
;
;tp->t_flags &= ~TF_PREVVALID;
;
;if (tcp_timer_active(tp, TT_REXMT))
; panic("tcp_setpersist: retransmit pending");
;
;; Start/restart persistance timer.
;
;TCPT_RANGESET(tt, t * tcp_backoff[tp->t_rxtshift], TCPTV_PERSMIN, TCPTV_PERSMAX);
;tcp_timer_activate(tp, TT_PERSIST, tt);
;
;if (tp->t_rxtshift < TCP_MAXRXTSHIFT)
; tp->t_rxtshift++;
}