[ovs-dev] [PATCH 1/2] ofproto-dpif: Move process_special() to ofproto-dpif-xlate.c.

Justin Pettit jpettit at nicira.com
Tue Jun 18 01:15:51 UTC 2013


The action translation functions are the only ones that need
process_special().  Move that function closer to the callers, since a
future commit will use more xlate-related knowledge in process_special.

Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 ofproto/ofproto-dpif-xlate.c |   35 +++++++++++++++++++++++++++++++++++
 ofproto/ofproto-dpif.c       |   36 ++----------------------------------
 ofproto/ofproto-dpif.h       |    7 +++----
 3 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 0a577b1..5118d17 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -16,14 +16,17 @@
 
 #include "ofproto/ofproto-dpif-xlate.h"
 
+#include "bfd.h"
 #include "bitmap.h"
 #include "bond.h"
 #include "bundle.h"
 #include "byte-order.h"
+#include "cfm.h"
 #include "connmgr.h"
 #include "coverage.h"
 #include "dpif.h"
 #include "dynamic-string.h"
+#include "lacp.h"
 #include "learn.h"
 #include "mac-learning.h"
 #include "meta-flow.h"
@@ -790,6 +793,38 @@ fix_sflow_action(struct xlate_ctx *ctx)
                          ctx->sflow_odp_port, ctx->sflow_n_outputs, cookie);
 }
 
+static enum slow_path_reason
+process_special(struct ofproto_dpif *ofproto, const struct flow *flow,
+                const struct ofport_dpif *ofport, const struct ofpbuf *packet)
+{
+    if (!ofport) {
+        return 0;
+    } else if (ofport->cfm && cfm_should_process_flow(ofport->cfm, flow)) {
+        if (packet) {
+            cfm_process_heartbeat(ofport->cfm, packet);
+        }
+        return SLOW_CFM;
+    } else if (ofport->bfd && bfd_should_process_flow(flow)) {
+        if (packet) {
+            bfd_process_packet(ofport->bfd, flow, packet);
+        }
+        return SLOW_BFD;
+    } else if (ofport->bundle && ofport->bundle->lacp
+               && flow->dl_type == htons(ETH_TYPE_LACP)) {
+        if (packet) {
+            lacp_process_packet(ofport->bundle->lacp, ofport, packet);
+        }
+        return SLOW_LACP;
+    } else if (ofproto->stp && stp_should_process_flow(flow)) {
+        if (packet) {
+            stp_process_packet(ofport, packet);
+        }
+        return SLOW_STP;
+    } else {
+        return 0;
+    }
+}
+
 static void
 compose_output_action__(struct xlate_ctx *ctx, uint16_t ofp_port,
                         bool check_stp)
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index b917dc7..e9af4a6 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1928,13 +1928,13 @@ stp_wait(struct ofproto_dpif *ofproto)
 }
 
 /* Returns true if STP should process 'flow'. */
-static bool
+bool
 stp_should_process_flow(const struct flow *flow)
 {
     return eth_addr_equals(flow->dl_dst, eth_addr_stp);
 }
 
-static void
+void
 stp_process_packet(const struct ofport_dpif *ofport,
                    const struct ofpbuf *packet)
 {
@@ -3234,38 +3234,6 @@ send_packet_in_miss(struct ofproto_dpif *ofproto, const struct ofpbuf *packet,
     connmgr_send_packet_in(ofproto->up.connmgr, &pin);
 }
 
-enum slow_path_reason
-process_special(struct ofproto_dpif *ofproto, const struct flow *flow,
-                const struct ofport_dpif *ofport, const struct ofpbuf *packet)
-{
-    if (!ofport) {
-        return 0;
-    } else if (ofport->cfm && cfm_should_process_flow(ofport->cfm, flow)) {
-        if (packet) {
-            cfm_process_heartbeat(ofport->cfm, packet);
-        }
-        return SLOW_CFM;
-    } else if (ofport->bfd && bfd_should_process_flow(flow)) {
-        if (packet) {
-            bfd_process_packet(ofport->bfd, flow, packet);
-        }
-        return SLOW_BFD;
-    } else if (ofport->bundle && ofport->bundle->lacp
-               && flow->dl_type == htons(ETH_TYPE_LACP)) {
-        if (packet) {
-            lacp_process_packet(ofport->bundle->lacp, ofport, packet);
-        }
-        return SLOW_LACP;
-    } else if (ofproto->stp && stp_should_process_flow(flow)) {
-        if (packet) {
-            stp_process_packet(ofport, packet);
-        }
-        return SLOW_STP;
-    } else {
-        return 0;
-    }
-}
-
 static struct flow_miss *
 flow_miss_find(struct hmap *todo, const struct ofproto_dpif *ofproto,
                const struct flow *flow, uint32_t hash)
diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h
index 52e9639..bfba344 100644
--- a/ofproto/ofproto-dpif.h
+++ b/ofproto/ofproto-dpif.h
@@ -257,10 +257,9 @@ size_t put_userspace_action(const struct ofproto_dpif *,
                             const union user_action_cookie *,
                             const size_t cookie_size);
 
-enum slow_path_reason process_special(struct ofproto_dpif *,
-                                      const struct flow *,
-                                      const struct ofport_dpif *,
-                                      const struct ofpbuf *packet);
+bool stp_should_process_flow(const struct flow *);
+void stp_process_packet(const struct ofport_dpif *,
+                        const struct ofpbuf *packet);
 
 uint16_t vsp_realdev_to_vlandev(const struct ofproto_dpif *,
                                 uint16_t realdev_ofp_port,
-- 
1.7.5.4




More information about the dev mailing list