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: <CA+h21hr3Ej2wBUCBOYe4CU1XRpQnj047RoRVdYSg8uhFNPYqnw@mail.gmail.com>
Date:   Sat, 25 Jan 2020 18:52:00 +0200
From:   Vladimir Oltean <olteanv@...il.com>
To:     Vinicius Costa Gomes <vinicius.gomes@...el.com>
Cc:     netdev <netdev@...r.kernel.org>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Jiri Pirko <jiri@...nulli.us>,
        "David S. Miller" <davem@...emloft.net>,
        Vladimir Oltean <vladimir.oltean@....com>,
        Po Liu <po.liu@....com>
Subject: Re: [PATCH net v1 3/3] taprio: Allow users not to specify "flags"
 when changing schedules

On Sat, 25 Jan 2020 at 02:52, Vinicius Costa Gomes
<vinicius.gomes@...el.com> wrote:
>
> When any offload mode is enabled, users had to specify the
> "flags" parameter when adding a new "admin" schedule.
>
> This fix allows that parameter to be omitted when adding a new
> schedule.
>
> Also move 'taprio_flags' to a smaller scope, so we reduce the region
> where we have two variables with the similar concepts ('taprio_flags'
> and 'q->flags').
>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@...el.com>
> ---

Acked-by: Vladimir Oltean <vladimir.oltean@....com>

>  net/sched/sch_taprio.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
> index dfbecb9ee2f4..65357e2ba04e 100644
> --- a/net/sched/sch_taprio.c
> +++ b/net/sched/sch_taprio.c
> @@ -1375,7 +1375,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
>         struct taprio_sched *q = qdisc_priv(sch);
>         struct net_device *dev = qdisc_dev(sch);
>         struct tc_mqprio_qopt *mqprio = NULL;
> -       u32 taprio_flags = 0;
>         unsigned long flags;
>         ktime_t start;
>         int i, err;
> @@ -1389,7 +1388,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
>                 mqprio = nla_data(tb[TCA_TAPRIO_ATTR_PRIOMAP]);
>
>         if (tb[TCA_TAPRIO_ATTR_FLAGS]) {
> -               taprio_flags = nla_get_u32(tb[TCA_TAPRIO_ATTR_FLAGS]);
> +               u32 taprio_flags = nla_get_u32(tb[TCA_TAPRIO_ATTR_FLAGS]);
>
>                 if (q->flags != taprio_flags) {
>                         NL_SET_ERR_MSG_MOD(extack, "Changing 'flags' of a running schedule is not supported");
> @@ -1402,7 +1401,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
>                 q->flags = taprio_flags;
>         }
>
> -       err = taprio_parse_mqprio_opt(dev, mqprio, extack, taprio_flags);
> +       err = taprio_parse_mqprio_opt(dev, mqprio, extack, q->flags);
>         if (err < 0)
>                 return err;
>
> @@ -1457,7 +1456,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
>                                                mqprio->prio_tc_map[i]);
>         }
>
> -       if (FULL_OFFLOAD_IS_ENABLED(taprio_flags))
> +       if (FULL_OFFLOAD_IS_ENABLED(q->flags))
>                 err = taprio_enable_offload(dev, mqprio, q, new_admin, extack);
>         else
>                 err = taprio_disable_offload(dev, q, extack);
> @@ -1477,14 +1476,14 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
>                 q->txtime_delay = nla_get_u32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]);
>         }
>
> -       if (!TXTIME_ASSIST_IS_ENABLED(taprio_flags) &&
> -           !FULL_OFFLOAD_IS_ENABLED(taprio_flags) &&
> +       if (!TXTIME_ASSIST_IS_ENABLED(q->flags) &&
> +           !FULL_OFFLOAD_IS_ENABLED(q->flags) &&
>             !hrtimer_active(&q->advance_timer)) {
>                 hrtimer_init(&q->advance_timer, q->clockid, HRTIMER_MODE_ABS);
>                 q->advance_timer.function = advance_sched;
>         }
>
> -       if (FULL_OFFLOAD_IS_ENABLED(taprio_flags)) {
> +       if (FULL_OFFLOAD_IS_ENABLED(q->flags)) {
>                 q->dequeue = taprio_dequeue_offload;
>                 q->peek = taprio_peek_offload;
>         } else {
> @@ -1501,7 +1500,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
>                 goto unlock;
>         }
>
> -       if (TXTIME_ASSIST_IS_ENABLED(taprio_flags)) {
> +       if (TXTIME_ASSIST_IS_ENABLED(q->flags)) {
>                 setup_txtime(q, new_admin, start);
>
>                 if (!oper) {
> @@ -1528,7 +1527,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
>
>                 spin_unlock_irqrestore(&q->current_entry_lock, flags);
>
> -               if (FULL_OFFLOAD_IS_ENABLED(taprio_flags))
> +               if (FULL_OFFLOAD_IS_ENABLED(q->flags))
>                         taprio_offload_config_changed(q);
>         }
>
> --
> 2.25.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