xref: /freebsd/sys/net/ieee_oui.h (revision 4e579ad047720775ab580b74192c7de8a3386fea)
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  * Author: George V. Neville-Neil
30  *
31  */
32 
33 /* Organizationally Unique Identifier assigned by IEEE 14 Nov 2013 */
34 #define OUI_FREEBSD_BASE 0x589cfc000000
35 #define OUI_FREEBSD(nic) (OUI_FREEBSD_BASE | (nic))
36 
37 /*
38  * OUIs are most often used to uniquely identify network interfaces
39  * and occupy the first 3 bytes of both destination and source MAC
40  * addresses.  The following allocations exist so that various
41  * software systems associated with FreeBSD can have unique IDs in the
42  * absence of hardware.  The use of OUIs for this purpose is not fully
43  * fleshed out but is now in common use in virtualization technology.
44  *
45  * Allocations from this range are expected to be made using COMMON
46  * SENSE by developers.  Do NOT take a large range just because
47  * they're currently wide open.  Take the smallest useful range for
48  * your system.  We have (2^24 - 2) available addresses (see Reserved
49  * Values below) but that is far from infinite.
50  *
51  * In the event of a conflict arbitration of allocation in this file
52  * is subject to core@ approval.
53  *
54  * Applications are differentiated based on the high order bit(s) of
55  * the remaining three bytes.  Our first allocation has all 0s, the
56  * next allocation has the highest bit set.  Allocating in this way
57  * gives us 254 allocations of 64K addresses.  Address blocks can be
58  * concatenated if necessary.
59  *
60  * Reserved Values: 0x000000 and 0xffffff are reserved and MUST NOT BE
61  * allocated for any reason.
62  */
63 
64 /* Allocate 20 bits to bhyve */
65 #define OUI_FREEBSD_BHYVE_LOW	OUI_FREEBSD(0x000001)
66 #define OUI_FREEBSD_BHYVE_HIGH	OUI_FREEBSD(0x0fffff)
67 
68 /*
69  * Allocate 16 bits for a pool to give to various interfaces that need a
70  * generated address, but don't quite need to slice off a whole section of
71  * the OUI (e.g. cloned interfaces, one-off NICs of various vendors).
72  *
73  * ether_gen_addr should be used to generate an address from this pool.
74  */
75 #define	OUI_FREEBSD_GENERATED_MASK	0x10ffff
76 #define	OUI_FREEBSD_GENERATED_LOW	OUI_FREEBSD(0x100000)
77 #define	OUI_FREEBSD_GENERATED_HIGH	OUI_FREEBSD(OUI_FREEBSD_GENERATED_MASK)
78 
79 /* Allocate 16 bits for emulated NVMe devices */
80 #define OUI_FREEBSD_NVME_MASK		0x20ffff
81 #define OUI_FREEBSD_NVME_LOW		OUI_FREEBSD(0x200000)
82 #define OUI_FREEBSD_NVME_HIGH		OUI_FREEBSD(OUI_FREEBSD_NVME_MASK)
83