From: Gurucharan Shetty Date: Mon, 19 Aug 2013 21:45:02 +0000 (-0700) Subject: ofproto: Start ofport allocation from the previous max after restart. X-Git-Tag: sliver-openvswitch-2.0.90-1~20^2~22 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=7c35397c84dc4930e7c2be9d5dcef3a4955abbda;p=sliver-openvswitch.git ofproto: Start ofport allocation from the previous max after restart. We currently do not recycle ofport numbers from interfaces that are recently deleted by maintaining the maximum allocated ofport value and allocating new ofport numbers greater than the previous maximum. But after a restart of ovs-vswitchd, we start again from ofport value of '1'. This means that after a restart, we can immeditaley recycle the 'ofport' value of the most recently deleted interface. With this commit, during ovs-vswitchd initial configuration, we figure out the previously allocated max ofport value. New interfaces get ofport value that is greater than this. Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 1e09c5662..4cb7ea8b3 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2103,6 +2103,10 @@ init_ports(struct ofproto *p) netdev = ofport_open(p, &ofproto_port, &pp); if (netdev) { ofport_install(p, netdev, &pp); + if (ofproto_port.ofp_port < p->max_ports) { + p->alloc_port_no = MAX(p->alloc_port_no, + ofproto_port.ofp_port); + } } } }