Commit 4eee13f1 authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller

net: stmmac: selftests: Guard VLAN Perfect test against non supported HW

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: 1b2250a0 ("net: stmmac: selftests: Add tests for VLAN Perfect Filtering")
Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d39b68e5
...@@ -971,6 +971,9 @@ static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv) ...@@ -971,6 +971,9 @@ static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv)
{ {
int ret, prev_cap = priv->dma_cap.vlhash; 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; priv->dma_cap.vlhash = 0;
ret = __stmmac_test_vlanfilt(priv); ret = __stmmac_test_vlanfilt(priv);
priv->dma_cap.vlhash = prev_cap; priv->dma_cap.vlhash = prev_cap;
...@@ -1063,6 +1066,9 @@ static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv) ...@@ -1063,6 +1066,9 @@ static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv)
{ {
int ret, prev_cap = priv->dma_cap.vlhash; 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; priv->dma_cap.vlhash = 0;
ret = __stmmac_test_dvlanfilt(priv); ret = __stmmac_test_dvlanfilt(priv);
priv->dma_cap.vlhash = prev_cap; priv->dma_cap.vlhash = prev_cap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment