On Fri, Aug 30, 2013 at 01:40:17PM -0700, Jarno Rajahalme wrote:
> Also, since all kinds of groups can refer to other groups, there is no
> reason to delete indirect groups first.

This seems reasonable to me, but its not clear to me
how the code prevents the deletion of groups that
are still referenced either by other groups or by rules.

> Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
> ---
>  ofproto/ofproto.c |   20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 9a4eda9..0eb1ee7 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -1126,6 +1126,8 @@ ofproto_flush__(struct ofproto *ofproto)
>      }
>  }
>  
> +static void delete_group(struct ofproto *ofproto, uint32_t group_id);
> +
>  static void
>  ofproto_destroy__(struct ofproto *ofproto)
>  {
> @@ -1139,6 +1141,9 @@ ofproto_destroy__(struct ofproto *ofproto)
>          free(ofproto->meters);
>      }
>  
> +    delete_group(ofproto, OFPG_ALL);
> +    hmap_destroy(&ofproto->groups);
> +
>      connmgr_destroy(ofproto->connmgr);
>  
>      hmap_remove(&all_ofprotos, &ofproto->hmap_node);
> @@ -4952,23 +4957,16 @@ delete_group__(struct ofgroup *ofgroup)
>  
>  /* Implements OFPGC_DELETE. */
>  static void
> -delete_group(struct ofproto *ofproto, const struct ofputil_group_mod *gm)
> +delete_group(struct ofproto *ofproto, uint32_t group_id)
>  {
> -    if (gm->group_id == OFPG_ALL) {
> +    if (group_id == OFPG_ALL) {
>          struct ofgroup *ofgroup, *next;
>  
> -        /* Remove indirect groups first, to allow other groups to be removed
> -         * successfully. */
> -        HMAP_FOR_EACH_SAFE (ofgroup, next, hmap_node, &ofproto->groups) {
> -            if (ofgroup->type == OFPGT11_INDIRECT) {
> -                delete_group__(ofgroup);
> -            }
> -        }
>          HMAP_FOR_EACH_SAFE (ofgroup, next, hmap_node, &ofproto->groups) {
>              delete_group__(ofgroup);
>          }
>      } else {
> -        struct ofgroup *ofgroup = ofproto_group_lookup(ofproto, 
> gm->group_id);
> +        struct ofgroup *ofgroup = ofproto_group_lookup(ofproto, group_id);
>          if (ofgroup) {
>              delete_group__(ofgroup);
>          }
> @@ -5000,7 +4998,7 @@ handle_group_mod(struct ofconn *ofconn, const struct 
> ofp_header *oh)
>          return modify_group(ofproto, &gm);
>  
>      case OFPGC11_DELETE:
> -        delete_group(ofproto, &gm);
> +        delete_group(ofproto, gm->group_id);
>          return 0;
>  
>      default:
> -- 
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
> 
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to