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 <gshe...@nicira.com>
---
 ofproto/ofproto.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index bbdb2d2..d7ed5f6 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2089,6 +2089,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);
+                }
             }
         }
     }
-- 
1.7.9.5

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

Reply via email to