generic: ar8216: mib_work_func: read all port mibs everytime

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>
v19.07.3_mercusys_ac12_duma
Chuanhong Guo 6 years ago committed by Petr Štetiar
parent 9fc506e9b2
commit d6366ce366

@ -2189,7 +2189,7 @@ static void
ar8xxx_mib_work_func(struct work_struct *work) ar8xxx_mib_work_func(struct work_struct *work)
{ {
struct ar8xxx_priv *priv; struct ar8xxx_priv *priv;
int err; int err, i;
priv = container_of(work, struct ar8xxx_priv, mib_work.work); 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); err = ar8xxx_mib_capture(priv);
if (err) if (err)
goto next_port; goto next_attempt;
ar8xxx_mib_fetch_port_stat(priv, priv->mib_next_port, false);
next_port: for (i = 0; i < priv->dev.ports; i++)
priv->mib_next_port++; ar8xxx_mib_fetch_port_stat(priv, i, false);
if (priv->mib_next_port >= priv->dev.ports)
priv->mib_next_port = 0;
next_attempt:
mutex_unlock(&priv->mib_lock); mutex_unlock(&priv->mib_lock);
schedule_delayed_work(&priv->mib_work, schedule_delayed_work(&priv->mib_work,
msecs_to_jiffies(AR8XXX_MIB_WORK_DELAY)); msecs_to_jiffies(AR8XXX_MIB_WORK_DELAY));

@ -488,7 +488,6 @@ struct ar8xxx_priv {
struct mutex mib_lock; struct mutex mib_lock;
struct delayed_work mib_work; struct delayed_work mib_work;
int mib_next_port;
u64 *mib_stats; u64 *mib_stats;
struct list_head list; struct list_head list;

Loading…
Cancel
Save