[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4a5532be-d0a0-956c-b166-6eb490377968@gmail.com>
Date: Wed, 20 Feb 2019 09:22:56 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Andrew Lunn <andrew@...n.ch>, Tristram.Ha@...rochip.com
Cc: Sergio Paracuellos <sergio.paracuellos@...il.com>,
Pavel Machek <pavel@....cz>, UNGLinuxDriver@...rochip.com,
netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next 2/4] net: dsa: microchip: add MIB counter
reading support
On 2/20/19 7:08 AM, Andrew Lunn wrote:
>> +static void mib_monitor(struct timer_list *t)
>> +{
>> + struct ksz_device *dev = from_timer(dev, t, mib_read_timer);
>> + const struct dsa_port *dp;
>> + struct net_device *netdev;
>> + struct ksz_port_mib *mib;
>> + struct ksz_port *p;
>> + int i;
>> +
>> + mod_timer(&dev->mib_read_timer, jiffies + dev->mib_read_interval);
>> +
>> + /* Check which port needs to read MIB counters. */
>> + for (i = 0; i < dev->mib_port_cnt; i++) {
>> + p = &dev->ports[i];
>> + if (!p->on)
>> + continue;
>> + dp = dsa_to_port(dev->ds, i);
>> + netdev = dp->slave;
>> +
>> + mib = &p->mib;
>> + mutex_lock(&mib->cnt_mutex);
>> +
>> + /* Read only dropped counters when link is not up. */
>> + if (netdev && netdev->phydev && !netdev->phydev->link)
>> + mib->cnt_ptr = dev->reg_mib_cnt;
>> + mutex_unlock(&mib->cnt_mutex);
>> + p->read = true;
>> + }
>> + schedule_work(&dev->mib_read);
>> +}
>
> Hi Tristram
>
> This is much easier to understand. Thanks for making the change.
>
> However, i suspect Florian was suggesting you use
> netif_carrier_ok(netdev), not poke around inside the phydev structure.
Yes indeed.
--
Florian
Powered by blists - more mailing lists