Message ID | 8CA204A851B7B14E86E75054661E41750F9C96EE@G4W3208.americas.hpqcorp.net |
---|---|
State | Rejected |
Headers | show |
On Tue, Dec 01, 2015 at 10:33:41PM +0000, Ansari, Shad wrote: > Currently, ofproto_class_register() is invoked by ofproto_init(). > Separating out the ofproto registration step from the initialization step > makes it actually possible for a user of libofproto to register > a custom ofproto_class. > > Signed-off-by: Shad Ansari <shad.ansari@hp.com> I think that the user could just register its class before calling ofproto_init().
Ben, I have my own custome ofproto provider class (for a hardware dp) which is to be registered. The existing ofproto_dpif_class instance is _not_ to be registered. However ofproto_init() is "hardcoded" to register the ofproto_dpif_class. So this is what I want to be able to do: const struct ofproto_class my_ofproto_class = { .... }; ofproto_class_register(&my_ofproto_class); ofproto_init(&iface_hints); /* ofprot_init() should not register ofproto_dpfif_class */ If I do as you suggest - i.e. register my class before calling ofproto_init(), then the default ofproto_dpif_class is also registered. I would like to avoid that? > > On Tue, Dec 01, 2015 at 10:33:41PM +0000, Ansari, Shad wrote: > > Currently, ofproto_class_register() is invoked by ofproto_init(). > > Separating out the ofproto registration step from the initialization step > > makes it actually possible for a user of libofproto to register > > a custom ofproto_class. > > > > Signed-off-by: Shad Ansari <shad.ansari@hp.com> > > I think that the user could just register its class before calling > ofproto_init().
The commit message is inaccurate then. It's not about registering a custom ofproto_class, it's about suppressing registration of the standard one. On Wed, Dec 02, 2015 at 04:57:36AM +0000, Ansari, Shad wrote: > Ben, > > I have my own custome ofproto provider class (for a hardware dp) which is to be registered. The existing ofproto_dpif_class instance is _not_ to be registered. However ofproto_init() is "hardcoded" to register the ofproto_dpif_class. > > So this is what I want to be able to do: > > const struct ofproto_class my_ofproto_class = { > .... > }; > > ofproto_class_register(&my_ofproto_class); > ofproto_init(&iface_hints); /* ofprot_init() should not register ofproto_dpfif_class */ > > If I do as you suggest - i.e. register my class before calling ofproto_init(), then the default ofproto_dpif_class is also registered. I would like to avoid that? > > > > > On Tue, Dec 01, 2015 at 10:33:41PM +0000, Ansari, Shad wrote: > > > Currently, ofproto_class_register() is invoked by ofproto_init(). > > > Separating out the ofproto registration step from the initialization step > > > makes it actually possible for a user of libofproto to register > > > a custom ofproto_class. > > > > > > Signed-off-by: Shad Ansari <shad.ansari@hp.com> > > > > I think that the user could just register its class before calling > > ofproto_init().
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 5688c6e..ca7d40a 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -365,8 +365,6 @@ ofproto_init(const struct shash *iface_hints) struct shash_node *node; size_t i; - ofproto_class_register(&ofproto_dpif_class); - /* Make a local copy, since we don't own 'iface_hints' elements. */ SHASH_FOR_EACH(node, iface_hints) { const struct iface_hint *orig_hint = node->data; diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index b966d92..6064a3f 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -376,6 +376,8 @@ bridge_init_ofproto(const struct ovsrec_open_vswitch *cfg) } } + ofproto_class_register(&ofproto_dpif_class); + ofproto_init(&iface_hints); shash_destroy_free_data(&iface_hints);
Currently, ofproto_class_register() is invoked by ofproto_init(). Separating out the ofproto registration step from the initialization step makes it actually possible for a user of libofproto to register a custom ofproto_class. Signed-off-by: Shad Ansari <shad.ansari@hp.com> --- ofproto/ofproto.c | 2 -- vswitchd/bridge.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)