NetSim Source Code Help
Loading...
Searching...
No Matches
CUBIC.c File Reference
#include "main.h"
#include "TCP.h"
#include <intrin.h>
Include dependency graph for CUBIC.c:

Go to the source code of this file.

Data Structures

struct  stru_cubic
 
struct  stru_congestion_var
 

Macros

#define clamp(val, lo, hi)   min(max(val, lo), hi)
 
#define tcp_time_stamp   ((UINT32)(pstruEventDetails->dEventTime/1000))
 
#define CUBIC_HZ   1024
 
#define BICTCP_BETA_SCALE
 
#define BICTCP_HZ   10 /* BIC HZ 2^10 = 1024 */
 
#define HYSTART_ACK_TRAIN   0x1
 
#define HYSTART_DELAY   0x2
 
#define HYSTART_MIN_SAMPLES   8
 
#define HYSTART_DELAY_MIN   (4U<<3)
 
#define HYSTART_DELAY_MAX   (16U<<3)
 
#define HYSTART_DELAY_THRESH(x)   clamp(x, HYSTART_DELAY_MIN, HYSTART_DELAY_MAX)
 
#define do_div(x, y)   (x=x/y)
 
#define after(seq2, seq1)   before(seq1, seq2)
 

Typedefs

typedef struct stru_cubic CUBIC
 
typedef struct stru_cubicPCUBIC
 
typedef struct stru_congestion_var CONGESTIONVAR
 
typedef struct stru_congestion_varPCONGESTIONVAR
 

Functions

static PCONGESTIONVAR get_congestionvar (PNETSIM_SOCKET s)
 
static void set_congestionvar (PNETSIM_SOCKET s, PCONGESTIONVAR data)
 
static void set_cwnd (PNETSIM_SOCKET s, UINT32 newcwnd)
 
static UINT32 get_cwnd (PNETSIM_SOCKET s)
 
static void set_ssthres (PNETSIM_SOCKET s, UINT32 newssthres)
 
static UINT32 get_ssthres (PNETSIM_SOCKET s)
 
static void increase_cwnd (PNETSIM_SOCKET s, UINT16 increase)
 
static bool tcp_in_slow_start (PNETSIM_SOCKET s)
 
static bool isDupAck (PNETSIM_SOCKET s, PCONGESTIONVAR var)
 
static UINT64 div64_u64 (UINT64 dividend, UINT64 divisor)
 
static bool before (UINT32 seq1, UINT32 seq2)
 
static UINT count_bit (UINT64 n)
 
static void slowStart (PNETSIM_SOCKET s, PCONGESTIONVAR var)
 
static void cubictcp_reset (PCUBIC ca)
 
static UINT32 cubictcp_clock (void)
 
static void cubictcp_hystart_reset (PNETSIM_SOCKET sk)
 
static void cubictcp_init (PNETSIM_SOCKET sk, PTCP_DEV_VAR tcp)
 
void init_cubic (PNETSIM_SOCKET s)
 
static UINT32 cubic_root (UINT64 a)
 
static UINT32 cubictcp_recalc_ssthresh (PNETSIM_SOCKET sk)
 
static void cubictcp_update (PNETSIM_SOCKET sk, UINT32 acked)
 
static void cubictcp_cong_avoid (PNETSIM_SOCKET sk, UINT32 segmentAcked)
 
static void hystart_update (PNETSIM_SOCKET sk, UINT32 delay)
 
static void cubictcp_acked (PNETSIM_SOCKET sk)
 
static void cubictcp_fastretransmit (PNETSIM_SOCKET s)
 
static void FastRecovery (PNETSIM_SOCKET s, PCONGESTIONVAR var)
 
void cubic_ack_received (PNETSIM_SOCKET s)
 

Variables

static int fast_convergence = 1
 
static int tcp_friendliness = 1
 
static int hystart = 1
 
static int hystart_detect = HYSTART_ACK_TRAIN | HYSTART_DELAY
 
static UINT32 cube_rtt_scale
 
static UINT32 beta_scale
 
static UINT32 cube_factor
 

Macro Definition Documentation

