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: <78e905b30c3c19ca74a651c0a541965abafda266.camel@microchip.com>
Date: Tue, 9 Apr 2024 14:14:04 +0000
From: <Arun.Ramadoss@...rochip.com>
To: <andrew@...n.ch>, <olteanv@...il.com>, <davem@...emloft.net>,
	<Woojung.Huh@...rochip.com>, <pabeni@...hat.com>, <o.rempel@...gutronix.de>,
	<edumazet@...gle.com>, <f.fainelli@...il.com>, <kuba@...nel.org>
CC: <kernel@...gutronix.de>, <dsahern@...nel.org>, <san@...v.dk>,
	<willemb@...gle.com>, <linux-kernel@...r.kernel.org>,
	<netdev@...r.kernel.org>, <horms@...nel.org>, <UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH net-next v5 4/9] net: dsa: microchip: add multi queue
 support for KSZ88X3 variants

Hi Oleksij,


> 
> -static void ksz8795_set_prio_queue(struct ksz_device *dev, int port,
> int queue)
> +static int ksz8_port_queue_split(struct ksz_device *dev, int port,
> int queues)
>  {
> -       u8 hi, lo;
> +       u8 mask_4q, mask_2q;
> +       u8 reg_4q, reg_2q;
> +       u8 data_4q = 0;
> +       u8 data_2q = 0;
> +       int ret;
> 
> -       /* Number of queues can only be 1, 2, or 4. */
> -       switch (queue) {
> -       case 4:
> -       case 3:
> -               queue = PORT_QUEUE_SPLIT_4;
> -               break;
> -       case 2:
> -               queue = PORT_QUEUE_SPLIT_2;
> -               break;
> -       default:
> -               queue = PORT_QUEUE_SPLIT_1;
> +       if (ksz_is_ksz88x3(dev)) {
> +               mask_4q = KSZ8873_PORT_4QUEUE_SPLIT_EN;
> +               mask_2q = KSZ8873_PORT_2QUEUE_SPLIT_EN;
> +               reg_4q = REG_PORT_CTRL_0;
> +               reg_2q = REG_PORT_CTRL_2;
> +
> +               /* KSZ8795 family switches have Weighted Fair
> Queueing (WFQ)
> +                * enabled by default. Enable it for KSZ8873 family
> switches
> +                * too. Default value for KSZ8873 family is strict
> priority,
> +                * which should be enabled by using
> TC_SETUP_QDISC_ETS, not
> +                * by default.
> +                */
> +               ret = ksz_rmw8(dev, REG_SW_CTRL_3,
> WEIGHTED_FAIR_QUEUE_ENABLE,
> +                              WEIGHTED_FAIR_QUEUE_ENABLE);
> +               if (ret)
> +                       return ret;
> +       } else {
> +               mask_4q = KSZ8795_PORT_4QUEUE_SPLIT_EN;
> +               mask_2q = KSZ8795_PORT_2QUEUE_SPLIT_EN;
> +               reg_4q = REG_PORT_CTRL_13;
> +               reg_2q = REG_PORT_CTRL_0;
> +
> +               /* TODO: this is legacy from initial KSZ8795 driver,
> should be
> +                * moved to appropriate place in the future.
> +                */
> +               ret = ksz_rmw8(dev, REG_SW_CTRL_19,
> +                              SW_OUT_RATE_LIMIT_QUEUE_BASED,
> +                              SW_OUT_RATE_LIMIT_QUEUE_BASED);
> +               if (ret)
> +                       return ret;
>         }
> -       ksz_pread8(dev, port, REG_PORT_CTRL_0, &lo);
> -       ksz_pread8(dev, port, P_DROP_TAG_CTRL, &hi);
> -       lo &= ~PORT_QUEUE_SPLIT_L;
> -       if (queue & PORT_QUEUE_SPLIT_2)
> -               lo |= PORT_QUEUE_SPLIT_L;
> -       hi &= ~PORT_QUEUE_SPLIT_H;
> -       if (queue & PORT_QUEUE_SPLIT_4)
> -               hi |= PORT_QUEUE_SPLIT_H;
> -       ksz_pwrite8(dev, port, REG_PORT_CTRL_0, lo);
> -       ksz_pwrite8(dev, port, P_DROP_TAG_CTRL, hi);
> -
> -       /* Default is port based for egress rate limit. */
> -       if (queue != PORT_QUEUE_SPLIT_1)
> -               ksz_cfg(dev, REG_SW_CTRL_19,
> SW_OUT_RATE_LIMIT_QUEUE_BASED,
> -                       true);
> +
> +       if (queues == 4)
> +               data_4q = mask_4q;
> +       if (queues == 2)
> +               data_2q = mask_2q;

nitpick: it should be else if. 

Otherwise:
Acked-by: Arun Ramadoss <arun.ramadoss@...rochip.com>

> +
> +       ret = ksz_prmw8(dev, port, reg_4q, mask_4q, data_4q);
> +       if (ret)
> +               return ret;
> +
> +       return ksz_prmw8(dev, port, reg_2q, mask_2q, data_2q);
>  }
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