diff mbox series

[U-Boot,v2,3/3] linux/if_ether.h: Add VLAN related macros

Message ID 1533030923-12926-3-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit 883b530
Delegated to: Joe Hershberger
Headers show
Series [U-Boot,v2,1/3] linux/if_ether.h: Initial import from Linux kernel v4.17 | expand

Commit Message

Bin Meng July 31, 2018, 9:55 a.m. UTC
There are VLAN related macros defined in include/linux/if_vlan.h
in Linux kernel, as well as some kernel useful structures and inline
functions. Instead of a complete import from kernel, let's add these
VLAN macros to U-Boot's include/linux/if_ether.h.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v2: None

 include/linux/if_ether.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Joe Hershberger Aug. 2, 2018, 4:49 p.m. UTC | #1
On Tue, Jul 31, 2018 at 4:55 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
> There are VLAN related macros defined in include/linux/if_vlan.h
> in Linux kernel, as well as some kernel useful structures and inline
> functions. Instead of a complete import from kernel, let's add these
> VLAN macros to U-Boot's include/linux/if_ether.h.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Oct. 11, 2018, 7:25 p.m. UTC | #2
Hi Bin,

https://patchwork.ozlabs.org/patch/951501/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 9144ad7..0d62aef 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -155,5 +155,24 @@ 
 #define ETH_P_MAP	0x00F9	/* Qualcomm multiplexing and    */
 				/* aggregation protocol         */
 
+/* The following macros come from Linux kernel include/linux/if_vlan.h */
+
+#define VLAN_HLEN	4	/* The additional bytes required by VLAN */
+				/* (in addition to the Ethernet header)  */
+#define VLAN_ETH_HLEN	18	/* Total octets in header.               */
+#define VLAN_ETH_ZLEN	64	/* Min. octets in frame sans FCS         */
+
+/*
+ * According to 802.3ac, the packet can be 4 bytes longer. --Klika Jan
+ */
+#define VLAN_ETH_DATA_LEN	1500	/* Max. octets in payload        */
+#define VLAN_ETH_FRAME_LEN	1518	/* Max. octets in frame sans FCS */
+
+#define VLAN_PRIO_MASK		0xe000	/* Priority Code Point           */
+#define VLAN_PRIO_SHIFT		13
+#define VLAN_CFI_MASK		0x1000	/* Canonical Format Indicator    */
+#define VLAN_TAG_PRESENT	VLAN_CFI_MASK
+#define VLAN_VID_MASK		0x0fff	/* VLAN Identifier               */
+#define VLAN_N_VID		4096
 
 #endif /* _UAPI_LINUX_IF_ETHER_H */