diff mbox

[net-next] net: sh_eth: fix incorrect RX length error if R8A7740

Message ID 51B7CFFB.7090801@renesas.com (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

Yoshihiro Shimoda June 12, 2013, 1:33 a.m. UTC
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.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 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(-)

Comments

Sergei Shtylyov June 12, 2013, 2:15 p.m. UTC | #1
Hello.

On 12-06-2013 5:33, Shimoda, Yoshihiro wrote:

> 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.

> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>   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

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov June 12, 2013, 7:13 p.m. UTC | #2
Hello.

On 06/12/2013 06:15 PM, Sergei Shtylyov wrote:

>> 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.

>> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
>> ---
>>   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

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov June 12, 2013, 7:25 p.m. UTC | #3
On 06/12/2013 05:33 AM, Shimoda, Yoshihiro wrote:

> 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.

> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>   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(-)

> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 43d8490..ab2f9c2 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -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

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

> +		 * (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

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller June 12, 2013, 7:55 p.m. UTC | #4
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Wed, 12 Jun 2013 23:13:14 +0400

> Hello.
> 
> On 06/12/2013 06:15 PM, Sergei Shtylyov wrote:
> 
>>> 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.
> 
>>> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
>>> ---
>>>   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.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov June 12, 2013, 8:03 p.m. UTC | #5
On 06/12/2013 11:55 PM, David Miller wrote:

>>>> 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.

>>>> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
>>>> ---
>>>>    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.

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

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yoshihiro Shimoda June 13, 2013, 12:57 a.m. UTC | #6
Hi,

(2013/06/13 4:25), Sergei Shtylyov wrote:
> On 06/12/2013 05:33 AM, Shimoda, Yoshihiro wrote:
< snip >
>> +#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

>> +         * (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
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 43d8490..ab2f9c2 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -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++;