Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_ppp.c
Show First 20 Lines • Show All 316 Lines • ▼ Show 20 Lines | |||||
static void ng_ppp_get_packet(node_p node, struct mbuf **mp); | static void ng_ppp_get_packet(node_p node, struct mbuf **mp); | ||||
static int ng_ppp_frag_process(node_p node, item_p oitem); | static int ng_ppp_frag_process(node_p node, item_p oitem); | ||||
static int ng_ppp_frag_trim(node_p node); | static int ng_ppp_frag_trim(node_p node); | ||||
static void ng_ppp_frag_timeout(node_p node, hook_p hook, void *arg1, | static void ng_ppp_frag_timeout(node_p node, hook_p hook, void *arg1, | ||||
int arg2); | int arg2); | ||||
static void ng_ppp_frag_checkstale(node_p node); | static void ng_ppp_frag_checkstale(node_p node); | ||||
static void ng_ppp_frag_reset(node_p node); | static void ng_ppp_frag_reset(node_p node); | ||||
static void ng_ppp_mp_strategy(node_p node, int len, int *distrib); | static void ng_ppp_mp_strategy(node_p node, int len, int *distrib); | ||||
static int ng_ppp_intcmp(void *latency, const void *v1, const void *v2); | static int ng_ppp_intcmp(const void *v1, const void *v2, void *latency); | ||||
static struct mbuf *ng_ppp_addproto(struct mbuf *m, uint16_t proto, int compOK); | static struct mbuf *ng_ppp_addproto(struct mbuf *m, uint16_t proto, int compOK); | ||||
static struct mbuf *ng_ppp_cutproto(struct mbuf *m, uint16_t *proto); | static struct mbuf *ng_ppp_cutproto(struct mbuf *m, uint16_t *proto); | ||||
static struct mbuf *ng_ppp_prepend(struct mbuf *m, const void *buf, int len); | static struct mbuf *ng_ppp_prepend(struct mbuf *m, const void *buf, int len); | ||||
static int ng_ppp_config_valid(node_p node, | static int ng_ppp_config_valid(node_p node, | ||||
const struct ng_ppp_node_conf *newConf); | const struct ng_ppp_node_conf *newConf); | ||||
static void ng_ppp_update(node_p node, int newConf); | static void ng_ppp_update(node_p node, int newConf); | ||||
static void ng_ppp_start_frag_timer(node_p node); | static void ng_ppp_start_frag_timer(node_p node); | ||||
static void ng_ppp_stop_frag_timer(node_p node); | static void ng_ppp_stop_frag_timer(node_p node); | ||||
▲ Show 20 Lines • Show All 1,977 Lines • ▼ Show 20 Lines | for (activeLinkNum = 0; | ||||
if (alink->bytesInQueue < 0) | if (alink->bytesInQueue < 0) | ||||
alink->bytesInQueue = 0; | alink->bytesInQueue = 0; | ||||
else | else | ||||
latency[activeLinkNum] += | latency[activeLinkNum] += | ||||
(100 * alink->bytesInQueue) / alink->conf.bandwidth; | (100 * alink->bytesInQueue) / alink->conf.bandwidth; | ||||
} | } | ||||
/* Sort active links by latency */ | /* Sort active links by latency */ | ||||
qsort_r(sortByLatency, | qsort_r(sortByLatency, priv->numActiveLinks, sizeof(*sortByLatency), | ||||
priv->numActiveLinks, sizeof(*sortByLatency), latency, ng_ppp_intcmp); | ng_ppp_intcmp, latency); | ||||
/* Find the interval we need (add links in sortByLatency[] order) */ | /* Find the interval we need (add links in sortByLatency[] order) */ | ||||
for (numFragments = 1; | for (numFragments = 1; | ||||
numFragments < priv->numActiveLinks; numFragments++) { | numFragments < priv->numActiveLinks; numFragments++) { | ||||
for (total = i = 0; i < numFragments; i++) { | for (total = i = 0; i < numFragments; i++) { | ||||
int flowTime; | int flowTime; | ||||
flowTime = latency[sortByLatency[numFragments]] | flowTime = latency[sortByLatency[numFragments]] | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | if (total < len) { | ||||
total -= delta; | total -= delta; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Compare two integers | * Compare two integers | ||||
*/ | */ | ||||
static int | static int | ||||
ng_ppp_intcmp(void *latency, const void *v1, const void *v2) | ng_ppp_intcmp(const void *v1, const void *v2, void *latency) | ||||
{ | { | ||||
const int index1 = *((const int *) v1); | const int index1 = *((const int *) v1); | ||||
const int index2 = *((const int *) v2); | const int index2 = *((const int *) v2); | ||||
return ((int *)latency)[index1] - ((int *)latency)[index2]; | return ((int *)latency)[index1] - ((int *)latency)[index2]; | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 232 Lines • Show Last 20 Lines |