X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fofproto-dpif.c;h=6da74c4847297bfa8d4bb698249e9d073e25d19f;hb=3b145dd7c001eb22f520b5ffd4179aaec59ebffe;hp=cf34e92ddf4ebf8156e922b580af8327b5333dd6;hpb=25f78c28faf4f3e059a006c8423b701fe9e9e77c;p=openvswitch diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index cf34e92d..6da74c48 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4255,20 +4255,24 @@ subfacet_create(struct facet *facet, enum odp_key_fitness key_fitness, uint32_t key_hash = odp_flow_key_hash(key, key_len); struct subfacet *subfacet; - subfacet = subfacet_find__(ofproto, key, key_len, key_hash, &facet->flow); - if (subfacet) { - if (subfacet->facet == facet) { - return subfacet; + if (list_is_empty(&facet->subfacets)) { + subfacet = &facet->one_subfacet; + } else { + subfacet = subfacet_find__(ofproto, key, key_len, key_hash, + &facet->flow); + if (subfacet) { + if (subfacet->facet == facet) { + return subfacet; + } + + /* This shouldn't happen. */ + VLOG_ERR_RL(&rl, "subfacet with wrong facet"); + subfacet_destroy(subfacet); } - /* This shouldn't happen. */ - VLOG_ERR_RL(&rl, "subfacet with wrong facet"); - subfacet_destroy(subfacet); + subfacet = xmalloc(sizeof *subfacet); } - subfacet = (list_is_empty(&facet->subfacets) - ? &facet->one_subfacet - : xmalloc(sizeof *subfacet)); hmap_insert(&ofproto->subfacets, &subfacet->hmap_node, key_hash); list_push_back(&facet->subfacets, &subfacet->list_node); subfacet->facet = facet;