Hi,

I'm trying to port OvS to a prototype fpga switch by implementing the
netdev and ofproto interfaces.

I'm running into a crash (with a reasonably recent master branch) when I run the
second command below (with no flow-tables configured or packets flowing):

  ovs-vsctl add-br br0 -- set bridge br0 datapath_type=blueswitch -- add-port 
br0 nf1
  ovs-vsctl del-br br0

ovs-vswitchd crashes with:
ovs-vswitchd: ofproto/ofproto.c:2403: assertion last_used == LLONG_MAX failed 
in ofport_set_usage()

#0  0x0000003ad52330c5 in raise () from /lib64/libc.so.6
#1  0x0000003ad5234a76 in abort () from /lib64/libc.so.6
#2  0x00000000004c634e in ovs_abort_valist (err_no=<value optimized out>, 
format=<value optimized out>, args=<value optimized out>) at lib/util.c:323
#3  0x00000000004cc868 in vlog_abort_valist (module_=<value optimized out>, 
message=0x528bc0 "%s: assertion %s failed in %s()", args=0x7fffffffdd30) at 
lib/vlog.c:992
#4  0x00000000004cc8f6 in vlog_abort (module=0x1015, message=0x1015 <Address 
0x1015 out of bounds>) at lib/vlog.c:1006
#5  0x00000000004c5f11 in ovs_assert_failure (where=<value optimized out>, 
function=<value optimized out>, condition=<value optimized out>) at 
lib/util.c:72
#6  0x0000000000415910 in ofport_set_usage (ofproto=0x7add50, ofp_port=1, 
last_used=2219296936) at ofproto/ofproto.c:2403
#7  0x000000000041597c in dealloc_ofp_port (port=0x7b5010) at 
ofproto/ofproto.c:2147
#8  ofport_destroy (port=0x7b5010) at ofproto/ofproto.c:2357
#9  0x000000000041a3a3 in ofproto_destroy (p=0x7add50) at ofproto/ofproto.c:1464
#10 0x000000000040569d in bridge_destroy (br=0x7ac580) at vswitchd/bridge.c:3120
#11 0x00000000004077c5 in add_del_bridges (cfg=<value optimized out>) at 
vswitchd/bridge.c:1671
#12 0x000000000040a350 in bridge_reconfigure (ovs_cfg=0x7b0b40) at 
vswitchd/bridge.c:557
#13 0x000000000040d844 in bridge_run () at vswitchd/bridge.c:2892
#14 0x000000000040f36d in main (argc=1, argv=0x7fffffffe378) at 
vswitchd/ovs-vswitchd.c:116

I'm able to resolve the assert with the following patch to
ofproto.c:ofport_open():

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 653b2a8..48ceff7 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2177,6 +2177,8 @@ ofport_open(struct ofproto *ofproto,
             ofproto_port->ofp_port = alloc_ofp_port(ofproto,
                                                     ofproto_port->name);
         }
+    } else {
+        ofport_set_usage(ofproto, ofproto_port->ofp_port, LLONG_MAX);
     }
     pp->port_no = ofproto_port->ofp_port;
     netdev_get_etheraddr(netdev, pp->hw_addr);


The port is created in the following sequence in ofproto.c:update_port():

    netdev = (!ofproto_port_query_by_name(ofproto, name, &ofproto_port)
              ? ofport_open(ofproto, &ofproto_port, &pp)
              : NULL);

My ofproto implementation of port_query_by_name returns a ofport of 1, which
causes ofport_open to skip the alloc_ofp_port() to update the usage hmap.  When
I do the update by adding the line in the above patch, the assert goes away.

Is this a bug, or am I not using the api correctly?

Thanks for any pointers.

--prashanth
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to