generic: ar8216: mib_work_func: read all port mibs everytime
authorChuanhong Guo <gch981213@gmail.com>
Fri, 11 Jan 2019 05:18:30 +0000 (13:18 +0800)
committerPetr Štetiar <ynezz@true.cz>
Sun, 24 Mar 2019 00:44:26 +0000 (01:44 +0100)
ar8xxx_mib_capture will update mib counters for all ports. Current
code only update one port at a time and the data for other ports
are lost.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
target/linux/generic/files/drivers/net/phy/ar8216.c
target/linux/generic/files/drivers/net/phy/ar8216.h

index c62411c9c19dc2c81e185d8928dc24ce25b7c9c7..a33d4b31fe2ebcaffb721f14ed906c5fc0ebd587 100644 (file)
@@ -2189,7 +2189,7 @@ static void
 ar8xxx_mib_work_func(struct work_struct *work)
 {
        struct ar8xxx_priv *priv;
-       int err;
+       int err, i;
 
        priv = container_of(work, struct ar8xxx_priv, mib_work.work);
 
@@ -2197,15 +2197,12 @@ ar8xxx_mib_work_func(struct work_struct *work)
 
        err = ar8xxx_mib_capture(priv);
        if (err)
-               goto next_port;
-
-       ar8xxx_mib_fetch_port_stat(priv, priv->mib_next_port, false);
+               goto next_attempt;
 
-next_port:
-       priv->mib_next_port++;
-       if (priv->mib_next_port >= priv->dev.ports)
-               priv->mib_next_port = 0;
+       for (i = 0; i < priv->dev.ports; i++)
+               ar8xxx_mib_fetch_port_stat(priv, i, false);
 
+next_attempt:
        mutex_unlock(&priv->mib_lock);
        schedule_delayed_work(&priv->mib_work,
                              msecs_to_jiffies(AR8XXX_MIB_WORK_DELAY));
index 9b390645512093593a9fefe13c430ab6db76b2ff..e9e83317865206fc9e4821ca376c9e62895b9644 100644 (file)
@@ -488,7 +488,6 @@ struct ar8xxx_priv {
 
        struct mutex mib_lock;
        struct delayed_work mib_work;
-       int mib_next_port;
        u64 *mib_stats;
 
        struct list_head list;