Hi everyone,
I had chance to install one of the latest release of OVS:

ovs-vsctl (Open vSwitch) 2.11.1
DB Schema 7.16.1

And I found a strange behavior for the OF group reference count. It seems that 
the count is not correct in some cases:
(I am using ONOS on top of OVS)

[OVS]
group_id=3276808,duration=13038.838s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0

[ONOS]
id=0x320008, state=ADDED, type=INDIRECT, bytes=0, packets=0, 
appId=org.onosproject.segmentrouting, referenceCount=1
        id=0x320008, bucket=1, bytes=0, packets=0, actions=[VLAN_POP, OUTPUT:8]

OVS reports in the group_stats a reference count of 1 while in my test this 
group is referenced many times. In particular, it is referenced by two groups 
and one flow

[ONOS-groups]
id=0x200005cf, state=ADDED, type=INDIRECT, bytes=0, packets=0, 
appId=org.onosproject.segmentrouting, referenceCount=1
        id=0x200005cf, bucket=1, bytes=0, packets=0, 
actions=[ETH_DST:00:BB:00:00:00:03, ETH_SRC:00:00:00:00:02:05, VLAN_ID:50, 
GROUP:0x320008]

id=0x40320000, state=ADDED, type=ALL, bytes=0, packets=0, 
appId=org.onosproject.segmentrouting, referenceCount=1
       id=0x40320000, bucket=1, bytes=0, packets=0, actions=[GROUP:0x320008]
       id=0x40320000, bucket=2, bytes=0, packets=0, actions=[GROUP:0x320009]

[ONOS-flows]
id=8b000047e7edc9, state=ADDED, bytes=0, packets=0, duration=20126, 
liveType=UNKNOWN, priority=100, tableId=50, 
appId=org.onosproject.segmentrouting, payLoad=null,
        selector=[ETH_DST:00:BB:00:00:00:03, VLAN_VID:50],
        treatment=DefaultTrafficTreatment{immediate=[], 
deferred=[GROUP:0x320008], transition=TABLE:60, meter=[], cleared=false, 
StatTrigger=null, metadata=null}

Instead, If the group is only referenced by flows - the count is correct:

group_id=3221225472,duration=13038.763s,ref_count=11,packet_count=5708,byte_count=1127953,bucket0:packet_count=5708,byte_count=1127953

id=de000009b10f97, state=ADDED, bytes=0, packets=0, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:1, VLAN_VID:4094], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de0000333ca8f6, state=ADDED, bytes=7494, packets=157, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:7, VLAN_VID:30], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de00005f25a18a, state=ADDED, bytes=472, packets=6, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:12, VLAN_VID:110], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de00006873571d, state=ADDED, bytes=7278, packets=159, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:6, VLAN_VID:30], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de0000700b01f4, state=ADDED, bytes=1703465, packets=8444, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:10, VLAN_VID:30], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de000072726903, state=ADDED, bytes=844, packets=10, duration=20271, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:13, VLAN_VID:56], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de00007bd131b9, state=ADDED, bytes=11962, packets=74, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:9, VLAN_VID:50], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de00008c6c5ee7, state=ADDED, bytes=0, packets=0, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:4, VLAN_VID:4094], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de0000cab1e25c, state=ADDED, bytes=0, packets=0, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:2, VLAN_VID:4094], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de0000f74b1b4f, state=ADDED, bytes=0, packets=0, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:3, VLAN_VID:4094], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

id=de0000f79d8339, state=ADDED, bytes=12108, packets=75, duration=20882, 
liveType=UNKNOWN, priority=40000, tableId=63, 
appId=org.onosproject.driver.OvsOfdpa2Pipeline, payLoad=null, 
selector=[IN_PORT:8, VLAN_VID:50], 
treatment=DefaultTrafficTreatment{immediate=[GROUP:0xc0000000], deferred=[], 
transition=None, meter=[], cleared=false, StatTrigger=null, metadata=null}

I have been digging into the code and found that the reference_count sent with 
the group_stats is the number of rules references:

https://github.com/openvswitch/ovs/blob/fed4282c53667def41d997a6bf4cb66b5da16b74/ofproto/ofproto.c#L7115
https://github.com/openvswitch/ovs/blob/fed4282c53667def41d997a6bf4cb66b5da16b74/ofproto/ofproto-provider.h#L588

I believe we are missing the group references inside struct ofgroup, as it is 
perfectly fine (according OF specification) having a group referenced by other 
groups. This references should be count.
This seems the reason behind the behavior I found during my tests.

Is my understanding of the problem right ? Can someone confirm ?

Thanks
Pier









_______________________________________________
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

Reply via email to