slirp: Drop statistic code

As agreed on the mailing list, there is no interest in keeping the
usually disabled slirp statistics in the tree. So this patch removes
them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
master
Jan Kiszka 2009-06-24 14:42:29 +02:00 committed by Anthony Liguori
parent 0d62c4cfe2
commit 0fe6a7f284
21 changed files with 6 additions and 485 deletions

View File

@ -1733,8 +1733,6 @@ static const mon_cmd_t info_cmds[] = {
"", "show CPU statistics", },
#endif
#if defined(CONFIG_SLIRP)
{ "slirp", "", do_info_slirp,
"", "show SLIRP statistics", },
{ "usernet", "", do_info_usernet,
"", "show user network stack connection states", },
#endif

5
net.c
View File

@ -1112,11 +1112,6 @@ void net_slirp_smb(const char *exported_dir)
#endif /* !defined(_WIN32) */
void do_info_slirp(Monitor *mon)
{
slirp_stats();
}
struct GuestFwd {
CharDriverState *hd;
struct in_addr server;

View File

@ -85,8 +85,6 @@ show the current VM name
show the current VM UUID
@item info cpustats
show CPU statistics
@item info slirp
show SLIRP statistics (if available)
@item info usernet
show user network stack connection states
@item info migrate

View File

@ -10,157 +10,3 @@
FILE *dfd = NULL;
int slirp_debug = 0;
#ifdef LOG_ENABLED
static void
ipstats(void)
{
lprint(" \r\n");
lprint("IP stats:\r\n");
lprint(" %6d total packets received (%d were unaligned)\r\n",
ipstat.ips_total, ipstat.ips_unaligned);
lprint(" %6d with incorrect version\r\n", ipstat.ips_badvers);
lprint(" %6d with bad header checksum\r\n", ipstat.ips_badsum);
lprint(" %6d with length too short (len < sizeof(iphdr))\r\n", ipstat.ips_tooshort);
lprint(" %6d with length too small (len < ip->len)\r\n", ipstat.ips_toosmall);
lprint(" %6d with bad header length\r\n", ipstat.ips_badhlen);
lprint(" %6d with bad packet length\r\n", ipstat.ips_badlen);
lprint(" %6d fragments received\r\n", ipstat.ips_fragments);
lprint(" %6d fragments dropped\r\n", ipstat.ips_fragdropped);
lprint(" %6d fragments timed out\r\n", ipstat.ips_fragtimeout);
lprint(" %6d packets reassembled ok\r\n", ipstat.ips_reassembled);
lprint(" %6d outgoing packets fragmented\r\n", ipstat.ips_fragmented);
lprint(" %6d total outgoing fragments\r\n", ipstat.ips_ofragments);
lprint(" %6d with bad protocol field\r\n", ipstat.ips_noproto);
lprint(" %6d total packets delivered\r\n", ipstat.ips_delivered);
}
static void
tcpstats(void)
{
lprint(" \r\n");
lprint("TCP stats:\r\n");
lprint(" %6d packets sent\r\n", tcpstat.tcps_sndtotal);
lprint(" %6d data packets (%d bytes)\r\n",
tcpstat.tcps_sndpack, tcpstat.tcps_sndbyte);
lprint(" %6d data packets retransmitted (%d bytes)\r\n",
tcpstat.tcps_sndrexmitpack, tcpstat.tcps_sndrexmitbyte);
lprint(" %6d ack-only packets (%d delayed)\r\n",
tcpstat.tcps_sndacks, tcpstat.tcps_delack);
lprint(" %6d URG only packets\r\n", tcpstat.tcps_sndurg);
lprint(" %6d window probe packets\r\n", tcpstat.tcps_sndprobe);
lprint(" %6d window update packets\r\n", tcpstat.tcps_sndwinup);
lprint(" %6d control (SYN/FIN/RST) packets\r\n", tcpstat.tcps_sndctrl);
lprint(" %6d times tcp_output did nothing\r\n", tcpstat.tcps_didnuttin);
lprint(" %6d packets received\r\n", tcpstat.tcps_rcvtotal);
lprint(" %6d acks (for %d bytes)\r\n",
tcpstat.tcps_rcvackpack, tcpstat.tcps_rcvackbyte);
lprint(" %6d duplicate acks\r\n", tcpstat.tcps_rcvdupack);
lprint(" %6d acks for unsent data\r\n", tcpstat.tcps_rcvacktoomuch);
lprint(" %6d packets received in sequence (%d bytes)\r\n",
tcpstat.tcps_rcvpack, tcpstat.tcps_rcvbyte);
lprint(" %6d completely duplicate packets (%d bytes)\r\n",
tcpstat.tcps_rcvduppack, tcpstat.tcps_rcvdupbyte);
lprint(" %6d packets with some duplicate data (%d bytes duped)\r\n",
tcpstat.tcps_rcvpartduppack, tcpstat.tcps_rcvpartdupbyte);
lprint(" %6d out-of-order packets (%d bytes)\r\n",
tcpstat.tcps_rcvoopack, tcpstat.tcps_rcvoobyte);
lprint(" %6d packets of data after window (%d bytes)\r\n",
tcpstat.tcps_rcvpackafterwin, tcpstat.tcps_rcvbyteafterwin);
lprint(" %6d window probes\r\n", tcpstat.tcps_rcvwinprobe);
lprint(" %6d window update packets\r\n", tcpstat.tcps_rcvwinupd);
lprint(" %6d packets received after close\r\n", tcpstat.tcps_rcvafterclose);
lprint(" %6d discarded for bad checksums\r\n", tcpstat.tcps_rcvbadsum);
lprint(" %6d discarded for bad header offset fields\r\n",
tcpstat.tcps_rcvbadoff);
lprint(" %6d connection requests\r\n", tcpstat.tcps_connattempt);
lprint(" %6d connection accepts\r\n", tcpstat.tcps_accepts);
lprint(" %6d connections established (including accepts)\r\n", tcpstat.tcps_connects);
lprint(" %6d connections closed (including %d drop)\r\n",
tcpstat.tcps_closed, tcpstat.tcps_drops);
lprint(" %6d embryonic connections dropped\r\n", tcpstat.tcps_conndrops);
lprint(" %6d segments we tried to get rtt (%d succeeded)\r\n",
tcpstat.tcps_segstimed, tcpstat.tcps_rttupdated);
lprint(" %6d retransmit timeouts\r\n", tcpstat.tcps_rexmttimeo);
lprint(" %6d connections dropped by rxmt timeout\r\n",
tcpstat.tcps_timeoutdrop);
lprint(" %6d persist timeouts\r\n", tcpstat.tcps_persisttimeo);
lprint(" %6d keepalive timeouts\r\n", tcpstat.tcps_keeptimeo);
lprint(" %6d keepalive probes sent\r\n", tcpstat.tcps_keepprobe);
lprint(" %6d connections dropped by keepalive\r\n", tcpstat.tcps_keepdrops);
lprint(" %6d correct ACK header predictions\r\n", tcpstat.tcps_predack);
lprint(" %6d correct data packet header predictions\n", tcpstat.tcps_preddat);
lprint(" %6d TCP cache misses\r\n", tcpstat.tcps_socachemiss);
}
static void
udpstats(void)
{
lprint(" \r\n");
lprint("UDP stats:\r\n");
lprint(" %6d datagrams received\r\n", udpstat.udps_ipackets);
lprint(" %6d with packets shorter than header\r\n", udpstat.udps_hdrops);
lprint(" %6d with bad checksums\r\n", udpstat.udps_badsum);
lprint(" %6d with data length larger than packet\r\n", udpstat.udps_badlen);
lprint(" %6d UDP socket cache misses\r\n", udpstat.udpps_pcbcachemiss);
lprint(" %6d datagrams sent\r\n", udpstat.udps_opackets);
}
static void
icmpstats(void)
{
lprint(" \r\n");
lprint("ICMP stats:\r\n");
lprint(" %6d ICMP packets received\r\n", icmpstat.icps_received);
lprint(" %6d were too short\r\n", icmpstat.icps_tooshort);
lprint(" %6d with bad checksums\r\n", icmpstat.icps_checksum);
lprint(" %6d with type not supported\r\n", icmpstat.icps_notsupp);
lprint(" %6d with bad type feilds\r\n", icmpstat.icps_badtype);
lprint(" %6d ICMP packets sent in reply\r\n", icmpstat.icps_reflect);
}
static void
mbufstats(void)
{
struct mbuf *m;
int i;
lprint(" \r\n");
lprint("Mbuf stats:\r\n");
lprint(" %6d mbufs allocated (%d max)\r\n", mbuf_alloced, mbuf_max);
i = 0;
for (m = m_freelist.m_next; m != &m_freelist; m = m->m_next)
i++;
lprint(" %6d mbufs on free list\r\n", i);
i = 0;
for (m = m_usedlist.m_next; m != &m_usedlist; m = m->m_next)
i++;
lprint(" %6d mbufs on used list\r\n", i);
lprint(" %6d mbufs queued as packets\r\n\r\n", if_queued);
}
#endif
void
slirp_stats(void)
{
#ifdef LOG_ENABLED
ipstats();
tcpstats();
udpstats();
icmpstats();
mbufstats();
#else
lprint("SLIRP statistics code not compiled.\n");
#endif
}

View File

@ -33,20 +33,6 @@
#ifndef _NETINET_ICMP_VAR_H_
#define _NETINET_ICMP_VAR_H_
/*
* Variables related to this implementation
* of the internet control message protocol.
*/
struct icmpstat {
/* statistics related to input messages processed */
u_long icps_received; /* #ICMP packets received */
u_long icps_tooshort; /* packet < ICMP_MINLEN */
u_long icps_checksum; /* bad checksum */
u_long icps_notsupp; /* #ICMP packets not supported */
u_long icps_badtype; /* #with bad type feild */
u_long icps_reflect; /* number of responses */
};
/*
* Names for ICMP sysctl objects
*/
@ -60,8 +46,4 @@ struct icmpstat {
{ "stats", CTLTYPE_STRUCT }, \
}
#ifdef LOG_ENABLED
extern struct icmpstat icmpstat;
#endif
#endif

View File

@ -28,24 +28,4 @@ extern struct mbuf *next_m;
#define ifs_init(ifm) ((ifm)->ifs_next = (ifm)->ifs_prev = (ifm))
#ifdef LOG_ENABLED
/* Interface statistics */
struct slirp_ifstats {
u_int out_pkts; /* Output packets */
u_int out_bytes; /* Output bytes */
u_int out_errpkts; /* Output Error Packets */
u_int out_errbytes; /* Output Error Bytes */
u_int in_pkts; /* Input packets */
u_int in_bytes; /* Input bytes */
u_int in_errpkts; /* Input Error Packets */
u_int in_errbytes; /* Input Error Bytes */
u_int bytes_saved; /* Number of bytes that compression "saved" */
/* ie: number of bytes that didn't need to be sent over the link
* because of compression */
u_int in_mbad; /* Bad incoming packets */
};
#endif
#endif

View File

@ -250,43 +250,6 @@ struct ipoption {
int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */
};
#ifdef LOG_ENABLED
/*
* Structure attached to inpcb.ip_moptions and
* passed to ip_output when IP multicast options are in use.
*/
struct ipstat {
u_long ips_total; /* total packets received */
u_long ips_badsum; /* checksum bad */
u_long ips_tooshort; /* packet too short */
u_long ips_toosmall; /* not enough data */
u_long ips_badhlen; /* ip header length < data size */
u_long ips_badlen; /* ip length < ip header length */
u_long ips_fragments; /* fragments received */
u_long ips_fragdropped; /* frags dropped (dups, out of space) */
u_long ips_fragtimeout; /* fragments timed out */
u_long ips_forward; /* packets forwarded */
u_long ips_cantforward; /* packets rcvd for unreachable dest */
u_long ips_redirectsent; /* packets forwarded on same net */
u_long ips_noproto; /* unknown or unsupported protocol */
u_long ips_delivered; /* datagrams delivered to upper level*/
u_long ips_localout; /* total ip packets generated here */
u_long ips_odropped; /* lost packets due to nobufs, etc. */
u_long ips_reassembled; /* total packets reassembled ok */
u_long ips_fragmented; /* datagrams successfully fragmented */
u_long ips_ofragments; /* output fragments created */
u_long ips_cantfrag; /* don't fragment flag was set, etc. */
u_long ips_badoptions; /* error in option processing */
u_long ips_noroute; /* packets discarded due to no route */
u_long ips_badvers; /* ip version != 4 */
u_long ips_rawout; /* total raw ip packets generated */
u_long ips_unaligned; /* times the ip packet was not aligned */
};
extern struct ipstat ipstat;
#endif
extern struct ipq ipq; /* ip reass. queue */
extern u_int16_t ip_id; /* ip packet ctr, for ids */

View File

@ -33,10 +33,6 @@
#include "slirp.h"
#include "ip_icmp.h"
#ifdef LOG_ENABLED
struct icmpstat icmpstat;
#endif
/* The message sent when emulating PING */
/* Be nice and tell them it's just a pseudo-ping packet */
static const char icmp_ping_msg[] = "This is a pseudo-PING packet used by Slirp to emulate ICMP ECHO-REQUEST packets.\n";
@ -78,14 +74,11 @@ icmp_input(struct mbuf *m, int hlen)
DEBUG_ARG("m = %lx", (long )m);
DEBUG_ARG("m_len = %d", m->m_len);
STAT(icmpstat.icps_received++);
/*
* Locate icmp structure in mbuf, and check
* that its not corrupted and of at least minimum length.
*/
if (icmplen < ICMP_MINLEN) { /* min 8 bytes payload */
STAT(icmpstat.icps_tooshort++);
freeit:
m_freem(m);
goto end_error;
@ -95,7 +88,6 @@ icmp_input(struct mbuf *m, int hlen)
m->m_data += hlen;
icp = mtod(m, struct icmp *);
if (cksum(m, icmplen)) {
STAT(icmpstat.icps_checksum++);
goto freeit;
}
m->m_len += hlen;
@ -159,12 +151,10 @@ icmp_input(struct mbuf *m, int hlen)
case ICMP_TSTAMP:
case ICMP_MASKREQ:
case ICMP_REDIRECT:
STAT(icmpstat.icps_notsupp++);
m_freem(m);
break;
default:
STAT(icmpstat.icps_badtype++);
m_freem(m);
} /* swith */
@ -299,8 +289,6 @@ icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
(void ) ip_output((struct socket *)NULL, m);
STAT(icmpstat.icps_reflect++);
end_error:
return;
}
@ -354,6 +342,4 @@ icmp_reflect(struct mbuf *m)
}
(void ) ip_output((struct socket *)NULL, m);
STAT(icmpstat.icps_reflect++);
}

