Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp19015pxb; Fri, 15 Jan 2021 04:50:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqv5SogU/aBOgUZlzGLBLNI7RR7r2aWc53zR9R4ydSbtKTZCyFnLOfdP3KS1uxqow1Uc71 X-Received: by 2002:a50:8004:: with SMTP id 4mr9297137eda.329.1610715051506; Fri, 15 Jan 2021 04:50:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715051; cv=none; d=google.com; s=arc-20160816; b=nFly8kdD08yg8i1cVl2DTR+yLEuIoJHRm5nP0tr+xRBrOSvOMEyu+ubF2dMQEI3WQ1 pPdWo40HP3GwtHVKP0+PrrjDl5Sd/VsHttWbJgrcJI+qlGPXZr8omARJLQt7Kyr404x9 z+oCfQ46hbD2wXUNdglSu2cFZJeNu9GO7hjzI3BMfyzUq4XCZipATNRpIY8uLdw3UvKY cxgXOvdl5BJ4+aM59IAAwO+SDh9LOOEcpcdr55Vo04SGzuUQxTfmMLer7bqdsQ9/4UeZ G9pygAqecR9aU46xxKUZgZcpD/cGGnUDg5RpqXSiwY/tltYWVrUd1++73u/BdsOxfuYj EeOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R8ptudx8e5JBlu1OYYxPwmSQNCvGlj1lVl3M36AAXzk=; b=oe5ojgwq1xh8azFCEeEpMql9i4+jKkowVMaz0XnhA/Ig4cf1I7GjDIRBlYM0HYRFVB HBTC7nirk9uwj72N45agBT9d+x1jMA4MpZ7tCQHkkNuE4+64Bipzj33jr1TSpNZJXFu3 bqjrCqhsMpDzkE9IwjDtURGmDarHUaMRpBIvk7bZFsEo4EDFAcuWcqjyyIbMVEp4m4ND f4GeJQkDH1N5QGI+rllqdtS8pLi1F+wv2IjhLexw0jSBqUeqccoicayG1KGCC5MZBGyc qJqSzJPWCQUyRuujKKQxFBTZfOkfNQk7Ga6pBAzlls0Md9pj/z7sKEsV9oRuDx6oFmbf tWCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HUyDqYvu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i10si4105095ejd.572.2021.01.15.04.50.27; Fri, 15 Jan 2021 04:50:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HUyDqYvu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387884AbhAOMt2 (ORCPT + 99 others); Fri, 15 Jan 2021 07:49:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:43284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387878AbhAOMg0 (ORCPT ); Fri, 15 Jan 2021 07:36:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 20AEF207C4; Fri, 15 Jan 2021 12:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714171; bh=D8uEX+akZC/h2Dp8b3/QNIIkzZ8kmzk7uj0WVa2qJWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HUyDqYvuBQQsb3mVpyUkhazS7hGCzlDulKfn4zwUgmrYdB7U+WvJfK/LIee8VImKy fN5hf17maM2yCQ3h7U6VC35M9PT3LKC+F5CUjmzR7+dIKYVDwtkz/l/OfeK3iDN2B6 0u/s4c9zC+ae3qjp076q4uSBaJoC9H87W4tW6CdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yonglong Liu , Huazhong Tan , "David S. Miller" Subject: [PATCH 5.10 016/103] net: hns3: fix a phy loopback fail issue Date: Fri, 15 Jan 2021 13:27:09 +0100 Message-Id: <20210115122006.831328939@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115122006.047132306@linuxfoundation.org> References: <20210115122006.047132306@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yonglong Liu [ Upstream commit f04bbcbf1e38d192e94bbfa126731a52332c40b1 ] When phy driver does not implement the set_loopback interface, phy loopback test will return -EOPNOTSUPP, and the loopback test will fail. So when phy driver does not implement the set_loopback interface, don't do phy loopback test. Fixes: c9765a89d142 ("net: hns3: add phy selftest function") Signed-off-by: Yonglong Liu Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -752,7 +752,8 @@ static int hclge_get_sset_count(struct h handle->flags |= HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK; handle->flags |= HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK; - if (hdev->hw.mac.phydev) { + if (hdev->hw.mac.phydev && hdev->hw.mac.phydev->drv && + hdev->hw.mac.phydev->drv->set_loopback) { count += 1; handle->flags |= HNAE3_SUPPORT_PHY_LOOPBACK; }