datapath: Correctly set key->vlan.type for ETH_P_8021Q

Empirically on linux 3.5, it appears that in the case where
vlan_tx_tag_present() is true skb->protocol has
the ethernet type of the frame after the outer VLAN header is
stripped. This is not the value of vlan.type stored in the key in the flow
table and the result is unnecessary upcalls to ovs-vswitchd.

In the case where vlan_tx_qinq_tag_present() it should be valid to
assume that the type of the VLAN header was ETH_P_8021Q. And in that
case, if an inner tag is present then set the tpid of the skb to
ETH_P_8021Q so that it will be used if the skb hits ovs_flow_extract()
again in which case vlan_tx_qinq_tag_present() will be true.

The other case where vlan_tx_qinq_tag_present() is true is that
the qinq tag has been extracted by other means. In this case
assume that the type of the outer vlan tag is ETH_P_8021AD.
I am entirely unsure about the validity of this assumption,
or what bugs may lie in q-in-q handling code.

Signed-off-by: Simon Horman <horms@verge.net.au>
flow: Add inner_dl_type

Add inner_dl_type to track the dl_type of an MPLS encapsulated frame.
This is to allow actions to act on the basis of the inner dl_type,
for instance a SET_IPV4 action that modifies an IP frame that
has had an MPLS label pushed onto it.

Signed-off-by: Simon Horman <horms@verge.net.au>
odp-util: Allow dec_ttl+push_mpls actions

Use the encap_dl_type of a flow to allow a dec_ttl in the
presence of a push_mpls action on a frame where the existing
dec_ttl implementation would otherwise work.

Signed-off-by: Simon Horman <horms@verge.net.au>
flow: Correct IP ttl extraction for MPLS frames

Signed-off-by: Simon Horman <horms@verge.net.au>
flow: Try to extract flow data from inner-frame of MPLS frames

This is needed for actions on MPLS frames that act on the inner frame
after the MPLS tag has been popped.

Signed-off-by: Simon Horman <horms@verge.net.au>
odp-util: Correct BoS logic in commit_mpls_pop_action

Correct MPLS bottom-of-stack (BoS) logic in commit_mpls_pop_action()
so that the dl_type is updated correctly when the bottom of
the stack is reached.

Signed-off-by: Simon Horman <horms@verge.net.au>
datapath: Allow IP actions for MPLS frames

Loosen the verification of IPv4 set actions to allow them
on IPv4 frames encapsulated in MPLS that have the MPLS tag popped.

Signed-off-by: Simon Horman <horms@verge.net.au>
datapath: Include inner-frame information in MPLS frame flow

This is necessary to provided adequately fine-grained matches for
facets that have actions modify inner-frame data.

e.g. A facet that modifies the IP TTL of an MPLS-encapsulated frame
     should not act on a frame if it is MPLS-encapsulated ARP,

It also provides symmetry with ovs-vswitchd's view of flows.
ovs-vswitchd requires inner-frame information in order to compose
actions that modify inner-frame data. e.g. an action that modifies
the IP TTL, is composed as a SET_IPV4 action and composing this
requires knowledge of the IPv4 addresses of the frame.

Signed-off-by: Simon Horman <horms@verge.net.au>
Revert "datapath: Allow IP actions for MPLS frames"

This reverts commit 1007b418d2a50d3e07d33aca91ca83f44877806f.
datapath: Allow IP set actions on MPLS frames

This is to allow ttl set and decrement which would otherwise
be disallowed.

Signed-off-by: Simon Horman <horms@verge.net.au>