+ n_no_tunnel++;
+ next[0] = IPSEC_INPUT_NEXT_DROP;
+ goto pkt1;
+ }
+ }
+ }
+
+ t0 = pool_elt_at_index (im->tunnel_interfaces, tid0);
+ vnet_buffer (b[0])->ipsec.sad_index = t0->input_sa_index;
+
+ if (PREDICT_TRUE (t0->hw_if_index != ~0))
+ {
+ vnet_buffer (b[0])->ipsec.flags = 0;
+ sw_if_index0 = t0->sw_if_index;
+ vnet_buffer (b[0])->sw_if_index[VLIB_RX] = sw_if_index0;
+
+ if (PREDICT_FALSE (!(t0->flags & VNET_HW_INTERFACE_FLAG_LINK_UP)))
+ {
+ vlib_increment_combined_counter
+ (drop_counter, thread_index, sw_if_index0, 1, len0);
+ n_disabled++;
+ next[0] = IPSEC_INPUT_NEXT_DROP;
+ goto pkt1;
+ }
+
+ if (PREDICT_TRUE (sw_if_index0 == last_sw_if_index))
+ {
+ n_packets++;
+ n_bytes += len0;
+ }
+ else
+ {
+ if (n_packets)
+ {
+ vlib_increment_combined_counter
+ (rx_counter, thread_index, last_sw_if_index,
+ n_packets, n_bytes);
+ }
+
+ last_sw_if_index = sw_if_index0;
+ n_packets = 1;
+ n_bytes = len0;
+ }
+ }
+ else
+ {
+ vnet_buffer (b[0])->ipsec.flags = IPSEC_FLAG_IPSEC_GRE_TUNNEL;
+ }
+
+ pkt1:
+ if (is_ip6)
+ {
+ key61.remote_ip = ip61->src_address;
+ key61.spi = esp1->spi;
+
+ if (memcmp (&key61, &last_key6, sizeof (last_key6)) == 0)
+ {
+ tid1 = last_tunnel_id;
+ }
+ else
+ {
+ uword *p =
+ hash_get_mem (im->ipsec6_if_pool_index_by_key, &key61);
+ if (p)
+ {
+ tid1 = p[0];
+ last_tunnel_id = tid1;
+ clib_memcpy_fast (&last_key6, &key61, sizeof (key61));
+ }
+ else
+ {
+ n_no_tunnel++;
+ next[1] = IPSEC_INPUT_NEXT_DROP;
+ goto trace1;
+ }
+ }
+ }
+ else /* !is_ip6 */
+ {
+ key41.remote_ip = ip41->src_address.as_u32;
+ key41.spi = esp1->spi;
+
+ if (key41.as_u64 == last_key4.as_u64)
+ {
+ tid1 = last_tunnel_id;
+ }
+ else
+ {
+ uword *p =
+ hash_get (im->ipsec4_if_pool_index_by_key, key41.as_u64);
+ if (p)
+ {
+ tid1 = p[0];
+ last_tunnel_id = tid1;
+ last_key4.as_u64 = key41.as_u64;
+ }
+ else
+ {
+ n_no_tunnel++;
+ next[1] = IPSEC_INPUT_NEXT_DROP;
+ goto trace1;
+ }
+ }
+ }
+
+ t1 = pool_elt_at_index (im->tunnel_interfaces, tid1);
+ vnet_buffer (b[1])->ipsec.sad_index = t1->input_sa_index;
+
+ if (PREDICT_TRUE (t1->hw_if_index != ~0))
+ {
+ vnet_buffer (b[1])->ipsec.flags = 0;
+ sw_if_index1 = t1->sw_if_index;
+ vnet_buffer (b[1])->sw_if_index[VLIB_RX] = sw_if_index1;
+
+ if (PREDICT_FALSE (!(t1->flags & VNET_HW_INTERFACE_FLAG_LINK_UP)))
+ {
+ vlib_increment_combined_counter
+ (drop_counter, thread_index, sw_if_index1, 1, len1);
+ n_disabled++;
+ next[1] = IPSEC_INPUT_NEXT_DROP;
+ goto trace1;
+ }
+
+ if (PREDICT_TRUE (sw_if_index1 == last_sw_if_index))
+ {
+ n_packets++;
+ n_bytes += len1;
+ }
+ else
+ {
+ if (n_packets)
+ {
+ vlib_increment_combined_counter
+ (rx_counter, thread_index, last_sw_if_index,
+ n_packets, n_bytes);