Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/dpif-netdev.c |   10 +++++++---
 lib/odp-execute.c |   18 ++++++++----------
 lib/odp-execute.h |    6 ++++--
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 0d489ba..0f6a71c 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1226,10 +1226,11 @@ dpif_netdev_wait(struct dpif *dpif)
 }
 
 static void
-dp_netdev_output_port(void *dp_, struct ofpbuf *packet, uint32_t out_port)
+dp_netdev_output_port(void *dp_, struct ofpbuf *packet,
+                      const struct flow *flow OVS_UNUSED, odp_port_t out_port)
 {
     struct dp_netdev *dp = dp_;
-    struct dp_netdev_port *p = dp->ports[out_port];
+    struct dp_netdev_port *p = dp->ports[odp_to_u32(out_port)];
     if (p) {
         netdev_send(p->netdev, packet);
     }
@@ -1289,8 +1290,11 @@ dp_netdev_output_userspace(struct dp_netdev *dp, const 
struct ofpbuf *packet,
 static void
 dp_netdev_action_userspace(void *dp, struct ofpbuf *packet,
                            const struct flow *key,
-                           const struct nlattr *userdata)
+                           const struct nlattr *a)
 {
+    const struct nlattr *userdata;
+
+    userdata = nl_attr_find_nested(a, OVS_USERSPACE_ATTR_USERDATA);
     dp_netdev_output_userspace(dp, packet, DPIF_UC_ACTION, key, userdata);
 }
 
diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index c91cc4a..3914c3b 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -125,10 +125,11 @@ static void
 odp_execute_sample(void *dp, struct ofpbuf *packet, struct flow *key,
                    const struct nlattr *action,
                    void (*output)(void *dp, struct ofpbuf *packet,
-                                  uint32_t out_port),
+                                  const struct flow *key,
+                                  odp_port_t out_port),
                    void (*userspace)(void *dp, struct ofpbuf *packet,
                                      const struct flow *key,
-                                     const struct nlattr *a))
+                                     const struct nlattr *action))
 {
     const struct nlattr *subactions = NULL;
     const struct nlattr *a;
@@ -163,10 +164,11 @@ void
 odp_execute_actions(void *dp, struct ofpbuf *packet, struct flow *key,
                     const struct nlattr *actions, size_t actions_len,
                     void (*output)(void *dp, struct ofpbuf *packet,
-                                   uint32_t out_port),
+                                   const struct flow *key,
+                                   odp_port_t out_port),
                     void (*userspace)(void *dp, struct ofpbuf *packet,
                                       const struct flow *key,
-                                      const struct nlattr *a))
+                                      const struct nlattr *action))
 {
     const struct nlattr *a;
     unsigned int left;
@@ -177,16 +179,12 @@ odp_execute_actions(void *dp, struct ofpbuf *packet, 
struct flow *key,
         switch ((enum ovs_action_attr) type) {
         case OVS_ACTION_ATTR_OUTPUT:
             if (output) {
-                output(dp, packet, nl_attr_get_u32(a));
+                output(dp, packet, key, u32_to_odp(nl_attr_get_u32(a)));
             }
             break;
 
         case OVS_ACTION_ATTR_USERSPACE: {
-            if (userspace) {
-                const struct nlattr *userdata;
-                userdata = nl_attr_find_nested(a, OVS_USERSPACE_ATTR_USERDATA);
-                userspace(dp, packet, key, userdata);
-            }
+            userspace(dp, packet, key, a);
             break;
         }
 
diff --git a/lib/odp-execute.h b/lib/odp-execute.h
index 89dd66b..5d9fa90 100644
--- a/lib/odp-execute.h
+++ b/lib/odp-execute.h
@@ -20,6 +20,7 @@
 
 #include <stddef.h>
 #include <stdint.h>
+#include "openvswitch/types.h"
 
 struct flow;
 struct nlattr;
@@ -29,8 +30,9 @@ void
 odp_execute_actions(void *dp, struct ofpbuf *packet, struct flow *key,
                     const struct nlattr *actions, size_t actions_len,
                     void (*output)(void *dp, struct ofpbuf *packet,
-                                   uint32_t out_port),
+                                   const struct flow *key,
+                                   odp_port_t out_port),
                     void (*userspace)(void *dp, struct ofpbuf *packet,
                                       const struct flow *key,
-                                      const struct nlattr *a));
+                                      const struct nlattr *action));
 #endif
-- 
1.7.10.4

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

Reply via email to