Netdev List
 help / color / mirror / Atom feed
* [PATCH NEXT 0/2]net:external loopback support in ethtool
@ 2011-06-28  6:40 amit.salecha
  2011-06-28  6:40 ` [PATCH NEXT 1/2] net: add external loopback test in ethtool self test amit.salecha
  2011-06-28  6:40 ` [PATCH NEXT 2/2] qlcnic: add external loopback support amit.salecha
  0 siblings, 2 replies; 5+ messages in thread
From: amit.salecha @ 2011-06-28  6:40 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman


Hi,
	Adding external loopback support in ethtool self test. External loopback test
	requires special cable need to be connected, so it can not be part of default test.
	Adding separate flag to specify external loopback test.

-Amit

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

* [PATCH NEXT 1/2] net: add external loopback test in ethtool self test
  2011-06-28  6:40 [PATCH NEXT 0/2]net:external loopback support in ethtool amit.salecha
@ 2011-06-28  6:40 ` amit.salecha
  2011-06-29 18:28   ` Ben Hutchings
  2011-06-28  6:40 ` [PATCH NEXT 2/2] qlcnic: add external loopback support amit.salecha
  1 sibling, 1 reply; 5+ messages in thread
From: amit.salecha @ 2011-06-28  6:40 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, Amit Kumar Salecha

From: Amit Kumar Salecha <amit.salecha@qlogic.com>

External loopback test can be performed by application without any driver
support on normal Ethernet cards.
But on CNA devices, where multiple functions share same physical port.
Here internal loopback test and external loopback test can be initiated by
different function at same time. To co exist all functions, firmware need
to regulate what test can be run by which function. So before performing external
loopback test, command need to send to firmware, which will quiescent other functions.

User may not want to run external loopback test always. As special cable need to be
connected for this test.

So adding explicit flag in ethtool self test, which will specify interface
to perform external loopback test.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 include/linux/ethtool.h |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 048d0fa..c2ba287 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -310,9 +310,18 @@ struct ethtool_sset_info {
 				   __u32's, etc. */
 };
 
+/*
+ * Flags definition of ethtool_test
+ *
+ * ETH_TEST_FL_OFFLINE:  online / offline
+ * ETH_TEST_FL_FAILED: test passed / failed
+ * ETH_TEST_FL_EXTERNAL_LB: perform external loopback test
+ */
+
 enum ethtool_test_flags {
-	ETH_TEST_FL_OFFLINE	= (1 << 0),	/* online / offline */
-	ETH_TEST_FL_FAILED	= (1 << 1),	/* test passed / failed */
+	ETH_TEST_FL_OFFLINE	= (1 << 0),
+	ETH_TEST_FL_FAILED	= (1 << 1),
+	ETH_TEST_FL_EXTERNAL_LB	= (1 << 2),
 };
 
 /* for requesting NIC test and getting results*/
-- 
1.7.3.3


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

* [PATCH NEXT 2/2] qlcnic: add external loopback support
  2011-06-28  6:40 [PATCH NEXT 0/2]net:external loopback support in ethtool amit.salecha
  2011-06-28  6:40 ` [PATCH NEXT 1/2] net: add external loopback test in ethtool self test amit.salecha
