netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: David Miller <davem@davemloft.net>
Cc: cwang@twopensource.com, netdev@vger.kernel.org, jesse@nicira.com,
	azhou@nicira.com, stephen@networkplumber.org,
	alexander.h.duyck@redhat.com
Subject: Re: [PATCH 5/5] geneve: add initial netdev driver for GENEVE tunnels
Date: Mon, 11 May 2015 11:17:28 -0400	[thread overview]
Message-ID: <20150511151728.GB2838@tuxdriver.com> (raw)
In-Reply-To: <20150510.194830.600095174408470043.davem@davemloft.net>

On Sun, May 10, 2015 at 07:48:30PM -0400, David Miller wrote:
> From: "John W. Linville" <linville@tuxdriver.com>
> Date: Fri, 8 May 2015 19:22:36 -0400
> 
> > On Fri, May 08, 2015 at 01:55:15PM -0700, Cong Wang wrote:
> >> On Fri, May 8, 2015 at 10:20 AM, John W. Linville
> >> <linville@tuxdriver.com> wrote:
> >> > +
> >> > +/* Setup stats when device is created */
> >> > +static int geneve_init(struct net_device *dev)
> >> > +{
> >> > +       struct geneve_dev *geneve = netdev_priv(dev);
> >> > +
> >> > +       dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
> >> > +       if (!dev->tstats)
> >> > +               return -ENOMEM;
> >> > +
> >> > +       /* make new socket outside of RTNL */
> >> > +       dev_hold(dev);
> >> > +       queue_work(geneve_wq, &geneve->sock_work);
> >> > +
> >> 
> >> 
> >> Any reason to create socket in this init() rather than in ndo_open()?
> > 
> > The socket can be created asynchronously and ndo_open can fail if
> > the socket creation hasn't succeeded.
> 
> In what manner is the socket creation asynchronous here?  It
> synchronously returns success or failure as far as I can tell.

Well, I misspoke -- I meant to indicate "outside of RTNL".  But, I
have been bitten again by copying (an older version of) vxlan a bit
too closely.  I don't think I need to worry about the RTNL stuff at
socket open time for this driver.
 
> >> Ditto, ndo_stop().
> > 
> > I really don't see the point of the ndo_open/ndo_stop inquiry.
> > The socket creation seems analagous to device initialization to me.
> 
> It's about resource allocation.
> 
> Even in ethernet drivers, memory allocations such as those done for
> RX and TX rings are done at ->ndo_open and released at ->ndo_stop()
> time.
> 
> Therefore it's sort of reasonable to stretch that idea to how you
> will handle sockets here in the geneve driver.

Sure, thanks for laying it out for me!  I'll rework this bit, and
address some of the other comments raised by Cong Wang and Jesse
Gross and spin a v2.

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  reply	other threads:[~2015-05-11 15:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 17:20 [PATCH] add GENEVE netdev tunnel driver John W. Linville
2015-05-08 17:20 ` [PATCH 1/5] geneve: remove MODULE_ALIAS_RTNL_LINK from net/ipv4/geneve.c John W. Linville
2015-05-08 17:20 ` [PATCH 2/5] geneve: move definition of geneve_hdr() to geneve.h John W. Linville
2015-05-08 17:20 ` [PATCH 3/5] geneve: Rename support library as geneve_core John W. Linville
2015-05-08 17:20 ` [PATCH 4/5] geneve_core: identify as driver library in modules description John W. Linville
2015-05-08 17:20 ` [PATCH 5/5] geneve: add initial netdev driver for GENEVE tunnels John W. Linville
2015-05-08 20:55   ` Cong Wang
2015-05-08 23:22     ` John W. Linville
2015-05-10 23:48       ` David Miller
2015-05-11 15:17         ` John W. Linville [this message]
2015-05-08 23:19   ` Jesse Gross
2015-05-11 20:51   ` [PATCH v2 " John W. Linville
2015-05-13  3:06     ` David Miller
2015-05-13 16:53       ` John W. Linville
2015-05-08 17:27 ` [PATCH] iproute2: GENEVE support John W. Linville
2015-05-08 23:27   ` Jesse Gross
2015-05-11 18:47   ` [PATCH v2] " John W. Linville
2015-05-08 19:32 ` [PATCH] add GENEVE netdev tunnel driver Stephen Hemminger

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=20150511151728.GB2838@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=alexander.h.duyck@redhat.com \
    --cc=azhou@nicira.com \
    --cc=cwang@twopensource.com \
    --cc=davem@davemloft.net \
    --cc=jesse@nicira.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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).