diff mbox

[ovs-dev,v2,5/6] userspace: Complete Packet In handling

Message ID AM2PR07MB1042A2D5B2E87C39B81772E08AE50@AM2PR07MB1042.eurprd07.prod.outlook.com
State Not Applicable
Headers show

Commit Message

Zoltan Balogh May 19, 2017, 9:24 a.m. UTC
From: Jan Scheurich <jan.scheurich@ericsson.com>

Send packet_in for non-Ethernet packets.
Include packet_type in Packet In for ptap bridges.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
---
 lib/flow.c                   |  4 ++++
 lib/ofp-print.c              |  3 +--
 ofproto/ofproto-dpif-xlate.c | 10 +++++-----
 3 files changed, 10 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/lib/flow.c b/lib/flow.c
index 4f7a041..d3b3cee 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -991,6 +991,10 @@  flow_get_metadata(const struct flow *flow, struct match *flow_metadata)
     }
 
     match_set_in_port(flow_metadata, flow->in_port.ofp_port);
+    if (flow->packet_type != htonl(PT_ETH)) {
+        match_set_packet_type(flow_metadata, flow->packet_type);
+    }
+
     if (flow->ct_state != 0) {
         match_set_ct_state(flow_metadata, flow->ct_state);
         if (is_ct_valid(flow, NULL, NULL) && flow->ct_nw_proto != 0) {
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 7ca9531..2408bff 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -217,10 +217,9 @@  ofp_print_packet_in(struct ds *string, const struct ofp_header *oh,
     }
 
     if (verbosity > 0) {
-        /* Packet In can only carry Ethernet packets. */
         char *packet = ofp_packet_to_string(public->packet,
                                             public->packet_len,
-                                            htonl(PT_ETH));
+                                            public->flow_metadata.flow.packet_type);
         ds_put_cstr(string, packet);
         free(packet);
     }
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 7240a24..3a69c21 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -4267,11 +4267,6 @@  execute_controller_action(struct xlate_ctx *ctx, int len,
         return;
     }
 
-    if (packet->packet_type != htonl(PT_ETH)) {
-        dp_packet_delete(packet);
-        return;
-    }
-
     /* A packet sent by an action in a table-miss rule is considered an
      * explicit table miss.  OpenFlow before 1.3 doesn't have that concept so
      * it will get translated back to OFPR_ACTION for those versions. */
@@ -4305,6 +4300,11 @@  execute_controller_action(struct xlate_ctx *ctx, int len,
     };
     flow_get_metadata(&ctx->xin->flow, &am->pin.up.public.flow_metadata);
 
+    /* Send packet_type only from packet-type-aware bridges. */
+    if (!ctx->xbridge->packet_type_aware) {
+        am->pin.up.public.flow_metadata.wc.masks.packet_type = 0;
+    }
+
     /* Async messages are only sent once, so if we send one now, no
      * xlate cache entry is created.  */
     if (ctx->xin->allow_side_effects) {