xref: /illumos-gate/usr/src/compat/bhyve/net/ieee_oui.h (revision 32640292339b07090f10ce34d455f98711077343)
1d0b3c59bSPatrick Mooney /* -
2*32640292SAndy Fiddaman  * SPDX-License-Identifier: BSD-2-Clause
3d0b3c59bSPatrick Mooney  *
4d0b3c59bSPatrick Mooney  * Copyright (c) 2013 The FreeBSD Foundation
5d0b3c59bSPatrick Mooney  * All rights reserved.
6d0b3c59bSPatrick Mooney  *
7d0b3c59bSPatrick Mooney  * Redistribution and use in source and binary forms, with or without
8d0b3c59bSPatrick Mooney  * modification, are permitted provided that the following conditions
9d0b3c59bSPatrick Mooney  * are met:
10d0b3c59bSPatrick Mooney  * 1. Redistributions of source code must retain the above copyright
11d0b3c59bSPatrick Mooney  *    notice, this list of conditions and the following disclaimer.
12d0b3c59bSPatrick Mooney  * 2. Redistributions in binary form must reproduce the above
13d0b3c59bSPatrick Mooney  *    copyright notice, this list of conditions and the following
14d0b3c59bSPatrick Mooney  *    disclaimer in the documentation and/or other materials provided
15d0b3c59bSPatrick Mooney  *    with the distribution.
16d0b3c59bSPatrick Mooney  *
17d0b3c59bSPatrick Mooney  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
18d0b3c59bSPatrick Mooney  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19d0b3c59bSPatrick Mooney  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20d0b3c59bSPatrick Mooney  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
21d0b3c59bSPatrick Mooney  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22d0b3c59bSPatrick Mooney  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23d0b3c59bSPatrick Mooney  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24d0b3c59bSPatrick Mooney  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25d0b3c59bSPatrick Mooney  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26d0b3c59bSPatrick Mooney  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27d0b3c59bSPatrick Mooney  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28d0b3c59bSPatrick Mooney  * SUCH DAMAGE.
29d0b3c59bSPatrick Mooney  *
30d0b3c59bSPatrick Mooney  * Author: George V. Neville-Neil
31d0b3c59bSPatrick Mooney  *
32d0b3c59bSPatrick Mooney  */
33d0b3c59bSPatrick Mooney 
34d0b3c59bSPatrick Mooney /* Organizationally Unique Identifier assigned by IEEE 14 Nov 2013 */
35d0b3c59bSPatrick Mooney #define OUI_FREEBSD_BASE 0x589cfc000000
36d0b3c59bSPatrick Mooney #define OUI_FREEBSD(nic) (OUI_FREEBSD_BASE | (nic))
37d0b3c59bSPatrick Mooney 
38d0b3c59bSPatrick Mooney /*
39d0b3c59bSPatrick Mooney  * OUIs are most often used to uniquely identify network interfaces
40d0b3c59bSPatrick Mooney  * and occupy the first 3 bytes of both destination and source MAC
41d0b3c59bSPatrick Mooney  * addresses.  The following allocations exist so that various
42d0b3c59bSPatrick Mooney  * software systems associated with FreeBSD can have unique IDs in the
43d0b3c59bSPatrick Mooney  * absence of hardware.  The use of OUIs for this purpose is not fully
44d0b3c59bSPatrick Mooney  * fleshed out but is now in common use in virtualization technology.
45d0b3c59bSPatrick Mooney  *
46d0b3c59bSPatrick Mooney  * Allocations from this range are expected to be made using COMMON
47d0b3c59bSPatrick Mooney  * SENSE by developers.  Do NOT take a large range just because
48d0b3c59bSPatrick Mooney  * they're currently wide open.  Take the smallest useful range for
49d0b3c59bSPatrick Mooney  * your system.  We have (2^24 - 2) available addresses (see Reserved
50d0b3c59bSPatrick Mooney  * Values below) but that is far from infinite.
51d0b3c59bSPatrick Mooney  *
52d0b3c59bSPatrick Mooney  * In the event of a conflict arbitration of allocation in this file
53d0b3c59bSPatrick Mooney  * is subject to core@ approval.
54d0b3c59bSPatrick Mooney  *
55d0b3c59bSPatrick Mooney  * Applications are differentiated based on the high order bit(s) of
56d0b3c59bSPatrick Mooney  * the remaining three bytes.  Our first allocation has all 0s, the
57d0b3c59bSPatrick Mooney  * next allocation has the highest bit set.  Allocating in this way
58d0b3c59bSPatrick Mooney  * gives us 254 allocations of 64K addresses.  Address blocks can be
59d0b3c59bSPatrick Mooney  * concatenated if necessary.
60d0b3c59bSPatrick Mooney  *
61d0b3c59bSPatrick Mooney  * Reserved Values: 0x000000 and 0xffffff are reserved and MUST NOT BE
62d0b3c59bSPatrick Mooney  * allocated for any reason.
63d0b3c59bSPatrick Mooney  */
64d0b3c59bSPatrick Mooney 
65d0b3c59bSPatrick Mooney /* Allocate 20 bits to bhyve */
66d0b3c59bSPatrick Mooney #define OUI_FREEBSD_BHYVE_LOW	OUI_FREEBSD(0x000001)
67d0b3c59bSPatrick Mooney #define OUI_FREEBSD_BHYVE_HIGH	OUI_FREEBSD(0x0fffff)
68d0b3c59bSPatrick Mooney 
69d0b3c59bSPatrick Mooney /*
70d0b3c59bSPatrick Mooney  * Allocate 16 bits for a pool to give to various interfaces that need a
71d0b3c59bSPatrick Mooney  * generated address, but don't quite need to slice off a whole section of
72d0b3c59bSPatrick Mooney  * the OUI (e.g. cloned interfaces, one-off NICs of various vendors).
73d0b3c59bSPatrick Mooney  *
74d0b3c59bSPatrick Mooney  * ether_gen_addr should be used to generate an address from this pool.
75d0b3c59bSPatrick Mooney  */
76d0b3c59bSPatrick Mooney #define	OUI_FREEBSD_GENERATED_MASK	0x10ffff
77d0b3c59bSPatrick Mooney #define	OUI_FREEBSD_GENERATED_LOW	OUI_FREEBSD(0x100000)
78d0b3c59bSPatrick Mooney #define	OUI_FREEBSD_GENERATED_HIGH	OUI_FREEBSD(OUI_FREEBSD_GENERATED_MASK)
79d0b3c59bSPatrick Mooney 
80d0b3c59bSPatrick Mooney /* Allocate 16 bits for emulated NVMe devices */
81d0b3c59bSPatrick Mooney #define OUI_FREEBSD_NVME_MASK		0x20ffff
82d0b3c59bSPatrick Mooney #define OUI_FREEBSD_NVME_LOW		OUI_FREEBSD(0x200000)
83d0b3c59bSPatrick Mooney #define OUI_FREEBSD_NVME_HIGH		OUI_FREEBSD(OUI_FREEBSD_NVME_MASK)
84