> +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.

        Andrew

Reply via email to