diff mbox series

[net-next,4/4] net: phy: bcm54140: add cable diagnostics support

Message ID 20200509223714.30855-5-michael@walle.cc
State Deferred
Delegated to: David Miller
Headers show
Series net: phy: broadcom: cable tester support | expand

Commit Message

Michael Walle May 9, 2020, 10:37 p.m. UTC
Use the generic cable tester functions from bcm-phy-lib to add cable
tester support.

100m cable, A/B/C/D open:
  Cable test started for device eth0.
  Cable test completed for device eth0.
  Pair: Pair A, result: Open Circuit
  Pair: Pair B, result: Open Circuit
  Pair: Pair C, result: Open Circuit
  Pair: Pair D, result: Open Circuit
  Pair: Pair A, fault length: 106.60m
  Pair: Pair B, fault length: 103.32m
  Pair: Pair C, fault length: 104.96m
  Pair: Pair D, fault length: 106.60m

1m cable, A/B connected, pair C shorted, D open:
  Cable test started for device eth0.
  Cable test completed for device eth0.
  Pair: Pair A, result: OK
  Pair: Pair B, result: OK
  Pair: Pair C, result: Short within Pair
  Pair: Pair D, result: Open Circuit
  Pair: Pair C, fault length: 0.82m
  Pair: Pair D, fault length: 1.64m

1m cable, A/B connected, pair C shorted with D:
  Cable test started for device eth0.
  Cable test completed for device eth0.
  Pair: Pair A, result: OK
  Pair: Pair B, result: OK
  Pair: Pair C, result: Short to another pair
  Pair: Pair D, result: Short to another pair
  Pair: Pair C, fault length: 1.64m
  Pair: Pair D, fault length: 1.64m

The granularity of the length measurement seems to be 82cm.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/phy/bcm54140.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

