From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3E16C606BD for ; Mon, 8 Jul 2019 15:18:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA90221537 for ; Mon, 8 Jul 2019 15:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599135; bh=n8SLqZ+SjKSD4ewi8qVbuW4I1Ca4aNJMMEj8to09ArY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tEBBXXT9uFZ56wQw0YbKuQbsMVILd+m2zw6BbRWK/RIQvM8LbcxwRhIFPpBpVLEs5 vzcp7uNO73zqgsPPmbyCYFgAdlOu6916sdZDLEN5qB98KB/AnPf4mAJbpktZD8X9HT zbLAR41+BR2Mq9dobtChVqI3aOR/kVS0t5eyI7PY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733140AbfGHPSy (ORCPT ); Mon, 8 Jul 2019 11:18:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:42832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733128AbfGHPSw (ORCPT ); Mon, 8 Jul 2019 11:18:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B4E04216F4; Mon, 8 Jul 2019 15:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599131; bh=n8SLqZ+SjKSD4ewi8qVbuW4I1Ca4aNJMMEj8to09ArY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7e5CwXkV7Q8FJAJMXK1DeGYGnOhPnB3hY/2NAvtQHGczWwtZ9/Xh+rCaQOUjmGlb xI5fvDhZvrDuKLy/ZGMwBWsBElbdLAAzoiErkBCUMeqxXX4CKrprTxxM7WSjismGKk rqiFZkjQvDBmotiLCEQBKOWIGCnsN7V18YJAW5Rw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yonglong Liu , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 016/102] net: hns: Fix loopback test failed at copper ports Date: Mon, 8 Jul 2019 17:12:09 +0200 Message-Id: <20190708150526.994227008@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150525.973820964@linuxfoundation.org> References: <20190708150525.973820964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 2e1f164861e500f4e068a9d909bbd3fcc7841483 ] When doing a loopback test at copper ports, the serdes loopback and the phy loopback will fail, because of the adjust link had not finished, and phy not ready. Adds sleep between adjust link and test process to fix it. Signed-off-by: Yonglong Liu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index 4cd163390dcc..f38848c4f69d 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c @@ -367,6 +367,7 @@ static int __lb_setup(struct net_device *ndev, static int __lb_up(struct net_device *ndev, enum hnae_loop loop_mode) { +#define NIC_LB_TEST_WAIT_PHY_LINK_TIME 300 struct hns_nic_priv *priv = netdev_priv(ndev); struct hnae_handle *h = priv->ae_handle; int speed, duplex; @@ -393,6 +394,9 @@ static int __lb_up(struct net_device *ndev, h->dev->ops->adjust_link(h, speed, duplex); + /* wait adjust link done and phy ready */ + msleep(NIC_LB_TEST_WAIT_PHY_LINK_TIME); + return 0; } -- 2.20.1