Messages in this thread | | | Date | Tue, 26 Oct 2021 13:43:51 +0200 | From | Sebastian Andrzej Siewior <> | 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
| |