Skip to contentSkip to conversation

ionic: fix ptp support config breakage

PATCH Superseded Shannon Nelson 3 participants 8 messages May 6, 2021 – May 7, 2021

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ionic: fix ptp support config breakage

Driver link failed with undefined references in some kernel config variations.

Fixes 61db421da31b ("ionic: link in the new hw timestamp code")
Cc Allen Hubbe <[email protected]>

---

v3 - put version notes below ---, added Allen's Cc v2 - added Fixes tag

 drivers/net/ethernet/pensando/ionic/Makefile    | 3 +--
 drivers/net/ethernet/pensando/ionic/ionic_phc.c | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/pensando/ionic/Makefile +1 -2
index 4e7642a2d25f..61c40169cb1f 100644
@@ -5,5 +5,4 @@ obj-$(CONFIG_IONIC) := ionic.o
 
 ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o ionic_dev.o \
 	   ionic_debugfs.o ionic_lif.o ionic_rx_filter.o ionic_ethtool.o \
-	   ionic_txrx.o ionic_stats.o ionic_fw.o
-ionic-$(CONFIG_PTP_1588_CLOCK) += ionic_phc.o
+	   ionic_txrx.o ionic_stats.o ionic_fw.o ionic_phc.o
drivers/net/ethernet/pensando/ionic/ionic_phc.c +3 -0
index a87c87e86aef..30c78808c45a 100644
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2017 - 2021 Pensando Systems, Inc */
 
+#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 
@@ -613,3 +615,4 @@ void ionic_lif_free_phc(struct ionic_lif *lif)
 	devm_kfree(lif->ionic->dev, lif->phc);
 	lif->phc = NULL;
 }
+#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 2 lines · On Wed, 5 May 2021 21:18:46 -0700 Shannon Nelson wrote:

Driver link failed with undefined references in some kernel config variations.

This is really vague and the patch is not very obvious.

drivers/net/ethernet/pensando/ionic/Makefile obj-$(CONFIG_IONIC) := ionic.o · line 8

Quoted 5 lines

ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o ionic_dev.o \

drivers/net/ethernet/pensando/ionic/Makefile +1 -2
 	   ionic_debugfs.o ionic_lif.o ionic_rx_filter.o ionic_ethtool.o \
-	   ionic_txrx.o ionic_stats.o ionic_fw.o
-ionic-$(CONFIG_PTP_1588_CLOCK) += ionic_phc.o
+	   ionic_txrx.o ionic_stats.o ionic_fw.o ionic_phc.o

So we'd replace a build dependency..

Quoted 14 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +2 -0
index a87c87e86aef..30c78808c45a 100644
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2017 - 2021 Pensando Systems, Inc */
 
+#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 

drivers/net/ethernet/pensando/ionic/ionic_phc.c void ionic_lif_free_phc(struct ionic_lif *lif) · line 618

Quoted 4 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +1 -0
@@ -613,3 +615,4 @@ void ionic_lif_free_phc(struct ionic_lif *lif)
 	devm_kfree(lif->ionic->dev, lif->phc);
 	lif->phc = NULL;
 }
+#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */

.. with an ifdef around an entire file? Does not feel very clean.

The construct of using:

	drv-$(CONFIG_PTP_1588_CLOCK) += ptp.o

seems relatively common, why does it now work here?

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

Maybe somehow the "ionic-y" confuses kbuild and it should be ionic-objs?

At the very least we need a better explanation in the commit message.

#2 lore raw
Quoted 39 lines · Jakub Kicinski
Quoted 2 lines · On Wed, 5 May 2021 21:18:46 -0700 Shannon Nelson wrote:

Driver link failed with undefined references in some kernel config variations.

This is really vague and the patch is not very obvious.

drivers/net/ethernet/pensando/ionic/Makefile obj-$(CONFIG_IONIC) := ionic.o · line 8

Quoted 5 lines

ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o ionic_dev.o \

drivers/net/ethernet/pensando/ionic/Makefile +1 -2
 	   ionic_debugfs.o ionic_lif.o ionic_rx_filter.o ionic_ethtool.o \
-	   ionic_txrx.o ionic_stats.o ionic_fw.o
-ionic-$(CONFIG_PTP_1588_CLOCK) += ionic_phc.o
+	   ionic_txrx.o ionic_stats.o ionic_fw.o ionic_phc.o

So we'd replace a build dependency..

Quoted 14 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +2 -0
index a87c87e86aef..30c78808c45a 100644
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2017 - 2021 Pensando Systems, Inc */
 
+#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 

drivers/net/ethernet/pensando/ionic/ionic_phc.c void ionic_lif_free_phc(struct ionic_lif *lif) · line 618

