svn commit: r258142 - head/sys/net

John Baldwin jhb at freebsd.org
Fri Nov 15 15:44:10 UTC 2013


On Friday, November 15, 2013 7:23:23 am Bruce Evans wrote:
> On Thu, 14 Nov 2013, George Neville-Neil wrote:
> Does the API require defining OUI_FREEBSD as a value that needs to be
> shifted left by 24 to use?  It would be more useful to define it as the
> left-shifted value.  Then it gives the base for the FreeBSD range.
> Values that aren't left shifted have the advantage of fitting in 32 bits,
> so that their natural type is always int the type needed to hold the
> left-shifted value can be implementation-defined (it should be int64_t
> on 32-bit systems and long on 64-bit systems).

The API is free to be whatever we want.  I agree that it would be simpler
to make the full value explicit.  Perhaps something like this:

#define OUI_FREEBSD_BASE 0x589cfc000000
#define OUI_FREEBSD(nic)  (OUI_FREEBSD_BASE | (nic))

And then you can have:

#define OUI_FREEBSD_BHYVE_LOW OUI_FREEBSD(0x000001)
#define OUI_FREEBSD_BHYVE_HIGH OUI_FREEBSD(0x00ffff)

That avoids the needs for any casts, etc.

-- 
John Baldwin


More information about the svn-src-all mailing list