Commit b870b0f8 authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller
Browse files

net: stmmac: selftests: Check if filtering is available before running



We need to check if the number of available Hash Filters is enough to
run the test, otherwise we will get false failures.

Fixes: 091810db ("net: stmmac: Introduce selftests support")
Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c763ac43
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -496,6 +496,9 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv)
	if (ret)
		return ret;

	if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins)
		return -EOPNOTSUPP;

	ret = dev_mc_add(priv->dev, gd_addr);
	if (ret)
		return ret;
@@ -573,6 +576,8 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv)

	if (stmmac_filter_check(priv))
		return -EOPNOTSUPP;
	if (!priv->hw->multicast_filter_bins)
		return -EOPNOTSUPP;

	/* Remove all MC addresses */
	__dev_mc_unsync(priv->dev, NULL);
@@ -611,6 +616,8 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv)

	if (stmmac_filter_check(priv))
		return -EOPNOTSUPP;
	if (!priv->hw->multicast_filter_bins)
		return -EOPNOTSUPP;

	/* Remove all UC addresses */
	__dev_uc_unsync(priv->dev, NULL);