Quoted 4 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +1 -0
@@ -613,3 +615,4 @@ void ionic_lif_free_phc(struct ionic_lif *lif)
 	devm_kfree(lif->ionic->dev, lif->phc);
 	lif->phc = NULL;
 }
+#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */

.. with an ifdef around an entire file? Does not feel very clean.

The construct of using:

	drv-$(CONFIG_PTP_1588_CLOCK) += ptp.o
Quoted 9 lines

seems relatively common, why does it now work here?

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

Maybe somehow the "ionic-y" confuses kbuild and it should be ionic-objs?

At the very least we need a better explanation in the commit message.

I'll take a look if someone can point me to the .config file.

Signature · 1 line
~Randy
#3 lore raw
Quoted 39 lines · Randy Dunlap
Quoted 38 lines · Jakub Kicinski
Quoted 2 lines · On Wed, 5 May 2021 21:18:46 -0700 Shannon Nelson wrote:

Driver link failed with undefined references in some kernel config variations.

This is really vague and the patch is not very obvious.

drivers/net/ethernet/pensando/ionic/Makefile obj-$(CONFIG_IONIC) := ionic.o · line 8

Quoted 5 lines
  ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o ionic_dev.o \
  	   ionic_debugfs.o ionic_lif.o ionic_rx_filter.o ionic_ethtool.o \
drivers/net/ethernet/pensando/ionic/Makefile +1 -2
-	   ionic_txrx.o ionic_stats.o ionic_fw.o
-ionic-$(CONFIG_PTP_1588_CLOCK) += ionic_phc.o
+	   ionic_txrx.o ionic_stats.o ionic_fw.o ionic_phc.o

So we'd replace a build dependency..

Quoted 14 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +2 -0
index a87c87e86aef..30c78808c45a 100644
@@ -1,6 +1,8 @@
  // SPDX-License-Identifier: GPL-2.0
  /* Copyright(c) 2017 - 2021 Pensando Systems, Inc */
 
+#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+
  #include <linux/netdevice.h>
  #include <linux/etherdevice.h>
 

drivers/net/ethernet/pensando/ionic/ionic_phc.c void ionic_lif_free_phc(struct ionic_lif *lif) · line 618

Quoted 4 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +1 -0
@@ -613,3 +615,4 @@ void ionic_lif_free_phc(struct ionic_lif *lif)
  	devm_kfree(lif->ionic->dev, lif->phc);
  	lif->phc = NULL;
  }
+#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */

.. with an ifdef around an entire file? Does not feel very clean.

The construct of using:

	drv-$(CONFIG_PTP_1588_CLOCK) += ptp.o

seems relatively common, why does it now work here?

Quoted 9 lines
Quoted 7 lines

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

Maybe somehow the "ionic-y" confuses kbuild and it should be ionic-objs?

At the very least we need a better explanation in the commit message.

I'll take a look if someone can point me to the .config file.

These are the notes I got from kernel test robot:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/

sln

#4 lore raw
Quoted 45 lines · Shannon Nelson
Quoted 44 lines · Randy Dunlap
Quoted 43 lines · Jakub Kicinski
Quoted 2 lines · On Wed,  5 May 2021 21:18:46 -0700 Shannon Nelson wrote:

Driver link failed with undefined references in some kernel config variations.

This is really vague and the patch is not very obvious.

Quoted 5 lines

  ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o ionic_dev.o \
         ionic_debugfs.o ionic_lif.o ionic_rx_filter.o ionic_ethtool.o \
-       ionic_txrx.o ionic_stats.o ionic_fw.o -ionic-$(CONFIG_PTP_1588_CLOCK) += ionic_phc.o
+       ionic_txrx.o ionic_stats.o ionic_fw.o ionic_phc.o

So we'd replace a build dependency..

Quoted 12 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +1 -0
index a87c87e86aef..30c78808c45a 100644
@@ -1,6 +1,8 @@
   // SPDX-License-Identifier: GPL-2.0
   /* Copyright(c) 2017 - 2021 Pensando Systems, Inc */
   +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+
   #include <linux/netdevice.h>
   #include <linux/etherdevice.h>
   @@ -613,3 +615,4 @@ void ionic_lif_free_phc(struct ionic_lif *lif)
Quoted 4 lines

      devm_kfree(lif->ionic->dev, lif->phc);
      lif->phc = NULL;
  }
+#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */

.. with an ifdef around an entire file? Does not feel very clean.

The construct of using:

    drv-$(CONFIG_PTP_1588_CLOCK) += ptp.o

seems relatively common, why does it now work here?

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

