1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-08 09:39:38 +00:00

remove m_pulldown statistics, which is highly experimental and does not

belong to *bsd-merged tree
This commit is contained in:
Jun-ichiro itojun Hagino 2000-07-12 16:39:13 +00:00
parent 60498ea783
commit f38211642f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=63024
3 changed files with 4 additions and 113 deletions

View File

@ -66,23 +66,13 @@
* @(#)uipc_mbuf.c 8.4 (Berkeley) 2/14/95
*/
#define PULLDOWN_STAT
/*#define PULLDOWN_DEBUG*/
#ifdef PULLDOWN_STAT
#include "opt_inet.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#if defined(PULLDOWN_STAT) && defined(INET6)
#include <netinet/in.h>
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
#endif
/*
* ensure that [off, off + len) is contiguous on the mbuf chain "m".
@ -103,10 +93,6 @@ m_pulldown(m, off, len, offp)
struct mbuf *n, *o;
int hlen, tlen, olen;
int sharedcluster;
#if defined(PULLDOWN_STAT) && defined(INET6)
static struct mbuf *prev = NULL;
int prevlen = 0, prevmlen = 0;
#endif
/* check invalid arguments. */
if (m == NULL)
@ -116,72 +102,6 @@ m_pulldown(m, off, len, offp)
return NULL; /* impossible */
}
#if defined(PULLDOWN_STAT) && defined(INET6)
ip6stat.ip6s_pulldown++;
#endif
#if defined(PULLDOWN_STAT) && defined(INET6)
/* statistics for m_pullup */
ip6stat.ip6s_pullup++;
if (off + len > MHLEN)
ip6stat.ip6s_pullup_fail++;
else {
int dlen, mlen;
dlen = (prev == m) ? prevlen : m->m_len;
mlen = (prev == m) ? prevmlen : m->m_len + M_TRAILINGSPACE(m);
if (dlen >= off + len)
ip6stat.ip6s_pullup--; /* call will not be made! */
else if ((m->m_flags & M_EXT) != 0) {
ip6stat.ip6s_pullup_alloc++;
ip6stat.ip6s_pullup_copy++;
} else {
if (mlen >= off + len)
ip6stat.ip6s_pullup_copy++;
else {
ip6stat.ip6s_pullup_alloc++;
ip6stat.ip6s_pullup_copy++;
}
}
prevlen = off + len;
prevmlen = MHLEN;
}
/* statistics for m_pullup2 */
ip6stat.ip6s_pullup2++;
if (off + len > MCLBYTES)
ip6stat.ip6s_pullup2_fail++;
else {
int dlen, mlen;
dlen = (prev == m) ? prevlen : m->m_len;
mlen = (prev == m) ? prevmlen : m->m_len + M_TRAILINGSPACE(m);
prevlen = off + len;
prevmlen = mlen;
if (dlen >= off + len)
ip6stat.ip6s_pullup2--; /* call will not be made! */
else if ((m->m_flags & M_EXT) != 0) {
ip6stat.ip6s_pullup2_alloc++;
ip6stat.ip6s_pullup2_copy++;
prevmlen = (off + len > MHLEN) ? MCLBYTES : MHLEN;
} else {
if (mlen >= off + len)
ip6stat.ip6s_pullup2_copy++;
else {
ip6stat.ip6s_pullup2_alloc++;
ip6stat.ip6s_pullup2_copy++;
prevmlen = (off + len > MHLEN) ? MCLBYTES
: MHLEN;
}
}
}
prev = m;
#endif
#ifdef PULLDOWN_DEBUG
{
struct mbuf *t;
@ -213,10 +133,6 @@ m_pulldown(m, off, len, offp)
if ((off == 0 || offp) && len <= n->m_len - off)
goto ok;
#if defined(PULLDOWN_STAT) && defined(INET6)
ip6stat.ip6s_pulldown_copy++;
#endif
/*
* when len < n->m_len - off and off != 0, it is a special case.
* len bytes from <n, off> sits in single mbuf, but the caller does
@ -293,9 +209,6 @@ m_pulldown(m, off, len, offp)
* now, we need to do the hard way. don't m_copy as there's no room
* on both end.
*/
#if defined(PULLDOWN_STAT) && defined(INET6)
ip6stat.ip6s_pulldown_alloc++;
#endif
MGET(o, M_DONTWAIT, m->m_type);
if (o == NULL) {
m_freem(m);

View File

@ -214,36 +214,30 @@ struct ip6_frag {
* supposed to never be matched but is prepared just in case.
*/
#ifdef INET6
#define IP6_EXTHDR_STAT(x) x
#else
#define IP6_EXTHDR_STAT(x)
#endif
#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \
do { \
if ((m)->m_next != NULL) { \
if (((m)->m_flags & M_LOOP) && \
((m)->m_len < (off) + (hlen)) && \
(((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrtoolong++); \
ip6stat.ip6s_exthdrtoolong++; \
return ret; \
} else if ((m)->m_flags & M_EXT) { \
if ((m)->m_len < (off) + (hlen)) { \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrtoolong++); \
ip6stat.ip6s_exthdrtoolong++; \
m_freem(m); \
return ret; \
} \
} else { \
if ((m)->m_len < (off) + (hlen)) { \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrtoolong++); \
ip6stat.ip6s_exthdrtoolong++; \
m_freem(m); \
return ret; \
} \
} \
} else { \
if ((m)->m_len < (off) + (hlen)) { \
IP6_EXTHDR_STAT(ip6stat.ip6s_tooshort++); \
ip6stat.ip6s_tooshort++; \
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \
m_freem(m); \
return ret; \
@ -265,7 +259,6 @@ do { \
do { \
struct mbuf *t; \
int tmp; \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrget++); \
if ((m)->m_len >= (off) + (len)) \
(val) = (typ)(mtod((m), caddr_t) + (off)); \
else { \
@ -284,7 +277,6 @@ do { \
#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
do { \
struct mbuf *t; \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrget0++); \
if ((off) == 0) \
(val) = (typ)mtod(m, caddr_t); \
else { \

View File

@ -170,20 +170,6 @@ struct ip6stat {
u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */
u_quad_t ip6s_nogif; /* no match gif found */
u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */
/* XXX the following two items are not really AF_INET6 thing */
u_quad_t ip6s_exthdrget; /* # of calls to IP6_EXTHDR_GET */
u_quad_t ip6s_exthdrget0; /* # of calls to IP6_EXTHDR_GET0 */
u_quad_t ip6s_pulldown; /* # of calls to m_pulldown */
u_quad_t ip6s_pulldown_copy; /* # of mbuf copies in m_pulldown */
u_quad_t ip6s_pulldown_alloc; /* # of mbuf allocs in m_pulldown */
u_quad_t ip6s_pullup; /* # of calls to m_pullup */
u_quad_t ip6s_pullup_copy; /* # of possible m_pullup copies */
u_quad_t ip6s_pullup_alloc; /* # of possible m_pullup mallocs */
u_quad_t ip6s_pullup_fail; /* # of possible m_pullup failures */
u_quad_t ip6s_pullup2; /* # of calls to m_pullup2 */
u_quad_t ip6s_pullup2_copy; /* # of possible m_pullup2 copies */
u_quad_t ip6s_pullup2_alloc; /* # of possible m_pullup2 mallocs */
u_quad_t ip6s_pullup2_fail; /* # of possible m_pullup2 failures */
/*
* statistics for improvement of the source address selection