summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-rid.c
diff options
context:
space:
mode:
authorSimon Horman <simon.horman@netronome.com>2014-11-10 13:47:49 +0900
committerBen Pfaff <blp@nicira.com>2014-11-10 08:39:57 -0800
commit27c247496fc15012b3186059639bf6dba1d1f706 (patch)
tree541751e520cc5d7b27e27bafe277991cf9d80882 /ofproto/ofproto-dpif-rid.c
parentc3bd4bfc7120a16d3e3604985e9c607705ef594d (diff)
downloadopenvswitch-27c247496fc15012b3186059639bf6dba1d1f706.tar.gz
id-pool: Refactor id_pool_alloc_id to allow any 32 bit value to be an id
id_pool_alloc_id() was created by breaking out the recirculation allocation code. As it is now a library call it makes sense to remove the restriction that id 0 is reserved. Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ofproto/ofproto-dpif-rid.c')
-rw-r--r--ofproto/ofproto-dpif-rid.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ofproto/ofproto-dpif-rid.c b/ofproto/ofproto-dpif-rid.c
index 55d5c2bef..afad3ce34 100644
--- a/ofproto/ofproto-dpif-rid.c
+++ b/ofproto/ofproto-dpif-rid.c
@@ -52,11 +52,16 @@ uint32_t
recirc_id_alloc(struct recirc_id_pool *pool)
{
uint32_t id;
+ bool ret;
ovs_mutex_lock(&pool->lock);
- id = id_pool_alloc_id(pool->rids);
+ ret = id_pool_alloc_id(pool->rids, &id);
ovs_mutex_unlock(&pool->lock);
+ if (!ret) {
+ return 0;
+ }
+
return id;
}