From: Ben Pfaff Date: Wed, 7 May 2008 22:21:30 +0000 (-0700) Subject: Treat flows without any wildcards as maximum priority. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8e4cbbd3ac9b1333d4b95757760dbb0956274b9;p=openvswitch Treat flows without any wildcards as maximum priority. Otherwise, we give the table implementations the opportunity to screw up by distinguishing between two flows without wildcards but with apparently different priorities that are required to be treated as the same priority. --- diff --git a/datapath/forward.c b/datapath/forward.c index 929703fb..2c5410ea 100644 --- a/datapath/forward.c +++ b/datapath/forward.c @@ -373,7 +373,7 @@ add_flow(struct sw_chain *chain, const struct ofp_flow_mod *ofm) /* Fill out flow. */ flow_extract_match(&flow->key, &ofm->match); flow->max_idle = ntohs(ofm->max_idle); - flow->priority = ntohs(ofm->priority); + flow->priority = flow->key.wildcards ? ntohs(ofm->priority) : -1; flow->timeout = jiffies + flow->max_idle * HZ; flow->n_actions = n_acts; flow->init_time = jiffies; @@ -424,8 +424,10 @@ recv_flow(struct sw_chain *chain, const struct sender *sender, const void *msg) return chain_delete(chain, &key, 0, 0) ? 0 : -ESRCH; } else if (command == OFPFC_DELETE_STRICT) { struct sw_flow_key key; + uint16_t priority; flow_extract_match(&key, &ofm->match); - return chain_delete(chain, &key, ntohs(ofm->priority), 1) ? 0 : -ESRCH; + priority = key.wildcards ? ntohs(ofm->priority) : -1; + return chain_delete(chain, &key, priority, 1) ? 0 : -ESRCH; } else { return -ENOTSUPP; } diff --git a/switch/datapath.c b/switch/datapath.c index e02f418d..5e51ca3c 100644 --- a/switch/datapath.c +++ b/switch/datapath.c @@ -1071,7 +1071,7 @@ add_flow(struct datapath *dp, const struct ofp_flow_mod *ofm) /* Fill out flow. */ flow_extract_match(&flow->key, &ofm->match); flow->max_idle = ntohs(ofm->max_idle); - flow->priority = ntohs(ofm->priority); + flow->priority = flow->key.wildcards ? ntohs(ofm->priority) : -1; flow->timeout = time(0) + flow->max_idle; /* FIXME */ flow->n_actions = n_acts; flow->created = time(0); /* FIXME */ @@ -1122,9 +1122,10 @@ recv_flow(struct datapath *dp, const struct sender *sender UNUSED, return chain_delete(dp->chain, &key, 0, 0) ? 0 : -ESRCH; } else if (command == OFPFC_DELETE_STRICT) { struct sw_flow_key key; + uint16_t priority; flow_extract_match(&key, &ofm->match); - return chain_delete(dp->chain, &key, - ntohs(ofm->priority), 1) ? 0 : -ESRCH; + priority = key.wildcards ? ntohs(ofm->priority) : -1; + return chain_delete(dp->chain, &key, priority, 1) ? 0 : -ESRCH; } else { return -ENODEV; }