Skip to contentSkip to conversation

tcp: Add tracepoint for tcp_set_ca_state

PATCH Applied jackygam2001 3 participants 4 messages Apr 6, 2022 – Apr 8, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp: Add tracepoint for tcp_set_ca_state

From: Ping Gan <[email protected]>

The congestion status of a tcp flow may be updated since there is congestion between tcp sender and receiver. It makes sense to add tracepoint for congestion status set function to summate cc status duration and evaluate the performance of network and congestion algorithm. the backgound of this patch is below.

---
 include/net/tcp.h          | 12 +++---------
 include/trace/events/tcp.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
 net/ipv4/tcp_cong.c        | 12 ++++++++++++
 3 files changed, 60 insertions(+), 9 deletions(-)
include/net/tcp.h +3 -9
index 70ca4a5e330a..9a3786f33798 100644
@@ -1139,15 +1139,6 @@ static inline bool tcp_ca_needs_ecn(const struct sock *sk)
 	return icsk->icsk_ca_ops->flags & TCP_CONG_NEEDS_ECN;
 }
 
-static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
-{
-	struct inet_connection_sock *icsk = inet_csk(sk);
-
-	if (icsk->icsk_ca_ops->set_state)
-		icsk->icsk_ca_ops->set_state(sk, ca_state);
-	icsk->icsk_ca_state = ca_state;
-}
-
 static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
 {
 	const struct inet_connection_sock *icsk = inet_csk(sk);
@@ -1156,6 +1147,9 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
 		icsk->icsk_ca_ops->cwnd_event(sk, event);
 }
 
+/* From tcp_cong.c */
+void tcp_set_ca_state(struct sock *sk, const u8 ca_state);
+
 /* From tcp_rate.c */
 void tcp_rate_skb_sent(struct sock *sk, struct sk_buff *skb);
 void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb,
include/trace/events/tcp.h +45 -0

51 lines not on this page · raw message

net/ipv4/tcp_cong.c +12 -0
index dc95572163df..98b48bdb8be7 100644
@@ -16,6 +16,7 @@
 #include <linux/gfp.h>
 #include <linux/jhash.h>
 #include <net/tcp.h>
+#include <trace/events/tcp.h>
 
 static DEFINE_SPINLOCK(tcp_cong_list_lock);
 static LIST_HEAD(tcp_cong_list);
@@ -33,6 +34,17 @@ struct tcp_congestion_ops *tcp_ca_find(const char *name)
 	return NULL;
 }
 
+void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
+{
+	struct inet_connection_sock *icsk = inet_csk(sk);
+
+	trace_tcp_cong_state_set(sk, ca_state);
+
+	if (icsk->icsk_ca_ops->set_state)
+		icsk->icsk_ca_ops->set_state(sk, ca_state);
+	icsk->icsk_ca_state = ca_state;
+}
+
 /* Must be called with rcu lock held */
 static struct tcp_congestion_ops *tcp_ca_find_autoload(struct net *net,
 						       const char *name)
Signature · 1 line
2.15.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · On Tue, Apr 5, 2022 at 6:12 PM jackygam2001 <[email protected]> wrote:

From: Ping Gan <[email protected]>

The congestion status of a tcp flow may be updated since there is congestion between tcp sender and receiver. It makes sense to add tracepoint for congestion status set function to summate cc status duration and evaluate the performance of network and congestion algorithm. the backgound of this patch is below.

Quoted 4 lines

---

This seems good to me, thanks.

#2 lore raw
Quoted 10 lines · Eric Dumazet
Quoted 9 lines · On Tue, Apr 5, 2022 at 6:12 PM jackygam2001 <[email protected]> wrote:

From: Ping Gan <[email protected]>

The congestion status of a tcp flow may be updated since there is congestion between tcp sender and receiver. It makes sense to add tracepoint for congestion status set function to summate cc status duration and evaluate the performance of network and congestion algorithm. the backgound of this patch is below.

Quoted 8 lines
Quoted 4 lines

---

This seems good to me, thanks.

Thanks for you comment and review!

#3 lore raw
In reply to jackygam2001
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 6 Apr 2022 09:09:56 +0800 you wrote:

From: Ping Gan <[email protected]>

The congestion status of a tcp flow may be updated since there is congestion between tcp sender and receiver. It makes sense to add tracepoint for congestion status set function to summate cc status duration and evaluate the performance of network and congestion algorithm. the backgound of this patch is below.

[...]

Here is the summary with links:
- [net-next] tcp: Add tracepoint for tcp_set_ca_state

    https://git.kernel.org/netdev/net-next/c/15fcdf6ae116

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html