From: Eilon Greenstein Date: Tue, 21 Jul 2009 05:47:41 +0000 (+0000) Subject: bnx2x: SMP-safe inter_sem X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e15107065d073714dc47cf6b80c8bf5eea1bf18b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git bnx2x: SMP-safe inter_sem Signed-off-by: Vlad Zolotarov Signed-off-by: Eilon Greenstein Signed-off-by: David S. Miller --- diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index f20df6d7dcb5..18c380330bed 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c @@ -706,6 +706,8 @@ static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw) /* disable interrupt handling */ atomic_inc(&bp->intr_sem); + smp_wmb(); /* Ensure that bp->intr_sem update is SMP-safe */ + if (disable_hw) /* prevent the HW from sending interrupts */ bnx2x_int_disable(bp); @@ -6642,7 +6644,12 @@ static void bnx2x_napi_disable(struct bnx2x *bp) static void bnx2x_netif_start(struct bnx2x *bp) { - if (atomic_dec_and_test(&bp->intr_sem)) { + int intr_sem; + + intr_sem = atomic_dec_and_test(&bp->intr_sem); + smp_wmb(); /* Ensure that bp->intr_sem update is SMP-safe */ + + if (intr_sem) { if (netif_running(bp->dev)) { bnx2x_napi_enable(bp); bnx2x_int_enable(bp); @@ -8229,6 +8236,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) /* Disable interrupt handling until HW is initialized */ atomic_set(&bp->intr_sem, 1); + smp_wmb(); /* Ensure that bp->intr_sem update is SMP-safe */ mutex_init(&bp->port.phy_mutex);