openvswitch / ovs-issues

Issue tracker repo for Open vSwitch
10 stars 3 forks source link

Why does ipv4 support mask but ipv6 does not in megaflows ? #271

Closed JackyZhang888 closed 1 year ago

JackyZhang888 commented 1 year ago

Recently, I found that the number of megaflows of ipv6 is much more than that of ipv4 under the same conditions. Then I constructed a simple scenario and found that ipv4 will match with mask, while ipv6 will not.

For example: ovs2.13+dpdk,a bridge with two VMs using virtio port. Using mz to construct two streams with different source ip addresses. The results of “ovs-ofctl dump-flows”(only hit nw_dst) and “ovs-appctl dpctl/dump-flows” is as follows:

Ipv4:

NXST_FLOW reply (xid=0x4): cookie=0x0, duration=83.728s, table=0, n_packets=0, n_bytes=0, idle_age=83, priority=70,ip,nw_src=192.168.1.30 actions=drop cookie=0x0, duration=60.190s, table=0, n_packets=18481326, n_bytes=776215692, idle_age=0, priority=60,ip,nw_dst=192.168.1.33 actions=output:4 cookie=0x0, duration=56.549s, table=0, n_packets=10, n_bytes=700, idle_age=39, priority=60,ip,nw_dst=192.168.1.32 actions=output:3 cookie=0x0, duration=104.281s, table=0, n_packets=39, n_bytes=2030, idle_age=0, priority=0 actions=NORMAL

flow-dump from pmd on cpu core: 2 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.1.32/255.255.255.224,dst=192.168.1.33,frag=no), packets:18510867, bytes:777456414, used:0.000s, actions:2

Ipv6:

NXST_FLOW reply (xid=0x4): cookie=0x0, duration=8.922s, table=0, n_packets=0, n_bytes=0, idle_age=8, priority=70,ipv6,ipv6_src=fe80::f816:3eff:fe01:100 actions=drop cookie=0x0, duration=20.302s, table=0, n_packets=7900883, n_bytes=489854762, idle_age=0, priority=60,ipv6,ipv6_dst=fe80::f816:3eff:fe01:102 actions=output:4 cookie=0x0, duration=16.029s, table=0, n_packets=64, n_bytes=7040, idle_age=0, priority=60,ipv6,ipv6_dst=fe80::f816:3eff:fe01:101 actions=output:3 cookie=0x0, duration=24.529s, table=0, n_packets=429221, n_bytes=26613070, idle_age=16, priority=0 actions=NORMAL

flow-dump from pmd on cpu core: 2 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=fe80::f816:3eff:fe01:101,dst=fe80::f816:3eff:fe01:102,frag=no), packets:847759, bytes:52561058, used:0.000s, actions:2 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=fe80::f816:3eff:fe01:103,dst=fe80::f816:3eff:fe01:102,frag=no), packets:10533664, bytes:653087168, used:4.025s, actions:2

Why does ipv4 support mask but ipv6 does not? Thank You!

.

igsilya commented 1 year ago

They both support masks, but you're using very different addresses in IPv4 and IPv6 cases. 0x30 is very different from 0x32 in a binary form, while 0x100 is very similar to 0x101 and 0x103, so there is no mask that will distinguish these.