Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2973086ybi; Mon, 10 Jun 2019 01:56:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+0IJ1kmWQ/k+mZfHcfYPx5AYkLx4GUvIS+mqhSLTA9GhURfs/Tq2TVj7CsZ3Xco+9F7vt X-Received: by 2002:a17:90a:290b:: with SMTP id g11mr20205282pjd.122.1560156962583; Mon, 10 Jun 2019 01:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560156962; cv=none; d=google.com; s=arc-20160816; b=btq4sokWNE/CWx4x4c8RZDz5B+t1iYklvR6VSh/B73ICUZaxh+OwNrKysK1u7Mg+rw NOg3dfxtdlxyCbIqFWE/JlRbYDJgoD4d4arw4Rh9KoKGS08mQVMxfGk1pA+1nrEy9YbV od8jeUueoUY8sJ9OObypG0GlKu2PmmpEcO5zMFuV1Y8LqKeA6Ohms8rSfV0d1sqYa3yI BfvBMxNEYtlgQEkKPcnt205Us87MkM76AzwraRZY4uUedcObmBcU4rN6DoMHiyoZYiTm CaL7t7fxOrEXtd7MU1kEy40FSt4qimRlJcsLY1xRWC1NHcqmdQxJzOY33xcmI/6m/hLK WcJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=KjtBV24rUPjM4CaD30SPojqLNFigdqElJaTJL51m5PM=; b=AqcN9ZN0OfMb9KPCmdmiIFWep/xakeAIHA5FIWqhzz8Md9XjaII7EyTknjKnk1tocs hLqtBBTAxsf1ZSXb92mtYF41UvKIhWPipz36Yywqprxc7BSNjQixywleYF85gOdptTnd A+8dk54Z8pDE90X0c07ow/Vs6VCP4CM9VkGloAfmAfbvnUnYjPTTwOValpof2agpxBi6 HdO2ABJL/IG8V5uMZDaC5Dvz4LxDj8zcvX2l2c9wLvp5c2wx4sZhnV4uJ3B5p4GVrq5m dsSY7C0ZXUPgngKtbfybHDhFbGEFq0PPq09br2hINQb4dm6P45/xTe9OBLzDpfdhVi6M reng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u124si365928pgu.319.2019.06.10.01.55.47; Mon, 10 Jun 2019 01:56:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388716AbfFJIzh (ORCPT + 99 others); Mon, 10 Jun 2019 04:55:37 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:56855 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387946AbfFJIzg (ORCPT ); Mon, 10 Jun 2019 04:55:36 -0400 X-Originating-IP: 90.88.159.246 Received: from mc-bl-xps13.lan (aaubervilliers-681-1-40-246.w90-88.abo.wanadoo.fr [90.88.159.246]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id C3ADCFF80C; Mon, 10 Jun 2019 08:55:33 +0000 (UTC) From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Antoine Tenart , thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com Subject: [PATCH net-next 1/3] net: mvpp2: Only clear the stat counters at port init Date: Mon, 10 Jun 2019 10:55:27 +0200 Message-Id: <20190610085529.16803-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190610085529.16803-1-maxime.chevallier@bootlin.com> References: <20190610085529.16803-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When first configuring a port on PPv2, we want to clear the internal counters so that we don't get values from previous boot stages. However, we can't really clear these counters when resetting the MAC, since there are valid reasons to do so while the port is being used, such as when reconfiguring the interface mode with the PHY. Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 4b4d79611339..ee653125194e 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -1359,13 +1359,8 @@ static int mvpp2_ethtool_get_sset_count(struct net_device *dev, int sset) static void mvpp2_mac_reset_assert(struct mvpp2_port *port) { - unsigned int i; u32 val; - /* Read the GOP statistics to reset the hardware counters */ - for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++) - mvpp2_read_count(port, &mvpp2_ethtool_regs[i]); - val = readl(port->base + MVPP2_GMAC_CTRL_2_REG) | MVPP2_GMAC_PORT_RESET_MASK; writel(val, port->base + MVPP2_GMAC_CTRL_2_REG); @@ -4265,7 +4260,7 @@ static int mvpp2_port_init(struct mvpp2_port *port) struct mvpp2 *priv = port->priv; struct mvpp2_txq_pcpu *txq_pcpu; unsigned int thread; - int queue, err; + int queue, err, i; /* Checks for hardware constraints */ if (port->first_rxq + port->nrxqs > @@ -4372,6 +4367,10 @@ static int mvpp2_port_init(struct mvpp2_port *port) if (err) goto err_free_percpu; + /* Read the GOP statistics to reset the hardware counters */ + for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++) + mvpp2_read_count(port, &mvpp2_ethtool_regs[i]); + return 0; err_free_percpu: -- 2.20.1