summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
diff options
context:
space:
mode:
authorAriel Elior2013-08-28 00:13:04 +0200
committerDavid S. Miller2013-08-28 04:03:04 +0200
commita3097bda78c7fb41fd3091ffb70bf7bd946e6997 (patch)
tree2d5465e0b14fda3d836c84d2cb7e834e71818a08 /drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
parentbnx2x: Fix VF memory leak unload (diff)
downloadkernel-qcow2-linux-a3097bda78c7fb41fd3091ffb70bf7bd946e6997.tar.gz
kernel-qcow2-linux-a3097bda78c7fb41fd3091ffb70bf7bd946e6997.tar.xz
kernel-qcow2-linux-a3097bda78c7fb41fd3091ffb70bf7bd946e6997.zip
bnx2x: Fix VF stats sync
Since the PF gathers statistics for the VF, when the VF is about to unload we must synchronize the release of its statistics buffer with the PF, so that no DMA operation will be made to that address after the buffer release. Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index fed9b1543b9f..86436c77af03 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -1993,3 +1993,14 @@ void bnx2x_afex_collect_stats(struct bnx2x *bp, void *void_afex_stats,
estats->mac_discard);
}
}
+
+void bnx2x_stats_safe_exec(struct bnx2x *bp,
+ void (func_to_exec)(void *cookie),
+ void *cookie){
+ if (down_timeout(&bp->stats_sema, HZ/10))
+ BNX2X_ERR("Unable to acquire stats lock\n");
+ bnx2x_stats_comp(bp);
+ func_to_exec(cookie);
+ __bnx2x_stats_start(bp);
+ up(&bp->stats_sema);
+}