Index: /trunk/src/VBox/Devices/Network/slirp/sbuf.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/sbuf.c	(revision 20376)
+++ /trunk/src/VBox/Devices/Network/slirp/sbuf.c	(revision 20377)
@@ -39,5 +39,5 @@
 
 void
-sbreserve(struct sbuf *sb, int size)
+sbreserve(PNATState pData, struct sbuf *sb, int size)
 {
     if (sb->sb_data)
@@ -83,9 +83,16 @@
     DEBUG_ARG("m->m_len = %d", m->m_len);
 
+    SLIRP_COUNTER_RESET(IOSBAppend);
+    SLIRP_COUNTER_RESET(IOSBAppend_zm);
+    SLIRP_COUNTER_RESET(IOSBAppend_wa);
+    SLIRP_COUNTER_RESET(IOSBAppend_wf);
+    SLIRP_COUNTER_RESET(IOSBAppend_wp);
+
+    SLIRP_COUNTER_INC(IOSBAppend);
     /* Shouldn't happen, but...  e.g. foreign host closes connection */
     if (m->m_len <= 0)
     {
-        m_free(pData, m);
-        return;
+        SLIRP_COUNTER_INC(IOSBAppend_zm);
+        goto done;
     }
 
@@ -97,5 +104,5 @@
     if (so->so_urgc)
     {
-        sbappendsb(&so->so_rcv, m);
+        sbappendsb(pData, &so->so_rcv, m);
         m_free(pData, m);
         sosendoob(so);
@@ -112,4 +119,5 @@
     if (ret <= 0)
     {
+        SLIRP_COUNTER_INC(IOSBAppend_wf);
         /*
          * Nothing was written
@@ -118,8 +126,10 @@
          * it will be detected in the normal way by soread()
          */
-        sbappendsb(&so->so_rcv, m);
+        sbappendsb(pData, &so->so_rcv, m);
+        goto done;
     }
     else if (ret != m->m_len)
     {
+        SLIRP_COUNTER_INC(IOSBAppend_wp);
         /*
          * Something was written, but not everything..
@@ -128,7 +138,10 @@
         m->m_len -= ret;
         m->m_data += ret;
-        sbappendsb(&so->so_rcv, m);
+        sbappendsb(pData, &so->so_rcv, m);
+        goto done;
     } /* else */
     /* Whatever happened, we free the mbuf */
+    SLIRP_COUNTER_INC(IOSBAppend_wa);
+done:
     m_free(pData, m);
 }
@@ -139,5 +152,5 @@
  */
 void
-sbappendsb(struct sbuf *sb, struct mbuf *m)
+sbappendsb(PNATState pData, struct sbuf *sb, struct mbuf *m)
 {
     int len, n,  nn;
@@ -145,6 +158,13 @@
     len = m->m_len;
 
+    SLIRP_COUNTER_RESET(IOSBAppendSB);
+    SLIRP_COUNTER_RESET(IOSBAppendSB_w_l_r);
+    SLIRP_COUNTER_RESET(IOSBAppendSB_w_ge_r);
+    SLIRP_COUNTER_RESET(IOSBAppendSB_w_alter);
+
+    SLIRP_COUNTER_INC(IOSBAppendSB);
     if (sb->sb_wptr < sb->sb_rptr)
     {
+        SLIRP_COUNTER_INC(IOSBAppendSB_w_l_r);
         n = sb->sb_rptr - sb->sb_wptr;
         if (n > len)
@@ -154,4 +174,5 @@
     else
     {
+        SLIRP_COUNTER_INC(IOSBAppendSB_w_ge_r);
         /* Do the right edge first */
         n = sb->sb_data + sb->sb_datalen - sb->sb_wptr;
@@ -174,5 +195,8 @@
     sb->sb_wptr += n;
     if (sb->sb_wptr >= sb->sb_data + sb->sb_datalen)
+    {
+        SLIRP_COUNTER_INC(IOSBAppendSB_w_alter);
         sb->sb_wptr -= sb->sb_datalen;
+    }
 }
 
Index: /trunk/src/VBox/Devices/Network/slirp/sbuf.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/sbuf.h	(revision 20376)
+++ /trunk/src/VBox/Devices/Network/slirp/sbuf.h	(revision 20377)
@@ -25,7 +25,7 @@
 void sbfree (struct sbuf *);
 void sbdrop (struct sbuf *, int);
-void sbreserve (struct sbuf *, int);
+void sbreserve (PNATState, struct sbuf *, int);
 void sbappend (PNATState, struct socket *, struct mbuf *);
-void sbappendsb (struct sbuf *, struct mbuf *);
+void sbappendsb (PNATState, struct sbuf *, struct mbuf *);
 void sbcopy (struct sbuf *, int, int, char *);
 
Index: /trunk/src/VBox/Devices/Network/slirp/tcp_input.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/tcp_input.c	(revision 20376)
+++ /trunk/src/VBox/Devices/Network/slirp/tcp_input.c	(revision 20377)
@@ -346,5 +346,4 @@
     {
         tcpstat.tcps_rcvbadsum++;
-        Log2(("checksum is invalid => drop\n"));
         goto drop;
     }
@@ -359,5 +358,4 @@
     {
         tcpstat.tcps_rcvbadoff++;
-        Log2(("ti_off(tlen(%d)<%d<(tcphdr(%d))) is invalid =>drop\n", tlen, off, sizeof(struct tcphdr)));
         goto drop;
     }
@@ -435,5 +433,4 @@
                 && so->so_deleted != 1) 
             {
-                Log2(("lock: %s:%d We found socket %R[natsock]\n", __FUNCTION__, __LINE__, so));
                 break; /* so is locked here */
             }
@@ -441,5 +438,4 @@
         }
         if (so == &tcb) {
-            Log2(("lock: %s:%d Haven't find anything \n", __FUNCTION__, __LINE__));
             so = NULL;
         }
@@ -470,5 +466,4 @@
      * as if it was LISTENING, and continue...
      */
-    Log2(("so = %R[natsock]\n", so));
     if (so == 0)
     {
@@ -484,6 +479,6 @@
         }
         SOCKET_LOCK(so); 
-        sbreserve(&so->so_snd, tcp_sndspace);
-        sbreserve(&so->so_rcv, tcp_rcvspace);
+        sbreserve(pData, &so->so_snd, tcp_sndspace);
+        sbreserve(pData, &so->so_rcv, tcp_rcvspace);
 
 /*      tcp_last_so = so; */  /* XXX ? */
@@ -509,5 +504,4 @@
     if (so->so_state & SS_ISFCONNECTING) 
     {
-        Log2(("so_state(%x) of %R[natsock] is still connecting =>drop\n", so->so_state, so));
         goto drop;
     }
@@ -520,5 +514,4 @@
     if (tp->t_state == TCPS_CLOSED)
     {
-        Log2(("t_state(%x) is closed =>drop\n", tp->t_state));
         goto drop;
     }
@@ -724,5 +717,4 @@
         {
             if (tiflags & TH_RST) {
-                Log2(("RST(%x) is on listen =>drop\n", tiflags));
                 goto drop;
             }
@@ -731,5 +723,4 @@
             if ((tiflags & TH_SYN) == 0) 
             {
-                Log2(("SYN(%x) is off on listen =>drop\n", tiflags));
                 goto drop;
             }
@@ -819,5 +810,4 @@
             tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
             tcpstat.tcps_accepts++;
-            Log2(("hit trimthenstep6\n"));
             goto trimthenstep6;
         } /* case TCPS_LISTEN */
@@ -845,5 +835,4 @@
                 if (tiflags & TH_ACK)
                     tp = tcp_drop(pData, tp, 0); /* XXX Check t_softerror! */
-                Log2(("RST(%x) is on SYN_SENT =>drop\n", tiflags));
                 goto drop;
             }
@@ -851,5 +840,4 @@
             if ((tiflags & TH_SYN) == 0) 
             {
-                Log2(("SYN(%x) bit is off on SYN_SENT =>drop\n", tiflags));
                 goto drop;
             }
@@ -1103,5 +1091,4 @@
 /*              so->so_error = ECONNRESET; */
 close:
-                Log2(("closing...=>drop\n", tp->t_state)); 
                 tp->t_state = TCPS_CLOSED;
                 tcpstat.tcps_drops++;
@@ -1112,5 +1099,4 @@
             case TCPS_LAST_ACK:
             case TCPS_TIME_WAIT:
-                Log2(("t_state is (%x) sort of close =>drop\n", tp->t_state)); 
                 tp = tcp_close(pData, tp);
                 goto drop;
@@ -1132,5 +1118,4 @@
     if ((tiflags & TH_ACK) == 0) 
     {
-        Log2(("ACK(%x) bit is off =>drop\n", tiflags)); 
         goto drop;
     }
@@ -1174,5 +1159,4 @@
             tp->snd_wl1 = ti->ti_seq - 1;
             /* Avoid ack processing; snd_una==ti_ack  =>  dup ack */
-            Log2(("hit synrx_to_est\n"));
             goto synrx_to_est;
             /* fall into ... */
@@ -1243,5 +1227,4 @@
                         if (SEQ_GT(onxt, tp->snd_nxt))
                             tp->snd_nxt = onxt;
-                        Log2(("t_dupacks(%d) == tcprexmtthresh(%d)=>drop\n", tp->t_dupacks, tcprexmtthresh));
                         goto drop;
                     }
@@ -1250,5 +1233,4 @@
                         tp->snd_cwnd += tp->t_maxseg;
                         (void) tcp_output(pData, tp);
-                        Log2(("t_dupacks(%d) > tcprexmtthresh(%d)=>drop\n", tp->t_dupacks, tcprexmtthresh));
                         goto drop;
                     }
@@ -1259,5 +1241,4 @@
             }
 synrx_to_est:
-            Log2(("enter synrx_to_est\n"));
             /*
              * If the congestion window was inflated to account
@@ -1397,5 +1378,4 @@
                     if (ourfinisacked)
                     {
-                        Log2(("ourfinisacked=>drop\n"));
                         tp = tcp_close(pData, tp);
                         goto drop;
@@ -1488,5 +1468,4 @@
             tp->rcv_up = tp->rcv_nxt;
 dodata:
-    Log2(("do data hit!\n"));
 
     /*
@@ -1898,6 +1877,6 @@
     tp->snd_cwnd = mss;
 
-    sbreserve(&so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0));
-    sbreserve(&so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0));
+    sbreserve(pData, &so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0));
+    sbreserve(pData, &so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0));
 
     DEBUG_MISC((dfd, " returning mss = %d\n", mss));
