* [PATCH net-next v2 0/2] net: lan743x: cleanup netdev-based logging
@ 2026-05-27 18:18 David Thompson
2026-05-27 18:18 ` [PATCH net-next v2 1/2] net: lan743x: add "message level" module parameter David Thompson
2026-05-27 18:18 ` [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging before netdev registration David Thompson
0 siblings, 2 replies; 5+ messages in thread
From: David Thompson @ 2026-05-27 18:18 UTC (permalink / raw)
To: bryan.whitehead, UNGLinuxDriver, andrew+netdev, davem, edumazet,
kuba, pabeni
Cc: netdev, linux-kernel, David Thompson
This series improves netdev-based logging in the lan743x driver by
addressing the issue where several log entries at boot include the
warning "(unnamed net_device) (uninitialized)".
The first patch introduces a "message level" module parameter and uses
netif_msg_init(), allowing msg_enable to be configured at load time.
The second patch ensures that netdev-based logging is only used after
netdev registration has completed successfully.
v2:
- Added patch 1
- Changed target repo from "net" to "net-next"
David Thompson (2):
net: lan743x: add "message level" module parameter
net: lan743x: avoid netdev-based logging before netdev registration
drivers/net/ethernet/microchip/lan743x_main.c | 87 ++++++++++++-------
1 file changed, 57 insertions(+), 30 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v2 1/2] net: lan743x: add "message level" module parameter
2026-05-27 18:18 [PATCH net-next v2 0/2] net: lan743x: cleanup netdev-based logging David Thompson
@ 2026-05-27 18:18 ` David Thompson
2026-05-27 20:35 ` Jacob Keller
2026-05-27 18:18 ` [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging before netdev registration David Thompson
1 sibling, 1 reply; 5+ messages in thread
From: David Thompson @ 2026-05-27 18:18 UTC (permalink / raw)
To: bryan.whitehead, UNGLinuxDriver, andrew+netdev, davem, edumazet,
kuba, pabeni
Cc: netdev, linux-kernel, David Thompson
The lan743x driver currently hardcodes the initial value of the msg_enable
parameter during probe(), and uses this value for netdev message logging.
Instead, the driver should provide a "message level" module parameter to
allow users to configure the logging level at load time.
Signed-off-by: David Thompson <davthompson@nvidia.com>
---
v2:
- new patch added in v2
---
drivers/net/ethernet/microchip/lan743x_main.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index f3332417162e..793633cced19 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -28,6 +28,17 @@
#define RFE_RD_FIFO_TH_3_DWORDS 0x3
+#define LAN743X_DEF_MSG_ENABLE \
+ (NETIF_MSG_DRV | \
+ NETIF_MSG_PROBE | \
+ NETIF_MSG_LINK | \
+ NETIF_MSG_IFUP | \
+ NETIF_MSG_IFDOWN | \
+ NETIF_MSG_TX_QUEUED)
+static int lan743x_msg_enable = -1;
+module_param(lan743x_msg_enable, int, 0);
+MODULE_PARM_DESC(lan743x_msg_enable, "Debug message level");
+
static bool pci11x1x_is_a0(struct lan743x_adapter *adapter)
{
u32 dev_rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_;
@@ -3661,9 +3672,7 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, netdev);
adapter = netdev_priv(netdev);
adapter->netdev = netdev;
- adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE |
- NETIF_MSG_LINK | NETIF_MSG_IFUP |
- NETIF_MSG_IFDOWN | NETIF_MSG_TX_QUEUED;
+ adapter->msg_enable = netif_msg_init(lan743x_msg_enable, LAN743X_DEF_MSG_ENABLE);
netdev->max_mtu = LAN743X_MAX_FRAME_SIZE;
of_get_mac_address(pdev->dev.of_node, adapter->mac_address);
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging before netdev registration
2026-05-27 18:18 [PATCH net-next v2 0/2] net: lan743x: cleanup netdev-based logging David Thompson
2026-05-27 18:18 ` [PATCH net-next v2 1/2] net: lan743x: add "message level" module parameter David Thompson
@ 2026-05-27 18:18 ` David Thompson
2026-05-27 20:32 ` Jacob Keller
1 sibling, 1 reply; 5+ messages in thread
From: David Thompson @ 2026-05-27 18:18 UTC (permalink / raw)
To: bryan.whitehead, UNGLinuxDriver, andrew+netdev, davem, edumazet,
kuba, pabeni
Cc: netdev, linux-kernel, David Thompson
This patch updates the lan743x driver to prevent the use of netdev-based
logging APIs (such as netdev_dbg) before the network device has been
successfully registered. Using netdev-based logging prior to registration
results in log messages referencing "(unnamed net_device) (uninitialized)",
which can be confusing and less informative.
The driver must use netif_msg_ APIs and device-based logging (e.g. dev_dbg)
until netdev registration is complete. This ensures log entries are
associated with the correct device context and improves log clarity. After
registration, netdev-based logging APIs can be used safely.
Signed-off-by: David Thompson <davthompson@nvidia.com>
---
v2:
- Changed target repo from "net" to "net-next"
- Removed "Fixes" tag
---
drivers/net/ethernet/microchip/lan743x_main.c | 72 ++++++++++++-------
1 file changed, 45 insertions(+), 27 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 793633cced19..bca2f3d1ad41 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -119,9 +119,10 @@ static int lan743x_pci_init(struct lan743x_adapter *adapter,
if (ret)
goto return_error;
- netif_info(adapter, probe, adapter->netdev,
- "PCI: Vendor ID = 0x%04X, Device ID = 0x%04X\n",
- pdev->vendor, pdev->device);
+ if (netif_msg_probe(adapter))
+ pci_info(pdev,
+ "PCI: Vendor ID = 0x%04X, Device ID = 0x%04X\n",
+ pdev->vendor, pdev->device);
bars = pci_select_bars(pdev, IORESOURCE_MEM);
if (!test_bit(0, &bars))
goto disable_device;
@@ -203,10 +204,11 @@ static int lan743x_csr_init(struct lan743x_adapter *adapter)
csr->id_rev = lan743x_csr_read(adapter, ID_REV);
csr->fpga_rev = lan743x_csr_read(adapter, FPGA_REV);
- netif_info(adapter, probe, adapter->netdev,
- "ID_REV = 0x%08X, FPGA_REV = %d.%d\n",
- csr->id_rev, FPGA_REV_GET_MAJOR_(csr->fpga_rev),
- FPGA_REV_GET_MINOR_(csr->fpga_rev));
+ if (netif_msg_probe(adapter))
+ dev_info(&adapter->pdev->dev,
+ "ID_REV = 0x%08X, FPGA_REV = %d.%d\n",
+ csr->id_rev, FPGA_REV_GET_MAJOR_(csr->fpga_rev),
+ FPGA_REV_GET_MINOR_(csr->fpga_rev));
if (!ID_REV_IS_VALID_CHIP_ID_(csr->id_rev))
return -ENODEV;
@@ -964,8 +966,9 @@ int lan743x_sgmii_read(struct lan743x_adapter *adapter, u8 mmd, u16 addr)
u32 val;
if (mmd > 31) {
- netif_err(adapter, probe, adapter->netdev,
- "%s mmd should <= 31\n", __func__);
+ if (netif_msg_probe(adapter))
+ dev_err(&adapter->pdev->dev,
+ "%s mmd should <= 31\n", __func__);
return -EINVAL;
}
@@ -994,8 +997,9 @@ static int lan743x_sgmii_write(struct lan743x_adapter *adapter,
int ret;
if (mmd > 31) {
- netif_err(adapter, probe, adapter->netdev,
- "%s mmd should <= 31\n", __func__);
+ if (netif_msg_probe(adapter))
+ dev_err(&adapter->pdev->dev,
+ "%s mmd should <= 31\n", __func__);
return -EINVAL;
}
mutex_lock(&adapter->sgmii_rw_lock);
@@ -1226,8 +1230,14 @@ static void lan743x_mac_set_address(struct lan743x_adapter *adapter,
lan743x_csr_write(adapter, MAC_RX_ADDRH, addr_hi);
ether_addr_copy(adapter->mac_address, addr);
- netif_info(adapter, drv, adapter->netdev,
- "MAC address set to %pM\n", addr);
+ if (netif_msg_drv(adapter)) {
+ if (adapter->netdev->reg_state == NETREG_REGISTERED)
+ netdev_info(adapter->netdev,
+ "MAC address set to %pM\n", addr);
+ else
+ dev_info(&adapter->pdev->dev,
+ "MAC address set to %pM\n", addr);
+ }
}
static int lan743x_mac_init(struct lan743x_adapter *adapter)
@@ -1381,8 +1391,9 @@ static void lan743x_phy_interface_select(struct lan743x_adapter *adapter)
else
adapter->phy_interface = PHY_INTERFACE_MODE_RGMII;
- netif_dbg(adapter, drv, adapter->netdev,
- "selected phy interface: 0x%X\n", adapter->phy_interface);
+ if (netif_msg_drv(adapter))
+ dev_dbg(&adapter->pdev->dev,
+ "selected phy interface: 0x%X\n", adapter->phy_interface);
}
static void lan743x_rfe_open(struct lan743x_adapter *adapter)
@@ -3179,7 +3190,7 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
}
adapter->phylink = pl;
- netdev_dbg(netdev, "lan743x phylink created");
+ dev_dbg(&adapter->pdev->dev, "lan743x phylink created");
return 0;
}
@@ -3592,30 +3603,36 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
adapter->mdiobus->priv = (void *)adapter;
if (adapter->is_pci11x1x) {
if (adapter->is_sgmii_en) {
- netif_dbg(adapter, drv, adapter->netdev,
- "SGMII operation\n");
+ if (netif_msg_drv(adapter))
+ dev_dbg(&adapter->pdev->dev,
+ "SGMII operation\n");
adapter->mdiobus->read = lan743x_mdiobus_read_c22;
adapter->mdiobus->write = lan743x_mdiobus_write_c22;
adapter->mdiobus->read_c45 = lan743x_mdiobus_read_c45;
adapter->mdiobus->write_c45 = lan743x_mdiobus_write_c45;
adapter->mdiobus->name = "lan743x-mdiobus-c45";
- netif_dbg(adapter, drv, adapter->netdev,
- "lan743x-mdiobus-c45\n");
+ if (netif_msg_drv(adapter))
+ dev_dbg(&adapter->pdev->dev,
+ "lan743x-mdiobus-c45\n");
} else {
- netif_dbg(adapter, drv, adapter->netdev,
- "RGMII operation\n");
+ if (netif_msg_drv(adapter))
+ dev_dbg(&adapter->pdev->dev,
+ "RGMII operation\n");
// Only C22 support when RGMII I/F
adapter->mdiobus->read = lan743x_mdiobus_read_c22;
adapter->mdiobus->write = lan743x_mdiobus_write_c22;
adapter->mdiobus->name = "lan743x-mdiobus";
- netif_dbg(adapter, drv, adapter->netdev,
- "lan743x-mdiobus\n");
+ if (netif_msg_drv(adapter))
+ dev_dbg(&adapter->pdev->dev,
+ "lan743x-mdiobus\n");
}
} else {
adapter->mdiobus->read = lan743x_mdiobus_read_c22;
adapter->mdiobus->write = lan743x_mdiobus_write_c22;
adapter->mdiobus->name = "lan743x-mdiobus";
- netif_dbg(adapter, drv, adapter->netdev, "lan743x-mdiobus\n");
+ if (netif_msg_drv(adapter))
+ dev_dbg(&adapter->pdev->dev,
+ "lan743x-mdiobus\n");
}
snprintf(adapter->mdiobus->id, MII_BUS_ID_SIZE,
@@ -3705,8 +3722,9 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev,
ret = lan743x_phylink_create(adapter);
if (ret < 0) {
- netif_err(adapter, probe, netdev,
- "failed to setup phylink (%d)\n", ret);
+ if (netif_msg_probe(adapter))
+ dev_err(&pdev->dev,
+ "failed to setup phylink (%d)\n", ret);
goto cleanup_mdiobus;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging before netdev registration
2026-05-27 18:18 ` [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging before netdev registration David Thompson
@ 2026-05-27 20:32 ` Jacob Keller
0 siblings, 0 replies; 5+ messages in thread
From: Jacob Keller @ 2026-05-27 20:32 UTC (permalink / raw)
To: David Thompson, bryan.whitehead, UNGLinuxDriver, andrew+netdev,
davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel
On 5/27/2026 11:18 AM, David Thompson wrote:
> This patch updates the lan743x driver to prevent the use of netdev-based
> logging APIs (such as netdev_dbg) before the network device has been
> successfully registered. Using netdev-based logging prior to registration
> results in log messages referencing "(unnamed net_device) (uninitialized)",
> which can be confusing and less informative.
>
> The driver must use netif_msg_ APIs and device-based logging (e.g. dev_dbg)
> until netdev registration is complete. This ensures log entries are
> associated with the correct device context and improves log clarity. After
> registration, netdev-based logging APIs can be used safely.
>
> Signed-off-by: David Thompson <davthompson@nvidia.com>
> ---
> v2:
> - Changed target repo from "net" to "net-next"
> - Removed "Fixes" tag
> ---
> drivers/net/ethernet/microchip/lan743x_main.c | 72 ++++++++++++-------
> 1 file changed, 45 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index 793633cced19..bca2f3d1ad41 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -119,9 +119,10 @@ static int lan743x_pci_init(struct lan743x_adapter *adapter,
> if (ret)
> goto return_error;
>
> - netif_info(adapter, probe, adapter->netdev,
> - "PCI: Vendor ID = 0x%04X, Device ID = 0x%04X\n",
> - pdev->vendor, pdev->device);
> + if (netif_msg_probe(adapter))
> + pci_info(pdev,
> + "PCI: Vendor ID = 0x%04X, Device ID = 0x%04X\n",
> + pdev->vendor, pdev->device);
Do you really need to check netif_msg here? I guess it keeps the log
from being cluttered based on the message levels enabled. I would
probably just do dev_dbg() for all of these and let users use dynamic
debugging to enable/disable precisely which messages they want instead
of the message_enable bits.
Also, sometimes you use pci_info and other times you use dev_info. Why
not be consistent?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2 1/2] net: lan743x: add "message level" module parameter
2026-05-27 18:18 ` [PATCH net-next v2 1/2] net: lan743x: add "message level" module parameter David Thompson
@ 2026-05-27 20:35 ` Jacob Keller
0 siblings, 0 replies; 5+ messages in thread
From: Jacob Keller @ 2026-05-27 20:35 UTC (permalink / raw)
To: David Thompson, bryan.whitehead, UNGLinuxDriver, andrew+netdev,
davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel
On 5/27/2026 11:18 AM, David Thompson wrote:
> The lan743x driver currently hardcodes the initial value of the msg_enable
> parameter during probe(), and uses this value for netdev message logging.
> Instead, the driver should provide a "message level" module parameter to
> allow users to configure the logging level at load time.
>
> Signed-off-by: David Thompson <davthompson@nvidia.com>
> ---
> v2:
> - new patch added in v2
> ---
> drivers/net/ethernet/microchip/lan743x_main.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index f3332417162e..793633cced19 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -28,6 +28,17 @@
>
> #define RFE_RD_FIFO_TH_3_DWORDS 0x3
>
> +#define LAN743X_DEF_MSG_ENABLE \
> + (NETIF_MSG_DRV | \
> + NETIF_MSG_PROBE | \
> + NETIF_MSG_LINK | \
> + NETIF_MSG_IFUP | \
> + NETIF_MSG_IFDOWN | \
> + NETIF_MSG_TX_QUEUED)
> +static int lan743x_msg_enable = -1;
> +module_param(lan743x_msg_enable, int, 0);
> +MODULE_PARM_DESC(lan743x_msg_enable, "Debug message level");
> +
I guess many drivers have msg_enable parameters already so this isn't
"new", but the netdev maintainers have frowned on adding any module
parameters for years.
You could handle this by just always using the dynamic debug capability
instead of the netdev msg_enable infrastructure, but the driver does
already use this infrastructure heavily, so I guess it makes sense to
expose it and allow changing the settings during early init prior to
when the netdevice is available to userspace..
Since this is a relatively common module parameter and not something
"new" or trying to do anything other than aid in debugging I suppose
this is likely acceptable.
Thanks,
Jake
> static bool pci11x1x_is_a0(struct lan743x_adapter *adapter)
> {
> u32 dev_rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_;
> @@ -3661,9 +3672,7 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev,
> pci_set_drvdata(pdev, netdev);
> adapter = netdev_priv(netdev);
> adapter->netdev = netdev;
> - adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE |
> - NETIF_MSG_LINK | NETIF_MSG_IFUP |
> - NETIF_MSG_IFDOWN | NETIF_MSG_TX_QUEUED;
> + adapter->msg_enable = netif_msg_init(lan743x_msg_enable, LAN743X_DEF_MSG_ENABLE);
> netdev->max_mtu = LAN743X_MAX_FRAME_SIZE;
>
> of_get_mac_address(pdev->dev.of_node, adapter->mac_address);
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-27 20:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-27 18:18 [PATCH net-next v2 0/2] net: lan743x: cleanup netdev-based logging David Thompson
2026-05-27 18:18 ` [PATCH net-next v2 1/2] net: lan743x: add "message level" module parameter David Thompson
2026-05-27 20:35 ` Jacob Keller
2026-05-27 18:18 ` [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging before netdev registration David Thompson
2026-05-27 20:32 ` Jacob Keller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox