Skip to contentSkip to conversation

Trivial print improvements in ndo_dflt_fdb_{add,del}

PATCH Applied Vladimir Oltean 2 participants 4 messages Jun 29, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Trivial print improvements in ndo_dflt_fdb_{add,del}

From: Vladimir Oltean <[email protected]>

These are some changes brought to the informational messages printed in the default .ndo_fdb_add and .ndo_fdb_del method implementations.

Vladimir Oltean (2):
net: use netdev_info in ndo_dflt_fdb_{add,del}
net: say "local" instead of "static" addresses in

    ndo_dflt_fdb_{add,del}
 net/core/rtnetlink.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 net: use netdev_info in ndo_dflt_fdb_{add,del}

From: Vladimir Oltean <[email protected]>

Use the more modern printk helper for network interfaces, which also contains information about the associated struct device, and results in overall shorter line lengths compared to printing an open-coded dev->name.

---
 net/core/rtnetlink.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/rtnetlink.c +3 -3
index 745965e49f78..ab11c9d5002b 100644
@@ -3947,12 +3947,12 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm,
 	 * implement its own handler for this.
 	 */
 	if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
-		pr_info("%s: FDB only supports static addresses\n", dev->name);
+		netdev_info(dev, "FDB only supports static addresses\n");
 		return err;
 	}
 
 	if (vid) {
-		pr_info("%s: vlans aren't supported yet for dev_uc|mc_add()\n", dev->name);
+		netdev_info(dev, "vlans aren't supported yet for dev_uc|mc_add()\n");
 		return err;
 	}
 
@@ -4086,7 +4086,7 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm,
 	 * implement its own handler for this.
 	 */
 	if (!(ndm->ndm_state & NUD_PERMANENT)) {
-		pr_info("%s: FDB only supports static addresses\n", dev->name);
+		netdev_info(dev, "FDB only supports static addresses\n");
 		return err;
 	}
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 net: say "local" instead of "static" addresses in ndo_dflt_fdb_{add,del}

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

"Static" is a loaded word, and probably not what the author meant when the code was written.

In particular, this looks weird:

$ bridge fdb add dev swp0 00:01:02:03:04:05 local        # totally fine, but
$ bridge fdb add dev swp0 00:01:02:03:04:05 static
[ 2020.708298] swp0: FDB only supports static addresses  # hmm what?

By looking at the implementation which uses dev_uc_add/dev_uc_del it is absolutely clear that only local addresses are supported, and the proper Network Unreachability Detection state is being used for this purpose (user space indeed sets NUD_PERMANENT when local addresses are meant). So it is just the message that is wrong, fix it.

---
 net/core/rtnetlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/rtnetlink.c +2 -2
index ab11c9d5002b..f6af3e74fc44 100644
@@ -3947,7 +3947,7 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm,
 	 * implement its own handler for this.
 	 */
 	if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
-		netdev_info(dev, "FDB only supports static addresses\n");
+		netdev_info(dev, "default FDB implementation only supports local addresses\n");
 		return err;
 	}
 
@@ -4086,7 +4086,7 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm,
 	 * implement its own handler for this.
 	 */
 	if (!(ndm->ndm_state & NUD_PERMANENT)) {
-		netdev_info(dev, "FDB only supports static addresses\n");
+		netdev_info(dev, "default FDB implementation only supports local addresses\n");
 		return err;
 	}
 
Signature · 1 line
2.25.1
#3 lore raw
In reply to Vladimir Oltean
This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 11 lines · On Tue, 29 Jun 2021 03:29:24 +0300 you wrote:

From: Vladimir Oltean <[email protected]>

These are some changes brought to the informational messages printed in the default .ndo_fdb_add and .ndo_fdb_del method implementations.

Vladimir Oltean (2):
net: use netdev_info in ndo_dflt_fdb_{add,del}
net: say "local" instead of "static" addresses in

    ndo_dflt_fdb_{add,del}

[...]

Here is the summary with links:
- [net-next,1/2] net: use netdev_info in ndo_dflt_fdb_{add,del}

    https://git.kernel.org/netdev/net-next/c/23ac0b421674
  - [net-next,2/2] net: say "local" instead of "static" addresses in ndo_dflt_fdb_{add,del}
    https://git.kernel.org/netdev/net-next/c/78ecc8903de2

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html