Skip to contentSkip to conversation

net/macb: increase RX buffer size for GEM

PATCH Superseded Ramon Fried 4 participants 10 messages Jul 14, 2019 – Aug 23, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification.

---
v2: Fix multi-line comment style

 drivers/net/macb.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/macb.c +22 -8
index c072f99d8f..3c8b9722b3 100644
@@ -45,10 +45,17 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define MACB_RX_BUFFER_SIZE		4096
-#define MACB_RX_RING_SIZE		(MACB_RX_BUFFER_SIZE / 128)
+/*
+ * These buffer sizes must be power of 2 and divisible
+ * by RX_BUFFER_MULTIPLE
+ */
+#define MACB_RX_BUFFER_SIZE		128
+#define GEM_RX_BUFFER_SIZE		2048
 #define RX_BUFFER_MULTIPLE		64
+
+#define MACB_RX_RING_SIZE		32
 #define MACB_TX_RING_SIZE		16
+
 #define MACB_TX_TIMEOUT		1000
 #define MACB_AUTONEG_TIMEOUT	5000000
 
@@ -95,6 +102,7 @@ struct macb_device {
 	void			*tx_buffer;
 	struct macb_dma_desc	*rx_ring;
 	struct macb_dma_desc	*tx_ring;
+	size_t			rx_buffer_size;
 
 	unsigned long		rx_buffer_dma;
 	unsigned long		rx_ring_dma;
@@ -395,15 +403,16 @@ static int _macb_recv(struct macb_device *macb, uchar **packetp)
 		}
 
 		if (status & MACB_BIT(RX_EOF)) {
-			buffer = macb->rx_buffer + 128 * macb->rx_tail;
+			buffer = macb->rx_buffer +
+				macb->rx_buffer_size * macb->rx_tail;
 			length = status & RXBUF_FRMLEN_MASK;
 
 			macb_invalidate_rx_buffer(macb);
 			if (macb->wrapped) {
 				unsigned int headlen, taillen;
 
-				headlen = 128 * (MACB_RX_RING_SIZE
-						 - macb->rx_tail);
+				headlen = macb->rx_buffer_size *
+					(MACB_RX_RING_SIZE - macb->rx_tail);
 				taillen = length - headlen;
 				memcpy((void *)net_rx_packets[0],
 				       buffer, headlen);
@@ -701,7 +710,7 @@ static void gmac_configure_dma(struct macb_device *macb)
 	u32 buffer_size;
 	u32 dmacfg;
 
-	buffer_size = 128 / RX_BUFFER_MULTIPLE;
+	buffer_size = macb->rx_buffer_size / RX_BUFFER_MULTIPLE;
 	dmacfg = gem_readl(macb, DMACFG) & ~GEM_BF(RXBS, -1L);
 	dmacfg |= GEM_BF(RXBS, buffer_size);
 
@@ -746,7 +755,7 @@ static int _macb_init(struct macb_device *macb, const char *name)
 			paddr |= MACB_BIT(RX_WRAP);
 		macb->rx_ring[i].addr = paddr;
 		macb->rx_ring[i].ctrl = 0;
-		paddr += 128;
+		paddr += macb->rx_buffer_size;
 	}
 	macb_flush_ring_desc(macb, RX);
 	macb_flush_rx_buffer(macb);
@@ -957,8 +966,13 @@ static void _macb_eth_initialize(struct macb_device *macb)
 	int id = 0;	/* This is not used by functions we call */
 	u32 ncfgr;
 
+	if (macb_is_gem(macb))
+		macb->rx_buffer_size = GEM_RX_BUFFER_SIZE;
+	else
+		macb->rx_buffer_size = MACB_RX_BUFFER_SIZE;
+
 	/* TODO: we need check the rx/tx_ring_dma is dcache line aligned */
-	macb->rx_buffer = dma_alloc_coherent(MACB_RX_BUFFER_SIZE,
+	macb->rx_buffer = dma_alloc_coherent(macb->rx_buffer_size * MACB_RX_RING_SIZE,
 					     &macb->rx_buffer_dma);
 	macb->rx_ring = dma_alloc_coherent(MACB_RX_DMA_DESC_SIZE,
 					   &macb->rx_ring_dma);
Signature · 1 line
2.22.0
#1 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

Quoted 9 lines · Ramon Fried

Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification.

#2 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

In reply to Ramon Fried
Quoted 9 lines · Ramon Fried

Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification.

Is there a dependency here that you don't mention? This doesn't apply cleanly.

Thanks,
-Joe

Quoted 97 lines

---
v2: Fix multi-line comment style

 drivers/net/macb.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/macb.c +22 -9
index c072f99d8f..3c8b9722b3 100644
@@ -45,10 +45,17 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define MACB_RX_BUFFER_SIZE            4096
-#define MACB_RX_RING_SIZE              (MACB_RX_BUFFER_SIZE / 128)
+/*
+ * These buffer sizes must be power of 2 and divisible
+ * by RX_BUFFER_MULTIPLE
+ */
+#define MACB_RX_BUFFER_SIZE            128
+#define GEM_RX_BUFFER_SIZE             2048
 #define RX_BUFFER_MULTIPLE             64
+
+#define MACB_RX_RING_SIZE              32
 #define MACB_TX_RING_SIZE              16
+
 #define MACB_TX_TIMEOUT                1000
 #define MACB_AUTONEG_TIMEOUT   5000000
 
@@ -95,6 +102,7 @@ struct macb_device {
        void                    *tx_buffer;
        struct macb_dma_desc    *rx_ring;
        struct macb_dma_desc    *tx_ring;
+       size_t                  rx_buffer_size;
 
        unsigned long           rx_buffer_dma;
        unsigned long           rx_ring_dma;
@@ -395,15 +403,16 @@ static int _macb_recv(struct macb_device *macb, uchar **packetp)
                }
 
                if (status & MACB_BIT(RX_EOF)) {
-                       buffer = macb->rx_buffer + 128 * macb->rx_tail;
+                       buffer = macb->rx_buffer +
+                               macb->rx_buffer_size * macb->rx_tail;
                        length = status & RXBUF_FRMLEN_MASK;
 
                        macb_invalidate_rx_buffer(macb);
                        if (macb->wrapped) {
                                unsigned int headlen, taillen;
 
-                               headlen = 128 * (MACB_RX_RING_SIZE
-                                                - macb->rx_tail);
+                               headlen = macb->rx_buffer_size *
+                                       (MACB_RX_RING_SIZE - macb->rx_tail);
                                taillen = length - headlen;
                                memcpy((void *)net_rx_packets[0],
                                       buffer, headlen);
@@ -701,7 +710,7 @@ static void gmac_configure_dma(struct macb_device *macb)
        u32 buffer_size;
        u32 dmacfg;
 
-       buffer_size = 128 / RX_BUFFER_MULTIPLE;
+       buffer_size = macb->rx_buffer_size / RX_BUFFER_MULTIPLE;
        dmacfg = gem_readl(macb, DMACFG) & ~GEM_BF(RXBS, -1L);
        dmacfg |= GEM_BF(RXBS, buffer_size);
 
@@ -746,7 +755,7 @@ static int _macb_init(struct macb_device *macb, const char *name)
                        paddr |= MACB_BIT(RX_WRAP);
                macb->rx_ring[i].addr = paddr;
                macb->rx_ring[i].ctrl = 0;
-               paddr += 128;
+               paddr += macb->rx_buffer_size;
        }
        macb_flush_ring_desc(macb, RX);
        macb_flush_rx_buffer(macb);
@@ -957,8 +966,13 @@ static void _macb_eth_initialize(struct macb_device *macb)
        int id = 0;     /* This is not used by functions we call */
        u32 ncfgr;
 
+       if (macb_is_gem(macb))
+               macb->rx_buffer_size = GEM_RX_BUFFER_SIZE;
+       else
+               macb->rx_buffer_size = MACB_RX_BUFFER_SIZE;
+
        /* TODO: we need check the rx/tx_ring_dma is dcache line aligned */
-       macb->rx_buffer = dma_alloc_coherent(MACB_RX_BUFFER_SIZE,
+       macb->rx_buffer = dma_alloc_coherent(macb->rx_buffer_size * MACB_RX_RING_SIZE,
                                             &macb->rx_buffer_dma);
        macb->rx_ring = dma_alloc_coherent(MACB_RX_DMA_DESC_SIZE,
                                           &macb->rx_ring_dma);
--

2.22.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

Quoted 10 lines · Joe Hershberger
Quoted 8 lines · Ramon Fried

Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification.

Quoted 4 lines
Quoted 1 line

Is there a dependency here that you don't mention? This doesn't apply cleanly.

It should be applied on my earlier macb patches.
Thanks,
Ramon

Quoted 3 lines

Thanks,
-Joe

#5 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

In reply to Ramon Fried

Hi Ramon,

Quoted 8 lines · Ramon Fried

Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification.

This patch breaks ethernet on my AT91SAM9G25 based board. With this patch now, tftp does not complete the xfer any more:

=> tftp 21000000 big
ethernet at f802c000: PHY present at 1
ethernet at f802c000: Starting autonegotiation... ethernet at f802c000: Autonegotiation complete ethernet at f802c000: link up, 100Mbps full-duplex (lpa: 0xc5e1) Using ethernet at f802c000 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.249 Filename 'big'.
Load address: 0x21000000
Loading: #T T

With this patch reverted (as well as with v2019.07), tftp works just fine.

I did not look into the patch yet. Perhaps you have a quick idea on why this breaks my platform.

BTW: When I disable the dcache (dcache off), tftp also works fine with this patch. So its definitely something cache / dma related.

Thanks,
Stefan

Quoted 91 lines

---
v2: Fix multi-line comment style

  drivers/net/macb.c | 30 ++++++++++++++++++++++--------
  1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/macb.c +22 -8
index c072f99d8f..3c8b9722b3 100644
@@ -45,10 +45,17 @@
 
  DECLARE_GLOBAL_DATA_PTR;
 
-#define MACB_RX_BUFFER_SIZE		4096
-#define MACB_RX_RING_SIZE		(MACB_RX_BUFFER_SIZE / 128)
+/*
+ * These buffer sizes must be power of 2 and divisible
+ * by RX_BUFFER_MULTIPLE
+ */
+#define MACB_RX_BUFFER_SIZE		128
+#define GEM_RX_BUFFER_SIZE		2048
  #define RX_BUFFER_MULTIPLE		64
+
+#define MACB_RX_RING_SIZE		32
  #define MACB_TX_RING_SIZE		16
+
  #define MACB_TX_TIMEOUT		1000
  #define MACB_AUTONEG_TIMEOUT	5000000
 
@@ -95,6 +102,7 @@ struct macb_device {
  	void			*tx_buffer;
  	struct macb_dma_desc	*rx_ring;
  	struct macb_dma_desc	*tx_ring;
+	size_t			rx_buffer_size;
 
  	unsigned long		rx_buffer_dma;
  	unsigned long		rx_ring_dma;
@@ -395,15 +403,16 @@ static int _macb_recv(struct macb_device *macb, uchar **packetp)
  		}
 
  		if (status & MACB_BIT(RX_EOF)) {
-			buffer = macb->rx_buffer + 128 * macb->rx_tail;
+			buffer = macb->rx_buffer +
+				macb->rx_buffer_size * macb->rx_tail;
  			length = status & RXBUF_FRMLEN_MASK;
 
  			macb_invalidate_rx_buffer(macb);
  			if (macb->wrapped) {
  				unsigned int headlen, taillen;
 
-				headlen = 128 * (MACB_RX_RING_SIZE
-						 - macb->rx_tail);
+				headlen = macb->rx_buffer_size *
+					(MACB_RX_RING_SIZE - macb->rx_tail);
  				taillen = length - headlen;
  				memcpy((void *)net_rx_packets[0],
  				       buffer, headlen);
@@ -701,7 +710,7 @@ static void gmac_configure_dma(struct macb_device *macb)
  	u32 buffer_size;
  	u32 dmacfg;
 
-	buffer_size = 128 / RX_BUFFER_MULTIPLE;
+	buffer_size = macb->rx_buffer_size / RX_BUFFER_MULTIPLE;
  	dmacfg = gem_readl(macb, DMACFG) & ~GEM_BF(RXBS, -1L);
  	dmacfg |= GEM_BF(RXBS, buffer_size);
 
@@ -746,7 +755,7 @@ static int _macb_init(struct macb_device *macb, const char *name)
  			paddr |= MACB_BIT(RX_WRAP);
  		macb->rx_ring[i].addr = paddr;
  		macb->rx_ring[i].ctrl = 0;
-		paddr += 128;
+		paddr += macb->rx_buffer_size;
  	}
  	macb_flush_ring_desc(macb, RX);
  	macb_flush_rx_buffer(macb);
@@ -957,8 +966,13 @@ static void _macb_eth_initialize(struct macb_device *macb)
  	int id = 0;	/* This is not used by functions we call */
  	u32 ncfgr;
 
+	if (macb_is_gem(macb))
+		macb->rx_buffer_size = GEM_RX_BUFFER_SIZE;
+	else
+		macb->rx_buffer_size = MACB_RX_BUFFER_SIZE;
+
  	/* TODO: we need check the rx/tx_ring_dma is dcache line aligned */
-	macb->rx_buffer = dma_alloc_coherent(MACB_RX_BUFFER_SIZE,
+	macb->rx_buffer = dma_alloc_coherent(macb->rx_buffer_size * MACB_RX_RING_SIZE,
  					     &macb->rx_buffer_dma);
  	macb->rx_ring = dma_alloc_coherent(MACB_RX_DMA_DESC_SIZE,
  					   &macb->rx_ring_dma);
#6 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

Quoted 26 lines · Stefan Roese

Hi Ramon,

Quoted 8 lines · Ramon Fried

Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification.

This patch breaks ethernet on my AT91SAM9G25 based board. With this patch now, tftp does not complete the xfer any more:

=> tftp 21000000 big
ethernet at f802c000: PHY present at 1
ethernet at f802c000: Starting autonegotiation... ethernet at f802c000: Autonegotiation complete ethernet at f802c000: link up, 100Mbps full-duplex (lpa: 0xc5e1) Using ethernet at f802c000 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.249 Filename 'big'.
Load address: 0x21000000
Loading: #T T

Quoted 9 lines

With this patch reverted (as well as with v2019.07), tftp works just fine.

I did not look into the patch yet. Perhaps you have a quick idea on why this breaks my platform.

BTW: When I disable the dcache (dcache off), tftp also works fine with this patch. So its definitely something cache / dma related.

Thanks for letting me know, I'll be next to a PC tomorrow, I'll look into it. Thanks,
Ramon

Quoted 100 lines

Thanks,
Stefan

drivers/net/macb.c static int _macb_recv(struct macb_device *macb,

Quoted 38 lines

---
v2: Fix multi-line comment style

  drivers/net/macb.c | 30 ++++++++++++++++++++++--------
  1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/macb.c +10 -2
index c072f99d8f..3c8b9722b3 100644
@@ -45,10 +45,17 @@
 
  DECLARE_GLOBAL_DATA_PTR;
 
-#define MACB_RX_BUFFER_SIZE		4096
-#define MACB_RX_RING_SIZE		(MACB_RX_BUFFER_SIZE / 128)
+/*
+ * These buffer sizes must be power of 2 and divisible
+ * by RX_BUFFER_MULTIPLE
+ */
+#define MACB_RX_BUFFER_SIZE		128
+#define GEM_RX_BUFFER_SIZE		2048
  #define RX_BUFFER_MULTIPLE		64
+
+#define MACB_RX_RING_SIZE		32
  #define MACB_TX_RING_SIZE		16
+
  #define MACB_TX_TIMEOUT		1000
  #define MACB_AUTONEG_TIMEOUT	5000000
 
@@ -95,6 +102,7 @@ struct macb_device {
  	void			*tx_buffer;
  	struct macb_dma_desc	*rx_ring;
  	struct macb_dma_desc	*tx_ring;
+	size_t			rx_buffer_size;
 
  	unsigned long		rx_buffer_dma;
  	unsigned long		rx_ring_dma;
@@ -395,15 +403,16 @@ static int _macb_recv(struct macb_device *macb,

uchar **packetp)

drivers/net/macb.c static void gmac_configure_dma(struct macb_device

Quoted 20 lines
drivers/net/macb.c +4 -3
  		}
 
  		if (status & MACB_BIT(RX_EOF)) {
-			buffer = macb->rx_buffer + 128 * macb->rx_tail;
+			buffer = macb->rx_buffer +
+				macb->rx_buffer_size * macb->rx_tail;
  			length = status & RXBUF_FRMLEN_MASK;
 
  			macb_invalidate_rx_buffer(macb);
  			if (macb->wrapped) {
  				unsigned int headlen, taillen;
 
-				headlen = 128 * (MACB_RX_RING_SIZE
-						 - macb->rx_tail);
+				headlen = macb->rx_buffer_size *
+					(MACB_RX_RING_SIZE - macb->rx_tail);
  				taillen = length - headlen;
  				memcpy((void *)net_rx_packets[0],
  				       buffer, headlen);
@@ -701,7 +710,7 @@ static void gmac_configure_dma(struct macb_device

*macb)

drivers/net/macb.c static int _macb_init(struct macb_device *macb,

Quoted 9 lines
drivers/net/macb.c +1 -1
  	u32 buffer_size;
  	u32 dmacfg;
 
-	buffer_size = 128 / RX_BUFFER_MULTIPLE;
+	buffer_size = macb->rx_buffer_size / RX_BUFFER_MULTIPLE;
  	dmacfg = gem_readl(macb, DMACFG) & ~GEM_BF(RXBS, -1L);
  	dmacfg |= GEM_BF(RXBS, buffer_size);
 
@@ -746,7 +755,7 @@ static int _macb_init(struct macb_device *macb,

const char *name)

drivers/net/macb.c static void _macb_eth_initialize(struct

Quoted 9 lines
drivers/net/macb.c +1 -1
  			paddr |= MACB_BIT(RX_WRAP);
  		macb->rx_ring[i].addr = paddr;
  		macb->rx_ring[i].ctrl = 0;
-		paddr += 128;
+		paddr += macb->rx_buffer_size;
  	}
  	macb_flush_ring_desc(macb, RX);
  	macb_flush_rx_buffer(macb);
@@ -957,8 +966,13 @@ static void _macb_eth_initialize(struct

macb_device *macb)

drivers/net/macb.c static void _macb_eth_initialize(struct macb_device *macb)

Quoted 9 lines
drivers/net/macb.c +5 -0
  	int id = 0;	/* This is not used by functions we call */
  	u32 ncfgr;
 
+	if (macb_is_gem(macb))
+		macb->rx_buffer_size = GEM_RX_BUFFER_SIZE;
+	else
+		macb->rx_buffer_size = MACB_RX_BUFFER_SIZE;
+
  	/* TODO: we need check the rx/tx_ring_dma is dcache line aligned

*/

drivers/net/macb.c static void _macb_eth_initialize(struct · line 975

Quoted 2 lines
drivers/net/macb.c +1 -1
-	macb->rx_buffer = dma_alloc_coherent(MACB_RX_BUFFER_SIZE,
+	macb->rx_buffer = dma_alloc_coherent(macb->rx_buffer_size *

MACB_RX_RING_SIZE,

Quoted 4 lines
drivers/net/macb.c +0 -0
  					     &macb->rx_buffer_dma);
  	macb->rx_ring = dma_alloc_coherent(MACB_RX_DMA_DESC_SIZE,
  					   &macb->rx_ring_dma);
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
#7 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

Hi Ramon,

Quoted 32 lines · Ramon Fried
Quoted 29 lines · Stefan Roese

Hi Ramon,

Quoted 8 lines · Ramon Fried

Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification.

This patch breaks ethernet on my AT91SAM9G25 based board. With this patch now, tftp does not complete the xfer any more:

=> tftp 21000000 big
ethernet at f802c000: PHY present at 1
ethernet at f802c000: Starting autonegotiation... ethernet at f802c000: Autonegotiation complete ethernet at f802c000: link up, 100Mbps full-duplex (lpa: 0xc5e1) Using ethernet at f802c000 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.249 Filename 'big'.
Load address: 0x21000000
Loading: #T T

With this patch reverted (as well as with v2019.07), tftp works just fine.

Quoted 8 lines
Quoted 6 lines

I did not look into the patch yet. Perhaps you have a quick idea on why this breaks my platform.

BTW: When I disable the dcache (dcache off), tftp also works fine with this patch. So its definitely something cache / dma related.

Thanks for letting me know, I'll be next to a PC tomorrow, I'll look into it.

I did look into this patch a bit and did not find any functional change for the non-GEM part I'm using. Hopefully I'll find some more time tomorrow to dig into this. If you spot something meanwhile, then even better. ;)

Thanks,
Stefan

#8 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

Quoted 42 lines · Stefan Roese

Hi Ramon,

Quoted 3 lines · Ramon Fried

On August 22, 2019 12:38:08 PM GMT+03:00, Stefan Roese

Quoted 35 lines · <[email protected]> wrote:
Quoted 35 lines

Hi Ramon,

Quoted 8 lines · Ramon Fried

Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure.
RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification.

This patch breaks ethernet on my AT91SAM9G25 based board. With this patch now, tftp does not complete the xfer any more:

=> tftp 21000000 big
ethernet at f802c000: PHY present at 1
ethernet at f802c000: Starting autonegotiation... ethernet at f802c000: Autonegotiation complete ethernet at f802c000: link up, 100Mbps full-duplex (lpa: 0xc5e1) Using ethernet at f802c000 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.249 Filename 'big'.
Load address: 0x21000000
Loading: #T T

With this patch reverted (as well as with v2019.07), tftp works just fine.

I did not look into the patch yet. Perhaps you have a quick idea on why this breaks my platform.

BTW: When I disable the dcache (dcache off), tftp also works fine with this patch. So its definitely something cache / dma related.

Quoted 7 lines
Quoted 2 lines

Thanks for letting me know, I'll be next to a PC tomorrow, I'll look into it.

I did look into this patch a bit and did not find any functional change for the non-GEM part I'm using. Hopefully I'll find some more time tomorrow to dig into this. If you spot something meanwhile, then even better. ;)

Are you sure this is the bad patch?
try master branch and bisect.
I would also make sure that your HW is doesn't identify as GEM. Thanks, Ramon

Quoted 3 lines

Thanks,
Stefan

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
#9 lore raw

PATCH v2 1/1 net/macb: increase RX buffer size for GEM

On 23.08.19 07:54, Ramon Fried wrote:

<snip>

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

BTW: When I disable the dcache (dcache off), tftp also works fine with this patch. So its definitely something cache / dma related.

Thanks for letting me know, I'll be next to a PC tomorrow, I'll look into it.

Quoted 6 lines
Quoted 4 lines

I did look into this patch a bit and did not find any functional change for the non-GEM part I'm using. Hopefully I'll find some more time tomorrow to dig into this. If you spot something meanwhile, then even better. ;)

Are you sure this is the bad patch?
try master branch and bisect.

I'm using master and this fails. When this patch in question is reverted, everything works fine. So yes, I'm sure that its this patch.

Quoted 1 line

I would also make sure that your HW is doesn't identify as GEM.

Yes. macb->rx_buffer_size is set to 128 as without this patch.

I'll look a bit more deeper into this problem later today.

Thanks,
Stefan