@ 2011-06-28  6:40 ` amit.salecha
  1 sibling, 0 replies; 5+ messages in thread
From: amit.salecha @ 2011-06-28  6:40 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, Amit Kumar Salecha, Sucheta Chakraborty

From: Amit Kumar Salecha <amit.salecha@qlogic.com>

o Add external loopback test in self test:
  - Send set external loopback mode request to fw.
     To quiscent other storage functions.
  - Perform test
  - Send unset loopback mode request to fw.

o Rename ilb to lb.
o Update driver version 5.0.20.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h         |    5 +++--
 drivers/net/qlcnic/qlcnic_ethtool.c |   25 ++++++++++++++++---------
 drivers/net/qlcnic/qlcnic_init.c    |    3 ++-
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index e545450..9899a79 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -36,8 +36,8 @@
 
 #define _QLCNIC_LINUX_MAJOR 5
 #define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 19
-#define QLCNIC_LINUX_VERSIONID  "5.0.19"
+#define _QLCNIC_LINUX_SUBVERSION 20
+#define QLCNIC_LINUX_VERSIONID  "5.0.20"
 #define QLCNIC_DRV_IDC_VER  0x01
 #define QLCNIC_DRIVER_VERSION  ((_QLCNIC_LINUX_MAJOR << 16) |\
 		 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
@@ -782,6 +782,7 @@ struct qlcnic_mac_list_s {
 #define QLCNIC_IP_DOWN		3
 
 #define QLCNIC_ILB_MODE		0x1
+#define QLCNIC_ELB_MODE		0x2
 
 #define QLCNIC_LINKEVENT	0x1
 #define QLCNIC_LB_RESPONSE	0x2
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 743035e..821d8a7 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -85,7 +85,8 @@ static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = {
 	"Register_Test_on_offline",
 	"Link_Test_on_offline",
 	"Interrupt_Test_offline",
-	"Loopback_Test_offline"
+	"Internal_Loopback_offline",
+	"External_Loopback_offline"
 };
 
 #define QLCNIC_TEST_LEN	ARRAY_SIZE(qlcnic_gstrings_test)
@@ -709,7 +710,7 @@ int qlcnic_check_loopback_buff(unsigned char *data, u8 mac[])
 	return memcmp(data, buff, QLCNIC_ILB_PKT_SIZE);
 }
 
-static int qlcnic_do_ilb_test(struct qlcnic_adapter *adapter)
+static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter)
 {
 	struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
 	struct qlcnic_host_sds_ring *sds_ring = &recv_ctx->sds_rings[0];
@@ -735,19 +736,19 @@ static int qlcnic_do_ilb_test(struct qlcnic_adapter *adapter)
 		dev_kfree_skb_any(skb);
 
 		if (!adapter->diag_cnt)
-			dev_warn(&adapter->pdev->dev, "ILB Test: %dth packet"
+			dev_warn(&adapter->pdev->dev, "LB Test: %dth packet"
 				" not recevied\n", i + 1);
 		else
 			cnt++;
 	}
 	if (cnt != i) {
-		dev_warn(&adapter->pdev->dev, "ILB Test failed\n");
+		dev_warn(&adapter->pdev->dev, "LB Test failed\n");
 		return -1;
 	}
 	return 0;
 }
 
-static int qlcnic_iloopback_test(struct net_device *netdev)
+static int qlcnic_loopback_test(struct net_device *netdev, u8 mode)
 {
 	struct qlcnic_adapter *adapter = netdev_priv(netdev);
 	int max_sds_rings = adapter->max_sds_rings;
@@ -755,7 +756,8 @@ static int qlcnic_iloopback_test(struct net_device *netdev)
 	int loop = 0;
 	int ret;
 
-	netdev_info(netdev, "%s:  in progress\n", __func__);
+	netdev_info(netdev, "%s loopback test in progress\n",
+		   mode == QLCNIC_ILB_MODE ? "internal" : "external");
 	if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) {
 		netdev_warn(netdev, "Loopback test not supported for non "
 				"privilege function\n");
@@ -772,7 +774,7 @@ static int qlcnic_iloopback_test(struct net_device *netdev)
 
 	sds_ring = &adapter->recv_ctx->sds_rings[0];
 
-	ret = qlcnic_set_lb_mode(adapter, QLCNIC_ILB_MODE);
+	ret = qlcnic_set_lb_mode(adapter, mode);
 	if (ret)
 		goto free_res;
 
@@ -790,7 +792,7 @@ static int qlcnic_iloopback_test(struct net_device *netdev)
 		goto free_res;
 	}
 
-	ret = qlcnic_do_ilb_test(adapter);
+	ret = qlcnic_do_lb_test(adapter);
 
 	qlcnic_clear_lb_mode(adapter);
 
@@ -822,10 +824,15 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
 		if (data[2])
 			eth_test->flags |= ETH_TEST_FL_FAILED;
 
-		data[3] = qlcnic_iloopback_test(dev);
+		data[3] = qlcnic_loopback_test(dev, QLCNIC_ILB_MODE);
 		if (data[3])
 			eth_test->flags |= ETH_TEST_FL_FAILED;
 
+		if (eth_test->flags & ETH_TEST_FL_EXTERNAL_LB) {
+			data[4] = qlcnic_loopback_test(dev, QLCNIC_ELB_MODE);
+			if (data[4])
+				eth_test->flags |= ETH_TEST_FL_FAILED;
+		}
 	}
 }
 
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 9d5bee0..6ec1baa 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -1303,7 +1303,8 @@ qlcnic_handle_linkevent(struct qlcnic_adapter *adapter,
 		dev_info(&netdev->dev, "unsupported cable length %d\n",
 				cable_len);
 
-	if (!link_status && (lb_status == 1))
+	if (!link_status && (lb_status == QLCNIC_ILB_MODE ||
+	    lb_status == QLCNIC_ELB_MODE))
 		adapter->ahw->loopback_state |= QLCNIC_LINKEVENT;
 
 	qlcnic_advert_link_change(adapter, link_status);
-- 
1.7.3.3


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

* Re: [PATCH NEXT 1/2] net: add external loopback test in ethtool self test
  2011-06-28  6:40 ` [PATCH NEXT 1/2] net: add external loopback test in ethtool self test amit.salecha