Maybe somehow the "ionic-y" confuses kbuild and it should be ionic-objs?

At the very least we need a better explanation in the commit message.

Quoted 8 lines
Quoted 2 lines

I'll take a look if someone can point me to the .config file.

These are the notes I got from kernel test robot:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/

At first glance it looks like Jakub's suggestion of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

is what is needed, but I'm still doing build testing ATM.

Signature · 1 line
~Randy
#5 lore raw
Quoted 55 lines · Randy Dunlap
Quoted 45 lines · Shannon Nelson
Quoted 44 lines · Randy Dunlap
Quoted 43 lines · Jakub Kicinski
Quoted 2 lines · On Wed,  5 May 2021 21:18:46 -0700 Shannon Nelson wrote:

Driver link failed with undefined references in some kernel config variations.

This is really vague and the patch is not very obvious.

Quoted 5 lines

  ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o ionic_dev.o \
         ionic_debugfs.o ionic_lif.o ionic_rx_filter.o ionic_ethtool.o \
-       ionic_txrx.o ionic_stats.o ionic_fw.o -ionic-$(CONFIG_PTP_1588_CLOCK) += ionic_phc.o
+       ionic_txrx.o ionic_stats.o ionic_fw.o ionic_phc.o

So we'd replace a build dependency..

Quoted 12 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +1 -0
index a87c87e86aef..30c78808c45a 100644
@@ -1,6 +1,8 @@
   // SPDX-License-Identifier: GPL-2.0
   /* Copyright(c) 2017 - 2021 Pensando Systems, Inc */
   +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+
   #include <linux/netdevice.h>
   #include <linux/etherdevice.h>
   @@ -613,3 +615,4 @@ void ionic_lif_free_phc(struct ionic_lif *lif)
Quoted 4 lines

      devm_kfree(lif->ionic->dev, lif->phc);
      lif->phc = NULL;
  }
+#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */

.. with an ifdef around an entire file? Does not feel very clean.

The construct of using:

    drv-$(CONFIG_PTP_1588_CLOCK) += ptp.o

seems relatively common, why does it now work here?

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

Maybe somehow the "ionic-y" confuses kbuild and it should be ionic-objs?

At the very least we need a better explanation in the commit message.

Quoted 8 lines
Quoted 2 lines

I'll take a look if someone can point me to the .config file.

These are the notes I got from kernel test robot:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/

Quoted 5 lines

At first glance it looks like Jakub's suggestion of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

is what is needed, but I'm still doing build testing ATM.

Nope, eat my words. These build issues are not about PTP. I'm still looking.

Signature · 1 line
~Randy
#6 lore raw
Quoted 8 lines · Randy Dunlap
Quoted 7 lines · Randy Dunlap
Quoted 6 lines · Shannon Nelson
Quoted 5 lines · Randy Dunlap
Quoted 4 lines · Jakub Kicinski
Quoted 2 lines · On Wed,  5 May 2021 21:18:46 -0700 Shannon Nelson wrote:

Driver link failed with undefined references in some kernel config variations.

This is really vague and the patch is not very obvious.

When IONIC=y and PTP_1588_CLOCK=m...

Quoted 47 lines
Quoted 47 lines
Quoted 46 lines
Quoted 31 lines
Quoted 31 lines
Quoted 5 lines

  ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o ionic_dev.o \
         ionic_debugfs.o ionic_lif.o ionic_rx_filter.o ionic_ethtool.o \
-       ionic_txrx.o ionic_stats.o ionic_fw.o -ionic-$(CONFIG_PTP_1588_CLOCK) += ionic_phc.o
+       ionic_txrx.o ionic_stats.o ionic_fw.o ionic_phc.o

So we'd replace a build dependency..

Quoted 12 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +1 -0
index a87c87e86aef..30c78808c45a 100644
@@ -1,6 +1,8 @@
   // SPDX-License-Identifier: GPL-2.0
   /* Copyright(c) 2017 - 2021 Pensando Systems, Inc */
   +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+
   #include <linux/netdevice.h>
   #include <linux/etherdevice.h>
   @@ -613,3 +615,4 @@ void ionic_lif_free_phc(struct ionic_lif *lif)
Quoted 4 lines

      devm_kfree(lif->ionic->dev, lif->phc);
      lif->phc = NULL;
  }
+#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */

.. with an ifdef around an entire file? Does not feel very clean.

The construct of using:

    drv-$(CONFIG_PTP_1588_CLOCK) += ptp.o

seems relatively common, why does it now work here?

Quoted 9 lines
Quoted 7 lines

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

Maybe somehow the "ionic-y" confuses kbuild and it should be ionic-objs?

