From patchwork Fri May 11 08:38:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 158461 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7C023B6FEE for ; Fri, 11 May 2012 18:38:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932174Ab2EKIie (ORCPT ); Fri, 11 May 2012 04:38:34 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:63167 "EHLO relmlor3.renesas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757976Ab2EKIi2 (ORCPT ); Fri, 11 May 2012 04:38:28 -0400 Received: from relmlir1.idc.renesas.com ([10.200.68.151]) by relmlor3.idc.renesas.com ( SJSMS) with ESMTP id <0M3U00CDTO03J6C0@relmlor3.idc.renesas.com>; Fri, 11 May 2012 17:38:27 +0900 (JST) Received: from relmlac2.idc.renesas.com ([10.200.69.22]) by relmlir1.idc.renesas.com (SJSMS) with ESMTP id <0M3U004G4O03QS80@relmlir1.idc.renesas.com>; Fri, 11 May 2012 17:38:27 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 3CA88280A1; Fri, 11 May 2012 17:38:27 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 28601280A6; Fri, 11 May 2012 17:38:27 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac2.idc.renesas.com with ESMTP id TAE21772; Fri, 11 May 2012 17:38:27 +0900 X-IronPort-AV: E=Sophos; i="4.75,570,1330873200"; d="scan'208"; a="80858424" Received: from unknown (HELO [172.30.8.157]) ([172.30.8.157]) by relmlii2.idc.renesas.com with ESMTP; Fri, 11 May 2012 17:38:27 +0900 Message-id: <4FACD002.1020304@renesas.com> Date: Fri, 11 May 2012 17:38:26 +0900 From: "Shimoda, Yoshihiro" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-version: 1.0 To: netdev Cc: SH-Linux Subject: [PATCH v2 3/5] net: sh_eth: fix the rxdesc pointer when rx descriptor empty happens Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When Receive Descriptor Empty happens, rxdesc pointer of the driver and actual next descriptor of the controller may be mismatch. This patch fixes it. Signed-off-by: Yoshihiro Shimoda --- about v2: - rebase the latest net-next.git drivers/net/ethernet/renesas/sh_eth.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 10f2a89..906e410 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -1098,8 +1098,12 @@ static int sh_eth_rx(struct net_device *ndev) /* Restart Rx engine if stopped. */ /* If we don't need to check status, don't. -KDU */ - if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) + if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { + /* fix the values for the next receiving */ + mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) - + sh_eth_read(ndev, RDLAR)) >> 4; sh_eth_write(ndev, EDRRR_R, EDRRR); + } return 0; } @@ -1196,8 +1200,6 @@ static void sh_eth_error(struct net_device *ndev, int intr_status) /* Receive Descriptor Empty int */ ndev->stats.rx_over_errors++; - if (sh_eth_read(ndev, EDRRR) ^ EDRRR_R) - sh_eth_write(ndev, EDRRR_R, EDRRR); if (netif_msg_rx_err(mdp)) dev_err(&ndev->dev, "Receive Descriptor Empty\n"); }