tcp: Add tracepoint for tcp_set_ca_state
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. Link: https://github.com/iovisor/bcc/pull/3899 Signed-off-by: Ping Gan <jacky_gam_2001@163.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20220406010956.19656-1-jacky_gam_2001@163.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user