diff mbox series

[v3,14/16] net: stmmac: dwmac-loongson: Disable flow control for GMAC

Message ID 021e4047c3b0f2c462e1aa891e25ae710705ed29.1691047285.git.chenfeiyang@loongson.cn (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series stmmac: Add Loongson platform support | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Feiyang Chen Aug. 3, 2023, 11:30 a.m. UTC
Loongson GMAC does not support Flow Control feature. Use
disable_flow_control flag to disable it.

Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 1 +
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c    | 5 +++++
 include/linux/stmmac.h                               | 1 +
 3 files changed, 7 insertions(+)

Comments

Jose Abreu Aug. 4, 2023, 5:28 p.m. UTC | #1
From: Feiyang Chen <chenfeiyang@loongson.cn>
Date: Thu, Aug 03, 2023 at 12:30:35

> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -360,5 +360,6 @@ struct plat_stmmacenet_data {
>  	bool dma_reset_times;
>  	u32 control_value;
>  	u32 irq_flags;
> +	bool disable_flow_control;
>  };
>  #endif

This (and other patches of this series) use a bool flag instead of the
Recently added bitfield flags, can you please switch to the bitfield flags?

Thanks,
Jose
Russell King (Oracle) Aug. 4, 2023, 8:38 p.m. UTC | #2
On Thu, Aug 03, 2023 at 07:30:35PM +0800, Feiyang Chen wrote:
> +
> +		if (priv->plat->disable_flow_control) {
> +			phy_support_sym_pause(dev->phydev);
> +			phy_set_sym_pause(dev->phydev, false, false, true);
> +		}

Given that stmmac uses phylink, control over the PHY is given over to
phylink to manage on the driver's behalf. Therefore, the above is not
very useful.

The correct way to deal with this is via
	priv->phylink_config.mac_capabilities

in stmmac_phy_setup().

Thanks.
Feiyang Chen Aug. 5, 2023, 6:15 a.m. UTC | #3
On Sat, Aug 5, 2023 at 1:29 AM Jose Abreu <Jose.Abreu@synopsys.com> wrote:
>
> From: Feiyang Chen <chenfeiyang@loongson.cn>
> Date: Thu, Aug 03, 2023 at 12:30:35
>
> > --- a/include/linux/stmmac.h
> > +++ b/include/linux/stmmac.h
> > @@ -360,5 +360,6 @@ struct plat_stmmacenet_data {
> >       bool dma_reset_times;
> >       u32 control_value;
> >       u32 irq_flags;
> > +     bool disable_flow_control;
> >  };
> >  #endif
>
> This (and other patches of this series) use a bool flag instead of the
> Recently added bitfield flags, can you please switch to the bitfield flags?
>

Hi, Jose,

OK.

Thanks,
Feiyang

> Thanks,
> Jose
Feiyang Chen Aug. 5, 2023, 6:15 a.m. UTC | #4
On Sat, Aug 5, 2023 at 4:38 AM Russell King (Oracle)
<linux@armlinux.org.uk> wrote:
>
> On Thu, Aug 03, 2023 at 07:30:35PM +0800, Feiyang Chen wrote:
> > +
> > +             if (priv->plat->disable_flow_control) {
> > +                     phy_support_sym_pause(dev->phydev);
> > +                     phy_set_sym_pause(dev->phydev, false, false, true);
> > +             }
>
> Given that stmmac uses phylink, control over the PHY is given over to
> phylink to manage on the driver's behalf. Therefore, the above is not
> very useful.
>
> The correct way to deal with this is via
>         priv->phylink_config.mac_capabilities
>
> in stmmac_phy_setup().

Hi, Russell,

OK.

Thanks,
Feiyang

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

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index 18bca996e1cb..40eddadd0bd2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -95,6 +95,7 @@  static int loongson_gmac_config(struct pci_dev *pdev,
 	}
 
 	plat->dma_reset_times = 5;
+	plat->disable_flow_control = true;
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5eafb08e2332..65ee5a681dcf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3827,6 +3827,11 @@  static int __stmmac_open(struct net_device *dev,
 				   __func__, ret);
 			goto init_phy_error;
 		}
+
+		if (priv->plat->disable_flow_control) {
+			phy_support_sym_pause(dev->phydev);
+			phy_set_sym_pause(dev->phydev, false, false, true);
+		}
 	}
 
 	/* Extra statistics */
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 2b59ddbe59ea..07570d808edb 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -360,5 +360,6 @@  struct plat_stmmacenet_data {
 	bool dma_reset_times;
 	u32 control_value;
 	u32 irq_flags;
+	bool disable_flow_control;
 };
 #endif