[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211026114351.sq2qlpbfptd7hyxm@linutronix.de>
Date: Tue, 26 Oct 2021 13:43:51 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Denis Kirjanov <dkirjanov@...e.de>
Cc: Arnd Bergmann <arnd@...nel.org>,
Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
"Ahmed S. Darwish" <a.darwish@...utronix.de>,
Arnd Bergmann <arnd@...db.de>,
Zheng Yongjun <zhengyongjun3@...wei.com>,
Eric Dumazet <edumazet@...gle.com>,
Randy Dunlap <rdunlap@...radead.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH net-next v3] net: sched: gred: dynamically allocate
tc_gred_qopt_offload
On 2021-10-26 14:16:16 [+0300], Denis Kirjanov wrote:
> 10/26/21 1:51 PM, Sebastian Andrzej Siewior пишет:
> > On 2021-10-26 13:42:24 [+0300], Denis Kirjanov wrote:
> > > > diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
> > > > index 72de08ef8335e..1073c76d05c45 100644
> > > > --- a/net/sched/sch_gred.c
> > > > +++ b/net/sched/sch_gred.c
> > > > @@ -311,42 +312,43 @@ static void gred_offload(struct Qdisc *sch, enum tc_gred_command command)
> > > > {
> > > > struct gred_sched *table = qdisc_priv(sch);
> > > > struct net_device *dev = qdisc_dev(sch);
> > > > - struct tc_gred_qopt_offload opt = {
> > > > - .command = command,
> > > > - .handle = sch->handle,
> > > > - .parent = sch->parent,
> > > > - };
> > > > + struct tc_gred_qopt_offload *opt = table->opt;
> > > > if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
> > > > return;
> > > > + memset(opt, 0, sizeof(*opt));
> > >
> > > It's zeroed in kzalloc()
> >
> > but it is not limited to a single invocation?
>
> I meant that all fields are set in the function as it was with the stack
> storage.
What about?
| for (i = 0; i < table->DPs; i++) {
| struct gred_sched_data *q = table->tab[i];
|
| if (!q)
| continue;
The stack storage version has an implicit memset().
Sebastian
Powered by blists - more mailing lists