[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PAXPR04MB918581FFA58483608B3A7DCA89379@PAXPR04MB9185.eurprd04.prod.outlook.com>
Date: Mon, 31 Oct 2022 18:34:02 +0000
From: Shenwei Wang <shenwei.wang@....com>
To: Andrew Lunn <andrew@...n.ch>
CC: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>,
kernel test robot <lkp@...el.com>
Subject: RE: [EXT] Re: [PATCH v2 1/1] net: fec: add initial XDP support
> -----Original Message-----
> From: Andrew Lunn <andrew@...n.ch>
> Sent: Monday, October 31, 2022 12:10 PM
> To: Shenwei Wang <shenwei.wang@....com>
> > + cbd_base = rxq->bd.base;
> > + if (bpf->prog)
> > + rxq->bd.ring_size = XDP_RX_RING_SIZE;
> > + else
> > + rxq->bd.ring_size = RX_RING_SIZE;
> > + size = dsize * rxq->bd.ring_size;
> > + cbd_base = (struct bufdesc *)(((void *)cbd_base) + size);
> > + rxq->bd.last = (struct bufdesc *)(((void
> > + *)cbd_base) - dsize);
>
> This does not look safe. netif_tx_disable(dev) will stop new transmissions, but
> the hardware can be busy receiving, DMAing frames, using the descriptors, etc.
> Modifying rxq->bd.last in particular seems risky. I think you need to disable the
> receiver, wait for it to indicate it really has stopped, and only then make these
> modifications.
>
Sounds reasonable. How about moving the codes of updating ring size to the place
right after the enet reset inside the fec_restart? This should clear those risky corner
cases.
Thanks,
Shenwei
> Andrew
Powered by blists - more mailing lists