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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Nov 2022 06:42:03 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Oleksij Rempel <o.rempel@...gutronix.de>,
        Woojung Huh <woojung.huh@...rochip.com>,
        UNGLinuxDriver@...rochip.com, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Cc:     Arun Ramadoss <arun.ramadoss@...rochip.com>, kernel@...gutronix.de,
        linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v4 1/4] net: dsa: microchip: move max mtu to one
 location



On 11/10/2022 4:22 AM, Oleksij Rempel wrote:
> There are no HW specific registers, so we can process all of them
> in one location.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> Tested-by: Arun Ramadoss <arun.ramadoss@...rochip.com> (KSZ9893 and LAN937x)

This looks good to me, just one nit see below

[snip]

> @@ -2500,10 +2499,23 @@ static int ksz_max_mtu(struct dsa_switch *ds, int port)
>   {
>   	struct ksz_device *dev = ds->priv;
>   
> -	if (!dev->dev_ops->max_mtu)
> -		return -EOPNOTSUPP;
> +	switch (dev->chip_id) {
> +	case KSZ8563_CHIP_ID:
> +	case KSZ9477_CHIP_ID:
> +	case KSZ9563_CHIP_ID:
> +	case KSZ9567_CHIP_ID:
> +	case KSZ9893_CHIP_ID:
> +	case KSZ9896_CHIP_ID:
> +	case KSZ9897_CHIP_ID:
> +	case LAN9370_CHIP_ID:
> +	case LAN9371_CHIP_ID:
> +	case LAN9372_CHIP_ID:
> +	case LAN9373_CHIP_ID:
> +	case LAN9374_CHIP_ID:
> +		return KSZ9477_MAX_FRAME_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN;

Rename to KSZ_MAX_FRAME_SIZE to denote this is a common constant?

> +	}
>   
> -	return dev->dev_ops->max_mtu(dev, port);
> +	return -EOPNOTSUPP;
>   }
>   
>   static void ksz_set_xmii(struct ksz_device *dev, int port,
> diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
> index c6726cbd5465..27c26ee15af4 100644
> --- a/drivers/net/dsa/microchip/ksz_common.h
> +++ b/drivers/net/dsa/microchip/ksz_common.h
> @@ -322,7 +322,6 @@ struct ksz_dev_ops {
>   	void (*get_caps)(struct ksz_device *dev, int port,
>   			 struct phylink_config *config);
>   	int (*change_mtu)(struct ksz_device *dev, int port, int mtu);
> -	int (*max_mtu)(struct ksz_device *dev, int port);
>   	void (*freeze_mib)(struct ksz_device *dev, int port, bool freeze);
>   	void (*port_init_cnt)(struct ksz_device *dev, int port);
>   	void (*phylink_mac_config)(struct ksz_device *dev, int port,
> @@ -588,6 +587,8 @@ static inline int is_lan937x(struct ksz_device *dev)
>   
>   #define PORT_SRC_PHY_INT		1
>   
> +#define KSZ9477_MAX_FRAME_SIZE		9000\

And here are as well.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