From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Eric Dumazet <edumazet@google.com>
Subject: [PATCH v3 net-next 4/4] net/sched: speedup tc_dump_qdisc() when tcm_ifindex is provided
Date: Thu, 30 Apr 2026 02:36:28 +0000 [thread overview]
Message-ID: <20260430023628.3216283-5-edumazet@google.com> (raw)
In-Reply-To: <20260430023628.3216283-1-edumazet@google.com>
There is no point dumping qdiscs for all devices when user space
wants them for a single device:
tc -s -d qdisc show dev eth1
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/sched/sch_api.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index cf3d01dd6b268741a6e4674954940e09dff139a4..dd0edc9bd4610ec865fc97a81f801a7da020667b 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1884,6 +1884,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
unsigned long ifindex;
int q_idx;
} *ctx = (void *)cb->ctx;
+ const struct tcmsg *tcm;
struct net_device *dev;
int s_q_idx, q_idx;
int err;
@@ -1894,6 +1895,9 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
rtm_tca_policy, cb->extack);
if (err < 0)
return err;
+ tcm = nlmsg_data(nlh);
+ if (tcm->tcm_ifindex && !ctx->ifindex)
+ ctx->ifindex = tcm->tcm_ifindex;
s_q_idx = ctx->q_idx;
@@ -1901,6 +1905,9 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
struct netdev_queue *dev_queue;
struct Qdisc *q;
+ if (tcm->tcm_ifindex && ctx->ifindex != tcm->tcm_ifindex)
+ break;
+
q_idx = 0;
netdev_lock_ops(dev);
--
2.54.0.545.g6539524ca2-goog
next prev parent reply other threads:[~2026-04-30 2:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 2:36 [PATCH v3 net-next 0/4] net/sched: tc_dump_qdisc() optimizations Eric Dumazet
2026-04-30 2:36 ` [PATCH v3 net-next 1/4] net/sched: propagate tc_fill_tclass() error Eric Dumazet
2026-04-30 2:36 ` [PATCH v3 net-next 2/4] net/sched: tc_dump_qdisc_root() refactor Eric Dumazet
2026-04-30 2:36 ` [PATCH v3 net-next 3/4] net/sched: switch tc_dump_qdisc() to for_each_netdev_dump() Eric Dumazet
2026-04-30 2:36 ` Eric Dumazet [this message]
2026-05-01 4:10 ` [PATCH v3 net-next 0/4] net/sched: tc_dump_qdisc() optimizations patchwork-bot+netdevbpf
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=20260430023628.3216283-5-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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