diff mbox series

[netnext] net: tc: improve qdisc error messages

Message ID 20250116195642.2794-1-ouster@cs.stanford.edu (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [netnext] net: tc: improve qdisc error messages | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 4 maintainers not CCed: horms@kernel.org edumazet@google.com pabeni@redhat.com kuba@kernel.org
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: line length of 112 exceeds 80 columns WARNING: line length of 88 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-01-17--03-00 (tests: 883)

Commit Message

John Ousterhout Jan. 16, 2025, 7:56 p.m. UTC
The existing error message ("Invalid qdisc name") is confusing
because it suggests that there is no qdisc with the given name. In
fact, the name does refer to a valid qdisc, but it doesn't match
the kind of an existing qdisc being modified or replaced. The
new error message provides more detail to eliminate confusion.

Signed-off-by: John Ousterhout <ouster@cs.stanford.edu>
---
 net/sched/sch_api.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--
2.34.1

Comments

Jamal Hadi Salim Jan. 16, 2025, 8 p.m. UTC | #1
On Thu, Jan 16, 2025 at 2:57 PM John Ousterhout <ouster@cs.stanford.edu> wrote:
>
> The existing error message ("Invalid qdisc name") is confusing
> because it suggests that there is no qdisc with the given name. In
> fact, the name does refer to a valid qdisc, but it doesn't match
> the kind of an existing qdisc being modified or replaced. The
> new error message provides more detail to eliminate confusion.
>
> Signed-off-by: John Ousterhout <ouster@cs.stanford.edu>
> ---
>  net/sched/sch_api.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
> index 300430b8c4d2..5d017c06a96f 100644
> --- a/net/sched/sch_api.c
> +++ b/net/sched/sch_api.c
> @@ -1560,7 +1560,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
>         }
>
>         if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) {
> -               NL_SET_ERR_MSG(extack, "Invalid qdisc name");
> +               NL_SET_ERR_MSG(extack, "Invalid qdisc name: must match existing qdisc");
>                 return -EINVAL;
>         }
>
> @@ -1670,7 +1670,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
>                                 }
>                                 if (tca[TCA_KIND] &&
>                                     nla_strcmp(tca[TCA_KIND], q->ops->id)) {
> -                                       NL_SET_ERR_MSG(extack, "Invalid qdisc name");
> +                                       NL_SET_ERR_MSG(extack, "Invalid qdisc name: must match existing qdisc");
>                                         return -EINVAL;
>                                 }
>                                 if (q->flags & TCQ_F_INGRESS) {
> @@ -1746,7 +1746,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
>                 return -EEXIST;
>         }
>         if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) {
> -               NL_SET_ERR_MSG(extack, "Invalid qdisc name");
> +               NL_SET_ERR_MSG(extack, "Invalid qdisc name: must match existing qdisc");
>                 return -EINVAL;
>         }
>         err = qdisc_change(q, tca, extack);
> --

LGTM.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

> 2.34.1
>
>
diff mbox series

Patch

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 300430b8c4d2..5d017c06a96f 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1560,7 +1560,7 @@  static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
 	}

 	if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) {
-		NL_SET_ERR_MSG(extack, "Invalid qdisc name");
+		NL_SET_ERR_MSG(extack, "Invalid qdisc name: must match existing qdisc");
 		return -EINVAL;
 	}

@@ -1670,7 +1670,7 @@  static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
 				}
 				if (tca[TCA_KIND] &&
 				    nla_strcmp(tca[TCA_KIND], q->ops->id)) {
-					NL_SET_ERR_MSG(extack, "Invalid qdisc name");
+					NL_SET_ERR_MSG(extack, "Invalid qdisc name: must match existing qdisc");
 					return -EINVAL;
 				}
 				if (q->flags & TCQ_F_INGRESS) {
@@ -1746,7 +1746,7 @@  static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
 		return -EEXIST;
 	}
 	if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) {
-		NL_SET_ERR_MSG(extack, "Invalid qdisc name");
+		NL_SET_ERR_MSG(extack, "Invalid qdisc name: must match existing qdisc");
 		return -EINVAL;
 	}
 	err = qdisc_change(q, tca, extack);