One looks up the FIB attached to the interface the packet arrives on. The other checks whether a previous node indicated which FIB this packet should be forwarded via. Many nodes have documented how they use sw_if_index[], see https://docs.fd.io/vpp/18.01/dc/da9/ip4__forward_8c.html#a981572b77836b7b06de0d93847867180
Chris. From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Saturday, November 4, 2017 1:45 To: [email protected] Cc: [email protected]; [email protected] Subject: [vpp-dev] Ask a question, thanks! Hi, in below fun ip4_lookup_inline,i have a question, please see also the following red part. always_inline uword ip4_lookup_inline (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame, int lookup_for_responses_to_locally_received_packets) fib_index0 = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer (p0)->sw_if_index[VLIB_RX]); //above code ,get fib table index from vnet_buffer (p0)->sw_if_index[VLIB_RX] by vec_elt fib_index0 = (vnet_buffer (p0)->sw_if_index[VLIB_TX] == (u32) ~ 0) ? fib_index0 : vnet_buffer (p0)->sw_if_index[VLIB_TX]; // here my question:if vnet_buffer (p0)->sw_if_index[VLIB_TX] is valid(not -1) , direct use vnet_buffer (p0)->sw_if_index[VLIB_TX] as fib table index .why direct use vnet_buffer (p0)->sw_if_index[VLIB_TX] instead of use vec_elt to get ? regards, chenghu yao
_______________________________________________ vpp-dev mailing list [email protected] https://lists.fd.io/mailman/listinfo/vpp-dev
