Netdev List
 help / color / mirror / Atom feed
From: Ante Knezic <ante.knezic@helmholz.de>
To: <netdev@vger.kernel.org>
Cc: <andrew@lunn.ch>, <f.fainelli@gmail.com>, <olteanv@gmail.com>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <linux-kernel@vger.kernel.org>,
	Ante Knezic <ante.knezic@helmholz.de>
Subject: [PATCH net-next] net: dsa: dont use generic selftest strings for custom selftests
Date: Thu, 14 Dec 2023 15:21:36 +0100	[thread overview]
Message-ID: <20231214142136.17564-1-ante.knezic@helmholz.de> (raw)

if dsa device supports custom selftests than we should use custom
selftest strings for ethtool.

Signed-off-by: Ante Knezic <ante.knezic@helmholz.de>
---
 net/dsa/user.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/dsa/user.c b/net/dsa/user.c
index d438884a4eb0..d0e0d1a2bff7 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -1072,7 +1072,11 @@ static void dsa_user_get_strings(struct net_device *dev,
 			ds->ops->get_strings(ds, dp->index, stringset,
 					     data + 4 * len);
 	} else if (stringset ==  ETH_SS_TEST) {
-		net_selftest_get_strings(data);
+		if (ds->ops->self_test && ds->ops->get_strings)
+			ds->ops->get_strings(ds, dp->index, stringset,
+					     data);
+		else
+			net_selftest_get_strings(data);
 	}
 
 }
@@ -1123,7 +1127,10 @@ static int dsa_user_get_sset_count(struct net_device *dev, int sset)
 
 		return count + 4;
 	} else if (sset ==  ETH_SS_TEST) {
-		return net_selftest_get_count();
+		if (ds->ops->self_test && ds->ops->get_sset_count)
+			return ds->ops->get_sset_count(ds, dp->index, sset);
+		else
+			return net_selftest_get_count();
 	}
 
 	return -EOPNOTSUPP;
-- 
2.11.0


             reply	other threads:[~2023-12-14 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 14:21 Ante Knezic [this message]
2023-12-14 14:25 ` [PATCH net-next] net: dsa: dont use generic selftest strings for custom selftests Vladimir Oltean
2023-12-14 14:47   ` Ante Knezic
2023-12-14 14:56     ` Vladimir Oltean

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=20231214142136.17564-1-ante.knezic@helmholz.de \
    --to=ante.knezic@helmholz.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    /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