PERFORCE change 221800 for review

Bjoern A. Zeeb bz at FreeBSD.org
Wed Feb 6 16:54:39 UTC 2013


http://p4web.freebsd.org/@@221800?ac=10

Change 221800 by bz at bz_zenith on 2013/02/06 16:53:47

	Use the special Ethernet hardware address allocation scheme based
	on unit number (including some checks) for locally administered
	bit set so we can use the in-flash re-programmed addresses from
	atsectl(8).

Affected files ...

.. //depot/projects/ctsrd/beribsd/src/sys/dev/altera/atse/if_atse.c#7 edit

Differences ...

==== //depot/projects/ctsrd/beribsd/src/sys/dev/altera/atse/if_atse.c#7 (text+ko) ====

@@ -679,6 +679,7 @@
 {
 	unsigned long hostid;
 	uint32_t val4;
+	int unit;
 
 	/*
 	 * Make sure to only ever do this once.  Otherwise a reset would
@@ -710,6 +711,31 @@
 	sc->atse_eth_addr[3] = atse_ethernet_option_bits[7];
 	sc->atse_eth_addr[4] = atse_ethernet_option_bits[8];
 	sc->atse_eth_addr[5] = atse_ethernet_option_bits[9];
+
+	/*
+	 * If we find a locally administered address with a 0x0 ending
+	 * adjust by device unit.  If not and this is not the first
+	 * Ethernet, go to random.
+	 */
+	unit = device_get_unit(sc->atse_dev);
+	if (unit == 0x00)
+		return (0);
+
+	if (unit > 0x0f) {
+		device_printf(sc->atse_dev, "We do not support Ethernet "
+		    "addresses for more than 16 MACs. Falling back to "
+		    "random hadware address.\n");
+		goto get_random;
+	}
+	if ((sc->atse_eth_addr[0] & 0x2) == 0 ||
+	    (sc->atse_eth_addr[5] & 0x0f) != 0x0) {
+		device_printf(sc->atse_dev, "Ethernet address not meeting our "
+		    "multi-MAC standards. Falling back to random hadware "
+		    "address.\n");
+		goto get_random;
+	}
+	sc->atse_eth_addr[5] |= (unit & 0x0f);
+
 	return (0);
 
 get_random:


More information about the p4-projects mailing list