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