1195972f6Sopenharmony_ciFrom a7be70b7c210fbe17d4b6a90b8c8a155dd489035 Mon Sep 17 00:00:00 2001 2195972f6Sopenharmony_ciFrom: compile_success <980965867@qq.com> 3195972f6Sopenharmony_ciDate: Sat, 4 Nov 2023 14:16:06 +0000 4195972f6Sopenharmony_ciSubject: [PATCH] enable vlan define 5195972f6Sopenharmony_ci 6195972f6Sopenharmony_ci--- 7195972f6Sopenharmony_ci src/include/lwipopts.h | 3 +++ 8195972f6Sopenharmony_ci src/netif/ethernet.c | 4 ++++ 9195972f6Sopenharmony_ci 2 files changed, 7 insertions(+) 10195972f6Sopenharmony_ci 11195972f6Sopenharmony_cidiff --git a/src/include/lwipopts.h b/src/include/lwipopts.h 12195972f6Sopenharmony_ciindex fdd4f87..a18179e 100644 13195972f6Sopenharmony_ci--- a/src/include/lwipopts.h 14195972f6Sopenharmony_ci+++ b/src/include/lwipopts.h 15195972f6Sopenharmony_ci@@ -261,4 +261,7 @@ 16195972f6Sopenharmony_ci */ 17195972f6Sopenharmony_ci #define LWIP_NETIF_LOOPBACK 1 18195972f6Sopenharmony_ci 19195972f6Sopenharmony_ci+#define ETHARP_SUPPORT_VLAN 1 20195972f6Sopenharmony_ci+#define LWIP_VLAN_PCP 1 21195972f6Sopenharmony_ci+ 22195972f6Sopenharmony_ci #endif /* __LWIPOPTS_H__ */ 23195972f6Sopenharmony_cidiff --git a/src/netif/ethernet.c b/src/netif/ethernet.c 24195972f6Sopenharmony_ciindex cbe298e..d411892 100644 25195972f6Sopenharmony_ci--- a/src/netif/ethernet.c 26195972f6Sopenharmony_ci+++ b/src/netif/ethernet.c 27195972f6Sopenharmony_ci@@ -321,7 +321,11 @@ ethernet_output(struct netif * netif, struct pbuf * p, 28195972f6Sopenharmony_ci ("ethernet_output: sending packet %p\n", (void *)p)); 29195972f6Sopenharmony_ci 30195972f6Sopenharmony_ci #if CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW 31195972f6Sopenharmony_ci+#if LWIP_VLAN_PCP 32195972f6Sopenharmony_ci+ ethh_cksum_set(p, sizeof(*ethhdr)+SIZEOF_VLAN_HDR); 33195972f6Sopenharmony_ci+#else 34195972f6Sopenharmony_ci ethh_cksum_set(p, sizeof(*ethhdr)); 35195972f6Sopenharmony_ci+#endif 36195972f6Sopenharmony_ci #endif 37195972f6Sopenharmony_ci 38195972f6Sopenharmony_ci /* send the packet */ 39195972f6Sopenharmony_ci-- 40195972f6Sopenharmony_ci2.33.0 41195972f6Sopenharmony_ci 42