Change-Id: I62a2a6524b72115a4239fbd7dc9ac8fdc35e20ed
Signed-off-by: John Lo <loj@cisco.com>
adj_index0 = gt0->l2_adj_index;
}
adj_index0 = gt0->l2_adj_index;
}
- if (sw_if_index0 == vnet_buffer (b1)->sw_if_index[VLIB_TX])
+ if (sw_if_index1 != vnet_buffer (b1)->sw_if_index[VLIB_TX])
- sw_if_index1 = sw_if_index0;
- gt1 = gt0;
- adj_index1 = adj_index0;
- }
- else if (sw_if_index1 != vnet_buffer (b1)->sw_if_index[VLIB_TX])
- {
- sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX];
- vnet_hw_interface_t *hi1 =
- vnet_get_sup_hw_interface (vnm, sw_if_index1);
- gt1 = &gm->tunnels[hi1->dev_instance];
- adj_index1 = gt1->l2_adj_index;
+ if (sw_if_index0 == vnet_buffer (b1)->sw_if_index[VLIB_TX])
+ {
+ sw_if_index1 = sw_if_index0;
+ gt1 = gt0;
+ adj_index1 = adj_index0;
+ }
+ else
+ {
+ sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX];
+ vnet_hw_interface_t *hi1 =
+ vnet_get_sup_hw_interface (vnm, sw_if_index1);
+ gt1 = &gm->tunnels[hi1->dev_instance];
+ adj_index1 = gt1->l2_adj_index;
+ }
}
vnet_buffer (b0)->ip.adj_index[VLIB_TX] = adj_index0;
}
vnet_buffer (b0)->ip.adj_index[VLIB_TX] = adj_index0;
else
{
/* Default MAC address (d00b:eed0:0000 + sw_if_index) */
else
{
/* Default MAC address (d00b:eed0:0000 + sw_if_index) */
- u8 address[6] = { 0xd0, 0x0b, 0xee, 0xd0, (u8) t_idx >> 8, (u8) t_idx };
- error = ethernet_register_interface (vnm, gre_device_class.index, t_idx,
- address, &hw_if_index, 0);
+ u8 address[6] =
+ { 0xd0, 0x0b, 0xee, 0xd0, (u8) (t_idx >> 8), (u8) t_idx };
+ error =
+ ethernet_register_interface (vnm, gre_device_class.index, t_idx,
+ address, &hw_if_index, 0);
if (error)
{
clib_error_report (error);
if (error)
{
clib_error_report (error);
vxlan_main_t * vxm = &vxlan_main;
vnet_main_t * vnm = vxm->vnet_main;
vnet_interface_main_t * im = &vnm->interface_main;
vxlan_main_t * vxm = &vxlan_main;
vnet_main_t * vnm = vxm->vnet_main;
vnet_interface_main_t * im = &vnm->interface_main;
- vlib_combined_counter_main_t * tx_counter = im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_TX;
+ vlib_combined_counter_main_t * tx_counter =
+ im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_TX;
u32 pkts_encapsulated = 0;
u32 thread_index = vlib_get_thread_index();
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
u32 sw_if_index0 = 0, sw_if_index1 = 0;
u32 next0 = 0, next1 = 0;
u32 pkts_encapsulated = 0;
u32 thread_index = vlib_get_thread_index();
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
u32 sw_if_index0 = 0, sw_if_index1 = 0;
u32 next0 = 0, next1 = 0;
- vnet_hw_interface_t * hi0, * hi1;
vxlan_tunnel_t * t0 = NULL, * t1 = NULL;
vxlan_tunnel_t * t0 = NULL, * t1 = NULL;
+ index_t dpoi_idx0 = INDEX_INVALID, dpoi_idx1 = INDEX_INVALID;
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
if (sw_if_index0 != vnet_buffer(b0)->sw_if_index[VLIB_TX])
{
sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
if (sw_if_index0 != vnet_buffer(b0)->sw_if_index[VLIB_TX])
{
sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
- hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
+ vnet_hw_interface_t *hi0 =
+ vnet_get_sup_hw_interface (vnm, sw_if_index0);
t0 = &vxm->tunnels[hi0->dev_instance];
t0 = &vxm->tunnels[hi0->dev_instance];
- /* Note: change to always set next0 if it may be set to drop */
+ /* Note: change to always set next0 if it may set to drop */
next0 = t0->next_dpo.dpoi_next_node;
next0 = t0->next_dpo.dpoi_next_node;
+ dpoi_idx0 = t0->next_dpo.dpoi_index;
- vnet_buffer(b0)->ip.adj_index[VLIB_TX] = t0->next_dpo.dpoi_index;
/* Get next node index and adj index from tunnel next_dpo */
if (sw_if_index1 != vnet_buffer(b1)->sw_if_index[VLIB_TX])
{
/* Get next node index and adj index from tunnel next_dpo */
if (sw_if_index1 != vnet_buffer(b1)->sw_if_index[VLIB_TX])
{
- sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_TX];
- hi1 = vnet_get_sup_hw_interface (vnm, sw_if_index1);
- t1 = &vxm->tunnels[hi1->dev_instance];
- /* Note: change to always set next1 if it may be set to drop */
- next1 = t1->next_dpo.dpoi_next_node;
+ if (sw_if_index0 == vnet_buffer(b1)->sw_if_index[VLIB_TX])
+ {
+ sw_if_index1 = sw_if_index0;
+ t1 = t0;
+ next1 = next0;
+ dpoi_idx1 = dpoi_idx0;
+ }
+ else
+ {
+ sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_TX];
+ vnet_hw_interface_t *hi1 =
+ vnet_get_sup_hw_interface (vnm, sw_if_index1);
+ t1 = &vxm->tunnels[hi1->dev_instance];
+ /* Note: change to always set next1 if it may set to drop */
+ next1 = t1->next_dpo.dpoi_next_node;
+ dpoi_idx1 = t1->next_dpo.dpoi_index;
+ }
- vnet_buffer(b1)->ip.adj_index[VLIB_TX] = t1->next_dpo.dpoi_index;
+
+ vnet_buffer(b0)->ip.adj_index[VLIB_TX] = dpoi_idx0;
+ vnet_buffer(b1)->ip.adj_index[VLIB_TX] = dpoi_idx1;
ASSERT(vec_len(t0->rewrite) == underlay_hdr_len);
ASSERT(vec_len(t1->rewrite) == underlay_hdr_len);
ASSERT(vec_len(t0->rewrite) == underlay_hdr_len);
ASSERT(vec_len(t1->rewrite) == underlay_hdr_len);
if (sw_if_index0 != vnet_buffer(b0)->sw_if_index[VLIB_TX])
{
sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
if (sw_if_index0 != vnet_buffer(b0)->sw_if_index[VLIB_TX])
{
sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
- hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
+ vnet_hw_interface_t *hi0 =
+ vnet_get_sup_hw_interface (vnm, sw_if_index0);
t0 = &vxm->tunnels[hi0->dev_instance];
/* Note: change to always set next0 if it may be set to drop */
next0 = t0->next_dpo.dpoi_next_node;
t0 = &vxm->tunnels[hi0->dev_instance];
/* Note: change to always set next0 if it may be set to drop */
next0 = t0->next_dpo.dpoi_next_node;
+ dpoi_idx0 = t0->next_dpo.dpoi_index;
- vnet_buffer(b0)->ip.adj_index[VLIB_TX] = t0->next_dpo.dpoi_index;
+ vnet_buffer(b0)->ip.adj_index[VLIB_TX] = dpoi_idx0;
ASSERT(vec_len(t0->rewrite) == underlay_hdr_len);
vlib_buffer_advance (b0, -underlay_hdr_len);
ASSERT(vec_len(t0->rewrite) == underlay_hdr_len);
vlib_buffer_advance (b0, -underlay_hdr_len);
u8 * format_vxlan_tunnel (u8 * s, va_list * args)
{
vxlan_tunnel_t * t = va_arg (*args, vxlan_tunnel_t *);
u8 * format_vxlan_tunnel (u8 * s, va_list * args)
{
vxlan_tunnel_t * t = va_arg (*args, vxlan_tunnel_t *);
- vxlan_main_t * ngm = &vxlan_main;
- u32 dev_instance;
- u32 user_instance;
-
- dev_instance = t - ngm->tunnels;
- user_instance = t->user_instance;
s = format (s,
"[%d] instance %d src %U dst %U vni %d fib-idx %d sw-if-idx %d ",
s = format (s,
"[%d] instance %d src %U dst %U vni %d fib-idx %d sw-if-idx %d ",
- dev_instance,
- user_instance,
+ t->dev_instance, t->user_instance,
format_ip46_address, &t->src, IP46_TYPE_ANY,
format_ip46_address, &t->dst, IP46_TYPE_ANY,
t->vni, t->encap_fib_index, t->sw_if_index);
format_ip46_address, &t->src, IP46_TYPE_ANY,
format_ip46_address, &t->dst, IP46_TYPE_ANY,
t->vni, t->encap_fib_index, t->sw_if_index);
}
vnet_delete_hw_interface (vnm, t->hw_if_index);
}
vnet_delete_hw_interface (vnm, t->hw_if_index);
- hash_unset (vxlan_main.instance_used, instance);
+ hash_unset (vxm->instance_used, instance);
fib_node_deinit(&t->node);
vec_free (t->rewrite);
fib_node_deinit(&t->node);
vec_free (t->rewrite);