Skip to contentSkip to conversation

Stability of MPC5200 FEC

DISCUSSION Asier Llano Palacios 5 participants 6 messages Feb 10, 2006 – Feb 14, 2006 Network drivers

lore
Share & tools
lore
#0 lore raw

We are working with MPC5200 cpu.=20
We've been using it since early 2.6 kernel versions.
We're currently quite stabilished with the version of the kernel Sylvain had before the Platform Device rework. But the problem is that we are experiencing that the FEC stops working after a long uptime.

So, do you think that the current git version is more stable than the one we are using? Do you think that there is anything that could stop us upgrading to the latest version?

The problem is that we have a custom board, with some custom devices, so it is not so easy to upgrade. We need to know that a new version, is more stable than the previous one, before we upgrade. As soon as we upgrade, we can help if we find any problem.

Thank you,
Asier Llano

--=20
Asier Llano Palacios
ZIV I+D Smart Energy Networks
Dpto. Ingenier=EDa de Desarrollo.

ZIV, Aplicaciones y Tecnolog=EDa.
Parque Tecnol=F3gico, 210
48170 ZAMUDIO (Bizkaia)

E-mail: [email protected]
Tlfno: (+34)944037400=20
=20
----------------------------------------- PLEASE NOTE =
-------------------------------------------
This message, along with any attachments, may be confidential or legally = privileged.=20
It is intended only for the named person(s), who is/are the only = authorized recipients.
If this message has reached you in error, kindly destroy it without = review and notify the sender immediately.
Thank you for your help.
=B5SysCom uses virus scanning software but excludes any liability for = viruses contained in any attachment.
=20
------------------------------------ ROGAMOS LEA ESTE TEXTO =
-------------------------------
Este mensaje y sus anexos pueden contener informaci=F3n confidencial y/o = con derecho legal.=20
Est=E1 dirigido =FAnicamente a la/s persona/s o entidad/es rese=F1adas = como =FAnico destinatario autorizado.
Si este mensaje le hubiera llegado por error, por favor elim=EDnelo sin = revisarlo ni reenviarlo y notif=EDquelo inmediatamente al remitente. = Gracias por su colaboraci=F3n. =20
=B5SysCom utiliza software antivirus, pero no se hace responsable de los = virus contenidos en los ficheros anexos.

#1 lore raw

Do you have a lite5200 board that exhibits the same bad FEC behavior. If so you could try the new version on it and see if things improve.

Quoted 19 lines · Asier Llano Palacios

We are working with MPC5200 cpu. We've been using it since early 2.6 kernel versions. We're currently quite stabilished with the version of the kernel Sylvain had before the Platform Device rework. But the problem is that we are experiencing that the FEC stops working after a long uptime.

So, do you think that the current git version is more stable than the one we are using? Do you think that there is anything that could stop us upgrading to the latest version?

The problem is that we have a custom board, with some custom devices, so it is not so easy to upgrade. We need to know that a new version, is more stable than the previous one, before we upgrade. As soon as we upgrade, we can help if we find any problem.

Thank you,
Asier Llano

#2 lore raw
In reply to Asier Llano Palacios
Quoted 5 lines · Asier Llano Palacios

We are working with MPC5200 cpu.
We've been using it since early 2.6 kernel versions.
We're currently quite stabilished with the version of the kernel Sylvain had before the Platform Device rework. But the problem is that we are experiencing that the FEC stops working after a long uptime.

Did you ever observe that behavior on a lite5200 ?
What is 'long uptime' and do you have sustained transfer during that period ? (To try reproduice the problem).

Also, what are the 'symptoms' ? (anything in dmesg ?)

Quoted 3 lines

So, do you think that the current git version is more stable than the one we are using? Do you think that there is anything that could stop us upgrading to the latest version?

Doubtfull, I haven't touched the FEC code much except to remove the aligment code (newer bestcomm microcode doesn't require alignement of the skb). It should be reworked to use the generic phy code and remove some "bugs" (like the fact when we down the interface, we stop the task but not deactivate the MAC IIRC, which cause warning in dmesg).

You can send me the driver/net/fec_mpc52xx and arch/ppc/syslib/bestcomm you're using, I'll tell you if there was major changes.

Quoted 4 lines

The problem is that we have a custom board, with some custom devices, so it is not so easy to upgrade. We need to know that a new version, is more stable than the previous one, before we upgrade. As soon as we upgrade, we can help if we find any problem.

Sylvain

#3 lore raw
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 3 lines

had before the Platform Device rework. But the problem is that we are experiencing that the FEC stops working after a long uptime.

