netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Veaceslav Falico <vfalico@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Jason Baron <jbaron@akamai.com>,
	Eric Dumazet <edumazet@google.com>,
	Vlad Yasevich <vyasevic@redhat.com>,
	stephen hemminger <stephen@networkplumber.org>,
	Jerry Chu <hkchu@google.com>,
	Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: [PATCH v2 net-next 2/2] net: print net_device reg_state in netdev_* unless it's registered
Date: Thu, 17 Jul 2014 19:27:41 +0200	[thread overview]
Message-ID: <20140717172741.GC20406@mikrodark.usersys.redhat.com> (raw)
In-Reply-To: <1405616424.12363.47.camel@joe-AO725>

On Thu, Jul 17, 2014 at 10:00:24AM -0700, Joe Perches wrote:
>On Thu, 2014-07-17 at 16:09 +0200, Veaceslav Falico wrote:
>> This way we'll always know in what status the device is, unless it's
>> running normally (i.e. NETDEV_REGISTERED).
>[]
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>[]
>> @@ -3388,6 +3388,20 @@ static inline const char *netdev_name(const struct net_device *dev)
>>  	return dev->name;
>>  }
>>
>> +static inline const char *netdev_reg_state(const struct net_device *dev)
>> +{
>> +	switch (dev->reg_state) {
>> +	case NETREG_UNINITIALIZED: return " (unregistered)";
>
>Why not " (uninitialized)"?

Good one, thank you, missed it somehow. Will send v2.

>
>> +	case NETREG_REGISTERED: return "";
>> +	case NETREG_UNREGISTERING: return " (unregistering)";
>> +	case NETREG_UNREGISTERED: return " (unregistered)";
>> +	case NETREG_RELEASED: return " (released)";
>> +	case NETREG_DUMMY: return " (dummy)";
>> +	}
>> +
>> +	return " (unknown)";
>
>Shouldn't this " (unknown)" have stronger text
>and use a WARN_ON_ONCE?

Hrm, I don't remember why, but I've specifically dropped the warning here.
Now it seems like a good idea, so I'll add it here.

>
>I'd put this in net/core/dev.c and make it not be static inline.

Again, I don't think it's really needed, as it's used in 4 functions (which
aren't inline), so the benefits are minimal, if any.

I'll rather keep them inline, I guess...

>
>

  reply	other threads:[~2014-07-17 17:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17 14:09 [PATCH v2 net-next 0/2] net: print net_device name/state more often Veaceslav Falico
2014-07-17 14:09 ` [PATCH v2 net-next 1/2] net: use dev->name in netdev_pr* when it's available Veaceslav Falico
2014-07-17 16:18   ` Joe Perches
2014-07-17 16:25     ` Veaceslav Falico
2014-07-17 16:36       ` Joe Perches
2014-07-17 16:38         ` Veaceslav Falico
2014-07-17 16:58           ` Joe Perches
2014-07-17 16:58             ` Veaceslav Falico
2014-07-17 14:09 ` [PATCH v2 net-next 2/2] net: print net_device reg_state in netdev_* unless it's registered Veaceslav Falico
2014-07-17 17:00   ` Joe Perches
2014-07-17 17:27     ` Veaceslav Falico [this message]
2014-07-17 14:48 ` [PATCH v2 net-next 0/2] net: print net_device name/state more often David Laight
2014-07-17 15:24   ` Veaceslav Falico
2014-07-17 15:25   ` Tom Gundersen
2014-07-17 15:27     ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140717172741.GC20406@mikrodark.usersys.redhat.com \
    --to=vfalico@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkchu@google.com \
    --cc=jbaron@akamai.com \
    --cc=joe@perches.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=vyasevic@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).