summaryrefslogtreecommitdiff
path: root/vlan.h
diff options
context:
space:
mode:
Diffstat (limited to 'vlan.h')
-rw-r--r--vlan.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/vlan.h b/vlan.h
new file mode 100644
index 0000000..b58d1a2
--- /dev/null
+++ b/vlan.h
@@ -0,0 +1,22 @@
+#ifndef VLAN_H
+#define VLAN_H
+
+#include <stdbool.h>
+#include <inttypes.h>
+
+static inline uint16_t vlan_tci2prio(uint16_t tci)
+{
+ return (tci & 0xe000) >> 13;
+}
+
+static inline uint16_t vlan_tci2cfi(uint16_t tci)
+{
+ return (tci & 0x1000) >> 12;
+}
+
+static inline uint16_t vlan_tci2vid(uint16_t tci)
+{
+ return tci & 0x0fff;
+}
+
+#endif