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: <vostvybxawyhzmcnabnh7hsc7kk6vdxfdzqu4rkuqv6sdm7cuw@fd2y2o7di5am>
Date: Tue, 6 Feb 2024 01:06:15 +0300
From: Serge Semin <fancer.lancer@...il.com>
To: Yanteng Si <siyanteng@...ngson.cn>
Cc: andrew@...n.ch, hkallweit1@...il.com, peppe.cavallaro@...com, 
	alexandre.torgue@...s.st.com, joabreu@...opsys.com, Jose.Abreu@...opsys.com, 
	chenhuacai@...ngson.cn, linux@...linux.org.uk, guyinggang@...ngson.cn, 
	netdev@...r.kernel.org, chris.chenfeiyang@...il.com
Subject: Re: [PATCH net-next v8 09/11] net: stmmac: dwmac-loongson: Fix half
 duplex

On Tue, Feb 06, 2024 at 12:58:17AM +0300, Serge Semin wrote:
> On Tue, Jan 30, 2024 at 04:49:14PM +0800, Yanteng Si wrote:
> > Current GNET does not support half duplex mode.
> > 
> > Signed-off-by: Yanteng Si <siyanteng@...ngson.cn>
> > Signed-off-by: Feiyang Chen <chenfeiyang@...ngson.cn>
> > Signed-off-by: Yinggang Gu <guyinggang@...ngson.cn>
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 11 ++++++++++-
> >  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c    |  3 ++-
> >  include/linux/stmmac.h                               |  1 +
> >  3 files changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > index 264c4c198d5a..1753a3c46b77 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > @@ -432,8 +432,17 @@ static int loongson_gnet_config(struct pci_dev *pdev,
> >  				struct stmmac_resources *res,
> >  				struct device_node *np)
> >  {
> 
> > -	if (pdev->revision == 0x00 || pdev->revision == 0x01)
> > +	switch (pdev->revision) {
> > +	case 0x00:
> > +		plat->flags |= STMMAC_FLAG_DISABLE_FORCE_1000 |
> > +			       STMMAC_FLAG_DISABLE_HALF_DUPLEX;
> > +		break;
> > +	case 0x01:
> >  		plat->flags |= STMMAC_FLAG_DISABLE_FORCE_1000;
> > +		break;
> > +	default:
> > +		break;
> > +	}
> 
> Move this change into the patch
> [PATCH net-next v8 06/11] net: stmmac: dwmac-loongson: Add GNET support
> 
> >  
> >  	return 0;
> >  }
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 5617b40abbe4..3aa862269eb0 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -1201,7 +1201,8 @@ static int stmmac_init_phy(struct net_device *dev)
> >  static void stmmac_set_half_duplex(struct stmmac_priv *priv)
> >  {
> 

> >  	/* Half-Duplex can only work with single tx queue */
> > -	if (priv->plat->tx_queues_to_use > 1)
> > +	if (priv->plat->tx_queues_to_use > 1 ||
> > +	    (STMMAC_FLAG_DISABLE_HALF_DUPLEX & priv->plat->flags))
> >  		priv->phylink_config.mac_capabilities &=
> >  			~(MAC_10HD | MAC_100HD | MAC_1000HD);
> >  	else
> > diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> > index 2810361e4048..197f6f914104 100644
> > --- a/include/linux/stmmac.h
> > +++ b/include/linux/stmmac.h
> > @@ -222,6 +222,7 @@ struct dwmac4_addrs {
> >  #define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING	BIT(11)
> >  #define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY	BIT(12)
> >  #define STMMAC_FLAG_DISABLE_FORCE_1000	BIT(13)
> > +#define STMMAC_FLAG_DISABLE_HALF_DUPLEX	BIT(14)
> >  
> 
> Place the patch with this change before
> [PATCH net-next v8 06/11] net: stmmac: dwmac-loongson: Add GNET support
> as a pre-requisite/preparation patch. Don't forget a thorough
> description of what is wrong with the GNET Half-Duplex mode.

BTW what about re-defining the stmmac_ops.phylink_get_caps() callback
instead of adding fixup flags in this patch and in the next one?

-Serge()

> 
> -Serge(y)
> 
> >  struct plat_stmmacenet_data {
> >  	int bus_id;
> > -- 
> > 2.31.4
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