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: <d22b01e14ec4c4fc25900e3fdf98c525f695bbb1.camel@microchip.com>
Date:   Tue, 29 Nov 2022 06:42:14 +0000
From:   <Arun.Ramadoss@...rochip.com>
To:     <olteanv@...il.com>, <UNGLinuxDriver@...rochip.com>,
        <vivien.didelot@...il.com>, <andrew@...n.ch>,
        <f.fainelli@...il.com>, <kuba@...nel.org>, <edumazet@...gle.com>,
        <pabeni@...hat.com>, <o.rempel@...gutronix.de>,
        <Woojung.Huh@...rochip.com>, <davem@...emloft.net>
CC:     <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
        <kernel@...gutronix.de>
Subject: Re: [PATCH v1 14/26] net: dsa: microchip: KSZ88x3 fix loopback
 support

Hi Oleksij,

On Mon, 2022-11-28 at 12:59 +0100, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> With current code loopback is not working and selftest will always
> fail.
> Fix register and bit offsets to make loopback on KSZ88x3 switches.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> ---
>  drivers/net/dsa/microchip/ksz8795.c     | 24 ++++++++++++++++++-----
> -
>  drivers/net/dsa/microchip/ksz8795_reg.h |  1 +
>  2 files changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz8795.c
> b/drivers/net/dsa/microchip/ksz8795.c
> index 208cf4dde397..a6d5de41a754 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -625,8 +625,13 @@ int ksz8_r_phy(struct ksz_device *dev, u16 phy,
> u16 reg, u16 *val)
>                 if (ret)
>                         return ret;
> 
> -               if (restart & PORT_PHY_LOOPBACK)
> -                       data |= BMCR_LOOPBACK;
> +               if (ksz_is_ksz88x3(dev)) {
> +                       if (restart & KSZ8873_PORT_PHY_LOOPBACK)
> +                               data |= BMCR_LOOPBACK;
> +               } else {
> +                       if (restart & PORT_PHY_LOOPBACK)
> +                               data |= BMCR_LOOPBACK;
> +               }

Can you consider using ksz8795_masks[] and ksz8863_masks[] to check the
loopback. Like if (restart & mask[PHY_LOOPBAK)) to avoid two checks.

>                 if (ctrl & PORT_FORCE_100_MBIT)
>                         data |= BMCR_SPEED100;
>                 if (ksz_is_ksz88x3(dev)) {
> diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h
> b/drivers/net/dsa/microchip/ksz8795_reg.h
> index 0bdceb534192..08204da7d621 100644
> --- a/drivers/net/dsa/microchip/ksz8795_reg.h
> +++ b/drivers/net/dsa/microchip/ksz8795_reg.h
> @@ -262,6 +262,7 @@
>  #define PORT_AUTO_MDIX_DISABLE         BIT(2)
>  #define PORT_FORCE_MDIX                        BIT(1)
>  #define PORT_MAC_LOOPBACK              BIT(0)
> +#define KSZ8873_PORT_PHY_LOOPBACK      BIT(0)
> 
>  #define REG_PORT_1_STATUS_2            0x1E
>  #define REG_PORT_2_STATUS_2            0x2E
> --
> 2.30.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