1From a7be70b7c210fbe17d4b6a90b8c8a155dd489035 Mon Sep 17 00:00:00 2001 2From: compile_success <980965867@qq.com> 3Date: Sat, 4 Nov 2023 14:16:06 +0000 4Subject: [PATCH] enable vlan define 5 6--- 7 src/include/lwipopts.h | 3 +++ 8 src/netif/ethernet.c | 4 ++++ 9 2 files changed, 7 insertions(+) 10 11diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h 12index fdd4f87..a18179e 100644 13--- a/src/include/lwipopts.h 14+++ b/src/include/lwipopts.h 15@@ -261,4 +261,7 @@ 16 */ 17 #define LWIP_NETIF_LOOPBACK 1 18 19+#define ETHARP_SUPPORT_VLAN 1 20+#define LWIP_VLAN_PCP 1 21+ 22 #endif /* __LWIPOPTS_H__ */ 23diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c 24index cbe298e..d411892 100644 25--- a/src/netif/ethernet.c 26+++ b/src/netif/ethernet.c 27@@ -321,7 +321,11 @@ ethernet_output(struct netif * netif, struct pbuf * p, 28 ("ethernet_output: sending packet %p\n", (void *)p)); 29 30 #if CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW 31+#if LWIP_VLAN_PCP 32+ ethh_cksum_set(p, sizeof(*ethhdr)+SIZEOF_VLAN_HDR); 33+#else 34 ethh_cksum_set(p, sizeof(*ethhdr)); 35+#endif 36 #endif 37 38 /* send the packet */ 39-- 402.33.0 41 42