From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (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 27C3B4A2E32 for ; Tue, 5 May 2026 17:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778002870; cv=none; b=EK3hBGTmgebMjQghZmIzmVAoAsTnvaObV4JCjQ69bm4X6co621voDyLBUrU5Ps2G2++Ns7ZEQwb4ACgGJIAC39Gn1r6St9J5Nk808gy2jxSc9jBqitsr3vBVcSFT0P3028oBnx/P426sXulacHiByBljWovzH+oBEAeDKlX6xYo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778002870; c=relaxed/simple; bh=HtYVrg/Vw4mSVH94F9/G2mEG9V6Dst5DVZvTk7ojCJw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jZu5HmecA9C82TMURS6Dh9FsZbQUqY6Nv4LqIsQC50L0oP2Chnao6eEr5sW+5/aedhnlYM5uifLnNN9yma/v94Gg+GswzsL5wvFLxLbDx6tdk76wsNiNEOmblcM0m4yNjvhHkLfGZRFrKGTv5qO37H6nMfNZuujjmVSERfQ0INE= 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=nlXyG47Y; arc=none smtp.client-ip=209.85.167.182 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="nlXyG47Y" Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-47cacb4ed99so1420364b6e.1 for ; Tue, 05 May 2026 10:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20251104.gappssmtp.com; s=20251104; t=1778002868; x=1778607668; 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=nlXyG47Y2KScPhnqDVNckN7XZCymm/0wIbB0XxXaRBWa+oPEHvZntAU/uEYVjx74Xx JQCuRJ0LM++bumtMEd7KVzgfAYkb2a1ctF7hC6C/OT75l7xCvteoLkVnXDTYUzM1Ehl3 9vFmv7WqXNCvA64j9AKmP+G5HlcEvYFizf4Riij+a/lYKXN2WcY+kBHgJyKikCRT0ZyA OkMaz9wj+p+1a4UO8vMFhEGB30JBc9QOtFF0CohlYRNNFV3SbdT6fFoO2qHCB3aP6wpB HrEWAhpjNyrDxszKDzkeQ6VXzZL/3B8jvmRr6G5n+/9Elyr8Lz1tbJS4UzXJHCKPCJhT f93A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778002868; x=1778607668; 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=bHfQmgrEI/ThEudPGDsSyAtwKlRQLKt5mhB/k0zXOvL1DPGivO7GRZrApiYSJDf7H1 rvgWwOgjAaxXAdB1e25ZLRvTb+DQtlTQIPy0zzUxx7o3e+qvFl05joUvoXbFBTjU2Dsg CdH6J+OA8sJpCyiluIYk1cl875DaMYTkTm11rDAWKyHEVnfzbBkKjDPbLTYojb141Ler gkE1Ml7jof1bnCQRjPK+/WIsTjbP9psbUGqAPXN5TgG945nb7WlTDDfYvbpcTnGRzPgS dtxfMbfPOCycI4ndLfRVb4YoKZ+je0PAilGkLmyU32IbddZhneQo1DFVZfp+YRaHej0Z nS/w== X-Forwarded-Encrypted: i=1; AFNElJ+jPSYC+rPHC2t1zrwzWpSObQC5xR68KvmdBvvR4qQpTPpKadSzJglQu5TC7WTpDdxxtoB2OgVXByEaGnM=@vger.kernel.org X-Gm-Message-State: AOJu0YzwN/g6NAFBPfJUG5aFEJAGsMWW0VxmmtahukfyKqnsbbhhKZD/ WS6SwO2h8yWoW8kE6w77JD2r4k6KkekGf5ZmEjA/WEiuaboEmCo5gQMc2TyXLo4ha4LKTOKchSa 20vYs X-Gm-Gg: AeBDieuhp0RcwCxUgrqo/zf7SIi15IMSXj4Q/uYNfIwrX9o6EA3U/2icesxTkjM/sjJ yY3eZeWBg3cQIJwhC4dA7EsKZb7PS341UWbKsGh2L3wik4MBGesvC0iQX0QPHzjzNK0Sperb7ro FJL/cv83DuyLwhwNNWv+aNucWfsUFdK7DukHXakTeIwfvh03Km0Gr2YKV68MyW6hX6fdbXhK7eD 2a1hHClsF3Qvc9/1LWH4rjhdukDhnxDt+stasrdJ5pgZfL8WMsnvJzzn4hRXK/Kxgg8KoTgAFas nmZuES80YgVSlgX5SPcRYX6H3/7uDYdIO+A9LrOJjLobRt9ZeaSUslk66zj5DKpGMORNHZIz1Ps XZp2M0kKC4YOO8prtNrritJF2WpbeRt+R9xBPa8uWRb6xO0PV5rlsAP8NiCNKV2DMSO44BrKKFB CGshvLoGR7h2vSrtlMBY3vEBIq5NP0r9HFkFLBvNRsFfM= X-Received: by 2002:a05:6808:320c:b0:467:880:744a with SMTP id 5614622812f47-48042496b28mr3826b6e.24.1778002867971; Tue, 05 May 2026 10:41:07 -0700 (PDT) Received: from phoenix.lan ([104.202.41.210]) by smtp.gmail.com with ESMTPSA id 5614622812f47-47c769c9b12sm9006504b6e.17.2026.05.05.10.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 10:41:07 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, jiri@resnulli.us, Stephen Hemminger , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next v3 3/5] net/sched: netem: replace pr_info with netlink extack error messages Date: Tue, 5 May 2026 10:38:43 -0700 Message-ID: <20260505174059.651260-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260505174059.651260-1-stephen@networkplumber.org> References: <20260505174059.651260-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