Small fixes and improvements on fabric.p4
- setting s_tag and c_tag for BNG as early as possible in the pipeline
- ingress_port_vlan was matching on inner_vlan_tag but that field could be not present

Change-Id: Id4d51159a314d45cec370471ed244a51fd74338b
diff --git a/pipelines/fabric/impl/src/main/resources/include/control/filtering.p4 b/pipelines/fabric/impl/src/main/resources/include/control/filtering.p4
index 17dba78..a8fae49 100644
--- a/pipelines/fabric/impl/src/main/resources/include/control/filtering.p4
+++ b/pipelines/fabric/impl/src/main/resources/include/control/filtering.p4
@@ -48,14 +48,16 @@
         permit();
     }
 
-    // FIXME: remove the use of ternary match on valid inner VLAN.
+    // FIXME: remove the use of ternary match on inner VLAN.
     // Use multi-table approach to remove ternary matching
     table ingress_port_vlan {
         key = {
             standard_metadata.ingress_port : exact @name("ig_port");
             hdr.vlan_tag.isValid()         : exact @name("vlan_is_valid");
             hdr.vlan_tag.vlan_id           : ternary @name("vlan_id");
+#ifdef WITH_DOUBLE_VLAN_TERMINATION
             hdr.inner_vlan_tag.vlan_id     : ternary @name("inner_vlan_id");
+#endif // WITH_DOUBLE_VLAN_TERMINATION
         }
         actions = {
             deny();
diff --git a/pipelines/fabric/impl/src/main/resources/include/control/next.p4 b/pipelines/fabric/impl/src/main/resources/include/control/next.p4
index 2ea719a..577307e 100644
--- a/pipelines/fabric/impl/src/main/resources/include/control/next.p4
+++ b/pipelines/fabric/impl/src/main/resources/include/control/next.p4
@@ -76,6 +76,10 @@
         set_vlan(outer_vlan_id);
         fabric_metadata.push_double_vlan = _TRUE;
         fabric_metadata.inner_vlan_id = inner_vlan_id;
+#ifdef WITH_BNG
+        fabric_metadata.bng.s_tag = outer_vlan_id;
+        fabric_metadata.bng.c_tag = inner_vlan_id;
+#endif // WITH_BNG
     }
 #endif // WITH_DOUBLE_VLAN_TERMINATION