kernel test robot May 10, 2020, 12:05 a.m. UTC | #1
Hi Michael,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on next-20200508]
[cannot apply to net/master linus/master v5.7-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Michael-Walle/net-phy-broadcom-cable-tester-support/20200510-063955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 2c674bec76d35b75c7c730f863424387c9e9633a
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=alpha 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/phy/bcm54140.c:834:13: error: 'PHY_POLL_CABLE_TEST' undeclared here (not in a function)
     834 |   .flags  = PHY_POLL_CABLE_TEST,
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/bcm54140.c:846:4: error: 'struct phy_driver' has no member named 'cable_test_start'
     846 |   .cable_test_start = bcm_phy_cable_test_start_rdb,
         |    ^~~~~~~~~~~~~~~~
>> drivers/net/phy/bcm54140.c:846:23: error: initialization of 'int (*)(struct phy_device *, bool)' {aka 'int (*)(struct phy_device *, _Bool)'} from incompatible pointer type 'int (*)(struct phy_device *)' [-Werror=incompatible-pointer-types]
     846 |   .cable_test_start = bcm_phy_cable_test_start_rdb,
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/bcm54140.c:846:23: note: (near initialization for 'bcm54140_drivers[0].set_loopback')
   drivers/net/phy/bcm54140.c:847:4: error: 'struct phy_driver' has no member named 'cable_test_get_status'
     847 |   .cable_test_get_status = bcm_phy_cable_test_get_status_rdb,
         |    ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/bcm54140.c:847:28: warning: excess elements in struct initializer
     847 |   .cable_test_get_status = bcm_phy_cable_test_get_status_rdb,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/bcm54140.c:847:28: note: (near initialization for 'bcm54140_drivers[0]')
   cc1: some warnings being treated as errors

vim +846 drivers/net/phy/bcm54140.c

   828	
   829	static struct phy_driver bcm54140_drivers[] = {
   830		{
   831			.phy_id         = PHY_ID_BCM54140,
   832			.phy_id_mask    = BCM54140_PHY_ID_MASK,
   833			.name           = "Broadcom BCM54140",
   834			.flags		= PHY_POLL_CABLE_TEST,
   835			.features       = PHY_GBIT_FEATURES,
   836			.config_init    = bcm54140_config_init,
   837			.did_interrupt	= bcm54140_did_interrupt,
   838			.ack_interrupt  = bcm54140_ack_intr,
   839			.config_intr    = bcm54140_config_intr,
   840			.probe		= bcm54140_probe,
   841			.suspend	= genphy_suspend,
   842			.resume		= genphy_resume,
   843			.soft_reset	= genphy_soft_reset,
   844			.get_tunable	= bcm54140_get_tunable,
   845			.set_tunable	= bcm54140_set_tunable,
 > 846			.cable_test_start = bcm_phy_cable_test_start_rdb,
   847			.cable_test_get_status = bcm_phy_cable_test_get_status_rdb,
   848		},
   849	};
   850	module_phy_driver(bcm54140_drivers);
   851	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Florian Fainelli May 10, 2020, 12:09 a.m. UTC | #2
On 5/9/2020 3:37 PM, Michael Walle wrote:
> Use the generic cable tester functions from bcm-phy-lib to add cable
> tester support.
> 
> 100m cable, A/B/C/D open:
>   Cable test started for device eth0.
>   Cable test completed for device eth0.
>   Pair: Pair A, result: Open Circuit
>   Pair: Pair B, result: Open Circuit
>   Pair: Pair C, result: Open Circuit
>   Pair: Pair D, result: Open Circuit
>   Pair: Pair A, fault length: 106.60m
>   Pair: Pair B, fault length: 103.32m
>   Pair: Pair C, fault length: 104.96m
>   Pair: Pair D, fault length: 106.60m
> 
> 1m cable, A/B connected, pair C shorted, D open:
>   Cable test started for device eth0.
>   Cable test completed for device eth0.
>   Pair: Pair A, result: OK
>   Pair: Pair B, result: OK
>   Pair: Pair C, result: Short within Pair
>   Pair: Pair D, result: Open Circuit
>   Pair: Pair C, fault length: 0.82m
>   Pair: Pair D, fault length: 1.64m
> 
> 1m cable, A/B connected, pair C shorted with D:
>   Cable test started for device eth0.
>   Cable test completed for device eth0.
>   Pair: Pair A, result: OK
>   Pair: Pair B, result: OK
>   Pair: Pair C, result: Short to another pair
>   Pair: Pair D, result: Short to another pair
>   Pair: Pair C, fault length: 1.64m
>   Pair: Pair D, fault length: 1.64m
> 
> The granularity of the length measurement seems to be 82cm.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
kernel test robot May 10, 2020, 5:37 a.m. UTC | #3
Hi Michael,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on next-20200508]
[cannot apply to net/master linus/master ipvs/master v5.7-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Michael-Walle/net-phy-broadcom-cable-tester-support/20200510-063955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 2c674bec76d35b75c7c730f863424387c9e9633a
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> drivers/net/phy/bcm54140.c:834:13: error: 'PHY_POLL_CABLE_TEST' undeclared here (not in a function)
      .flags  = PHY_POLL_CABLE_TEST,
                ^~~~~~~~~~~~~~~~~~~
>> drivers/net/phy/bcm54140.c:846:4: error: 'struct phy_driver' has no member named 'cable_test_start'
      .cable_test_start = bcm_phy_cable_test_start_rdb,
       ^~~~~~~~~~~~~~~~
>> drivers/net/phy/bcm54140.c:846:23: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
      .cable_test_start = bcm_phy_cable_test_start_rdb,
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/bcm54140.c:846:23: note: (near initialization for 'bcm54140_drivers[0].set_loopback')
>> drivers/net/phy/bcm54140.c:847:4: error: 'struct phy_driver' has no member named 'cable_test_get_status'
      .cable_test_get_status = bcm_phy_cable_test_get_status_rdb,
       ^~~~~~~~~~~~~~~~~~~~~
>> drivers/net/phy/bcm54140.c:847:28: warning: excess elements in struct initializer
      .cable_test_get_status = bcm_phy_cable_test_get_status_rdb,
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/bcm54140.c:847:28: note: (near initialization for 'bcm54140_drivers[0]')
   cc1: some warnings being treated as errors

vim +/PHY_POLL_CABLE_TEST +834 drivers/net/phy/bcm54140.c

   828	
   829	static struct phy_driver bcm54140_drivers[] = {
   830		{
   831			.phy_id         = PHY_ID_BCM54140,
   832			.phy_id_mask    = BCM54140_PHY_ID_MASK,
   833			.name           = "Broadcom BCM54140",
 > 834			.flags		= PHY_POLL_CABLE_TEST,
   835			.features       = PHY_GBIT_FEATURES,
   836			.config_init    = bcm54140_config_init,
   837			.did_interrupt	= bcm54140_did_interrupt,
   838			.ack_interrupt  = bcm54140_ack_intr,
   839			.config_intr    = bcm54140_config_intr,
   840			.probe		= bcm54140_probe,
   841			.suspend	= genphy_suspend,
   842			.resume		= genphy_resume,
   843			.soft_reset	= genphy_soft_reset,
   844			.get_tunable	= bcm54140_get_tunable,
   845			.set_tunable	= bcm54140_set_tunable,
 > 846			.cable_test_start = bcm_phy_cable_test_start_rdb,
 > 847			.cable_test_get_status = bcm_phy_cable_test_get_status_rdb,
   848		},
   849	};
   850	module_phy_driver(bcm54140_drivers);
   851	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Andrew Lunn May 10, 2020, 2:44 p.m. UTC | #4
On Sun, May 10, 2020 at 12:37:14AM +0200, Michael Walle wrote:
> Use the generic cable tester functions from bcm-phy-lib to add cable
> tester support.
> 
> 100m cable, A/B/C/D open:
>   Cable test started for device eth0.
>   Cable test completed for device eth0.
>   Pair: Pair A, result: Open Circuit
>   Pair: Pair B, result: Open Circuit
>   Pair: Pair C, result: Open Circuit
>   Pair: Pair D, result: Open Circuit
>   Pair: Pair A, fault length: 106.60m
>   Pair: Pair B, fault length: 103.32m
>   Pair: Pair C, fault length: 104.96m
>   Pair: Pair D, fault length: 106.60m
> 
> 1m cable, A/B connected, pair C shorted, D open:
>   Cable test started for device eth0.
>   Cable test completed for device eth0.
>   Pair: Pair A, result: OK
>   Pair: Pair B, result: OK
>   Pair: Pair C, result: Short within Pair
>   Pair: Pair D, result: Open Circuit
>   Pair: Pair C, fault length: 0.82m
>   Pair: Pair D, fault length: 1.64m
> 
> 1m cable, A/B connected, pair C shorted with D:
>   Cable test started for device eth0.
>   Cable test completed for device eth0.
>   Pair: Pair A, result: OK
>   Pair: Pair B, result: OK
>   Pair: Pair C, result: Short to another pair
>   Pair: Pair D, result: Short to another pair
>   Pair: Pair C, fault length: 1.64m
>   Pair: Pair D, fault length: 1.64m
> 
> The granularity of the length measurement seems to be 82cm.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/bcm54140.c b/drivers/net/phy/bcm54140.c
index 9ef37a3bc2bb..8998e68bb26b 100644
--- a/drivers/net/phy/bcm54140.c
+++ b/drivers/net/phy/bcm54140.c
@@ -831,6 +831,7 @@  static struct phy_driver bcm54140_drivers[] = {
 		.phy_id         = PHY_ID_BCM54140,
 		.phy_id_mask    = BCM54140_PHY_ID_MASK,
 		.name           = "Broadcom BCM54140",
+		.flags		= PHY_POLL_CABLE_TEST,
 		.features       = PHY_GBIT_FEATURES,
 		.config_init    = bcm54140_config_init,
 		.did_interrupt	= bcm54140_did_interrupt,
@@ -842,6 +843,8 @@  static struct phy_driver bcm54140_drivers[] = {
 		.soft_reset	= genphy_soft_reset,
 		.get_tunable	= bcm54140_get_tunable,
 		.set_tunable	= bcm54140_set_tunable,
+		.cable_test_start = bcm_phy_cable_test_start_rdb,
+		.cable_test_get_status = bcm_phy_cable_test_get_status_rdb,
 	},
 };
 module_phy_driver(bcm54140_drivers);