Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4264383pxy; Tue, 27 Apr 2021 00:17:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycLj0FmJh3wuy7d1BY0m2QA2lQDkKl7UC3UUYZGJfl8Y8Gogmkl9m6woRjrTJyG9eKeyWe X-Received: by 2002:a63:4f21:: with SMTP id d33mr20393766pgb.434.1619507845418; Tue, 27 Apr 2021 00:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619507845; cv=none; d=google.com; s=arc-20160816; b=V33o87mPok1N3Ag3Ymjf8tlI/wPflyvwHT3jDJN2Wr6x6SY/PH/sUqzp3nfgNEjDQt gzJNdpGo5az3nVk2wKUg0c4R1LD7eVL14vlS41AXaPBZpxl9naDJDhtQw5xmvQWmzaQF ItsgfNxDjJdjft19YTZ/eFtz9Wi20/VMN+wptCxayDdymQU/2RZhALI6hHv1QoldHREw 6++LFrA4+iMx17Vfe44EQRJ27q2NTdliPYPrBROE/VvPTGsltzdnjSbGS3WY2FsE2j7Y 9JVttchiCdoxp5EfTN6KTAem7Wx80NxPOZec+9RY8u9XOX0QSV5ofSufbCJY4h46VvWD YP4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=daHIupA47ni0pThr2dFMgKBk9fwRTn2TQ1fhzdl49mw=; b=iHyuLV0yx8ZkRXCBbfVgXMHkRn875PAxlQhN7x412QRsi29MhCKvg/1rCYbka2BrEH FBHthkWlLRlIJk7deNPra3xcP1Eu4kpSRHOg1I5e2fMfXG6/ant/Ro+qCxnJTIZcDGR9 Y/zqM3UJrYkKkKI73ZLe8HDbhE6RfrmjMX5n8vzxjuCgpJSNcoXnWoUCDDbxxum7hV3D jMOjTpqY0pQzXvoe/quZNAfVUucbu0Gk357slIr4eProHkG/ymTuRDH9RkU8D+Ckfur5 577M9n9fYow8pmQ2u+oI52Q1pcpJI8HLcin0KESdQ2aQaIpzzSu9uflul8wrCjKUOgMy mDoQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z27si19708583pga.62.2021.04.27.00.17.13; Tue, 27 Apr 2021 00:17:25 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234734AbhD0HQE (ORCPT + 99 others); Tue, 27 Apr 2021 03:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbhD0HQC (ORCPT ); Tue, 27 Apr 2021 03:16:02 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 374F3C061574 for ; Tue, 27 Apr 2021 00:15:20 -0700 (PDT) Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lbHwA-0002PF-Gi; Tue, 27 Apr 2021 09:15:14 +0200 Received: from ore by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1lbHw8-0007nc-NG; Tue, 27 Apr 2021 09:15:12 +0200 Date: Tue, 27 Apr 2021 09:15:12 +0200 From: Oleksij Rempel To: Joakim Zhang Cc: Shawn Guo , Sascha Hauer , Andrew Lunn , Florian Fainelli , Heiner Kallweit , Fugang Duan , "kernel@pengutronix.de" , "netdev@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx , Fabio Estevam , David Jander , Russell King , Philippe Schenker Subject: Re: [PATCH net-next v3 0/6] provide generic net selftest support Message-ID: <20210427071512.vprrsajwwhmmb3ch@pengutronix.de> References: <20210419130106.6707-1-o.rempel@pengutronix.de> <20210423043729.tup7nntmmyv6vurm@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 09:10:33 up 145 days, 21:16, 42 users, load average: 0.30, 0.09, 0.02 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joakim, On Tue, Apr 27, 2021 at 04:48:42AM +0000, Joakim Zhang wrote: > > Hi Joakim, > > > > On Fri, Apr 23, 2021 at 03:18:32AM +0000, Joakim Zhang wrote: > > > > > > Hi Oleksij, > > > > > > I look both stmmac selftest code and this patch set. For stmmac, if PHY > > doesn't support loopback, it will fallthrough to MAC loopback. > > > You provide this generic net selftest support based on PHY loopback, I have a > > question, is it possible to extend it also support MAC loopback later? > > > > Yes. If you have interest and time to implement it, please do. > > It should be some kind of generic callback as phy_loopback() and if PHY and > > MAC loopbacks are supported we need to tests both variants. > Hi Oleksij, > > Yes, I can try to implement it when I am free, but I still have some questions: > 1. Where we place the generic function? Such as mac_loopback(). > 2. MAC is different from PHY, need program different registers to enable loopback on different SoCs, that means we need get MAC private data from "struct net_device". ACK > So we need a callback for MAC drivers, where we extend this callback? Could be "struct net_device_ops"? Such as ndo_set_loopback? yes. Sounds good for me. ndo_set_loopback could be implemented for ethernet controllers, DSA and even CAN. Regards, Oleksij > > > > -----Original Message----- > > > > From: Oleksij Rempel > > > > Sent: 2021年4月19日 21:01 > > > > To: Shawn Guo ; Sascha Hauer > > > > ; Andrew Lunn ; Florian > > > > Fainelli ; Heiner Kallweit > > > > ; Fugang Duan > > > > Cc: Oleksij Rempel ; kernel@pengutronix.de; > > > > netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org; > > > > linux-kernel@vger.kernel.org; dl-linux-imx ; > > > > Fabio Estevam ; David Jander > > > > ; Russell King ; Philippe > > > > Schenker > > > > Subject: [PATCH net-next v3 0/6] provide generic net selftest > > > > support > > > > > > > > changes v3: > > > > - make more granular tests > > > > - enable loopback for all PHYs by default > > > > - fix allmodconfig build errors > > > > - poll for link status update after switching to the loopback mode > > > > > > > > changes v2: > > > > - make generic selftests available for all networking devices. > > > > - make use of net_selftest* on FEC, ag71xx and all DSA switches. > > > > - add loopback support on more PHYs. > > > > > > > > This patch set provides diagnostic capabilities for some iMX, ag71xx > > > > or any DSA based devices. For proper functionality, PHY loopback support is > > needed. > > > > So far there is only initial infrastructure with basic tests. > > > > > > > > Oleksij Rempel (6): > > > > net: phy: execute genphy_loopback() per default on all PHYs > > > > net: phy: genphy_loopback: add link speed configuration > > > > net: add generic selftest support > > > > net: fec: make use of generic NET_SELFTESTS library > > > > net: ag71xx: make use of generic NET_SELFTESTS library > > > > net: dsa: enable selftest support for all switches by default > > > > > > > > drivers/net/ethernet/atheros/Kconfig | 1 + > > > > drivers/net/ethernet/atheros/ag71xx.c | 20 +- > > > > drivers/net/ethernet/freescale/Kconfig | 1 + > > > > drivers/net/ethernet/freescale/fec_main.c | 7 + > > > > drivers/net/phy/phy.c | 3 +- > > > > drivers/net/phy/phy_device.c | 35 +- > > > > include/linux/phy.h | 1 + > > > > include/net/dsa.h | 2 + > > > > include/net/selftests.h | 12 + > > > > net/Kconfig | 4 + > > > > net/core/Makefile | 1 + > > > > net/core/selftests.c | 400 > > > > ++++++++++++++++++++++ > > > > net/dsa/Kconfig | 1 + > > > > net/dsa/slave.c | 21 ++ > > > > 14 files changed, 500 insertions(+), 9 deletions(-) create mode > > > > 100644 include/net/selftests.h create mode 100644 > > > > net/core/selftests.c > > > > > > > > -- > > > > 2.29.2 > > > > > > _______________________________________________ > > > linux-arm-kernel mailing list > > > linux-arm-kernel@lists.infradead.org > > > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists > > > .infradead.org%2Fmailman%2Flistinfo%2Flinux-arm-kernel&data=04%7 > > C0 > > > > > 1%7Cqiangqing.zhang%40nxp.com%7C8796bf53e46b4b1be92b08d9061186f9 > > %7C686 > > > > > ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637547494614753358%7CU > > nknown%7 > > > > > CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiL > > CJXV > > > > > CI6Mn0%3D%7C1000&sdata=x%2BUFB%2B1Xp0zbR1mG5HDGvqBUvKhX > > VJn337T%2BB > > > D7cO6g%3D&reserved=0 > > > > -- > > Pengutronix e.K. | > > | > > Steuerwalder Str. 21 | > > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pe > > ngutronix.de%2F&data=04%7C01%7Cqiangqing.zhang%40nxp.com%7C87 > > 96bf53e46b4b1be92b08d9061186f9%7C686ea1d3bc2b4c6fa92cd99c5c301635 > > %7C0%7C0%7C637547494614753358%7CUnknown%7CTWFpbGZsb3d8eyJWIj > > oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C10 > > 00&sdata=K2dsGVxEXv%2FtC7p0l4TFlLlaqzzTa6ktrbSdcCJ10J0%3D& > > reserved=0 | > > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 > > | > > Amtsgericht Hildesheim, HRA 2686 | Fax: > > +49-5121-206917-5555 | -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |