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: <CANn89iJ4Z=Z+iSHoQQhTS+QGyfU_TOeWNC3Sjszc=DeZ3-bJUw@mail.gmail.com>
Date:   Tue, 3 Nov 2020 09:18:50 +0100
From:   Eric Dumazet <edumazet@...gle.com>
To:     Allen Pais <allen.lkml@...il.com>
Cc:     David Miller <davem@...emloft.net>,
        Gerrit Renker <gerrit@....abdn.ac.uk>,
        Jakub Kicinski <kuba@...nel.org>,
        Alexey Kuznetsov <kuznet@....inr.ac.ru>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        Johannes Berg <johannes@...solutions.net>,
        Alexander Aring <alex.aring@...il.com>,
        stefan@...enfreihafen.org,
        Santosh Shilimkar <santosh.shilimkar@...cle.com>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Jiri Pirko <jiri@...nulli.us>,
        Steffen Klassert <steffen.klassert@...unet.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        netdev <netdev@...r.kernel.org>,
        Allen Pais <apais@...ux.microsoft.com>,
        Romain Perier <romain.perier@...il.com>
Subject: Re: [net-next V3 6/8] net: sched: convert tasklets to use new
 tasklet_setup() API

On Tue, Nov 3, 2020 at 8:10 AM Allen Pais <allen.lkml@...il.com> wrote:
>
> From: Allen Pais <apais@...ux.microsoft.com>
>
> In preparation for unconditionally passing the
> struct tasklet_struct pointer to all tasklet
> callbacks, switch to using the new tasklet_setup()
> and from_tasklet() to pass the tasklet pointer explicitly.
>
> Signed-off-by: Romain Perier <romain.perier@...il.com>
> Signed-off-by: Allen Pais <apais@...ux.microsoft.com>
> ---
>  net/sched/sch_atm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
> index 1c281cc81f57..390d972bb2f0 100644
> --- a/net/sched/sch_atm.c
> +++ b/net/sched/sch_atm.c
> @@ -466,10 +466,10 @@ drop: __maybe_unused
>   * non-ATM interfaces.
>   */
>
> -static void sch_atm_dequeue(unsigned long data)
> +static void sch_atm_dequeue(struct tasklet_struct *t)
>  {
> -       struct Qdisc *sch = (struct Qdisc *)data;
> -       struct atm_qdisc_data *p = qdisc_priv(sch);
> +       struct atm_qdisc_data *p = from_tasklet(p, t, task);
> +       struct Qdisc *sch = (struct Qdisc *)((char *)p - sizeof(struct Qdisc));

Hmm... I think I prefer not burying implementation details in
net/sched/sch_atm.c and instead
define a helper in include/net/pkt_sched.h

diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 4ed32e6b020145afb015c3c07d2ec3a613f1311d..15b1b30f454e4837cd1fc07bb3ff6b4f178b1d39
100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -24,6 +24,11 @@ static inline void *qdisc_priv(struct Qdisc *q)
        return &q->privdata;
 }

+static inline struct Qdisc *qdisc_from_priv(void *priv)
+{
+       return container_of(priv, struct Qdisc, privdata);
+}
+
 /*
    Timer resolution MUST BE < 10% of min_schedulable_packet_size/bandwidth

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