Skip to contentSkip to conversation

net: sh_eth: fix incorrect RX length error if R8A7740

PATCH Superseded Shimoda, Yoshihiro 3 participants 7 messages Jun 12, 2013 – Jun 13, 2013

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sh_eth: fix incorrect RX length error if R8A7740

This patch fixes an issue that the driver increments the "RX length error" on every buffer in sh_eth_rx() if the R8A7740.
This patch also adds a description about the Receive Frame Status bits.

---
This patch is based on the latest net-next.git.

 drivers/net/ethernet/renesas/sh_eth.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +11 -4
index 43d8490..ab2f9c2 100644
@@ -1260,16 +1260,23 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status)
 		desc_status = edmac_to_cpu(mdp, rxdesc->status);
 		pkt_len = rxdesc->frame_length;
 
-#if defined(CONFIG_ARCH_R8A7740)
-		desc_status >>= 16;
-#endif
-
 		if (--boguscnt < 0)
 			break;
 
 		if (!(desc_status & RDFEND))
 			ndev->stats.rx_length_errors++;
 
+#if defined(CONFIG_ARCH_R8A7740)
+		/*
+		 * In case of almost GETHER/ETHERs, the Receive Frame State
+		 * (RFS) bits in the Receive Descriptor 0 are from bit 9 to
+		 * bit 0. However, in case of the R8A7740's GETHER, the RFS
+		 * bits are from bit 25 to bit 16. So, the driver needs right
+		 * shifting by 16.
+		 */
+		desc_status >>= 16;
+#endif
+
 		if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 |
 				   RD_RFS5 | RD_RFS6 | RD_RFS10)) {
 			ndev->stats.rx_errors++;
Signature · 1 line
1.7.1
#1 lore raw

Hello.

Quoted 3 lines · Yoshihiro

This patch fixes an issue that the driver increments the "RX length error" on every buffer in sh_eth_rx() if the R8A7740.
This patch also adds a description about the Receive Frame Status bits.

Thank you.

Quoted 3 lines

---
This patch is based on the latest net-next.git.

Since this is a fix, it should have been done against 'net.git'.

WBR, Sergei

#2 lore raw

Hello.

Quoted 5 lines · Sergei Shtylyov
Quoted 4 lines

This patch fixes an issue that the driver increments the "RX length error"
on every buffer in sh_eth_rx() if the R8A7740.
This patch also adds a description about the Receive Frame Status bits.

Quoted 7 lines

Thank you.

Quoted 3 lines

---
This patch is based on the latest net-next.git.

Since this is a fix, it should have been done against 'net.git'.

David, this patch applies to the recent net.git repo with offset.
Could you merge it there and also queue for stable?

WBR, Sergei

#5 lore raw
In reply to Shimoda, Yoshihiro
Quoted 22 lines · Yoshihiro

This patch fixes an issue that the driver increments the "RX length error" on every buffer in sh_eth_rx() if the R8A7740.
This patch also adds a description about the Receive Frame Status bits.

---
This patch is based on the latest net-next.git.

  drivers/net/ethernet/renesas/sh_eth.c |   15 +++++++++++----
  1 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +0 -3
index 43d8490..ab2f9c2 100644
@@ -1260,16 +1260,23 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status)
  		desc_status = edmac_to_cpu(mdp, rxdesc->status);
  		pkt_len = rxdesc->frame_length;
 
-#if defined(CONFIG_ARCH_R8A7740)
-		desc_status >>= 16;
-#endif

drivers/net/ethernet/renesas/sh_eth.c static int sh_eth_rx(struct net_device *ndev, u32 intr_status) · line 1271

Quoted 10 lines
drivers/net/ethernet/renesas/sh_eth.c +3 -1
-
  		if (--boguscnt < 0)
  			break;
 
  		if (!(desc_status & RDFEND))
  			ndev->stats.rx_length_errors++;
 
+#if defined(CONFIG_ARCH_R8A7740)
+		/*
+		 * In case of almost GETHER/ETHERs, the Receive Frame State

Erm, minor nit: it seems you forgot "all" after "almost". Hence it's
probably worth resubmitting...

drivers/net/ethernet/renesas/sh_eth.c static int sh_eth_rx(struct net_device *ndev, u32 intr_status) · line 1279

Quoted 8 lines
drivers/net/ethernet/renesas/sh_eth.c +8 -0
+		 * (RFS) bits in the Receive Descriptor 0 are from bit 9 to
+		 * bit 0. However, in case of the R8A7740's GETHER, the RFS
+		 * bits are from bit 25 to bit 16. So, the driver needs right
+		 * shifting by 16.
+		 */
+		desc_status >>= 16;
+#endif
+

WBR, Sergei

maintainer
#3 lore raw
In reply to Sergei Shtylyov

From: Sergei Shtylyov <[email protected]>
Date: Wed, 12 Jun 2013 23:13:14 +0400

Quoted 12 lines

Hello.

Quoted 7 lines · Sergei Shtylyov
Quoted 5 lines

This patch fixes an issue that the driver increments the "RX length error"
on every buffer in sh_eth_rx() if the R8A7740.
This patch also adds a description about the Receive Frame Status bits.

Thank you.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

---
This patch is based on the latest net-next.git.

Since this is a fix, it should have been done against 'net.git'.

David, this patch applies to the recent net.git repo with offset.
Could you merge it there and also queue for stable?

Repost it so that I can apply it cleanly.

#4 lore raw
Quoted 12 lines · David Miller
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines

This patch fixes an issue that the driver increments the "RX length error"
on every buffer in sh_eth_rx() if the R8A7740.
This patch also adds a description about the Receive Frame Status bits.

Thank you.

Quoted 3 lines

---
This patch is based on the latest net-next.git.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Since this is a fix, it should have been done against 'net.git'.

David, this patch applies to the recent net.git repo with offset.
Could you merge it there and also queue for stable?

Repost it so that I can apply it cleanly.

OK, I'll first wait for Shimoda-san's repost as it needs a little
comment fix anyway.

WBR, Sergei

#6 lore raw
In reply to Sergei Shtylyov

Hi,

Quoted 1 line · Sergei Shtylyov

On 06/12/2013 05:33 AM, Shimoda, Yoshihiro wrote:

< snip >

Quoted 6 lines

drivers/net/ethernet/renesas/sh_eth.c static int sh_eth_rx(struct net_device *ndev, u32 intr_status) · line 1271

Quoted 3 lines
drivers/net/ethernet/renesas/sh_eth.c +3 -0
+#if defined(CONFIG_ARCH_R8A7740)
+        /*
+         * In case of almost GETHER/ETHERs, the Receive Frame State

Erm, minor nit: it seems you forgot "all" after "almost". Hence it's probably worth resubmitting...

Thank you for the point. I will fix it and resubmit a patch for "net.git".

Best regards,
Yoshihiro Shimoda

Quoted 12 lines

drivers/net/ethernet/renesas/sh_eth.c static int sh_eth_rx(struct net_device *ndev, u32 intr_status) · line 1279

Quoted 8 lines
drivers/net/ethernet/renesas/sh_eth.c +8 -0
+         * (RFS) bits in the Receive Descriptor 0 are from bit 9 to
+         * bit 0. However, in case of the R8A7740's GETHER, the RFS
+         * bits are from bit 25 to bit 16. So, the driver needs right
+         * shifting by 16.
+         */
+        desc_status >>= 16;
+#endif
+

WBR, Sergei