[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DM6PR07MB492380ABB3821E02FBE6E16A9EE40@DM6PR07MB4923.namprd07.prod.outlook.com>
Date: Sat, 6 Oct 2018 05:01:49 +0000
From: "Goutham, Sunil" <Sunil.Goutham@...ium.com>
To: David Miller <davem@...emloft.net>,
"sunil.kovvuri@...il.com" <sunil.kovvuri@...il.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"arnd@...db.de" <arnd@...db.de>,
"linux-soc@...r.kernel.org" <linux-soc@...r.kernel.org>,
"sgoutham@...vell.com" <sgoutham@...vell.com>,
"amakarov@...vell.com" <amakarov@...vell.com>,
"lbartosik@...vell.com" <lbartosik@...vell.com>
Subject: RE: [EXT] Re: [PATCH v6 04/15] octeontx2-af: Add mailbox support
infra
> -----Original Message-----
> From: David Miller <davem@...emloft.net>
> Sent: 06 October 2018 03:21
> To: sunil.kovvuri@...il.com
> Cc: netdev@...r.kernel.org; arnd@...db.de; linux-soc@...r.kernel.org;
> sgoutham@...vell.com; amakarov@...vell.com; lbartosik@...vell.com
> Subject: [EXT] Re: [PATCH v6 04/15] octeontx2-af: Add mailbox support infra
>
>
> ----------------------------------------------------------------------
> From: sunil.kovvuri@...il.com
> Date: Thu, 4 Oct 2018 23:51:47 +0530
>
> > +int otx2_mbox_init(struct otx2_mbox *mbox, void *hwbase, struct
> pci_dev *pdev,
> > + void *reg_base, int direction, int ndevs) {
> > + int devid;
> > + struct otx2_mbox_dev *mdev;
>
> Please order local variable declarations from longest to shortest line.
>
> Please audit your entire series for this problem.
Sure, will fix this and re-submit.
>
> > +int otx2_mbox_busy_poll_for_rsp(struct otx2_mbox *mbox, int devid) {
> > + struct otx2_mbox_dev *mdev = &mbox->dev[devid];
> > + unsigned long timeout = jiffies + 1 * HZ;
> > +
> > + while (!time_after(jiffies, timeout)) {
> > + if (mdev->num_msgs == mdev->msgs_acked)
> > + return 0;
> > + cpu_relax();
> > + }
> > + return -EIO;
> > +}
>
> Probably not a good idea to poll something in the kernel for an entire
> second. Please add a preemption point like a usleep() or similar.
> cpu_relax() does not yield the cpu to the scheduler.
>
> Thank you.
APIs with both modes are added here i.e
otx2_mbox_wait_for_rsp() - which sleeps on every check as you suggested.
This API will be used 99% of the cases.
otx2_mbox_busy_poll_for_rsp() - This API is a busy poll one which is intended to be used in
cases where polling is not allowed. An example would be
' .ndo_set_rx_mode' when netdev driver has to change mode
It frames and sends mailbox message to this AF driver and busy polls
for response.
Thanks,
Sunil.
Powered by blists - more mailing lists