Re: [PATCH net-next 3/4] net: phy: broadcom: add cable test support

From: kbuild test robot
Date: Sat May 09 2020 - 23:08:53 EST


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@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/net/phy/bcm-phy-lib.c: In function 'bcm_phy_cable_test_report_trans':
>> drivers/net/phy/bcm-phy-lib.c:639:10: error: 'ETHTOOL_A_CABLE_RESULT_CODE_OK' undeclared (first use in this function); did you mean 'ETHTOOL_A_COALESCE_PKT_RATE_LOW'?
return ETHTOOL_A_CABLE_RESULT_CODE_OK;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_COALESCE_PKT_RATE_LOW
drivers/net/phy/bcm-phy-lib.c:639:10: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/phy/bcm-phy-lib.c:641:10: error: 'ETHTOOL_A_CABLE_RESULT_CODE_OPEN' undeclared (first use in this function); did you mean 'ETHTOOL_A_CABLE_RESULT_CODE_OK'?
return ETHTOOL_A_CABLE_RESULT_CODE_OPEN;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_CABLE_RESULT_CODE_OK
>> drivers/net/phy/bcm-phy-lib.c:643:10: error: 'ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT' undeclared (first use in this function); did you mean 'ETHTOOL_A_CABLE_RESULT_CODE_OPEN'?
return ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_CABLE_RESULT_CODE_OPEN
>> drivers/net/phy/bcm-phy-lib.c:645:10: error: 'ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT' undeclared (first use in this function); did you mean 'ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT'?
return ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT
>> drivers/net/phy/bcm-phy-lib.c:649:10: error: 'ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC' undeclared (first use in this function); did you mean 'ETHTOOL_A_CABLE_RESULT_CODE_OPEN'?
return ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_CABLE_RESULT_CODE_OPEN
drivers/net/phy/bcm-phy-lib.c: In function 'bcm_phy_report_length':
>> drivers/net/phy/bcm-phy-lib.c:681:2: error: implicit declaration of function 'ethnl_cable_test_fault_length' [-Werror=implicit-function-declaration]
ethnl_cable_test_fault_length(phydev, pair, val);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/bcm-phy-lib.c: In function '_bcm_phy_cable_test_get_status':
>> drivers/net/phy/bcm-phy-lib.c:719:2: error: implicit declaration of function 'ethnl_cable_test_result'; did you mean 'bcm_phy_cable_test_start'? [-Werror=implicit-function-declaration]
ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A,
^~~~~~~~~~~~~~~~~~~~~~~
bcm_phy_cable_test_start
>> drivers/net/phy/bcm-phy-lib.c:719:34: error: 'ETHTOOL_A_CABLE_PAIR_A' undeclared (first use in this function); did you mean 'ETHTOOL_A_PAUSE_MAX'?
ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A,
^~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_PAUSE_MAX
>> drivers/net/phy/bcm-phy-lib.c:721:34: error: 'ETHTOOL_A_CABLE_PAIR_B' undeclared (first use in this function); did you mean 'ETHTOOL_A_CABLE_PAIR_A'?
ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_B,
^~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_CABLE_PAIR_A
>> drivers/net/phy/bcm-phy-lib.c:723:34: error: 'ETHTOOL_A_CABLE_PAIR_C' undeclared (first use in this function); did you mean 'ETHTOOL_A_CABLE_PAIR_B'?
ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_C,
^~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_CABLE_PAIR_B
>> drivers/net/phy/bcm-phy-lib.c:725:34: error: 'ETHTOOL_A_CABLE_PAIR_D' undeclared (first use in this function); did you mean 'ETHTOOL_A_CABLE_PAIR_C'?
ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_D,
^~~~~~~~~~~~~~~~~~~~~~
ETHTOOL_A_CABLE_PAIR_C
cc1: some warnings being treated as errors

vim +639 drivers/net/phy/bcm-phy-lib.c

