git: 533c0d345b93 - main - sys/net: move DOT1Q_VID_* constants to ethernet.h
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 04 Jul 2025 23:22:34 UTC
The branch main has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=533c0d345b93ecf6832c9f689f5401c3fb182229
commit 533c0d345b93ecf6832c9f689f5401c3fb182229
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-07-02 01:19:34 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-07-04 23:21:51 +0000
sys/net: move DOT1Q_VID_* constants to ethernet.h
These are generally useful to anything dealing with 802.1q and aren't
specific to if_vlan, so move them to <net/ethernet.h> and remove the
_KERNEL gate.
While here, document what they actually mean.
Reviewed by: kp, des
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50570
---
sys/net/ethernet.h | 17 +++++++++++++++++
sys/net/if_vlan_var.h | 7 -------
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h
index 6eefedba8775..cf4f75bd0b6c 100644
--- a/sys/net/ethernet.h
+++ b/sys/net/ethernet.h
@@ -80,6 +80,23 @@ struct ether_addr {
(((addr)[0] | (addr)[1] | (addr)[2] | \
(addr)[3] | (addr)[4] | (addr)[5]) == 0x00)
+/*
+ * 802.1q VID constants from IEEE 802.1Q-2014, table 9-2.
+ */
+
+/* Null VID: The tag contains only PCP (priority) and DEI information. */
+#define DOT1Q_VID_NULL 0x0
+/* The default PVID for a bridge port. NB: bridge(4) does not honor this. */
+#define DOT1Q_VID_DEF_PVID 0x1
+/* The default SR_PVID for SRP Stream related traffic. */
+#define DOT1Q_VID_DEF_SR_PVID 0x2
+/* A VID reserved for implementation use, not permitted on the wire. */
+#define DOT1Q_VID_RSVD_IMPL 0xfff
+/* The lowest valid VID. */
+#define DOT1Q_VID_MIN 0x1
+/* The highest valid VID. */
+#define DOT1Q_VID_MAX 0xffe
+
/*
* This is the type of the VLAN ID inside the tag, not the tag itself.
*/
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
index f0b09445d04b..695bb81f77b3 100644
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -126,13 +126,6 @@ struct vlanreq {
#define VLAN_PCP_MAX 7
-#define DOT1Q_VID_NULL 0x0
-#define DOT1Q_VID_DEF_PVID 0x1
-#define DOT1Q_VID_DEF_SR_PVID 0x2
-#define DOT1Q_VID_RSVD_IMPL 0xfff
-#define DOT1Q_VID_MIN 1 /* minimum valid vlan id */
-#define DOT1Q_VID_MAX 4094 /* maximum valid vlan id */
-
/*
* 802.1q full tag. Proto and vid are stored in host byte order.
*/