From 9599182f3b9e66ac26f2f7d706127514f82c5c56 Mon Sep 17 00:00:00 2001 From: stsp Date: Fri, 21 Apr 2017 16:40:11 +0000 Subject: [PATCH] Fix nic lock usage around iwm_disable_rx_dma(). iwm_disable_rx_dma() was unintentionally releasing the nic lock too early. Patch by Imre Vadasz. --- sys/dev/pci/if_iwm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index a7332b4392f..13e29748d35 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.168 2017/04/21 16:39:52 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.169 2017/04/21 16:40:11 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -1646,12 +1646,14 @@ iwm_nic_config(struct iwm_softc *sc) int iwm_nic_rx_init(struct iwm_softc *sc) { - if (!iwm_nic_lock(sc)) - return EBUSY; - memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat)); iwm_disable_rx_dma(sc); + + if (!iwm_nic_lock(sc)) + return EBUSY; + + /* reset and flush pointers */ IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_RBDCB_WPTR, 0); IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_FLUSH_RB_REQ, 0); IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_RDPTR, 0); -- 2.20.1