netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] forcedeth: run loopback test only on chipsets that support it
@ 2013-12-04 17:06 Ivan Vecera
  2013-12-06  2:01 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Vecera @ 2013-12-04 17:06 UTC (permalink / raw)
  To: netdev; +Cc: davem

The driver incorrectly run loopback test on chips that don't support it.
Loopback test is only supported by chips that has DEV_HAS_TEST_EXTENDED
flag and returns 4 (NV_TEST_COUNT_EXTENDED) as test count.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/net/ethernet/nvidia/forcedeth.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 2d045be..1e8b951 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -5150,8 +5150,10 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64
 {
 	struct fe_priv *np = netdev_priv(dev);
 	u8 __iomem *base = get_hwbase(dev);
-	int result;
-	memset(buffer, 0, nv_get_sset_count(dev, ETH_SS_TEST)*sizeof(u64));
+	int result, count;
+
+	count = nv_get_sset_count(dev, ETH_SS_TEST);
+	memset(buffer, 0, count * sizeof(u64));
 
 	if (!nv_link_test(dev)) {
 		test->flags |= ETH_TEST_FL_FAILED;
@@ -5195,7 +5197,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64
 			return;
 		}
 
-		if (!nv_loopback_test(dev)) {
+		if (count > NV_TEST_COUNT_BASE && !nv_loopback_test(dev)) {
 			test->flags |= ETH_TEST_FL_FAILED;
 			buffer[3] = 1;
 		}
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] forcedeth: run loopback test only on chipsets that support it
  2013-12-04 17:06 [PATCH net] forcedeth: run loopback test only on chipsets that support it Ivan Vecera
@ 2013-12-06  2:01 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-12-06  2:01 UTC (permalink / raw)
  To: ivecera; +Cc: netdev

From: Ivan Vecera <ivecera@redhat.com>
Date: Wed,  4 Dec 2013 18:06:51 +0100

> The driver incorrectly run loopback test on chips that don't support it.
> Loopback test is only supported by chips that has DEV_HAS_TEST_EXTENDED
> flag and returns 4 (NV_TEST_COUNT_EXTENDED) as test count.
> 
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-06  2:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-04 17:06 [PATCH net] forcedeth: run loopback test only on chipsets that support it Ivan Vecera
2013-12-06  2:01 ` David Miller

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).