]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: stmmac: selftests: Guard VLAN Perfect test against non supported HW
authorJose Abreu <Jose.Abreu@synopsys.com>
Tue, 14 Jan 2020 16:09:23 +0000 (17:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Jan 2020 22:11:18 +0000 (23:11 +0100)
When HW does not support perfect filtering the feature will not be
enabled in the net_device. Add a check for this to prevent failures.

Fixes: 89f15a2c48ec ("net: stmmac: selftests: Add tests for VLAN Perfect Filtering")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c

index 7edee3c87ac9e1bb7945a27e46fd8b1e281dd5c3..450d7dac3ea6f195fdd8cf083b86022a1cfa648f 100644 (file)
@@ -971,6 +971,9 @@ static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv)
 {
        int ret, prev_cap = priv->dma_cap.vlhash;
 
+       if (!(priv->dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
+               return -EOPNOTSUPP;
+
        priv->dma_cap.vlhash = 0;
        ret = __stmmac_test_vlanfilt(priv);
        priv->dma_cap.vlhash = prev_cap;
@@ -1063,6 +1066,9 @@ static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv)
 {
        int ret, prev_cap = priv->dma_cap.vlhash;
 
+       if (!(priv->dev->features & NETIF_F_HW_VLAN_STAG_FILTER))
+               return -EOPNOTSUPP;
+
        priv->dma_cap.vlhash = 0;
        ret = __stmmac_test_dvlanfilt(priv);
        priv->dma_cap.vlhash = prev_cap;