From patchwork Sat Mar 24 20:11:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10306385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4CBAE600CC for ; Sat, 24 Mar 2018 20:11:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E60129272 for ; Sat, 24 Mar 2018 20:11:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32EFD292DC; Sat, 24 Mar 2018 20:11:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B461929272 for ; Sat, 24 Mar 2018 20:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040AbeCXULY (ORCPT ); Sat, 24 Mar 2018 16:11:24 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:47036 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753166AbeCXULW (ORCPT ); Sat, 24 Mar 2018 16:11:22 -0400 Received: by mail-lf0-f66.google.com with SMTP id j68-v6so22870273lfg.13 for ; Sat, 24 Mar 2018 13:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QGky3NWgaMnMcY4G+JMJKqCiZmMMzfZMIFmv4dUKRQM=; b=zkiWnr3WydzO0qyuSPmGEjCz/1A9HXZT9rcin5WLzKR7C9VA+nseniJEdnCbcYbwPr xsPpCUByEZRs5x7R5HYT7mtmZ55xW6IiB5wu1IJqb6p5FS9U99Y3ivQe4O+hKb/nJfDx tm8cu7dX4nCf5mS6ZmN7BRWV9TfZSkQwdJfVMhgGqYRfYyNHreLeSSLQPjP4Lyn7iDuF cxRt1Jb3M3Q43mfdYLfgg5EJ/DT8J7mJsifxB2SMbW8nZH5a4qBWYGu+3t9MjzFirtqu tpeeNTs/1YekPTVn2e/Bj2JdRm2yc5lFNDnb1oGxfA+7r2ZGSUohTQlyFm3HqEnTZ+lz 7z7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=QGky3NWgaMnMcY4G+JMJKqCiZmMMzfZMIFmv4dUKRQM=; b=lhncFNb3ESNnepLz83gNSSvnSD6ioYk8+EuA+3kFURDBxeWBVZJs7CgFMbOA4BTHxx i7Xj5CgM1MxQcPZndNfvuhTqSUFAU+/gM0olqKfb1pjgyRWXgiXp1ZtqzgHEGXGpDrZS 0S/mI76XZEelz3IhVqs8ZKIG3nck7o0s8hnd5/4eEePxFe0A3Cd4MUV/F1kwECoTOcV3 AaBfOlW9vKlaQSC2sL/FHOJGpzqZyMRR1ypyXCFSc1Zlq3/Jyca7XgErurjtivPqtXje /41ORGNrcKm3TL1+pbGw480PmBSnrFYUEvpio4Pyk0Moid/JUEFW2wN3/5dFqQWXAXx/ CVpw== X-Gm-Message-State: AElRT7HV+NmaVpyQn/GwIQ80RMOKDbbkpjebQLRW+aI800rZzUcG/nIH oCSSTA23IcGyUn+g4LCJgxaUWodU6KE= X-Google-Smtp-Source: AG47ELu13b20Dsl/tqXtqsyac5TE+Vih5FmkuHJAWOd7Jnx/0n+p2yezncGE2h+xPK8honPh1nnX0A== X-Received: by 2002:a19:4e5d:: with SMTP id c90-v6mr21789348lfb.98.1521922280580; Sat, 24 Mar 2018 13:11:20 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.80.64]) by smtp.gmail.com with ESMTPSA id 1sm2613831lje.38.2018.03.24.13.11.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Mar 2018 13:11:19 -0700 (PDT) Subject: [PATCH 4/5] sh_eth: add sh_eth_cpu_data::no_tx_cntr flag From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org References: Organization: Cogent Embedded Message-ID: Date: Sat, 24 Mar 2018 23:11:19 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-MW Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP RZ/A1H (R7S72100) Ether controller doesn't seem to have the TX counter registers like TROCR/CDCR/LCCR (or at least they are still undocumented like some TSU registers), so we bail out of sh_eth_get_stats() early in this case. Currently we are calling sh_eth_is_rz_fast_ether() in order to check for this, but it would be simpler to check the new 'no_tx_cntrs' bitfield in the 'struct sh_eth_cpu_data'; then we'd be able to remove sh_eth_is_rz_fast_ether() as there would be no callers left... Signed-off-by: Sergei Shtylyov --- drivers/net/ethernet/renesas/sh_eth.c | 8 ++------ drivers/net/ethernet/renesas/sh_eth.h | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) -- 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 Index: net-next/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net-next/drivers/net/ethernet/renesas/sh_eth.c @@ -455,11 +455,6 @@ static bool sh_eth_is_gether(struct sh_e return mdp->reg_offset == sh_eth_offset_gigabit; } -static bool sh_eth_is_rz_fast_ether(struct sh_eth_private *mdp) -{ - return mdp->reg_offset == sh_eth_offset_fast_rz; -} - static void sh_eth_select_mii(struct net_device *ndev) { struct sh_eth_private *mdp = netdev_priv(ndev); @@ -614,6 +609,7 @@ static struct sh_eth_cpu_data r7s72100_d .xdfar_rw = 1, .hw_checksum = 1, .tsu = 1, + .no_tx_cntrs = 1, }; static void sh_eth_chip_reset_r8a7740(struct net_device *ndev) @@ -2534,7 +2530,7 @@ static struct net_device_stats *sh_eth_g { struct sh_eth_private *mdp = netdev_priv(ndev); - if (sh_eth_is_rz_fast_ether(mdp)) + if (mdp->cd->no_tx_cntrs) return &ndev->stats; if (!mdp->is_opened) Index: net-next/drivers/net/ethernet/renesas/sh_eth.h =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.h +++ net-next/drivers/net/ethernet/renesas/sh_eth.h @@ -514,6 +514,7 @@ struct sh_eth_cpu_data { unsigned rmiimode:1; /* EtherC has RMIIMODE register */ unsigned rtrate:1; /* EtherC has RTRATE register */ unsigned magic:1; /* EtherC has ECMR.MPDE and ECSR.MPD */ + unsigned no_tx_cntrs:1; /* EtherC DOES NOT have TX error counters */ unsigned dual_port:1; /* Dual EtherC/E-DMAC */ };