◆ after

#define after (   seq2,
  seq1 
)    before(seq1, seq2)

Definition at line 219 of file CUBIC.c.

◆ BICTCP_BETA_SCALE

#define BICTCP_BETA_SCALE
Value:
1024 /* Scale factor beta calculation
* max_cwnd = snd_cwnd * beta
*/

Definition at line 29 of file CUBIC.c.

◆ BICTCP_HZ

#define BICTCP_HZ   10 /* BIC HZ 2^10 = 1024 */

Definition at line 30 of file CUBIC.c.

◆ clamp

#define clamp (   val,
  lo,
  hi 
)    min(max(val, lo), hi)

Definition at line 24 of file CUBIC.c.

◆ CUBIC_HZ

#define CUBIC_HZ   1024

Definition at line 27 of file CUBIC.c.

◆ do_div

#define do_div (   x,
 
)    (x=x/y)

Definition at line 213 of file CUBIC.c.

◆ HYSTART_ACK_TRAIN

#define HYSTART_ACK_TRAIN   0x1

Definition at line 33 of file CUBIC.c.

◆ HYSTART_DELAY

#define HYSTART_DELAY   0x2

Definition at line 34 of file CUBIC.c.

◆ HYSTART_DELAY_MAX

#define HYSTART_DELAY_MAX   (16U<<3)

Definition at line 39 of file CUBIC.c.

◆ HYSTART_DELAY_MIN

#define HYSTART_DELAY_MIN   (4U<<3)

Definition at line 38 of file CUBIC.c.

◆ HYSTART_DELAY_THRESH

#define HYSTART_DELAY_THRESH (   x)    clamp(x, HYSTART_DELAY_MIN, HYSTART_DELAY_MAX)

Definition at line 40 of file CUBIC.c.

◆ HYSTART_MIN_SAMPLES

#define HYSTART_MIN_SAMPLES   8

Definition at line 37 of file CUBIC.c.

◆ tcp_time_stamp

#define tcp_time_stamp   ((UINT32)(pstruEventDetails->dEventTime/1000))

Definition at line 26 of file CUBIC.c.

Typedef Documentation

◆ CONGESTIONVAR

◆ CUBIC

typedef struct stru_cubic CUBIC

◆ PCONGESTIONVAR

◆ PCUBIC

typedef struct stru_cubic * PCUBIC

Function Documentation

◆ before()

static bool before ( UINT32  seq1,
UINT32  seq2 
)
inlinestatic

Definition at line 215 of file CUBIC.c.

◆ count_bit()

static UINT count_bit ( UINT64  n)
static

Definition at line 221 of file CUBIC.c.

Here is the caller graph for this function:

◆ cubic_ack_received()

void cubic_ack_received ( PNETSIM_SOCKET  s)

Definition at line 693 of file CUBIC.c.

◆ cubic_root()

static UINT32 cubic_root ( UINT64  a)
static

Definition at line 349 of file CUBIC.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cubictcp_acked()

static void cubictcp_acked ( PNETSIM_SOCKET  sk)
static

Definition at line 627 of file CUBIC.c.

Here is the call graph for this function:

◆ cubictcp_clock()

static UINT32 cubictcp_clock ( void  )
inlinestatic

Definition at line 258 of file CUBIC.c.

◆ cubictcp_cong_avoid()

static void cubictcp_cong_avoid ( PNETSIM_SOCKET  sk,
UINT32  segmentAcked 
)
static

Definition at line 541 of file CUBIC.c.

◆ cubictcp_fastretransmit()

static void cubictcp_fastretransmit ( PNETSIM_SOCKET  s)
static

Definition at line 642 of file CUBIC.c.

◆ cubictcp_hystart_reset()

static void cubictcp_hystart_reset ( PNETSIM_SOCKET  sk)
inlinestatic

Definition at line 263 of file CUBIC.c.

◆ cubictcp_init()

static void cubictcp_init ( PNETSIM_SOCKET  sk,
PTCP_DEV_VAR  tcp 
)
static

Definition at line 273 of file CUBIC.c.

◆ cubictcp_recalc_ssthresh()

static UINT32 cubictcp_recalc_ssthresh ( PNETSIM_SOCKET  sk)
static

Definition at line 393 of file CUBIC.c.

◆ cubictcp_reset()

static void cubictcp_reset ( PCUBIC  ca)
inlinestatic

Definition at line 243 of file CUBIC.c.

◆ cubictcp_update()

static void cubictcp_update ( PNETSIM_SOCKET  sk,
UINT32  acked 
)
inlinestatic

Definition at line 416 of file CUBIC.c.

Here is the call graph for this function:

◆ div64_u64()

static UINT64 div64_u64 ( UINT64  dividend,
UINT64  divisor 
)
inlinestatic

div64_u64 - unsigned 64bit divide with 64bit divisor

Definition at line 208 of file CUBIC.c.

Here is the caller graph for this function:

◆ FastRecovery()

static void FastRecovery ( PNETSIM_SOCKET  s,
PCONGESTIONVAR  var 
)
static

Definition at line 686 of file CUBIC.c.

◆ get_congestionvar()

static PCONGESTIONVAR get_congestionvar ( PNETSIM_SOCKET  s)
inlinestatic

Definition at line 108 of file CUBIC.c.

Here is the caller graph for this function:

◆ get_cwnd()

static UINT32 get_cwnd ( PNETSIM_SOCKET  s)
static

Definition at line 133 of file CUBIC.c.

Here is the caller graph for this function:

◆ get_ssthres()

static UINT32 get_ssthres ( PNETSIM_SOCKET  s)
static

Definition at line 161 of file CUBIC.c.

◆ hystart_update()

static void hystart_update ( PNETSIM_SOCKET  sk,
UINT32  delay 
)
static

Definition at line 578 of file CUBIC.c.

Here is the caller graph for this function:

◆ increase_cwnd()

static void increase_cwnd ( PNETSIM_SOCKET  s,
UINT16  increase 
)
static

Definition at line 175 of file CUBIC.c.

◆ init_cubic()

void init_cubic ( PNETSIM_SOCKET  s)

Definition at line 290 of file CUBIC.c.

◆ isDupAck()

static bool isDupAck ( PNETSIM_SOCKET  s,
PCONGESTIONVAR  var 
)
static

Definition at line 200 of file CUBIC.c.

◆ set_congestionvar()

static void set_congestionvar ( PNETSIM_SOCKET  s,
PCONGESTIONVAR  data 
)
inlinestatic

Definition at line 113 of file CUBIC.c.

◆ set_cwnd()

static void set_cwnd ( PNETSIM_SOCKET  s,
UINT32  newcwnd 
)
static

Definition at line 118 of file CUBIC.c.

◆ set_ssthres()

static void set_ssthres ( PNETSIM_SOCKET  s,
UINT32  newssthres 
)
static

Definition at line 147 of file CUBIC.c.

◆ slowStart()

static void slowStart ( PNETSIM_SOCKET  s,
PCONGESTIONVAR  var 
)
static

Definition at line 233 of file CUBIC.c.

◆ tcp_in_slow_start()

static bool tcp_in_slow_start ( PNETSIM_SOCKET  s)
inlinestatic

Definition at line 195 of file CUBIC.c.

Here is the caller graph for this function:

Variable Documentation

◆ beta_scale

UINT32 beta_scale
static

Definition at line 50 of file CUBIC.c.

◆ cube_factor

UINT32 cube_factor
static

Definition at line 51 of file CUBIC.c.

◆ cube_rtt_scale

UINT32 cube_rtt_scale
static

Definition at line 49 of file CUBIC.c.

◆ fast_convergence

int fast_convergence = 1
static

Definition at line 42 of file CUBIC.c.

◆ hystart

int hystart = 1
static

Definition at line 45 of file CUBIC.c.

◆ hystart_detect

int hystart_detect = HYSTART_ACK_TRAIN | HYSTART_DELAY
static

Definition at line 46 of file CUBIC.c.

◆ tcp_friendliness

int tcp_friendliness = 1
static

Definition at line 43 of file CUBIC.c.