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: <ZhaPGO77dcYxiqqA@shell.armlinux.org.uk>
Date: Wed, 10 Apr 2024 14:07:36 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Yanteng Si <siyanteng@...ngson.cn>
Cc: andrew@...n.ch, hkallweit1@...il.com, peppe.cavallaro@...com,
	alexandre.torgue@...s.st.com, joabreu@...opsys.com,
	fancer.lancer@...il.com, Jose.Abreu@...opsys.com,
	chenhuacai@...nel.org, guyinggang@...ngson.cn,
	netdev@...r.kernel.org, chris.chenfeiyang@...il.com,
	siyanteng01@...il.com
Subject: Re: [PATCH net-next v10 6/6] net: stmmac: dwmac-loongson: Add
 Loongson GNET support

On Tue, Apr 09, 2024 at 10:04:34PM +0800, Yanteng Si wrote:
> +	/* The GMAC device with PCI ID 7a03 does not support any pause mode.
> +	 * The GNET device (only LS7A2000) does not support half-duplex.
> +	 */
> +	if (pdev->device == PCI_DEVICE_ID_LOONGSON_GMAC) {
> +		priv->hw->link.caps = MAC_10FD | MAC_100FD |
> +			MAC_1000FD;
> +	} else {

I'm sorry, but what follows looks totally broken to me.

> +		priv->hw->link.caps = (MAC_ASYM_PAUSE |
> +			MAC_SYM_PAUSE | MAC_10FD | MAC_100FD | MAC_1000FD);

Parens not required.

This sets 10Mbps full duplex, 100Mbps full duplex, 1000Mbps full duplex.
It does *not* set 10Mbps half duplex, 100Mbps half duplex, nor 1000Mbps
half duplex.

> +
> +		if (loongson_gmac == DWMAC_CORE_3_70) {
> +			priv->hw->link.caps &= ~(MAC_10HD |
> +				MAC_100HD | MAC_1000HD);
> +		}

Braces not required.

This clears 10Mbps half duplex, 100Mbps half duplex, 1000Mbps half
duplex, all of which were _NOT_ set. Therefore this code as written
can be entirely deleted.

Alternatively, this code is completely untested and is functionally
incorrect.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