At the very least we need a better explanation in the commit message.

I'll take a look if someone can point me to the .config file.

These are the notes I got from kernel test robot:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/

Quoted 8 lines
Quoted 5 lines

At first glance it looks like Jakub's suggestion of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

is what is needed, but I'm still doing build testing ATM.

Nope, eat my words. These build issues are not about PTP. I'm still looking.

I have been trying to go to fast.. slow down, wait for the old computer.

Back to Jakub's suggestion -- that works for me. (copy-paste, whitespace damaged)

drivers/net/ethernet/pensando/Kconfig +1 -0
@@ -20,6 +20,7 @@ if NET_VENDOR_PENSANDO
 config IONIC
        tristate "Pensando Ethernet IONIC Support"
        depends on 64BIT && PCI
+       depends on PTP_1588_CLOCK || !PTP_1588_CLOCK
        select NET_DEVLINK
        select DIMLIB
        help

If PTP_1588_CLOCK=m, the depends limits IONIC to =m (or disabled). If PTP_1588_CLOCK is disabled, IONIC can be any of y/m/n.

Signature · 1 line
~Randy
#7 lore raw
Quoted 78 lines · Randy Dunlap
Quoted 8 lines · Randy Dunlap
Quoted 7 lines · Randy Dunlap
Quoted 6 lines · Shannon Nelson
Quoted 5 lines · Randy Dunlap
Quoted 4 lines · Jakub Kicinski
Quoted 2 lines · On Wed,  5 May 2021 21:18:46 -0700 Shannon Nelson wrote:

Driver link failed with undefined references in some kernel config variations.

This is really vague and the patch is not very obvious.

When IONIC=y and PTP_1588_CLOCK=m...

Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
Quoted 31 lines
Quoted 31 lines
Quoted 5 lines

  ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o ionic_dev.o \
         ionic_debugfs.o ionic_lif.o ionic_rx_filter.o ionic_ethtool.o \
-       ionic_txrx.o ionic_stats.o ionic_fw.o -ionic-$(CONFIG_PTP_1588_CLOCK) += ionic_phc.o
+       ionic_txrx.o ionic_stats.o ionic_fw.o ionic_phc.o

So we'd replace a build dependency..

Quoted 6 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +0 -0
index a87c87e86aef..30c78808c45a 100644
@@ -1,6 +1,8 @@
   // SPDX-License-Identifier: GPL-2.0

drivers/net/ethernet/pensando/ionic/ionic_phc.c

Quoted 10 lines
drivers/net/ethernet/pensando/ionic/ionic_phc.c +2 -0
   /* Copyright(c) 2017 - 2021 Pensando Systems, Inc */
   +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+
   #include <linux/netdevice.h>
   #include <linux/etherdevice.h>
   @@ -613,3 +615,4 @@ void ionic_lif_free_phc(struct ionic_lif *lif)
       devm_kfree(lif->ionic->dev, lif->phc);
       lif->phc = NULL;
   }
+#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */

.. with an ifdef around an entire file? Does not feel very clean.

The construct of using:

    drv-$(CONFIG_PTP_1588_CLOCK) += ptp.o

seems relatively common, why does it now work here?

Quoted 9 lines
Quoted 7 lines

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

Maybe somehow the "ionic-y" confuses kbuild and it should be ionic-objs?

At the very least we need a better explanation in the commit message.

I'll take a look if someone can point me to the .config file.

These are the notes I got from kernel test robot:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/

Quoted 6 lines
Quoted 4 lines

At first glance it looks like Jakub's suggestion of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Maybe the config in question has PTP as a module and ionic built in? Then you should add depends on PTP_1588_CLOCK || !PTP_1588_CLOCK.

is what is needed, but I'm still doing build testing ATM.

Nope, eat my words. These build issues are not about PTP. I'm still looking.

I have been trying to go to fast.. slow down, wait for the old computer.

Back to Jakub's suggestion -- that works for me. (copy-paste, whitespace damaged)

drivers/net/ethernet/pensando/Kconfig +1 -0
@@ -20,6 +20,7 @@ if NET_VENDOR_PENSANDO
  config IONIC
         tristate "Pensando Ethernet IONIC Support"
         depends on 64BIT && PCI
+       depends on PTP_1588_CLOCK || !PTP_1588_CLOCK
         select NET_DEVLINK
         select DIMLIB
         help
Quoted 3 lines

If PTP_1588_CLOCK=m, the depends limits IONIC to =m (or disabled). If PTP_1588_CLOCK is disabled, IONIC can be any of y/m/n.

Thanks, I'll follow up with this.
sln