svn commit: r247794 - stable/9/sys/dev/mxge

Andrew Gallatin gallatin at FreeBSD.org
Mon Mar 4 15:30:39 UTC 2013


Author: gallatin
Date: Mon Mar  4 15:30:38 2013
New Revision: 247794
URL: http://svnweb.freebsd.org/changeset/base/247794

Log:
  MFC r247159
    Improvements for newer mxge nics:
  
    - Some mxge nics may store the serial number in the SN2 field of the
      EEPROM.  These will also have an SN=0 field, so parse the SN2 field,
      and give it precedence.
  
    - Skip MXGEFW_CMD_UNALIGNED_TEST on mxge nics which do not require it.
      This saves roughly 10ms per port at device attach time.

Modified:
  stable/9/sys/dev/mxge/if_mxge.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/mxge/if_mxge.c
==============================================================================
--- stable/9/sys/dev/mxge/if_mxge.c	Mon Mar  4 15:03:52 2013	(r247793)
+++ stable/9/sys/dev/mxge/if_mxge.c	Mon Mar  4 15:30:38 2013	(r247794)
@@ -290,11 +290,12 @@ mxge_parse_strings(mxge_softc_t *sc)
 #define MXGE_NEXT_STRING(p) while(ptr < limit && *ptr++)
 
 	char *ptr, *limit;
-	int i, found_mac;
+	int i, found_mac, found_sn2;
 
 	ptr = sc->eeprom_strings;
 	limit = sc->eeprom_strings + MXGE_EEPROM_STRINGS_SIZE;
 	found_mac = 0;
+	found_sn2 = 0;
 	while (ptr < limit && *ptr != '\0') {
 		if (memcmp(ptr, "MAC=", 4) == 0) {
 			ptr += 1;
@@ -310,10 +311,16 @@ mxge_parse_strings(mxge_softc_t *sc)
 			ptr += 3;
 			strncpy(sc->product_code_string, ptr,
 				sizeof (sc->product_code_string) - 1);
-		} else if (memcmp(ptr, "SN=", 3) == 0) {
+		} else if (!found_sn2 && (memcmp(ptr, "SN=", 3) == 0)) {
 			ptr += 3;
 			strncpy(sc->serial_number_string, ptr,
 				sizeof (sc->serial_number_string) - 1);
+		} else if (memcmp(ptr, "SN2=", 4) == 0) {
+			/* SN2 takes precedence over SN */
+			ptr += 4;
+			found_sn2 = 1;
+			strncpy(sc->serial_number_string, ptr,
+				sizeof (sc->serial_number_string) - 1);
 		}
 		MXGE_NEXT_STRING(ptr);
 	}
@@ -580,9 +587,10 @@ mxge_firmware_probe(mxge_softc_t *sc)
 
 	/* 
 	 * Run a DMA test which watches for unaligned completions and
-	 * aborts on the first one seen.
+	 * aborts on the first one seen.  Not required on Z8ES or newer.
 	 */
-
+	if (pci_get_revid(sc->dev) >= MXGE_PCI_REV_Z8ES)
+		return 0;
 	status = mxge_dma_test(sc, MXGEFW_CMD_UNALIGNED_TEST);
 	if (status == 0)
 		return 0; /* keep the aligned firmware */


More information about the svn-src-stable-9 mailing list