dummynet: Move packet counters into dn_cfg
Move the packets counters into the dn_cfg struct. This reduces the global name space use for dummynet and will make future work for things like vnet support and re-use in pf easier. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29245
This commit is contained in:
parent
df7549775c
commit
cd5671efc0
@ -53,9 +53,6 @@ typedef int32_t aqm_stime_t;
|
|||||||
/* Macro for variable bounding */
|
/* Macro for variable bounding */
|
||||||
#define BOUND_VAR(x,l,h) ((x) > (h)? (h) : ((x) > (l)? (x) : (l)))
|
#define BOUND_VAR(x,l,h) ((x) > (h)? (h) : ((x) > (l)? (x) : (l)))
|
||||||
|
|
||||||
/* sysctl variable to count number of dropped packets */
|
|
||||||
extern unsigned long io_pkt_drop;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure for holding data and function pointers that together represent a
|
* Structure for holding data and function pointers that together represent a
|
||||||
* AQM algorithm.
|
* AQM algorithm.
|
||||||
@ -137,7 +134,7 @@ update_stats(struct dn_queue *q, int len, int drop)
|
|||||||
if (drop) {
|
if (drop) {
|
||||||
qni->drops++;
|
qni->drops++;
|
||||||
sni->drops++;
|
sni->drops++;
|
||||||
io_pkt_drop++;
|
dn_cfg.io_pkt_drop++;
|
||||||
} else {
|
} else {
|
||||||
/*update queue stats */
|
/*update queue stats */
|
||||||
qni->length += inc;
|
qni->length += inc;
|
||||||
|
@ -104,7 +104,7 @@ fq_update_stats(struct fq_codel_flow *q, struct fq_codel_si *si, int len,
|
|||||||
si->main_q.ni.drops ++;
|
si->main_q.ni.drops ++;
|
||||||
q->stats.drops ++;
|
q->stats.drops ++;
|
||||||
si->_si.ni.drops ++;
|
si->_si.ni.drops ++;
|
||||||
io_pkt_drop ++;
|
dn_cfg.io_pkt_drop ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!drop || (drop && len < 0)) {
|
if (!drop || (drop && len < 0)) {
|
||||||
|
@ -299,7 +299,7 @@ fq_update_stats(struct fq_pie_flow *q, struct fq_pie_si *si, int len,
|
|||||||
si->main_q.ni.drops ++;
|
si->main_q.ni.drops ++;
|
||||||
q->stats.drops ++;
|
q->stats.drops ++;
|
||||||
si->_si.ni.drops ++;
|
si->_si.ni.drops ++;
|
||||||
io_pkt_drop ++;
|
dn_cfg.io_pkt_drop ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!drop || (drop && len < 0)) {
|
if (!drop || (drop && len < 0)) {
|
||||||
|
@ -88,14 +88,6 @@ static long tick_lost; /* Lost(coalesced) ticks number. */
|
|||||||
/* Adjusted vs non-adjusted curr_time difference (ticks). */
|
/* Adjusted vs non-adjusted curr_time difference (ticks). */
|
||||||
static long tick_diff;
|
static long tick_diff;
|
||||||
|
|
||||||
static unsigned long io_pkt;
|
|
||||||
static unsigned long io_pkt_fast;
|
|
||||||
|
|
||||||
#ifdef NEW_AQM
|
|
||||||
unsigned long io_pkt_drop;
|
|
||||||
#else
|
|
||||||
static unsigned long io_pkt_drop;
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* We use a heap to store entities for which we have pending timer events.
|
* We use a heap to store entities for which we have pending timer events.
|
||||||
* The heap is checked at every tick and all entities with expired events
|
* The heap is checked at every tick and all entities with expired events
|
||||||
@ -228,13 +220,13 @@ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, fsk_count,
|
|||||||
SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, queue_count,
|
SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, queue_count,
|
||||||
CTLFLAG_RD, DC(queue_count), 0, "Number of queues");
|
CTLFLAG_RD, DC(queue_count), 0, "Number of queues");
|
||||||
SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt,
|
SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt,
|
||||||
CTLFLAG_RD, &io_pkt, 0,
|
CTLFLAG_RD, DC(io_pkt), 0,
|
||||||
"Number of packets passed to dummynet.");
|
"Number of packets passed to dummynet.");
|
||||||
SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_fast,
|
SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_fast,
|
||||||
CTLFLAG_RD, &io_pkt_fast, 0,
|
CTLFLAG_RD, DC(io_pkt_fast), 0,
|
||||||
"Number of packets bypassed dummynet scheduler.");
|
"Number of packets bypassed dummynet scheduler.");
|
||||||
SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_drop,
|
SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_drop,
|
||||||
CTLFLAG_RD, &io_pkt_drop, 0,
|
CTLFLAG_RD, DC(io_pkt_drop), 0,
|
||||||
"Number of packets dropped by dummynet.");
|
"Number of packets dropped by dummynet.");
|
||||||
#undef DC
|
#undef DC
|
||||||
SYSEND
|
SYSEND
|
||||||
@ -540,7 +532,7 @@ dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop)
|
|||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
io_pkt_drop++;
|
dn_cfg.io_pkt_drop++;
|
||||||
q->ni.drops++;
|
q->ni.drops++;
|
||||||
ni->drops++;
|
ni->drops++;
|
||||||
FREE_PKT(m);
|
FREE_PKT(m);
|
||||||
@ -882,7 +874,7 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa)
|
|||||||
else if (fwa->flags & IPFW_ARGS_IP6)
|
else if (fwa->flags & IPFW_ARGS_IP6)
|
||||||
dir |= PROTO_IPV6;
|
dir |= PROTO_IPV6;
|
||||||
DN_BH_WLOCK();
|
DN_BH_WLOCK();
|
||||||
io_pkt++;
|
dn_cfg.io_pkt++;
|
||||||
/* we could actually tag outside the lock, but who cares... */
|
/* we could actually tag outside the lock, but who cares... */
|
||||||
if (tag_mbuf(m, dir, fwa))
|
if (tag_mbuf(m, dir, fwa))
|
||||||
goto dropit;
|
goto dropit;
|
||||||
@ -918,7 +910,7 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa)
|
|||||||
m = *m0 = NULL;
|
m = *m0 = NULL;
|
||||||
|
|
||||||
/* dn_enqueue already increases io_pkt_drop */
|
/* dn_enqueue already increases io_pkt_drop */
|
||||||
io_pkt_drop--;
|
dn_cfg.io_pkt_drop--;
|
||||||
|
|
||||||
goto dropit;
|
goto dropit;
|
||||||
}
|
}
|
||||||
@ -956,7 +948,7 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa)
|
|||||||
|
|
||||||
tag->m_tag_cookie = MTAG_IPFW_RULE;
|
tag->m_tag_cookie = MTAG_IPFW_RULE;
|
||||||
tag->m_tag_id = 0;
|
tag->m_tag_id = 0;
|
||||||
io_pkt_fast++;
|
dn_cfg.io_pkt_fast++;
|
||||||
if (m->m_nextpkt != NULL) {
|
if (m->m_nextpkt != NULL) {
|
||||||
printf("dummynet: fast io: pkt chain detected!\n");
|
printf("dummynet: fast io: pkt chain detected!\n");
|
||||||
m->m_nextpkt = NULL;
|
m->m_nextpkt = NULL;
|
||||||
@ -972,7 +964,7 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dropit:
|
dropit:
|
||||||
io_pkt_drop++;
|
dn_cfg.io_pkt_drop++;
|
||||||
DN_BH_WUNLOCK();
|
DN_BH_WUNLOCK();
|
||||||
if (m)
|
if (m)
|
||||||
FREE_PKT(m);
|
FREE_PKT(m);
|
||||||
|
@ -131,6 +131,11 @@ struct dn_parms {
|
|||||||
int fsk_count;
|
int fsk_count;
|
||||||
int queue_count;
|
int queue_count;
|
||||||
|
|
||||||
|
/* packet counters */
|
||||||
|
unsigned long io_pkt;
|
||||||
|
unsigned long io_pkt_fast;
|
||||||
|
unsigned long io_pkt_drop;
|
||||||
|
|
||||||
/* ticks and other stuff */
|
/* ticks and other stuff */
|
||||||
uint64_t curr_time;
|
uint64_t curr_time;
|
||||||
/* flowsets and schedulers are in hash tables, with 'hash_size'
|
/* flowsets and schedulers are in hash tables, with 'hash_size'
|
||||||
|
Loading…
Reference in New Issue
Block a user