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 Acked-by: Lorenzo Bianconi Reviewed-by: Joe Damato Signed-off-by: Maxime Chevallier --- 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 4fc96b317d79..17991572fd2d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -440,6 +440,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 0c381ae0d0ff..76f9f5d35253 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3571,7 +3571,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; } @@ -8100,7 +8100,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