Hi "Marek,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on cd29296fdfca919590e4004a7e4905544f4c4a32]
url:
https://github.com/0day-ci/linux/commits/Marek-Beh-n/netdev-trigger-offlo...
base: cd29296fdfca919590e4004a7e4905544f4c4a32
config: nds32-randconfig-r012-20201030 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://github.com/0day-ci/linux/commit/0cfca88266cb524576ecb45f52c9f40c1...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Marek-Beh-n/netdev-trigger-offloading-and-LEDs-on-Marvell-PHYs/20201030-194640
git checkout 0cfca88266cb524576ecb45f52c9f40c177f1560
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
> drivers/net/phy/marvell.c:885:13: warning: 'struct
led_netdev_data' declared inside parameter list will not be visible outside of this
definition or declaration
885 | struct led_netdev_data *trig)
| ^~~~~~~~~~~~~~~
drivers/net/phy/marvell.c: In function 'marvell_find_led_mode':
> drivers/net/phy/marvell.c:892:21: error: dereferencing pointer to
incomplete type 'struct led_netdev_data'
892 | key =
LED_MODE(trig->link, trig->tx, trig->rx);
| ^~
drivers/net/phy/marvell.c:832:28: note: in definition of macro 'BITIF'
832 | #define BITIF(i, cond) ((cond) ? BIT(i) : 0)
| ^~~~
drivers/net/phy/marvell.c:892:8: note: in expansion of macro 'LED_MODE'
892 | key = LED_MODE(trig->link, trig->tx, trig->rx);
| ^~~~~~~~
drivers/net/phy/marvell.c: In function 'marvell_led_trigger_offload':
> drivers/net/phy/marvell.c:941:28: error:
'netdev_led_trigger' undeclared (first use in this function); did you mean
'phy_led_trigger'?
941 | if (led->cdev.trigger !=
&netdev_led_trigger || !phydev->attached_dev ||
| ^~~~~~~~~~~~~~~~~~
| phy_led_trigger
drivers/net/phy/marvell.c:941:28: note: each undeclared identifier is reported only
once for each function it appears in
drivers/net/phy/marvell.c:942:34: error: dereferencing pointer to incomplete type
'struct led_netdev_data'
942 | phydev->attached_dev != trig->net_dev)
| ^~
> drivers/net/phy/marvell.c:945:44: error: passing argument 3 of
'marvell_find_led_mode' from incompatible pointer type
[-Werror=incompatible-pointer-types]
945 | mode =
marvell_find_led_mode(phydev, led, trig);
| ^~~~
| |
| struct led_netdev_data *
drivers/net/phy/marvell.c:885:30: note: expected 'struct led_netdev_data *' but
argument is of type 'struct led_netdev_data *'
885 | struct led_netdev_data *trig)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
cc1: some warnings being treated as errors
vim +892 drivers/net/phy/marvell.c
831
832 #define BITIF(i, cond) ((cond) ? BIT(i) : 0)
833 #define LED_MODE(link, tx, rx) \
834 (BITIF(0, (link)) | BITIF(1, (tx)) | BITIF(2, (rx)))
835
836 struct marvell_led_mode_info {
837 u32 key;
838 s8 regval[6];
839 enum {
840 COMMON = BIT(0),
841 L1V0_RX = BIT(1),
842 L3V5_TX = BIT(2),
843 } flags;
844 };
845
846 struct marvell_leds_info {
847 u32 family;
848 int nleds;
849 u32 flags;
850 };
851
852 #define LED(f, n, flg) \
853 { \
854 .family = MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E##f), \
855 .nleds = (n), \
856 .flags = (flg), \
857 } \
858
859 static const struct marvell_leds_info marvell_leds_info[] = {
860 LED(1112, 4, COMMON | L3V5_TX),
861 LED(1116R, 3, COMMON),
862 LED(1118, 3, COMMON),
863 LED(1121R, 3, COMMON),
864 LED(1149R, 4, COMMON | L3V5_TX),
865 LED(1240, 6, COMMON | L3V5_TX),
866 LED(1318S, 3, COMMON | L1V0_RX),
867 LED(1340S, 6, COMMON),
868 LED(1510, 3, COMMON | L1V0_RX),
869 LED(1545, 6, COMMON),
870 LED(1548P, 6, COMMON),
871 };
872
873 static const struct marvell_led_mode_info marvell_led_mode_info[] = {
874 { LED_MODE(1, 0, 0), { 0x0, -1, 0x0, -1, -1, -1, }, COMMON },
875 { LED_MODE(1, 1, 1), { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, }, COMMON },
876 { LED_MODE(0, 1, 1), { 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, }, COMMON },
877 { LED_MODE(1, 0, 1), { -1, 0x2, -1, 0x2, 0x2, 0x2, }, COMMON },
878 { LED_MODE(0, 1, 0), { 0x5, -1, 0x5, -1, 0x5, 0x5, }, COMMON },
879 { LED_MODE(0, 1, 0), { -1, -1, -1, 0x5, -1, -1, }, L3V5_TX },
880 { LED_MODE(0, 0, 1), { -1, -1, -1, -1, 0x0, 0x0, }, COMMON },
881 { LED_MODE(0, 0, 1), { -1, 0x0, -1, -1, -1, -1, }, L1V0_RX },
882 };
883
884 static int marvell_find_led_mode(struct phy_device *phydev, struct phy_led *led,
885 struct led_netdev_data *trig)
886 {
887 const struct marvell_leds_info *info = led->priv;
888 const struct marvell_led_mode_info *mode;
889 u32 key;
890 int i;
891
892 key = LED_MODE(trig->link, trig->tx, trig->rx);
893
894 for (i = 0; i < ARRAY_SIZE(marvell_led_mode_info); ++i) {
895 mode = &marvell_led_mode_info[i];
896
897 if (key != mode->key || mode->regval[led->addr] == -1 ||
898 !(info->flags & mode->flags))
899 continue;
900
901 return mode->regval[led->addr];
902 }
903
904 dev_dbg(led->cdev.dev,
905 "cannot offload trigger configuration (%s, link=%i, tx=%i, rx=%i)\n",
906 netdev_name(trig->net_dev), trig->link, trig->tx, trig->rx);
907
908 return -1;
909 }
910
911 /* FIXME: Blinking rate is shared by all LEDs on a PHY. Should we check whether
912 * another LED is currently blinking with incompatible rate? It would be cleaner
913 * if we in this case failed to offload blinking this LED.
914 * But consider this situation:
915 * 1. user sets LED[1] to blink with period 500ms for some reason. This would
916 * start blinking LED[1] with perion 670ms here
917 * 2. user sets netdev trigger to LED[0] to blink on activity, default there
918 * is 100ms period, which would translate here to 84ms. This is
919 * incompatible with the already blinking LED, so we fail to offload to HW,
920 * and netdev trigger does software offloading instead.
921 * 3. user unsets blinking od LED[1], so now we theoretically can offload
922 * netdev trigger to LED[0], but we don't know about it, and so it is
left
923 * in SW triggering until user writes the settings again
924 * This could be solved by the netdev trigger periodically trying to offload to
925 * HW if we reported that it is theoretically possible (by returning -EAGAIN
926 * instead of -EOPNOTSUPP, for example). Do we want to do this?
927 */
928 static int marvell_led_trigger_offload(struct phy_device *phydev,
929 struct phy_led *led, bool enable)
930 {
931 struct led_netdev_data *trig = led_get_trigger_data(&led->cdev);
932 struct device *dev = led->cdev.dev;
933 unsigned long period;
934 int mode;
935 int ret;
936
937 if (!enable)
938 goto offload_disable;
939
940 /* Sanity checks first */
941 if (led->cdev.trigger != &netdev_led_trigger ||
!phydev->attached_dev ||
942 phydev->attached_dev !=
trig->net_dev)
943 goto offload_disable;
944
945 mode = marvell_find_led_mode(phydev, led, trig);
946 if (mode < 0)
947 goto offload_disable;
948
949 /* TODO: this should only be checked if blinking is needed */
950 period = jiffies_to_msecs(atomic_read(&trig->interval)) * 2;
951 ret = marvell_leds_set_blink_rate(phydev, &period);
952 if (ret) {
953 dev_dbg(dev, "cannot offload trigger (unsupported blinking
period)\n");
954 goto offload_disable;
955 }
956
957 ret = marvell_led_set_regval(phydev, led->addr, mode);
958 if (!ret) {
959 atomic_set(&trig->interval, msecs_to_jiffies(period / 2));
960 dev_dbg(led->cdev.dev, "netdev trigger offloaded\n");
961 }
962
963 return ret;
964
965 offload_disable:
966 ret = marvell_led_set_regval(phydev, led->addr, MII_PHY_LED_CTRL_OFF);
967 if (ret)
968 return ret;
969
970 return -EOPNOTSUPP;
971 }
972
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org