[ovs-dev] [PATCH v4 5/9] ofproto-dpif: Add idle_timeout parameter to ofproto_dpif_add_internal_flow()

Simon Horman horms at verge.net.au
Fri May 2 08:41:36 UTC 2014


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 <horms at verge.net.au>

--
v3
* Rebase
* Break back out into separate patch

v2
* Erroneously squashed into "odp-util: Add odp_put_recirc_action() helper"
---
 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 7962ad9..d904b1e 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -351,7 +351,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, pr_op->pr_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 9429430..7665520 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1212,7 +1212,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;
@@ -1270,7 +1271,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;
@@ -1283,7 +1284,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;
@@ -4849,6 +4850,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)
 {
@@ -4864,7 +4866,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 e368f63..7a72563 100644
--- a/ofproto/ofproto-dpif.h
+++ b/ofproto/ofproto-dpif.h
@@ -224,6 +224,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 *,
                                    struct match *, int priority,
+                                   uint16_t idle_timeout,
                                    const struct ofpbuf *ofpacts,
                                    struct rule **rulep);
 int ofproto_dpif_delete_internal_flow(struct ofproto_dpif *, struct match *,
-- 
1.8.4




More information about the dev mailing list