From owner-svn-src-all@FreeBSD.ORG Fri Apr 18 14:28:41 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80092644; Fri, 18 Apr 2014 14:28:41 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51DCC160D; Fri, 18 Apr 2014 14:28:41 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Wb9mS-000I6P-1O; Fri, 18 Apr 2014 14:28:40 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s3IESbrP004499; Fri, 18 Apr 2014 08:28:37 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/CcN9218d+NVjNuSKnMbqT Subject: Re: svn commit: r264646 - head/sys/dev/netfpga10g/nf10bmac From: Ian Lepore To: "Bjoern A. Zeeb" In-Reply-To: <201404181421.s3IELAH0082972@svn.freebsd.org> References: <201404181421.s3IELAH0082972@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Fri, 18 Apr 2014 08:28:37 -0600 Message-ID: <1397831317.1124.301.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Fri, 18 Apr 2014 14:28:41 -0000 On Fri, 2014-04-18 at 14:21 +0000, Bjoern A. Zeeb wrote: > Author: bz > Date: Fri Apr 18 14:21:10 2014 > New Revision: 264646 > URL: http://svnweb.freebsd.org/changeset/base/264646 > > Log: > Now that I figured out where the ethernet addresses come from > on NetFPGA-10G, assign one to the interface by default in a very > similar way. > > MFC after: 6 days > X-Easter-Egg-Hunt: yes > > Modified: > head/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c > > Modified: head/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c > ============================================================================== > --- head/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c Fri Apr 18 12:51:30 2014 (r264645) > +++ head/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c Fri Apr 18 14:21:10 2014 (r264646) > @@ -446,7 +446,25 @@ static int > nf10bmac_reset(struct nf10bmac_softc *sc) > { > > - /* Currently we cannot do anything. */ > + /* > + * If we do not have an ether address set, initialize to the same > + * OUI as NetFPGA-10G Linux driver does (which luckily seems > + * unallocated). We just change the NIC specific part from > + * the slightly long "\0NF10C0" to "\0NFBSD". > + * Oh and we keep the way of setting it from a string as they do. > + * It's an amazing way to hide it. > + * XXX-BZ If NetFPGA gets their own OUI we should fix this. > + */ > + if (sc->nf10bmac_eth_addr[0] == 0x00 && > + sc->nf10bmac_eth_addr[1] == 0x00 && > + sc->nf10bmac_eth_addr[2] == 0x00 && > + sc->nf10bmac_eth_addr[3] == 0x00 && > + sc->nf10bmac_eth_addr[4] == 0x00 && > + sc->nf10bmac_eth_addr[5] == 0x00) { > + memcpy(&sc->nf10bmac_eth_addr, "\0NFBSD", ETHER_ADDR_LEN); > + sc->nf10bmac_eth_addr[5] += sc->nf10bmac_unit; > + } > + > return (0); > } > > For other drivers/socs where we need to cook up an address on the fly, we've used "bsd" as the OUI and a 24-bit random for the low order. Aside from the nice aesthetic, 'bsd' has the "locally administered" bit set and thus is g'teed to not clash with any globally assigned OUI. -- Ian