tunneling: Update port pools on config change.
authorJesse Gross <jesse@nicira.com>
Sun, 5 Dec 2010 20:16:40 +0000 (12:16 -0800)
committerJesse Gross <jesse@nicira.com>
Fri, 10 Dec 2010 01:43:36 +0000 (17:43 -0800)
We keep track of the number of tunnels using the different types of
matching in order to avoid doing the lookup when there are no ports
of that type.  However, when updating the configuration we weren't
changing the port pool counts, which could lead to incorrectly not
finding a tunnel on receive.

Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/tunnel.c

index 0faa4ec..d8bcb0f 100644 (file)
@@ -247,6 +247,7 @@ static int add_port(struct vport *vport)
 
        err = tbl_insert(port_table, &tnl_vport->tbl_node, mutable_hash(tnl_vport->mutable));
        if (err) {
+               (*find_port_pool(tnl_vport->mutable))--;
                check_table_empty();
                return err;
        }
@@ -282,7 +283,9 @@ static int move_port(struct vport *vport, struct tnl_mutable_config *new_mutable
        }
 
 table_updated:
+       (*find_port_pool(tnl_vport->mutable))--;
        assign_config_rcu(vport, new_mutable);
+       (*find_port_pool(tnl_vport->mutable))++;
 
        return 0;
 }