From: Xiaolei Wang <xiaolei.wang@windriver.com>
To: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [net PATCH] net/sched: Get stab before calling ops->change()
Date: Thu, 9 May 2024 10:40:43 +0800 [thread overview]
Message-ID: <20240509024043.3532677-1-xiaolei.wang@windriver.com> (raw)
ops->change() depends on stab, there is such a situation
When no parameters are passed in for the first time, stab
is omitted, as in configuration 1 below. At this time, a
warning "Warning: sch_taprio: Size table not specified, frame
length estimates may be inaccurate" will be received. When
stab is added for the second time, parameters, like configuration
2 below, because the stab is still empty when ops->change()
is running, you will also receive the above warning.
1. tc qdisc replace dev eth1 parent root handle 100 taprio \
num_tc 5 map 0 1 2 3 4 queues 1@0 1@1 1@2 1@3 1@4 base-time 0 \
sched-entry S 1 100000 \
sched-entry S 2 100000 \
sched-entry S 4 100000 \
max-sdu 0 0 0 0 0 0 0 200 \
flags 2
2. tc qdisc replace dev eth1 parent root overhead 24 handle 100 taprio \
num_tc 5 map 0 1 2 3 4 queues 1@0 1@1 1@2 1@3 1@4 base-time 0 \
sched-entry S 1 100000 \
sched-entry S 2 100000 \
sched-entry S 4 100000 \
max-sdu 0 0 0 0 0 0 0 200 \
flags 2
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
net/sched/sch_api.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 60239378d43f..fec358f497d5 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1404,6 +1404,16 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca,
struct qdisc_size_table *ostab, *stab = NULL;
int err = 0;
+ if (tca[TCA_STAB]) {
+ stab = qdisc_get_stab(tca[TCA_STAB], extack);
+ if (IS_ERR(stab))
+ return PTR_ERR(stab);
+ }
+
+ ostab = rtnl_dereference(sch->stab);
+ rcu_assign_pointer(sch->stab, stab);
+ qdisc_put_stab(ostab);
+
if (tca[TCA_OPTIONS]) {
if (!sch->ops->change) {
NL_SET_ERR_MSG(extack, "Change operation not supported by specified qdisc");
@@ -1418,16 +1428,6 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca,
return err;
}
- if (tca[TCA_STAB]) {
- stab = qdisc_get_stab(tca[TCA_STAB], extack);
- if (IS_ERR(stab))
- return PTR_ERR(stab);
- }
-
- ostab = rtnl_dereference(sch->stab);
- rcu_assign_pointer(sch->stab, stab);
- qdisc_put_stab(ostab);
-
if (tca[TCA_RATE]) {
/* NB: ignores errors from replace_estimator
because change can't be undone. */
--
2.25.1
next reply other threads:[~2024-05-09 2:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 2:40 Xiaolei Wang [this message]
2024-05-10 12:19 ` [net PATCH] net/sched: Get stab before calling ops->change() Simon Horman
2024-05-15 13:39 ` wang xiaolei
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=20240509024043.3532677-1-xiaolei.wang@windriver.com \
--to=xiaolei.wang@windriver.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xiyou.wangcong@gmail.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).