From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
edumazet@google.com, pabeni@redhat.com
Subject: Re: [PATCH net-next] tcp_metrics: add netlink protocol spec in YAML
Date: Thu, 27 Jun 2024 10:20:15 +0100 [thread overview]
Message-ID: <m2o77md9o0.fsf@gmail.com> (raw)
In-Reply-To: <20240626201133.2572487-1-kuba@kernel.org> (Jakub Kicinski's message of "Wed, 26 Jun 2024 13:11:33 -0700")
Jakub Kicinski <kuba@kernel.org> writes:
> Add a protocol spec for tcp_metrics, so that it's accessible via YNL.
> Useful at the very least for testing fixes.
>
> In this episode of "10,000 ways to complicate netlink" the metric
> nest has defines which are off by 1. iproute2 does:
>
> struct rtattr *m[TCP_METRIC_MAX + 1 + 1];
>
> parse_rtattr_nested(m, TCP_METRIC_MAX + 1, a);
>
> for (i = 0; i < TCP_METRIC_MAX + 1; i++) {
> // ...
> attr = m[i + 1];
>
> This is too weird to support in YNL, add a new set of defines
> with _correct_ values to the official kernel header.
I had to add tcp_metrics.h to Makefile.deps to get the generated code to
complile.
diff --git a/tools/net/ynl/Makefile.deps b/tools/net/ynl/Makefile.deps
index f4e8eb79c1b8..2f05f8ec2324 100644
--- a/tools/net/ynl/Makefile.deps
+++ b/tools/net/ynl/Makefile.deps
@@ -25,3 +25,4 @@ CFLAGS_nfsd:=$(call get_hdr_inc,_LINUX_NFSD_NETLINK_H,nfsd_netlink.h)
CFLAGS_ovs_datapath:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h)
CFLAGS_ovs_flow:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h)
CFLAGS_ovs_vport:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h)
+CFLAGS_tcp_metrics:=$(call get_hdr_inc,__LINUX_TCP_METRICS_H,tcp_metrics.h)
> +
> + -
> + name: metrics
> + # Intentially don't define the name-prefix to match the kernel, see below.
Typo: Intentionally
> + doc: |
> + Attributes with metrics. Note that the values here do not match
> + the TCP_METRIC_* defines in the kernel, because kernel defines
> + are off-by one (e.g. rtt is defined as enum 0, while netlink carries
> + attribute type 1).
> + attributes:
> + -
> + name: rtt
> + type: u32
> + doc: |
> + Round Trip Time (RTT), in msecs with 3 bits fractional
> + (left-shift by 3 to get the msec value).
> + -
> + name: rttvar
> + type: u32
> + doc: |
> + Round Trip Time VARiance (RTT), in msecs with 2 bits fractional
> + (left-shift by 2 to get the msec value).
> + -
> + name: ssthresh
> + type: u32
> + doc: Slow Start THRESHold.
> + -
> + name: cwnd
> + type: u32
> + doc: Congestion Window.
> + -
> + name: reodering
> + type: u32
> + doc: Reodering metric.
> + -
> + name: rtt_us
Should this be a dash, 'rtt-us' ?
> + type: u32
> + doc: |
> + Round Trip Time (RTT), in usecs, with 3 bits fractional
> + (left-shift by 3 to get the msec value).
> + -
> + name: rttvar_us
Same here?
> + type: u32
> + doc: |
> + Round Trip Time (RTT), in usecs, with 3 bits fractional
> + (left-shift by 3 to get the msec value).
> +
next prev parent reply other threads:[~2024-06-27 9:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 20:11 [PATCH net-next] tcp_metrics: add netlink protocol spec in YAML Jakub Kicinski
2024-06-27 9:20 ` Donald Hunter [this message]
2024-06-27 19:03 ` Jakub Kicinski
2024-06-27 10:34 ` Donald Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2o77md9o0.fsf@gmail.com \
--to=donald.hunter@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).