Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Madhvapathi Sriram <sriram.madhvapathi@gmail.com>
Cc: <netdev@vger.kernel.org>
Subject: Re: query : unregister/register netdev
Date: Fri, 18 Nov 2011 15:52:06 +0000	[thread overview]
Message-ID: <1321631526.2885.121.camel@deadeye> (raw)
In-Reply-To: <CAAvRe=jhfXEnLFkwbPmWEroDE-qHUpZ54TSSdw=WpmfPGZpsPQ@mail.gmail.com>

On Fri, 2011-11-18 at 17:53 +0530, Madhvapathi Sriram wrote:
> Hi,
> 
> In register_netdevice(), BUG_ON(dev->reg_state != NETREG_UNINITIALIZED) is
> used to check if the device that is being registered is indeed a new one.
> 
> However, I see that this state is never moved to. It only happens when a
> netdevice is allocated (by default to 0 using kzalloc).
> 
> So, the cycle register-->unregister-->register would fail since in the
> unregister_netdevice the state is only moved to NETREG_UNREGISTERED (at max
> to NETREG_RELEASED using free_netdev)
> 
> So, I presume that to reinitialize a netdevice one has to free the
> netdevice, re allocate netdevice and only then re register.
> 
> Wondering why unregister and reregister is not allowed, rather than having
> go through the free/alloc cycle - I am not an expert though.

Why do you think that would be useful?

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  reply	other threads:[~2011-11-18 15:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18 12:23 query : unregister/register netdev Madhvapathi Sriram
2011-11-18 15:52 ` Ben Hutchings [this message]
2011-11-18 16:22 ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2011-11-23 11:14 manoj bm

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=1321631526.2885.121.camel@deadeye \
    --to=bhutchings@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=sriram.madhvapathi@gmail.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