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]
Date:   Sun, 5 Feb 2023 13:10:35 +0100
From:   Gerhard Engleder <gerhard@...leder-embedded.com>
To:     Vladimir Oltean <vladimir.oltean@....com>, netdev@...r.kernel.org
Cc:     "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Vinicius Costa Gomes <vinicius.gomes@...el.com>,
        Kurt Kanzenbach <kurt@...utronix.de>,
        Jacob Keller <jacob.e.keller@...el.com>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Jiri Pirko <jiri@...nulli.us>,
        Simon Horman <simon.horman@...igine.com>
Subject: Re: [PATCH v5 net-next 11/17] net/sched: taprio: centralize mqprio
 qopt validation

On 02.02.23 01:36, Vladimir Oltean wrote:
> There is a lot of code in taprio which is "borrowed" from mqprio.
> It makes sense to put a stop to the "borrowing" and start actually
> reusing code.
> 
> Because taprio and mqprio are built as part of different kernel modules,
> code reuse can only take place either by writing it as static inline
> (limiting), putting it in sch_generic.o (not generic enough), or
> creating a third auto-selectable kernel module which only holds library
> code. I opted for the third variant.
> 
> In a previous change, mqprio gained support for reverse TC:TXQ mappings,
> something which taprio still denies. Make taprio use the same validation
> logic so that it supports this configuration as well.
> 
> The taprio code didn't enforce TXQ overlaps in txtime-assist mode and
> that looks intentional, even if I've no idea why that might be. Preserve
> that, but add a comment.
> 
> There isn't any dedicated MAINTAINERS entry for mqprio, so nothing to
> update there.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>

<...>

> +++ b/net/sched/sch_mqprio.c
> @@ -17,6 +17,8 @@
>   #include <net/sch_generic.h>
>   #include <net/pkt_cls.h>
>   
> +#include "sch_mqprio_lib.h"
> +
>   struct mqprio_sched {
>   	struct Qdisc		**qdiscs;
>   	u16 mode;
> @@ -27,59 +29,6 @@ struct mqprio_sched {
>   	u64 max_rate[TC_QOPT_MAX_QUEUE];
>   };
>   
> -/* Returns true if the intervals [a, b) and [c, d) overlap. */
> -static bool intervals_overlap(int a, int b, int c, int d)
> -{
> -	int left = max(a, c), right = min(b, d);
> -
> -	return left < right;
> -}

<...>

> +++ b/net/sched/sch_mqprio_lib.c
> @@ -0,0 +1,100 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +
> +#include <linux/net.h>
> +#include <linux/netdevice.h>
> +#include <linux/netlink.h>
> +#include <linux/types.h>
> +#include <net/pkt_sched.h>
> +
> +#include "sch_mqprio_lib.h"
> +
> +static bool intervals_overlap(int a, int b, int c, int d)

You may could keep the comment for this function.
/* Returns true if the intervals [a, b) and [c, d) overlap. */

Reviewed-by: Gerhard Engleder <gerhard@...leder-embedded.com>

Gerhard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