summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2026-04-30 05:36:28 +0300
committerJakub Kicinski <kuba@kernel.org>2026-05-01 06:54:27 +0300
commit6f63b829632cbb4e7c4b6c55c79f5bb6652c06a8 (patch)
tree6f7deb5ae2ac1f8ce18b479ecd712dfa48edcafe
parent748bbef5fc6a6f5931103b68b67d345c67d0850b (diff)
downloadlinux-6f63b829632cbb4e7c4b6c55c79f5bb6652c06a8.tar.xz
net/sched: speedup tc_dump_qdisc() when tcm_ifindex is provided
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> Link: https://patch.msgid.link/20260430023628.3216283-5-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--net/sched/sch_api.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index cf3d01dd6b26..dd0edc9bd461 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);