X-Git-Url: http://git.onelab.eu/?p=distributedratelimiting.git;a=blobdiff_plain;f=drl%2Fratetypes.h;h=5430c2ded02ff9b04b7c03f32b74f018176a5fb1;hp=c88c93191367d45b29e14f1122f6d8d067c2c0f6;hb=c9d6255f0c06ee41eb2c06a5f74a957ec7be3223;hpb=0be9704d6b24d09ebd55beedec52758cb88c570b diff --git a/drl/ratetypes.h b/drl/ratetypes.h index c88c931..5430c2d 100644 --- a/drl/ratetypes.h +++ b/drl/ratetypes.h @@ -17,13 +17,14 @@ #include "rate_accounting/simple.h" #endif -#include "calendar.h" +#include "bsd_queue.h" #include "config.h" #include "drl_state.h" #include "common_accounting.h" #include "standard.h" #include "samplehold.h" #include "simple.h" +#include "multipleinterval.h" /** Represents a DRL entitiy/group. */ @@ -35,12 +36,26 @@ typedef struct identity { /** The global rate limit. */ uint32_t limit; + /** The effective global rate limit. Can be lower than the nominal global + * rate limit due to the failure of one or more peers. */ + uint32_t effective_limit; + /** The local rate limit. */ uint32_t locallimit; /** Pointer to the identity's parent in the HTB hierarchy. */ struct identity *parent; + /** For sets, indicates the parent should be 0x10. Meaningless for machines. */ + int independent; + + /** Array of the leaves that are limited by this identity. Points into the + * leaves array for the identity's instance. */ + struct leaf **leaves; + + /** The number of leaves for which this identity is responsible. */ + int leaf_count; + /** The fixed (per second) EWMA weight. */ double fixed_ewma_weight; @@ -71,18 +86,23 @@ typedef struct identity { /** FPS previous weight value. */ double last_localweight; + double total_weight; + /** A flag to indicate whether or not the identity is in the flowstart * state. During flowstart, the identity's limit is raised to allow for * flows to grow before incurring losses. */ int flowstart; + /** Keeps track of the state of FPS dampening for this identity. */ + enum dampenings dampen_state; + /* GRD */ /** GRD drop probability information. */ - double localdropprob; + double drop_prob; /** GRD previous drop probability information. */ - double last_localdropprob; + double last_drop_prob; /* Flow accounting machinery. */ @@ -117,17 +137,47 @@ typedef struct identity { /** Function to call when the table should be destroyed. */ void (*table_destroy_function)(void *); +#ifdef SHADOW_ACCTING + + common_accounting_t shadow_common; + + void *shadow_table; + + double localweight_copy; + double last_localweight_copy; + + enum dampenings dampen_state_copy; + +#endif + /* Scheduling bookkeeping. */ - /* Pointers to other identities in the scheduling calendar. */ - TAILQ_ENTRY(identity) calendar; + /** Scheduling unit that tells the limiter when to execute the main loop.*/ + struct ident_action *loop_action; - /* The number of limiter ticks at which this identity should be scheduled. - */ - uint32_t intervals; + /** Scheduling unit that tells the limiter when to communicate.*/ + struct ident_action *comm_action; + + /** The number of limiter ticks that should pass before this identity should + * be scheduled to execute its main estimate/allocate/enforce loop. */ + uint32_t mainloop_intervals; + + /** The number of limiter ticks that should pass before this identity should + * be scheduled for communication. */ + uint32_t communication_intervals; } identity_t; +enum identity_actions { ACTION_MAINLOOP = 1, ACTION_COMMUNICATE = 2 }; + +typedef struct ident_action { + struct identity *ident; + enum identity_actions action; + int valid; + + TAILQ_ENTRY(ident_action) calendar; +} identity_action; + /** * Represents the bottom most entity in the HTB hierarchy. For PlanetLab, * this corresponds to sliver (identified by Vserver context id, or xid). @@ -139,6 +189,13 @@ typedef struct leaf { /** The leaf's parent in the hierarchy. This is the identity to which this * leaf belongs. */ identity_t *parent; + + /** GRD: The leaf's packet drop probability. */ + double drop_prob; + + /** Only used for experimentation. */ + int delay; + } leaf_t; /** @@ -194,7 +251,7 @@ typedef struct limiter { uint32_t nodelimit; /** The DRL policy (GRD, FPS) this node is using. */ - enum policies policynum; + enum policies policy; /** The estimate interval (in milliseconds). */ int estintms;