Did you ever observe that behavior on a lite5200 ?
What is 'long uptime' and do you have sustained transfer during that period ? (To try reproduice the problem).

This is a well-known problem, I'm afraid. To trigger it, it is usually (*) sufficient to transfer a large file (700 MB or so) over FTP to the target. Note that I've encountered the problem in the context of the 2.4 kernel.

(*) In some cases you can run several such transfers in a row without problem. Power-cycling the board will bring it back to "normal" mode.

It's probably Bestcomm related. See the previous discussions with Freescale about known issues with the 2.6 Bestcomm code.

Quoted 1 line

Also, what are the 'symptoms' ? (anything in dmesg ?)

No, nothing.

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
Like winter snow on summer lawn, time past is time gone.
#4 lore raw
In reply to Sylvain Munaut
Quoted 4 lines · Sylvain Munaut

Asier Llano Palacios wrote:
Did you ever observe that behavior on a lite5200 ?
What is 'long uptime' and do you have sustained transfer during that period ? (To try reproduice the problem).

Weeks uptime. We don't work with the lite5200 for so long time, but our board is based on a lite5200, and the FEC configuration is exactly equal.

Quoted 1 line

Also, what are the 'symptoms' ? (anything in dmesg ?)

FEC doesn't work at all, everything else works. If using a console I execute 'ifconfig eth0 down && ifconfig eth0 up <IP>' the fec starts working again.
I haven't reproduced it directly, but a partner and a customer. I'll try to reproduce this behaviour myself and bring back more information.

Quoted 6 lines

I haven't touched the FEC code much except to remove the aligment code (newer bestcomm microcode doesn't require alignement of the skb).

You can send me the driver/net/fec_mpc52xx and arch/ppc/syslib/bestcomm you're using, I'll tell you if there was major changes.

I've sent to you the patches that I extracted from your kernel source tree some time ago.
I have all the patches until the 1.2161 one. But I've only sent to you the ones related to the FEC and the bestcomm.

Signature · 23 lines
Asier Llano Palacios
ZIV I+D Smart Energy Networks
Dpto. Ingeniería de Desarrollo.

ZIV, Aplicaciones y Tecnología.
Parque Tecnológico, 210
48170 ZAMUDIO (Bizkaia)

E-mail: [email protected]
Tlfno: 944037400 
 
----------------------------------------- PLEASE NOTE -------------------------------------------
This message, along with any attachments, may be confidential or legally privileged. 
It is intended only for the named person(s), who is/are the only authorized recipients.
If this message has reached you in error, kindly destroy it without review and notify the sender immediately.
Thank you for your help.
µSysCom uses virus scanning software but excludes any liability for viruses contained in any attachment.
 
------------------------------------ ROGAMOS LEA ESTE TEXTO -------------------------------
Este mensaje y sus anexos pueden contener información confidencial y/o con derecho legal. 
Está dirigido únicamente a la/s persona/s o entidad/es reseñadas como único destinatario autorizado.
Si este mensaje le hubiera llegado por error, por favor elimínelo sin revisarlo ni reenviarlo y notifíquelo inmediatamente al remitente. Gracias por su colaboración.  
µSysCom utiliza software antivirus, pero no se hace responsable de los virus contenidos en los ficheros anexos.
arch/ppc/Kconfig +4 -0
diff -Nru a/arch/ppc/Kconfig b/arch/ppc/Kconfig
@@ -623,6 +623,10 @@
 config PPC_MPC52xx
 	bool
 
+config PPC_BESTCOMM
+	bool
+	depends on PPC_MPC52xx
+
 config 8260
 	bool "CPM2 Support" if WILLOW
 	depends on 6xx
arch/ppc/syslib/Makefile +1 -0
diff -Nru a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
@@ -88,3 +88,4 @@
 ifeq ($(CONFIG_PPC_MPC52xx),y)
 obj-$(CONFIG_PCI)		+= mpc52xx_pci.o
 endif
+obj-$(CONFIG_PPC_BESTCOMM)	+= bestcomm/
arch/ppc/syslib/bestcomm/Makefile new file +2 -0
diff -Nru a/arch/ppc/syslib/bestcomm/Makefile b/arch/ppc/syslib/bestcomm/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_PPC_BESTCOMM) 	+= bestcomm.o
+obj-$(CONFIG_FEC_MPC52xx)	+= sdma_fec_rx_task.o sdma_fec_tx_task.o fec.o
arch/ppc/syslib/bestcomm/bestcomm.c new file +248 -0

248 lines not on this page · raw message

