[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250402134631.5af060dc@hermes.local>
Date: Wed, 2 Apr 2025 13:46:31 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Octavian Purdila <tavip@...gle.com>
Cc: jhs@...atatu.com, xiyou.wangcong@...il.com, jiri@...nulli.us,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, horms@...nel.org, shuah@...nel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net v2 1/3] net_sched: sch_sfq: use a temporary work
area for validating configuration
On Wed, 2 Apr 2025 09:27:48 -0700
Octavian Purdila <tavip@...gle.com> wrote:
> diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
> index 65d5b59da583..1af06cd5034a 100644
> --- a/net/sched/sch_sfq.c
> +++ b/net/sched/sch_sfq.c
> @@ -631,6 +631,16 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt,
> struct red_parms *p = NULL;
> struct sk_buff *to_free = NULL;
> struct sk_buff *tail = NULL;
> + /* work area for validating changes before committing them */
Unnecessary comment.
> + int limit;
> + unsigned int divisor;
> + unsigned int maxflows;
> + int perturb_period;
> + unsigned int quantum;
> + u8 headdrop;
> + u8 maxdepth;
> + u8 flags;
> +
Network code prefers reverse christmas tree style declaration order.
+ /* copy configuration to work area */
+ limit = q->limit;
+ divisor = q->divisor;
+ headdrop = q->headdrop;
+ maxdepth = q->maxdepth;
+ maxflows = q->maxflows;
+ perturb_period = q->perturb_period;
+ quantum = q->quantum;
+ flags = q->flags;
Comment is unneeded. Rather than doing individual fields, why not just use
a whole temporary structure?
Powered by blists - more mailing lists