net: print a notification on device rename
Subsystems (2)
PATCH 1/1 net: print a notification on device rename
Currently it's done silently (from the kernel part), and thus it might be hard to track the renames from logs.
Add a simple netdev_info() to notify the rename, but only in case the previous name was valid.
--- net/core/dev.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/dev.c +3 -0
@@ -1113,6 +1113,9 @@ int dev_change_name(struct net_device *dev, const char *newname)return err; } +if (oldname[0 ] && !strchr (oldname,'%' )) +netdev_info (dev,"renamed from %s\n" , oldname); + old_assign_type = dev->name_assign_type; dev->name_assign_type =NET_NAME_RENAMED ;
Signature · 1 line
1.8.4
Quoted 5 lines
Currently it's done silently (from the kernel part), and thus it might be hard to track the renames from logs.
Add a simple
netdev_info()to notify the rename, but only in case the previous name was valid.
Hi,
Why you're at it, perhaps we could also consider adding an optional ndo callback in the drivers to notify them of the device name change?
[e.g., multi-module dependencies where one would wish to inform the others of the name change]
Cheers,
Yuval
Quoted 18 lines
CC "David S. Miller" <[email protected]>CC Eric Dumazet <[email protected]>CC Vlad Yasevich <[email protected]>CC stephen hemminger <[email protected]>CC Jerry Chu <[email protected]>CC Ben Hutchings <[email protected]>CC David Laight <[email protected]>Signed-off-by Veaceslav Falico <[email protected]>--- net/core/dev.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/dev.c int dev_change_name(struct net_device *dev, const · line 1121
Quoted 9 lines
net/core/dev.c +3
-0@@ -1113,6 +1113,9 @@ int dev_change_name(struct net_device *dev, const char *newname)return err; } +if (oldname[0 ] && !strchr (oldname,'%' )) +netdev_info (dev,"renamed from %s\n" , oldname); + old_assign_type = dev->name_assign_type; dev->name_assign_type =NET_NAME_RENAMED ;
________________________________
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
Quoted 6 lines · Yuval Mintz
Quoted 5 lines
Currently it's done silently (from the kernel part), and thus it might be hard to track the renames from logs.
Add a simple
netdev_info()to notify the rename, but only in case the previous name was valid.
Quoted 6 lines
Hi,
Why you're at it, perhaps we could also consider adding an optional ndo callback in the drivers to notify them of the device name change?
[e.g., multi-module dependencies where one would wish to inform the others of the name change]
There's already one, I think:
1142 ret = call_netdevice_notifiers(NETDEV_CHANGENAME, dev);
It's also possible to block it. Or did you mean something else?
Thank you!
Quoted 35 lines
Cheers,
YuvalQuoted 18 lines
CC "David S. Miller" <[email protected]>CC Eric Dumazet <[email protected]>CC Vlad Yasevich <[email protected]>CC stephen hemminger <[email protected]>CC Jerry Chu <[email protected]>CC Ben Hutchings <[email protected]>CC David Laight <[email protected]>Signed-off-by Veaceslav Falico <[email protected]>--- net/core/dev.c | 3 +++ 1 file changed, 3 insertions(+)net/core/dev.c int dev_change_name(struct net_device *dev, const · line 1121
Quoted 9 lines
net/core/dev.c +3
-0@@ -1113,6 +1113,9 @@ int dev_change_name(struct net_device *dev, const char *newname)return err; } +if (oldname[0 ] && !strchr (oldname,'%' )) +netdev_info (dev,"renamed from %s\n" , oldname); + old_assign_type = dev->name_assign_type; dev->name_assign_type =NET_NAME_RENAMED ;________________________________
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
David Miller
maintainerFrom: Veaceslav Falico <[email protected]>
Date: Thu, 17 Jul 2014 20:33:32 +0200
Quoted 6 lines
Currently it's done silently (from the kernel part), and thus it might be hard to track the renames from logs.
Add a simple
netdev_info()to notify the rename, but only in case the previous name was valid.
Quoted 8 lines
CC "David S. Miller" <[email protected]>CC Eric Dumazet <[email protected]>CC Vlad Yasevich <[email protected]>CC stephen hemminger <[email protected]>CC Jerry Chu <[email protected]>CC Ben Hutchings <[email protected]>CC David Laight <[email protected]>Signed-off-by Veaceslav Falico <[email protected]>
This is fine, applied.
Quoted 18 lines
Cc: netdev; David Miller; Eric Dumazet; Vlad Yasevich; stephen hemminger; Jerry Chu; Ben Hutchings; David Laight
Subject: Re: [PATCH net-next] net: print a notification on device renameQuoted 6 lines · Yuval Mintz
Quoted 5 lines
Currently it's done silently (from the kernel part), and thus it might be hard to track the renames from logs.
Add a simple
netdev_info()to notify the rename, but only in case the previous name was valid.Quoted 6 lines
Hi,
Why you're at it, perhaps we could also consider adding an optional ndo callback in the drivers to notify them of the device name change? [e.g., multi-module dependencies where one would wish to inform the others of the name change]
Quoted 6 lines
There's already one, I think:
1142 ret =
call_netdevice_notifiers(NETDEV_CHANGENAME, dev);It's also possible to block it. Or did you mean something else?
I wasn't aware of the notifier, but although usable I've meant an actual .ndo to the device itself - under current implementation the device is oblivious to changes to its own name, and it's only method of getting a notification is by enlisting into the notifier chain and getting all sorts of notifications for all sort of devices.
[You're right my example was probably covered by the current implementation]
Although it might be debatable whether the device should actually care about its Name change.
Quoted 37 lines
Thank you!
Quoted 35 lines
Cheers,
YuvalQuoted 19 lines
CC "David S. Miller" <[email protected]>CC Eric Dumazet <[email protected]>CC Vlad Yasevich <[email protected]>CC stephen hemminger <[email protected]>CC Jerry Chu <[email protected]>CC Ben Hutchings <[email protected]>CC David Laight <[email protected]>Signed-off-by Veaceslav Falico <[email protected]>--- net/core/dev.c | 3 +++ 1 file changed, 3 insertions(+)net/core/dev.c index 239722a..d14ebf0 renamed from net/core/dev.c +0
-0100644
net/core/dev.c int dev_change_name(struct net_device *dev, · line 1121
Quoted 9 lines
net/core/dev.c +3
-0@@ -1113,6 +1113,9 @@ int dev_change_name(struct net_device *dev, const char *newname) return err; } +if (oldname[0 ] && !strchr (oldname,'%' )) +netdev_info (dev,"renamed from %s\n" , oldname); + old_assign_type = dev->name_assign_type; dev->name_assign_type =NET_NAME_RENAMED ;________________________________
Quoted 5 lines
Quoted 1 line
This message and any attached documents contain information from QLogic
Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
________________________________
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.