Commit 6410c139 authored by Maxime Chevallier's avatar Maxime Chevallier Committed by David S. Miller
Browse files

net: mvpp2: Only clear the stat counters at port init



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: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad3a9ee0
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -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: