Thread (51 messages) 51 messages, 7 authors, 2023-05-24

Re: [PATCH net 5/6] net/sched: Refactor qdisc_graft() for ingress and clsact Qdiscs

From: Peilin Ye <hidden>
Date: 2023-05-08 22:24:32
Also in: lkml

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 [off-list ref] wrote:
quoted
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@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help