arch/ppc/syslib/bestcomm/bestcomm.h new file +441 -0

441 lines not on this page · raw message

arch/ppc/syslib/bestcomm/fec.c new file +161 -0

161 lines not on this page · raw message

arch/ppc/syslib/bestcomm/fec.h new file +64 -0

64 lines not on this page · raw message

arch/ppc/syslib/bestcomm/sdma_fec_rx_task.c new file +52 -0

52 lines not on this page · raw message

arch/ppc/syslib/bestcomm/sdma_fec_tx_task.c new file +74 -0

74 lines not on this page · raw message

arch/ppc/platforms/lite5200.c +4 -0
diff -Nru a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
@@ -132,6 +132,10 @@
 	port_config &= ~0x00007000;     /* Differential mode - USB1 only */
 	port_config |=  0x00001000;
 
+	/* Ethernet port */
+	port_config &= ~0x000f0000;	/* 100 Mbits with MDIO lines */
+	port_config |=  0x00050000;
+
 	/* Commit port config */
 	out_be32(&gpio->port_config, port_config);
 
arch/ppc/platforms/mpc5200.c +7 -0
diff -Nru a/arch/ppc/platforms/mpc5200.c b/arch/ppc/platforms/mpc5200.c
@@ -54,6 +54,13 @@
 		.irq		= MPC52xx_USB_IRQ,
 		.pm		= OCP_CPM_NA,
 	}, 
+	{       
+		.vendor		= OCP_VENDOR_FREESCALE,
+		.function	= OCP_FUNC_FEC_MPC52xx,
+		.paddr		= MPC52xx_FEC,
+		.irq		= MPC52xx_FEC_IRQ,
+		.pm		= OCP_CPM_NA,
+	},   
 	{	/* Terminating entry */
 		.vendor		= OCP_VENDOR_INVALID
 	}
drivers/net/Kconfig +1 -0
diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig
@@ -1817,6 +1817,7 @@
 	  controller on the Renesas H8/300 processor.
 
 source "drivers/net/fec_8xx/Kconfig"
+source "drivers/net/fec_mpc52xx/Kconfig"
 
 endmenu
 
drivers/net/Makefile +1 -0
diff -Nru a/drivers/net/Makefile b/drivers/net/Makefile
@@ -182,6 +182,7 @@
 obj-$(CONFIG_S2IO) += s2io.o
 obj-$(CONFIG_SMC91X) += smc91x.o
 obj-$(CONFIG_FEC_8XX) += fec_8xx/
+obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx/
 
 obj-$(CONFIG_ARM) += arm/
 obj-$(CONFIG_NET_FC) += fc/
drivers/net/fec_mpc52xx/Kconfig new file +23 -0
diff -Nru a/drivers/net/fec_mpc52xx/Kconfig b/drivers/net/fec_mpc52xx/Kconfig
@@ -0,0 +1,23 @@
+menu "MPC5200 Networking Options"
+	depends PPC_MPC52xx && NET_ETHERNET
+
+config FEC_MPC52xx
+	bool "FEC Ethernet"
+	depends on NET_ETHERNET
+	select PPC_BESTCOMM
+	select CRC32
+	---help---
+	  This option enables support for the MPC5200's on-chip
+	  Fast Ethernet Controller
+
+config USE_MDIO
+	bool "  Use external Ethernet MII PHY"
+	select MII
+	depends FEC_MPC52xx
+	---help---
+	  The MPC5200's FEC can connect to the Ethernet either with
+	  an external MII PHY chip or 10 Mbps 7-wire interface 
+	  (Motorola? industry standard).
+	  If your board uses an external PHY, say y, else n.
+
+endmenu
drivers/net/fec_mpc52xx/Makefile new file +2 -0
diff -Nru a/drivers/net/fec_mpc52xx/Makefile b/drivers/net/fec_mpc52xx/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_FEC_MPC52xx) 	+= fec.o
+obj-$(CONFIG_USE_MDIO)		+= fec_phy.o
drivers/net/fec_mpc52xx/fec.c new file +791 -0

791 lines not on this page · raw message

drivers/net/fec_mpc52xx/fec.h new file +308 -0

308 lines not on this page · raw message

drivers/net/fec_mpc52xx/fec_phy.c new file +526 -0

526 lines not on this page · raw message

drivers/net/fec_mpc52xx/fec_phy.h new file +73 -0

73 lines not on this page · raw message

