netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Yanteng Si <siyanteng@loongson.cn>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, peppe.cavallaro@st.com,
	alexandre.torgue@foss.st.com, joabreu@synopsys.com,
	fancer.lancer@gmail.com, Jose.Abreu@synopsys.com,
	chenhuacai@kernel.org, guyinggang@loongson.cn,
	netdev@vger.kernel.org, chris.chenfeiyang@gmail.com,
	siyanteng01@gmail.com
Subject: Re: [PATCH net-next v10 6/6] net: stmmac: dwmac-loongson: Add Loongson GNET support
Date: Wed, 10 Apr 2024 14:07:36 +0100	[thread overview]
Message-ID: <ZhaPGO77dcYxiqqA@shell.armlinux.org.uk> (raw)
In-Reply-To: <77daabe9ca5c62168d9e54a81b5822e9b898eeb3.1712668711.git.siyanteng@loongson.cn>

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!

  parent reply	other threads:[~2024-04-10 13:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 14:00 [PATCH net-next v10 0/6] stmmac: Add Loongson platform support Yanteng Si
2024-04-09 14:00 ` [PATCH net-next v10 1/6] net: stmmac: Move all PHYLINK MAC capabilities initializations to MAC-specific setup methods Yanteng Si
2024-04-09 14:00 ` [PATCH net-next v10 2/6] net: stmmac: Add multi-channel support Yanteng Si
2024-04-09 18:55   ` Simon Horman
2024-04-10  1:48     ` Yanteng Si
2024-04-09 14:00 ` [PATCH net-next v10 3/6] net: stmmac: dwmac-loongson: Use PCI_DEVICE_DATA() macro for device identification Yanteng Si
2024-04-09 14:04 ` [PATCH net-next v10 4/6] net: stmmac: dwmac-loongson: Introduce GMAC setup Yanteng Si
2024-04-09 14:04 ` [PATCH net-next v10 5/6] net: stmmac: dwmac-loongson: Add full PCI support Yanteng Si
2024-04-09 14:04 ` [PATCH net-next v10 6/6] net: stmmac: dwmac-loongson: Add Loongson GNET support Yanteng Si
2024-04-09 18:58   ` Simon Horman
2024-04-10  1:49     ` Yanteng Si
2024-04-10  3:15   ` Huacai Chen
2024-04-10 10:03     ` Yanteng Si
2024-04-10 13:07   ` Russell King (Oracle) [this message]
2024-04-11  9:29     ` Yanteng Si

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZhaPGO77dcYxiqqA@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=Jose.Abreu@synopsys.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=chenhuacai@kernel.org \
    --cc=chris.chenfeiyang@gmail.com \
    --cc=fancer.lancer@gmail.com \
    --cc=guyinggang@loongson.cn \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=siyanteng01@gmail.com \
    --cc=siyanteng@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).