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]
Date: Sun, 7 Apr 2024 17:27:38 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Yanteng Si <siyanteng@...ngson.cn>
Cc: hkallweit1@...il.com, peppe.cavallaro@...com,
	alexandre.torgue@...s.st.com, joabreu@...opsys.com,
	fancer.lancer@...il.com, Jose.Abreu@...opsys.com,
	chenhuacai@...ngson.cn, linux@...linux.org.uk,
	guyinggang@...ngson.cn, netdev@...r.kernel.org,
	chris.chenfeiyang@...il.com, siyanteng01@...il.com
Subject: Re: [PATCH net-next v9 6/6] net: stmmac: dwmac-loongson: Add GNET
 support

On Sun, Apr 07, 2024 at 05:06:34PM +0800, Yanteng Si wrote:
> 
> 在 2024/4/6 22:46, Andrew Lunn 写道:
> > > +	 */
> > > +	if (speed == SPEED_1000) {
> > > +		if (readl(ptr->ioaddr + MAC_CTRL_REG) & (1 << 15))
> > It would be good to add a #define using BIT(15) for this PS bit. Also,
> OK.
> > what does PS actually mean?
> 
> In DW GMAC v3.73a:
> 
> It is the bit 15 of MAC Configuration Register
> 
> 
> Port Select

Since this is a standard bit in a register, please add a #define for
it. Something like

#define MAC_CTRL_PORT_SELECT_10_100 BIT(15)

maybe in commom.h? I don't know this driver too well, so it might have
a different naming convention. 

	if (speed == SPEED_1000) {
		if (readl(ptr->ioaddr + MAC_CTRL_REG) & MAC_CTRL_PORT_SELECT_10_100)
		/* Word around hardware bug, restart autoneg */

is more obvious what is going on.

> > > +	priv->synopsys_id = 0x37;
> > hwif.c:		if (priv->synopsys_id >= DWMAC_CORE_3_50) {
> > hwif.c:	priv->synopsys_id = id;
> > hwif.c:		/* Use synopsys_id var because some setups can override this */
> > hwif.c:		if (priv->synopsys_id < entry->min_id)
> > stmmac_ethtool.c:		if (priv->synopsys_id >= DWMAC_CORE_3_50)
> > stmmac.h:	int synopsys_id;
> > stmmac_main.c:			if (priv->synopsys_id < DWMAC_CORE_4_10)
> > stmmac_main.c:	if (priv->synopsys_id >= DWMAC_CORE_4_00 ||
> > stmmac_main.c:		if (priv->synopsys_id < DWMAC_CORE_4_00)
> > stmmac_main.c:	if (((priv->synopsys_id >= DWMAC_CORE_3_50) ||
> > stmmac_main.c:	if (priv->synopsys_id < DWMAC_CORE_5_20)
> > stmmac_main.c:	else if ((priv->plat->enh_desc) || (priv->synopsys_id >= DWMAC_CORE_4_00))
> > stmmac_mdio.c:	if (priv->synopsys_id < DWXGMAC_CORE_2_20) {
> > stmmac_mdio.c:	if (priv->synopsys_id < DWXGMAC_CORE_2_20 &&
> > stmmac_mdio.c:	if (priv->synopsys_id < DWXGMAC_CORE_2_20 &&
> > stmmac_mdio.c:		if (priv->synopsys_id < DWXGMAC_CORE_2_20) {
> > 
> > Please add a #define for this 0x37.
> > 
> > Who allocated this value? Synopsys?
> It look like this.

That did not answer my question. Did Synopsys allocate this value?  If
not, what happens when Synopsys does produce a version which makes use
of this value?

> > 
> > /* Synopsys Core versions */
> > #define DWMAC_CORE_3_40         0x34
> > #define DWMAC_CORE_3_50         0x35
> > #define DWMAC_CORE_4_00         0x40
> > #define DWMAC_CORE_4_10         0x41
> > 
> > 0x37 makes it somewhere between a 3.5 and 4.0.
> 
> Yeah,
> 
> How about defining it in
> drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c?

No, because of the version comparisons within the code, developers
need to know what versions actually exist. So you should include it
along side all the other values.

      Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