include/asm-ppc/ocp_ids.h +1 -0
diff -Nru a/include/asm-ppc/ocp_ids.h b/include/asm-ppc/ocp_ids.h
@@ -66,6 +66,7 @@
 /* Network 0x0200 - 0x02FF */
 #define OCP_FUNC_EMAC		0x0200
 #define OCP_FUNC_GFAR		0x0201	/* TSEC & FEC */
+#define OCP_FUNC_FEC_MPC52xx	0x0202
 
 /* Bridge devices 0xE00 - 0xEFF */
 #define OCP_FUNC_OPB		0x0E00
drivers/net/fec_mpc52xx/fec.c +24 -13
@@ -175,13 +175,11 @@
 		skb = dev_alloc_skb(FEC_RX_BUFFER_SIZE);
 		if (skb == 0)
 			goto eagain;
-		skb->dev = dev;
-		skb_put(skb, FEC_RX_BUFFER_SIZE);
 
 		/* zero out the initial receive buffers to aid debugging */
 		memset(skb->data, 0, FEC_RX_BUFFER_SIZE);
 		data = (void *)virt_to_phys(skb->data);
-		sdma_submit_buffer(priv->rx_sdma, skb, data, skb->len);
+		sdma_submit_buffer(priv->rx_sdma, skb, data, FEC_RX_BUFFER_SIZE);
 	}
 
 	fec_set_paddr(dev, dev->dev_addr);
@@ -307,8 +305,7 @@
 	struct fec_priv *priv = (struct fec_priv *)dev->priv;
 	struct sk_buff *skb;
 	struct sk_buff *rskb;
-	void *data;
-	int length;
+	int status;
 
 	for (;;) {
 		sdma_clear_irq(priv->rx_sdma);
@@ -316,30 +313,44 @@
 		if (!sdma_buffer_done(priv->rx_sdma))
 			break;
 
-		rskb = sdma_retrieve_buffer(priv->rx_sdma, &length);
-		/* length included sizeof CRC32 */
-		skb_trim(rskb, length - sizeof(u32));
+		rskb = sdma_retrieve_buffer(priv->rx_sdma, &status);
+
+		/* Test for errors in received frame */
+		if (status & 0x370000) { 
+			/* Drop packet and reuse the buffer */
+			sdma_submit_buffer(
+				priv->rx_sdma, rskb,
+				(void *)virt_to_phys(rskb->data),
+				FEC_RX_BUFFER_SIZE );
+			
+			priv->stats.rx_dropped++;
+
+			continue;
+		}
 
 		/* allocate replacement skb */
 		skb = dev_alloc_skb(FEC_RX_BUFFER_SIZE);
 		if (skb) {
+			/* Process the received skb */
+			int length = (status & ((1<<11) - 1)) - sizeof(u32);
+			skb_put(rskb, length);	/* length included CRC32 */
+
+			rskb->dev = dev;
 			rskb->protocol = eth_type_trans(rskb, dev);
 			netif_rx(rskb);
 			dev->last_rx = jiffies;
 		} else {
+			/* Can't get a new one : reuse the same & drop pkt */
 			printk(KERN_NOTICE
 				"%s: Memory squeeze, dropping packet.\n",
 				dev->name);
 			priv->stats.rx_dropped++;
 
-			skb_trim(rskb, 0);
 			skb = rskb;
 		}
 
-		skb->dev = dev;
-		skb_put(skb, FEC_RX_BUFFER_SIZE);
-		data = (void *)virt_to_phys(skb->data);
-		sdma_submit_buffer(priv->rx_sdma, skb, data, skb->len);
+		sdma_submit_buffer( priv->rx_sdma, skb,
+			(void *)virt_to_phys(skb->data), FEC_RX_BUFFER_SIZE );
 	}
 
 	return IRQ_HANDLED;
arch/ppc/syslib/bestcomm/fec.c +1 -1
@@ -155,7 +155,7 @@
 	/* clear pending interrupt bits */
 	out_be32(&sdma->IntPend, 1<<tasknum);
 
-	out_8(&sdma->ipr[SDMA_INITIATOR_FEC_TX], SDMA_IPR_FEC_RX);
+	out_8(&sdma->ipr[SDMA_INITIATOR_FEC_TX], SDMA_IPR_FEC_TX);
 
 	return tasknum;
 }
arch/ppc/syslib/bestcomm/fec.c +1 -0
diff -Nru a/arch/ppc/syslib/bestcomm/fec.c b/arch/ppc/syslib/bestcomm/fec.c
@@ -68,6 +68,7 @@
 	inc = (struct sdma_fec_rx_inc *)sdma_task_inc(tasknum);
 	inc->incr_bytes		= -(s16)sizeof(u32);
 	inc->incr_dst		= sizeof(u32);
