:p
atchew
Login
Some MPTCP counters from mptcp_info structure have been added in the kernel but not in ss. Before adding the new counters in patch 3/3, patch 1/3 makes sure all unsigned counters are displayed as unsigned. Patch 2/3 displays all seq related counters as decimal instead of hexadecimal. Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- Matthieu Baerts (3): ss: mptcp: display info counters as unsigned ss: mptcp: display seq related counters as decimal ss: mptcp: print missing info counters misc/ss.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) --- base-commit: 872148f54e35cb13aa6c9e48e52306cd469aaa53 change-id: 20230817-mptcp-issue-415-ss-mptcp-info-6-5-9d6fa5121fb0 Best regards, -- Matthieu Baerts <matthieu.baerts@tessares.net>
Some counters from mptcp_info structure were stored as an unsigned number (u8) but displayed as a signed one. Even if it is unlikely these u8 counters -- number of subflows and ADD_ADDR -- have a value bigger than 2^7, it still sounds better to display them as unsigned. Fixes: 9c3be2c0 ("ss: mptcp: add msk diag interface support") Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- misc/ss.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index XXXXXXX..XXXXXXX 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -XXX,XX +XXX,XX @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, static void mptcp_stats_print(struct mptcp_info *s) { if (s->mptcpi_subflows) - out(" subflows:%d", s->mptcpi_subflows); + out(" subflows:%u", s->mptcpi_subflows); if (s->mptcpi_add_addr_signal) - out(" add_addr_signal:%d", s->mptcpi_add_addr_signal); + out(" add_addr_signal:%u", s->mptcpi_add_addr_signal); if (s->mptcpi_add_addr_accepted) - out(" add_addr_accepted:%d", s->mptcpi_add_addr_accepted); + out(" add_addr_accepted:%u", s->mptcpi_add_addr_accepted); if (s->mptcpi_subflows_max) - out(" subflows_max:%d", s->mptcpi_subflows_max); + out(" subflows_max:%u", s->mptcpi_subflows_max); if (s->mptcpi_add_addr_signal_max) - out(" add_addr_signal_max:%d", s->mptcpi_add_addr_signal_max); + out(" add_addr_signal_max:%u", s->mptcpi_add_addr_signal_max); if (s->mptcpi_add_addr_accepted_max) - out(" add_addr_accepted_max:%d", s->mptcpi_add_addr_accepted_max); + out(" add_addr_accepted_max:%u", s->mptcpi_add_addr_accepted_max); if (s->mptcpi_flags & MPTCP_INFO_FLAG_FALLBACK) out(" fallback"); if (s->mptcpi_flags & MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED) -- 2.40.1
This is aligned with what is printed for TCP sockets. The main difference here is that these counters can be larger (u32 vs u64) but WireShark and TCPDump are also printing these MPTCP counters as decimal and they look fine. So it sounds better to do the same here with ss for those who want to easily count how many bytes have been exchanged between two runs without having to think in hexa. Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- misc/ss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index XXXXXXX..XXXXXXX 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -XXX,XX +XXX,XX @@ static void mptcp_stats_print(struct mptcp_info *s) if (s->mptcpi_token) out(" token:%x", s->mptcpi_token); if (s->mptcpi_write_seq) - out(" write_seq:%llx", s->mptcpi_write_seq); + out(" write_seq:%llu", s->mptcpi_write_seq); if (s->mptcpi_snd_una) - out(" snd_una:%llx", s->mptcpi_snd_una); + out(" snd_una:%llu", s->mptcpi_snd_una); if (s->mptcpi_rcv_nxt) - out(" rcv_nxt:%llx", s->mptcpi_rcv_nxt); + out(" rcv_nxt:%llu", s->mptcpi_rcv_nxt); } static void mptcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, -- 2.40.1
These new counters have been added in different kernel versions: - v5.12: local_addr_used, local_addr_max - v5.13: csum_enabled - v6.5: retransmits, bytes_retrans, bytes_sent, bytes_received, bytes_acked It is interesting to display them if they are available. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/415 Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- misc/ss.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/misc/ss.c b/misc/ss.c index XXXXXXX..XXXXXXX 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -XXX,XX +XXX,XX @@ static void mptcp_stats_print(struct mptcp_info *s) out(" snd_una:%llu", s->mptcpi_snd_una); if (s->mptcpi_rcv_nxt) out(" rcv_nxt:%llu", s->mptcpi_rcv_nxt); + if (s->mptcpi_local_addr_used) + out(" local_addr_used:%u", s->mptcpi_local_addr_used); + if (s->mptcpi_local_addr_max) + out(" local_addr_max:%u", s->mptcpi_local_addr_max); + if (s->mptcpi_csum_enabled) + out(" csum_enabled:%u", s->mptcpi_csum_enabled); + if (s->mptcpi_retransmits) + out(" retransmits:%u", s->mptcpi_retransmits); + if (s->mptcpi_bytes_retrans) + out(" bytes_retrans:%llu", s->mptcpi_bytes_retrans); + if (s->mptcpi_bytes_sent) + out(" bytes_sent:%llu", s->mptcpi_bytes_sent); + if (s->mptcpi_bytes_received) + out(" bytes_received:%llu", s->mptcpi_bytes_received); + if (s->mptcpi_bytes_acked) + out(" bytes_acked:%llu", s->mptcpi_bytes_acked); } static void mptcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, -- 2.40.1
Some MPTCP counters from mptcp_info structure have been added in the kernel but not in ss. Before adding the new counters in patch 3/3, patch 1/3 makes sure all unsigned counters are displayed as unsigned. Patch 2/3 displays all seq related counters as decimal instead of hexadecimal. Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- Matthieu Baerts (3): ss: mptcp: display info counters as unsigned ss: mptcp: display seq related counters as decimal ss: mptcp: print missing info counters misc/ss.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) --- base-commit: 872148f54e35cb13aa6c9e48e52306cd469aaa53 change-id: 20230817-mptcp-issue-415-ss-mptcp-info-6-5-9d6fa5121fb0 Best regards, -- Matthieu Baerts <matthieu.baerts@tessares.net>
Some counters from mptcp_info structure were stored as an unsigned number (u8) but displayed as a signed one. Even if it is unlikely these u8 counters -- number of subflows and ADD_ADDR -- have a value bigger than 2^7, it still sounds better to display them as unsigned. Fixes: 9c3be2c0 ("ss: mptcp: add msk diag interface support") Acked-by: Paolo Abeni <pabeni@redhat.com> Acked-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- misc/ss.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index XXXXXXX..XXXXXXX 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -XXX,XX +XXX,XX @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, static void mptcp_stats_print(struct mptcp_info *s) { if (s->mptcpi_subflows) - out(" subflows:%d", s->mptcpi_subflows); + out(" subflows:%u", s->mptcpi_subflows); if (s->mptcpi_add_addr_signal) - out(" add_addr_signal:%d", s->mptcpi_add_addr_signal); + out(" add_addr_signal:%u", s->mptcpi_add_addr_signal); if (s->mptcpi_add_addr_accepted) - out(" add_addr_accepted:%d", s->mptcpi_add_addr_accepted); + out(" add_addr_accepted:%u", s->mptcpi_add_addr_accepted); if (s->mptcpi_subflows_max) - out(" subflows_max:%d", s->mptcpi_subflows_max); + out(" subflows_max:%u", s->mptcpi_subflows_max); if (s->mptcpi_add_addr_signal_max) - out(" add_addr_signal_max:%d", s->mptcpi_add_addr_signal_max); + out(" add_addr_signal_max:%u", s->mptcpi_add_addr_signal_max); if (s->mptcpi_add_addr_accepted_max) - out(" add_addr_accepted_max:%d", s->mptcpi_add_addr_accepted_max); + out(" add_addr_accepted_max:%u", s->mptcpi_add_addr_accepted_max); if (s->mptcpi_flags & MPTCP_INFO_FLAG_FALLBACK) out(" fallback"); if (s->mptcpi_flags & MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED) -- 2.40.1
This is aligned with what is printed for TCP sockets. The main difference here is that these counters can be larger (u32 vs u64) but WireShark and TCPDump are also printing these MPTCP counters as decimal and they look fine. So it sounds better to do the same here with ss for those who want to easily count how many bytes have been exchanged between two runs without having to think in hexa. Acked-by: Paolo Abeni <pabeni@redhat.com> Acked-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- misc/ss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index XXXXXXX..XXXXXXX 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -XXX,XX +XXX,XX @@ static void mptcp_stats_print(struct mptcp_info *s) if (s->mptcpi_token) out(" token:%x", s->mptcpi_token); if (s->mptcpi_write_seq) - out(" write_seq:%llx", s->mptcpi_write_seq); + out(" write_seq:%llu", s->mptcpi_write_seq); if (s->mptcpi_snd_una) - out(" snd_una:%llx", s->mptcpi_snd_una); + out(" snd_una:%llu", s->mptcpi_snd_una); if (s->mptcpi_rcv_nxt) - out(" rcv_nxt:%llx", s->mptcpi_rcv_nxt); + out(" rcv_nxt:%llu", s->mptcpi_rcv_nxt); } static void mptcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, -- 2.40.1
These new counters have been added in different kernel versions: - v5.12: local_addr_used, local_addr_max - v5.13: csum_enabled - v6.5: retransmits, bytes_retrans, bytes_sent, bytes_received, bytes_acked It is interesting to display them if they are available. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/415 Acked-by: Paolo Abeni <pabeni@redhat.com> Acked-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- misc/ss.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/misc/ss.c b/misc/ss.c index XXXXXXX..XXXXXXX 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -XXX,XX +XXX,XX @@ static void mptcp_stats_print(struct mptcp_info *s) out(" snd_una:%llu", s->mptcpi_snd_una); if (s->mptcpi_rcv_nxt) out(" rcv_nxt:%llu", s->mptcpi_rcv_nxt); + if (s->mptcpi_local_addr_used) + out(" local_addr_used:%u", s->mptcpi_local_addr_used); + if (s->mptcpi_local_addr_max) + out(" local_addr_max:%u", s->mptcpi_local_addr_max); + if (s->mptcpi_csum_enabled) + out(" csum_enabled:%u", s->mptcpi_csum_enabled); + if (s->mptcpi_retransmits) + out(" retransmits:%u", s->mptcpi_retransmits); + if (s->mptcpi_bytes_retrans) + out(" bytes_retrans:%llu", s->mptcpi_bytes_retrans); + if (s->mptcpi_bytes_sent) + out(" bytes_sent:%llu", s->mptcpi_bytes_sent); + if (s->mptcpi_bytes_received) + out(" bytes_received:%llu", s->mptcpi_bytes_received); + if (s->mptcpi_bytes_acked) + out(" bytes_acked:%llu", s->mptcpi_bytes_acked); } static void mptcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, -- 2.40.1