View File

@ -42,10 +42,6 @@
#include <osdep.h>
#include "ip_icmp.h"
#ifdef LOG_ENABLED
struct ipstat ipstat;
#endif
struct ipq ipq;
static struct ip *ip_reass(register struct ip *ip,
@ -82,24 +78,19 @@ ip_input(struct mbuf *m)
DEBUG_ARG("m = %lx", (long)m);
DEBUG_ARG("m_len = %d", m->m_len);
STAT(ipstat.ips_total++);
if (m->m_len < sizeof (struct ip)) {
STAT(ipstat.ips_toosmall++);
return;
}
ip = mtod(m, struct ip *);
if (ip->ip_v != IPVERSION) {
STAT(ipstat.ips_badvers++);
goto bad;
}
hlen = ip->ip_hl << 2;
if (hlen<sizeof(struct ip ) || hlen>m->m_len) {/* min header length */
STAT(ipstat.ips_badhlen++); /* or packet too short */
goto bad;
goto bad; /* or packet too short */
}
/* keep ip header intact for ICMP reply
@ -107,7 +98,6 @@ ip_input(struct mbuf *m)
* if (ip->ip_sum) {
*/
if(cksum(m,hlen)) {
STAT(ipstat.ips_badsum++);
goto bad;
}
@ -116,7 +106,6 @@ ip_input(struct mbuf *m)
*/
NTOHS(ip->ip_len);
if (ip->ip_len < hlen) {
STAT(ipstat.ips_badlen++);
goto bad;
}
NTOHS(ip->ip_id);
@ -129,7 +118,6 @@ ip_input(struct mbuf *m)
* Drop packet if shorter than we expect.
*/
if (m->m_len < ip->ip_len) {
STAT(ipstat.ips_tooshort++);
goto bad;
}
@ -210,11 +198,9 @@ ip_input(struct mbuf *m)
* attempt reassembly; if it succeeds, proceed.
*/
if (ip->ip_tos & 1 || ip->ip_off) {
STAT(ipstat.ips_fragments++);
ip = ip_reass(ip, fp);
if (ip == NULL)
return;
STAT(ipstat.ips_reassembled++);
m = dtom(ip);
} else
if (fp)
@ -226,7 +212,6 @@ ip_input(struct mbuf *m)
/*
* Switch out to protocol's input routine.
*/
STAT(ipstat.ips_delivered++);
switch (ip->ip_p) {
case IPPROTO_TCP:
tcp_input(m, hlen, (struct socket *)NULL);
@ -238,7 +223,6 @@ ip_input(struct mbuf *m)
icmp_input(m, hlen);
break;
default:
STAT(ipstat.ips_noproto++);
m_free(m);
}
return;
@ -399,7 +383,6 @@ insert:
return ip;
dropfrag:
STAT(ipstat.ips_fragdropped++);
m_freem(m);
return NULL;
}
@ -468,7 +451,6 @@ ip_slowtimo(void)
struct ipq *fp = container_of(l, struct ipq, ip_link);
l = l->next;
if (--fp->ipq_ttl == 0) {
STAT(ipstat.ips_fragtimeout++);
ip_freef(fp);
}
}
@ -671,7 +653,6 @@ typedef u_int32_t n_time;
bad:
icmp_error(m, type, code, 0, 0);
STAT(ipstat.ips_badoptions++);
return (1);
}

