Commit 05373e31 authored by Jose Abreu's avatar Jose Abreu Committed by Jakub Kicinski

net: stmmac: selftests: Switch to dev_direct_xmit()

In the upcoming commit for TBS selftest we will need to send a packet on
a specific Queue. As stmmac fallsback to netdev_pick_tx() on the select
Queue callback, we need to switch all selftests logic to
dev_direct_xmit() so that we can send the given SKB on a specific Queue.
Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 44e65475
...@@ -339,8 +339,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv, ...@@ -339,8 +339,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv,
goto cleanup; goto cleanup;
} }
skb_set_queue_mapping(skb, attr->queue_mapping); ret = dev_direct_xmit(skb, attr->queue_mapping);
ret = dev_queue_xmit(skb);
if (ret) if (ret)
goto cleanup; goto cleanup;
...@@ -926,8 +925,7 @@ static int __stmmac_test_vlanfilt(struct stmmac_priv *priv) ...@@ -926,8 +925,7 @@ static int __stmmac_test_vlanfilt(struct stmmac_priv *priv)
goto vlan_del; goto vlan_del;
} }
skb_set_queue_mapping(skb, 0); ret = dev_direct_xmit(skb, 0);
ret = dev_queue_xmit(skb);
if (ret) if (ret)
goto vlan_del; goto vlan_del;
...@@ -1018,8 +1016,7 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv) ...@@ -1018,8 +1016,7 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv)
goto vlan_del; goto vlan_del;
} }
skb_set_queue_mapping(skb, 0); ret = dev_direct_xmit(skb, 0);
ret = dev_queue_xmit(skb);
if (ret) if (ret)
goto vlan_del; goto vlan_del;
...@@ -1286,8 +1283,7 @@ static int stmmac_test_vlanoff_common(struct stmmac_priv *priv, bool svlan) ...@@ -1286,8 +1283,7 @@ static int stmmac_test_vlanoff_common(struct stmmac_priv *priv, bool svlan)
__vlan_hwaccel_put_tag(skb, htons(proto), tpriv->vlan_id); __vlan_hwaccel_put_tag(skb, htons(proto), tpriv->vlan_id);
skb->protocol = htons(proto); skb->protocol = htons(proto);
skb_set_queue_mapping(skb, 0); ret = dev_direct_xmit(skb, 0);
ret = dev_queue_xmit(skb);
if (ret) if (ret)
goto vlan_del; goto vlan_del;
...@@ -1639,8 +1635,7 @@ static int stmmac_test_arpoffload(struct stmmac_priv *priv) ...@@ -1639,8 +1635,7 @@ static int stmmac_test_arpoffload(struct stmmac_priv *priv)
if (ret) if (ret)
goto cleanup; goto cleanup;
skb_set_queue_mapping(skb, 0); ret = dev_direct_xmit(skb, 0);
ret = dev_queue_xmit(skb);
if (ret) if (ret)
goto cleanup_promisc; goto cleanup_promisc;
...@@ -1869,7 +1864,6 @@ void stmmac_selftest_run(struct net_device *dev, ...@@ -1869,7 +1864,6 @@ void stmmac_selftest_run(struct net_device *dev,
{ {
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
int count = stmmac_selftest_get_count(priv); int count = stmmac_selftest_get_count(priv);
int carrier = netif_carrier_ok(dev);
int i, ret; int i, ret;
memset(buf, 0, sizeof(*buf) * count); memset(buf, 0, sizeof(*buf) * count);
...@@ -1879,15 +1873,12 @@ void stmmac_selftest_run(struct net_device *dev, ...@@ -1879,15 +1873,12 @@ void stmmac_selftest_run(struct net_device *dev,
netdev_err(priv->dev, "Only offline tests are supported\n"); netdev_err(priv->dev, "Only offline tests are supported\n");
etest->flags |= ETH_TEST_FL_FAILED; etest->flags |= ETH_TEST_FL_FAILED;
return; return;
} else if (!carrier) { } else if (!netif_carrier_ok(dev)) {
netdev_err(priv->dev, "You need valid Link to execute tests\n"); netdev_err(priv->dev, "You need valid Link to execute tests\n");
etest->flags |= ETH_TEST_FL_FAILED; etest->flags |= ETH_TEST_FL_FAILED;
return; return;
} }
/* We don't want extra traffic */
netif_carrier_off(dev);
/* Wait for queues drain */ /* Wait for queues drain */
msleep(200); msleep(200);
...@@ -1942,10 +1933,6 @@ void stmmac_selftest_run(struct net_device *dev, ...@@ -1942,10 +1933,6 @@ void stmmac_selftest_run(struct net_device *dev,
break; break;
} }
} }
/* Restart everything */
if (carrier)
netif_carrier_on(dev);
} }
void stmmac_selftest_get_strings(struct stmmac_priv *priv, u8 *data) void stmmac_selftest_get_strings(struct stmmac_priv *priv, u8 *data)
......
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