[ovs-dev] [RFC 7/9] ofproto-dpif: Allow caching of xlate_actions() effects.

Ben Pfaff blp at nicira.com
Tue Mar 11 23:32:45 UTC 2014


On Thu, Mar 06, 2014 at 05:20:30PM -0800, Joe Stringer wrote:
> This patch adds a new object called 'struct xlate_cache' which can be
> set in 'struct xlate_in', and passed to xlate_actions() to cache the
> modules affected by this flow translation. Subsequently, the caller can
> pass the xcache to xlate_from_cache() to credit stats and perform side
> effects for a lower cost than full flow translation.
> 
> Initial testing shows mild TCP CRR performance increase (~5%) and a
> drastic decrease in flow dump duration. This is expected to allow
> significantly more flows to be maintained in the datapath.
> 
> Signed-off-by: Joe Stringer <joestringer at nicira.com>

I'm folding in some minor style fixes:

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index ecc545f..bd78cbc 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -3366,7 +3366,8 @@ xlate_credit_stats_dev(struct xc_entry *entry, struct dpif_flow_stats *push)
 }
 
 struct xlate_cache *
-xlate_cache_new(void) {
+xlate_cache_new(void)
+{
     struct xlate_cache *xc = xmalloc(sizeof *xc);
 
     ofpbuf_init(&xc->entries, 512);
@@ -3374,7 +3375,8 @@ xlate_cache_new(void) {
 }
 
 static struct xc_entry *
-xlate_cache_add_entry(struct xlate_cache *xc, enum stats_type type) {
+xlate_cache_add_entry(struct xlate_cache *xc, enum stats_type type)
+{
     struct xc_entry *entry;
 
     entry = ofpbuf_put_uninit(&xc->entries, sizeof *entry);
@@ -3395,7 +3397,8 @@ xlate_cache_normal(struct ofproto_dpif *ofproto, struct flow *flow, int vlan)
         return;
     }
 
-    xbundle = lookup_input_bundle(xbridge, flow->in_port.ofp_port, false, NULL);
+    xbundle = lookup_input_bundle(xbridge, flow->in_port.ofp_port, false,
+                                  NULL);
     if (!xbundle) {
         return;
     }
@@ -3409,7 +3412,7 @@ xlate_from_cache(struct xlate_cache *xc, struct dpif_flow_stats *push)
     struct xc_entry *entry;
     struct ofpbuf entries = xc->entries;
 
-    XC_ENTRY_FOR_EACH(entry, entries, xc) {
+    XC_ENTRY_FOR_EACH (entry, entries, xc) {
         switch (entry->type) {
         case XC_RULE:
             rule_dpif_credit_stats(entry->u.rule, push);
@@ -3463,7 +3466,9 @@ xlate_dev_unref(struct xc_entry *entry)
     }
 }
 
-void xlate_cache_clear(struct xlate_cache *xc) {
+void
+xlate_cache_clear(struct xlate_cache *xc)
+{
     struct xc_entry *entry;
     struct ofpbuf entries;
 
@@ -3471,7 +3476,7 @@ void xlate_cache_clear(struct xlate_cache *xc) {
         return;
     }
 
-    XC_ENTRY_FOR_EACH(entry, entries, xc) {
+    XC_ENTRY_FOR_EACH (entry, entries, xc) {
         switch (entry->type) {
         case XC_RULE:
             rule_dpif_unref(entry->u.rule);



More information about the dev mailing list