X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=datapath%2Ftable-hash.c;h=86e19201e555c2d808c876df6a43b180580a0c3b;hb=686cd5c3d8dd7f23c320b4e3a3c25c59c355f78c;hp=f6a41de5c5424070b6c91952585434f92f4778fc;hpb=57d52057650716ee354ebbe588d2a884ccabc81f;p=sliver-openvswitch.git diff --git a/datapath/table-hash.c b/datapath/table-hash.c index f6a41de5c..86e19201e 100644 --- a/datapath/table-hash.c +++ b/datapath/table-hash.c @@ -60,11 +60,6 @@ static int table_hash_insert(struct sw_table *swt, struct sw_flow *flow) } else { struct sw_flow *old_flow = *bucket; if (flow_keys_equal(&old_flow->key, &flow->key)) { - /* Keep stats from the original flow */ - flow->init_time = old_flow->init_time; - flow->packet_count = old_flow->packet_count; - flow->byte_count = old_flow->byte_count; - rcu_assign_pointer(*bucket, flow); flow_deferred_free(old_flow); retval = 1; @@ -76,8 +71,8 @@ static int table_hash_insert(struct sw_table *swt, struct sw_flow *flow) } static int table_hash_modify(struct sw_table *swt, - const struct sw_flow_key *key, - const struct ofp_action *actions, int n_actions) + const struct sw_flow_key *key, uint16_t priority, int strict, + const struct ofp_action_header *actions, size_t actions_len) { struct sw_table_hash *th = (struct sw_table_hash *) swt; unsigned int count = 0; @@ -85,8 +80,9 @@ static int table_hash_modify(struct sw_table *swt, if (key->wildcards == 0) { struct sw_flow **bucket = find_bucket(swt, key); struct sw_flow *flow = *bucket; - if (flow && flow_matches_1wild(&flow->key, key)) { - flow_replace_acts(flow, actions, n_actions); + if (flow && flow_matches_desc(&flow->key, key, strict) + && (!strict || (flow->priority == priority))) { + flow_replace_acts(flow, actions, actions_len); count = 1; } } else { @@ -95,8 +91,9 @@ static int table_hash_modify(struct sw_table *swt, for (i = 0; i <= th->bucket_mask; i++) { struct sw_flow **bucket = &th->buckets[i]; struct sw_flow *flow = *bucket; - if (flow && flow_matches_1wild(&flow->key, key)) { - flow_replace_acts(flow, actions, n_actions); + if (flow && flow_matches_desc(&flow->key, key, strict) + && (!strict || (flow->priority == priority))) { + flow_replace_acts(flow, actions, actions_len); count++; } } @@ -133,7 +130,7 @@ static int table_hash_delete(struct sw_table *swt, for (i = 0; i <= th->bucket_mask; i++) { struct sw_flow **bucket = &th->buckets[i]; struct sw_flow *flow = *bucket; - if (flow && flow_del_matches(&flow->key, key, strict)) + if (flow && flow_matches_desc(&flow->key, key, strict)) count += do_delete(bucket, flow); } } @@ -223,6 +220,7 @@ static void table_hash_stats(struct sw_table *swt, stats->wildcards = 0; /* No wildcards are supported. */ stats->n_flows = th->n_flows; stats->max_flows = th->bucket_mask + 1; + stats->n_lookup = swt->n_lookup; stats->n_matched = swt->n_matched; } @@ -291,12 +289,14 @@ static int table_hash2_insert(struct sw_table *swt, struct sw_flow *flow) } static int table_hash2_modify(struct sw_table *swt, - const struct sw_flow_key *key, - const struct ofp_action *actions, int n_actions) + const struct sw_flow_key *key, uint16_t priority, int strict, + const struct ofp_action_header *actions, size_t actions_len) { struct sw_table_hash2 *t2 = (struct sw_table_hash2 *) swt; - return (table_hash_modify(t2->subtable[0], key, actions, n_actions) - + table_hash_modify(t2->subtable[1], key, actions, n_actions)); + return (table_hash_modify(t2->subtable[0], key, priority, strict, + actions, actions_len) + + table_hash_modify(t2->subtable[1], key, priority, strict, + actions, actions_len)); } static int table_hash2_delete(struct sw_table *swt, @@ -357,6 +357,7 @@ static void table_hash2_stats(struct sw_table *swt, stats->wildcards = 0; /* No wildcards are supported. */ stats->n_flows = substats[0].n_flows + substats[1].n_flows; stats->max_flows = substats[0].max_flows + substats[1].max_flows; + stats->n_lookup = swt->n_lookup; stats->n_matched = swt->n_matched; }