be2net: do external loopback test only when it is requested
authorIvan Vecera <ivecera@redhat.com>
Wed, 5 Mar 2014 10:54:05 +0000 (11:54 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Mar 2014 22:01:10 +0000 (17:01 -0500)
v2: remove unnecessary braces from all 'loopback' if-blocks (thx Sergei)

Cc: sathya.perla@emulex.com
Cc: subbu.seetharaman@emulex.com
Cc: ajit.khaparde@emulex.com
Cc: sergei.shtylyov@cogentembedded.com
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Acked-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be_ethtool.c

index cf09d8faca84d808cc23d564a0e20cf0881dee56..66759b6ce3733bdf78f3583afb349c8a4e61afa7 100644 (file)
@@ -802,16 +802,18 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
 
        if (test->flags & ETH_TEST_FL_OFFLINE) {
                if (be_loopback_test(adapter, BE_MAC_LOOPBACK,
-                                               &data[0]) != 0) {
+                                    &data[0]) != 0)
                        test->flags |= ETH_TEST_FL_FAILED;
-               }
+
                if (be_loopback_test(adapter, BE_PHY_LOOPBACK,
-                                               &data[1]) != 0) {
-                       test->flags |= ETH_TEST_FL_FAILED;
-               }
-               if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK,
-                                               &data[2]) != 0) {
+                                    &data[1]) != 0)
                        test->flags |= ETH_TEST_FL_FAILED;
+
+               if (test->flags & ETH_TEST_FL_EXTERNAL_LB) {
+                       if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK,
+                                            &data[2]) != 0)
+                               test->flags |= ETH_TEST_FL_FAILED;
+                       test->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE;
                }
        }