* [PATCH net] be2net: Poll for link status till 5s in ethtool diag test
@ 2014-05-05 23:20 Ajit Khaparde
2014-05-07 20:14 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ajit Khaparde @ 2014-05-05 23:20 UTC (permalink / raw)
To: netdev
After the loopback test is finished,
it takes a few seconds for link to come back up.
Poll for link status every 1 second interval for 5 seconds, only in cases
when the link was UP before PHY loopback test was issued.
Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_ethtool.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index 15ba96c..b4be712 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -788,9 +788,11 @@ static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
static void
be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
{
+#define LINK_READY_TIMEOUT 5
struct be_adapter *adapter = netdev_priv(netdev);
int status;
u8 link_status = 0;
+ int timeout = netif_carrier_ok(netdev) ? 0 : LINK_READY_TIMEOUT;
if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) {
dev_err(&adapter->pdev->dev, "Self test not supported\n");
@@ -822,7 +824,18 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
test->flags |= ETH_TEST_FL_FAILED;
}
- status = be_cmd_link_status_query(adapter, NULL, &link_status, 0);
+ /* After the loopback test is finished,
+ * it takes a few seconds for the link to comeback up.
+ * Poll for 5s before reporting a failure to the link test.
+ */
+ do {
+ status = be_cmd_link_status_query(adapter, NULL,
+ &link_status, 0);
+ if (link_status || status || ++timeout >= LINK_READY_TIMEOUT)
+ break;
+ ssleep(1);
+ } while (true);
+
if (status) {
test->flags |= ETH_TEST_FL_FAILED;
data[4] = -1;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] be2net: Poll for link status till 5s in ethtool diag test
2014-05-05 23:20 [PATCH net] be2net: Poll for link status till 5s in ethtool diag test Ajit Khaparde
@ 2014-05-07 20:14 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-05-07 20:14 UTC (permalink / raw)
To: ajit.khaparde; +Cc: netdev
From: Ajit Khaparde <ajit.khaparde@emulex.com>
Date: Mon, 5 May 2014 18:20:14 -0500
> After the loopback test is finished,
> it takes a few seconds for link to come back up.
> Poll for link status every 1 second interval for 5 seconds, only in cases
> when the link was UP before PHY loopback test was issued.
>
> Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
This is really anti-social, because the RTNL semaphore is held during
this entire call.
You are potentially blocking any and all network configuration setting
and fetches for up to 5 seconds.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-07 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05 23:20 [PATCH net] be2net: Poll for link status till 5s in ethtool diag test Ajit Khaparde
2014-05-07 20:14 ` 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).