Skip to contentSkip to conversation

ss: output dctcp diag information

PATCH Applied Daniel Borkmann 2 participants 2 messages Sep 29, 2014 – Oct 30, 2014

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

PATCH 1/1 ss: output dctcp diag information

Dump useful DCTCP state/debug information gathered from diag.

---
 include/linux/inet_diag.h | 13 +++++++++++--
 misc/ss.c                 | 13 +++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
include/linux/inet_diag.h +11 -2
index e34f247..7438dad 100644
@@ -110,10 +110,10 @@ enum {
 	INET_DIAG_TCLASS,
 	INET_DIAG_SKMEMINFO,
 	INET_DIAG_SHUTDOWN,
+	INET_DIAG_DCTCPINFO,
 };
 
-#define INET_DIAG_MAX INET_DIAG_SHUTDOWN
-
+#define INET_DIAG_MAX INET_DIAG_DCTCPINFO
 
 /* INET_DIAG_MEM */
 
@@ -133,5 +133,14 @@ struct tcpvegas_info {
 	__u32	tcpv_minrtt;
 };
 
+/* INET_DIAG_DCTCPINFO */
+
+struct tcp_dctcp_info {
+	__u16	dctcp_enabled;
+	__u16	dctcp_ce_state;
+	__u32	dctcp_alpha;
+	__u32	dctcp_ab_ecn;
+	__u32	dctcp_ab_tot;
+};
 
 #endif /* _INET_DIAG_H_ */
misc/ss.c +13 -0
index c847954..f5019e1 100644
@@ -1576,6 +1576,19 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
 				rtt =  vinfo->tcpv_rtt;
 		}
 
+		if (tb[INET_DIAG_DCTCPINFO]) {
+			const struct tcp_dctcp_info *dinfo
+				= RTA_DATA(tb[INET_DIAG_DCTCPINFO]);
+
+			if (dinfo->dctcp_enabled) {
+				printf(" ce_state %u alpha %u ab_ecn %u ab_tot %u",
+				       dinfo->dctcp_ce_state, dinfo->dctcp_alpha,
+				       dinfo->dctcp_ab_ecn, dinfo->dctcp_ab_tot);
+			} else {
+				printf(" fallback_mode");
+			}
+		}
+
 		if (rtt > 0 && info->tcpi_snd_mss && info->tcpi_snd_cwnd) {
 			printf(" send %sbps",
 			       sprint_bw(b1, (double) info->tcpi_snd_cwnd *
Signature · 1 line
1.9.0