From owner-svn-src-all@FreeBSD.ORG Wed Sep 30 14:42:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFA451065679; Wed, 30 Sep 2009 14:42:06 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDE418FC0A; Wed, 30 Sep 2009 14:42:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8UEg6G6018027; Wed, 30 Sep 2009 14:42:06 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8UEg6vK018024; Wed, 30 Sep 2009 14:42:06 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200909301442.n8UEg6vK018024@svn.freebsd.org> From: Andrew Gallatin Date: Wed, 30 Sep 2009 14:42:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197645 - head/sys/dev/mxge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2009 14:42:07 -0000 Author: gallatin Date: Wed Sep 30 14:42:06 2009 New Revision: 197645 URL: http://svn.freebsd.org/changeset/base/197645 Log: Two more mxge watchdog fixes: 1) Restore the PCI Express control register after a watchdog reset. This is required because the device will come out of watchdog reset with the pectl reg at its default state, and important BIOS configuration (like max payload size) could be lost. 2) Call mxge_start_locked() for every tx queue before dropping the lock in the watchdog handler. This is required, as the queue's buf ring may have filled during the reset. Modified: head/sys/dev/mxge/if_mxge.c head/sys/dev/mxge/if_mxge_var.h Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Wed Sep 30 14:28:38 2009 (r197644) +++ head/sys/dev/mxge/if_mxge.c Wed Sep 30 14:42:06 2009 (r197645) @@ -3701,10 +3701,16 @@ mxge_setup_cfg_space(mxge_softc_t *sc) if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { lnk = pci_read_config(dev, reg + 0x12, 2); sc->link_width = (lnk >> 4) & 0x3f; - - pectl = pci_read_config(dev, reg + 0x8, 2); - pectl = (pectl & ~0x7000) | (5 << 12); - pci_write_config(dev, reg + 0x8, pectl, 2); + + if (sc->pectl == 0) { + pectl = pci_read_config(dev, reg + 0x8, 2); + pectl = (pectl & ~0x7000) | (5 << 12); + pci_write_config(dev, reg + 0x8, pectl, 2); + sc->pectl = pectl; + } else { + /* restore saved pectl after watchdog reset */ + pci_write_config(dev, reg + 0x8, sc->pectl, 2); + } } /* Enable DMA and Memory space access */ @@ -3816,6 +3822,9 @@ mxge_watchdog_reset(mxge_softc_t *sc, in /* release all TX locks */ for (s = 0; s < num_tx_slices; s++) { ss = &sc->ss[s]; +#ifdef IFNET_BUF_RING + mxge_start_locked(ss); +#endif mtx_unlock(&ss->tx.mtx); } } Modified: head/sys/dev/mxge/if_mxge_var.h ============================================================================== --- head/sys/dev/mxge/if_mxge_var.h Wed Sep 30 14:28:38 2009 (r197644) +++ head/sys/dev/mxge/if_mxge_var.h Wed Sep 30 14:42:06 2009 (r197645) @@ -274,6 +274,7 @@ struct mxge_softc { struct sysctl_ctx_list slice_sysctl_ctx; char *mac_addr_string; uint8_t mac_addr[6]; /* eeprom mac address */ + uint16_t pectl; /* save PCIe CTL state */ char product_code_string[64]; char serial_number_string[64]; char cmd_mtx_name[16];