Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Feb 2013 16:54:39 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 221800 for review
Message-ID:  <201302061654.r16Gsdl9067798@skunkworks.freebsd.org>

index | next in thread | raw e-mail

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

Change 221800 by bz@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:


help

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