xref: /freebsd/sys/net/ieee_oui.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1fe267a55SPedro F. Giffuni /* -
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3fe267a55SPedro F. Giffuni  *
462f1e1b2SGeorge V. Neville-Neil  * Copyright (c) 2013 The FreeBSD Foundation
562f1e1b2SGeorge V. Neville-Neil  *
662f1e1b2SGeorge V. Neville-Neil  * Redistribution and use in source and binary forms, with or without
762f1e1b2SGeorge V. Neville-Neil  * modification, are permitted provided that the following conditions
862f1e1b2SGeorge V. Neville-Neil  * are met:
962f1e1b2SGeorge V. Neville-Neil  * 1. Redistributions of source code must retain the above copyright
1062f1e1b2SGeorge V. Neville-Neil  *    notice, this list of conditions and the following disclaimer.
1162f1e1b2SGeorge V. Neville-Neil  * 2. Redistributions in binary form must reproduce the above
1262f1e1b2SGeorge V. Neville-Neil  *    copyright notice, this list of conditions and the following
1362f1e1b2SGeorge V. Neville-Neil  *    disclaimer in the documentation and/or other materials provided
1462f1e1b2SGeorge V. Neville-Neil  *    with the distribution.
1562f1e1b2SGeorge V. Neville-Neil  *
1662f1e1b2SGeorge V. Neville-Neil  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
1762f1e1b2SGeorge V. Neville-Neil  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1862f1e1b2SGeorge V. Neville-Neil  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
1962f1e1b2SGeorge V. Neville-Neil  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
2062f1e1b2SGeorge V. Neville-Neil  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2162f1e1b2SGeorge V. Neville-Neil  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2262f1e1b2SGeorge V. Neville-Neil  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
2362f1e1b2SGeorge V. Neville-Neil  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2462f1e1b2SGeorge V. Neville-Neil  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2562f1e1b2SGeorge V. Neville-Neil  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2662f1e1b2SGeorge V. Neville-Neil  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2762f1e1b2SGeorge V. Neville-Neil  * SUCH DAMAGE.
2862f1e1b2SGeorge V. Neville-Neil  *
2962f1e1b2SGeorge V. Neville-Neil  * Author: George V. Neville-Neil
3062f1e1b2SGeorge V. Neville-Neil  *
3162f1e1b2SGeorge V. Neville-Neil  */
3262f1e1b2SGeorge V. Neville-Neil 
3362f1e1b2SGeorge V. Neville-Neil /* Organizationally Unique Identifier assigned by IEEE 14 Nov 2013 */
341350c361SGeorge V. Neville-Neil #define OUI_FREEBSD_BASE 0x589cfc000000
351350c361SGeorge V. Neville-Neil #define OUI_FREEBSD(nic) (OUI_FREEBSD_BASE | (nic))
3662f1e1b2SGeorge V. Neville-Neil 
3762f1e1b2SGeorge V. Neville-Neil /*
3862f1e1b2SGeorge V. Neville-Neil  * OUIs are most often used to uniquely identify network interfaces
3962f1e1b2SGeorge V. Neville-Neil  * and occupy the first 3 bytes of both destination and source MAC
4062f1e1b2SGeorge V. Neville-Neil  * addresses.  The following allocations exist so that various
4162f1e1b2SGeorge V. Neville-Neil  * software systems associated with FreeBSD can have unique IDs in the
4262f1e1b2SGeorge V. Neville-Neil  * absence of hardware.  The use of OUIs for this purpose is not fully
4362f1e1b2SGeorge V. Neville-Neil  * fleshed out but is now in common use in virtualization technology.
4462f1e1b2SGeorge V. Neville-Neil  *
4562f1e1b2SGeorge V. Neville-Neil  * Allocations from this range are expected to be made using COMMON
4662f1e1b2SGeorge V. Neville-Neil  * SENSE by developers.  Do NOT take a large range just because
4762f1e1b2SGeorge V. Neville-Neil  * they're currently wide open.  Take the smallest useful range for
4862f1e1b2SGeorge V. Neville-Neil  * your system.  We have (2^24 - 2) available addresses (see Reserved
4962f1e1b2SGeorge V. Neville-Neil  * Values below) but that is far from infinite.
5062f1e1b2SGeorge V. Neville-Neil  *
5162f1e1b2SGeorge V. Neville-Neil  * In the event of a conflict arbitration of allocation in this file
52d4aff8d1SGeorge V. Neville-Neil  * is subject to core@ approval.
5362f1e1b2SGeorge V. Neville-Neil  *
5462f1e1b2SGeorge V. Neville-Neil  * Applications are differentiated based on the high order bit(s) of
5562f1e1b2SGeorge V. Neville-Neil  * the remaining three bytes.  Our first allocation has all 0s, the
5662f1e1b2SGeorge V. Neville-Neil  * next allocation has the highest bit set.  Allocating in this way
5762f1e1b2SGeorge V. Neville-Neil  * gives us 254 allocations of 64K addresses.  Address blocks can be
5862f1e1b2SGeorge V. Neville-Neil  * concatenated if necessary.
5962f1e1b2SGeorge V. Neville-Neil  *
6062f1e1b2SGeorge V. Neville-Neil  * Reserved Values: 0x000000 and 0xffffff are reserved and MUST NOT BE
6162f1e1b2SGeorge V. Neville-Neil  * allocated for any reason.
6262f1e1b2SGeorge V. Neville-Neil  */
6362f1e1b2SGeorge V. Neville-Neil 
6469023644SPeter Grehan /* Allocate 20 bits to bhyve */
651350c361SGeorge V. Neville-Neil #define OUI_FREEBSD_BHYVE_LOW	OUI_FREEBSD(0x000001)
6669023644SPeter Grehan #define OUI_FREEBSD_BHYVE_HIGH	OUI_FREEBSD(0x0fffff)
673c3aa8c1SKyle Evans 
683c3aa8c1SKyle Evans /*
693c3aa8c1SKyle Evans  * Allocate 16 bits for a pool to give to various interfaces that need a
703c3aa8c1SKyle Evans  * generated address, but don't quite need to slice off a whole section of
713c3aa8c1SKyle Evans  * the OUI (e.g. cloned interfaces, one-off NICs of various vendors).
723c3aa8c1SKyle Evans  *
733c3aa8c1SKyle Evans  * ether_gen_addr should be used to generate an address from this pool.
743c3aa8c1SKyle Evans  */
753c3aa8c1SKyle Evans #define	OUI_FREEBSD_GENERATED_MASK	0x10ffff
763c3aa8c1SKyle Evans #define	OUI_FREEBSD_GENERATED_LOW	OUI_FREEBSD(0x100000)
77409a80e5SChuck Tuffli #define	OUI_FREEBSD_GENERATED_HIGH	OUI_FREEBSD(OUI_FREEBSD_GENERATED_MASK)
78409a80e5SChuck Tuffli 
79409a80e5SChuck Tuffli /* Allocate 16 bits for emulated NVMe devices */
80409a80e5SChuck Tuffli #define OUI_FREEBSD_NVME_MASK		0x20ffff
81409a80e5SChuck Tuffli #define OUI_FREEBSD_NVME_LOW		OUI_FREEBSD(0x200000)
8294c15665SChuck Tuffli #define OUI_FREEBSD_NVME_HIGH		OUI_FREEBSD(OUI_FREEBSD_NVME_MASK)
83