• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c
2--- lwip-org/src/core/netif.c	2023-11-24 17:38:29.428481010 +0800
3+++ lwip-vlan/src/core/netif.c	2023-11-27 18:35:00.172481010 +0800
4@@ -355,6 +355,11 @@
5   netif->input = input;
6
7   NETIF_RESET_HINTS(netif);
8+
9+#if GAZELLE_ENABLE
10+  netif->vlan_enable=false;
11+#endif
12+
13 #if ENABLE_LOOPBACK
14   netif->loop_first = NULL;
15   netif->loop_last = NULL;
16@@ -441,6 +446,15 @@
17   return netif;
18 }
19
20+#if GAZELLE_ENABLE
21+void
22+netif_set_vlan_tci(struct netif *netif, u16_t vlan_tci)
23+{
24+  netif->vlan_enable = true;
25+  netif->vlan_tci = vlan_tci;
26+}
27+#endif
28+
29 static void
30 netif_do_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
31 {
32diff -Nur lwip-org/src/core/tcp.c lwip-vlan/src/core/tcp.c
33--- lwip-org/src/core/tcp.c	2023-11-24 17:38:29.448481010 +0800
34+++ lwip-vlan/src/core/tcp.c	2023-11-27 10:42:33.228481010 +0800
35@@ -987,7 +987,9 @@
36   lpcb->tos = pcb->tos;
37
38 #if LWIP_VLAN_PCP
39+#if !GAZELLE_ENABLE
40   lpcb->netif_hints.tci = pcb->netif_hints.tci;
41+#endif
42 #endif /* LWIP_VLAN_PCP */
43 #if GAZELLE_TCP_REUSE_IPPORT
44   lpcb->connect_num = 0;
45diff -Nur lwip-org/src/core/tcp_in.c lwip-vlan/src/core/tcp_in.c
46--- lwip-org/src/core/tcp_in.c	2023-11-24 17:38:29.448481010 +0800
47+++ lwip-vlan/src/core/tcp_in.c	2023-11-27 10:42:33.228481010 +0800
48@@ -808,7 +808,9 @@
49     npcb->listener = pcb;
50 #endif /* LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG */
51 #if LWIP_VLAN_PCP
52+#if !GAZELLE_ENABLE
53     npcb->netif_hints.tci = pcb->netif_hints.tci;
54+#endif
55 #endif /* LWIP_VLAN_PCP */
56     /* inherit socket options */
57     npcb->so_options = pcb->so_options & SOF_INHERITED;
58diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
59--- lwip-org/src/include/lwip/netif.h	2023-11-24 17:38:29.440481010 +0800
60+++ lwip-vlan/src/include/lwip/netif.h	2023-11-27 18:33:07.936481010 +0800
61@@ -45,6 +45,10 @@
62
63 #include "lwip/ip_addr.h"
64
65+#if GAZELLE_ENABLE
66+#include <stdbool.h>
67+#endif
68+
69 #include "lwip/def.h"
70 #include "lwip/pbuf.h"
71 #include "lwip/stats.h"
72@@ -357,6 +361,10 @@
73 #if GAZELLE_ENABLE
74   u64_t rxol_flags;
75   u64_t txol_flags;
76+  bool vlan_enable;
77+  /** vlan id is an attribute of NIC. The variable 'netif_hints' is not used because it is assigned by pcb,
78+   *  while non transport layers without pcb cannot be enabled */
79+  u16_t vlan_tci;
80 #endif
81   /** descriptive abbreviation */
82   char name[2];
83@@ -484,6 +492,7 @@
84 #define netif_get_rxol_flags(netif)  ((netif)->rxol_flags)
85 #define netif_get_txol_flags(netif)  ((netif)->txol_flags)
86
87+void netif_set_vlan_tci(struct netif *netif, u16_t vlan_tci);
88 void netif_set_rtc_mode(struct netif *netif);
89 void netif_set_rxol_flags(struct netif *netif, u64_t flags);
90 void netif_set_txol_flags(struct netif *netif, u64_t flags);
91diff -Nur lwip-org/src/netif/ethernet.c lwip-vlan/src/netif/ethernet.c
92--- lwip-org/src/netif/ethernet.c	2023-11-24 17:38:29.444481010 +0800
93+++ lwip-vlan/src/netif/ethernet.c	2023-11-27 11:07:48.464481010 +0800
94@@ -283,9 +283,15 @@
95   vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
96 #elif LWIP_VLAN_PCP
97   vlan_prio_vid = -1;
98+#if !GAZELLE_ENABLE
99   if (netif->hints && (netif->hints->tci >= 0)) {
100     vlan_prio_vid = (u16_t)netif->hints->tci;
101   }
102+#else
103+  if (netif->vlan_enable) {
104+    vlan_prio_vid = netif->vlan_tci;
105+  }
106+#endif /* GAZELLE_ENABLE */
107 #endif
108   if (vlan_prio_vid >= 0) {
109     struct eth_vlan_hdr *vlanhdr;
110