@ 2011-06-29 18:28   ` Ben Hutchings
  2011-06-30  5:26     ` Amit Salecha
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2011-06-29 18:28 UTC (permalink / raw)
  To: amit.salecha; +Cc: davem, netdev, ameen.rahman

On Mon, 2011-06-27 at 23:40 -0700, amit.salecha@qlogic.com wrote:
> From: Amit Kumar Salecha <amit.salecha@qlogic.com>
> 
> External loopback test can be performed by application without any driver
> support on normal Ethernet cards.
> But on CNA devices, where multiple functions share same physical port.
> Here internal loopback test and external loopback test can be initiated by
> different function at same time. To co exist all functions, firmware need
> to regulate what test can be run by which function. So before performing external
> loopback test, command need to send to firmware, which will quiescent other functions.
> 
> User may not want to run external loopback test always. As special cable need to be
> connected for this test.
> 
> So adding explicit flag in ethtool self test, which will specify interface
> to perform external loopback test.

The trouble with adding flags to enum ethtool_test_flags is that there
is really no general way to tell whether the driver understood the flag.

I think you need to add a second flag which the driver sets to confirm
that it *did* use external loopback.

> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
> ---
>  include/linux/ethtool.h |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 048d0fa..c2ba287 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -310,9 +310,18 @@ struct ethtool_sset_info {
>  				   __u32's, etc. */
>  };
>  
> +/*
> + * Flags definition of ethtool_test
> + *
> + * ETH_TEST_FL_OFFLINE:  online / offline
> + * ETH_TEST_FL_FAILED: test passed / failed
> + * ETH_TEST_FL_EXTERNAL_LB: perform external loopback test
> + */
> +

Replacing the inline comments with a block comment is fine, but please
use kernel-doc format.

Ben.

>  enum ethtool_test_flags {
> -	ETH_TEST_FL_OFFLINE	= (1 << 0),	/* online / offline */
> -	ETH_TEST_FL_FAILED	= (1 << 1),	/* test passed / failed */
> +	ETH_TEST_FL_OFFLINE	= (1 << 0),
> +	ETH_TEST_FL_FAILED	= (1 << 1),
> +	ETH_TEST_FL_EXTERNAL_LB	= (1 << 2),
>  };
>  
>  /* for requesting NIC test and getting results*/

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


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

* RE: [PATCH NEXT 1/2] net: add external loopback test in ethtool self test
  2011-06-29 18:28   ` Ben Hutchings
@ 2011-06-30  5:26     ` Amit Salecha
  0 siblings, 0 replies; 5+ messages in thread
From: Amit Salecha @ 2011-06-30  5:26 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: David Miller, netdev, Ameen Rahman, Sucheta Chakraborty

> From: Ben Hutchings [mailto:bhutchings@solarflare.com]
>
> Subject: Re: [PATCH NEXT 1/2] net: add external loopback test in
> ethtool self test
> 
> >
> > So adding explicit flag in ethtool self test, which will specify
> interface
> > to perform external loopback test.
> 
> The trouble with adding flags to enum ethtool_test_flags is that there
> is really no general way to tell whether the driver understood the
> flag.
> 
> I think you need to add a second flag which the driver sets to confirm
> that it *did* use external loopback.
>

If I understood correctly:
You are concern about drives which doesn't support external loopback test.
In this case application doesn't have no general way to know, whether driver has
performed external loopback test.
Though the test case will be mention in test set. (return by .get_strings)

I will add it and send revised patch.

> > +/*
> > + * Flags definition of ethtool_test
> > + *
> > + * ETH_TEST_FL_OFFLINE:  online / offline
> > + * ETH_TEST_FL_FAILED: test passed / failed
> > + * ETH_TEST_FL_EXTERNAL_LB: perform external loopback test
> > + */
> > +
> 
> Replacing the inline comments with a block comment is fine, but please
> use kernel-doc format.
> 
I will fix it.

-Amit


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

end of thread, other threads:[~2011-06-30  5:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-28  6:40 [PATCH NEXT 0/2]net:external loopback support in ethtool amit.salecha
2011-06-28  6:40 ` [PATCH NEXT 1/2] net: add external loopback test in ethtool self test amit.salecha
2011-06-29 18:28   ` Ben Hutchings
2011-06-30  5:26     ` Amit Salecha
2011-06-28  6:40 ` [PATCH NEXT 2/2] qlcnic: add external loopback support amit.salecha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox