This is in preparation for using the same helper as part of support
for using recirculation in conjunction series of actions including
with MPLS actions that are currently not able to be translated.

In that scenario the idle timeout will be used to expire internal
rules that are added to handle recirculation.

Signed-off-by: Simon Horman <ho...@verge.net.au>
---
 ofproto/bond.c         |  2 +-
 ofproto/ofproto-dpif.c | 10 ++++++----
 ofproto/ofproto-dpif.h |  1 +
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/ofproto/bond.c b/ofproto/bond.c
index 7086246..13a7e8a 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -354,7 +354,7 @@ update_recirc_rules(struct bond *bond)
             ofpact_put_OUTPUT(&ofpacts)->port = pr_op->out_ofport;
             error = ofproto_dpif_add_internal_flow(bond->ofproto,
                                                    &pr_op->match,
-                                                   RECIRC_RULE_PRIORITY,
+                                                   RECIRC_RULE_PRIORITY, 0,
                                                    &ofpacts, &rule);
             if (error) {
                 char *err_s = match_to_string(&pr_op->match,
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 12b6be3..05f7bca 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1173,7 +1173,8 @@ add_internal_miss_flow(struct ofproto_dpif *ofproto, int 
id,
     match_init_catchall(&match);
     match_set_reg(&match, 0, id);
 
-    error = ofproto_dpif_add_internal_flow(ofproto, &match, 0, ofpacts, &rule);
+    error = ofproto_dpif_add_internal_flow(ofproto, &match, 0, 0, ofpacts,
+                                           &rule);
     *rulep = error ? NULL : rule_dpif_cast(rule);
 
     return error;
@@ -1230,7 +1231,7 @@ add_internal_flows(struct ofproto_dpif *ofproto)
     match_init_catchall(&match);
     match_set_recirc_id(&match, 0);
 
-    error = ofproto_dpif_add_internal_flow(ofproto, &match, 2,  &ofpacts,
+    error = ofproto_dpif_add_internal_flow(ofproto, &match, 2, 0, &ofpacts,
                                            &unused_rulep);
     if (error) {
         return error;
@@ -1243,7 +1244,7 @@ add_internal_flows(struct ofproto_dpif *ofproto)
      */
     ofpbuf_clear(&ofpacts);
     match_init_catchall(&match);
-    error = ofproto_dpif_add_internal_flow(ofproto, &match, 1,  &ofpacts,
+    error = ofproto_dpif_add_internal_flow(ofproto, &match, 1, 0, &ofpacts,
                                            &unused_rulep);
 
     return error;
@@ -4727,6 +4728,7 @@ ofproto_dpif_free_recirc_id(struct ofproto_dpif *ofproto, 
uint32_t recirc_id)
 int
 ofproto_dpif_add_internal_flow(struct ofproto_dpif *ofproto,
                                struct match *match, int priority,
+                               uint16_t idle_timeout,
                                const struct ofpbuf *ofpacts,
                                struct rule **rulep)
 {
@@ -4742,7 +4744,7 @@ ofproto_dpif_add_internal_flow(struct ofproto_dpif 
*ofproto,
     fm.modify_cookie = false;
     fm.table_id = TBL_INTERNAL;
     fm.command = OFPFC_ADD;
-    fm.idle_timeout = 0;
+    fm.idle_timeout = idle_timeout;
     fm.hard_timeout = 0;
     fm.buffer_id = 0;
     fm.out_port = 0;
diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h
index b9210fd..6d21bac 100644
--- a/ofproto/ofproto-dpif.h
+++ b/ofproto/ofproto-dpif.h
@@ -200,6 +200,7 @@ uint32_t ofproto_dpif_alloc_recirc_id(struct ofproto_dpif 
*ofproto);
 void ofproto_dpif_free_recirc_id(struct ofproto_dpif *ofproto, uint32_t 
recirc_id);
 int ofproto_dpif_add_internal_flow(struct ofproto_dpif *ofproto,
                                    struct match *match, int proiroty,
+                                   uint16_t idle_timeout,
                                    const struct ofpbuf *ofpacts,
                                    struct rule **rulep);
 int ofproto_dpif_delete_internal_flow(struct ofproto_dpif *ofproto, struct 
match *match,
-- 
1.8.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to