From patchwork Fri Mar 16 08:46:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 147156 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 F0E7EB6ED0 for ; Fri, 16 Mar 2012 19:46:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759157Ab2CPIqi (ORCPT ); Fri, 16 Mar 2012 04:46:38 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:58498 "EHLO relmlor4.renesas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752589Ab2CPIqY (ORCPT ); Fri, 16 Mar 2012 04:46:24 -0400 Received: from relmlir4.idc.renesas.com ([10.200.68.154]) by relmlor4.idc.renesas.com ( SJSMS) with ESMTP id <0M0Y008J5Z12UZ10@relmlor4.idc.renesas.com>; Fri, 16 Mar 2012 17:46:14 +0900 (JST) Received: from relmlac4.idc.renesas.com ([10.200.69.24]) by relmlir4.idc.renesas.com ( SJSMS) with ESMTP id <0M0Y00ANSZ10DE70@relmlir4.idc.renesas.com>; Fri, 16 Mar 2012 17:46:14 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 9C6AE480A5; Fri, 16 Mar 2012 17:46:14 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 8D7B248082; Fri, 16 Mar 2012 17:46:14 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id TAP15169; Fri, 16 Mar 2012 17:46:14 +0900 X-IronPort-AV: E=Sophos; i="4.73,597,1325430000"; d="scan'208"; a="73038052" Received: from unknown (HELO [172.30.8.157]) ([172.30.8.157]) by relmlii2.idc.renesas.com with ESMTP; Fri, 16 Mar 2012 17:46:14 +0900 Message-id: <4F62FDD6.60508@renesas.com> Date: Fri, 16 Mar 2012 17:46:14 +0900 From: "Shimoda, Yoshihiro" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-version: 1.0 To: netdev Cc: SH-Linux Subject: [PATCH 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 --- 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 6718ba0..62458d9 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -972,8 +972,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; } @@ -1070,8 +1074,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"); }