[ovs-dev,06/10] ofproto: Add default match on packet_type Ethernet

Submitted by Zoltán Balogh on April 18, 2017, 11:20 a.m.

Details

Message ID AM2PR07MB1042A23962672C7099DB97BC8A190@AM2PR07MB1042.eurprd07.prod.outlook.com
State Deferred
Headers show

Commit Message

Zoltán Balogh April 18, 2017, 11:20 a.m.
From: Jan Scheurich <jan.scheurich@ericsson.com>

Add default match on packet_type Ethernet in case of packet type-aware bridge.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
---
 ofproto/ofproto.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index c21a6e1..31e64b6 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4709,6 +4709,7 @@  add_flow_init(struct ofproto *ofproto, struct ofproto_flow_mod *ofm,
     OVS_EXCLUDED(ofproto_mutex)
 {
     struct oftable *table;
+    struct match match = fm->match;
     struct cls_rule cr;
     uint8_t table_id;
     enum ofperr error;
@@ -4749,8 +4750,16 @@  add_flow_init(struct ofproto *ofproto, struct ofproto_flow_mod *ofm,
         return OFPERR_OFPBRC_EPERM;
     }
 
+    if (ofproto->packet_type_aware) {
+        if (!match.wc.masks.packet_type) {
+            /* Add default match on packet_type Ethernet.*/
+            match.flow.packet_type = htonl(PT_ETH);
+            match.wc.masks.packet_type = OVS_BE32_MAX;
+        }
+    }
+
     if (!ofm->temp_rule) {
-        cls_rule_init(&cr, &fm->match, fm->priority);
+        cls_rule_init(&cr, &match, fm->priority);
 
         /* Allocate new rule.  Destroys 'cr'. */
         error = ofproto_rule_create(ofproto, &cr, table - ofproto->tables,