The branch main has been updated by kbowling:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=444168adbe5217ea9b73773e42c60bf75fb7a6fd

commit 444168adbe5217ea9b73773e42c60bf75fb7a6fd
Author:     Kevin Bowling <[email protected]>
AuthorDate: 2026-09-03 10:58:30 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-09-17 05:58:31 +0000

    ixl: Tie statistics baselines to hardware resource epochs
    
    Raw VSI statistics belong to the firmware-assigned counter index and are
    reset when firmware recreates the VSI.  Reusing a baseline across either
    event makes a counter decrease look like a full width rollover.
    
    Reset the PF and main VSI baselines when rebuilding hardware resources.
    Start a new baseline when firmware assigns a different PF counter index
    and whenever it allocates a VF VSI.  Ordinary interface reinits which
    retain the hardware resources continue to retain their statistics.
    
    This follows the lifecycle used by ice without placing an unconditional
    statistics reset in ixl_initialize_vsi(), which also runs during ordinary
    iflib initialization.
    
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59337
---
 sys/dev/ixl/ixl_pf_iflib.c | 11 ++++++++++-
 sys/dev/ixl/ixl_pf_iov.c   |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c
index 723b5b635220..17802e28d613 100644
--- a/sys/dev/ixl/ixl_pf_iflib.c
+++ b/sys/dev/ixl/ixl_pf_iflib.c
@@ -500,7 +500,13 @@ ixl_initialize_vsi(struct ixl_vsi *vsi)
                ctxt.info.queueing_opt_flags |= I40E_AQ_VSI_QUE_OPT_TCP_ENA;
        }
 #endif
-       /* Save VSI number and info for use later */
+       /*
+        * Save the VSI number and info for later.  A changed counter index
+        * begins a new statistics epoch.
+        */
+       if (vsi->stat_offsets_loaded &&
+           vsi->info.stat_counter_idx != ctxt.info.stat_counter_idx)
+               ixl_vsi_reset_stats(vsi);
        vsi->vsi_num = ctxt.vsi_number;
        bcopy(&ctxt.info, &vsi->info, sizeof(vsi->info));
 
@@ -1030,6 +1036,9 @@ ixl_rebuild_hw_structs_after_reset(struct ixl_pf *pf, 
bool is_up)
                error = EIO;
                goto ixl_rebuild_hw_structs_after_reset_err;
        }
+       /* Firmware has rebuilt the port and VSI counter resources. */
+       ixl_pf_reset_stats(pf);
+       ixl_vsi_reset_stats(vsi);
 
        error = i40e_aq_set_phy_int_mask(hw, IXL_DEFAULT_PHY_INT_MASK,
            NULL);
diff --git a/sys/dev/ixl/ixl_pf_iov.c b/sys/dev/ixl/ixl_pf_iov.c
index 29f0f1fd839e..8c985d622cfe 100644
--- a/sys/dev/ixl/ixl_pf_iov.c
+++ b/sys/dev/ixl/ixl_pf_iov.c
@@ -212,6 +212,8 @@ ixl_vf_alloc_vsi(struct ixl_pf *pf, struct ixl_vf *vf)
        }
 
        memcpy(&vf->vsi.info, &vsi_ctx.info, sizeof(vf->vsi.info));
+       /* A newly allocated hardware VSI starts a new statistics epoch. */
+       ixl_vsi_reset_stats(&vf->vsi);
        return (0);
 
 fail:

Reply via email to