- b0 = vlib_get_buffer (vm, bi0);
- b1 = vlib_get_buffer (vm, bi1);
-
- /* 1-wide cache? */
- sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
- sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX];
- hi0 =
- vnet_get_sup_hw_interface (vnm,
- vnet_buffer (b0)->sw_if_index
- [VLIB_TX]);
- hi1 =
- vnet_get_sup_hw_interface (vnm,
- vnet_buffer (b1)->sw_if_index
- [VLIB_TX]);
-
- t0 = pool_elt_at_index (ngm->tunnels, hi0->dev_instance);
- t1 = pool_elt_at_index (ngm->tunnels, hi1->dev_instance);
+ /* get "af_0" */
+ if (sw_if_index0 != vnet_buffer (b[0])->sw_if_index[VLIB_TX])
+ {
+ sw_if_index0 = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
+ hi0 =
+ vnet_get_sup_hw_interface (vnm,
+ vnet_buffer (b[0])->sw_if_index
+ [VLIB_TX]);
+ t0 = pool_elt_at_index (ngm->tunnels, hi0->dev_instance);
+ af_0 = (t0->flags & VXLAN_GPE_TUNNEL_IS_IPV4 ? AF_IP4 : AF_IP6);
+ }