One step towards the goal of removing the ofputil_flow_mod from the
bundle message.
Signed-off-by: Jarno Rajahalme
---
ofproto/ofproto-provider.h | 7 +
ofproto/ofproto.c | 68 ++
2 files changed, 45 insertions(+), 30 deletions(-)
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index 0610e78..fb5fc95 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -1908,6 +1908,13 @@ int ofproto_class_unregister(const struct ofproto_class
*);
struct ofproto_flow_mod {
struct ofputil_flow_mod fm;
+/* Replicate needed fields from ofputil_flow_mod to not need it after the
+ * flow has been created. */
+uint32_t buffer_id;
+
+bool modify_may_add_flow;
+enum nx_flow_update_event event;
+
ovs_version_t version; /* Version in which changes take
* effect. */
struct rule_collection old_rules; /* Affected rules. */
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index f467125..853b2a3 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -265,7 +265,8 @@ struct openflow_mod_requester {
/* OpenFlow. */
static enum ofperr replace_rule_create(struct ofproto *,
- struct ofputil_flow_mod *,
+ struct ofproto_flow_mod *,
+ const struct ofputil_flow_mod *,
struct cls_rule *cr, uint8_t table_id,
struct rule *old_rule,
struct rule **new_rule)
@@ -280,7 +281,7 @@ static void replace_rule_revert(struct ofproto *, struct
rule *old_rule,
struct rule *new_rule)
OVS_REQUIRES(ofproto_mutex);
-static void replace_rule_finish(struct ofproto *, struct ofputil_flow_mod *,
+static void replace_rule_finish(struct ofproto *, struct ofproto_flow_mod *,
const struct openflow_mod_requester *,
struct rule *old_rule, struct rule *new_rule,
struct ovs_list *dead_cookies)
@@ -4873,7 +4874,7 @@ add_flow_start(struct ofproto *ofproto, struct
ofproto_flow_mod *ofm)
}
/* Allocate new rule. */
-error = replace_rule_create(ofproto, fm, , table - ofproto->tables,
+error = replace_rule_create(ofproto, ofm, fm, , table - ofproto->tables,
rule, new_rule);
if (error) {
return error;
@@ -4908,12 +4909,11 @@ add_flow_finish(struct ofproto *ofproto, struct
ofproto_flow_mod *ofm,
const struct openflow_mod_requester *req)
OVS_REQUIRES(ofproto_mutex)
{
-struct ofputil_flow_mod *fm = >fm;
struct rule *old_rule = rule_collection_stub(>old_rules)[0];
struct rule *new_rule = rule_collection_stub(>new_rules)[0];
struct ovs_list dead_cookies = OVS_LIST_INITIALIZER(_cookies);
-replace_rule_finish(ofproto, fm, req, old_rule, new_rule, _cookies);
+replace_rule_finish(ofproto, ofm, req, old_rule, new_rule, _cookies);
learned_cookies_flush(ofproto, _cookies);
if (old_rule) {
@@ -4927,7 +4927,7 @@ add_flow_finish(struct ofproto *ofproto, struct
ofproto_flow_mod *ofm,
send_table_status(ofproto, new_rule->table_id);
}
-send_buffered_packet(req, fm->buffer_id, new_rule);
+send_buffered_packet(req, ofm->buffer_id, new_rule);
}
/* OFPFC_MODIFY and OFPFC_MODIFY_STRICT. */
@@ -4936,7 +4936,8 @@ add_flow_finish(struct ofproto *ofproto, struct
ofproto_flow_mod *ofm,
* and 'old_rule'. Note that the rule is NOT inserted into a any data
* structures yet. Takes ownership of 'cr'. */
static enum ofperr
-replace_rule_create(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
+replace_rule_create(struct ofproto *ofproto, struct ofproto_flow_mod *ofm,
+const struct ofputil_flow_mod *fm,
struct cls_rule *cr, uint8_t table_id,
struct rule *old_rule, struct rule **new_rule)
{
@@ -5065,7 +5066,7 @@ replace_rule_revert(struct ofproto *ofproto,
/* Adds the 'new_rule', replacing the 'old_rule'. */
static void
-replace_rule_finish(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
+replace_rule_finish(struct ofproto *ofproto, struct ofproto_flow_mod *ofm,
const struct openflow_mod_requester *req,
struct rule *old_rule, struct rule *new_rule,
struct ovs_list *dead_cookies)
@@ -5088,27 +5089,25 @@ replace_rule_finish(struct ofproto *ofproto, struct
ofputil_flow_mod *fm,
if (old_rule) {
const struct rule_actions *old_actions = rule_get_actions(old_rule);
+const struct rule_actions *new_actions = rule_get_actions(new_rule);
learned_cookies_dec(ofproto, old_actions, dead_cookies);