2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

dpif-provider: Add class init function.

This init function is called when the dpif class is registered. It will
be used by following commits

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
Daniele Di Proietto
2015-04-10 19:09:49 +01:00
committed by Ethan Jackson
parent 55e3ca97d1
commit c8973eb634
4 changed files with 18 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ static int
dp_register_provider__(const struct dpif_class *new_class)
{
struct registered_dpif_class *registered_class;
int error;
if (sset_contains(&dpif_blacklist, new_class->type)) {
VLOG_DBG("attempted to register blacklisted provider: %s",
@@ -148,6 +149,13 @@ dp_register_provider__(const struct dpif_class *new_class)
return EEXIST;
}
error = new_class->init ? new_class->init() : 0;
if (error) {
VLOG_WARN("failed to initialize %s datapath class: %s",
new_class->type, ovs_strerror(error));
return error;
}
registered_class = xmalloc(sizeof *registered_class);
registered_class->dpif_class = new_class;
registered_class->refcount = 0;