forked from KolibriOS/kolibrios
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:
parent
8fd9581723
commit
f156bb294d
@ -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 ;;
|
||||
;; ;;
|
||||
;; Written by hidnplayr@kolibrios.org, ;;
|
||||
@ -157,8 +157,8 @@ ends
|
||||
|
||||
struct STREAM_SOCKET TCP_SOCKET
|
||||
|
||||
rcv rd sizeof.RING_BUFFER/4
|
||||
snd rd sizeof.RING_BUFFER/4
|
||||
rcv RING_BUFFER
|
||||
snd RING_BUFFER
|
||||
|
||||
ends
|
||||
|
||||
@ -1410,8 +1410,8 @@ SOCKET_free:
|
||||
jnz .no_tcp
|
||||
|
||||
mov ebx, eax
|
||||
stdcall kernel_free, [ebx + STREAM_SOCKET.rcv + RING_BUFFER.start_ptr]
|
||||
stdcall kernel_free, [ebx + STREAM_SOCKET.snd + RING_BUFFER.start_ptr]
|
||||
stdcall kernel_free, [ebx + STREAM_SOCKET.rcv.start_ptr]
|
||||
stdcall kernel_free, [ebx + STREAM_SOCKET.snd.start_ptr]
|
||||
mov eax, ebx
|
||||
.no_tcp:
|
||||
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; Part of the tcp/ip network stack for KolibriOS ;;
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; Part of the tcp/ip network stack for KolibriOS ;;
|
||||
@ -434,7 +434,7 @@ TCP_input:
|
||||
|
||||
; Calculate receive window size
|
||||
|
||||
; mov eax, [ebx + STREAM_SOCKET.rcv + RING_BUFFER.size]
|
||||
; mov eax, [ebx + STREAM_SOCKET.rcv.size]
|
||||
; neg eax
|
||||
; add eax, SOCKETBUFFSIZE
|
||||
; mov edx, [ebx + TCP_SOCKET.RCV_ADV]
|
||||
@ -1306,7 +1306,7 @@ align 4
|
||||
;;; 1040-1050
|
||||
|
||||
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
|
||||
jbe .not_urgent
|
||||
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; Part of the tcp/ip network stack for KolibriOS ;;
|
||||
@ -75,7 +75,7 @@ TCP_output:
|
||||
test ecx, ecx
|
||||
jnz .no_zero_window
|
||||
|
||||
cmp ebx, [eax + STREAM_SOCKET.snd + RING_BUFFER.size]
|
||||
cmp ebx, [eax + STREAM_SOCKET.snd.size]
|
||||
jae @f
|
||||
|
||||
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)
|
||||
|
||||
mov esi, [eax + STREAM_SOCKET.snd + RING_BUFFER.size]
|
||||
mov esi, [eax + STREAM_SOCKET.snd.size]
|
||||
cmp esi, ecx
|
||||
jb @f
|
||||
mov esi, ecx
|
||||
@ -146,7 +146,7 @@ TCP_output:
|
||||
mov edi, [eax + TCP_SOCKET.SND_NXT]
|
||||
add edi, esi
|
||||
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
|
||||
|
||||
and dl, not (TH_FIN)
|
||||
@ -157,7 +157,7 @@ TCP_output:
|
||||
; calculate window advertisement (130)
|
||||
|
||||
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)
|
||||
@ -168,7 +168,13 @@ TCP_output:
|
||||
cmp esi, [eax + TCP_SOCKET.t_maxseg]
|
||||
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 ;;;
|
||||
jnz .send
|
||||
@ -190,7 +196,23 @@ TCP_output:
|
||||
test ecx, ecx
|
||||
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:
|
||||
|
||||
@ -224,10 +246,18 @@ TCP_output:
|
||||
|
||||
.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"
|
||||
|
||||
|
||||
;;; 213 - 217
|
||||
mov [eax + TCP_SOCKET.t_rxtshift], 0
|
||||
TCP_set_persist eax
|
||||
@@:
|
||||
|
||||
;----------------------------
|
||||
; No reason to send a segment (219)
|
||||
@ -463,9 +493,11 @@ TCP_output:
|
||||
mov edx, [eax + TCP_SOCKET.t_rxtcur]
|
||||
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.t_rxtshift], 0 ;;; TODO: only do this if timer_persist was set
|
||||
|
||||
mov [eax + TCP_SOCKET.t_rxtshift], 0
|
||||
@@:
|
||||
|
||||
.retransmit_set:
|
||||
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; Part of the tcp/ip network stack for KolibriOS ;;
|
||||
@ -380,3 +380,25 @@ TCP_respond_segment:
|
||||
add esp, 2+4
|
||||
|
||||
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++;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user