[ovs-discuss] add flow and flow dump

Ben Pfaff blp at nicira.com
Mon Jul 21 15:50:05 UTC 2014


On Mon, Jul 21, 2014 at 03:40:28AM +0000, Eyal Nissim wrote:
> Having read the porting document, and after deciding to implement "ofproto provider" for my HW
> I started working on modifying the following 2 flows:  "add flow" and "flow dump"
> 
> 1.       As for "flow dump" , I  was happy to find out that I had just what I wanted:
> 
> Inside handle_flow_stats_request there's the following call:
> 
> fproto->ofproto_class->rule_get_stats  where I can hook to my HW and collect some statistics

Great.

> 2.       As for "flow add" , I'd like to perform validations:
> 
> By validations I mean that I'd like to make sure that the rule doesn't relate to physical ports I don't actually have
> or to preserved vlans   (I have a few vlans which I don't want the remote controller to configure)
> or anything else which is in contradiction to the integrity of the HW
> besides, there might be  layers/protocols  that I'm not going to support
> (hypothetically, for the sake of argument,let's say that I'm not going to support MPLS)
> 
> I would have wanted to find something like this in the code:
> 
> ofproto->ofproto_class->validate() , right at the beginning of the function, before a new rule is allocated
> 
> 
> 
> However, the only function pointers I found are:
> 
> 
> 
> ofproto->ofproto_class->rule_choose_table(...)
> 
> 
> 
> fproto->ofproto_class->rule_alloc();
> 
> 
> 
> ofproto->ofproto_class->rule_construct()
> 
> 
> 
> ofproto->ofproto_class->rule_insert(rule);
> 
> 
> 
> ule->ofproto->ofproto_class->rule_modify_actions(...)
> 
> 
> 
> 
> 
> Now, is my basic assumption that I should hook up to your code only by the function pointers that you offer correct?
> 
> or is it OK to add function calls inside "flow add" as I please?

You can make any changes you like, of course, but the intent is that it
should only be necessary to hook up inside the function pointers only.
In this case I'd expect that rule_construct() or rule_insert(), plus
(on master) rule_premodify_actions() are the right places to check that
your datapath can handle the flow.

> (hooking to your function pointers only, seems best for me in the sense that I would have to make no changes once you
> make a new release).

Right, although some new releases do make changes to the function
pointers.

> Do you have intensions to add something like ofproto->ofproto_class->validate() in the future?

I'm not sure I understand how it would be better than rule_construct()
for this purpose.



More information about the discuss mailing list