aboutsummaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2011-08-03 11:19:47 +0900
committerJesse Gross <jesse@nicira.com>2011-08-02 21:45:20 -0700
commitde06dce673979eb9208c539bad15fae855e1d4c5 (patch)
treeefa475ad9b11d38a6474f9f45d1f3f6ce71db993 /datapath
parentd1993ffea5d91f28f39838e8bcb1c67bc6bec790 (diff)
datapath: Allow the number of hash entries to exceed TBL_MAX_BUCKETS
* If the number of entries in a table exceeds the number of buckets that it has then an attempt will be made to resize the table. * There is a limit of TBL_MAX_BUCKETS placed on the number of buckets of a table. * If this limit is exceeded keep using the existing table. This allows a table to hold more than TBL_MAX_BUCKETS entries at the expense of increased hash collisions. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/datapath.c12
-rw-r--r--datapath/tunnel.c12
2 files changed, 14 insertions, 10 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c
index a964c27f..3ec5be4e 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -629,11 +629,13 @@ static int expand_table(struct datapath *dp)
struct tbl *new_table;
new_table = tbl_expand(old_table);
- if (IS_ERR(new_table))
- return PTR_ERR(new_table);
-
- rcu_assign_pointer(dp->table, new_table);
- tbl_deferred_destroy(old_table, NULL);
+ if (IS_ERR(new_table)) {
+ if (PTR_ERR(new_table) != -ENOSPC)
+ return PTR_ERR(new_table);
+ } else {
+ rcu_assign_pointer(dp->table, new_table);
+ tbl_deferred_destroy(old_table, NULL);
+ }
return 0;
}
diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index c2439f0e..1ef81ab7 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -249,11 +249,13 @@ static int add_port(struct vport *vport)
struct tbl *new_table;
new_table = tbl_expand(cur_table);
- if (IS_ERR(new_table))
- return PTR_ERR(new_table);
-
- rcu_assign_pointer(port_table, new_table);
- tbl_deferred_destroy(cur_table, NULL);
+ if (IS_ERR(new_table)) {
+ if (PTR_ERR(new_table) != -ENOSPC)
+ return PTR_ERR(new_table);
+ } else {
+ rcu_assign_pointer(port_table, new_table);
+ tbl_deferred_destroy(cur_table, NULL);
+ }
}
err = tbl_insert(rtnl_dereference(port_table), &tnl_vport->tbl_node,