[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BY2PR07MB486FCC30E2D888F074697C9FE6B0@BY2PR07MB486.namprd07.prod.outlook.com>
Date: Fri, 19 Dec 2014 22:39:47 +0000
From: "Chickles, Derek" <Derek.Chickles@...iumnetworks.com>
To: Lino Sanfilippo <LinoSanfilippo@....de>,
"Vatsavayi, Raghu" <Raghu.Vatsavayi@...iumnetworks.com>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"Burla, Satananda" <Satananda.Burla@...iumnetworks.com>,
"Manlunas, Felix" <Felix.Manlunas@...iumnetworks.com>,
"Vatsavayi, Raghu" <Raghu.Vatsavayi@...iumnetworks.com>
Subject: RE: [PATCH net-next v3] Add support of Cavium Liquidio ethernet
adapters
> On 19.12.2014 04:25, Raghu Vatsavayi wrote:
> > +static int setup_nic_devices(struct octeon_device *octeon_dev)
> > +{
...
> > +
> > + sc = kmalloc(sizeof(*sc), GFP_ATOMIC);
> > + if (!sc)
> > + return -ENOMEM;
> > +
> > + resp = kmalloc(sizeof(*resp), GFP_KERNEL);
> > + if (!resp) {
> > + kfree(sc);
> > + return -ENOMEM;
> > + }
...
> > + init_waitqueue_head(&resp->s.wc);
...
> > +
> > + retval = octeon_send_soft_command(octeon_dev, sc);
> > + if (retval) {
> > + lio_dev_err(octeon_dev,
> > + "Link status instruction failed status: %x\n",
> > + retval);
> > + /* Soft instr is freed by driver in case of failure. */
> > + goto setup_nic_dev_fail;
> > + }
> > +
> > + /* Sleep on a wait queue till the cond flag indicates that the
> > + * response arrived or timed-out.
> > + */
> > + sleep_cond(&resp->s.wc, &resp->s.cond);
...
> > + kfree(sc);
> > + kfree(resp);
>
> I wonder if this is correct. AFAICS sc is the same memory that we put on
> the octeon_instr_queue (see send_soft_command() ->
> send_command()->add_to_nrlist()). Is that queue cleared before sc is
> freed?
>
>
Yes, it's correct. We wait for the response before exiting this loop with
that sleep_cond() call. This adds an entry to a wait_queue that is
serviced asynchronously and will return once it is complete.
--
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