lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACKFLi=R+yRa-Y5jr=jf9cJmB-rkWSjyHSZOppFMPXb9wTGCTw@mail.gmail.com>
Date:   Wed, 8 Nov 2023 10:39:34 -0800
From:   Michael Chan <michael.chan@...adcom.com>
To:     Alex Pakhunov <alexey.pakhunov@...cex.com>
Cc:     linux-kernel@...r.kernel.org, mchan@...adcom.com,
        netdev@...r.kernel.org, prashant@...adcom.com,
        siva.kallam@...adcom.com, vincent.wong2@...cex.com
Subject: Re: [PATCH 1/2] tg3: Move the [rt]x_dropped counters to tg3_napi

On Wed, Nov 8, 2023 at 10:18 AM Alex Pakhunov
<alexey.pakhunov@...cex.com> wrote:
>
> Hi,
>
> > I think here we need to keep these counters accumulate across a reset:
> >
> > stats->rx_dropped = old_stats->rx_dropped + rx_dropped;
> > stats->tx_dropped = old_stats->tx_dropped + tx_dropped;
>
> Hm, tg3_halt() explicitly resets the HW counters:
>
> ```
>         if (tp->hw_stats) {
>                 /* Save the stats across chip resets... */
>                 tg3_get_nstats(tp, &tp->net_stats_prev);
>                 tg3_get_estats(tp, &tp->estats_prev);
>
>                 /* And make sure the next sample is new data */
>                 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
>         }

Right, we reset the hardware counters but only after we save a
snapshot first.  The snapshot will be added to the new counters after
reset.

> ```
>
> We sort of doing the same thing with clearing [tr]x_dropped in
> tg3_init_rings() but it seems more confusing than helpful. First, why do we
> handle different counters differently? Second, tg3_halt() is not always
> followed by tg3_init_rings(), so the logic is not consistent.
>
> Instead I think we should just not touch [tr]x_dropped in tg3_init_rings().
> The counters will be set to zero when tg3 is allocated in tg3_init_one().
> Hardware resets will not change tg3_napi::[tr]x_dropped since they are
> purely software counters.
>

Not resetting the tnapi->rx_dropped and tnapi->tx_dropped counters is
an option, but the number of queues (tp->irq_cnt) can change after
reset.  So to always keep the count accurate, we'll have to sum over
all the array entries (TG3_IRQ_MAX_VECS).  I think this will be
confusing and is not consistent with the existing scheme of saving a
snapshot of all counters before reset and then starting from zero
after reset.  Thanks.

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4209 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