- l4_proto == IPPROTO_UDP) {
- udp_hdr = (struct udp_hdr *)((char *)l3_hdr + l3_len);
-
- /* check udp destination port, 4789 is the default
- * vxlan port (rfc7348) */
- if (udp_hdr->dst_port == _htons(4789)) {
- l4_tun_len = ETHER_VXLAN_HLEN;
- tunnel = 1;
-
- /* currently, this flag is set by i40e only if the
- * packet is vxlan */
- } else if (m->ol_flags & (PKT_RX_TUNNEL_IPV4_HDR |
- PKT_RX_TUNNEL_IPV6_HDR))
- tunnel = 1;
-
- if (tunnel == 1) {
- outer_ethertype = ethertype;
- outer_l2_len = l2_len;
- outer_l3_len = l3_len;
- outer_l3_hdr = l3_hdr;
-
- eth_hdr = (struct ether_hdr *)((char *)udp_hdr +
- sizeof(struct udp_hdr) +
- sizeof(struct vxlan_hdr));
-
- parse_ethernet(eth_hdr, ðertype, &l2_len,
- &l3_len, &l4_proto, &l4_len);
- l3_hdr = (char *)eth_hdr + l2_len;
- }
+ info.l4_proto == IPPROTO_UDP) {
+ struct udp_hdr *udp_hdr;
+ udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info.l3_len);
+ parse_vxlan(udp_hdr, &info, m->ol_flags);
+ }
+
+ /* update l3_hdr and outer_l3_hdr if a tunnel was parsed */
+ if (info.is_tunnel) {
+ outer_l3_hdr = l3_hdr;
+ l3_hdr = (char *)l3_hdr + info.outer_l3_len + info.l2_len;