Skip to content

Commit fc25fa9

Browse files
Luo bindavem330
authored andcommitted
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: 4aa218a ("hinic: add self test support") Signed-off-by: Luo bin <luobin9@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2b33b20 commit fc25fa9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/net/ethernet/huawei/hinic/hinic_ethtool.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,7 @@ static void hinic_diag_test(struct net_device *netdev,
16541654
}
16551655

16561656
netif_carrier_off(netdev);
1657+
netif_tx_disable(netdev);
16571658

16581659
err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME,
16591660
&test_index);
@@ -1662,9 +1663,12 @@ static void hinic_diag_test(struct net_device *netdev,
16621663
data[test_index] = 1;
16631664
}
16641665

1666+
netif_tx_wake_all_queues(netdev);
1667+
16651668
err = hinic_port_link_state(nic_dev, &link_state);
16661669
if (!err && link_state == HINIC_LINK_STATE_UP)
16671670
netif_carrier_on(netdev);
1671+
16681672
}
16691673

16701674
static int hinic_set_phys_id(struct net_device *netdev,

drivers/net/ethernet/huawei/hinic/hinic_tx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget)
717717
netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id);
718718

719719
__netif_tx_lock(netdev_txq, smp_processor_id());
720-
721-
netif_wake_subqueue(nic_dev->netdev, qp->q_id);
720+
if (!netif_testing(nic_dev->netdev))
721+
netif_wake_subqueue(nic_dev->netdev, qp->q_id);
722722

723723
__netif_tx_unlock(netdev_txq);
724724

0 commit comments

Comments
 (0)