[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150510.194830.600095174408470043.davem@davemloft.net>
Date: Sun, 10 May 2015 19:48:30 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: linville@...driver.com
Cc: cwang@...pensource.com, netdev@...r.kernel.org, jesse@...ira.com,
azhou@...ira.com, stephen@...workplumber.org,
alexander.h.duyck@...hat.com
Subject: Re: [PATCH 5/5] geneve: add initial netdev driver for GENEVE
tunnels
From: "John W. Linville" <linville@...driver.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@...driver.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.
>> 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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists