netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: print net_device name/state more often
@ 2014-07-17 11:28 Veaceslav Falico
  2014-07-17 11:28 ` [PATCH net-next 1/2] net: use dev->name in netdev_pr* when it's available Veaceslav Falico
  2014-07-17 11:28 ` [PATCH net-next 2/2] net: print net_device reg_state in netdev_* unless it's registered Veaceslav Falico
  0 siblings, 2 replies; 7+ messages in thread
From: Veaceslav Falico @ 2014-07-17 11:28 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Jason Baron, Eric Dumazet, Vlad Yasevich,
	stephen hemminger, Jerry Chu, Ben Hutchings, Veaceslav Falico

Hi,

Currently we use net_device->name only if it's the NETREG_REGISTERED
reg_state, otherwise we return "(unregistered device)".

However, we always populate net_device->name on creation, so it's always
available to us for use. The only caveat is that we might have a name like
"eth%d", in which case we cannot use it as it might change in the future.

Also, the net_device might not be NETREG_UNREGISTERED when the function is
called (_UNINITIALIZED, _UNREGISTERING, _RELEASED, _DUMMY), so it's
misleading.

So, a better way would be to always return the dev->name in netdev_name(),
unless it's in the form of "eth%d", then return "unnamed net_device". This
way we'll always return the name in NETREG_REGISTERED reg_state, and also
return it in other states, when possible.

Also, to be more verbose on non-NETREG_REGISTERED states, add a function
netdev_reg_state(), which returns a string describing the state, and use it
in netdev_printk()-related functions. If the dev is in NETREG_REGISTERED
state then a void string is regurned and, thus, nothing changes.

After these two patches we'll have the same behaviour in the usual cases,
and more verbose in non-standardad/buggy ones.

CC: "David S. Miller" <davem@davemloft.net>
CC: Jason Baron <jbaron@akamai.com>
CC: Eric Dumazet <edumazet@google.com>
CC: Vlad Yasevich <vyasevic@redhat.com>
CC: stephen hemminger <stephen@networkplumber.org>
CC: Jerry Chu <hkchu@google.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Veaceslav Falico <vfalico@gmail.com>

---
 include/linux/netdevice.h | 21 ++++++++++++++++++---
 lib/dynamic_debug.c       |  8 +++++---
 net/core/dev.c            |  8 +++++---
 3 files changed, 28 insertions(+), 9 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-17 14:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-17 11:28 [PATCH net-next 0/2] net: print net_device name/state more often Veaceslav Falico
2014-07-17 11:28 ` [PATCH net-next 1/2] net: use dev->name in netdev_pr* when it's available Veaceslav Falico
2014-07-17 13:48   ` Tom Gundersen
2014-07-17 14:01     ` Veaceslav Falico
2014-07-17 14:29       ` Tom Gundersen
2014-07-17 14:30         ` Veaceslav Falico
2014-07-17 11:28 ` [PATCH net-next 2/2] net: print net_device reg_state in netdev_* unless it's registered Veaceslav Falico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).