diff mbox series

[v3,mptcp-next] Squash to "mptcp: add tracepoint in mptcp_subflow_get_send"

Message ID 77e57026944d545dc4aaf9a6199ffa39485e1f43.1617296035.git.geliangtang@gmail.com
State Accepted, archived
Commit 8c49e105a00a40ecb37f8d191477165df3bdae59
Delegated to: Matthieu Baerts
Headers show
Series [v3,mptcp-next] Squash to "mptcp: add tracepoint in mptcp_subflow_get_send" | expand

Commit Message

Geliang Tang April 1, 2021, 4:54 p.m. UTC
Reduce the indentation level and zero the uninitialized fields.

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 include/trace/events/mptcp.h | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

Comments

Paolo Abeni April 1, 2021, 5:14 p.m. UTC | #1
On Fri, 2021-04-02 at 00:54 +0800, Geliang Tang wrote:
> Reduce the indentation level and zero the uninitialized fields.
> 
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
>  include/trace/events/mptcp.h | 27 +++++++++++++++++----------
>  1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/include/trace/events/mptcp.h b/include/trace/events/mptcp.h
> index f1c836573744..b1617a0162da 100644
> --- a/include/trace/events/mptcp.h
> +++ b/include/trace/events/mptcp.h
> @@ -23,22 +23,29 @@ TRACE_EVENT(mptcp_subflow_get_send,
>  	),
>  
>  	TP_fast_assign(
> -		bool sk = sk_fullsock(subflow->tcp_sock);
> +		struct sock *ssk;
>  
>  		__entry->active = mptcp_subflow_active(subflow);
>  		__entry->backup = subflow->backup;
> -		if (sk) {
> -			struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
>  
> +		if (subflow->tcp_sock && sk_fullsock(subflow->tcp_sock))
>  			__entry->free = sk_stream_memory_free(subflow->tcp_sock);
> -			if (ssk) {
> -				__entry->snd_wnd = tcp_sk(ssk)->snd_wnd;
> -				__entry->pace = ssk->sk_pacing_rate;
> -				if (__entry->pace)
> -					__entry->ratio = div_u64((u64)ssk->sk_wmem_queued << 32,
> -								 __entry->pace);
> -			}
> +		else
> +			__entry->free = 0;
> +
> +		ssk = mptcp_subflow_tcp_sock(subflow);
> +		if (ssk && sk_fullsock(ssk)) {
> +			__entry->snd_wnd = tcp_sk(ssk)->snd_wnd;
> +			__entry->pace = ssk->sk_pacing_rate;
> +		} else {
> +			__entry->snd_wnd = 0;
> +			__entry->pace = 0;
>  		}
> +
> +		if (ssk && sk_fullsock(ssk) && __entry->pace)
> +			__entry->ratio = div_u64((u64)ssk->sk_wmem_queued << 32, __entry->pace);
> +		else
> +			__entry->ratio = 0;
>  	),
>  
>  	TP_printk("active=%d free=%d snd_wnd=%u pace=%u backup=%u ratio=%llu",

LGTM, thanks!

Paolo
Geliang Tang April 2, 2021, 3:35 a.m. UTC | #2
Note: v2 wasn't shown in ML since I forgot to cc mptcp@lists.linux.dev in
it. Sorry about that.

-Geliang

Paolo Abeni <pabeni@redhat.com> 于2021年4月2日周五 上午1:14写道:
>
> On Fri, 2021-04-02 at 00:54 +0800, Geliang Tang wrote:
> > Reduce the indentation level and zero the uninitialized fields.
> >
> > Suggested-by: Paolo Abeni <pabeni@redhat.com>
> > Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> > ---
> >  include/trace/events/mptcp.h | 27 +++++++++++++++++----------
> >  1 file changed, 17 insertions(+), 10 deletions(-)
> >
> > diff --git a/include/trace/events/mptcp.h b/include/trace/events/mptcp.h
> > index f1c836573744..b1617a0162da 100644
> > --- a/include/trace/events/mptcp.h
> > +++ b/include/trace/events/mptcp.h
> > @@ -23,22 +23,29 @@ TRACE_EVENT(mptcp_subflow_get_send,
> >       ),
> >
> >       TP_fast_assign(
> > -             bool sk = sk_fullsock(subflow->tcp_sock);
> > +             struct sock *ssk;
> >
> >               __entry->active = mptcp_subflow_active(subflow);
> >               __entry->backup = subflow->backup;
> > -             if (sk) {
> > -                     struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> >
> > +             if (subflow->tcp_sock && sk_fullsock(subflow->tcp_sock))
> >                       __entry->free = sk_stream_memory_free(subflow->tcp_sock);
> > -                     if (ssk) {
> > -                             __entry->snd_wnd = tcp_sk(ssk)->snd_wnd;
> > -                             __entry->pace = ssk->sk_pacing_rate;
> > -                             if (__entry->pace)
> > -                                     __entry->ratio = div_u64((u64)ssk->sk_wmem_queued << 32,
> > -                                                              __entry->pace);
> > -                     }
> > +             else
> > +                     __entry->free = 0;
> > +
> > +             ssk = mptcp_subflow_tcp_sock(subflow);
> > +             if (ssk && sk_fullsock(ssk)) {
> > +                     __entry->snd_wnd = tcp_sk(ssk)->snd_wnd;
> > +                     __entry->pace = ssk->sk_pacing_rate;
> > +             } else {
> > +                     __entry->snd_wnd = 0;
> > +                     __entry->pace = 0;
> >               }
> > +
> > +             if (ssk && sk_fullsock(ssk) && __entry->pace)
> > +                     __entry->ratio = div_u64((u64)ssk->sk_wmem_queued << 32, __entry->pace);
> > +             else
> > +                     __entry->ratio = 0;
> >       ),
> >
> >       TP_printk("active=%d free=%d snd_wnd=%u pace=%u backup=%u ratio=%llu",
>
> LGTM, thanks!
>
> Paolo
>
Matthieu Baerts April 2, 2021, 7:18 p.m. UTC | #3
Hi Geliang, Paolo,

On 01/04/2021 18:54, Geliang Tang wrote:
> Reduce the indentation level and zero the uninitialized fields.
> 
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

Thank you for the squash-to patch and the review!

Now in our tree:

- 8c49e105a00a: "squashed" in "mptcp: add tracepoint in 
mptcp_subflow_get_send"
- Results: 9f7fd6e1752e..f6973d0e03b2

Tests + export have been started!

Cheers,
Matt
diff mbox series

Patch

diff --git a/include/trace/events/mptcp.h b/include/trace/events/mptcp.h
index f1c836573744..b1617a0162da 100644
--- a/include/trace/events/mptcp.h
+++ b/include/trace/events/mptcp.h
@@ -23,22 +23,29 @@  TRACE_EVENT(mptcp_subflow_get_send,
 	),
 
 	TP_fast_assign(
-		bool sk = sk_fullsock(subflow->tcp_sock);
+		struct sock *ssk;
 
 		__entry->active = mptcp_subflow_active(subflow);
 		__entry->backup = subflow->backup;
-		if (sk) {
-			struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
 
+		if (subflow->tcp_sock && sk_fullsock(subflow->tcp_sock))
 			__entry->free = sk_stream_memory_free(subflow->tcp_sock);
-			if (ssk) {
-				__entry->snd_wnd = tcp_sk(ssk)->snd_wnd;
-				__entry->pace = ssk->sk_pacing_rate;
-				if (__entry->pace)
-					__entry->ratio = div_u64((u64)ssk->sk_wmem_queued << 32,
-								 __entry->pace);
-			}
+		else
+			__entry->free = 0;
+
+		ssk = mptcp_subflow_tcp_sock(subflow);
+		if (ssk && sk_fullsock(ssk)) {
+			__entry->snd_wnd = tcp_sk(ssk)->snd_wnd;
+			__entry->pace = ssk->sk_pacing_rate;
+		} else {
+			__entry->snd_wnd = 0;
+			__entry->pace = 0;
 		}
+
+		if (ssk && sk_fullsock(ssk) && __entry->pace)
+			__entry->ratio = div_u64((u64)ssk->sk_wmem_queued << 32, __entry->pace);
+		else
+			__entry->ratio = 0;
 	),
 
 	TP_printk("active=%d free=%d snd_wnd=%u pace=%u backup=%u ratio=%llu",