From patchwork Mon Dec 4 09:19:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13477976 X-Patchwork-Delegate: dsahern@gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WWtLPfIH" Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04944101 for ; Mon, 4 Dec 2023 01:19:16 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5d340a9cf07so64181607b3.3 for ; Mon, 04 Dec 2023 01:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701681555; x=1702286355; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=y5Rd1tgTUvyMs83JE7brV4nb0+zXx5TKbcvBUy55/2o=; b=WWtLPfIHe78Zyot2VuMKa/ix7voITVSri7fpmjLFUTM3//2q2xH29Iiwyu8GGNT2G0 Z8Oydg1Owvrj5UlPZB8SGl3wKOhK6Jcqod+/cminV0toJb6hwpQfs+1jZvAx1HVWPucJ 8tjmBTjz6C0XN9OvmUVGx7+Uv33ihzWGx2mR37iifvgdija4KGncAaDjHVpLt/0zgXfX fj/uXoqRZ2TJlLJwbjUGI8hd9RWgYYJfIDTDrghI5Imwscx1pvQjLX/H4xA68PKOcP2H yucUXmKjMvP29WbwXr7wZaCBZ/y4RoZYKVXBlZ/5QgMmRv+raskakybhAR6/II2QtKMK qyOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701681555; x=1702286355; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y5Rd1tgTUvyMs83JE7brV4nb0+zXx5TKbcvBUy55/2o=; b=CWcpHifXUuY8CmFWFuYx1QxQ4HeQCnSuBTDnWXvIsM6KdNdN3NkNFTMk+l31AgFZWX cPHVqxMvKewYwTuHJK6JqGBcS+dhpzhM2lVFbbpih2B1eUd9tgBm9Beh8NN6dBCgzUeW cZ38f1CDkTzU/xfQb+qZEKcrc3otJudlIm5iJob2FFVJ1GEcjr+SaxmOw9JI5fUDg0yJ ZrXa3msrITOhnJRr/vRZjCwKcNEHOg4HobzjbRmXj3zwy8xj8++Id48rrCpsPAuwHMPk W4OR8rJuDOU2Sl4Jb8RDcYGJkyjMjC6g43FrhIt+8H4iTzgIdFsZVOeHjebgjnaGdJt+ tMDA== X-Gm-Message-State: AOJu0YxNvqBqSL66T4XzYGYEOJLIl5Hedjm4Ee4ZHy9duuIfVdI7jAbG vAPo4a5hmVWpuifW4oq8BiW7MUQFNgWYGw== X-Google-Smtp-Source: AGHT+IE9v9rpIZoqrB5PjQQykbTo8vu9z/5iBxpRHLgykstmCBt71Zle0GvjKPmL4cmaxLKGTID/aJ6DXA/Suw== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a81:9ad3:0:b0:5d3:9513:4aad with SMTP id r202-20020a819ad3000000b005d395134aadmr341892ywg.3.1701681555191; Mon, 04 Dec 2023 01:19:15 -0800 (PST) Date: Mon, 4 Dec 2023 09:19:07 +0000 In-Reply-To: <20231204091911.1326130-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20231204091911.1326130-1-edumazet@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Message-ID: <20231204091911.1326130-2-edumazet@google.com> Subject: [PATCH iproute2 1/5] ip route: add support for TCP usec TS From: Eric Dumazet To: David Ahern , Stephen Hemminger Cc: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Neal Cardwell , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: dsahern@gmail.com linux-6.7 got support for TCP usec resolution timestamps, using one bit in the features mask : RTAX_FEATURE_TCP_USEC_TS. ip route add 10/8 ... features tcp_usec_ts Signed-off-by: Eric Dumazet --- ip/iproute.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ip/iproute.c b/ip/iproute.c index fdf1f9a9dd0a4b693516d0b29b12cd6463895317..73dbab48aa4533e2297a1b1dd43726b4b05466b9 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -351,6 +351,11 @@ static void print_rtax_features(FILE *fp, unsigned int features) features &= ~RTAX_FEATURE_ECN; } + if (features & RTAX_FEATURE_TCP_USEC_TS) { + print_null(PRINT_ANY, "tcp_usec_ts", "tcp_usec_ts ", NULL); + features &= ~RTAX_FEATURE_TCP_USEC_TS; + } + if (features) print_0xhex(PRINT_ANY, "features", "%#llx ", of); @@ -1349,6 +1354,8 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv) if (strcmp(*argv, "ecn") == 0) features |= RTAX_FEATURE_ECN; + else if (strcmp(*argv, "tcp_usec_ts") == 0) + features |= RTAX_FEATURE_TCP_USEC_TS; else invarg("\"features\" value not valid\n", *argv); break; From patchwork Mon Dec 4 09:19:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13477977 X-Patchwork-Delegate: dsahern@gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UH2NJLb6" Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4864106 for ; Mon, 4 Dec 2023 01:19:17 -0800 (PST) Received: by mail-qk1-x749.google.com with SMTP id af79cd13be357-77da6895c5bso613383885a.3 for ; Mon, 04 Dec 2023 01:19:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701681557; x=1702286357; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=qYMb1BHlApXAbHoP7W0B6oQP1AUehiPBoha05ujq6jQ=; b=UH2NJLb6uXLbus016hF2cIFQLllJZr0+A8xNf8kkcfRd3AFX4IPVGPXch+IkAOJ+lz 6sDq3G6vKVbKY9r9CBjo+XRnat/gSGF8R+9UVdNNg63oxlj++a70HGFIeHMMrnoBFCSA NRiAAzsZHOYGHMYllSwHfpCsrDaP3VPYmCxN808grQH+/dUN+FilLBL1GhwBlPmb8HBC 8Tuuh2qfAxikTJeKNK0ZQy/ms2yk1LpYJrFMjSXIppGqZF2pJohuSBssNhUVHpdOnPC8 DwHjDHoHmhXjFcp2NkpFUREgBS8txIzTqqCn3eTyD3zTjlQMJyHcFxKJjO7ebvt1bqI7 hOmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701681557; x=1702286357; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qYMb1BHlApXAbHoP7W0B6oQP1AUehiPBoha05ujq6jQ=; b=PGH4AMLRDm6STSTY1Mqv+QFNxdRaodCl5/GiauLAK0YNNJLJus8en3v73YSY+u7ddP TsoNflis5ZNEVT6ovkyPuPFMd6g31nHz0mrE4xcxVh6BxT6+6Ny+kkvhSC6QtF/YBWcw vg3nwusDQp7oDcrkT288VKFlUVYpbkyY4JxnjF6p++I5EoMomqrHhJ32Hz/PRem2vZxT RI6b0+WZv0cYqppvH8PuTgH8I01Wlnegd9qTi8n7g+NWX4G5ooaCbRXss0NcFugQT3tR lG5Ei/IXPYm4ss96AUwTGiZXPDy0PuNi3Gv+4RBPYrtiKuDkJ+3IHIWPGdTwUEOX4IIe bbyA== X-Gm-Message-State: AOJu0Yw2T7D45vuOpRgQv7OoyhrijojaMOdVgLjn1QUlruCuyeDavkRS 4x0nx5YuTMWbVwPGSbK7qTvSoeYclITDVQ== X-Google-Smtp-Source: AGHT+IGgFKYpE1W37ze1Tr2h0Pg4MlCQDqfP7UFlrloX/4oHocEGYEFhv+UjnxaRoLcfteCLtoEHC6LnYIEj7A== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a05:620a:e8f:b0:77d:bf6f:9290 with SMTP id w15-20020a05620a0e8f00b0077dbf6f9290mr518161qkm.13.1701681556828; Mon, 04 Dec 2023 01:19:16 -0800 (PST) Date: Mon, 4 Dec 2023 09:19:08 +0000 In-Reply-To: <20231204091911.1326130-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20231204091911.1326130-1-edumazet@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Message-ID: <20231204091911.1326130-3-edumazet@google.com> Subject: [PATCH iproute2 2/5] ss: add report of TCPI_OPT_USEC_TS From: Eric Dumazet To: David Ahern , Stephen Hemminger Cc: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Neal Cardwell , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: dsahern@gmail.com linux-6.7 supports usec resolution in TCP TS values. ss -ie can show if a flow is using this new resolution. $ ss -tie ... State Recv-Q Send-Q Local Address:Port Peer Address:Port Process ESTAB 0 12869632 [2002:a05:6608:295::]:37054 [2002:a05:6608:297::]:35721 ts usec_ts sack bbr2s wscale:12,12 ... Signed-off-by: Eric Dumazet --- misc/ss.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misc/ss.c b/misc/ss.c index 9438382b8e667529dc2cf4b020d8696a4175e992..3dacee48db0f805b3a7a3bd213771b86eceea1ab 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -875,6 +875,7 @@ struct tcpstat { unsigned long long bytes_sent; unsigned long long bytes_retrans; bool has_ts_opt; + bool has_usec_ts_opt; bool has_sack_opt; bool has_ecn_opt; bool has_ecnseen_opt; @@ -2562,6 +2563,8 @@ static void tcp_stats_print(struct tcpstat *s) if (s->has_ts_opt) out(" ts"); + if (s->has_usec_ts_opt) + out(" usec_ts"); if (s->has_sack_opt) out(" sack"); if (s->has_ecn_opt) @@ -3037,6 +3040,7 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, if (show_options) { s.has_ts_opt = TCPI_HAS_OPT(info, TCPI_OPT_TIMESTAMPS); + s.has_usec_ts_opt = TCPI_HAS_OPT(info, TCPI_OPT_USEC_TS); s.has_sack_opt = TCPI_HAS_OPT(info, TCPI_OPT_SACK); s.has_ecn_opt = TCPI_HAS_OPT(info, TCPI_OPT_ECN); s.has_ecnseen_opt = TCPI_HAS_OPT(info, TCPI_OPT_ECN_SEEN); From patchwork Mon Dec 4 09:19:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13477978 X-Patchwork-Delegate: dsahern@gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rQgfYref" Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A8F0103 for ; Mon, 4 Dec 2023 01:19:19 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d9a541b720aso3067490276.0 for ; Mon, 04 Dec 2023 01:19:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701681558; x=1702286358; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Arb8i5vAdWOSXn81AEoSvLDIp1fjLyYHYObNvnjaI/8=; b=rQgfYrefRKUQWXN2LiF8syDNKTL31S3fW8On2mz54IBjmgX24SvUxLA1p5cZ0Rcj7h +Ux+I7MqxtQAECOXufa9M1pNVE5xdk+hpfv0Z9HUJ1H6bm44uUH9VYZem0/srv0A74HN lNm6tNoV1Dz1ta29K/cE3ELJiTSBjjxJFv+Aa6c4FvR4cazxDRf583zcz0akza+XteXy FvCYTB+in604aBGQ3pyGiKLwu52Ib+IC+fLhXH8/3HG2oL6tJSN36f4PWLXHkBZ2giZh o3Nvh6mLotHejw49nsWXK/ofQ4shCUSTK1DsrcOhae1fNu8JD57T3aTHkgHUELkkQM/S 0/8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701681558; x=1702286358; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Arb8i5vAdWOSXn81AEoSvLDIp1fjLyYHYObNvnjaI/8=; b=ASSAZ/qq49WmsoOrc7UvlaoS2qv1v+e3EBzLWlQJq5EdG2RBbF15LjAfnBCwO8vFLF X9KjUA1KWX0ShIDz4w2MbipI5PI+rp93fizUHagFLdkPN/RF0LhKHgupb9ggniO3DQvH lKy0mt54GYGFhMgYZfDJ7WH3Ximb1oijxG04IS3hx0sTRN/sF3hEtG0CAsBRVFF23pcp YyRKANWNd0u+WMRgBH20KGFTF9TQNj36ecaJfEjjBIiorNm/NyGFK3kCgPJ51xgkuLga wrOubZJeHtwB1H5eZDuTlSYLFBKVyc6ISXgGiCyVmU5ozjzKWbeCHxQhN+Rgrs5YUiWA MFxw== X-Gm-Message-State: AOJu0YxdzDgjYeHgoIrYU7tdcWWiYcNeV+Cuu7ur0SCQiFggWTBeEWA4 genj9eK49E8dINpknVx5EhHHH/TZORasnw== X-Google-Smtp-Source: AGHT+IHc0s5ChGKWHCulCFiVI8NG7vo63vH04kpubDsXcose2FlVM7F+jcjFVUgzXAeN65v7i/es9BtcbddbIw== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a5b:a01:0:b0:db4:7d21:8cea with SMTP id k1-20020a5b0a01000000b00db47d218ceamr887607ybq.5.1701681558549; Mon, 04 Dec 2023 01:19:18 -0800 (PST) Date: Mon, 4 Dec 2023 09:19:09 +0000 In-Reply-To: <20231204091911.1326130-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20231204091911.1326130-1-edumazet@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Message-ID: <20231204091911.1326130-4-edumazet@google.com> Subject: [PATCH iproute2 3/5] tc: fq: add TCA_FQ_PRIOMAP handling From: Eric Dumazet To: David Ahern , Stephen Hemminger Cc: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Neal Cardwell , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: dsahern@gmail.com linux-6.7 FQ packet scheduler gets 3-bands, and the ability to report or program the associated priomap. $ tc qdisc show dev eth0 ... qdisc fq ... bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 $ tc qdisc change dev eth0 ... qdisc fq ... bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 Signed-off-by: Eric Dumazet --- tc/q_fq.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tc/q_fq.c b/tc/q_fq.c index 3277ebc7c43702dfd663eb90100954c44e312fc3..d6f724569932906515cd012d4d7f815966523934 100644 --- a/tc/q_fq.c +++ b/tc/q_fq.c @@ -25,6 +25,7 @@ static void explain(void) " [ quantum BYTES ] [ initial_quantum BYTES ]\n" " [ maxrate RATE ] [ buckets NUMBER ]\n" " [ [no]pacing ] [ refill_delay TIME ]\n" + " [ bands 3 priomap P0 P1 ... P14 P15 ]\n" " [ low_rate_threshold RATE ]\n" " [ orphan_mask MASK]\n" " [ timer_slack TIME]\n" @@ -48,6 +49,7 @@ static unsigned int ilog2(unsigned int val) static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { + struct tc_prio_qopt prio2band; unsigned int plimit; unsigned int flow_plimit; unsigned int quantum; @@ -74,6 +76,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, bool set_ce_threshold = false; bool set_timer_slack = false; bool set_horizon = false; + bool set_priomap = false; int pacing = -1; struct rtattr *tail; @@ -193,6 +196,48 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, pacing = 1; } else if (strcmp(*argv, "nopacing") == 0) { pacing = 0; + } else if (strcmp(*argv, "bands") == 0) { + int idx; + + if (set_priomap) { + fprintf(stderr, "Duplicate \"bands\"\n"); + return -1; + } + memset(&prio2band, 0, sizeof(prio2band)); + NEXT_ARG(); + if (get_integer(&prio2band.bands, *argv, 10)) { + fprintf(stderr, "Illegal \"bands\"\n"); + return -1; + } + if (prio2band.bands != 3) { + fprintf(stderr, "\"bands\" must be 3\n"); + return -1; + } + NEXT_ARG(); + if (strcmp(*argv, "priomap") != 0) { + fprintf(stderr, "\"priomap\" expected\n"); + return -1; + } + for (idx = 0; idx <= TC_PRIO_MAX; ++idx) { + unsigned band; + + if (!NEXT_ARG_OK()) { + fprintf(stderr, "Not enough elements in priomap\n"); + return -1; + } + NEXT_ARG(); + if (get_unsigned(&band, *argv, 10)) { + fprintf(stderr, "Illegal \"priomap\" element, number in [0..%u] expected\n", + prio2band.bands - 1); + return -1; + } + if (band >= prio2band.bands) { + fprintf(stderr, "\"priomap\" element %u too big\n", band); + return -1; + } + prio2band.priomap[idx] = band; + } + set_priomap = true; } else if (strcmp(*argv, "help") == 0) { explain(); return -1; @@ -252,6 +297,9 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, if (horizon_drop != 255) addattr_l(n, 1024, TCA_FQ_HORIZON_DROP, &horizon_drop, sizeof(horizon_drop)); + if (set_priomap) + addattr_l(n, 1024, TCA_FQ_PRIOMAP, + &prio2band, sizeof(prio2band)); addattr_nest_end(n, tail); return 0; } @@ -306,6 +354,17 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) if (pacing == 0) print_bool(PRINT_ANY, "pacing", "nopacing ", false); } + if (tb[TCA_FQ_PRIOMAP] && + RTA_PAYLOAD(tb[TCA_FQ_PRIOMAP]) >= sizeof(struct tc_prio_qopt)) { + struct tc_prio_qopt *prio2band = RTA_DATA(tb[TCA_FQ_PRIOMAP]); + int i; + + print_uint(PRINT_ANY, "bands", "bands %u ", prio2band->bands); + open_json_array(PRINT_ANY, "priomap "); + for (i = 0; i <= TC_PRIO_MAX; i++) + print_uint(PRINT_ANY, NULL, "%d ", prio2band->priomap[i]); + close_json_array(PRINT_ANY, ""); + } if (tb[TCA_FQ_QUANTUM] && RTA_PAYLOAD(tb[TCA_FQ_QUANTUM]) >= sizeof(__u32)) { quantum = rta_getattr_u32(tb[TCA_FQ_QUANTUM]); From patchwork Mon Dec 4 09:19:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13477979 X-Patchwork-Delegate: dsahern@gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="H/fOZX8z" Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B0E9F2 for ; Mon, 4 Dec 2023 01:19:21 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5d064f9e2a1so59403997b3.1 for ; Mon, 04 Dec 2023 01:19:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701681560; x=1702286360; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=dH7fxg7s8g2U4VGI4/VngLAD7JuHHoX+b6vwZarf2yU=; b=H/fOZX8zjZWZXKD6l73T8JpwgcRejPDiBfk7h5nUWn0+cbD/vH7roNLKhcXqpZSOvk ZAtL/IFHvCJ3yx2lkn5FRMXqdlOnPwM0Jd2aNMtOBpQdjRAFc66N+8/7HKBLPdc7/Wm8 2M7m5gLIpt5atcP8UqeO+/Yt7srEKhHYWhpcHsK1NrOTYqOrv2HbdMI5pteKTDM6iLZm 8uxCsMJqbqeltveu5q09lL/c9OteZq4CUf7P93lBcjzcUPqwPCptnRhKhCy51wym0j6q K3Y0l55VU3O1CMA00sc+/VB8hxMTc4AsdTbZx15hEg0IpqfxJMn2DUhPzvbynSuL8xG+ GZkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701681560; x=1702286360; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dH7fxg7s8g2U4VGI4/VngLAD7JuHHoX+b6vwZarf2yU=; b=MAlU8x6K0iMW9+IvS2tDRsgnac+Vyv4qoskw8OYhmWfVIKeD1beGzfrNZGsRxlNqEe O4DsDOF8xd/Bbp9i8I3KwtlKMok9UYtMYAp0Yd19eJBHsFDW4Nx9mxqg6Rn5OFh92AVG ENvWByv7n6diaNpM8S+TfNfH87ZJ0wVtWCI/FKeW5lc5cCI9f75B75oEKfnrFrbxoIv4 cZYUr8MVVz/Vct+RA5GE5E3olDfSYbQu6U85cQ1v5UbNg8w7Y8vdkZKK+xQeHAvP8wVJ qsyBQuDVKVSrORiOGYXJ11hcUyuAH5ZvBAbXUqvSK4GLPzhbtvXc21nMWaezAFvXVXt6 Rnrg== X-Gm-Message-State: AOJu0YxEKktXlficNHXcG4eTJc5oGV0YR4sfIUGJC77hqKP7dHvq3bWg C2ZHceZj1hRRxCD8cILIYTjJQt7/LhhkUw== X-Google-Smtp-Source: AGHT+IE0p4snC4sZNnR6cmilH2yI0R8HuTWHBWeJ+Oav45VHpypAhVLOjOxPJ3hVVWIe2gh5e5MTOJsUpimlCg== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a05:690c:989:b0:5d3:e8b8:e1fe with SMTP id ce9-20020a05690c098900b005d3e8b8e1femr312707ywb.0.1701681560244; Mon, 04 Dec 2023 01:19:20 -0800 (PST) Date: Mon, 4 Dec 2023 09:19:10 +0000 In-Reply-To: <20231204091911.1326130-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20231204091911.1326130-1-edumazet@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Message-ID: <20231204091911.1326130-5-edumazet@google.com> Subject: [PATCH iproute2 4/5] tc: fq: add TCA_FQ_WEIGHTS handling From: Eric Dumazet To: David Ahern , Stephen Hemminger Cc: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Neal Cardwell , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: dsahern@gmail.com Linux-6.7 FQ got WRR scheduling. TCA_FQ_WEIGHTS attribute can report/change per-band weights. tc qdisc show dev eth1 ... qdisc fq ... weights 589824 196608 65536 quantum 8364b ... Signed-off-by: Eric Dumazet --- tc/q_fq.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tc/q_fq.c b/tc/q_fq.c index d6f724569932906515cd012d4d7f815966523934..08bfbf4ef6db1838bca87d1d87d6923255a1a4f6 100644 --- a/tc/q_fq.c +++ b/tc/q_fq.c @@ -26,6 +26,7 @@ static void explain(void) " [ maxrate RATE ] [ buckets NUMBER ]\n" " [ [no]pacing ] [ refill_delay TIME ]\n" " [ bands 3 priomap P0 P1 ... P14 P15 ]\n" + " [ weights W1 W2 W3 ]\n" " [ low_rate_threshold RATE ]\n" " [ orphan_mask MASK]\n" " [ timer_slack TIME]\n" @@ -77,6 +78,8 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, bool set_timer_slack = false; bool set_horizon = false; bool set_priomap = false; + bool set_weights = false; + int weights[FQ_BANDS]; int pacing = -1; struct rtattr *tail; @@ -238,6 +241,33 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, prio2band.priomap[idx] = band; } set_priomap = true; + } else if (strcmp(*argv, "weights") == 0) { + int idx; + + if (set_weights) { + fprintf(stderr, "Duplicate \"weights\"\n"); + return -1; + } + NEXT_ARG(); + for (idx = 0; idx < FQ_BANDS; ++idx) { + int val; + + if (!NEXT_ARG_OK()) { + fprintf(stderr, "Not enough elements in weights\n"); + return -1; + } + NEXT_ARG(); + if (get_integer(&val, *argv, 10)) { + fprintf(stderr, "Illegal \"weights\" element, positive number expected\n"); + return -1; + } + if (val < FQ_MIN_WEIGHT) { + fprintf(stderr, "\"weight\" element %d too small\n", val); + return -1; + } + weights[idx] = val; + } + set_weights = true; } else if (strcmp(*argv, "help") == 0) { explain(); return -1; @@ -300,6 +330,9 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, if (set_priomap) addattr_l(n, 1024, TCA_FQ_PRIOMAP, &prio2band, sizeof(prio2band)); + if (set_weights) + addattr_l(n, 1024, TCA_FQ_WEIGHTS, + weights, sizeof(weights)); addattr_nest_end(n, tail); return 0; } @@ -365,6 +398,16 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) print_uint(PRINT_ANY, NULL, "%d ", prio2band->priomap[i]); close_json_array(PRINT_ANY, ""); } + if (tb[TCA_FQ_WEIGHTS] && + RTA_PAYLOAD(tb[TCA_FQ_WEIGHTS]) >= FQ_BANDS * sizeof(int)) { + const int *weights = RTA_DATA(tb[TCA_FQ_WEIGHTS]); + int i; + + open_json_array(PRINT_ANY, "weights "); + for (i = 0; i < FQ_BANDS; ++i) + print_uint(PRINT_ANY, NULL, "%d ", weights[i]); + close_json_array(PRINT_ANY, ""); + } if (tb[TCA_FQ_QUANTUM] && RTA_PAYLOAD(tb[TCA_FQ_QUANTUM]) >= sizeof(__u32)) { quantum = rta_getattr_u32(tb[TCA_FQ_QUANTUM]); From patchwork Mon Dec 4 09:19:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13477980 X-Patchwork-Delegate: dsahern@gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3tSx+fT1" Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A36A4103 for ; Mon, 4 Dec 2023 01:19:22 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5d1b2153ba1so55530787b3.2 for ; Mon, 04 Dec 2023 01:19:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701681562; x=1702286362; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=WFg20Zy13bAgrk38a7PgG5Nr6pvQ5q4+zvqB6YL75Fc=; b=3tSx+fT15PRvaPcPcBEd8t5hmimt9kpMFIat+MYHncjnb+DR5n1jMiYZ/wPO+NpxW4 fkPTb9hfh4WVcKINdMIT7/0iM8tK5GRXlum8O67ZaL53nl8tUyojMwhbbwhwu+OTBg4M 5W7JsRA6Iy6ol3lNDd35lAJiCctDGC9mLRCUxynPRopKj81qTVFV2XFt3NQRops4MEdf 42fs3IqbbUTQ6pL/Npm/fQJ/EUmNT/lTD8gwUzFFxoCXTFw9pQaEDxzDTVdeVsxtjTKM OMhlKXR3yqRLs0nsg/Dtw7jh4/Zfzc8KjN6OwQGhM0a4KycyH1ccgLaW+4G4dTBsTHp2 Hz9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701681562; x=1702286362; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WFg20Zy13bAgrk38a7PgG5Nr6pvQ5q4+zvqB6YL75Fc=; b=rqVLvWLBynPWOHf4uMQgKDG1dUui4Q7AcExlVGRpAQwCq4aHGeoSSE89E0tBn0AQDQ 2Xg6R92yLx8wcPSjBIPiCKophE2o52A6yAg9lXoeag4rpTGdkqOvcMI9srEajVcIUWJm FXOkNyaKjZpQ/34+Y91ov/Qp4bc339BKD0cWLYLLbNO2OmWqrOoF3VAK5w/qGtgcnNDP 5lkUN5PSWEoeEl4VcGPyzBImQCIt+QTVXdQTT24vJHzT6LLdphDLY6sR1PlxauqUgW4z G4D1DDys697BMU7SNzshX3+xJrber1uhSwMpCvQWWqob9aI7cBWZyPidnYzTQIANhTli QTdw== X-Gm-Message-State: AOJu0YxyHSl+kZBIMuQdk2qJfM4BjofMNlC/zNFLrKKUD+q0eD1MVC6I qIcDaU6gNOuZIeoo+ExvFO+A+zgXvUKArA== X-Google-Smtp-Source: AGHT+IETYcv4LOI9JTJcqt2tMl2k7AyOIsQAKRz/uysBVqAwY4TawBmAzIcu8v6zJlMcbvdT0QEDn4sqZP2kxA== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a25:74c4:0:b0:db5:4692:3aaf with SMTP id p187-20020a2574c4000000b00db546923aafmr279732ybc.6.1701681561857; Mon, 04 Dec 2023 01:19:21 -0800 (PST) Date: Mon, 4 Dec 2023 09:19:11 +0000 In-Reply-To: <20231204091911.1326130-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20231204091911.1326130-1-edumazet@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Message-ID: <20231204091911.1326130-6-edumazet@google.com> Subject: [PATCH iproute2 5/5] tc: fq: reports stats added in linux-6.7 From: Eric Dumazet To: David Ahern , Stephen Hemminger Cc: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Neal Cardwell , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: dsahern@gmail.com Report new fields added in linux-6.7: - fastpath : Number of packets that have used the fast path. - band[012]_pkts : Number of packets currently queued per band. - band[012]_drops : Counters of dropped packets, per band (only printed if not zero) Signed-off-by: Eric Dumazet --- tc/q_fq.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tc/q_fq.c b/tc/q_fq.c index 08bfbf4ef6db1838bca87d1d87d6923255a1a4f6..7f8a2b80d441857ecadc19ea77545092b7f4f02f 100644 --- a/tc/q_fq.c +++ b/tc/q_fq.c @@ -510,6 +510,10 @@ static int fq_print_xstats(struct qdisc_util *qu, FILE *f, print_uint(PRINT_ANY, "throttled", " throttled %u)", st->throttled_flows); + print_uint(PRINT_ANY, "band0_pkts", " band0_pkts %u", st->band_pkt_count[0]); + print_uint(PRINT_ANY, "band1_pkts", " band1_pkts %u", st->band_pkt_count[1]); + print_uint(PRINT_ANY, "band2_pkts", " band2_pkts %u", st->band_pkt_count[2]); + if (st->time_next_delayed_flow > 0) { print_lluint(PRINT_JSON, "next_packet_delay", NULL, st->time_next_delayed_flow); @@ -522,6 +526,10 @@ static int fq_print_xstats(struct qdisc_util *qu, FILE *f, print_lluint(PRINT_ANY, "highprio", " highprio %llu", st->highprio_packets); + if (st->fastpath_packets) + print_lluint(PRINT_ANY, "fastpath", " fastpath %llu", + st->fastpath_packets); + if (st->tcp_retrans) print_lluint(PRINT_ANY, "retrans", " retrans %llu", st->tcp_retrans); @@ -544,7 +552,10 @@ static int fq_print_xstats(struct qdisc_util *qu, FILE *f, st->flows_plimit); if (st->pkts_too_long || st->allocation_errors || - st->horizon_drops || st->horizon_caps) { + st->horizon_drops || st->horizon_caps || + st->band_drops[0] || + st->band_drops[1] || + st->band_drops[2]) { print_nl(); if (st->pkts_too_long) print_lluint(PRINT_ANY, "pkts_too_long", @@ -562,6 +573,18 @@ static int fq_print_xstats(struct qdisc_util *qu, FILE *f, print_lluint(PRINT_ANY, "horizon_caps", " horizon_caps %llu", st->horizon_caps); + if (st->band_drops[0]) + print_lluint(PRINT_ANY, "band0_drops", + " band0_drops %llu", + st->band_drops[0]); + if (st->band_drops[1]) + print_lluint(PRINT_ANY, "band1_drops", + " band1_drops %llu", + st->band_drops[1]); + if (st->band_drops[2]) + print_lluint(PRINT_ANY, "band2_drops", + " band2_drops %llu", + st->band_drops[2]); } return 0;