diff mbox

net: ll_temac: Fix DMA map size bug

Message ID d76f13c52ce740544e8fac27f2a5904b9537a226.1431410298.git.michal.simek@xilinx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Simek May 12, 2015, 5:58 a.m. UTC
DMA allocates skb->len instead of headlen
which is used for DMA.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/ethernet/xilinx/ll_temac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Julia Lawall May 12, 2015, 6:03 a.m. UTC | #1
On Tue, 12 May 2015, Michal Simek wrote:

> DMA allocates skb->len instead of headlen
> which is used for DMA.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
>  drivers/net/ethernet/xilinx/ll_temac_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
> index ca640d04fd93..cfb6bdb37fdc 100644
> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> @@ -705,8 +705,8 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
>  
>  	cur_p->app0 |= STS_CTRL_APP0_SOP;
>  	cur_p->len = skb_headlen(skb);
> -	cur_p->phys = dma_map_single(ndev->dev.parent, skb->data, skb->len,
> -				     DMA_TO_DEVICE);
> +	cur_p->phys = dma_map_single(ndev->dev.parent, skb->data,
> +				skb_headlen(skb), DMA_TO_DEVICE);

I think you could align the later arguments with the right side of the 
parenthesis, as done in the original code.

julia



>  	cur_p->app4 = (unsigned long)skb;
>  
>  	for (ii = 0; ii < num_frag; ii++) {
> -- 
> 2.3.5
> 
>
Michal Simek May 12, 2015, 6:06 a.m. UTC | #2
On 05/12/2015 08:03 AM, Julia Lawall wrote:
> On Tue, 12 May 2015, Michal Simek wrote:
> 
>> DMA allocates skb->len instead of headlen
>> which is used for DMA.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>  drivers/net/ethernet/xilinx/ll_temac_main.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
>> index ca640d04fd93..cfb6bdb37fdc 100644
>> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
>> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
>> @@ -705,8 +705,8 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
>>  
>>  	cur_p->app0 |= STS_CTRL_APP0_SOP;
>>  	cur_p->len = skb_headlen(skb);
>> -	cur_p->phys = dma_map_single(ndev->dev.parent, skb->data, skb->len,
>> -				     DMA_TO_DEVICE);
>> +	cur_p->phys = dma_map_single(ndev->dev.parent, skb->data,
>> +				skb_headlen(skb), DMA_TO_DEVICE);
> 
> I think you could align the later arguments with the right side of the 
> parenthesis, as done in the original code.

Fixed and send v2.

Thanks,
Michal
diff mbox

Patch

diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index ca640d04fd93..cfb6bdb37fdc 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -705,8 +705,8 @@  static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
 	cur_p->app0 |= STS_CTRL_APP0_SOP;
 	cur_p->len = skb_headlen(skb);
-	cur_p->phys = dma_map_single(ndev->dev.parent, skb->data, skb->len,
-				     DMA_TO_DEVICE);
+	cur_p->phys = dma_map_single(ndev->dev.parent, skb->data,
+				skb_headlen(skb), DMA_TO_DEVICE);
 	cur_p->app4 = (unsigned long)skb;
 
 	for (ii = 0; ii < num_frag; ii++) {