netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Jiri Pirko <jiri@resnulli.us>,
	 Stephen Hemminger <stephen@networkplumber.org>,
	 netdev@vger.kernel.org
Subject: Re: [PATCH 1/3] net/sched: netem: use extack
Date: Fri, 02 Feb 2024 11:53:04 +0000	[thread overview]
Message-ID: <m2bk8zulpb.fsf@gmail.com> (raw)
In-Reply-To: <20240201090046.1b93bcbd@kernel.org> (Jakub Kicinski's message of "Thu, 1 Feb 2024 09:00:46 -0800")

Jakub Kicinski <kuba@kernel.org> writes:

> On Thu, 1 Feb 2024 10:30:27 +0100 Jiri Pirko wrote:
>> Thu, Feb 01, 2024 at 04:45:58AM CET, stephen@networkplumber.org wrote:
>> >-	if (!opt)
>> >+	if (!opt) {
>> >+		NL_SET_ERR_MSG_MOD(extack, "Netem missing required parameters");  
>> 
>> Drop "Netem " here.
>> 
>> Otherwise, this looks fine.
>
> Looks like most sch's require opt. Would it be a bad idea to pull 
> the check out to the caller? Minor simplification, plus the caller
> has the outer message so they can use NL_SET_ERR_ATTR_MISS() and
> friends.

There's also these which maybe complicates things:

$ git grep -A1 'if (opt == NULL)' -- net/sched/
net/sched/cls_flow.c:   if (opt == NULL)
net/sched/cls_flow.c-           return -EINVAL;
--
net/sched/sch_choke.c:  if (opt == NULL)
net/sched/sch_choke.c-          return -EINVAL;
--
net/sched/sch_fifo.c:   if (opt == NULL) {
net/sched/sch_fifo.c-           u32 limit = qdisc_dev(sch)->tx_queue_len;
--
net/sched/sch_hfsc.c:   if (opt == NULL)
net/sched/sch_hfsc.c-           return -EINVAL;
--
net/sched/sch_plug.c:   if (opt == NULL) {
net/sched/sch_plug.c-           q->limit = qdisc_dev(sch)->tx_queue_len

I'm in favour of qdisc specific extack messages.

> $ git grep -A1 'if (!opt)' -- net/sched/
> net/sched/cls_fw.c:     if (!opt)
> net/sched/cls_fw.c-             return handle ? -EINVAL : 0; /* Succeed if it is old method. */
> --
> net/sched/cls_u32.c:    if (!opt) {
> net/sched/cls_u32.c-            if (handle) {
> --
> net/sched/sch_cbs.c:    if (!opt) {
> net/sched/sch_cbs.c-            NL_SET_ERR_MSG(extack, "Missing CBS qdisc options  which are mandatory");
> --
> net/sched/sch_drr.c:    if (!opt) {
> net/sched/sch_drr.c-            NL_SET_ERR_MSG(extack, "DRR options are required for this operation");
> --
> net/sched/sch_etf.c:    if (!opt) {
> net/sched/sch_etf.c-            NL_SET_ERR_MSG(extack,
> --
> net/sched/sch_ets.c:    if (!opt) {
> net/sched/sch_ets.c-            NL_SET_ERR_MSG(extack, "ETS options are required for this operation");
> --
> net/sched/sch_ets.c:    if (!opt)
> net/sched/sch_ets.c-            return -EINVAL;
> --
> net/sched/sch_gred.c:   if (!opt)
> net/sched/sch_gred.c-           return -EINVAL;
> --
> net/sched/sch_htb.c:    if (!opt)
> net/sched/sch_htb.c-            return -EINVAL;
> --
> net/sched/sch_htb.c:    if (!opt)
> net/sched/sch_htb.c-            goto failure;
> --
> net/sched/sch_multiq.c: if (!opt)
> net/sched/sch_multiq.c-         return -EINVAL;
> --
> net/sched/sch_netem.c:  if (!opt)
> net/sched/sch_netem.c-          return -EINVAL;
> --
> net/sched/sch_prio.c:   if (!opt)
> net/sched/sch_prio.c-           return -EINVAL;
> --
> net/sched/sch_red.c:    if (!opt)
> net/sched/sch_red.c-            return -EINVAL;
> --
> net/sched/sch_skbprio.c:        if (!opt)
> net/sched/sch_skbprio.c-                return 0;
> --
> net/sched/sch_taprio.c: if (!opt)
> net/sched/sch_taprio.c-         return -EINVAL;
> --
> net/sched/sch_tbf.c:    if (!opt)
> net/sched/sch_tbf.c-            return -EINVAL;

  reply	other threads:[~2024-02-02 11:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01  3:45 [PATCH 0/3] net/sched: netem cleanups Stephen Hemminger
2024-02-01  3:45 ` [PATCH 1/3] net/sched: netem: use extack Stephen Hemminger
2024-02-01  9:30   ` Jiri Pirko
2024-02-01 17:00     ` Jakub Kicinski
2024-02-02 11:53       ` Donald Hunter [this message]
2024-02-02 16:23         ` Jakub Kicinski
2024-02-02 17:03           ` Donald Hunter
2024-02-01  3:45 ` [PATCH 2/3] net/sched: netem: get rid of unnecesary version message Stephen Hemminger
2024-02-01  9:31   ` Jiri Pirko
2024-02-01  3:46 ` [PATCH 3/3] net/sched: netem: update intro comment Stephen Hemminger
2024-02-01  9:32   ` Jiri Pirko

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=m2bk8zulpb.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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).