]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/sched: tbf: add extack to offload params
authorDavid Yang <mmyangfl@gmail.com>
Thu, 21 May 2026 01:03:06 +0000 (09:03 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 23 May 2026 00:23:37 +0000 (17:23 -0700)
Drivers might have error messages to propagate to user space. Propagate
the netlink extack so that they can inform user space in a verbal way of
their limitations.

Signed-off-by: David Yang <mmyangfl@gmail.com>
Link: https://patch.msgid.link/20260521010320.208138-3-mmyangfl@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/pkt_cls.h
net/sched/sch_tbf.c

index 99ac747b7906074c43b3eb8e34cf6c07235cc81d..3bd08d7f39c18c0b45b389d75963ecd14b5f9730 100644 (file)
@@ -1046,6 +1046,7 @@ struct tc_tbf_qopt_offload_replace_params {
 };
 
 struct tc_tbf_qopt_offload {
+       struct netlink_ext_ack *extack;
        enum tc_tbf_command command;
        u32 handle;
        u32 parent;
index 67c7aaaf8f607e82ad13b7fdf177405a1dd075bb..58c9687efb0fd87aaa8c5666ab004fe40c23ba1f 100644 (file)
@@ -139,7 +139,8 @@ static u64 psched_ns_t2l(const struct psched_ratecfg *r,
        return len;
 }
 
-static void tbf_offload_change(struct Qdisc *sch)
+static void tbf_offload_change(struct Qdisc *sch,
+                              struct netlink_ext_ack *extack)
 {
        struct tbf_sched_data *q = qdisc_priv(sch);
        struct net_device *dev = qdisc_dev(sch);
@@ -148,6 +149,7 @@ static void tbf_offload_change(struct Qdisc *sch)
        if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
                return;
 
+       qopt.extack = extack;
        qopt.command = TC_TBF_REPLACE;
        qopt.handle = sch->handle;
        qopt.parent = sch->parent;
@@ -166,6 +168,7 @@ static void tbf_offload_destroy(struct Qdisc *sch)
        if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
                return;
 
+       qopt.extack = NULL;
        qopt.command = TC_TBF_DESTROY;
        qopt.handle = sch->handle;
        qopt.parent = sch->parent;
@@ -176,6 +179,7 @@ static int tbf_offload_dump(struct Qdisc *sch)
 {
        struct tc_tbf_qopt_offload qopt;
 
+       qopt.extack = NULL;
        qopt.command = TC_TBF_STATS;
        qopt.handle = sch->handle;
        qopt.parent = sch->parent;
@@ -193,6 +197,7 @@ static void tbf_offload_graft(struct Qdisc *sch, struct Qdisc *new,
                .parent         = sch->parent,
                .child_handle   = new->handle,
                .command        = TC_TBF_GRAFT,
+               .extack         = extack,
        };
 
        qdisc_offload_graft_helper(qdisc_dev(sch), sch, new, old,
@@ -477,7 +482,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt,
        qdisc_put(old);
        err = 0;
 
-       tbf_offload_change(sch);
+       tbf_offload_change(sch, extack);
 done:
        return err;
 }