struct hmap_node hmap_node; /* In ofproto's "deletions" hmap. */
struct rule *rule; /* Rule being operated upon. */
enum ofoperation_type type; /* Type of operation. */
- struct rule *victim; /* OFOPERATION_ADDING: Replaced rule. */
- struct ofpact *ofpacts; /* OFOPERATION_MODIFYING: Replaced actions. */
- size_t ofpacts_len; /* OFOPERATION_MODIFYING: Bytes of ofpacts. */
+ struct rule *victim; /* OFOPERATION_ADD: Replaced rule. */
+ struct ofpact *ofpacts; /* OFOPERATION_MODIFY: Replaced actions. */
+ size_t ofpacts_len; /* OFOPERATION_MODIFY: Bytes of ofpacts. */
ovs_be64 flow_cookie; /* Rule's old flow cookie. */
};
-static void ofoperation_create(struct ofopgroup *, struct rule *,
- enum ofoperation_type);
+static struct ofoperation *ofoperation_create(struct ofopgroup *,
+ struct rule *,
+ enum ofoperation_type);
static void ofoperation_destroy(struct ofoperation *);
/* oftable. */
assert(ofproto->n_tables);
ofproto->datapath_id = pick_datapath_id(ofproto);
- VLOG_INFO("%s: using datapath ID %016"PRIx64,
- ofproto->name, ofproto->datapath_id);
init_ports(ofproto);
*ofprotop = ofproto;
}
}
+uint64_t
+ofproto_get_datapath_id(const struct ofproto *ofproto)
+{
+ return ofproto->datapath_id;
+}
+
void
ofproto_set_datapath_id(struct ofproto *p, uint64_t datapath_id)
{
uint64_t old_dpid = p->datapath_id;
p->datapath_id = datapath_id ? datapath_id : pick_datapath_id(p);
if (p->datapath_id != old_dpid) {
- VLOG_INFO("%s: datapath ID changed to %016"PRIx64,
- p->name, p->datapath_id);
-
/* Force all active connections to reconnect, since there is no way to
* notify a controller that the datapath ID has changed. */
ofproto_reconnect_controllers(p);
}
static struct oftable *
-next_visible_table(struct ofproto *ofproto, uint8_t table_id)
+next_visible_table(const struct ofproto *ofproto, uint8_t table_id)
{
struct oftable *table;
}
static struct oftable *
-first_matching_table(struct ofproto *ofproto, uint8_t table_id)
+first_matching_table(const struct ofproto *ofproto, uint8_t table_id)
{
if (table_id == 0xff) {
return next_visible_table(ofproto, 0);
}
static struct oftable *
-next_matching_table(struct ofproto *ofproto,
- struct oftable *table, uint8_t table_id)
+next_matching_table(const struct ofproto *ofproto,
+ const struct oftable *table, uint8_t table_id)
{
return (table_id == 0xff
? next_visible_table(ofproto, (table - ofproto->tables) + 1)
} else if (victim && victim->pending) {
error = OFPROTO_POSTPONE;
} else {
+ struct ofoperation *op;
struct rule *evict;
if (classifier_count(&table->cls) > table->max_flows) {
}
group = ofopgroup_create(ofproto, ofconn, request, fm->buffer_id);
- ofoperation_create(group, rule, OFOPERATION_ADD);
- rule->pending->victim = victim;
+ op = ofoperation_create(group, rule, OFOPERATION_ADD);
+ op->victim = victim;
error = ofproto->ofproto_class->rule_construct(rule);
if (error) {
if (!ofpacts_equal(fm->ofpacts, fm->ofpacts_len,
rule->ofpacts, rule->ofpacts_len)) {
- ofoperation_create(group, rule, OFOPERATION_MODIFY);
- rule->pending->ofpacts = rule->ofpacts;
- rule->pending->ofpacts_len = rule->ofpacts_len;
+ struct ofoperation *op;
+
+ op = ofoperation_create(group, rule, OFOPERATION_MODIFY);
+ op->ofpacts = rule->ofpacts;
+ op->ofpacts_len = rule->ofpacts_len;
rule->ofpacts = xmemdup(fm->ofpacts, fm->ofpacts_len);
rule->ofpacts_len = fm->ofpacts_len;
rule->ofproto->ofproto_class->rule_modify_actions(rule);
}
/* Initiates a new operation on 'rule', of the specified 'type', within
- * 'group'. Prior to calling, 'rule' must not have any pending operation. */
-static void
+ * 'group'. Prior to calling, 'rule' must not have any pending operation.
+ *
+ * Returns the newly created ofoperation (which is also available as
+ * rule->pending). */
+static struct ofoperation *
ofoperation_create(struct ofopgroup *group, struct rule *rule,
enum ofoperation_type type)
{
hmap_insert(&ofproto->deletions, &op->hmap_node,
cls_rule_hash(&rule->cr, rule->table_id));
}
+
+ return op;
}
static void