[ovs-dev] adding new ofproto provider

Ben Pfaff blp at nicira.com
Tue Dec 2 18:56:17 UTC 2014


On Tue, Dec 02, 2014 at 01:41:10PM +0000, Zolt?n Balogh wrote:
> Dear Sirs,
> 
> I'm working on a project in which the goal is to add a new ofproto provider to ovs while keeping ofproto_dpif. We use ovs version  I created a new ofproto _class (ofproto_new) and I register an instance of  this new type of ofproto class in ofproto_init() the same way as the existing ofproto_dpif_class:
> 
> void
> ofproto_init(const struct shash *iface_hints)
> {
>     struct shash_node *node;
>     size_t i;
> 
>     ofproto_class_register(&ofproto_dpif_class);
>     ofproto_class_register(&ofproto_new_class);
> 
>     ...
> }
> 
> In my implementation enumerate_types() of the new class returns only a single type, let's call it "new".  Similarly to ofproto_dpif implementation the passed sset pointed by types will be cleared before adding the new member.
> 
> I observed that when bridge_run__() is invoked only the type_run() of ofproto_new_class is invoked, type_run() of ofproto_dpif_class will never be called.  If my interpretation is correct then ofproto_enumerate_types() invoked in bridge_run__() should go through the registered ofproto provider classes and collect the "types".
> 
> void
> ofproto_enumerate_types(struct sset *types)
> {
>     size_t i;
> 
>     sset_clear(types);
>     for (i = 0; i < n_ofproto_classes; i++) {
>         ofproto_classes[i]->enumerate_types(types);
>     }
>   }
> 
> But since the enumerate_types() functions (both of ofproto_dpif and similarly ofproto_new) clear the passed sset only the types of the last ofproto_class will be collected and provided to bridge_run__().
> 
> Maybe my interpretation is wrong but I guess the types retrieved by each call of ->enumerate_types() in ofproto_enumerate_types() should be merged. Is there any reason why this is not done in your ofproto_enumerate_types() implementation?

I think you're right.

I sent out a patch:
        http://openvswitch.org/pipermail/dev/2014-December/049350.html
Will you review it?  Thanks.



More information about the dev mailing list