Skip to contentSkip to conversation

net: stmmac: v6.1.y clears xstats.pcpu_stats in __stmmac_open()

REGRESSION Kunihiko Hayashi 1 participant 1 message Nov 16

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

A regression appears to have been introduced in the v6.1.y stable series after the per-CPU stmmac statistics backport.

Since v6.1.191, DMA interrupt handlers were converted by

commit 52002cae02db ("net: stmmac: protect updates of 64-bit statistics counters")

from:

    priv->xstats.rxq_stats[chan]
    priv->xstats.txq_stats[chan]
to:
    this_cpu_ptr(priv->xstats.pcpu_stats)

where pcpu_stats is allocated during probe():

    priv->xstats.pcpu_stats =
            devm_netdev_alloc_pcpu_stats(...);

However, __stmmac_open() still contains:

    memset(&priv->xstats, 0,
           sizeof(struct stmmac_extra_stats));

which clears the pcpu_stats pointer allocated during probe.

As a result:

    probe()
        -> allocate xstats.pcpu_stats
    __stmmac_open()
        -> memset(&priv->xstats, ...)
        -> xstats.pcpu_stats = NULL
    dma_interrupt
        -> this_cpu_ptr(priv->xstats.pcpu_stats)

which appears to leave xstats.pcpu_stats cleared after allocation during probe().

v6.6 and later do not appear to be affected because the xstats memset was already removed by

    commit 2eb85b750512 ("net: stmmac: don't clear network statistics in .ndo_open()").

before the per-CPU statistics conversion was introduced.

Has anyone else observed this issue?

Thanks,

---
Best Regards
Kunihiko Hayashi