Commit fc25fa97 authored by Luo bin's avatar Luo bin Committed by David S. Miller

hinic: fix sending pkts from core while self testing

Call netif_tx_disable firstly before starting doing self-test to
avoid sending packet from networking core and self-test packet
simultaneously which may cause self-test failure or hw abnormal.

Fixes: 4aa218a4 ("hinic: add self test support")
Signed-off-by: default avatarLuo bin <luobin9@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2b33b202
...@@ -1654,6 +1654,7 @@ static void hinic_diag_test(struct net_device *netdev, ...@@ -1654,6 +1654,7 @@ static void hinic_diag_test(struct net_device *netdev,
} }
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_disable(netdev);
err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME, err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME,
&test_index); &test_index);
...@@ -1662,9 +1663,12 @@ static void hinic_diag_test(struct net_device *netdev, ...@@ -1662,9 +1663,12 @@ static void hinic_diag_test(struct net_device *netdev,
data[test_index] = 1; data[test_index] = 1;
} }
netif_tx_wake_all_queues(netdev);
err = hinic_port_link_state(nic_dev, &link_state); err = hinic_port_link_state(nic_dev, &link_state);
if (!err && link_state == HINIC_LINK_STATE_UP) if (!err && link_state == HINIC_LINK_STATE_UP)
netif_carrier_on(netdev); netif_carrier_on(netdev);
} }
static int hinic_set_phys_id(struct net_device *netdev, static int hinic_set_phys_id(struct net_device *netdev,
......
...@@ -717,8 +717,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget) ...@@ -717,8 +717,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget)
netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id); netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id);
__netif_tx_lock(netdev_txq, smp_processor_id()); __netif_tx_lock(netdev_txq, smp_processor_id());
if (!netif_testing(nic_dev->netdev))
netif_wake_subqueue(nic_dev->netdev, qp->q_id); netif_wake_subqueue(nic_dev->netdev, qp->q_id);
__netif_tx_unlock(netdev_txq); __netif_tx_unlock(netdev_txq);
......
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