[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YIII6cl5X4UsvRq3@lunn.ch>
Date: Fri, 23 Apr 2021 01:38:17 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Prasanna Vengateshan <prasanna.vengateshan@...rochip.com>
Cc: netdev@...r.kernel.org, olteanv@...il.com, robh+dt@...nel.org,
UNGLinuxDriver@...rochip.com, hkallweit1@...il.com,
linux@...linux.org.uk, davem@...emloft.net, kuba@...nel.org,
linux-kernel@...r.kernel.org, vivien.didelot@...il.com,
f.fainelli@...il.com, devicetree@...r.kernel.org
Subject: Re: [PATCH v2 net-next 4/9] net: dsa: microchip: add DSA support for
microchip lan937x
> +static void lan937x_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
> + u64 *dropped, u64 *cnt)
> +{
> + addr = lan937x_mib_names[addr].index;
> + lan937x_r_mib_cnt(dev, port, addr, cnt);
> +}
> +
> +static void lan937x_port_init_cnt(struct ksz_device *dev, int port)
> +{
> + struct ksz_port_mib *mib = &dev->ports[port].mib;
> +
> + /* flush all enabled port MIB counters */
> + mutex_lock(&mib->cnt_mutex);
> + lan937x_pwrite32(dev, port, REG_PORT_MIB_CTRL_STAT__4,
> + MIB_COUNTER_FLUSH_FREEZE);
> + ksz_write8(dev, REG_SW_MAC_CTRL_6, SW_MIB_COUNTER_FLUSH);
> + lan937x_pwrite32(dev, port, REG_PORT_MIB_CTRL_STAT__4, 0);
> + mutex_unlock(&mib->cnt_mutex);
> +
> + mib->cnt_ptr = 0;
> + memset(mib->counters, 0, dev->mib_cnt * sizeof(u64));
This setting of cnt_ptr to zero and the memset() seem to be common to
all the drivers. Please add a cleanup patch which moves this into
ksz_init_mib_timer().
Andrew
Powered by blists - more mailing lists