netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] sh_eth: RX buffer alignment fixes
@ 2015-10-23 21:44 Sergei Shtylyov
  2015-10-23 21:46 ` [PATCH 1/2] sh_eth: fix RX buffer size alignment Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-10-23 21:44 UTC (permalink / raw)
  To: netdev; +Cc: linux-sh

Hello.

   Here's a set of 2 patches against DaveM's 'net.git' repo which are the fixes
to the RX buffer size calculation.

[1/2] sh_eth: fix RX buffer size alignment
[2/2] sh_eth: fix RX buffer size calculation

MBR, Sergei


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

* [PATCH 1/2] sh_eth: fix RX buffer size alignment
  2015-10-23 21:44 [PATCH 0/2] sh_eth: RX buffer alignment fixes Sergei Shtylyov
@ 2015-10-23 21:46 ` Sergei Shtylyov
  2015-10-23 21:46 ` [PATCH 2/2] sh_eth: fix RX buffer size calculation Sergei Shtylyov
  2015-10-27  1:32 ` [PATCH 0/2] sh_eth: RX buffer alignment fixes David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-10-23 21:46 UTC (permalink / raw)
  To: netdev; +Cc: linux-sh

Both  Renesas R-Car and RZ/A1 manuals state that RX buffer  length must be
a multiple of 32 bytes, while the driver  only uses 16 byte granularity...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: net/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net/drivers/net/ethernet/renesas/sh_eth.c
@@ -1148,8 +1148,8 @@ static void sh_eth_ring_format(struct ne
 
 		/* RX descriptor */
 		rxdesc = &mdp->rx_ring[i];
-		/* The size of the buffer is a multiple of 16 bytes. */
-		rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
+		/* The size of the buffer is a multiple of 32 bytes. */
+		rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);
 		dma_addr = dma_map_single(&ndev->dev, skb->data,
 					  rxdesc->buffer_length,
 					  DMA_FROM_DEVICE);
@@ -1506,7 +1506,7 @@ static int sh_eth_rx(struct net_device *
 			if (mdp->cd->rpadir)
 				skb_reserve(skb, NET_IP_ALIGN);
 			dma_unmap_single(&ndev->dev, rxdesc->addr,
-					 ALIGN(mdp->rx_buf_sz, 16),
+					 ALIGN(mdp->rx_buf_sz, 32),
 					 DMA_FROM_DEVICE);
 			skb_put(skb, pkt_len);
 			skb->protocol = eth_type_trans(skb, ndev);
@@ -1524,8 +1524,8 @@ static int sh_eth_rx(struct net_device *
 	for (; mdp->cur_rx - mdp->dirty_rx > 0; mdp->dirty_rx++) {
 		entry = mdp->dirty_rx % mdp->num_rx_ring;
 		rxdesc = &mdp->rx_ring[entry];
-		/* The size of the buffer is 16 byte boundary. */
-		rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
+		/* The size of the buffer is 32 byte boundary. */
+		rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);
 
 		if (mdp->rx_skbuff[entry] == NULL) {
 			skb = netdev_alloc_skb(ndev, skbuff_size);


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

* [PATCH 2/2] sh_eth: fix RX buffer size calculation
  2015-10-23 21:44 [PATCH 0/2] sh_eth: RX buffer alignment fixes Sergei Shtylyov
  2015-10-23 21:46 ` [PATCH 1/2] sh_eth: fix RX buffer size alignment Sergei Shtylyov
@ 2015-10-23 21:46 ` Sergei Shtylyov
  2015-10-27  1:32 ` [PATCH 0/2] sh_eth: RX buffer alignment fixes David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-10-23 21:46 UTC (permalink / raw)
  To: netdev; +Cc: linux-sh

The RX buffer size calulation failed to account for the length granularity
(which is now 32 bytes)...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

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

Index: net/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net/drivers/net/ethernet/renesas/sh_eth.c
@@ -1127,7 +1127,7 @@ static void sh_eth_ring_format(struct ne
 	struct sh_eth_txdesc *txdesc = NULL;
 	int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring;
 	int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring;
-	int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;
+	int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;
 	dma_addr_t dma_addr;
 
 	mdp->cur_rx = 0;
@@ -1450,7 +1450,7 @@ static int sh_eth_rx(struct net_device *
 	struct sk_buff *skb;
 	u16 pkt_len = 0;
 	u32 desc_status;
-	int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;
+	int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;
 	dma_addr_t dma_addr;
 
 	boguscnt = min(boguscnt, *quota);

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

* Re: [PATCH 0/2] sh_eth: RX buffer alignment fixes
  2015-10-23 21:44 [PATCH 0/2] sh_eth: RX buffer alignment fixes Sergei Shtylyov
  2015-10-23 21:46 ` [PATCH 1/2] sh_eth: fix RX buffer size alignment Sergei Shtylyov
  2015-10-23 21:46 ` [PATCH 2/2] sh_eth: fix RX buffer size calculation Sergei Shtylyov
@ 2015-10-27  1:32 ` David Miller
  2015-10-29 19:58   ` Sergei Shtylyov
  2 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2015-10-27  1:32 UTC (permalink / raw)
  To: sergei.shtylyov; +Cc: netdev, linux-sh

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Sat, 24 Oct 2015 00:44:27 +0300

>    Here's a set of 2 patches against DaveM's 'net.git' repo which are the fixes
> to the RX buffer size calculation.
> 
> [1/2] sh_eth: fix RX buffer size alignment
> [2/2] sh_eth: fix RX buffer size calculation

Series applied, thanks.

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

* Re: [PATCH 0/2] sh_eth: RX buffer alignment fixes
  2015-10-27  1:32 ` [PATCH 0/2] sh_eth: RX buffer alignment fixes David Miller
@ 2015-10-29 19:58   ` Sergei Shtylyov
  0 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-10-29 19:58 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-sh

Hello.

On 10/27/2015 04:32 AM, David Miller wrote:

>>     Here's a set of 2 patches against DaveM's 'net.git' repo which are the fixes
>> to the RX buffer size calculation.
>>
>> [1/2] sh_eth: fix RX buffer size alignment
>> [2/2] sh_eth: fix RX buffer size calculation
>
> Series applied, thanks.

    Will you queue these for stable?
    (I have some more fixes brewing...) :-)

MBR, Sergei

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

end of thread, other threads:[~2015-10-29 19:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 21:44 [PATCH 0/2] sh_eth: RX buffer alignment fixes Sergei Shtylyov
2015-10-23 21:46 ` [PATCH 1/2] sh_eth: fix RX buffer size alignment Sergei Shtylyov
2015-10-23 21:46 ` [PATCH 2/2] sh_eth: fix RX buffer size calculation Sergei Shtylyov
2015-10-27  1:32 ` [PATCH 0/2] sh_eth: RX buffer alignment fixes David Miller
2015-10-29 19:58   ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).