X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ofproto%2Fofproto.c;h=4d4c23201b42e4904b6fe3ca333c3bda22b422e7;hb=073e2a6f2383cf7c17f78b8fa29e6e5293f60ba0;hp=6203676e2b603f29074532ddf2873324b1068efd;hpb=79feb7dfc714780ba86de73d42fe366e45e22b05;p=sliver-openvswitch.git diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 6203676e2..4d4c23201 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -290,7 +290,9 @@ ofproto_create(const char *datapath_name, const char *datapath_type, { const struct ofproto_class *class; struct ofproto *ofproto; + int n_tables; int error; + int i; *ofprotop = NULL; @@ -337,14 +339,20 @@ ofproto_create(const char *datapath_name, const char *datapath_type, list_init(&ofproto->pending); hmap_init(&ofproto->deletions); - error = ofproto->ofproto_class->construct(ofproto); + error = ofproto->ofproto_class->construct(ofproto, &n_tables); if (error) { VLOG_ERR("failed to open datapath %s: %s", datapath_name, strerror(error)); ofproto_destroy__(ofproto); return error; } - assert(ofproto->n_tables > 0); + + assert(n_tables >= 1 && n_tables <= 255); + ofproto->n_tables = n_tables; + ofproto->tables = xmalloc(n_tables * sizeof *ofproto->tables); + for (i = 0; i < n_tables; i++) { + classifier_init(&ofproto->tables[i]); + } ofproto->datapath_id = pick_datapath_id(ofproto); VLOG_INFO("using datapath ID %016"PRIx64, ofproto->datapath_id);