[ovs-dev] Key Attrs in OVS

Ravi.Kerur at telekom.com Ravi.Kerur at telekom.com
Sat Feb 18 21:56:04 UTC 2012


Hi Ben,

Attached latest diffs. Diffs still hasn't fixed flow matching issue, let me know your inputs. I will continue debugging in parallel. To generate mpls packets, run "./mpls br0 1 1"

Thanks
Ravi

-----Original Message-----
From: Ben Pfaff [mailto:blp at nicira.com] 
Sent: Friday, February 17, 2012 11:03 AM
To: Kerur, Ravi
Subject: Re: Key Attrs in OVS

Yes, I'd expect it to be matched also.

On Fri, Feb 17, 2012 at 08:01:18PM +0100, Ravi.Kerur at telekom.com wrote:
> Thanks Ben for the help. I really don't want to bother you with the debugging. I will continue debugging and probably send the diffs later today/tomorrow if I can't figure it out.
> 
> I have written a simple test program which constructs mpls/ipv4/udp packet and sends out on an interface i.e. br0 and I am using this program to test out mpls match. I have verified test program works fine by capturing packets via tcpdump. I program the flow as follows in ovs
> 
> ovs-ofctl add-flow br0 priority=65535,idle_timeout=50000,dl_type=0x8847,actions=NORMAL
> 
> When I send packets via my test program, I expect above flow to be matched and actions taken. I have traced the problem to handle_flow_miss function where "rule" from rule_dpif_lookup" comes out as NULL and hence wanted to check with you on additional requirements for handling 0x8847 dl_type? This might apply to vlan qinq as well, hence thought of getting some clarifications.
> 
> static void
> handle_flow_miss(struct ofproto_dpif *ofproto, struct flow_miss *miss,
>                 struct flow_miss_op *ops, size_t *n_ops)
> {
>     const struct flow *flow = &miss->flow;
>     struct ofpbuf *packet, *next_packet;
>     struct subfacet *subfacet;
>     struct facet *facet;
>  
>     facet = facet_lookup_valid(ofproto, flow);
>     VLOG_ERR("rkk-facet %x %x %x", facet, flow->mpls_lse, flow->dl_type);
>     if (!facet) {
>         struct rule_dpif *rule;
>  
>         rule = rule_dpif_lookup(ofproto, flow, 0);
> ...
> }
> 
> Thanks
> Ravi
>  
> -----Original Message-----
> From: Ben Pfaff [mailto:blp at nicira.com] 
> Sent: Friday, February 17, 2012 10:21 AM
> To: Kerur, Ravi
> Subject: Re: Key Attrs in OVS
> 
> I don't understand the problem you're having in #4.  If you can send a
> patch against master to ovs-dev, with an explanation of how to
> reproduce the problem (how do I send the MPLS packets to trigger the
> problem, for example) then I'll take a stab at debugging it.
> 
> I will be out, with no net access, from Feb. 20 to Feb. 24.
> 
> Thanks,
> 
> Ben.
> 
> On Fri, Feb 17, 2012 at 06:31:19PM +0100, Ravi.Kerur at telekom.com wrote:
> > Hi Ben,
> > 
> > 
> > 
> > Couple of things (need help on 4th one)
> > 
> > 
> > 
> > 1. I needed gcc-multilib for sparse to work correctly. Fixed most of the errors reported by it. Will look into it more closely over the weekend and fix rest of them.
> > 
> > 
> > 
> > 2. I have taken care of your review comments, some of them like bit-mask... I started off with setting lsb and use shifts to check, however, later on I followed vlan model and didn't make changes in rest of the code. Those were in user-space actions and I still hadn't tested them. I have corrected them now.
> > 
> > 
> > 
> > 3. I will get back to you on openflow later.
> > 
> > 
> > 
> > 4. Currently I am facing issues with matching when dl_type=0x8847. I have programmed following flows
> > 
> > 
> > 
> > root at rkerur-ThinkPad-T400:~# ovs-ofctl dump-flows br0
> > 
> > NXST_FLOW reply (xid=0x4):
> > 
> >  cookie=0x0, duration=100.956s, table=0, n_packets=6, n_bytes=3072,
> > 
> > idle_timeout=50000,idle_age=84,priority=100,dl_vlan=1,dl_vlan_pcp=0
> > 
> > actions=strip_vlan,output:1
> > 
> > 
> > 
> >  cookie=0x0, duration=152.81s, table=0, n_packets=29, n_bytes=1790,
> > 
> > idle_timeout=50000,idle_age=0,priority=65535,arp actions=NORMAL
> > 
> > 
> > 
> >  cookie=0x0, duration=56.459s, table=0, n_packets=0, n_bytes=0,
> > 
> > idle_timeout=50000,idle_age=56,priority=65535,mpls actions=NORMAL
> > 
> > 
> > 
> >  cookie=0x0, duration=152.808s, table=0, n_packets=6, n_bytes=588,
> > 
> > idle_timeout=50000,idle_age=113,priority=65535,icmp,nw_src=10.117.46.196,nw_dst=10.117.46.193 actions=push_mpls:8847,set_mpls_label:10,copy_ttl_in,output:
> > 
> > 
> > 
> > Most of the match works fine i.e
> > 
> > 
> > 
> > For ARP flow-2 is matched and arp resolved.
> > 
> > For ICMP flow-4 is matched and I see mpls actions being executed.
> > 
> > For VLAN flow-1 is matched and stats incremented.
> > 
> > For MPLS no flow is matched.
> > 
> > 
> > 
> > I have actions=1 or NORMAL for mpls and its same results.
> > 
> > 
> > 
> > I traced down the code where kernel does an upcall for flow miss in its table and finally ends up in function
> > 
> > handle_flow_miss in ofproto/ofproto-dpif.c
> > 
> > 
> > 
> > static void
> > handle_flow_miss(struct ofproto_dpif *ofproto, struct flow_miss *miss,
> >                 struct flow_miss_op *ops, size_t *n_ops)
> > {
> >    const struct flow *flow = &miss->flow;
> >    struct ofpbuf *packet, *next_packet;
> >    struct subfacet *subfacet;
> >    struct facet *facet;
> > 
> >    facet = facet_lookup_valid(ofproto, flow);
> >    VLOG_ERR("rkk-facet %x %x %x", facet, flow->mpls_lse, flow->dl_type);
> >    if (!facet) {
> >        struct rule_dpif *rule;
> > 
> >        rule = rule_dpif_lookup(ofproto, flow, 0);
> >        VLOG_ERR("rkk-facet-2 %x", rule);
> >        if (!rule) {
> >            /* Don't send a packet-in if OFPPC_NO_PACKET_IN asserted. */
> >            struct ofport_dpif *port = get_ofp_port(ofproto, flow->in_port);
> >            if (port) {
> > ...
> > }
> > 
> > 
> > 
> > From logs, I see facet=null, mpls_lse=aa70000(0x0000a70a->host byte order, ttl=10, tc=3, label=10) and dl_type=4788. It matches what I have sent from my test program.  However, rule also comes out as NULL and packets never get out(ovs-dpctl doesn't show anything).
> > 
> > 
> > 
> > My question is does any additional changes needed to match dl_type=mpls/vlan_qinq. I have modified parse_protocol(lib/ofp-parse.c) to handle mpls protocol and later on it calls cls_rule_set_dl_type. Just wanted to get your inputs on this as I am kind of stuck at it right now.
> > 
> > 
> > 
> > Thanks
> > 
> > Ravi
> > 
> > 
> > 
> > -----Original Message-----
> > From: Ben Pfaff [mailto:blp at nicira.com]
> > Sent: Thursday, February 16, 2012 10:13 AM
> > To: Kerur, Ravi
> > Subject: Re: Key Attrs in OVS
> > 
> > 
> > 
> > The code for translating sw_flow_key to and from Netlink attributes
> > 
> > (OVS_KEY_ATTR_*) handles at the boundary between userspace and the
> > 
> > kernel, so yes it will happen on flow dumps.  It also happens on
> > 
> > flow table misses.  Translating the other direction happens whenever
> > 
> > userspace queries or manipulates flow table entries.
> > 
> > 
> > 
> > Did you read datapath/README?
> > 
> > 
> > 
> > We definitely need code to do these translations for MPLS also.
> > 
> > 
> > 
> > On Thu, Feb 16, 2012 at 07:07:49PM +0100, Ravi.Kerur at telekom.com wrote:
> > 
> > > Ok, More specifically I am looking at
> > 
> > > OVS_KEY_ATTR_ETHERTYPE/OVS_KEY_ATTR_VLAN and it's associated
> > 
> > > code. Basically, this send out nl_attrs to/from kernel and
> > 
> > > updates/extracts sw_flow_key members. My understanding it is being
> > 
> > > used for datapath flow dumps and was not sure its being used for
> > 
> > > anything else?
> > 
> > >
> > 
> > > I am debugging flow not matching problem and wanted to understand
> > 
> > > better on this part of the code. Do you agree that mpls related code
> > 
> > > should be added to this?
> > 
> > >
> > 
> > > Thanks
> > 
> > > Ravi
> > 
> > >
> > 
> > > -----Original Message-----
> > 
> > > From: Ben Pfaff [mailto:blp at nicira.com]
> > 
> > > Sent: Thursday, February 16, 2012 9:55 AM
> > 
> > > To: Kerur, Ravi
> > 
> > > Subject: Re: Key Attrs in OVS
> > 
> > >
> > 
> > > On Thu, Feb 16, 2012 at 06:53:36PM +0100, Ravi.Kerur at telekom.com wrote:
> > 
> > > > Could you please clarify me on Key Attributes i.e. how it is being
> > 
> > > > used in the code. I have done some code reading and added code for
> > 
> > > > mpls key attributes but it is not quite clear its usage. I
> > 
> > > > understand it gets translated to sw_flow_key which is then used for
> > 
> > > > matching but wanted some more description on it. Inputs appreciated.
> > 
> > >
> > 
> > > Can you ask a more specific question?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: latest_mpls_diffs
Type: application/octet-stream
Size: 100132 bytes
Desc: latest_mpls_diffs
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20120218/bc4ed266/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.tgz
Type: application/x-compressed
Size: 5412 bytes
Desc: test.tgz
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20120218/bc4ed266/attachment-0004.bin>


More information about the dev mailing list