ovs_rwlock_wrlock(&table->cls.rwlock);
cls_cursor_init(&cursor, &table->cls, NULL);
CLS_CURSOR_FOR_EACH_SAFE (rule, next_rule, up.cr, &cursor) {
- ofproto_rule_destroy(&ofproto->up, &table->cls, &rule->up);
+ ofproto_rule_delete(&ofproto->up, &table->cls, &rule->up);
}
ovs_rwlock_unlock(&table->cls.rwlock);
}
+ complete_operations(ofproto);
ovs_mutex_lock(&ofproto->flow_mod_mutex);
LIST_FOR_EACH_SAFE (fm, next_fm, list_node, &ofproto->flow_mods) {
}
ovs_mutex_lock(&ofproto->flow_mod_mutex);
- if (ofproto->n_flow_mods) {
- flow_mods = ofproto->flow_mods;
- list_moved(&flow_mods);
- list_init(&ofproto->flow_mods);
- ofproto->n_flow_mods = 0;
- } else {
- list_init(&flow_mods);
- }
+ list_move(&flow_mods, &ofproto->flow_mods);
+ list_init(&ofproto->flow_mods);
+ ofproto->n_flow_mods = 0;
ovs_mutex_unlock(&ofproto->flow_mod_mutex);
LIST_FOR_EACH_SAFE (fm, next_fm, list_node, &flow_mods) {
}
ovs_mutex_lock(&ofproto->pin_mutex);
- if (ofproto->n_pins) {
- pins = ofproto->pins;
- list_moved(&pins);
- list_init(&ofproto->pins);
- ofproto->n_pins = 0;
- } else {
- list_init(&pins);
- }
+ list_move(&pins, &ofproto->pins);
+ list_init(&ofproto->pins);
+ ofproto->n_pins = 0;
ovs_mutex_unlock(&ofproto->pin_mutex);
LIST_FOR_EACH_SAFE (pin, next_pin, list_node, &pins) {
return;
}
- if (!ovs_rwlock_trywrlock(&rule->up.evict)) {
- COVERAGE_INC(ofproto_dpif_expired);
-
- /* Get rid of the rule. */
- ofproto_rule_expire(&rule->up, reason);
- }
+ COVERAGE_INC(ofproto_dpif_expired);
+ ofproto_rule_expire(&rule->up, reason);
}
\f
/* Facets. */
rule->packet_count = 0;
rule->byte_count = 0;
ovs_mutex_unlock(&rule->stats_mutex);
- complete_operation(rule);
return 0;
}
static void
-rule_destruct(struct rule *rule_)
+rule_insert(struct rule *rule_)
{
struct rule_dpif *rule = rule_dpif_cast(rule_);
complete_operation(rule);
+}
+
+static void
+rule_delete(struct rule *rule_)
+{
+ struct rule_dpif *rule = rule_dpif_cast(rule_);
+ complete_operation(rule);
+}
+
+static void
+rule_destruct(struct rule *rule_)
+{
+ struct rule_dpif *rule = rule_dpif_cast(rule_);
ovs_mutex_destroy(&rule->stats_mutex);
}
}
static void
-rule_modify_actions(struct rule *rule_)
+rule_modify_actions(struct rule *rule_, bool reset_counters)
{
struct rule_dpif *rule = rule_dpif_cast(rule_);
+ if (reset_counters) {
+ ovs_mutex_lock(&rule->stats_mutex);
+ rule->packet_count = 0;
+ rule->byte_count = 0;
+ ovs_mutex_unlock(&rule->stats_mutex);
+ }
+
complete_operation(rule);
}
\f
NULL, /* rule_choose_table */
rule_alloc,
rule_construct,
+ rule_insert,
+ rule_delete,
rule_destruct,
rule_dealloc,
rule_get_stats,
NULL, /* meter_set */
NULL, /* meter_get */
NULL, /* meter_del */
+ NULL, /* group_alloc */
+ NULL, /* group_construct */
+ NULL, /* group_destruct */
+ NULL, /* group_dealloc */
+ NULL, /* group_modify */
+ NULL, /* group_get_stats */
};