Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netpfil/ipfw/ip_dn_private.h
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
#define DN_BH_LOCK_ASSERT() mtx_assert(&dn_cfg.uh_mtx, MA_OWNED) | #define DN_BH_LOCK_ASSERT() mtx_assert(&dn_cfg.uh_mtx, MA_OWNED) | ||||
SLIST_HEAD(dn_schk_head, dn_schk); | SLIST_HEAD(dn_schk_head, dn_schk); | ||||
SLIST_HEAD(dn_sch_inst_head, dn_sch_inst); | SLIST_HEAD(dn_sch_inst_head, dn_sch_inst); | ||||
SLIST_HEAD(dn_fsk_head, dn_fsk); | SLIST_HEAD(dn_fsk_head, dn_fsk); | ||||
SLIST_HEAD(dn_queue_head, dn_queue); | SLIST_HEAD(dn_queue_head, dn_queue); | ||||
SLIST_HEAD(dn_alg_head, dn_alg); | SLIST_HEAD(dn_alg_head, dn_alg); | ||||
#ifdef NEW_AQM | |||||
SLIST_HEAD(dn_aqm_head, dn_aqm); /* for new AQMs */ | |||||
#endif | |||||
struct mq { /* a basic queue of packets*/ | struct mq { /* a basic queue of packets*/ | ||||
struct mbuf *head, *tail; | struct mbuf *head, *tail; | ||||
int count; | int count; | ||||
}; | }; | ||||
static inline void | static inline void | ||||
set_oid(struct dn_id *o, int type, int len) | set_oid(struct dn_id *o, int type, int len) | ||||
{ | { | ||||
Show All 39 Lines | struct dn_parms { | ||||
* buckets. fshash is looked up at every packet arrival | * buckets. fshash is looked up at every packet arrival | ||||
* so better be generous if we expect many entries. | * so better be generous if we expect many entries. | ||||
*/ | */ | ||||
struct dn_ht *fshash; | struct dn_ht *fshash; | ||||
struct dn_ht *schedhash; | struct dn_ht *schedhash; | ||||
/* list of flowsets without a scheduler -- use sch_chain */ | /* list of flowsets without a scheduler -- use sch_chain */ | ||||
struct dn_fsk_head fsu; /* list of unlinked flowsets */ | struct dn_fsk_head fsu; /* list of unlinked flowsets */ | ||||
struct dn_alg_head schedlist; /* list of algorithms */ | struct dn_alg_head schedlist; /* list of algorithms */ | ||||
#ifdef NEW_AQM | |||||
struct dn_aqm_head aqmlist; /* list of AQMs */ | |||||
#endif | |||||
/* Store the fs/sch to scan when draining. The value is the | /* Store the fs/sch to scan when draining. The value is the | ||||
* bucket number of the hash table. Expire can be disabled | * bucket number of the hash table. Expire can be disabled | ||||
* with net.inet.ip.dummynet.expire=0, or it happens every | * with net.inet.ip.dummynet.expire=0, or it happens every | ||||
* expire ticks. | * expire ticks. | ||||
**/ | **/ | ||||
int drain_fs; | int drain_fs; | ||||
int drain_sch; | int drain_sch; | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | struct dn_fsk { /* kernel side of a flowset */ | ||||
u_int c_3 ; /* for GRED, (1-max_p)/max_th (scaled) */ | u_int c_3 ; /* for GRED, (1-max_p)/max_th (scaled) */ | ||||
u_int c_4 ; /* for GRED, 1 - 2*max_p (scaled) */ | u_int c_4 ; /* for GRED, 1 - 2*max_p (scaled) */ | ||||
u_int * w_q_lookup ; /* lookup table for computing (1-w_q)^t */ | u_int * w_q_lookup ; /* lookup table for computing (1-w_q)^t */ | ||||
u_int lookup_depth ; /* depth of lookup table */ | u_int lookup_depth ; /* depth of lookup table */ | ||||
int lookup_step ; /* granularity inside the lookup table */ | int lookup_step ; /* granularity inside the lookup table */ | ||||
int lookup_weight ; /* equal to (1-w_q)^t / (1-w_q)^(t+1) */ | int lookup_weight ; /* equal to (1-w_q)^t / (1-w_q)^(t+1) */ | ||||
int avg_pkt_size ; /* medium packet size */ | int avg_pkt_size ; /* medium packet size */ | ||||
int max_pkt_size ; /* max packet size */ | int max_pkt_size ; /* max packet size */ | ||||
#ifdef NEW_AQM | |||||
struct dn_aqm *aqmfp; /* Pointer to AQM functions */ | |||||
void *aqmcfg; /* configuration parameters for AQM */ | |||||
#endif | |||||
}; | }; | ||||
/* | /* | ||||
* A queue is created as a child of a flowset unless it belongs to | * A queue is created as a child of a flowset unless it belongs to | ||||
* a !MULTIQUEUE scheduler. It is normally in a hash table in the | * a !MULTIQUEUE scheduler. It is normally in a hash table in the | ||||
* flowset. fs always points to the parent flowset. | * flowset. fs always points to the parent flowset. | ||||
* si normally points to the sch_inst, unless the flowset has been | * si normally points to the sch_inst, unless the flowset has been | ||||
* detached from the scheduler -- in this case si == NULL and we | * detached from the scheduler -- in this case si == NULL and we | ||||
* should not enqueue. | * should not enqueue. | ||||
*/ | */ | ||||
struct dn_queue { | struct dn_queue { | ||||
struct dn_flow ni; /* oid, flow_id, stats */ | struct dn_flow ni; /* oid, flow_id, stats */ | ||||
struct mq mq; /* packets queue */ | struct mq mq; /* packets queue */ | ||||
struct dn_sch_inst *_si; /* owner scheduler instance */ | struct dn_sch_inst *_si; /* owner scheduler instance */ | ||||
SLIST_ENTRY(dn_queue) q_next; /* hash chain list for qht */ | SLIST_ENTRY(dn_queue) q_next; /* hash chain list for qht */ | ||||
struct dn_fsk *fs; /* parent flowset. */ | struct dn_fsk *fs; /* parent flowset. */ | ||||
/* RED parameters */ | /* RED parameters */ | ||||
int avg; /* average queue length est. (scaled) */ | int avg; /* average queue length est. (scaled) */ | ||||
int count; /* arrivals since last RED drop */ | int count; /* arrivals since last RED drop */ | ||||
int random; /* random value (scaled) */ | int random; /* random value (scaled) */ | ||||
uint64_t q_time; /* start of queue idle time */ | uint64_t q_time; /* start of queue idle time */ | ||||
#ifdef NEW_AQM | |||||
void *aqm_status; /* per-queue status variables*/ | |||||
#endif | |||||
}; | }; | ||||
/* | /* | ||||
* The kernel side of a scheduler. Contains the userland config, | * The kernel side of a scheduler. Contains the userland config, | ||||
* a link, pointer to extra config arguments from command line, | * a link, pointer to extra config arguments from command line, | ||||
* kernel flags, and a pointer to the scheduler methods. | * kernel flags, and a pointer to the scheduler methods. | ||||
* It is stored in a hash table, and holds a list of all | * It is stored in a hash table, and holds a list of all | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | |||||
int dn_compat_copy_pipe(struct copy_args *a, void *_o); | int dn_compat_copy_pipe(struct copy_args *a, void *_o); | ||||
int copy_data_helper_compat(void *_o, void *_arg); | int copy_data_helper_compat(void *_o, void *_arg); | ||||
int dn_compat_calc_size(void); | int dn_compat_calc_size(void); | ||||
int do_config(void *p, int l); | int do_config(void *p, int l); | ||||
/* function to drain idle object */ | /* function to drain idle object */ | ||||
void dn_drain_scheduler(void); | void dn_drain_scheduler(void); | ||||
void dn_drain_queue(void); | void dn_drain_queue(void); | ||||
#ifdef NEW_AQM | |||||
int ecn_mark(struct mbuf* m); | |||||
/* moved from ip_dn_io.c to here to be available for AQMs modules*/ | |||||
static inline void | |||||
mq_append(struct mq *q, struct mbuf *m) | |||||
{ | |||||
#ifdef USERSPACE | |||||
// buffers from netmap need to be copied | |||||
// XXX note that the routine is not expected to fail | |||||
ND("append %p to %p", m, q); | |||||
if (m->m_flags & M_STACK) { | |||||
struct mbuf *m_new; | |||||
void *p; | |||||
int l, ofs; | |||||
ofs = m->m_data - m->__m_extbuf; | |||||
// XXX allocate | |||||
MGETHDR(m_new, M_NOWAIT, MT_DATA); | |||||
ND("*** WARNING, volatile buf %p ext %p %d dofs %d m_new %p", | |||||
m, m->__m_extbuf, m->__m_extlen, ofs, m_new); | |||||
p = m_new->__m_extbuf; /* new pointer */ | |||||
l = m_new->__m_extlen; /* new len */ | |||||
if (l <= m->__m_extlen) { | |||||
panic("extlen too large"); | |||||
} | |||||
*m_new = *m; // copy | |||||
m_new->m_flags &= ~M_STACK; | |||||
m_new->__m_extbuf = p; // point to new buffer | |||||
_pkt_copy(m->__m_extbuf, p, m->__m_extlen); | |||||
m_new->m_data = p + ofs; | |||||
m = m_new; | |||||
} | |||||
#endif /* USERSPACE */ | |||||
if (q->head == NULL) | |||||
q->head = m; | |||||
else | |||||
q->tail->m_nextpkt = m; | |||||
q->count++; | |||||
q->tail = m; | |||||
m->m_nextpkt = NULL; | |||||
} | |||||
#endif /* NEW_AQM */ | |||||
#endif /* _IP_DN_PRIVATE_H */ | #endif /* _IP_DN_PRIVATE_H */ |