]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
eth: fbnic: Reset MAC stats
authorMohsin Bashir <mohsin.bashr@gmail.com>
Mon, 25 Aug 2025 20:02:03 +0000 (13:02 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 28 Aug 2025 01:56:19 +0000 (18:56 -0700)
commitbcf54e5d7cd0dccf6378e00f1f6ddff28b9f3989
tree3f9e0dbd298fb274fb409bfc8cfd8ead97c7707f
parentb1161b1863c5f3d592adba5accd6e5c79741720f
eth: fbnic: Reset MAC stats

Reset the MAC stats as part of the hardware stats reset to ensure
consistency. Currently, hardware stats are reset during device bring-up
and upon experiencing PCI errors; however, MAC stats are being skipped
during these resets.

When fbnic_reset_hw_stats() is called upon recovering from PCI error,
MAC stats are accessed outside the rtnl_lock. The only other access to
MAC stats is via the ethtool API, which is protected by rtnl_lock. This
can result in concurrent access to MAC stats and a potential race. Protect
the fbnic_reset_hw_stats() call in __fbnic_pm_attach() with rtnl_lock to
avoid this.

Note that fbnic_reset_hw_mac_stats() is called outside the hardware
stats lock which protects access to the fbnic_hw_stats. This is intentional
because MAC stats are fetched from the device outside this lock and are
exclusively read via the ethtool API.

Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250825200206.2357713-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.c
drivers/net/ethernet/meta/fbnic/fbnic_pci.c