[ovs-dev] [PATCH 4/4] User-Space MPLS actions and matches

Isaku Yamahata yamahata at valinux.co.jp
Thu Oct 11 13:10:39 UTC 2012


On Thu, Oct 11, 2012 at 11:14:40AM +0900, Simon Horman wrote:
> diff --git a/lib/odp-util.c b/lib/odp-util.c
> index 5a1d31c..5ffbaef 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
...
> @@ -1911,6 +2045,33 @@ commit_vlan_action(const struct flow *flow, struct flow *base,
>  }
>  
>  static void
> +commit_mpls_action(const struct flow *flow, struct flow *base,
> +                   struct ofpbuf *odp_actions)
> +{
> +    if (flow->mpls_lse == base->mpls_lse) {
> +        return;
> +    }

Not only label value, but also The stack depth needs to be compared. 


> +
> +    if (base->mpls_lse != htonl(0) && flow->mpls_lse == htonl(0)) {
> +        nl_msg_put_be16(odp_actions, OVS_ACTION_ATTR_POP_MPLS,
> +                        flow->dl_type);
> +    } else if (base->mpls_lse == htonl(0) && flow->mpls_lse != htonl(0)) {
> +        struct ovs_action_push_mpls *mpls;
> +
> +        mpls = nl_msg_put_unspec_uninit(odp_actions, OVS_ACTION_ATTR_PUSH_MPLS,
> +                                        sizeof *mpls);
> +        memset(mpls, 0, sizeof *mpls);
> +        mpls->mpls_ethertype = flow->dl_type;
> +        mpls->mpls_label = flow->mpls_lse;
> +    } else {
> +        nl_msg_put_be32(odp_actions, OVS_ACTION_ATTR_SET_MPLS, flow->mpls_lse);
> +    }
> +
> +    base->dl_type = flow->dl_type;
> +    base->mpls_lse = flow->mpls_lse;
> +}
> +
> +static void
>  commit_set_ipv4_action(const struct flow *flow, struct flow *base,
>                       struct ofpbuf *odp_actions)
>  {

-- 
yamahata



More information about the dev mailing list