> The RSS feature is only available in stmmac if the hardware reports it > through the DMA caps and if the platform glue sets rss_en. > > Introduce a helper that checks both. > > For now, no platform sets rss_en, but there's interest in the topic so > leave the door open instead of dropping the feature altogether. > > No functional changes intended. > > Suggested-by: Nicolai Buchwitz > Signed-off-by: Maxime Chevallier Acked-by: Lorenzo Bianconi > --- > drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 +++++ > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > index 7582fca63741..e2873d46e049 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > @@ -433,6 +433,11 @@ struct timespec64 stmmac_calc_tas_basetime(ktime_t old_base_time, > ktime_t current_time, > u64 cycle_time); > > +static inline bool stmmac_rss_is_supported(const struct stmmac_priv *priv) > +{ > + return priv->dma_cap.rssen && priv->plat->rss_en; > +} > + > #if IS_ENABLED(CONFIG_STMMAC_SELFTESTS) > void stmmac_selftest_run(struct net_device *dev, > struct ethtool_test *etest, u64 *buf); > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 4dee3542df3b..08feb18d62ba 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -3538,7 +3538,7 @@ static void stmmac_mac_config_rx_queues_routing(struct stmmac_priv *priv) > > static void stmmac_mac_config_rss(struct stmmac_priv *priv) > { > - if (!priv->dma_cap.rssen || !priv->plat->rss_en) { > + if (!stmmac_rss_is_supported(priv)) { > priv->rss.enable = false; > return; > } > @@ -8037,7 +8037,7 @@ static int __stmmac_dvr_probe(struct device *device, > for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++) > priv->rss.table[i] = ethtool_rxfh_indir_default(i, rxq); > > - if (priv->dma_cap.rssen && priv->plat->rss_en) > + if (stmmac_rss_is_supported(priv)) > ndev->features |= NETIF_F_RXHASH; > > ndev->vlan_features |= ndev->features; > -- > 2.55.0 > >