+/* A group within a "struct ofproto".
+ *
+ * With few exceptions, ofproto implementations may look at these fields but
+ * should not modify them. */
+struct ofgroup {
+ /* The rwlock is used to prevent groups from being deleted while child
+ * threads are using them to xlate flows. A read lock means the
+ * group is currently being used. A write lock means the group is
+ * in the process of being deleted or updated. Note that since
+ * a read lock on the groups container is held while searching, and
+ * a group is ever write locked only while holding a write lock
+ * on the container, the user's of groups will never face a group
+ * in the write locked state. */
+ struct ovs_rwlock rwlock;
+ struct hmap_node hmap_node; /* In struct ofproto's "groups" hmap. */
+ struct ofproto *ofproto; /* The ofproto that contains this group. */
+ uint32_t group_id;
+ enum ofp11_group_type type; /* One of OFPGT_*. */
+
+ long long int created; /* Creation time. */
+ long long int modified; /* Time of last modification. */
+
+ struct list buckets; /* Contains "struct ofputil_bucket"s. */
+ uint32_t n_buckets;
+};
+
+bool ofproto_group_lookup(const struct ofproto *ofproto, uint32_t group_id,
+ struct ofgroup **group)
+ OVS_TRY_RDLOCK(true, (*group)->rwlock);
+
+void ofproto_group_release(struct ofgroup *group)
+ OVS_RELEASES(group->rwlock);
+