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
This commit is contained in:
George V. Neville-Neil 2016-03-03 17:46:38 +00:00
parent 316e599449
commit e79cb051d5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296352
4 changed files with 10 additions and 6 deletions

View File

@ -1317,7 +1317,7 @@ tcp_output(struct tcpcb *tp)
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

View File

@ -291,7 +291,6 @@ tcp_do_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so,
*/
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 tcphdr *th, struct socket *so,
(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, struct tcphdr *th, struct socket *so,
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 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, struct socket *so,
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 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, struct socket *so,
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 tcphdr *th, struct socket *so,
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 tcphdr *th, struct socket *so,
(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))

View File

@ -1026,7 +1026,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
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);

View File

@ -525,6 +525,7 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
error = tp->t_fb->tfb_tcp_output(tp);
out:
TCPDEBUG2(PRU_CONNECT);
TCP_PROBE2(debug__user, tp, PRU_CONNECT);
INP_WUNLOCK(inp);
return (error);
}