634
635 static int bcm_phy_cable_test_report_trans(int result)
636 {
637 switch (result) {
638 case BCM54XX_ECD_FAULT_TYPE_OK:
> 639 return ETHTOOL_A_CABLE_RESULT_CODE_OK;
640 case BCM54XX_ECD_FAULT_TYPE_OPEN:
> 641 return ETHTOOL_A_CABLE_RESULT_CODE_OPEN;
642 case BCM54XX_ECD_FAULT_TYPE_SAME_SHORT:
> 643 return ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT;
644 case BCM54XX_ECD_FAULT_TYPE_CROSS_SHORT:
> 645 return ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT;
646 case BCM54XX_ECD_FAULT_TYPE_INVALID:
647 case BCM54XX_ECD_FAULT_TYPE_BUSY:
648 default:
> 649 return ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC;
650 }
651 }
652
653 static bool bcm_phy_distance_valid(int result)
654 {
655 switch (result) {
656 case BCM54XX_ECD_FAULT_TYPE_OPEN:
657 case BCM54XX_ECD_FAULT_TYPE_SAME_SHORT:
658 case BCM54XX_ECD_FAULT_TYPE_CROSS_SHORT:
659 return true;
660 }
661 return false;
662 }
663
664 static int bcm_phy_report_length(struct phy_device *phydev, int result,
665 int pair)
666 {
667 int val;
668
669 val = __bcm_phy_read_exp(phydev,
670 BCM54XX_EXP_ECD_PAIR_A_LENGTH_RESULTS + pair);
671 if (val < 0)
672 return val;
673
674 if (val == BCM54XX_ECD_LENGTH_RESULTS_INVALID)
675 return 0;
676
677 /* intra-pair shorts report twice the length */
678 if (result == BCM54XX_ECD_FAULT_TYPE_CROSS_SHORT)
679 val >>= 1;
680
> 681 ethnl_cable_test_fault_length(phydev, pair, val);
682
683 return 0;
684 }
685
686 static int _bcm_phy_cable_test_get_status(struct phy_device *phydev,
687 bool *finished, bool is_rdb)
688 {
689 int pair_a, pair_b, pair_c, pair_d, ret;
690
691 *finished = false;
692
693 phy_lock_mdio_bus(phydev);
694
695 if (is_rdb) {
696 ret = __bcm_phy_enable_legacy_access(phydev);
697 if (ret)
698 goto out;
699 }
700
701 ret = __bcm_phy_read_exp(phydev, BCM54XX_EXP_ECD_CTRL);
702 if (ret < 0)
703 goto out;
704
705 if (ret & BCM54XX_ECD_CTRL_IN_PROGRESS) {
706 ret = 0;
707 goto out;
708 }
709
710 ret = __bcm_phy_read_exp(phydev, BCM54XX_EXP_ECD_FAULT_TYPE);
711 if (ret < 0)
712 goto out;
713
714 pair_a = FIELD_GET(BCM54XX_ECD_FAULT_TYPE_PAIR_A_MASK, ret);
715 pair_b = FIELD_GET(BCM54XX_ECD_FAULT_TYPE_PAIR_B_MASK, ret);
716 pair_c = FIELD_GET(BCM54XX_ECD_FAULT_TYPE_PAIR_C_MASK, ret);
717 pair_d = FIELD_GET(BCM54XX_ECD_FAULT_TYPE_PAIR_D_MASK, ret);
718
> 719 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A,
720 bcm_phy_cable_test_report_trans(pair_a));
> 721 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_B,
722 bcm_phy_cable_test_report_trans(pair_b));
> 723 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_C,
724 bcm_phy_cable_test_report_trans(pair_c));
> 725 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_D,
726 bcm_phy_cable_test_report_trans(pair_d));
727
728 if (bcm_phy_distance_valid(pair_a))
729 bcm_phy_report_length(phydev, pair_a, 0);
730 if (bcm_phy_distance_valid(pair_b))
731 bcm_phy_report_length(phydev, pair_b, 1);
732 if (bcm_phy_distance_valid(pair_c))
733 bcm_phy_report_length(phydev, pair_c, 2);
734 if (bcm_phy_distance_valid(pair_d))
735 bcm_phy_report_length(phydev, pair_d, 3);
736
737 ret = 0;
738 *finished = true;
739 out:
740 /* re-enable the RDB access even if there was an error */
741 if (is_rdb)
742 ret = __bcm_phy_enable_rdb_access(phydev) ? : ret;
743
744 phy_unlock_mdio_bus(phydev);
745
746 return ret;
747 }
748

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip