#include <sys/param.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <netgraph/ng_message.h>
#include <netgraph/ng_parse.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_car.h>
#include "qos.h"
Go to the source code of this file.
|
static void | ng_car_refillhook (struct hookinfo *h) |
|
static void | ng_car_schedule (struct hookinfo *h) |
|
void | ng_car_q_event (node_p node, hook_p hook, void *arg, int arg2) |
|
static void | ng_car_enqueue (struct hookinfo *h, item_p item) |
|
| NETGRAPH_INIT (car, &ng_car_typestruct) |
|
static int | ng_car_constructor (node_p node) |
|
static int | ng_car_newhook (node_p node, hook_p hook, const char *name) |
|
static int | ng_car_rcvdata (hook_p hook, item_p item) |
|
static int | ng_car_rcvmsg (node_p node, item_p item, hook_p lasthook) |
|
static int | ng_car_shutdown (node_p node) |
|
static int | ng_car_disconnect (hook_p hook) |
|
◆ NG_CAR_PERFORM_MATCH_ACTION
#define NG_CAR_PERFORM_MATCH_ACTION |
( |
|
a, |
|
|
|
col |
|
) |
| |
Value: do { \
switch (a) { \
\
break; \
if (colp == NULL) { \
colp = (void *)m_tag_alloc( \
if (colp != NULL) \
m_tag_prepend(m, &colp->tag); \
} \
if (colp != NULL) \
colp->color = col; \
break; \
default: \
\
NG_FREE_ITEM(item); \
++hinfo->stats.dropped_pkts; \
return (0); \
} \
} while (0)
◆ NG_CAR_QUEUE_MIN_TH
#define NG_CAR_QUEUE_MIN_TH 8 /* Minimum RED threshold for SHAPE mode */ |
◆ NG_CAR_QUEUE_SIZE
#define NG_CAR_QUEUE_SIZE 100 /* Maximum queue size for SHAPE mode */ |
◆ priv_p
◆ NETGRAPH_INIT()
NETGRAPH_INIT |
( |
car |
, |
|
|
& |
ng_car_typestruct |
|
) |
| |
◆ ng_car_constructor()
static int ng_car_constructor |
( |
node_p |
node | ) |
|
|
static |
◆ ng_car_disconnect()
static int ng_car_disconnect |
( |
hook_p |
hook | ) |
|
|
static |
Definition at line 586 of file ng_car.c.
References hookinfo::hook, priv::lower, NG_CAR_QUEUE_SIZE, NG_FREE_M, NG_HOOK_NODE, NG_HOOK_PRIVATE, NG_NODE_IS_VALID, NG_NODE_NUMHOOKS, NG_NODE_PRIVATE, ng_rmnode_self(), hookinfo::q, hookinfo::q_first, hookinfo::q_last, and priv::upper.
◆ ng_car_enqueue()
Definition at line 744 of file ng_car.c.
References m_qos_color::color, hookinfo::conf, ng_car_hookstats::dropped_pkts, M_QOS_COLOR, M_QOS_COOKIE, NG_CAR_COLOR_AWARE, NG_CAR_COUNT_PACKETS, NG_CAR_QUEUE_MIN_TH, NG_CAR_QUEUE_SIZE, ng_car_schedule(), NG_FREE_ITEM, NG_FREE_M, NGI_GET_M, ng_car_hookconf::opt, hookinfo::q, hookinfo::q_first, hookinfo::q_last, hookinfo::q_mtx, QOS_COLOR_GREEN, QOS_COLOR_RED, ng_car_hookstats::red_pkts, hookinfo::stats, hookinfo::tc, hookinfo::te, and ng_car_hookstats::yellow_pkts.
Referenced by ng_car_rcvdata().
◆ ng_car_newhook()
static int ng_car_newhook |
( |
node_p |
node, |
|
|
hook_p |
hook, |
|
|
const char * |
name |
|
) |
| |
|
static |
◆ ng_car_q_event()
void ng_car_q_event |
( |
node_p |
node, |
|
|
hook_p |
hook, |
|
|
void * |
arg, |
|
|
int |
arg2 |
|
) |
| |
Definition at line 698 of file ng_car.c.
References hookinfo::conf, hookinfo::dest, ng_car_hookstats::errors, hookinfo::hook, NG_CAR_COUNT_PACKETS, NG_CAR_QUEUE_SIZE, ng_car_refillhook(), ng_car_schedule(), NG_HOOK_PRIVATE, NG_SEND_DATA_ONLY, ng_car_hookconf::opt, ng_car_hookstats::passed_pkts, hookinfo::q, hookinfo::q_first, hookinfo::q_last, hookinfo::stats, and hookinfo::tc.
Referenced by ng_car_schedule().
◆ ng_car_rcvdata()
Definition at line 263 of file ng_car.c.
References m_qos_color::color, hookinfo::conf, hookinfo::dest, ng_car_hookconf::ebs, ng_car_hookstats::errors, ng_car_hookconf::green_action, ng_car_hookstats::green_pkts, hookinfo::hook, M_QOS_COLOR, M_QOS_COOKIE, ng_car_hookconf::mode, NG_CAR_COLOR_AWARE, NG_CAR_COUNT_PACKETS, ng_car_enqueue(), NG_CAR_PERFORM_MATCH_ACTION, NG_CAR_RED, ng_car_refillhook(), NG_CAR_SHAPE, NG_FWD_ITEM_HOOK, NG_HOOK_PRIVATE, NGI_M, ng_car_hookconf::opt, ng_car_hookstats::passed_pkts, hookinfo::q_first, hookinfo::q_last, QOS_COLOR_GREEN, QOS_COLOR_RED, QOS_COLOR_YELLOW, ng_car_hookconf::red_action, ng_car_hookstats::red_pkts, hookinfo::stats, hookinfo::tc, hookinfo::te, ng_car_hookconf::yellow_action, and ng_car_hookstats::yellow_pkts.
◆ ng_car_rcvmsg()
Definition at line 412 of file ng_car.c.
References ng_mesg::ng_msghdr::arglen, ng_car_hookconf::cbs, ng_car_hookconf::cir, ng_mesg::ng_msghdr::cmd, ng_mesg::data, ng_car_bulkstats::downstream, ng_car_bulkconf::downstream, ng_car_hookconf::ebs, ng_mesg::header, priv::lower, ng_car_hookconf::mode, NG_CAR_COUNT_PACKETS, NG_CAR_RED, NG_CAR_SHAPE, NG_FREE_MSG, NG_MKRESPONSE, NG_NODE_PRIVATE, NG_RESPOND_MSG, NGI_GET_MSG, NGM_CAR_CLR_STATS, NGM_CAR_COOKIE, NGM_CAR_GET_CONF, NGM_CAR_GET_STATS, NGM_CAR_GETCLR_STATS, NGM_CAR_SET_CONF, ng_car_hookconf::opt, ng_car_hookconf::pir, ng_mesg::ng_msghdr::typecookie, priv::upper, ng_car_bulkstats::upstream, and ng_car_bulkconf::upstream.
◆ ng_car_refillhook()
static void ng_car_refillhook |
( |
struct hookinfo * |
h | ) |
|
|
static |
Definition at line 618 of file ng_car.c.
References ng_car_hookconf::cbs, ng_car_hookconf::cir, hookinfo::conf, ng_car_hookconf::ebs, hookinfo::lastRefill, ng_car_hookconf::mode, NG_CAR_DOUBLE_RATE, NG_CAR_SINGLE_RATE, ng_car_hookconf::pir, hookinfo::tc, and hookinfo::te.
Referenced by ng_car_q_event(), and ng_car_rcvdata().
◆ ng_car_schedule()
static void ng_car_schedule |
( |
struct hookinfo * |
h | ) |
|
|
static |
◆ ng_car_shutdown()
static int ng_car_shutdown |
( |
node_p |
node | ) |
|
|
static |
◆ ng_car_bulkconf_type
Initial value:= {
}
static const struct ng_parse_struct_field ng_car_bulkconf_type_fields[]
const struct ng_parse_type ng_parse_struct_type
Definition at line 125 of file ng_car.c.
◆ ng_car_bulkconf_type_fields
◆ ng_car_bulkstats_type
Initial value:= {
}
static const struct ng_parse_struct_field ng_car_bulkstats_type_fields[]
Definition at line 109 of file ng_car.c.
◆ ng_car_bulkstats_type_fields
◆ ng_car_cmdlist
◆ ng_car_constructor
◆ ng_car_disconnect
◆ ng_car_hookconf_type
Initial value:= {
}
static const struct ng_parse_struct_field ng_car_hookconf_type_fields[]
Definition at line 117 of file ng_car.c.
◆ ng_car_hookconf_type_fields
◆ ng_car_hookstats_type
Initial value:= {
}
static const struct ng_parse_struct_field ng_car_hookstats_type_fields[]
Definition at line 101 of file ng_car.c.
◆ ng_car_hookstats_type_fields
◆ ng_car_newhook
◆ ng_car_rcvdata
◆ ng_car_rcvmsg
◆ ng_car_shutdown
◆ ng_car_typestruct
Initial value:= {
}
static ng_rcvdata_t ng_car_rcvdata
static ng_newhook_t ng_car_newhook
static ng_disconnect_t ng_car_disconnect
static ng_shutdown_t ng_car_shutdown
static struct ng_cmdlist ng_car_cmdlist[]
static ng_constructor_t ng_car_constructor
static ng_rcvmsg_t ng_car_rcvmsg
Definition at line 172 of file ng_car.c.