[PATCH] examples/l2fwd: fix port statistics reset inside loop

Stephen Hemminger stephen at networkplumber.org
Sat May 2 00:57:03 CEST 2026


On Tue, 31 Mar 2026 10:15:32 +0530
Harsh raj Singh <singhharshraj215 at gmail.com> wrote:

> Hi,
> 
> Please find attached my patch for fix port statistics reset inside
> loop in l2fwd example
> 
> Thanks,
> Harsh Raj Singh

What is the problem here. That loop only happens during initialization.

The memset() is redundant and not needed but that is a different reason
to remove it. In current code the port_statistics will start out at all zeros.

If you want, the right fix is to pull the memset entirely.
While your at it look for the same pattern in other variants of l2fwd and l3fwd.
There is a lot of copy/paste here.


More information about the dev mailing list