1195972f6Sopenharmony_cidiff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c 2195972f6Sopenharmony_ci--- lwip-org/src/core/netif.c 2023-11-24 17:38:29.428481010 +0800 3195972f6Sopenharmony_ci+++ lwip-vlan/src/core/netif.c 2023-11-27 18:35:00.172481010 +0800 4195972f6Sopenharmony_ci@@ -355,6 +355,11 @@ 5195972f6Sopenharmony_ci netif->input = input; 6195972f6Sopenharmony_ci 7195972f6Sopenharmony_ci NETIF_RESET_HINTS(netif); 8195972f6Sopenharmony_ci+ 9195972f6Sopenharmony_ci+#if GAZELLE_ENABLE 10195972f6Sopenharmony_ci+ netif->vlan_enable=false; 11195972f6Sopenharmony_ci+#endif 12195972f6Sopenharmony_ci+ 13195972f6Sopenharmony_ci #if ENABLE_LOOPBACK 14195972f6Sopenharmony_ci netif->loop_first = NULL; 15195972f6Sopenharmony_ci netif->loop_last = NULL; 16195972f6Sopenharmony_ci@@ -441,6 +446,15 @@ 17195972f6Sopenharmony_ci return netif; 18195972f6Sopenharmony_ci } 19195972f6Sopenharmony_ci 20195972f6Sopenharmony_ci+#if GAZELLE_ENABLE 21195972f6Sopenharmony_ci+void 22195972f6Sopenharmony_ci+netif_set_vlan_tci(struct netif *netif, u16_t vlan_tci) 23195972f6Sopenharmony_ci+{ 24195972f6Sopenharmony_ci+ netif->vlan_enable = true; 25195972f6Sopenharmony_ci+ netif->vlan_tci = vlan_tci; 26195972f6Sopenharmony_ci+} 27195972f6Sopenharmony_ci+#endif 28195972f6Sopenharmony_ci+ 29195972f6Sopenharmony_ci static void 30195972f6Sopenharmony_ci netif_do_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr) 31195972f6Sopenharmony_ci { 32195972f6Sopenharmony_cidiff -Nur lwip-org/src/core/tcp.c lwip-vlan/src/core/tcp.c 33195972f6Sopenharmony_ci--- lwip-org/src/core/tcp.c 2023-11-24 17:38:29.448481010 +0800 34195972f6Sopenharmony_ci+++ lwip-vlan/src/core/tcp.c 2023-11-27 10:42:33.228481010 +0800 35195972f6Sopenharmony_ci@@ -987,7 +987,9 @@ 36195972f6Sopenharmony_ci lpcb->tos = pcb->tos; 37195972f6Sopenharmony_ci 38195972f6Sopenharmony_ci #if LWIP_VLAN_PCP 39195972f6Sopenharmony_ci+#if !GAZELLE_ENABLE 40195972f6Sopenharmony_ci lpcb->netif_hints.tci = pcb->netif_hints.tci; 41195972f6Sopenharmony_ci+#endif 42195972f6Sopenharmony_ci #endif /* LWIP_VLAN_PCP */ 43195972f6Sopenharmony_ci #if GAZELLE_TCP_REUSE_IPPORT 44195972f6Sopenharmony_ci lpcb->connect_num = 0; 45195972f6Sopenharmony_cidiff -Nur lwip-org/src/core/tcp_in.c lwip-vlan/src/core/tcp_in.c 46195972f6Sopenharmony_ci--- lwip-org/src/core/tcp_in.c 2023-11-24 17:38:29.448481010 +0800 47195972f6Sopenharmony_ci+++ lwip-vlan/src/core/tcp_in.c 2023-11-27 10:42:33.228481010 +0800 48195972f6Sopenharmony_ci@@ -808,7 +808,9 @@ 49195972f6Sopenharmony_ci npcb->listener = pcb; 50195972f6Sopenharmony_ci #endif /* LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG */ 51195972f6Sopenharmony_ci #if LWIP_VLAN_PCP 52195972f6Sopenharmony_ci+#if !GAZELLE_ENABLE 53195972f6Sopenharmony_ci npcb->netif_hints.tci = pcb->netif_hints.tci; 54195972f6Sopenharmony_ci+#endif 55195972f6Sopenharmony_ci #endif /* LWIP_VLAN_PCP */ 56195972f6Sopenharmony_ci /* inherit socket options */ 57195972f6Sopenharmony_ci npcb->so_options = pcb->so_options & SOF_INHERITED; 58195972f6Sopenharmony_cidiff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h 59195972f6Sopenharmony_ci--- lwip-org/src/include/lwip/netif.h 2023-11-24 17:38:29.440481010 +0800 60195972f6Sopenharmony_ci+++ lwip-vlan/src/include/lwip/netif.h 2023-11-27 18:33:07.936481010 +0800 61195972f6Sopenharmony_ci@@ -45,6 +45,10 @@ 62195972f6Sopenharmony_ci 63195972f6Sopenharmony_ci #include "lwip/ip_addr.h" 64195972f6Sopenharmony_ci 65195972f6Sopenharmony_ci+#if GAZELLE_ENABLE 66195972f6Sopenharmony_ci+#include <stdbool.h> 67195972f6Sopenharmony_ci+#endif 68195972f6Sopenharmony_ci+ 69195972f6Sopenharmony_ci #include "lwip/def.h" 70195972f6Sopenharmony_ci #include "lwip/pbuf.h" 71195972f6Sopenharmony_ci #include "lwip/stats.h" 72195972f6Sopenharmony_ci@@ -357,6 +361,10 @@ 73195972f6Sopenharmony_ci #if GAZELLE_ENABLE 74195972f6Sopenharmony_ci u64_t rxol_flags; 75195972f6Sopenharmony_ci u64_t txol_flags; 76195972f6Sopenharmony_ci+ bool vlan_enable; 77195972f6Sopenharmony_ci+ /** vlan id is an attribute of NIC. The variable 'netif_hints' is not used because it is assigned by pcb, 78195972f6Sopenharmony_ci+ * while non transport layers without pcb cannot be enabled */ 79195972f6Sopenharmony_ci+ u16_t vlan_tci; 80195972f6Sopenharmony_ci #endif 81195972f6Sopenharmony_ci /** descriptive abbreviation */ 82195972f6Sopenharmony_ci char name[2]; 83195972f6Sopenharmony_ci@@ -484,6 +492,7 @@ 84195972f6Sopenharmony_ci #define netif_get_rxol_flags(netif) ((netif)->rxol_flags) 85195972f6Sopenharmony_ci #define netif_get_txol_flags(netif) ((netif)->txol_flags) 86195972f6Sopenharmony_ci 87195972f6Sopenharmony_ci+void netif_set_vlan_tci(struct netif *netif, u16_t vlan_tci); 88195972f6Sopenharmony_ci void netif_set_rtc_mode(struct netif *netif); 89195972f6Sopenharmony_ci void netif_set_rxol_flags(struct netif *netif, u64_t flags); 90195972f6Sopenharmony_ci void netif_set_txol_flags(struct netif *netif, u64_t flags); 91195972f6Sopenharmony_cidiff -Nur lwip-org/src/netif/ethernet.c lwip-vlan/src/netif/ethernet.c 92195972f6Sopenharmony_ci--- lwip-org/src/netif/ethernet.c 2023-11-24 17:38:29.444481010 +0800 93195972f6Sopenharmony_ci+++ lwip-vlan/src/netif/ethernet.c 2023-11-27 11:07:48.464481010 +0800 94195972f6Sopenharmony_ci@@ -283,9 +283,15 @@ 95195972f6Sopenharmony_ci vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type); 96195972f6Sopenharmony_ci #elif LWIP_VLAN_PCP 97195972f6Sopenharmony_ci vlan_prio_vid = -1; 98195972f6Sopenharmony_ci+#if !GAZELLE_ENABLE 99195972f6Sopenharmony_ci if (netif->hints && (netif->hints->tci >= 0)) { 100195972f6Sopenharmony_ci vlan_prio_vid = (u16_t)netif->hints->tci; 101195972f6Sopenharmony_ci } 102195972f6Sopenharmony_ci+#else 103195972f6Sopenharmony_ci+ if (netif->vlan_enable) { 104195972f6Sopenharmony_ci+ vlan_prio_vid = netif->vlan_tci; 105195972f6Sopenharmony_ci+ } 106195972f6Sopenharmony_ci+#endif /* GAZELLE_ENABLE */ 107195972f6Sopenharmony_ci #endif 108195972f6Sopenharmony_ci if (vlan_prio_vid >= 0) { 109195972f6Sopenharmony_ci struct eth_vlan_hdr *vlanhdr; 110