aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
diff options
context:
space:
mode:
authorMohsin Bashir <mohsin.bashr@gmail.com>2025-04-10 00:08:55 -0700
committerPaolo Abeni <pabeni@redhat.com>2025-04-15 11:23:13 +0200
commit9f61eb2d185b06d49ef8c25af994d6fc571433cc (patch)
tree998850f6851911c409d4776613ba31bfb85c2178 /drivers/net/ethernet/meta/fbnic/fbnic_pci.c
parentnet: mdio: Add RTL9300 MDIO driver (diff)
downloadwireguard-linux-9f61eb2d185b06d49ef8c25af994d6fc571433cc.tar.xz
wireguard-linux-9f61eb2d185b06d49ef8c25af994d6fc571433cc.zip
eth: fbnic: add locking support for hw stats
This patch adds lock protection for the hardware statistics for fbnic. The hardware statistics access via ndo_get_stats64 is not protected by the rtnl_lock(). Since these stats can be accessed from different places in the code such as service task, ethtool, Q-API, and net_device_ops, a lock-less approach can lead to races. Note that this patch is not a fix rather, just a prep for the subsequent changes in this series. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250410070859.4160768-2-mohsin.bashr@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to '')
-rw-r--r--drivers/net/ethernet/meta/fbnic/fbnic_pci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
index 6cbbc2ee3e1f..1f76ebdd6ad1 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
@@ -292,6 +292,7 @@ static int fbnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
fbnic_devlink_register(fbd);
fbnic_dbg_fbd_init(fbd);
+ spin_lock_init(&fbd->hw_stats_lock);
/* Capture snapshot of hardware stats so netdev can calculate delta */
fbnic_reset_hw_stats(fbd);