View File

@ -72,7 +72,6 @@ ip_output(struct socket *so, struct mbuf *m0)
ip->ip_off &= IP_DF;
ip->ip_id = htons(ip_id++);
ip->ip_hl = hlen >> 2;
STAT(ipstat.ips_localout++);
/*
* If small enough for interface, can just send directly.
@ -93,7 +92,6 @@ ip_output(struct socket *so, struct mbuf *m0)
*/
if (ip->ip_off & IP_DF) {
error = -1;
STAT(ipstat.ips_cantfrag++);
goto bad;
}
@ -118,7 +116,6 @@ ip_output(struct socket *so, struct mbuf *m0)
m = m_get();
if (m == NULL) {
error = -1;
STAT(ipstat.ips_odropped++);
goto sendorfree;
}
m->m_data += IF_MAXLINKHDR;
@ -145,7 +142,6 @@ ip_output(struct socket *so, struct mbuf *m0)
mhip->ip_sum = cksum(m, mhlen);
*mnext = m;
mnext = &m->m_nextpkt;
STAT(ipstat.ips_ofragments++);
}
/*
* Update first fragment by trimming what's been copied out
@ -166,9 +162,6 @@ sendorfree:
else
m_freem(m);
}
if (error == 0)
STAT(ipstat.ips_fragmented++);
}
done:

View File

@ -26,7 +26,6 @@ int slirp_remove_hostfwd(int is_udp, struct in_addr host_addr, int host_port);
int slirp_add_exec(int do_pty, const void *args, struct in_addr guest_addr,
int guest_port);
void slirp_stats(void);
void slirp_connection_info(Monitor *mon);
void slirp_socket_recv(struct in_addr guest_addr, int guest_port,

View File

@ -17,10 +17,9 @@
#include <slirp.h>
int mbuf_alloced = 0;
static int mbuf_alloced;
struct mbuf m_freelist, m_usedlist;
#define MBUF_THRESH 30
int mbuf_max = 0;
/*
* Find a nice value for msize
@ -57,8 +56,6 @@ m_get(void)
mbuf_alloced++;
if (mbuf_alloced > MBUF_THRESH)
flags = M_DOFREE;
if (mbuf_alloced > mbuf_max)
mbuf_max = mbuf_alloced;
} else {
m = m_freelist.m_next;
remque(m);

View File

@ -114,19 +114,7 @@ struct mbuf {
#define M_DOFREE 0x08 /* when m_free is called on the mbuf, free()
* it rather than putting it on the free list */
/*
* Mbuf statistics. XXX
*/
struct mbstat {
int mbs_alloced; /* Number of mbufs allocated */
};
extern struct mbstat mbstat;
extern int mbuf_alloced;
extern struct mbuf m_freelist, m_usedlist;
extern int mbuf_max;
void m_init _P((void));
struct mbuf * m_get _P((void));

