From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Feiyang Chen <chenfeiyang@loongson.cn>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, peppe.cavallaro@st.com,
alexandre.torgue@foss.st.com, joabreu@synopsys.com,
chenhuacai@loongson.cn, dongbiao@loongson.cn,
guyinggang@loongson.cn, siyanteng@loongson.cn,
loongson-kernel@lists.loongnix.cn, netdev@vger.kernel.org,
loongarch@lists.linux.dev, chris.chenfeiyang@gmail.com
Subject: Re: [PATCH v4 11/11] net: stmmac: dwmac-loongson: Add GNET support
Date: Tue, 22 Aug 2023 12:45:03 +0100 [thread overview]
Message-ID: <ZOSfv9CcKRRC2kS/@shell.armlinux.org.uk> (raw)
In-Reply-To: <e83b526e0ee0f90ba0e645efec405de957c28bcb.1692696115.git.chenfeiyang@loongson.cn>
On Tue, Aug 22, 2023 at 05:41:19PM +0800, Feiyang Chen wrote:
> @@ -192,6 +192,86 @@ static struct stmmac_pci_info loongson_gmac_pci_info = {
> .config = loongson_gmac_config,
> };
>
> +static void loongson_gnet_fix_speed(void *priv, unsigned int speed)
> +{
What tree are these patches against? They don't look like the net-next
tree, since net-next has changed the prototype for the fix_mac_speed
method. Also, it would be good for it to be called
"loongson_gnet_fix_mac_speed" so that grepping for "fix_mac_speed"
finds not only the callsite but also the method definitions too.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index a98bcd797720..fa4d7b90c5fa 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1242,7 +1242,8 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
> }
>
> /* Half-Duplex can only work with single queue */
> - if (priv->plat->tx_queues_to_use > 1)
> + if (priv->plat->tx_queues_to_use > 1 ||
> + FIELD_GET(DWEGMAC_DISABLE_HALF_DUPLEX, priv->plat->dwegmac_flags))
> priv->phylink_config.mac_capabilities &=
> ~(MAC_10HD | MAC_100HD | MAC_1000HD);
There have been a number of shortcomings of stmmac's setup of the
phylink MAC capabilities recently, and I think it's getting to the
point where we need someone to bite the bullet and do something
about it.
Constantly extending conditions such as the above doesn't make a
lot of sense.
In patch 9, you've added:
+ priv->phylink_config.mac_capabilities = MAC_10 | MAC_100;
+ if (!FIELD_GET(DWEGMAC_DISABLE_FLOW_CONTROL, priv->plat->dwegmac_flags))
+ priv->phylink_config.mac_capabilities |=
+ MAC_ASYM_PAUSE | MAC_SYM_PAUSE;
The only two capabilities that are unconditional are MAC_10FD and
MAC_100FD. Everything else is conditional on something.
I'm thinking two things:
1) the stmmac platform implementations should be responsible for
initialising priv->phylink_config.mac_capabilities
2) phylink may need a function:
phylink_set_max_speed(struct phylink_config *config, u32 max_speed);
which does similar to phy_set_max_speed(), but operates on
mac_capabilities. This can then be used after calling the platform
setup of priv->phylink_config.mac_capabilities to limit the
speed. I'm not entirely sure that this is required though. I don't
think it's required for dwmac-intel, but would possibly be needed
for stmmac_platform since there's a "max-speed" property in DT.
What I'm basically saying is... let's not make the setup of
mac_capabilities any more convoluted than it already is by adding
new flags which only exist to set or clear other bits.
Also, let's try to stick to positive logic where possible!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-08-22 11:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 9:40 [PATCH v4 00/11] stmmac: Add Loongson platform support Feiyang Chen
2023-08-22 9:40 ` [PATCH v4 01/11] net: stmmac: Pass stmmac_priv and chan in some callbacks Feiyang Chen
2023-08-22 10:03 ` Russell King (Oracle)
2023-08-22 9:40 ` [PATCH v4 02/11] stmmac: dwmac1000: Add 64-bit DMA support Feiyang Chen
2023-08-22 9:40 ` [PATCH v4 03/11] stmmac: Add extended GMAC support for Loongson platforms Feiyang Chen
2023-08-22 16:13 ` Serge Semin
2023-08-22 9:40 ` [PATCH v4 04/11] net: stmmac: Allow platforms to set irq_flags Feiyang Chen
2023-08-22 9:40 ` [PATCH v4 05/11] net: stmmac: dwmac-loongson: Refactor code for loongson_dwmac_probe() Feiyang Chen
2023-08-22 9:40 ` [PATCH v4 06/11] net: stmmac: dwmac-loongson: Add LS7A support Feiyang Chen
2023-08-22 9:40 ` [PATCH v4 07/11] net: stmmac: dwmac-loongson: Add 64-bit DMA and MSI support Feiyang Chen
2023-08-22 9:41 ` [PATCH v4 08/11] net: stmmac: dwegmac: Fix channel numbers Feiyang Chen
2023-08-22 9:41 ` [PATCH v4 09/11] net: stmmac: dwmac-loongson: Disable flow control for GMAC Feiyang Chen
2023-08-22 9:41 ` [PATCH v4 10/11] net: stmmac: dwegmac: Disable coe Feiyang Chen
2023-08-22 9:41 ` [PATCH v4 11/11] net: stmmac: dwmac-loongson: Add GNET support Feiyang Chen
2023-08-22 11:45 ` Russell King (Oracle) [this message]
2023-08-24 1:47 ` [PATCH v4 00/11] stmmac: Add Loongson platform support Feiyang Chen
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=ZOSfv9CcKRRC2kS/@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=chenfeiyang@loongson.cn \
--cc=chenhuacai@loongson.cn \
--cc=chris.chenfeiyang@gmail.com \
--cc=dongbiao@loongson.cn \
--cc=guyinggang@loongson.cn \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=loongarch@lists.linux.dev \
--cc=loongson-kernel@lists.loongnix.cn \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.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).