Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Oct 2009 14:28:23 +0000 (UTC)
From:      Andrew Gallatin <gallatin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r197773 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/mxge dev/xen/xenpci
Message-ID:  <200910051428.n95ESNhM015041@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gallatin
Date: Mon Oct  5 14:28:23 2009
New Revision: 197773
URL: http://svn.freebsd.org/changeset/base/197773

Log:
  MFC:197645
  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.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/mxge/if_mxge.c
  stable/8/sys/dev/mxge/if_mxge_var.h
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/mxge/if_mxge.c
==============================================================================
--- stable/8/sys/dev/mxge/if_mxge.c	Mon Oct  5 14:13:16 2009	(r197772)
+++ stable/8/sys/dev/mxge/if_mxge.c	Mon Oct  5 14:28:23 2009	(r197773)
@@ -3653,10 +3653,16 @@ mxge_setup_cfg_space(mxge_softc_t *sc)
 	if (pci_find_extcap(dev, PCIY_EXPRESS, &reg) == 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 */
@@ -3768,6 +3774,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: stable/8/sys/dev/mxge/if_mxge_var.h
==============================================================================
--- stable/8/sys/dev/mxge/if_mxge_var.h	Mon Oct  5 14:13:16 2009	(r197772)
+++ stable/8/sys/dev/mxge/if_mxge_var.h	Mon Oct  5 14:28:23 2009	(r197773)
@@ -273,6 +273,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];



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910051428.n95ESNhM015041>