[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200110183328.219ed2bd@carbon>
Date: Fri, 10 Jan 2020 18:33:28 +0100
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: Ilias Apalodimas <ilias.apalodimas@...aro.org>,
netdev@...r.kernel.org, davem@...emloft.net,
lorenzo.bianconi@...hat.com, brouer@...hat.com
Subject: Re: [PATCH v2 net-next] net: socionext: get rid of huge dma sync in
netsec_alloc_rx_data
On Fri, 10 Jan 2020 16:34:13 +0100
Lorenzo Bianconi <lorenzo@...nel.org> wrote:
> > On Fri, Jan 10, 2020 at 02:57:44PM +0100, Lorenzo Bianconi wrote:
> > > Socionext driver can run on dma coherent and non-coherent devices.
> > > Get rid of huge dma_sync_single_for_device in netsec_alloc_rx_data since
> > > now the driver can let page_pool API to managed needed DMA sync
> > >
> > > Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> > > ---
> > > Changes since v1:
> > > - rely on original frame size for dma sync
> > > ---
> > > drivers/net/ethernet/socionext/netsec.c | 43 +++++++++++++++----------
> > > 1 file changed, 26 insertions(+), 17 deletions(-)
> > >
>
> [...]
>
> > > @@ -883,6 +881,8 @@ static u32 netsec_xdp_xmit_back(struct netsec_priv *priv, struct xdp_buff *xdp)
> > > static u32 netsec_run_xdp(struct netsec_priv *priv, struct bpf_prog *prog,
> > > struct xdp_buff *xdp)
> > > {
> > > + struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_RX];
> > > + unsigned int len = xdp->data_end - xdp->data;
> >
> > We need to account for XDP expanding the headers as well here.
> > So something like max(xdp->data_end(before bpf), xdp->data_end(after bpf)) -
> > xdp->data (original)
>
> correct, the corner case that is not covered at the moment is when data_end is
> moved forward by the bpf program. I will fix it in v3. Thx
Maybe we can simplify do:
void *data_start = NETSEC_RXBUF_HEADROOM + xdp->data_hard_start;
unsigned int len = xdp->data_end - data_start;
The cache-lines that need to be flushed/synced for_device is the area
used by NIC DMA engine. We know it will always start at a certain
point (given driver configured hardware to this).
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists