All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ravb: Remove rx buffer ALIGN
@ 2016-04-24 16:16 Yoshihiro Kaneko
  2016-04-26 19:14 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Yoshihiro Kaneko @ 2016-04-24 16:16 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Sergei Shtylyov, Simon Horman, Magnus Damm,
	linux-renesas-soc

From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>

Aligning the reception data size is not required.

Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---

This patch is based on the master branch of David Miller's next networking
tree.

 drivers/net/ethernet/renesas/ravb_main.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 238b56f..66ed80c 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -246,10 +246,10 @@ static void ravb_ring_format(struct net_device *ndev, int q)
 	for (i = 0; i < priv->num_rx_ring[q]; i++) {
 		/* RX descriptor */
 		rx_desc = &priv->rx_ring[q][i];
-		/* The size of the buffer should be on 16-byte boundary. */
-		rx_desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16));
-		dma_addr = dma_map_single(ndev->dev.parent, priv->rx_skb[q][i]->data,
-					  ALIGN(PKT_BUF_SZ, 16),
+		rx_desc->ds_cc = cpu_to_le16(PKT_BUF_SZ);
+		dma_addr = dma_map_single(ndev->dev.parent,
+					  priv->rx_skb[q][i]->data,
+					  PKT_BUF_SZ,
 					  DMA_FROM_DEVICE);
 		/* We just set the data size to 0 for a failed mapping which
 		 * should prevent DMA from happening...
@@ -557,8 +557,9 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q)
 
 			skb = priv->rx_skb[q][entry];
 			priv->rx_skb[q][entry] = NULL;
-			dma_unmap_single(ndev->dev.parent, le32_to_cpu(desc->dptr),
-					 ALIGN(PKT_BUF_SZ, 16),
+			dma_unmap_single(ndev->dev.parent,
+					 le32_to_cpu(desc->dptr),
+					 PKT_BUF_SZ,
 					 DMA_FROM_DEVICE);
 			get_ts &= (q == RAVB_NC) ?
 					RAVB_RXTSTAMP_TYPE_V2_L2_EVENT :
@@ -588,8 +589,7 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q)
 	for (; priv->cur_rx[q] - priv->dirty_rx[q] > 0; priv->dirty_rx[q]++) {
 		entry = priv->dirty_rx[q] % priv->num_rx_ring[q];
 		desc = &priv->rx_ring[q][entry];
-		/* The size of the buffer should be on 16-byte boundary. */
-		desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16));
+		desc->ds_cc = cpu_to_le16(PKT_BUF_SZ);
 
 		if (!priv->rx_skb[q][entry]) {
 			skb = netdev_alloc_skb(ndev,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] ravb: Remove rx buffer ALIGN
  2016-04-24 16:16 [PATCH net-next] ravb: Remove rx buffer ALIGN Yoshihiro Kaneko
@ 2016-04-26 19:14 ` Sergei Shtylyov
  2016-04-28 23:34   ` Simon Horman
  2016-05-01 14:29   ` Yoshihiro Kaneko
  0 siblings, 2 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2016-04-26 19:14 UTC (permalink / raw)
  To: Yoshihiro Kaneko, netdev
  Cc: David S. Miller, Simon Horman, Magnus Damm, linux-renesas-soc

Hello.

On 04/24/2016 07:16 PM, Yoshihiro Kaneko wrote:

> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>
> Aligning the reception data size is not required.

    OK, the gen 2/3 manuals indeed don't require this. I assume the patch has 
been tested...

> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>

    I have a few comments though...

> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 238b56f..66ed80c 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -246,10 +246,10 @@ static void ravb_ring_format(struct net_device *ndev, int q)
>   	for (i = 0; i < priv->num_rx_ring[q]; i++) {
>   		/* RX descriptor */
>   		rx_desc = &priv->rx_ring[q][i];
> -		/* The size of the buffer should be on 16-byte boundary. */
> -		rx_desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16));
> -		dma_addr = dma_map_single(ndev->dev.parent, priv->rx_skb[q][i]->data,
> -					  ALIGN(PKT_BUF_SZ, 16),
> +		rx_desc->ds_cc = cpu_to_le16(PKT_BUF_SZ);
> +		dma_addr = dma_map_single(ndev->dev.parent,
> +					  priv->rx_skb[q][i]->data,

    Please don't reformat the lines above.

> +					  PKT_BUF_SZ,
>   					  DMA_FROM_DEVICE);
>   		/* We just set the data size to 0 for a failed mapping which
>   		 * should prevent DMA from happening...
> @@ -557,8 +557,9 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q)
>
>   			skb = priv->rx_skb[q][entry];
>   			priv->rx_skb[q][entry] = NULL;
> -			dma_unmap_single(ndev->dev.parent, le32_to_cpu(desc->dptr),
> -					 ALIGN(PKT_BUF_SZ, 16),
> +			dma_unmap_single(ndev->dev.parent,
> +					 le32_to_cpu(desc->dptr),

   Same here.

[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] ravb: Remove rx buffer ALIGN
  2016-04-26 19:14 ` Sergei Shtylyov
@ 2016-04-28 23:34   ` Simon Horman
  2016-05-01 14:34     ` Yoshihiro Kaneko
  2016-05-01 14:29   ` Yoshihiro Kaneko
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Horman @ 2016-04-28 23:34 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Yoshihiro Kaneko, netdev, David S. Miller, Magnus Damm,
	linux-renesas-soc

Hi Sergei, Hi Kaneko-san,

On Tue, Apr 26, 2016 at 10:14:41PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 04/24/2016 07:16 PM, Yoshihiro Kaneko wrote:
> 
> >From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> >
> >Aligning the reception data size is not required.
> 
>    OK, the gen 2/3 manuals indeed don't require this. I assume the patch has
> been tested...

This morning I tested this patch applied on net-next using the
r8a7795/salvator-x  (Gen-3). My test was to boot to a user-space prompt
using NFS root which was successful. I can run further tests on this setup
if it would be useful.

Unfortunately I do not have access to hardware to allow me to test this
on Gen-2.

> >Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> >Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>

Tested-by: Simon Horman <horms+renesas@verge.net.au>

>    I have a few comments though...

[...]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] ravb: Remove rx buffer ALIGN
  2016-04-26 19:14 ` Sergei Shtylyov
  2016-04-28 23:34   ` Simon Horman
@ 2016-05-01 14:29   ` Yoshihiro Kaneko
  1 sibling, 0 replies; 5+ messages in thread
From: Yoshihiro Kaneko @ 2016-05-01 14:29 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: netdev, David S. Miller, Simon Horman, Magnus Damm, linux-renesas-soc

Hi Sergei,

Sorry for the late reply.

2016-04-27 4:14 GMT+09:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
> On 04/24/2016 07:16 PM, Yoshihiro Kaneko wrote:
>
>> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>
>> Aligning the reception data size is not required.
>
>
>    OK, the gen 2/3 manuals indeed don't require this. I assume the patch has
> been tested...
>
>> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>
>
>    I have a few comments though...
>
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
>> b/drivers/net/ethernet/renesas/ravb_main.c
>> index 238b56f..66ed80c 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>> @@ -246,10 +246,10 @@ static void ravb_ring_format(struct net_device
>> *ndev, int q)
>>         for (i = 0; i < priv->num_rx_ring[q]; i++) {
>>                 /* RX descriptor */
>>                 rx_desc = &priv->rx_ring[q][i];
>> -               /* The size of the buffer should be on 16-byte boundary.
>> */
>> -               rx_desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16));
>> -               dma_addr = dma_map_single(ndev->dev.parent,
>> priv->rx_skb[q][i]->data,
>> -                                         ALIGN(PKT_BUF_SZ, 16),
>> +               rx_desc->ds_cc = cpu_to_le16(PKT_BUF_SZ);
>> +               dma_addr = dma_map_single(ndev->dev.parent,
>> +                                         priv->rx_skb[q][i]->data,
>
>
>    Please don't reformat the lines above.

Got it.

>
>> +                                         PKT_BUF_SZ,
>>                                           DMA_FROM_DEVICE);
>>                 /* We just set the data size to 0 for a failed mapping
>> which
>>                  * should prevent DMA from happening...
>> @@ -557,8 +557,9 @@ static bool ravb_rx(struct net_device *ndev, int
>> *quota, int q)
>>
>>                         skb = priv->rx_skb[q][entry];
>>                         priv->rx_skb[q][entry] = NULL;
>> -                       dma_unmap_single(ndev->dev.parent,
>> le32_to_cpu(desc->dptr),
>> -                                        ALIGN(PKT_BUF_SZ, 16),
>> +                       dma_unmap_single(ndev->dev.parent,
>> +                                        le32_to_cpu(desc->dptr),
>
>
>   Same here.

Likewise.

>
> [...]
>
> MBR, Sergei
>

Thanks,
kaneko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] ravb: Remove rx buffer ALIGN
  2016-04-28 23:34   ` Simon Horman
@ 2016-05-01 14:34     ` Yoshihiro Kaneko
  0 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Kaneko @ 2016-05-01 14:34 UTC (permalink / raw)
  To: Simon Horman
  Cc: Sergei Shtylyov, netdev, David S. Miller, Magnus Damm, linux-renesas-soc

Hi Simon-san,

Thank you for testing this patch!

Thanks,
kaneko

2016-04-29 8:34 GMT+09:00 Simon Horman <horms@verge.net.au>:
> Hi Sergei, Hi Kaneko-san,
>
> On Tue, Apr 26, 2016 at 10:14:41PM +0300, Sergei Shtylyov wrote:
>> Hello.
>>
>> On 04/24/2016 07:16 PM, Yoshihiro Kaneko wrote:
>>
>> >From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>> >
>> >Aligning the reception data size is not required.
>>
>>    OK, the gen 2/3 manuals indeed don't require this. I assume the patch has
>> been tested...
>
> This morning I tested this patch applied on net-next using the
> r8a7795/salvator-x  (Gen-3). My test was to boot to a user-space prompt
> using NFS root which was successful. I can run further tests on this setup
> if it would be useful.
>
> Unfortunately I do not have access to hardware to allow me to test this
> on Gen-2.
>
>> >Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>> >Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>
> Tested-by: Simon Horman <horms+renesas@verge.net.au>
>
>>    I have a few comments though...
>
> [...]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-01 14:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-24 16:16 [PATCH net-next] ravb: Remove rx buffer ALIGN Yoshihiro Kaneko
2016-04-26 19:14 ` Sergei Shtylyov
2016-04-28 23:34   ` Simon Horman
2016-05-01 14:34     ` Yoshihiro Kaneko
2016-05-01 14:29   ` Yoshihiro Kaneko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.