From: Florian Fainelli <f.fainelli@gmail.com>
To: Joakim Zhang <qiangqing.zhang@nxp.com>,
Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Fugang Duan <fugang.duan@nxp.com>,
"kernel@pengutronix.de" <kernel@pengutronix.de>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>,
Fabio Estevam <festevam@gmail.com>,
David Jander <david@protonic.nl>,
Russell King <linux@armlinux.org.uk>,
Philippe Schenker <philippe.schenker@toradex.com>
Subject: Re: [PATCH net-next v3 0/6] provide generic net selftest support
Date: Tue, 27 Apr 2021 09:40:50 -0700 [thread overview]
Message-ID: <6416c580-0df9-7d36-c42d-65293c40aa25@gmail.com> (raw)
In-Reply-To: <DB8PR04MB6795479FBF086751D16080E2E6419@DB8PR04MB6795.eurprd04.prod.outlook.com>
On 4/26/2021 9:48 PM, Joakim Zhang wrote:
>
>> -----Original Message-----
>> From: Oleksij Rempel <o.rempel@pengutronix.de>
>> Sent: 2021年4月23日 12:37
>> To: Joakim Zhang <qiangqing.zhang@nxp.com>
>> Cc: Shawn Guo <shawnguo@kernel.org>; Sascha Hauer
>> <s.hauer@pengutronix.de>; Andrew Lunn <andrew@lunn.ch>; Florian Fainelli
>> <f.fainelli@gmail.com>; Heiner Kallweit <hkallweit1@gmail.com>; Fugang
>> Duan <fugang.duan@nxp.com>; kernel@pengutronix.de;
>> netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
>> linux-kernel@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>; Fabio
>> Estevam <festevam@gmail.com>; David Jander <david@protonic.nl>; Russell
>> King <linux@armlinux.org.uk>; Philippe Schenker
>> <philippe.schenker@toradex.com>
>> Subject: Re: [PATCH net-next v3 0/6] provide generic net selftest support
>>
>> 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".
> So we need a callback for MAC drivers, where we extend this callback? Could be "struct net_device_ops"? Such as ndo_set_loopback?
Even for PHY devices, if we implemented external PHY loopback in the
future, the programming would be different from one vendor to another. I
am starting to wonder if the existing ethtool self-tests are the best
API to expose the ability for an user to perform PHY and MAC loopback
testing.
From an Ethernet MAC and PHY driver perspective, what I would imagine we
could have for a driver API is:
enum ethtool_loopback_mode {
ETHTOOL_LOOPBACK_OFF,
ETHTOOL_LOOPBACK_PHY_INTERNAL,
ETHTOOL_LOOPBACK_PHY_EXTERNAL,
ETHTOOL_LOOPBACK_MAC_INTERNAL,
ETHTOOL_LOOPBACK_MAC_EXTERNAL,
ETHTOOL_LOOPBACK_FIXTURE,
__ETHTOOL_LOOPBACK_MAX
};
int (*ndo_set_loopback_mode)(struct net_device *dev, enum
ethtool_loopback_mode mode);
and within the Ethernet MAC driver you would do something like this:
switch (mode) {
case ETHTOOL_LOOPBACK_PHY_INTERNAL:
case ETHTOOL_LOOPBACK_PHY_EXTERNAL:
case ETHTOOL_LOOPBACK_OFF:
ret = phy_loopback(ndev->phydev, mode);
break;
/* Other case statements implemented in driver */
we would need to change the signature of phy_loopback() to accept being
passed ethtool_loopback_mode so we can support different modes.
Whether we want to continue using the self-tests API, or if we implement
a new ethtool command in order to request a loopback operation is up for
discussion.
--
Florian
next prev parent reply other threads:[~2021-04-27 16:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 13:01 [PATCH net-next v3 0/6] provide generic net selftest support Oleksij Rempel
2021-04-19 13:01 ` [PATCH net-next v3 1/6] net: phy: execute genphy_loopback() per default on all PHYs Oleksij Rempel
2021-04-19 13:01 ` [PATCH net-next v3 2/6] net: phy: genphy_loopback: add link speed configuration Oleksij Rempel
2021-04-19 13:01 ` [PATCH net-next v3 3/6] net: add generic selftest support Oleksij Rempel
2021-04-30 6:45 ` Geert Uytterhoeven
2021-04-30 7:26 ` Oleksij Rempel
2021-04-30 7:49 ` Geert Uytterhoeven
2021-04-30 12:31 ` Andrew Lunn
2021-04-19 13:01 ` [PATCH net-next v3 4/6] net: fec: make use of generic NET_SELFTESTS library Oleksij Rempel
2021-04-19 13:01 ` [PATCH net-next v3 5/6] net: ag71xx: " Oleksij Rempel
2021-04-19 13:01 ` [PATCH net-next v3 6/6] net: dsa: enable selftest support for all switches by default Oleksij Rempel
2021-04-23 3:18 ` [PATCH net-next v3 0/6] provide generic net selftest support Joakim Zhang
2021-04-23 4:37 ` Oleksij Rempel
2021-04-27 4:48 ` Joakim Zhang
2021-04-27 7:15 ` Oleksij Rempel
2021-04-27 16:40 ` Florian Fainelli [this message]
2021-04-28 8:06 ` Joakim Zhang
2021-04-28 8:51 ` Oleksij Rempel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6416c580-0df9-7d36-c42d-65293c40aa25@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=david@protonic.nl \
--cc=festevam@gmail.com \
--cc=fugang.duan@nxp.com \
--cc=hkallweit1@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=philippe.schenker@toradex.com \
--cc=qiangqing.zhang@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).