[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFl2ltqtVM5o8UpE@C02FL77VMD6R>
Date: Mon, 8 May 2023 15:24:22 -0700
From: Peilin Ye <yepeilin.cs@...il.com>
To: Jamal Hadi Salim <jhs@...atatu.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Cong Wang <xiyou.wangcong@...il.com>, Jiri Pirko <jiri@...nulli.us>,
Peilin Ye <peilin.ye@...edance.com>,
Daniel Borkmann <daniel@...earbox.net>,
Vlad Buslov <vladbu@...lanox.com>,
Pedro Tammela <pctammela@...atatu.com>,
Hillf Danton <hdanton@...a.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Cong Wang <cong.wang@...edance.com>,
John Fastabend <john.fastabend@...il.com>
Subject: Re: [PATCH net 5/6] net/sched: Refactor qdisc_graft() for ingress
and clsact Qdiscs
On Mon, May 08, 2023 at 07:29:26AM -0400, Jamal Hadi Salim wrote:
> On Fri, May 5, 2023 at 8:15 PM Peilin Ye <yepeilin.cs@...il.com> wrote:
> >
> > Grafting ingress and clsact Qdiscs does not need a for-loop in
> > qdisc_graft(). Refactor it. No functional changes intended.
>
> This one i am not so sure; num_q = 1 implies it will run on the for
> loop only once. I am not sure it improves readability either. Anyways
> for the effort you put into it i am tossing a coin and saying:
> Reviewed-by: Jamal Hadi Salim <jhs@...atatu.com>
> Acked-by: Jamal Hadi Salim <jhs@...atatu.com>
Yeah, it doesn't make much difference itself. I'm just afraid that,
without [5/6], [6/6] would look like:
for (i = 0; i < num_q; i++) {
if (!ingress) {
dev_queue = netdev_get_tx_queue(dev, i);
old = dev_graft_qdisc(dev_queue, new);
else {
old = dev_graft_qdisc(dev_queue, NULL);
}
if (new && i > 0)
qdisc_refcount_inc(new);
if (!ingress) {
qdisc_put(old);
} else {
/* {ingress,clsact}_destroy() "old" before grafting "new" to avoid
* unprotected concurrent accesses to net_device::miniq_{in,e}gress
* pointer(s) in mini_qdisc_pair_swap().
*/
qdisc_notify(net, skb, n, classid, old, new, extack);
qdisc_destroy(old);
}
if (ingress)
dev_graft_qdisc(dev_queue, new);
}
The "!ingress" path doesn't share a single line with "ingress", which
looks a bit weird to me. Personally I'd like to keep [5/6].
Thanks,
Peilin Ye
Powered by blists - more mailing lists