Re: [ovs-dev] which fields should be masked or unmasked while using megaflow match?

2017-12-27 Thread Ben Pfaff
On Wed, Dec 27, 2017 at 07:48:30PM +0800, ychen wrote:
> HI, is there any policy about which fields should be wildcard when using 
> megaflow match?
...

> my question is why ETH_SRC, ETH_DST is needed when using normal action?

eth_dst is needed to ensure that the packet gets forwarded to the right
port.

eth_src is needed to ensure that MAC learning happens for the packet's
source address.

> exp 3:
> table=0,in_port=1,nw_src=1.1.1.0/24, actions=2
> table=0,in_port=2,nw_src=1.1.1.0/24, actions=1
> then the datapath flow is like that:
> recirc_id(0),in_port(3),eth_type(0x0800),ipv4(src=1.1.1.0/255.255.255.0,frag=no),
>  packets:1863, bytes:182574, used:0.552s, actions:2
> recirc_id(0),in_port(2),eth_type(0x0800),ipv4(src=1.1.1.0/255.255.255.0,frag=no),
>  packets:1863, bytes:182574, used:0.552s, actions:3
> 
> 
> exp 4:
> table=0,in_port=1,nw_src=1.1.1.0/24, actions=mod_nw_src:1.1.1.3, output:2
> table=0,in_port=2,actions=1
> 
> 
> then the datapath flow is like that:
> recirc_id(0),in_port(3),eth_type(0x0800),ipv4(src=1.1.1.2,frag=no), 
> packets:37, bytes:3626, used:0.332s, actions:set(ipv4(src=1.1.1.3)),2
> recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:37, 
> bytes:3626, used:0.332s, actions:3
> 
> 
> my question is why NW_SRC=1.1.1.2 should be all masked with 0xff, why not 
> 0xff00 like the rule we created?

There may be room for additional optimization here.

OpenFlow 1.0 actions like mod_nw_src are special-cased, by the way.  You
can probably get better optimization by using "set_field" or "load".

> in one word, is there any rules to set flow mask when using megaflow match? 
> which fields should be wildcard? why? 
> we can extract all fields from packets, and we can find the rule match the 
> packet, but why the datapath flow match fields is not the same as userspace 
> rule?

You should read our NSDI 2015 paper, "The Design and Implementation of
Open vSwitch", for information about megaflows.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] which fields should be masked or unmasked while using megaflow match?

2017-12-27 Thread ychen
HI, is there any policy about which fields should be wildcard when using 
megaflow match?
exp 1:
 table=0, priorIty=0,actions=NORMAL
 then the datapath flow is like that:
 
recirc_id(0),in_port(3),eth(src=b6:49:dd:5d:3a:a6,dst=2e:b5:7b:d6:52:c2),eth_type(0x0806),
 packets:0, bytes:0, used:never, actions:2
 
recirc_id(0),in_port(2),eth(src=2e:b5:7b:d6:52:c2,dst=b6:49:dd:5d:3a:a6),eth_type(0x0800),ipv4(frag=no),
 packets:12, bytes:1176, used:0.825s, actions:3


exp 2:
table=0,in_port=1,actions=2
table=0,in_port=2,actions=1
then the datapath flow is like that:
recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:26, bytes:2548, 
used:0.441s, actions:3
recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:26, bytes:2548, 
used:0.441s, actions:2


my question is why ETH_SRC, ETH_DST is needed when using normal action?


exp 3:
table=0,in_port=1,nw_src=1.1.1.0/24, actions=2
table=0,in_port=2,nw_src=1.1.1.0/24, actions=1
then the datapath flow is like that:
recirc_id(0),in_port(3),eth_type(0x0800),ipv4(src=1.1.1.0/255.255.255.0,frag=no),
 packets:1863, bytes:182574, used:0.552s, actions:2
recirc_id(0),in_port(2),eth_type(0x0800),ipv4(src=1.1.1.0/255.255.255.0,frag=no),
 packets:1863, bytes:182574, used:0.552s, actions:3


exp 4:
table=0,in_port=1,nw_src=1.1.1.0/24, actions=mod_nw_src:1.1.1.3, output:2
table=0,in_port=2,actions=1


then the datapath flow is like that:
recirc_id(0),in_port(3),eth_type(0x0800),ipv4(src=1.1.1.2,frag=no), packets:37, 
bytes:3626, used:0.332s, actions:set(ipv4(src=1.1.1.3)),2
recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:37, bytes:3626, 
used:0.332s, actions:3


my question is why NW_SRC=1.1.1.2 should be all masked with 0xff, why not 
0xff00 like the rule we created?


in one word, is there any rules to set flow mask when using megaflow match? 
which fields should be wildcard? why? 
we can extract all fields from packets, and we can find the rule match the 
packet, but why the datapath flow match fields is not the same as userspace 
rule?
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev