Remove the vhost tap if the physical interface corresponsing to a vhost
interface changes

If before a vrouter soft reset the physical interface was different and
post reset agent adds a different physical interface (corresponding to a
particular vhost), then a system crash is possible subsequently when
somebody tries to remove the module. (This situation can happen  because
interfaces mentioned in agent_param and contrail-vrouter-agent.conf are
different. Unlikely, but possible).

The system crash is because during reset we install a handler on the
physical interface that directly shunts the packet to vhost interface in
the kernel. Post reset, if the interface changes, we don't remove this tap.
If we then remove the vrouter module, the tap points to the module function
and hence an invalid memory.

Change-Id: I28d4a7691d7caea81f849110edf7c7f7170b0bc5
Closes-BUG: #1394473
Merge "Remove the vhost tap if the physical interface corresponsing to a vhost interface changes"
modify vr_compat.h to compile on centos 6.5 and later

Change-Id: Ibf124cf46cf4b07b073494707ee4d0c63da2bed3
Diagnostics - traceroute and ping support

A diagnostic packet is a packet that is injected by agent to accomplish
two main functionalities (for now) - reachability (ping) and path
information (traceroute), given the five tuple (sip,sport,dip,dport,proto).

While injecting the packet, agent explicitly marks the packet as a
diagnostic packet. If the packet transits a compute node, at the
receiving compute, the transport header checksum is used to identify
whether the packet is a diagnostic packet or not.

Ping, thus is straight forward

For traceroute to work, vrouter needs to decrement ttl and send icmp
time to live exceeded message. Every packet that vrouter forwards,
vrouter decerements the ttl and if the ttl goes to zero trap the packet
to agent, which processes the message and sends an icmp ttl exceeded
message. For a diagnostic packet, the inner network header ttl is
also copied onto outer network header so that the fabric routers
do send a ttl exceeded message and thus a map of the underlay is known.

Partial-BUG: #1379622
Change-Id: Idb785a6c25ee02578ee90254a0d6dd137a0eb6d6
Fix return code check

The current code reads:

   if ((ret = vr_fragment_table_init(vrouter) < 0))

The check is performed correctly, but since the "<" comparison takes
precedence, ret is now 1, which confuses the module loader into thinking
everything worked out.

Move the parentheses to fix this issue.

Change-Id: I1278cebbdcebe2aec445d491fa471f6f4ebcc8ba
Return ENOMEM when failing to allocate memory

When vr_btable_alloc fails, it should get reported back up the call
stack as ENOMEM, not EINVAL. This is also what happens in vr_flow.

Change-Id: I250b272c4274904cadb2c1e9a6dc92fc6bc4c7b5
Bug:#1391062 Marking the vp_type alwasy with network protocol and introducing L2_PAYLOAD flag to identify that payload carried after label is L2 payload. The L2 packets also get subjected to DF bit and MSS adjust processing

Change-Id: I5506c371c3b4dca59c4cacb7b01c6406df837cec
Cache more than one packet in the flow hold queue (3 to be precise)

The main problem with caching more than one packet is the race between
forwarding paths adding new packets and agent flushing them in a different
core. One way this can be solved is by deferring the flushing till all
cores have seen the change of the flow state. However, this adds to latency.
Adding a spinlock (the only lock that is possible) is not preferrable
since it is possible that one of the forwarding thread can be looping on
the lock availability.

The way we fix this is by doing a bit of compromise. We run a two stage
flush. In the first stage, which happens when agent has changed the state,
we take all packets that were queued before agent changed the state (
thus solving the latency) and in the second stage that runs in a defer, we
take care of all those packets that were queued at the same moment the flow
entry was changing state, but did not see the change. It is possible that
we will see some latency for these packets and a possible reorder, but till
we observe and conclude that this latency indeed occurs and we can't live with
the anomaly, this solution seems to be the best.

This change also simplifies flow queue alloction and free by making the queue
an array instead of a list.

Many of the files that show up in the commit have a header file inclusion
since we had to remove one inclusion from vrouter.h.

Closes Bug:#1387710

Change-Id: I4d08fc96d6d154f1bcdace1860c51982a324cdd9
Rebase dpdk-devel-squash to juniper/master
Fix compilation errors
Fix compilation warnings
Add new hif_get_encap callback
Fix pkt0 transport
Fix get_udp_src_port (untested)