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