On Tue, Oct 16, 2012 at 01:33:03PM +0900, Simon Horman wrote:
> This patch implements use-space datapath and non-datapath code
> to match and use the datapath API set out in Leo Alterman's patch
> "user-space datapath: Add basic MPLS support to kernel".
>
> The resulting MPLS implementation supports:
> * Pushing a single MPLS label
> * Poping a single MPLS label
> * Modifying an MPLS lable using set-field or load actions
> that act on the label value, tc and bos bit.
> * There is no support for manipulating the TTL
> this is considered future work.
>
> The single-level push pop limitation is implemented by processing
> push, pop and set-field/load actions in order and discarding information
> that would require multiple levels of push/pop to be supported.
>
> e.g.
> push,push -> the first push is discarded
> pop,pop -> the first pop is discarded
>
> This patch is based heavily on work by Ravi K.
>
> Cc: Isaku Yamahata <[email protected]>
> Cc: Ravi K <[email protected]>
> Signed-off-by: Simon Horman <[email protected]>
>
> ---
[snip]
> diff --git a/lib/flow.c b/lib/flow.c
> index 76d2340..d91201e 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
[snip]
> @@ -373,6 +399,25 @@ flow_extract(struct ofpbuf *packet, uint32_t
> skb_priority,
> }
> flow->dl_type = parse_ethertype(&b);
>
> + /* Parse mpls, copy l3 ttl. */
> + if (flow->dl_type == htons(ETH_TYPE_MPLS) ||
> + flow->dl_type == htons(ETH_TYPE_MPLS_MCAST)) {
> + struct ip_header *ih = b.data;
> + struct ip6_hdr *ih6 = b.data;
ih and ih6 should not be initialised until after calling
parse_mpls() and parse_remaining_mpls() as those functions
may alter the value of b.data.
I will fix this in my next post of this patch.
Though I am currently still awaiting futher review.
> + packet->l2_5 = b.data;
> + parse_mpls(&b, flow);
> + if (!(flow->mpls_lse & htonl(MPLS_BOS_MASK))) {
> + parse_remaining_mpls(&b, flow);
> + }
> + if (packet->size >= sizeof *ih &&
> + IP_VER(ih->ip_ihl_ver) == IP_VERSION) {
> + flow->nw_ttl = ih->ip_ttl;
> + } else if (packet->size >= sizeof *ih6 &&
> + IP6_VER(ih6->ip6_vfc) == IP6_VERSION) {
> + flow->nw_ttl = ih6->ip6_hlim;
> + }
> + }
> +
> /* Network layer. */
> packet->l3 = b.data;
> if (flow->dl_type == htons(ETH_TYPE_IP)) {
[snip]
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev