Subject: Re: [PATCH v3 net-next] net: socionext: get rid of huge dma sync in netsec_alloc_rx_data

From: Jesper Dangaard Brouer <[email-masked]>
Date: Tue, 14 Jan 2020 11:59:02 +0100

On Tue, 14 Jan 2020 10:24:19 +0100
Lorenzo Bianconi <[email-masked]> 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
> 
> Reviewed-by: Ilias Apalodimas <[email-masked]>
> Signed-off-by: Lorenzo Bianconi <[email-masked]>
> ---
> Changes since v2:
> - fix checkpatch warnings
> 
> 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(-)
> 
> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
> index b5a9e947a4a8..6870a6ce76a6 100644
> --- a/drivers/net/ethernet/socionext/netsec.c
> +++ b/drivers/net/ethernet/socionext/netsec.c
[...]

> @@ -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;

This is correct because you calc len before BPF-prog can change these,
and because we can currently only shrink tail (data_end).

Acked-by: Jesper Dangaard Brouer <[email-masked]>

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer