diff looks good to me.  ok mikeb

On Tue, Sep 18, 2012 at 12:49 +0200, Gerhard Roth wrote:
> Hi,
> 
> we observed mysterious panics while stopping vr interfaces. This was due
> to vr_stop() trying to stop the transfers but then not waiting for them
> to really finish but rather remove their DMA buffer mappings immediately.
> 
> The patch below uses a loop that was copied from vr_setcfg() (!IFM_ACTIVE)
> to wait for transfers to finish.
> 
> Gerhard
> 
> 
> Index: sys/dev/pci/if_vr.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
> retrieving revision 1.114
> diff -u -p -r1.114 if_vr.c
> --- sys/dev/pci/if_vr.c       30 Jan 2012 09:11:30 -0000      1.114
> +++ sys/dev/pci/if_vr.c       18 Sep 2012 10:48:24 -0000
> @@ -1542,6 +1542,17 @@ vr_stop(struct vr_softc *sc)
>  
>       VR_SETBIT16(sc, VR_COMMAND, VR_CMD_STOP);
>       VR_CLRBIT16(sc, VR_COMMAND, (VR_CMD_RX_ON|VR_CMD_TX_ON));
> +
> +     /* wait for xfers to shutdown */
> +     for (i = VR_TIMEOUT; i > 0; i--) {
> +             DELAY(10);
> +             if (!(CSR_READ_2(sc, VR_COMMAND) & (VR_CMD_TX_ON|VR_CMD_RX_ON)))
> +                     break;
> +     }
> +#ifdef VR_DEBUG
> +     if (i == 0)
> +             printf("%s: rx shutdown error!\n", sc->sc_dev.dv_xname);
> +#endif
>       CSR_WRITE_2(sc, VR_IMR, 0x0000);
>       CSR_WRITE_4(sc, VR_TXADDR, 0x00000000);
>       CSR_WRITE_4(sc, VR_RXADDR, 0x00000000);

Reply via email to