From patchwork Fri Mar 8 17:15:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13587115 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57D53282EB for ; Fri, 8 Mar 2024 17:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709918229; cv=none; b=nFXQzgmJ/G7BgoQKMD6LictJD+2zg5QceMIwx/V/cHveUQF8+H6o+kkHyksLpiteH5t9FcLUE11+MXfE4e9dYTC3jOm2awLGHmm0t82gNAgrs0xxSFfhKlPMLHntfmeIvVCrWUVuntxUVLYH4+wdceAvheyhhlYxcIUMjYGDL3E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709918229; c=relaxed/simple; bh=T0w0PlsudigSGGLTkEbWrg42Atbxixzn7hpTdqoOvLM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=klCCmgk8SKlgvYxh0TLbfpD07h9tFLr0nZPnyvo9lcgO5T4NhMDnADACSRRj14M9wubhY49iKtwbUnGF2oRwBCnLKSGn2itRcZaTOR5VPS0g6v8aWoX21r/BiwzBVLL3edqljdxQ5HWgfRFHtEFEIzOu23vveU33rN95jr8NdR0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=W7uZAZpt; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="W7uZAZpt" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6e61851dbaeso1430384b3a.2 for ; Fri, 08 Mar 2024 09:17:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709918226; x=1710523026; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=apMa0xe9W9HjRM8pDuHbm+GtS736Cy0jrUR5s8n0mT4=; b=W7uZAZptm+cKadG8xrrN2kGH7hsYOABvXvCNXnhGzKlWT1cspoHi6nGj4AEPeQbp3C qw2HPG7Q5/28VmtBqnp6r34ljilAJqe0sENXFicUKukKgKa1WOUcimwvTKBVZ5ZmOmCV 9+OLyFWbw8pQ97n+VnUSZOxL1B2daojpSP0AfVWK+sM/L3vLIK5IHP4L/iagXeJ9ED5P n+BnjJW01/Y7vQ0suhRMzCTdEsxSLgx16+pkPTjAFtBBgfuxkezviLcY8rB3QR3L1skP q+UQAAuosECZLa37vG53CKoklE+SaGv85/xOYim45+8xq+lS7X4wFcg/DIzD/s69z5+A 35tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709918226; x=1710523026; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=apMa0xe9W9HjRM8pDuHbm+GtS736Cy0jrUR5s8n0mT4=; b=X0NM1+QhYAxQA27c9ujnqfkv6o8xv4SYMZo0KnTSSUR66eoD8HhbAKWhlJajhhmZxi jkwd9oji/CdYYkBH3mUELRrF18I1dYY2yJCwhUK6HozIn2fkczj2d9lCXVM59YcvxXzk 3EZ2s1g9auvzjsTeFrAP2YAyoCi9EfjxAmqNIRbNow/VC1VmTm8QACWY+SyOkxw1/1Ym TxPQmr6vMex3D9vlNljtHH4LfW5xedCcdiU/YSr/w1ywp5HytSmNb/yNL4iSQbgOyNJI kgTVxjlbCZxsAETCrX9gpnd5F6UV8pccp/L8KhhRr+svZe5LH2pEQFHs2vbK8rVvSsaR yG9A== X-Gm-Message-State: AOJu0YzjqGLp5h+UYgJJSx9tudULrOkEjp1nvDVw23mRBXqzu5V/JrSr 1HYnCSaddh+M0j9Tkz6ixt22hGUccz1qGT7CLVkYFIGVyq8jd3hJbv7MT4Xi4i/Bk6e41E+Kzs8 iluA= X-Google-Smtp-Source: AGHT+IHAuBW0grVykvujiiy6Q3ydzKY8ylwApPRPqTfAHRxpOOG/dRRQh9teUy2nS9YM+I7bn9A2sw== X-Received: by 2002:a05:6a20:94c8:b0:1a1:7874:624b with SMTP id ht8-20020a056a2094c800b001a17874624bmr5515440pzb.44.1709918226549; Fri, 08 Mar 2024 09:17:06 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id r8-20020aa79ec8000000b006e50cedb59bsm14771413pfq.16.2024.03.08.09.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 09:17:06 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2-next 1/3] README: add note about kernel version compatibility Date: Fri, 8 Mar 2024 09:15:59 -0800 Message-ID: <20240308171656.9034-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com Since next netem changes will break some usages of out of support kernels, add an explicit policy about range of kernel versions. Signed-off-by: Stephen Hemminger --- README | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README b/README index 4eb9390a3ffa..a7d283cb809d 100644 --- a/README +++ b/README @@ -12,6 +12,19 @@ Stable version repository: Development repository: git://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git +Compatibility +------------- +A new release of iproute2 is done with each kernel version, but +there is a wide range of compatibility. Newer versions of iproute2 +will still work with older kernels, but there are some limitations. + +If an iproute2 command with a new feature is used with an older +kernel, the kernel may report an error or silently ignore the new +attribute. Likewise if older iproute2 is used with an newer kernel, +it is not possible to use or see new features. The range of +compatibility extends back as far as the oldest supported Long Term +Support (LTS) kernel version. + How to compile this. -------------------- 1. libdbm From patchwork Fri Mar 8 17:16:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13587116 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10AEF286AF for ; Fri, 8 Mar 2024 17:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709918230; cv=none; b=rH31uwCvFqRC053nU4141eiSHuzo1fRhkePkMhbI7mAV08tk0zdiZ9Rr+M9TymZMxaCAqoiqLyVMB1gQ1sHXVxxRbVE4KlObmaMHyjXklIWt9e1F179VnPJ9fFsbcijntoW1sZyyf/Z/+iCehTUcWZ4Xu8zREGUztHJh9B9+Bi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709918230; c=relaxed/simple; bh=Q6aOCwF7B4mqldpN86KMTTRsOdvz/XCWq4AmmqKYvuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cFDDa+kDAU2FYUXnsd1W09ZgZ440vXkK/8NwAbsmyQAj1Gz/3PtG6/dW4L0Z1iphALf9zhmv2d2wVLYzb5WKaBy/mL/jECkmtsgNpNYNbIneDZ5f8P43PRLYiHqu4BNOG0ZAkHZZB+TWi5akjM86dlrBqnuoTTUHC9Mgx5nV6zU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=WwjcRtRx; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="WwjcRtRx" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6e5a50d91b4so998851b3a.2 for ; Fri, 08 Mar 2024 09:17:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709918227; x=1710523027; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fjn1arFOZtY42L3iMyfXjex5TTyrofWpn5NwE42plWs=; b=WwjcRtRxQG8Fnwsffagu0MmZZZXkH2Zh3yno6+Id79sMvPlalsRAwuVgQRtS7XwVWy r2MBP+mznaknfnbWx1yqxaecEm1YlZoyX8lPU6D+3h046SJqJgVpLbPf3d72uU/8Eyoc 1aE6t7rx0rxnd+Imi3nGLB6RZ+CyrFwiOOL7qJm3cxcEJtF2AqVHZaPqOqONODO8foYp sf2tNIyX9FO8lQXBasRWWePGkndqYx9+t02K54kzK18WZychjAIDrtm0YjgXwZTthkUN C2twJUaX7kS6z0Z1tcmCLQEAugvJEKxCrRh7XoWymW9ziTihAgeNImZDSbMVm52XQhho fK7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709918227; x=1710523027; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fjn1arFOZtY42L3iMyfXjex5TTyrofWpn5NwE42plWs=; b=BN56PjrlVWGbnjtAZf3vhM71+nTd3ighP7Du/06kYuIbHMbFOq6FE0iW7JozofGDJn jCWpUwjNLgpGls4CIT+ZJNNaZENLTazAgAoQnVn/DyNhzU/vTmOnhKi5nr5u0najpHoH JRZbtQ//hjrT6qxLfjJbrAh8ZzV1PvnyCn2CM0qaC1SIIxXrnQ7RNMeh5hbtSGE7DBan iWCdT21RusF1/wMfH9QKx02CzYss7M60Z0fj1UNcCwM1Ssz5/lbAJsqn4p1kkRhXeAKn MfzQ743DNgX4BS71sk794ViM+dZMEA9Ff7GS+Vk4WEFXSmmyhBUPECV+cJ5q/Y4XR8QI SmEA== X-Gm-Message-State: AOJu0YzH3TSTD1XxwV9vf6Vh9aI0nLCCA45HPnNInaOmwUj5mTX8kIn2 sJHhURYwJ6iD0GUHhJhWXWDM/5s04jwf26BCcyZ6PXaPI2eHdqbxR+sTrSz1TlzZHuM0+npgSGI bRnk= X-Google-Smtp-Source: AGHT+IHZ1lVeVdoMxHsMo0KvSjz6mJzdAFg17R6UNNLBA5hHr6ccMAMq3UZeRO5RozbS4ngXsBiSoQ== X-Received: by 2002:a05:6a00:b95:b0:6e6:4ebc:3cd with SMTP id g21-20020a056a000b9500b006e64ebc03cdmr8535090pfj.27.1709918227287; Fri, 08 Mar 2024 09:17:07 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id r8-20020aa79ec8000000b006e50cedb59bsm14771413pfq.16.2024.03.08.09.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 09:17:06 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Marc Blanchet Subject: [PATCH iproute2-next 2/3] netem: use 64 bit value for latency and jitter Date: Fri, 8 Mar 2024 09:16:00 -0800 Message-ID: <20240308171656.9034-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240308171656.9034-1-stephen@networkplumber.org> References: <20240308171656.9034-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com The current version of netem in iproute2 has a maximum of 4.3 seconds because of scaled 32 bit clock values. Some users would like to be able to use larger delays to emulate things like storage delays. Since kernel version 4.15, netem qdisc had netlink parameters to express wider range of delays in nanoseconds. But the iproute2 side was never updated to use them. This does break compatibility with older kernels (4.14 and earlier). With these out of support kernels, the latency/delay parameter will end up being ignored. Reported-by: Marc Blanchet Signed-off-by: Stephen Hemminger --- tc/q_netem.c | 83 +++++++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 37 deletions(-) diff --git a/tc/q_netem.c b/tc/q_netem.c index 4ce9ab6e529b..86cabbfe7b3a 100644 --- a/tc/q_netem.c +++ b/tc/q_netem.c @@ -170,26 +170,6 @@ static int get_distribution(const char *type, __s16 *data, int maxdata) #define NEXT_IS_SIGNED_NUMBER() \ (NEXT_ARG_OK() && (isdigit(argv[1][0]) || argv[1][0] == '-')) -/* - * Adjust for the fact that psched_ticks aren't always usecs - * (based on kernel PSCHED_CLOCK configuration - */ -static int get_ticks(__u32 *ticks, const char *str) -{ - unsigned int t; - - if (get_time(&t, str)) - return -1; - - if (tc_core_time2big(t)) { - fprintf(stderr, "Illegal %u time (too large)\n", t); - return -1; - } - - *ticks = tc_core_time2tick(t); - return 0; -} - static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { @@ -208,6 +188,8 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, __s16 *slot_dist_data = NULL; __u16 loss_type = NETEM_LOSS_UNSPEC; int present[__TCA_NETEM_MAX] = {}; + __s64 latency64 = 0; + __s64 jitter64 = 0; __u64 rate64 = 0; __u64 seed = 0; @@ -221,14 +203,20 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, } else if (matches(*argv, "latency") == 0 || matches(*argv, "delay") == 0) { NEXT_ARG(); - if (get_ticks(&opt.latency, *argv)) { + + /* Old latency value in opt is no longer used. */ + present[TCA_NETEM_LATENCY64] = 1; + + if (get_time64(&latency64, *argv)) { explain1("latency"); return -1; } if (NEXT_IS_NUMBER()) { NEXT_ARG(); - if (get_ticks(&opt.jitter, *argv)) { + + present[TCA_NETEM_JITTER64] = 1; + if (get_time64(&jitter64, *argv)) { explain1("latency"); return -1; } @@ -552,7 +540,7 @@ random_loss_model: tail = NLMSG_TAIL(n); if (reorder.probability) { - if (opt.latency == 0) { + if (latency64 == 0) { fprintf(stderr, "reordering not possible without specifying some delay\n"); explain(); return -1; @@ -573,7 +561,7 @@ random_loss_model: } } - if (dist_data && (opt.latency == 0 || opt.jitter == 0)) { + if (dist_data && (latency64 == 0 || jitter64 == 0)) { fprintf(stderr, "distribution specified but no latency and jitter values\n"); explain(); return -1; @@ -582,6 +570,14 @@ random_loss_model: if (addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)) < 0) return -1; + if (present[TCA_NETEM_LATENCY64] && + addattr_l(n, 1024, TCA_NETEM_LATENCY64, &latency64, sizeof(latency64)) < 0) + return -1; + + if (present[TCA_NETEM_JITTER64] && + addattr_l(n, 1024, TCA_NETEM_JITTER64, &jitter64, sizeof(jitter64)) < 0) + return -1; + if (present[TCA_NETEM_CORR] && addattr_l(n, 1024, TCA_NETEM_CORR, &cor, sizeof(cor)) < 0) return -1; @@ -676,6 +672,8 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) __u64 seed = 0; int len; __u64 rate64 = 0; + __u64 latency64 = 0; + __u64 jitter64 = 0; SPRINT_BUF(b1); @@ -734,6 +732,18 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return -1; rate64 = rta_getattr_u64(tb[TCA_NETEM_RATE64]); } + if (tb[TCA_NETEM_LATENCY64]) { + if (RTA_PAYLOAD(tb[TCA_NETEM_LATENCY64]) < sizeof(latency64)) + return -1; + latency64 = rta_getattr_u64(tb[TCA_NETEM_LATENCY64]); + + } + if (tb[TCA_NETEM_JITTER64]) { + if (RTA_PAYLOAD(tb[TCA_NETEM_JITTER64]) < sizeof(jitter64)) + return -1; + jitter64 = rta_getattr_u64(tb[TCA_NETEM_JITTER64]); + + } if (tb[TCA_NETEM_SLOT]) { if (RTA_PAYLOAD(tb[TCA_NETEM_SLOT]) < sizeof(*slot)) return -1; @@ -749,24 +759,23 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) print_uint(PRINT_ANY, "limit", "limit %d", qopt.limit); - if (qopt.latency) { + + if (latency64 != 0) { open_json_object("delay"); - if (!is_json_context()) { - print_string(PRINT_FP, NULL, " delay %s", - sprint_ticks(qopt.latency, b1)); - if (qopt.jitter) - print_string(PRINT_FP, NULL, " %s", - sprint_ticks(qopt.jitter, b1)); - } else { + if (is_json_context()) { print_float(PRINT_JSON, "delay", NULL, - tc_core_tick2time(qopt.latency) / - 1000000.); + (double)latency64 / 1000000000.); print_float(PRINT_JSON, "jitter", NULL, - tc_core_tick2time(qopt.jitter) / - 1000000.); + (double)jitter64 / 1000000000.); + } else { + print_string(PRINT_FP, NULL, " delay %s", + sprint_time64(latency64, b1)); + if (jitter64 != 0) + print_string(PRINT_FP, NULL, " %s", + sprint_time64(jitter64, b1)); } - print_corr(qopt.jitter && cor && cor->delay_corr, + print_corr(jitter64 && cor && cor->delay_corr, cor ? cor->delay_corr : 0); close_json_object(); } From patchwork Fri Mar 8 17:16:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13587117 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 646932577B for ; Fri, 8 Mar 2024 17:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709918231; cv=none; b=F1CKyAyxbYa3+VZnDNnPdNCuGVTo7TKK/WhQpRkO5maYujy2kKKO23nz6tVPfwBA2xntDqj214xomiXcz6a0LQdFUIcG7+nVjHsKA9ZDPC+VCrWSRN0Z+FN1lufT0eMIU2YqhZ6HW2BVCgQD2hT2qtyr8hIgz9b2CdFbDbokRss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709918231; c=relaxed/simple; bh=+ZHcsmBIKb0O1ganZhwb8nR8Krt+Q6jkO2p5SZ/MSjw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gpAyLGkiFMEZboUS6nXChx8vCRTzUXKNc3QFFvpSMyh+0xqzodqM78sYgrXhh1MdA5NTKPNxXy4RDuDF5YfYDGy4yV9sd8+W1MNkfpEIXyOcwG0J6zqRb0wlMQnZOXRpSx6ZUaToRdGbJTBO9ehIKxiflOM5ucq7vgZKdERxiok= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=pjUCpy5c; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="pjUCpy5c" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6e6082eab17so2152288b3a.1 for ; Fri, 08 Mar 2024 09:17:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709918228; x=1710523028; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IRpEzdy5Gx2FCyyAJ26fT9iVD/nmn4SZHUwFSVpHhTQ=; b=pjUCpy5cqxzwM52McqzmduEOed4qWiFihDX9kslui3mAMBx81mubvOQ3SV21XQUq9B hBlKZN2ewAhWJJRKFutf9GQxeWBEDBmbLVJ3yxQHXtRgUJXis4sfXXpYAQLL0qDuAej6 QO3+3VVh9qvxisUzUSMFVCrvHiv5PKWNW7zUo2wn7ZE1JjXNDsRtZfYfkfblCRLfBDUb w1TRHrTtT/YQ4VY+cVQuHgPoqN8YvlxpAfTdEkD64enE9C30DtyWadXuXJ55xKetW5Yb wv7/iIQWEILxXnSpNC9uC1KjWkFIg2dB78kWGIXO0N665c9lSlvaj0ncmmL9Uw5eR934 Sqmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709918228; x=1710523028; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IRpEzdy5Gx2FCyyAJ26fT9iVD/nmn4SZHUwFSVpHhTQ=; b=JyMlLEGW9FSSCMHgjIgQpFemgb+0Lq55SshW/y7zy+Wk5AXBCk5bvr8lUZQs1wd8gU RC7Ln2FS60bwA3RUCGE2imSefKoHhhM2+4I/AQd5rGqdJE8a+fhtVJYR5oIRBLU+keTY KfLMv+uOgZCjqyVQuJhaZ18cqEhAccYCMCwy4ZsLmYLBkp2O6QIx27wz65DK/kCAxO+V HZLFdGOh8Bb9QVua5/y1f9ywhSUm8zoLcin/GEQYOj8vehDZAuMfw5KoGQkVQm9DHW8s NC05mslg9zCLsDNVihmZ6IO/t7XcarqughBmUGW4WPihU4PcEhZkklpoMs4N0t9EDIFS l34g== X-Gm-Message-State: AOJu0Yx8H9J+h7TDAc2V60/ngAPxCvNQ2vhe8p/iI08rNQqFwJoZrypi GckLoF7CrqsgL8EiDAhsNPCt7HoAnu4QBV07blLPdAAn4pzue2ezr7AVC1Zpm7gepJaWIw3eFgx usRo= X-Google-Smtp-Source: AGHT+IEWfMxFngaP+nYfCKQbYtQfnuambWKmF+a4+RG0BLhRY4WxSNqrt6mN4m6NRJv9/XkX7XM3ng== X-Received: by 2002:a05:6a00:2354:b0:6e5:80a4:2ff2 with SMTP id j20-20020a056a00235400b006e580a42ff2mr24606703pfj.30.1709918228093; Fri, 08 Mar 2024 09:17:08 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id r8-20020aa79ec8000000b006e50cedb59bsm14771413pfq.16.2024.03.08.09.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 09:17:07 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2-next 3/3] tc: remove no longer used helpers Date: Fri, 8 Mar 2024 09:16:01 -0800 Message-ID: <20240308171656.9034-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240308171656.9034-1-stephen@networkplumber.org> References: <20240308171656.9034-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com The removal of tick usage in netem, means that some of the helper functions in tc are no longer used and can be safely removed. Other functions can be made static. Signed-off-by: Stephen Hemminger --- tc/tc_core.c | 15 +++------------ tc/tc_core.h | 2 -- tc/tc_util.c | 5 ----- tc/tc_util.h | 1 - 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/tc/tc_core.c b/tc/tc_core.c index 871ceb45ff58..37547e9b3395 100644 --- a/tc/tc_core.c +++ b/tc/tc_core.c @@ -23,23 +23,14 @@ static double tick_in_usec = 1; static double clock_factor = 1; -int tc_core_time2big(unsigned int time) +static unsigned int tc_core_time2tick(unsigned int time) { - __u64 t = time; - - t *= tick_in_usec; - return (t >> 32) != 0; -} - - -unsigned int tc_core_time2tick(unsigned int time) -{ - return time*tick_in_usec; + return time * tick_in_usec; } unsigned int tc_core_tick2time(unsigned int tick) { - return tick/tick_in_usec; + return tick / tick_in_usec; } unsigned int tc_core_time2ktime(unsigned int time) diff --git a/tc/tc_core.h b/tc/tc_core.h index 6dab2727d199..7a986ac27a44 100644 --- a/tc/tc_core.h +++ b/tc/tc_core.h @@ -12,8 +12,6 @@ enum link_layer { }; -int tc_core_time2big(unsigned time); -unsigned tc_core_time2tick(unsigned time); unsigned tc_core_tick2time(unsigned tick); unsigned tc_core_time2ktime(unsigned time); unsigned tc_core_ktime2time(unsigned ktime); diff --git a/tc/tc_util.c b/tc/tc_util.c index aa7cf60faa6d..c293643dc80d 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -257,11 +257,6 @@ tc_print_rate(enum output_type t, const char *key, const char *fmt, print_rate(use_iec, t, key, fmt, rate); } -char *sprint_ticks(__u32 ticks, char *buf) -{ - return sprint_time(tc_core_tick2time(ticks), buf); -} - int get_size_and_cell(unsigned int *size, int *cell_log, char *str) { char *slash = strchr(str, '/'); diff --git a/tc/tc_util.h b/tc/tc_util.h index 623d9888a5ad..b7b9a097acd3 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -86,7 +86,6 @@ void tc_print_rate(enum output_type t, const char *key, const char *fmt, void print_devname(enum output_type type, int ifindex); char *sprint_tc_classid(__u32 h, char *buf); -char *sprint_ticks(__u32 ticks, char *buf); char *sprint_linklayer(unsigned int linklayer, char *buf); void print_tcstats_attr(FILE *fp, struct rtattr *tb[],