lkml.org 
[lkml]   [2021]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2021-04-23 01:39    [W:0.168 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site