zoukankan      html  css  js  c++  java
  • TCP/IP研究(1)-Timer

     

           ARM and TOE Rx/Tx module will initialize, reset and clean the timer list. The timer list is some timer descriptor arrays stored in the SRAM and maintained by Timer Manager. All the timeout process are handled by ARM. When several TCP connections are timeout , the Timer Manager will generate an interrupt to ARM and indicate timeout happend. ARM will

    read all the connections’ timeout events from the registers of Timer Manager and process in the ISR of firmware.

    The main functions of Timer Manager:

    l  Maintain descriptor array

    l  Generate interrupt when timeout happened

    l  Tell the ARM which connections are timeout

    2.Timer Descriptor and Array

    The hardware maintains six sequential arrays of timer descriptors which are stored in the SRAM. The array size is the maximum TCP connections supported. The entry of the array is short , middle and long timer descriptors:

    l  The short timer descriptors is used by four general timer: SYNACK timer, FIN_WAIT2 time, Delayed ACK timer, TIME_WAIT Kill timer.

    l  The middle timer descriptors is used by one general timer: Write timer(inherit from Linux, re-used by Retransmit timer and Zero Window Probe timer).

    l  The long timer descriptors is used by one general timer: Keepalive timer.

    Linux General

    TCP Timer

    TOE Timer

    Timeout Value

    Reset Frequence

    Accuracy

    Descriptor Type

    Keepalive timer

    SYNACK timer

    3 seconds

    Very low

    0.1s

    Short

    FIN_WAIT2 timer

    (FIN time – 60) second.

    Very low

    0.5s

    Short

    Keepalive timer

    75 seconds or 2 hours

    Very low

    5s

    Long

    Write timer

    Write timer

    Retransmit timer

    200ms ~ 2min

    High in WAN

    Low in LAN

    50ms

         Middle

    Zero Window Probe timer

    (RTT*2 ^backoff) , Maximum 120 seconds

    Low

    Delayed ACK timer

    Delayed ACK time

    40ms ~ 200ms

     

       Extreme High

    (reset whenever receive a packet)

    10ms

    Short

    TIME_WAIT Kill timer

    TIME_WAIT Kill timer

    60 seconds

    Very low

    1s

    Short

     

     

     

     

     

     

    The operation of timer is described by the following, by SYNACK timer as instance:

    Initialize/ Clear:

    Software initialize the SYNACK timer of TCP Connection ID X. Software accesses the timer descriptor in the Keepalive_timer1_Array[ X ] and set the USED to 0( USED is 0, indicates the descriptor is not used)

    Reset:

    Software initialize the SYNACK timer of TCP Connection ID N.Software/Hardware accesses the timer descriptor in the Keepalive_timer1_Array[X ] and set the USED to 1. And set VALUE:

    Equation[1]:

    VALUE = timeout_second / accuracy_second.

    If timeout_second is 3 second, accuracy_second is 0.5 second, VALUE will be set to 6.

    Maintain:

    Timer manager will access each entry of  Keepalive_timer1_Array,and subtract  1 from the VALUE every accuracy_second.

    Equation[2]:

    VALUE = VALUE – 1

    If the Keepalive_timer1_Array X].VALUE become to zero, it is indicate the TCP Connection ID X is timeout. Then, Timer manager should interrupt the ARM to process the timeout process.

    The design doesn’t follow the Linux. In the Linux, 4 general timers are re-used as 7 individual timers. For example , the Keepalive timer is re-used as 3 timers (SYNACK timer, FIN_WAIT2 timer and Keepalive timer). But those three times have different accuracy. It has to use 0.1 second as the minium accuracy and the use 3 bytes timer descriptors. The hardware need the whole 3 bytes * Max_Connection_ID array every 0.1 second. The Read/Write memory overhead is too big.

    3. Overhead Estimation

    On the assumption that the TOE support 1K connections. The hardware maintains six sequential array of timer descriptors: SYNACK timer, FIN_WAIT2 time, Delayed ACK timer, TIME_WAIT Kill timer, Write timer and Keepalive timer. Now, we will estimation the overhead of Read/Write memory and store quantity.

    3.1 Read/Write memory

     

    Equation[3]:

    Read/Write_Memory byte/second = Length_of_Descriptor * Number_of_Connections / Accuracy_second

    Overhead of SYNACK timer:

    Read/Write Memory = 1byte * 1K /0.1 = 10 Kbyte/second

    Overhead of FIN_WAIT2 timer:

    Read/Write Memory = 1byte * 1K /0.5 = 2 Kbyte/second

    Overhead of Delayed ACK timer:

    Read/Write Memory = 1byte * 1K /0.01 = 100 Kbyte/second

    Overhead of TIME_WAIT Kill timer:

    Read/Write Memory = 1byte * 1K /1 = 1 Kbyte/second

    Overhead of Write time:

    Read/Write Memory = 1.5byte * 1K /0.05 = 30 Kbyte/second

    Overhead of Keepalive e time:

    Read/Write Memory = 2byte * 1K / 5 = 0.4 Kbyte/second

    Read/Write memory  Summary = 10 + 2 +100 +1 + 30+ 0.4 = 143.4 Kbyte/second

    3.2 Store quantity

    Support 1K connections, need SRAM:

    (1 + 1 + 1 +1 +1.5 + 2) * 1K = 7.5Kbyte

    4. Interrupt

    Timer Manage generates interrupt when timeout happened( VALUE became to 0 in the descriptor.)

    …….

     

    5. Tell the ARM which connections are timeout

    ……….

     

  • 相关阅读:
    SNMP++
    临界区,互斥量,信号量,事件的区别
    2015 年最棒的 5 个 HTML5 框架(转)
    java.lang.OutOfMemoryError: PermGen space及其解决方法
    java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
    eclipse安装tomcat插件
    (转)Activity的跳转与传值
    Android SDK下载和更新失败的解决方法
    Android客户端WebView控件与Javascript交互
    SCI期刊
  • 原文地址:https://www.cnblogs.com/e-shannon/p/10381338.html
Copyright © 2011-2022 走看看