lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM0EoM=o862LdMEwmqpCSOFT=dMM8LhxgY3QUvpAow1rHSe7DA@mail.gmail.com>
Date: Mon, 8 May 2023 07:29:26 -0400
From: Jamal Hadi Salim <jhs@...atatu.com>
To: Peilin Ye <yepeilin.cs@...il.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 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.
>
> Signed-off-by: Peilin Ye <peilin.ye@...edance.com>

Fixed John's email address.

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>

cheers,
jamal


>  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 49b9c1bbfdd9..f72a581666a2 100644
> --- a/net/sched/sch_api.c
> +++ b/net/sched/sch_api.c
> @@ -1073,12 +1073,12 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
>
>         if (parent == NULL) {
>                 unsigned int i, num_q, ingress;
> +               struct netdev_queue *dev_queue;
>
>                 ingress = 0;
>                 num_q = dev->num_tx_queues;
>                 if ((q && q->flags & TCQ_F_INGRESS) ||
>                     (new && new->flags & TCQ_F_INGRESS)) {
> -                       num_q = 1;
>                         ingress = 1;
>                         if (!dev_ingress_queue(dev)) {
>                                 NL_SET_ERR_MSG(extack, "Device does not have an ingress queue");
> @@ -1094,18 +1094,18 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
>                 if (new && new->ops->attach && !ingress)
>                         goto skip;
>
> -               for (i = 0; i < num_q; i++) {
> -                       struct netdev_queue *dev_queue = dev_ingress_queue(dev);
> -
> -                       if (!ingress)
> +               if (!ingress) {
> +                       for (i = 0; i < num_q; i++) {
>                                 dev_queue = netdev_get_tx_queue(dev, i);
> +                               old = dev_graft_qdisc(dev_queue, new);
>
> -                       old = dev_graft_qdisc(dev_queue, new);
> -                       if (new && i > 0)
> -                               qdisc_refcount_inc(new);
> -
> -                       if (!ingress)
> +                               if (new && i > 0)
> +                                       qdisc_refcount_inc(new);
>                                 qdisc_put(old);
> +                       }
> +               } else {
> +                       dev_queue = dev_ingress_queue(dev);
> +                       old = dev_graft_qdisc(dev_queue, new);
>                 }
>
>  skip:
> --
> 2.20.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