ofproto: Add reference count for Openflow groups.
authorRyan Wilson <wryan@nicira.com>
Thu, 22 May 2014 08:12:02 +0000 (08:12 +0000)
committerAndy Zhou <azhou@nicira.com>
Thu, 22 May 2014 03:09:45 +0000 (20:09 -0700)
commit809c7548e09a0508ff7d579a340cda1a598fcbd3
tree8217d9e1a47d903453e7369f0976f50cc4c11918
parent59e6d833b32cb7695738c56a004aa78ab26ec3dc
ofproto: Add reference count for Openflow groups.

When adding support for OpenFlow group and bucket stats, a group entry is added
to the xlate_cache. If the main thread removes the group from an ofproto, we
need to guarantee that the group remains accessible to users of
xlate_group_actions and the xlate_cache, as the xlate_cache will not be cleaned
up until the corresponding datapath flows are revalidated.

Before, modify_group could change the bucket list for a group. With group
entries in the xlate_cache, this could leave already-freed bucket pointers in
the cache. Modify_group now recreates the group and replaces the old group in
ofproto's ofgroup hash map. Thus, any subsequent group lookup will find the new
group while the old group and buckets will still exist until the xlate_cache
entries unref the group.

Since ofgroup's properties were only written in-place by modify_group and this
is no longer done, this eliminates the need for ofgroup's lock.

Signed-off-by: Ryan Wilson <wryan@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
ofproto/ofproto-dpif-xlate.c
ofproto/ofproto-dpif.c
ofproto/ofproto-dpif.h
ofproto/ofproto-provider.h
ofproto/ofproto.c