net: stmmac: selftests: Add missing checks for support of SA
authorJose Abreu <Jose.Abreu@synopsys.com>
Fri, 6 Sep 2019 07:41:13 +0000 (09:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Sep 2019 15:57:41 +0000 (17:57 +0200)
Add checks for support of Source Address Insertion/Replacement before
running the test.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c

index 305d24935cf460de6b0fb877daadd13708294826..dce34c081a1e9d2549f8dd8849c498132c332f37 100644 (file)
@@ -1057,6 +1057,9 @@ static int stmmac_test_desc_sai(struct stmmac_priv *priv)
        struct stmmac_packet_attrs attr = { };
        int ret;
 
+       if (!priv->dma_cap.vlins)
+               return -EOPNOTSUPP;
+
        attr.remove_sa = true;
        attr.sarc = true;
        attr.src = src;
@@ -1076,6 +1079,9 @@ static int stmmac_test_desc_sar(struct stmmac_priv *priv)
        struct stmmac_packet_attrs attr = { };
        int ret;
 
+       if (!priv->dma_cap.vlins)
+               return -EOPNOTSUPP;
+
        attr.sarc = true;
        attr.src = src;
        attr.dst = priv->dev->dev_addr;
@@ -1094,6 +1100,9 @@ static int stmmac_test_reg_sai(struct stmmac_priv *priv)
        struct stmmac_packet_attrs attr = { };
        int ret;
 
+       if (!priv->dma_cap.vlins)
+               return -EOPNOTSUPP;
+
        attr.remove_sa = true;
        attr.sarc = true;
        attr.src = src;
@@ -1114,6 +1123,9 @@ static int stmmac_test_reg_sar(struct stmmac_priv *priv)
        struct stmmac_packet_attrs attr = { };
        int ret;
 
+       if (!priv->dma_cap.vlins)
+               return -EOPNOTSUPP;
+
        attr.sarc = true;
        attr.src = src;
        attr.dst = priv->dev->dev_addr;