Message ID | 89d95c7121117df7ce6236b330c443e13fdbaa80.1702990507.git.siyanteng@loongson.cn (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | stmmac: Add Loongson platform support | expand |
On Tue, Dec 19, 2023 at 10:28:18PM +0800, Yanteng Si wrote: > Loongson GMAC does not support Flow Control feature. Set flags to > disable it. > > Signed-off-by: Yanteng Si <siyanteng@loongson.cn> > Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> > Signed-off-by: Yinggang Gu <guyinggang@loongson.cn> > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 2 ++ > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- > include/linux/stmmac.h | 1 + > 3 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c > index 9e4953c7e4e0..77c9bcb66a8e 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c > @@ -160,6 +160,8 @@ static int loongson_gmac_config(struct pci_dev *pdev, > break; > } > > + plat->flags |= FIELD_PREP(STMMAC_FLAG_DISABLE_FLOW_CONTROL, 1); Why FIELD_PREP()-ing? > + > return ret; > } > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 9764d2ab7e46..d94f61742772 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -1236,9 +1236,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) > xpcs_get_interfaces(priv->hw->xpcs, > priv->phylink_config.supported_interfaces); > > - priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | > - MAC_10FD | MAC_100FD | > - MAC_1000FD; > + priv->phylink_config.mac_capabilities = MAC_10FD | MAC_100FD | MAC_1000FD; > + if (!FIELD_GET(STMMAC_FLAG_DISABLE_FLOW_CONTROL, priv->plat->flags)) !(priv->plat->flags & STMMAC_FLAG_DISABLE_FLOW_CONTROL) ? -Serge(y) > + priv->phylink_config.mac_capabilities |= MAC_ASYM_PAUSE | MAC_SYM_PAUSE; > > stmmac_set_half_duplex(priv); > > diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h > index 067030cdb60f..5ece92e4d8c3 100644 > --- a/include/linux/stmmac.h > +++ b/include/linux/stmmac.h > @@ -224,6 +224,7 @@ struct dwmac4_addrs { > #define STMMAC_FLAG_HAS_LGMAC BIT(13) > #define STMMAC_FLAG_DISABLE_HALF_DUPLEX BIT(14) > #define STMMAC_FLAG_DISABLE_FORCE_1000 BIT(15) > +#define STMMAC_FLAG_DISABLE_FLOW_CONTROL BIT(16) > > struct plat_stmmacenet_data { > int bus_id; > -- > 2.31.4 >
在 2023/12/21 10:35, Serge Semin 写道: > On Tue, Dec 19, 2023 at 10:28:18PM +0800, Yanteng Si wrote: >> Loongson GMAC does not support Flow Control feature. Set flags to >> disable it. >> >> Signed-off-by: Yanteng Si <siyanteng@loongson.cn> >> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> >> Signed-off-by: Yinggang Gu <guyinggang@loongson.cn> >> --- >> drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 2 ++ >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- >> include/linux/stmmac.h | 1 + >> 3 files changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c >> index 9e4953c7e4e0..77c9bcb66a8e 100644 >> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c >> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c >> @@ -160,6 +160,8 @@ static int loongson_gmac_config(struct pci_dev *pdev, >> break; >> } >> >> + plat->flags |= FIELD_PREP(STMMAC_FLAG_DISABLE_FLOW_CONTROL, 1); > Why FIELD_PREP()-ing? This is very early code and will be changed to: plat->flags |= STMMAC_FLAG_DISABLE_FLOW_CONTROL; > >> + >> return ret; >> } >> >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> index 9764d2ab7e46..d94f61742772 100644 >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> @@ -1236,9 +1236,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) >> xpcs_get_interfaces(priv->hw->xpcs, >> priv->phylink_config.supported_interfaces); >> >> - priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | >> - MAC_10FD | MAC_100FD | >> - MAC_1000FD; >> + priv->phylink_config.mac_capabilities = MAC_10FD | MAC_100FD | MAC_1000FD; >> + if (!FIELD_GET(STMMAC_FLAG_DISABLE_FLOW_CONTROL, priv->plat->flags)) > !(priv->plat->flags & STMMAC_FLAG_DISABLE_FLOW_CONTROL) ? OK! Thanks, Yanteng > > -Serge(y) > >> + priv->phylink_config.mac_capabilities |= MAC_ASYM_PAUSE | MAC_SYM_PAUSE; >> >> stmmac_set_half_duplex(priv); >> >> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h >> index 067030cdb60f..5ece92e4d8c3 100644 >> --- a/include/linux/stmmac.h >> +++ b/include/linux/stmmac.h >> @@ -224,6 +224,7 @@ struct dwmac4_addrs { >> #define STMMAC_FLAG_HAS_LGMAC BIT(13) >> #define STMMAC_FLAG_DISABLE_HALF_DUPLEX BIT(14) >> #define STMMAC_FLAG_DISABLE_FORCE_1000 BIT(15) >> +#define STMMAC_FLAG_DISABLE_FLOW_CONTROL BIT(16) >> >> struct plat_stmmacenet_data { >> int bus_id; >> -- >> 2.31.4 >>
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c index 9e4953c7e4e0..77c9bcb66a8e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c @@ -160,6 +160,8 @@ static int loongson_gmac_config(struct pci_dev *pdev, break; } + plat->flags |= FIELD_PREP(STMMAC_FLAG_DISABLE_FLOW_CONTROL, 1); + return ret; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9764d2ab7e46..d94f61742772 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1236,9 +1236,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) xpcs_get_interfaces(priv->hw->xpcs, priv->phylink_config.supported_interfaces); - priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | - MAC_10FD | MAC_100FD | - MAC_1000FD; + priv->phylink_config.mac_capabilities = MAC_10FD | MAC_100FD | MAC_1000FD; + if (!FIELD_GET(STMMAC_FLAG_DISABLE_FLOW_CONTROL, priv->plat->flags)) + priv->phylink_config.mac_capabilities |= MAC_ASYM_PAUSE | MAC_SYM_PAUSE; stmmac_set_half_duplex(priv); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 067030cdb60f..5ece92e4d8c3 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -224,6 +224,7 @@ struct dwmac4_addrs { #define STMMAC_FLAG_HAS_LGMAC BIT(13) #define STMMAC_FLAG_DISABLE_HALF_DUPLEX BIT(14) #define STMMAC_FLAG_DISABLE_FORCE_1000 BIT(15) +#define STMMAC_FLAG_DISABLE_FLOW_CONTROL BIT(16) struct plat_stmmacenet_data { int bus_id;