mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [MPTCP][PATCH v3 mptcp-next] Squash to "mptcp: add tracepoint in mptcp_subflow_get_send"
@ 2021-04-01 16:54 Geliang Tang
  2021-04-01 17:14 ` Paolo Abeni
  2021-04-02 19:18 ` Matthieu Baerts
  0 siblings, 2 replies; 4+ messages in thread
From: Geliang Tang @ 2021-04-01 16:54 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang, Paolo Abeni

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",
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-02 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 16:54 [MPTCP][PATCH v3 mptcp-next] Squash to "mptcp: add tracepoint in mptcp_subflow_get_send" Geliang Tang
2021-04-01 17:14 ` Paolo Abeni
2021-04-02  3:35   ` Geliang Tang
2021-04-02 19:18 ` Matthieu Baerts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).