From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f53.google.com (mail-dl1-f53.google.com [74.125.82.53]) (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 6334A247280 for ; Fri, 8 May 2026 01:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778205593; cv=none; b=jtOGrHNVntisxVlWqotJzCbCWIo5gndtt2FjnjOrkPNlOci70hiZRKvmVfZ9J+XsenlDOpHZsCExr3WaSPQE2I+JHazGUO31ENVjOr2EIWIJ4tmtTXDLsmEfhJU6SZ8SE9oDAhzeMxCE0T0TZJazlbV5ItLEj3Q/WOBJ7liq2IU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778205593; c=relaxed/simple; bh=HtYVrg/Vw4mSVH94F9/G2mEG9V6Dst5DVZvTk7ojCJw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tzDiPMED3L3nwC2AkJbUEi7D0qNLhfT5VlTA8iw5pBlLqgD+TSDRBJwSV3z8ZNSRARg3opqB26k/8ydeJe8HCuBJYOsmEhbZ/lKh/B3dS+vg+BTQrqGrmvXgRNsji8lQQuOy1010kgeref6mawTNmyD7CeuXaxtuK6AgVuHkCg4= 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.20251104.gappssmtp.com header.i=@networkplumber-org.20251104.gappssmtp.com header.b=n+SHHv7X; arc=none smtp.client-ip=74.125.82.53 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.20251104.gappssmtp.com header.i=@networkplumber-org.20251104.gappssmtp.com header.b="n+SHHv7X" Received: by mail-dl1-f53.google.com with SMTP id a92af1059eb24-12dca45ca21so2362681c88.1 for ; Thu, 07 May 2026 18:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20251104.gappssmtp.com; s=20251104; t=1778205591; x=1778810391; 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=6CXiOetWfOPX+NNCrDyidAkyh9VnGD6A1wMqx06ky2Q=; b=n+SHHv7XDmnqyOmU2DoAtXsUUGiZPWSD8+GjAH2/onJq4/2ep6/uwhagNZX+P8NWRY bbxb+sHjPkJiXfMIzRcKzHiegrMllk4oQXbop8LkoceFatlQM6Xf1DuWjOq4P8tXQ9H7 K5h8mlilHcvegttJdPpxNLMJPyZcRUt18faD4mUaOlnRdghxnhyvsybSum6LBlrG5HuB rZ3M5jLWeaXEm9CZeABQGzKxKjWXESs6SWHAPGiEcsWtoZj1Xw6/ivC5n7mMtyhOjob+ xQrdy+FUPrOVH9MGensA25cKFVHH/p/MIYVdJ32zE7dyOXcOWl+cxuur1HP0SVXTM5yU SjqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778205591; x=1778810391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6CXiOetWfOPX+NNCrDyidAkyh9VnGD6A1wMqx06ky2Q=; b=ZfWhIKtuhDrEcKB5Jvmt4jWAufsVzYB3x+8wVjZ/y7bEL42NU/5HNsf3Wek9zhQFV8 6NDMK8S1doJU4j3T1ygHRdXktBwEcn6LptHux6tLF96dLVF05r7Vg/cHibfdsScwq8Q0 hepGdBiBRPdoyKVL67FSjcufl5jyQQnelKDoJskZUAiXdbmLUhXMZbN9zpuoYY+3Usi0 hUQ2ACe9edLTUIfg9u3y0eLT93jm17Olff8DbcEsyNwDlKODvVVb/gXarkGjpM8Hr7fq 7ZZUIj2s+ZxMFojXw+XUds72k+DAeI555R4AeVQXwpcfvz9fgs7ms6IQGtNc0QqHmLGj kEpQ== X-Forwarded-Encrypted: i=1; AFNElJ+3eSaIV3/3vhVpgausG5hQr5O1i1apdSM3OfBFCYuDzLTAjVKmymZljNF8WPATyYUBjyhWXmwORtjRkrk=@vger.kernel.org X-Gm-Message-State: AOJu0YxrHlCKcsSjD74S5ZRk+0bvRopJVlWfDyo4l9IVaE6jqPIf8Ot/ uzGZAbZoBXHpPxuycGvKqQ/pdZ48O8k1ck5guH9+CLwfe4H9+DJWB16YForttF+AaqI= X-Gm-Gg: Acq92OG52cKCSuoKmcjfesxUebOgV7vYjcqA6G/pCrb/8NCWXd/q4jBux+dot/3yyw5 v1kWBDb6O3NbRSpNyIIbPapV4rX6bF6FCNhXcGFmpUss2cYD4zLQxn67M396yV8jVnX6KIc6a6c xUcdYy58U1Vn7SKoYS3BukoGKHLKhJZHOww8F5TsqSh2V0uo9CQoKr6i6WCp75ByWwTBW3cLwWP L4cNpdYCMTEoTtAF1Mxg9UxlZCFGkGgg5Vp3mPibxRI9xJvav25LkVYgWWMWfJuWwK6Q2emV7Zq nS+acPASWrjTxUYRXObjpkOQNgeYLh7EWjy7n6DVOxv97ThleTi3u0MHwA3joRuU7NEKvoysVfJ 30e69YIzEeuqvpgEJcU8q88xXUnVbwLfQQsabJLkmASpIRGIoBokHh68l9V3Smlx0nWPWpwsFaR zOWkch2tFrDyURjAcX/1lO5z8kwy/gJypV X-Received: by 2002:a05:7301:3f07:b0:2ed:b131:240e with SMTP id 5a478bee46e88-2f54a67d551mr5571411eec.23.1778205591355; Thu, 07 May 2026 18:59:51 -0700 (PDT) Received: from phoenix.lan ([104.202.41.210]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2f88847504dsm324090eec.15.2026.05.07.18.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2026 18:59:51 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, Stephen Hemminger , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 3/5] net/sched: netem: replace pr_info with netlink extack error messages Date: Thu, 7 May 2026 18:55:19 -0700 Message-ID: <20260508015940.554462-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260508015940.554462-1-stephen@networkplumber.org> References: <20260508015940.554462-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use netlink extack to report errors instead of sending them to the kernel log with pr_info(). The error message can them be seen with tc commands; and avoids log spam. Signed-off-by: Stephen Hemminger --- net/sched/sch_netem.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 2b0b5c032e70..53bdfa77ee2d 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -921,7 +921,8 @@ static void get_rate(struct netem_sched_data *q, const struct nlattr *attr) q->cell_size_reciprocal = (struct reciprocal_value) { 0 }; } -static int get_loss_clg(struct netem_sched_data *q, const struct nlattr *attr) +static int get_loss_clg(struct netem_sched_data *q, const struct nlattr *attr, + struct netlink_ext_ack *extack) { const struct nlattr *la; int rem; @@ -934,7 +935,8 @@ static int get_loss_clg(struct netem_sched_data *q, const struct nlattr *attr) const struct tc_netem_gimodel *gi = nla_data(la); if (nla_len(la) < sizeof(struct tc_netem_gimodel)) { - pr_info("netem: incorrect gi model size\n"); + NL_SET_ERR_MSG_ATTR(extack, la, + "netem: incorrect gi model size"); return -EINVAL; } @@ -953,7 +955,8 @@ static int get_loss_clg(struct netem_sched_data *q, const struct nlattr *attr) const struct tc_netem_gemodel *ge = nla_data(la); if (nla_len(la) < sizeof(struct tc_netem_gemodel)) { - pr_info("netem: incorrect ge model size\n"); + NL_SET_ERR_MSG_ATTR(extack, la, + "netem: incorrect ge model size"); return -EINVAL; } @@ -967,7 +970,8 @@ static int get_loss_clg(struct netem_sched_data *q, const struct nlattr *attr) } default: - pr_info("netem: unknown loss type %u\n", type); + NL_SET_ERR_MSG_ATTR_FMT(extack, la, + "netem: unknown loss type %u", type); return -EINVAL; } } @@ -990,19 +994,21 @@ static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = { }; static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla, - const struct nla_policy *policy, int len) + const struct nla_policy *policy, int len, + struct netlink_ext_ack *extack) { int nested_len = nla_len(nla) - NLA_ALIGN(len); if (nested_len < 0) { - pr_info("netem: invalid attributes len %d\n", nested_len); + NL_SET_ERR_MSG_FMT(extack, "netem: invalid attributes len %d < %d", + nla_len(nla), NLA_ALIGN(len)); return -EINVAL; } if (nested_len >= nla_attr_size(0)) return nla_parse_deprecated(tb, maxtype, nla_data(nla) + NLA_ALIGN(len), - nested_len, policy, NULL); + nested_len, policy, extack); memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); return 0; @@ -1057,7 +1063,7 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt, int ret; qopt = nla_data(opt); - ret = parse_attr(tb, TCA_NETEM_MAX, opt, netem_policy, sizeof(*qopt)); + ret = parse_attr(tb, TCA_NETEM_MAX, opt, netem_policy, sizeof(*qopt), extack); if (ret < 0) return ret; @@ -1097,7 +1103,7 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt, old_loss_model = q->loss_model; if (tb[TCA_NETEM_LOSS]) { - ret = get_loss_clg(q, tb[TCA_NETEM_LOSS]); + ret = get_loss_clg(q, tb[TCA_NETEM_LOSS], extack); if (ret) { q->loss_model = old_loss_model; q->clg = old_clg; @@ -1193,8 +1199,6 @@ static int netem_init(struct Qdisc *sch, struct nlattr *opt, prandom_seed_state(&q->prng.prng_state, q->prng.seed); ret = netem_change(sch, opt, extack); - if (ret) - pr_info("netem: change failed\n"); return ret; } -- 2.53.0