[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170112.102102.2249793963798495642.davem@davemloft.net>
Date: Thu, 12 Jan 2017 10:21:02 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: horms+renesas@...ge.net.au
Cc: sergei.shtylyov@...entembedded.com, magnus.damm@...il.com,
netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH/RFC net] ravb: do not use zero-length alighment DMA
request
From: Simon Horman <horms+renesas@...ge.net.au>
Date: Thu, 12 Jan 2017 14:53:37 +0100
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 92d7692c840d..3b4d2504285e 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1508,6 +1508,8 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> buffer = PTR_ALIGN(priv->tx_align[q], DPTR_ALIGN) +
> entry / NUM_TX_DESC * DPTR_ALIGN;
> len = PTR_ALIGN(skb->data, DPTR_ALIGN) - skb->data;
> + if (len == 0)
> + len = skb->len > 4 ? 4 : skb->len;
> memcpy(buffer, skb->data, len);
> dma_addr = dma_map_single(ndev->dev.parent, buffer, len, DMA_TO_DEVICE);
> if (dma_mapping_error(ndev->dev.parent, dma_addr))
Assume len ends up being skb->len, then the second DMA mapping will be
made of zero length.
This code needs a bit of TLC.
Powered by blists - more mailing lists