Author: gnn
Date: Thu Mar  3 17:46:38 2016
New Revision: 296352
URL: https://svnweb.freebsd.org/changeset/base/296352

Log:
  Fix dtrace probes (introduced in 287759): debug__input was used
  for output and drop; connect didn't always fire a user probe
  some probes were missing in fastpath
  
  Submitted by: Hannes Mehnert
  Sponsored by: REMS, EPSRC
  Differential Revision:        https://reviews.freebsd.org/D5525

Modified:
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_stacks/fastpath.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_output.c
==============================================================================
--- head/sys/netinet/tcp_output.c       Thu Mar  3 15:36:00 2016        
(r296351)
+++ head/sys/netinet/tcp_output.c       Thu Mar  3 17:46:38 2016        
(r296352)
@@ -1317,7 +1317,7 @@ send:
                ipov->ih_len = save;
        }
 #endif /* TCPDEBUG */
-       TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+       TCP_PROBE3(debug__output, tp, th, mtod(m, const char *));
 
        /*
         * Fill in IP length and desired time to live and

Modified: head/sys/netinet/tcp_stacks/fastpath.c
==============================================================================
--- head/sys/netinet/tcp_stacks/fastpath.c      Thu Mar  3 15:36:00 2016        
(r296351)
+++ head/sys/netinet/tcp_stacks/fastpath.c      Thu Mar  3 17:46:38 2016        
(r296352)
@@ -291,7 +291,6 @@ tcp_do_fastack(struct mbuf *m, struct tc
                 */
                tp->snd_wl2 = th->th_ack;
                tp->t_dupacks = 0;
-               m_freem(m);
 
                /*
                 * If all outstanding data are acked, stop
@@ -308,6 +307,8 @@ tcp_do_fastack(struct mbuf *m, struct tc
                                  (void *)tcp_saveipgen,
                                  &tcp_savetcp, 0);
 #endif
+               TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+               m_freem(m);
                if (tp->snd_una == tp->snd_max)
                        tcp_timer_activate(tp, TT_REXMT, 0);
                else if (!tcp_timer_active(tp, TT_PERSIST))
@@ -398,6 +399,7 @@ tcp_do_fastnewdata(struct mbuf *m, struc
                tcp_trace(TA_INPUT, ostate, tp,
                          (void *)tcp_saveipgen, &tcp_savetcp, 0);
 #endif
+       TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
        /*
         * Automatic sizing of receive socket buffer.  Often the send
         * buffer size is not optimally adjusted to the actual network
@@ -1695,7 +1697,7 @@ dropafterack:
                tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
                          &tcp_savetcp, 0);
 #endif
-       TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+       TCP_PROBE3(debug__drop, tp, th, mtod(m, const char *));
        if (ti_locked == TI_RLOCKED) {
                INP_INFO_RUNLOCK(&V_tcbinfo);
        }
@@ -1738,7 +1740,7 @@ drop:
                tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
                          &tcp_savetcp, 0);
 #endif
-       TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+       TCP_PROBE3(debug__drop, tp, th, mtod(m, const char *));
        if (tp != NULL)
                INP_WUNLOCK(tp->t_inpcb);
        m_freem(m);
@@ -2134,7 +2136,6 @@ tcp_fastack(struct mbuf *m, struct tcphd
 
                tp->snd_una = th->th_ack;
                tp->t_dupacks = 0;
-               m_freem(m);
 
                /*
                 * If all outstanding data are acked, stop
@@ -2151,6 +2152,8 @@ tcp_fastack(struct mbuf *m, struct tcphd
                                  (void *)tcp_saveipgen,
                                  &tcp_savetcp, 0);
 #endif
+               TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+               m_freem(m);
                if (tp->snd_una == tp->snd_max)
                        tcp_timer_activate(tp, TT_REXMT, 0);
                else if (!tcp_timer_active(tp, TT_PERSIST))

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c Thu Mar  3 15:36:00 2016        (r296351)
+++ head/sys/netinet/tcp_subr.c Thu Mar  3 17:46:38 2016        (r296352)
@@ -1026,7 +1026,7 @@ tcp_respond(struct tcpcb *tp, void *ipge
        if (tp == NULL || (inp->inp_socket->so_options & SO_DEBUG))
                tcp_trace(TA_OUTPUT, 0, tp, mtod(m, void *), th, 0);
 #endif
-       TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+       TCP_PROBE3(debug__output, tp, th, mtod(m, const char *));
        if (flags & TH_RST)
                TCP_PROBE5(accept__refused, NULL, NULL, mtod(m, const char *),
                    tp, nth);

Modified: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c       Thu Mar  3 15:36:00 2016        
(r296351)
+++ head/sys/netinet/tcp_usrreq.c       Thu Mar  3 17:46:38 2016        
(r296352)
@@ -525,6 +525,7 @@ tcp_usr_connect(struct socket *so, struc
        error = tp->t_fb->tfb_tcp_output(tp);
 out:
        TCPDEBUG2(PRU_CONNECT);
+       TCP_PROBE2(debug__user, tp, PRU_CONNECT);
        INP_WUNLOCK(inp);
        return (error);
 }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to