Messages in this thread | | | From | Michael Chan <> | Date | Wed, 8 Nov 2023 10:39:34 -0800 | 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@spacex.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. [unhandled content-type:application/pkcs7-signature] | |