Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp1055905pxw; Sat, 9 Apr 2022 09:44:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoHr344TibtyBZZk1MNWaUAcrbMAUVPivrIUlOG1v4V9lByvB3e3b3LWG6gg+TgCaDdVBZ X-Received: by 2002:a05:6402:270f:b0:419:5b71:3493 with SMTP id y15-20020a056402270f00b004195b713493mr25125797edd.72.1649522654869; Sat, 09 Apr 2022 09:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649522654; cv=none; d=google.com; s=arc-20160816; b=IDWoGJpiiM++7i+ufpWCk74JMtapozkGucm4wrzqV204iPYyKlu1i7ao0KYkbgEO8b RaQBOvCVlstPzTOI8amJU5BGq7nsJ3WDRxpdSnwUyakfHaBBrZb/gRncffvmAWgAxJ89 6v9r7NoGotvZ99k6+J9x9X/vDP+OjuazumL3KgBpyjLUdEgpo7Ws6oDni+dMHNY6o82R Z2PZCKuaHR1Czzoc+lyIEqNdjGBzC3n0QCYVToVUI87pBtiVGRIN7HonR+1pCUSavqF1 M2Xgjs8k6PUEYvGaALNgBm4tJxl7/e5Fw/2KYY5FKNOT5bLsf1F6dJc4On9ZRlQrY/pe ziTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v16RxxaOxOZqHPVqyXeuMbn/xFT7DRq6k8ReY5NAjLc=; b=ynpjUseiEF371Y5S/BC3y1KN6ZFxjBFFhr02i/09I/qmPMszp4Ql9FO5oFcvPoFwW5 J7WSROZiPC6fB3PGzzm6F4dX7Jo1VWDKxYYp60xdWsS2CA79UcA2piVwc61t4lDKI5eP +gJVlgdnQFuQg50ragPf1dD9aZjFsVTcr144lOpOa4xjt1qYuZg5mB19QyhJwg9wiv9Z XNLAiQ67wJboNhQPdC8J7M3oF/nHkW9vhkvtt2cy52xWWGsoajHkP8dip7zPOdphethx nwhTJBA87dm3cok2JI4d4ek/4i/3fwpL181oKv0+il692UlOqSX8rR/81bubGO6Ocpq0 TqyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Dxi5elEV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r25-20020a170906c29900b006e85a385741si2575915ejz.376.2022.04.09.09.43.50; Sat, 09 Apr 2022 09:44:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Dxi5elEV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236119AbiDHNHH (ORCPT + 99 others); Fri, 8 Apr 2022 09:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236079AbiDHNGl (ORCPT ); Fri, 8 Apr 2022 09:06:41 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC09344FEA; Fri, 8 Apr 2022 06:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=v16RxxaOxOZqHPVqyXeuMbn/xFT7DRq6k8ReY5NAjLc=; b=Dxi5elEVble7hCqrLhqht5VQBD ZzR3h8pg+jA79dfvgiHHELgWUpgeImkQA1QfjNq1mr7Py5wKydXwWgutJh7hQQOFWTndwISM6+znv /Dp28dN/sszBvuZdBe2AasoDOGIwPxC8Kw1JFsoTOjNeCzBigZtrcTkQaNk0U66AohWI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ncoHo-00EpXL-8D; Fri, 08 Apr 2022 15:04:24 +0200 Date: Fri, 8 Apr 2022 15:04:24 +0200 From: Andrew Lunn To: Oleksij Rempel Cc: "huangguangbin (A)" , davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lipeng321@huawei.com, chenhao288@hisilicon.com Subject: Re: [PATCH] net: phy: genphy_loopback: fix loopback failed when speed is unknown Message-ID: References: <20220331114819.14929-1-huangguangbin2@huawei.com> <130bb780-0dc1-3819-8f6d-f2daf4d9ece9@huawei.com> <20220401064006.GB4449@pengutronix.de> <20220408081824.GF25348@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220408081824.GF25348@pengutronix.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 08, 2022 at 10:18:24AM +0200, Oleksij Rempel wrote: > On Thu, Apr 07, 2022 at 04:45:03PM +0200, Andrew Lunn wrote: > > > Hi Andrew, > > > The PHY we test is RTL8211F, it supports 10 half. This problem actually is, > > > our board has MAC connected with PHY, when loopback test, packet flow is > > > MAC->PHY->MAC, it needs speed of MAC and PHY should be same when they work. > > > > > > If PHY speed is unknown when PHY goes down, we will not set MAC speed in > > > adjust_link interface. In this case, we hope that PHY speed should not be > > > changed, as the old code of function genphy_loopback() before patch > > > "net: phy: genphy_loopback: add link speed configuration". > > > > > > If PHY has never link, MAC speed has never be set in adjust_link interface, > > > yeah, in this case, MAC and PHY may has different speed, and they can not work. > > > I think we can accept this situation. > > > > > > I think it is general problem if there is MAC connected with PHY. > > > > Thanks for investigating. Looks like we are getting close the real > > solution. And it is a generic problem, that the MAC and PHY might not > > be using the same configuration. > > > > So it looks like if the link is down, or speed is UNKNOWN, we need to > > set phydev->link true, speed 10, duplex half... > > Hm, i was thinking, is it impossible to run loopback test on half duplex link. > Do I missing something? Ah, you might be right. I was just thinking of the lowest common denominator. So 10 Full. Or maybe even look at phydev->supported and pick one from there. Andrew