+	inc->incr_dst_ma	= sizeof(u8);
 
 	sdma_set_task_pragma(tasknum, SDMA_FEC_RX_BD_PRAGMA);
 	sdma_set_task_auto_start(tasknum, tasknum);
arch/ppc/syslib/bestcomm/fec.h +2 -0
diff -Nru a/arch/ppc/syslib/bestcomm/fec.h b/arch/ppc/syslib/bestcomm/fec.h
@@ -31,6 +31,8 @@
 	s16 incr_bytes;
 	u16 pad1;
 	s16 incr_dst;
+	u16 pad2;
+	s16 incr_dst_ma;
 };
 
 /* tx task vars that need to be set before enabling the task */
arch/ppc/syslib/bestcomm/sdma_fec_rx_task.c +30 -11

69 lines not on this page · raw message

arch/ppc/syslib/bestcomm/sdma_fec_tx_task.c +26 -16

10 lines not on this page · raw message

drivers/net/fec_mpc52xx/fec.c +1 -42

43 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#5 lore raw

Asier,

I tried copying 700MB files to my lite board with ftp on sylvain's latest kernel
and was not able to reproduce the problem. One thing I did see though were lots of RX framing errors. I will investigate this further.

I consulted with someone in Freescale who knows a lot more about bestcomm dma and the 5200 than me and his best guess was that there is a problem in error handling. Can you have your partner report what the error counts reported by ifconfig are? This might give us some clue about what is leading to the problem.

Thanks
John
[email protected]
[email protected]

Quoted 36 lines · Asier Llano Palacios

El s=E1b, 11-02-2006 a las 16:28 +0100, Sylvain Munaut escribi=F3:

Quoted 4 lines

Asier Llano Palacios wrote:
Did you ever observe that behavior on a lite5200 ?
What is 'long uptime' and do you have sustained transfer during that period ? (To try reproduice the problem).

Weeks uptime. We don't work with the lite5200 for so long time, but our board is based on a lite5200, and the FEC configuration is exactly equal.

Quoted 1 line

Also, what are the 'symptoms' ? (anything in dmesg ?)

FEC doesn't work at all, everything else works. If using a console I execute 'ifconfig eth0 down && ifconfig eth0 up <IP>' the fec starts working again.
I haven't reproduced it directly, but a partner and a customer. I'll try to reproduce this behaviour myself and bring back more information.

Quoted 6 lines

I haven't touched the FEC code much except to remove the aligment code (newer bestcomm microcode doesn't require alignement of the skb).

You can send me the driver/net/fec_mpc52xx and arch/ppc/syslib/bestcomm you're using, I'll tell you if there was major changes.

I've sent to you the patches that I extracted from your kernel source tree some time ago.
I have all the patches until the 1.2161 one. But I've only sent to you the ones related to the FEC and the bestcomm.

--
Asier Llano Palacios
ZIV I+D Smart Energy Networks
Dpto. Ingenier=EDa de Desarrollo.

Quoted 8 lines

ZIV, Aplicaciones y Tecnolog=EDa.
Parque Tecnol=F3gico, 210
48170 ZAMUDIO (Bizkaia)

E-mail: [email protected]
Tlfno: 944037400

----------------------------------------- PLEASE NOTE -------------------=

------------------------

Quoted 1 line

This message, along with any attachments, may be confidential or legally =

privileged.

Quoted 1 line

It is intended only for the named person(s), who is/are the only authoriz=

ed recipients.

Quoted 1 line

If this message has reached you in error, kindly destroy it without revie=

w and notify the sender immediately.

Quoted 2 lines

Thank you for your help.
=B5SysCom uses virus scanning software but excludes any liability for vir=

uses contained in any attachment.

Quoted 2 lines

------------------------------------ ROGAMOS LEA ESTE TEXTO -------------=

------------------

Quoted 1 line

Este mensaje y sus anexos pueden contener informaci=F3n confidencial y/o =

con derecho legal.

Quoted 1 line

Est=E1 dirigido =FAnicamente a la/s persona/s o entidad/es rese=F1adas co=

mo =FAnico destinatario autorizado.

Quoted 1 line

Si este mensaje le hubiera llegado por error, por favor elim=EDnelo sin r=

evisarlo ni reenviarlo y notif=EDquelo inmediatamente al remitente. Gracias=
por su colaboraci=F3n.

Quoted 1 line

=B5SysCom utiliza software antivirus, pero no se hace responsable de los =

virus contenidos en los ficheros anexos.

Quoted 9 lines

_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded