Tor 0.4.9.0-alpha-dev
Macros | Functions | Variables
scheduler_kist.c File Reference

Implements the KIST cell scheduler. More...

#include "core/or/or.h"
#include "lib/buf/buffers.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/relay/routermode.h"
#include "core/or/channel.h"
#include "core/or/channeltls.h"
#include "core/or/scheduler.h"
#include "lib/math/fp.h"
#include "core/or/or_connection_st.h"

Go to the source code of this file.

Functions

static uint32_t socket_table_ent_hash (const socket_table_ent_t *ent)
 
static unsigned socket_table_ent_eq (const socket_table_ent_t *a, const socket_table_ent_t *b)
 
typedef HT_HEAD (HT_PROTOTYPE(socket_table_s, HT_PROTOTYPE(socket_table_ent_t)
 
static uint32_t outbuf_table_ent_hash (const outbuf_table_ent_t *ent)
 
static unsigned outbuf_table_ent_eq (const outbuf_table_ent_t *a, const outbuf_table_ent_t *b)
 
 HT_PROTOTYPE (outbuf_table_s, outbuf_table_ent_t, node, outbuf_table_ent_hash, outbuf_table_ent_eq)
 
 HT_GENERATE2 (outbuf_table_s, outbuf_table_ent_t, node, outbuf_table_ent_hash, outbuf_table_ent_eq, 0.6, tor_reallocarray, tor_free_)
 
static size_t channel_outbuf_length (channel_t *chan)
 
static int each_channel_write_to_kernel (outbuf_table_ent_t *ent, void *data)
 
static int free_outbuf_info_by_ent (outbuf_table_ent_t *ent, void *data)
 
static int free_socket_info_by_ent (socket_table_ent_t *ent, void *data)
 
static void free_all_socket_info (void)
 
static socket_table_ent_t * socket_table_search (socket_table_t *table, const channel_t *chan)
 
static void free_socket_info_by_chan (socket_table_t *table, const channel_t *chan)
 
void update_socket_info_impl (socket_table_ent_t *ent)
 
static void init_socket_info (socket_table_t *table, const channel_t *chan)
 
static void outbuf_table_add (outbuf_table_t *table, channel_t *chan)
 
static void outbuf_table_remove (outbuf_table_t *table, channel_t *chan)
 
static void set_scheduler_run_interval (void)
 
static int socket_can_write (socket_table_t *table, const channel_t *chan)
 
static void update_socket_info (socket_table_t *table, const channel_t *chan)
 
static void update_socket_written (socket_table_t *table, channel_t *chan, size_t bytes)
 
int channel_should_write_to_kernel (outbuf_table_t *table, channel_t *chan)
 
void channel_write_to_kernel (channel_t *chan)
 
static int have_work (void)
 
static void kist_free_all (void)
 
static void kist_on_channel_free_fn (const channel_t *chan)
 
static void kist_scheduler_on_new_consensus (void)
 
static void kist_scheduler_on_new_options (void)
 
static void kist_scheduler_init (void)
 
static void kist_scheduler_schedule (void)
 
static void kist_scheduler_run (void)
 
scheduler_tget_kist_scheduler (void)
 
int kist_scheduler_run_interval (void)
 
void scheduler_kist_set_lite_mode (void)
 
void scheduler_kist_set_full_mode (void)
 
int scheduler_can_use_kist (void)
 

Variables

 outbuf_table_ent_t
 
static monotime_t scheduler_last_run
 
static double sock_buf_size_factor = 1.0
 
STATIC int sched_run_interval = KIST_SCHED_RUN_INTERVAL_DEFAULT
 
static unsigned int kist_lite_mode = 1
 
static scheduler_t kist_scheduler
 

Detailed Description

Implements the KIST cell scheduler.

Definition in file scheduler_kist.c.

Macro Definition Documentation

◆ CHANNEL_OBJECT_PRIVATE

#define CHANNEL_OBJECT_PRIVATE

Definition at line 17 of file scheduler_kist.c.

◆ SCHEDULER_KIST_PRIVATE

#define SCHEDULER_KIST_PRIVATE

Definition at line 9 of file scheduler_kist.c.

◆ SCHEDULER_PRIVATE

#define SCHEDULER_PRIVATE

Definition at line 20 of file scheduler_kist.c.

Function Documentation

◆ channel_outbuf_length()

static size_t channel_outbuf_length ( channel_t chan)
inlinestatic

Definition at line 123 of file scheduler_kist.c.

◆ channel_should_write_to_kernel()

int channel_should_write_to_kernel ( outbuf_table_t *  table,
channel_t chan 
)

Definition at line 462 of file scheduler_kist.c.

◆ channel_write_to_kernel()

void channel_write_to_kernel ( channel_t chan)

Definition at line 472 of file scheduler_kist.c.

◆ each_channel_write_to_kernel()

static int each_channel_write_to_kernel ( outbuf_table_ent_t *  ent,
void *  data 
)
static

Definition at line 137 of file scheduler_kist.c.

◆ free_all_socket_info()

static void free_all_socket_info ( void  )
static

Definition at line 168 of file scheduler_kist.c.

◆ free_outbuf_info_by_ent()

static int free_outbuf_info_by_ent ( outbuf_table_ent_t *  ent,
void *  data 
)
static

Definition at line 146 of file scheduler_kist.c.

◆ free_socket_info_by_chan()

static void free_socket_info_by_chan ( socket_table_t *  table,
const channel_t chan 
)
static

Definition at line 185 of file scheduler_kist.c.

◆ free_socket_info_by_ent()

static int free_socket_info_by_ent ( socket_table_ent_t *  ent,
void *  data 
)
static

Definition at line 157 of file scheduler_kist.c.

◆ get_kist_scheduler()

scheduler_t * get_kist_scheduler ( void  )

Definition at line 793 of file scheduler_kist.c.

◆ have_work()

static int have_work ( void  )
static

Definition at line 498 of file scheduler_kist.c.

◆ HT_HEAD()

typedef HT_HEAD ( HT_PROTOTYPE socket_table_s,
HT_PROTOTYPE socket_table_ent_t 
)

Definition at line 55 of file scheduler_kist.c.

◆ init_socket_info()

static void init_socket_info ( socket_table_t *  table,
const channel_t chan 
)
static

Definition at line 332 of file scheduler_kist.c.

◆ kist_free_all()

static void kist_free_all ( void  )
static

Definition at line 509 of file scheduler_kist.c.

◆ kist_on_channel_free_fn()

static void kist_on_channel_free_fn ( const channel_t chan)
static

Definition at line 516 of file scheduler_kist.c.

◆ kist_scheduler_init()

static void kist_scheduler_init ( void  )
static

Definition at line 540 of file scheduler_kist.c.

◆ kist_scheduler_on_new_consensus()

static void kist_scheduler_on_new_consensus ( void  )
static

Definition at line 523 of file scheduler_kist.c.

◆ kist_scheduler_on_new_options()

static void kist_scheduler_on_new_options ( void  )
static

Definition at line 530 of file scheduler_kist.c.

◆ kist_scheduler_run()

static void kist_scheduler_run ( void  )
static

Definition at line 601 of file scheduler_kist.c.

◆ kist_scheduler_run_interval()

int kist_scheduler_run_interval ( void  )

Definition at line 808 of file scheduler_kist.c.

◆ kist_scheduler_schedule()

static void kist_scheduler_schedule ( void  )
static

Definition at line 564 of file scheduler_kist.c.

◆ outbuf_table_add()

static void outbuf_table_add ( outbuf_table_t *  table,
channel_t chan 
)
static

Definition at line 349 of file scheduler_kist.c.

◆ outbuf_table_ent_eq()

static unsigned outbuf_table_ent_eq ( const outbuf_table_ent_t *  a,
const outbuf_table_ent_t *  b 
)
static

Definition at line 81 of file scheduler_kist.c.

◆ outbuf_table_ent_hash()

static uint32_t outbuf_table_ent_hash ( const outbuf_table_ent_t *  ent)
static

Definition at line 75 of file scheduler_kist.c.

◆ outbuf_table_remove()

static void outbuf_table_remove ( outbuf_table_t *  table,
channel_t chan 
)
static

Definition at line 364 of file scheduler_kist.c.

◆ scheduler_can_use_kist()

int scheduler_can_use_kist ( void  )

Definition at line 878 of file scheduler_kist.c.

◆ scheduler_kist_set_full_mode()

void scheduler_kist_set_full_mode ( void  )

Definition at line 847 of file scheduler_kist.c.

◆ scheduler_kist_set_lite_mode()

void scheduler_kist_set_lite_mode ( void  )

Definition at line 837 of file scheduler_kist.c.

◆ set_scheduler_run_interval()

static void set_scheduler_run_interval ( void  )
static

Definition at line 377 of file scheduler_kist.c.

◆ socket_can_write()

static int socket_can_write ( socket_table_t *  table,
const channel_t chan 
)
static

Definition at line 390 of file scheduler_kist.c.

◆ socket_table_ent_eq()

static unsigned socket_table_ent_eq ( const socket_table_ent_t *  a,
const socket_table_ent_t *  b 
)
static

Definition at line 50 of file scheduler_kist.c.

◆ socket_table_ent_hash()

static uint32_t socket_table_ent_hash ( const socket_table_ent_t *  ent)
static

Definition at line 44 of file scheduler_kist.c.

◆ socket_table_search()

static socket_table_ent_t * socket_table_search ( socket_table_t *  table,
const channel_t chan 
)
static

Definition at line 175 of file scheduler_kist.c.

◆ update_socket_info()

static void update_socket_info ( socket_table_t *  table,
const channel_t chan 
)
static

Definition at line 410 of file scheduler_kist.c.

◆ update_socket_info_impl()

void update_socket_info_impl ( socket_table_ent_t *  ent)

Definition at line 200 of file scheduler_kist.c.

◆ update_socket_written()

static void update_socket_written ( socket_table_t *  table,
channel_t chan,
size_t  bytes 
)
static

Definition at line 427 of file scheduler_kist.c.

Variable Documentation

◆ kist_lite_mode

unsigned int kist_lite_mode = 1
static

Definition at line 114 of file scheduler_kist.c.

◆ kist_scheduler

scheduler_t kist_scheduler
static
Initial value:
= {
.type = SCHEDULER_KIST,
.free_all = kist_free_all,
.on_channel_free = kist_on_channel_free_fn,
.init = kist_scheduler_init,
.on_new_consensus = kist_scheduler_on_new_consensus,
.schedule = kist_scheduler_schedule,
.run = kist_scheduler_run,
.on_new_options = kist_scheduler_on_new_options,
}

Definition at line 779 of file scheduler_kist.c.

◆ outbuf_table_ent_t

outbuf_table_ent_t

Definition at line 72 of file scheduler_kist.c.

◆ sched_run_interval

STATIC int sched_run_interval = KIST_SCHED_RUN_INTERVAL_DEFAULT

Definition at line 103 of file scheduler_kist.c.

◆ scheduler_last_run

monotime_t scheduler_last_run
static

Definition at line 97 of file scheduler_kist.c.

◆ sock_buf_size_factor

double sock_buf_size_factor = 1.0
static

Definition at line 101 of file scheduler_kist.c.