View File

@ -3,15 +3,6 @@
//#define DEBUG 1
// Uncomment the following line to enable SLIRP statistics printing in Qemu
//#define LOG_ENABLED
#ifdef LOG_ENABLED
#define STAT(expr) expr
#else
#define STAT(expr) do { } while(0)
#endif
#include "config-host.h"
#include "slirp_config.h"

View File

@ -75,8 +75,6 @@ tcp_seq tcp_iss; /* tcp initial send seq # */
tp->t_flags |= TF_DELACK; \
(tp)->rcv_nxt += (ti)->ti_len; \
flags = (ti)->ti_flags & TH_FIN; \
STAT(tcpstat.tcps_rcvpack++); \
STAT(tcpstat.tcps_rcvbyte += (ti)->ti_len); \
if (so->so_emu) { \
if (tcp_emu((so),(m))) sbappend((so), (m)); \
} else \
@ -94,8 +92,6 @@ tcp_seq tcp_iss; /* tcp initial send seq # */
tp->t_flags |= TF_DELACK; \
(tp)->rcv_nxt += (ti)->ti_len; \
flags = (ti)->ti_flags & TH_FIN; \
STAT(tcpstat.tcps_rcvpack++); \
STAT(tcpstat.tcps_rcvbyte += (ti)->ti_len); \
if (so->so_emu) { \
if (tcp_emu((so),(m))) sbappend(so, (m)); \
} else \
@ -145,8 +141,6 @@ tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti,
i = q->ti_seq + q->ti_len - ti->ti_seq;
if (i > 0) {
if (i >= ti->ti_len) {
STAT(tcpstat.tcps_rcvduppack++);
STAT(tcpstat.tcps_rcvdupbyte += ti->ti_len);
m_freem(m);
/*
* Try to present any queued data
@ -162,8 +156,6 @@ tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti,
}
q = tcpiphdr_next(q);
}
STAT(tcpstat.tcps_rcvoopack++);
STAT(tcpstat.tcps_rcvoobyte += ti->ti_len);
ti->ti_mbuf = m;
/*
@ -263,8 +255,6 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso)
goto cont_conn;
}
STAT(tcpstat.tcps_rcvtotal++);
/*
* Get IP and TCP header together in first mbuf.
* Note: IP leaves IP header in first mbuf.
@ -295,7 +285,6 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso)
ti->ti_len = htons((u_int16_t)tlen);
len = sizeof(struct ip ) + tlen;
if(cksum(m, len)) {
STAT(tcpstat.tcps_rcvbadsum++);
goto drop;
}
@ -305,7 +294,6 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso)
*/
off = ti->ti_off << 2;
if (off < sizeof (struct tcphdr) || off > tlen) {
STAT(tcpstat.tcps_rcvbadoff++);
goto drop;
}
tlen -= off;
@ -353,7 +341,6 @@ findso:
ti->ti_dst, ti->ti_dport);
if (so)
tcp_last_so = so;
STAT(tcpstat.tcps_socachemiss++);
}
/*
@ -460,13 +447,10 @@ findso:
/*
* this is a pure ack for outstanding data.
*/
STAT(tcpstat.tcps_predack++);
if (tp->t_rtt &&
SEQ_GT(ti->ti_ack, tp->t_rtseq))
tcp_xmit_timer(tp, tp->t_rtt);
acked = ti->ti_ack - tp->snd_una;
STAT(tcpstat.tcps_rcvackpack++);
STAT(tcpstat.tcps_rcvackbyte += acked);
sbdrop(&so->so_snd, acked);
tp->snd_una = ti->ti_ack;
m_freem(m);
@ -503,10 +487,7 @@ findso:
* with nothing on the reassembly queue and
* we have enough buffer space to take it.
*/
STAT(tcpstat.tcps_preddat++);
tp->rcv_nxt += ti->ti_len;
STAT(tcpstat.tcps_rcvpack++);
STAT(tcpstat.tcps_rcvbyte += ti->ti_len);
/*
* Add data to socket buffer.
*/
@ -658,7 +639,6 @@ findso:
tp->t_flags |= TF_ACKNOW;
tp->t_state = TCPS_SYN_RECEIVED;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
STAT(tcpstat.tcps_accepts++);
goto trimthenstep6;
} /* case TCPS_LISTEN */
@ -699,7 +679,6 @@ findso:
tcp_rcvseqinit(tp);
tp->t_flags |= TF_ACKNOW;
if (tiflags & TH_ACK && SEQ_GT(tp->snd_una, tp->iss)) {
STAT(tcpstat.tcps_connects++);
soisfconnected(so);
tp->t_state = TCPS_ESTABLISHED;
@ -726,8 +705,6 @@ trimthenstep6:
m_adj(m, -todrop);
ti->ti_len = tp->rcv_wnd;
tiflags &= ~TH_FIN;
STAT(tcpstat.tcps_rcvpackafterwin++);
STAT(tcpstat.tcps_rcvbyteafterwin += todrop);
}
tp->snd_wl1 = ti->ti_seq - 1;
tp->rcv_up = ti->ti_seq;
@ -768,11 +745,6 @@ trimthenstep6:
*/
tp->t_flags |= TF_ACKNOW;
todrop = ti->ti_len;
STAT(tcpstat.tcps_rcvduppack++);
STAT(tcpstat.tcps_rcvdupbyte += todrop);
} else {
STAT(tcpstat.tcps_rcvpartduppack++);
STAT(tcpstat.tcps_rcvpartdupbyte += todrop);
}
m_adj(m, todrop);
ti->ti_seq += todrop;
@ -791,7 +763,6 @@ trimthenstep6:
if ((so->so_state & SS_NOFDREF) &&
tp->t_state > TCPS_CLOSE_WAIT && ti->ti_len) {
tp = tcp_close(tp);
STAT(tcpstat.tcps_rcvafterclose++);
goto dropwithreset;
}
@ -801,9 +772,7 @@ trimthenstep6:
*/
todrop = (ti->ti_seq+ti->ti_len) - (tp->rcv_nxt+tp->rcv_wnd);
if (todrop > 0) {
STAT(tcpstat.tcps_rcvpackafterwin++);
if (todrop >= ti->ti_len) {
STAT(tcpstat.tcps_rcvbyteafterwin += ti->ti_len);
/*
* If a new connection request is received
* while in TIME_WAIT, drop the old connection
@ -826,11 +795,10 @@ trimthenstep6:
*/
if (tp->rcv_wnd == 0 && ti->ti_seq == tp->rcv_nxt) {
tp->t_flags |= TF_ACKNOW;
STAT(tcpstat.tcps_rcvwinprobe++);
} else
} else {
goto dropafterack;
} else
STAT(tcpstat.tcps_rcvbyteafterwin += todrop);
}
}
m_adj(m, -todrop);
ti->ti_len -= todrop;
tiflags &= ~(TH_PUSH|TH_FIN);
@ -854,7 +822,6 @@ trimthenstep6:
case TCPS_FIN_WAIT_2:
case TCPS_CLOSE_WAIT:
tp->t_state = TCPS_CLOSED;
STAT(tcpstat.tcps_drops++);
tp = tcp_close(tp);
goto drop;
@ -893,7 +860,6 @@ trimthenstep6:
if (SEQ_GT(tp->snd_una, ti->ti_ack) ||
SEQ_GT(ti->ti_ack, tp->snd_max))
goto dropwithreset;
STAT(tcpstat.tcps_connects++);
tp->t_state = TCPS_ESTABLISHED;
/*
* The sent SYN is ack'ed with our sequence number +1
@ -944,7 +910,6 @@ trimthenstep6:
if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) {
if (ti->ti_len == 0 && tiwin == tp->snd_wnd) {
STAT(tcpstat.tcps_rcvdupack++);
DEBUG_MISC((dfd," dup ack m = %lx so = %lx \n",
(long )m, (long )so));
/*
@ -1012,12 +977,9 @@ trimthenstep6:
tp->snd_cwnd = tp->snd_ssthresh;
tp->t_dupacks = 0;
if (SEQ_GT(ti->ti_ack, tp->snd_max)) {
STAT(tcpstat.tcps_rcvacktoomuch++);
goto dropafterack;
}
acked = ti->ti_ack - tp->snd_una;
STAT(tcpstat.tcps_rcvackpack++);
STAT(tcpstat.tcps_rcvackbyte += acked);
/*
* If transmit timer is running and timed sequence
@ -1138,10 +1100,6 @@ step6:
(SEQ_LT(tp->snd_wl1, ti->ti_seq) ||
(tp->snd_wl1 == ti->ti_seq && (SEQ_LT(tp->snd_wl2, ti->ti_ack) ||
(tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd))))) {
/* keep track of pure window updates */
if (ti->ti_len == 0 &&
tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd)
STAT(tcpstat.tcps_rcvwinupd++);
tp->snd_wnd = tiwin;
tp->snd_wl1 = ti->ti_seq;
tp->snd_wl2 = ti->ti_ack;
@ -1425,7 +1383,6 @@ tcp_xmit_timer(register struct tcpcb *tp, int rtt)
DEBUG_ARG("tp = %lx", (long)tp);
DEBUG_ARG("rtt = %d", rtt);
STAT(tcpstat.tcps_rttupdated++);
if (tp->t_srtt != 0) {
/*
* srtt is stored as fixed point with 3 bits after the

View File

@ -247,8 +247,6 @@ again:
/*
* No reason to send a segment, just return.
*/
STAT(tcpstat.tcps_didnuttin++);
return (0);
send:
@ -292,16 +290,6 @@ send:
* the template for sends on this connection.
*/
if (len) {
if (tp->t_force && len == 1)
STAT(tcpstat.tcps_sndprobe++);
else if (SEQ_LT(tp->snd_nxt, tp->snd_max)) {
STAT(tcpstat.tcps_sndrexmitpack++);
STAT(tcpstat.tcps_sndrexmitbyte += len);
} else {
STAT(tcpstat.tcps_sndpack++);
STAT(tcpstat.tcps_sndbyte += len);
}
m = m_get();
if (m == NULL) {
error = 1;
@ -322,15 +310,6 @@ send:
if (off + len == so->so_snd.sb_cc)
flags |= TH_PUSH;
} else {
if (tp->t_flags & TF_ACKNOW)
STAT(tcpstat.tcps_sndacks++);
else if (flags & (TH_SYN|TH_FIN|TH_RST))
STAT(tcpstat.tcps_sndctrl++);
else if (SEQ_GT(tp->snd_up, tp->snd_una))
STAT(tcpstat.tcps_sndurg++);
else
STAT(tcpstat.tcps_sndwinup++);
m = m_get();
if (m == NULL) {
error = 1;
@ -436,7 +415,6 @@ send:
if (tp->t_rtt == 0) {
tp->t_rtt = 1;
tp->t_rtseq = startseq;
STAT(tcpstat.tcps_segstimed++);
}
}
@ -481,7 +459,6 @@ send:
out:
return (error);
}
STAT(tcpstat.tcps_sndtotal++);
/*
* Data sent (as far as we can tell).

View File

@ -222,9 +222,7 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err)
if (TCPS_HAVERCVDSYN(tp->t_state)) {
tp->t_state = TCPS_CLOSED;
(void) tcp_output(tp);
STAT(tcpstat.tcps_drops++);
} else
STAT(tcpstat.tcps_conndrops++);
}
return (tcp_close(tp));
}
@ -261,7 +259,6 @@ tcp_close(struct tcpcb *tp)
sbfree(&so->so_rcv);
sbfree(&so->so_snd);
sofree(so);
STAT(tcpstat.tcps_closed++);
return ((struct tcpcb *)0);
}
@ -442,8 +439,6 @@ tcp_connect(struct socket *inso)
tcp_template(tp);
STAT(tcpstat.tcps_connattempt++);
tp->t_state = TCPS_SYN_SENT;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
tp->iss = tcp_iss;

View File

@ -32,10 +32,6 @@
#include <slirp.h>
#ifdef LOG_ENABLED
struct tcpstat tcpstat; /* tcp statistics */
#endif
u_int32_t tcp_now; /* for RFC 1323 timestamps */
static struct tcpcb *tcp_timers(register struct tcpcb *tp, int timer);
@ -58,7 +54,6 @@ tcp_fasttimo(void)
(tp->t_flags & TF_DELACK)) {
tp->t_flags &= ~TF_DELACK;
tp->t_flags |= TF_ACKNOW;
STAT(tcpstat.tcps_delack++);
(void) tcp_output(tp);
}
}
@ -180,7 +175,6 @@ tcp_timers(register struct tcpcb *tp, int timer)
* We tried our best, now the connection must die!
*/
tp->t_rxtshift = TCP_MAXRXTSHIFT;
STAT(tcpstat.tcps_timeoutdrop++);
tp = tcp_drop(tp, tp->t_softerror);
/* tp->t_softerror : ETIMEDOUT); */ /* XXX */
return (tp); /* XXX */
@ -192,7 +186,6 @@ tcp_timers(register struct tcpcb *tp, int timer)
*/
tp->t_rxtshift = 6;
}
STAT(tcpstat.tcps_rexmttimeo++);
rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
TCPT_RANGESET(tp->t_rxtcur, rexmt,
(short)tp->t_rttmin, TCPTV_REXMTMAX); /* XXX */
@ -254,7 +247,6 @@ tcp_timers(register struct tcpcb *tp, int timer)
* Force a byte to be output, if possible.
*/
case TCPT_PERSIST:
STAT(tcpstat.tcps_persisttimeo++);
tcp_setpersist(tp);
tp->t_force = 1;
(void) tcp_output(tp);
@ -266,7 +258,6 @@ tcp_timers(register struct tcpcb *tp, int timer)
* or drop connection if idle for too long.
*/
case TCPT_KEEP:
STAT(tcpstat.tcps_keeptimeo++);
if (tp->t_state < TCPS_ESTABLISHED)
goto dropit;
@ -285,7 +276,6 @@ tcp_timers(register struct tcpcb *tp, int timer)
* by the protocol spec, this requires the
* correspondent TCP to respond.
*/
STAT(tcpstat.tcps_keepprobe++);
tcp_respond(tp, &tp->t_template, (struct mbuf *)NULL,
tp->rcv_nxt, tp->snd_una - 1, 0);
tp->t_timer[TCPT_KEEP] = TCPTV_KEEPINTVL;
@ -294,7 +284,6 @@ tcp_timers(register struct tcpcb *tp, int timer)
break;
dropit:
STAT(tcpstat.tcps_keepdrops++);
tp = tcp_drop(tp, 0);
break;
}

View File

@ -158,69 +158,6 @@ struct tcpcb {
#define TCP_REXMTVAL(tp) \
(((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar)
#ifdef LOG_ENABLED
/*
* TCP statistics.
* Many of these should be kept per connection,
* but that's inconvenient at the moment.
*/
struct tcpstat {
u_long tcps_connattempt; /* connections initiated */
u_long tcps_accepts; /* connections accepted */
u_long tcps_connects; /* connections established */
u_long tcps_drops; /* connections dropped */
u_long tcps_conndrops; /* embryonic connections dropped */
u_long tcps_closed; /* conn. closed (includes drops) */
u_long tcps_segstimed; /* segs where we tried to get rtt */
u_long tcps_rttupdated; /* times we succeeded */
u_long tcps_delack; /* delayed acks sent */
u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */
u_long tcps_rexmttimeo; /* retransmit timeouts */
u_long tcps_persisttimeo; /* persist timeouts */
u_long tcps_keeptimeo; /* keepalive timeouts */
u_long tcps_keepprobe; /* keepalive probes sent */
u_long tcps_keepdrops; /* connections dropped in keepalive */
u_long tcps_sndtotal; /* total packets sent */
u_long tcps_sndpack; /* data packets sent */
u_long tcps_sndbyte; /* data bytes sent */
u_long tcps_sndrexmitpack; /* data packets retransmitted */
u_long tcps_sndrexmitbyte; /* data bytes retransmitted */
u_long tcps_sndacks; /* ack-only packets sent */
u_long tcps_sndprobe; /* window probes sent */
u_long tcps_sndurg; /* packets sent with URG only */
u_long tcps_sndwinup; /* window update-only packets sent */
u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */
u_long tcps_rcvtotal; /* total packets received */
u_long tcps_rcvpack; /* packets received in sequence */
u_long tcps_rcvbyte; /* bytes received in sequence */
u_long tcps_rcvbadsum; /* packets received with ccksum errs */
u_long tcps_rcvbadoff; /* packets received with bad offset */
u_long tcps_rcvduppack; /* duplicate-only packets received */
u_long tcps_rcvdupbyte; /* duplicate-only bytes received */
u_long tcps_rcvpartduppack; /* packets with some duplicate data */
u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
u_long tcps_rcvoopack; /* out-of-order packets received */
u_long tcps_rcvoobyte; /* out-of-order bytes received */
u_long tcps_rcvpackafterwin; /* packets with data after window */
u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */
u_long tcps_rcvafterclose; /* packets rcvd after "close" */
u_long tcps_rcvwinprobe; /* rcvd window probe packets */
u_long tcps_rcvdupack; /* rcvd duplicate acks */
u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */
u_long tcps_rcvackpack; /* rcvd ack packets */
u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */
u_long tcps_rcvwinupd; /* rcvd window update packets */
u_long tcps_predack; /* times hdr predict ok for acks */
u_long tcps_preddat; /* times hdr predict ok for data pkts */
u_long tcps_socachemiss; /* tcp_last_so misses */
u_long tcps_didnuttin; /* Times tcp_output didn't do anything XXX */
};
extern struct tcpstat tcpstat; /* tcp statistics */
#endif
extern u_int32_t tcp_now; /* for RFC 1323 timestamps */
#endif

View File

@ -41,10 +41,6 @@
#include <slirp.h>
#include "ip_icmp.h"
#ifdef LOG_ENABLED
struct udpstat udpstat;
#endif
struct socket udb;
static u_int8_t udp_tos(struct socket *so);
@ -74,8 +70,6 @@ udp_input(register struct mbuf *m, int iphlen)
DEBUG_ARG("m = %lx", (long)m);
DEBUG_ARG("iphlen = %d", iphlen);
STAT(udpstat.udps_ipackets++);
/*
* Strip IP options, if any; should skip this,
* make available to user, and use on returned packets,
@ -101,7 +95,6 @@ udp_input(register struct mbuf *m, int iphlen)
if (ip->ip_len != len) {
if (len > ip->ip_len) {
STAT(udpstat.udps_badlen++);
goto bad;
}
m_adj(m, len - ip->ip_len);
@ -123,7 +116,6 @@ udp_input(register struct mbuf *m, int iphlen)
((struct ipovly *)ip)->ih_x1 = 0;
((struct ipovly *)ip)->ih_len = uh->uh_ulen;
if(cksum(m, len + sizeof(struct ip))) {
STAT(udpstat.udps_badsum++);
goto bad;
}
}
@ -165,7 +157,6 @@ udp_input(register struct mbuf *m, int iphlen)
if (tmp == &udb) {
so = NULL;
} else {
STAT(udpstat.udpps_pcbcachemiss++);
udp_last_so = so;
}
}
@ -279,8 +270,6 @@ int udp_output2(struct socket *so, struct mbuf *m,
((struct ip *)ui)->ip_ttl = IPDEFTTL;
((struct ip *)ui)->ip_tos = iptos;
STAT(udpstat.udps_opackets++);
error = ip_output(so, m);
return (error);

View File

@ -67,32 +67,12 @@ struct udpiphdr {
#define ui_ulen ui_u.uh_ulen
#define ui_sum ui_u.uh_sum
#ifdef LOG_ENABLED
struct udpstat {
/* input statistics: */
u_long udps_ipackets; /* total input packets */
u_long udps_hdrops; /* packet shorter than header */
u_long udps_badsum; /* checksum error */
u_long udps_badlen; /* data length larger than packet */
u_long udps_noport; /* no socket on port */
u_long udps_noportbcast; /* of above, arrived as broadcast */
u_long udps_fullsock; /* not delivered, input socket full */
u_long udpps_pcbcachemiss; /* input packets missing pcb cache */
/* output statistics: */
u_long udps_opackets; /* total output packets */
};
#endif
/*
* Names for UDP sysctl objects
*/
#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */
#define UDPCTL_MAXID 2
#ifdef LOG_ENABLED
extern struct udpstat udpstat;
#endif
extern struct socket udb;
struct mbuf;