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

Isaku Yamahata yamahata at valinux.co.jp
Fri Oct 12 01:24:24 UTC 2012


On Fri, Oct 12, 2012 at 09:04:09AM +0900, Simon Horman wrote:
> On Thu, Oct 11, 2012 at 10:10:39PM +0900, Isaku Yamahata wrote:
> > 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. 
> 
> I'm a little confused.
> 
> This series doesn't track the stack depth as it has an implicit
> limit of one label.

The following cases for example. 
(I might be wrong because it depends on how flow->mpls_lse is managed.)

outer A, B inner --push_mpls(A)--> outer A, A, B inner
outer A, B, C inner --pop_mpls(), set_mpls(B)--> outer A, C inner

I'm not sure if the latter case should be allowed with the scope of this
patch series, though.
mpls_lse = 0 value is internally used for special meaning. I suppose 0 is
also valid label value. But I'm not a MPLS expert.

Need to track mpls stack depth or depth change?

thanks,

> > > +
> > > +    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
> > 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
> 

-- 
yamahata



More information about the dev mailing list