diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java index d8db5936fb..5bb6a5d7aa 100644 --- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java +++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java @@ -59,6 +59,8 @@ public final class FabricConstants { buildPiMatchField(ETHERNET, "src_addr", true); public static final PiMatchFieldId HF_ICMP_ICMP_TYPE_ID = buildPiMatchField(ICMP, "icmp_type", true); + public static final PiMatchFieldId HF_STANDARD_METADATA_EGRESS_PORT_ID = + buildPiMatchField(STANDARD_METADATA, "egress_port", false); public static final PiMatchFieldId HF_FABRIC_METADATA_NEXT_ID_ID = buildPiMatchField(FABRIC_METADATA, "next_id", false); public static final PiMatchFieldId HF_FABRIC_METADATA_L4_DST_PORT_ID = @@ -91,6 +93,8 @@ public final class FabricConstants { PiTableId.of("FabricIngress.forwarding.acl"); public static final PiTableId TBL_HASHED_ID = PiTableId.of("FabricIngress.next.hashed"); + public static final PiTableId TBL_EGRESS_VLAN_ID = + PiTableId.of("FabricEgress.egress_next.egress_vlan"); public static final PiTableId TBL_MPLS_ID = PiTableId.of("FabricIngress.forwarding.mpls"); public static final PiTableId TBL_MULTICAST_ID = @@ -105,12 +109,14 @@ public final class FabricConstants { PiTableId.of("FabricIngress.filtering.fwd_classifier"); public static final PiTableId TBL_BRIDGING_ID = PiTableId.of("FabricIngress.forwarding.bridging"); + public static final PiTableId TBL_SIMPLE_ID = + PiTableId.of("FabricIngress.next.simple"); public static final PiTableId TBL_INGRESS_PORT_VLAN_ID = PiTableId.of("FabricIngress.filtering.ingress_port_vlan"); public static final PiTableId TBL_UNICAST_V6_ID = PiTableId.of("FabricIngress.forwarding.unicast_v6"); - public static final PiTableId TBL_SIMPLE_ID = - PiTableId.of("FabricIngress.next.simple"); + public static final PiTableId TBL_VLAN_META_ID = + PiTableId.of("FabricIngress.next.vlan_meta"); // Indirect Counter IDs public static final PiCounterId CNT_EGRESS_PORT_COUNTER_ID = @@ -123,8 +129,8 @@ public final class FabricConstants { PiCounterId.of("FabricIngress.forwarding.acl_counter"); public static final PiCounterId CNT_MULTICAST_COUNTER_ID = PiCounterId.of("FabricIngress.next.multicast_counter"); - public static final PiCounterId CNT_SIMPLE_COUNTER_ID = - PiCounterId.of("FabricIngress.next.simple_counter"); + public static final PiCounterId CNT_VLAN_META_COUNTER_ID = + PiCounterId.of("FabricIngress.next.vlan_meta_counter"); public static final PiCounterId CNT_FWD_CLASSIFIER_COUNTER_ID = PiCounterId.of("FabricIngress.filtering.fwd_classifier_counter"); public static final PiCounterId CNT_BRIDGING_COUNTER_ID = @@ -137,6 +143,8 @@ public final class FabricConstants { PiCounterId.of("FabricIngress.forwarding.unicast_v6_counter"); public static final PiCounterId CNT_UNICAST_V4_COUNTER_ID = PiCounterId.of("FabricIngress.forwarding.unicast_v4_counter"); + public static final PiCounterId CNT_SIMPLE_COUNTER_ID = + PiCounterId.of("FabricIngress.next.simple_counter"); public static final PiCounterId CNT_INGRESS_PORT_VLAN_COUNTER_ID = PiCounterId.of("FabricIngress.filtering.ingress_port_vlan_counter"); public static final PiCounterId CNT_MPLS_COUNTER_ID = @@ -147,8 +155,12 @@ public final class FabricConstants { // Action IDs public static final PiActionId ACT_FABRICINGRESS_FILTERING_DROP_ID = PiActionId.of("FabricIngress.filtering.drop"); + public static final PiActionId ACT_FABRICINGRESS_NEXT_SET_VLAN_ID = + PiActionId.of("FabricIngress.next.set_vlan"); public static final PiActionId ACT_FABRICINGRESS_FORWARDING_POP_MPLS_AND_NEXT_ID = PiActionId.of("FabricIngress.forwarding.pop_mpls_and_next"); + public static final PiActionId ACT_FABRICEGRESS_EGRESS_NEXT_POP_VLAN_ID = + PiActionId.of("FabricEgress.egress_next.pop_vlan"); public static final PiActionId ACT_FABRICINGRESS_FILTERING_SET_FORWARDING_TYPE_ID = PiActionId.of("FabricIngress.filtering.set_forwarding_type"); public static final PiActionId ACT_NOP_ID = PiActionId.of("nop"); @@ -156,6 +168,10 @@ public final class FabricConstants { PiActionId.of("FabricIngress.filtering.set_vlan"); public static final PiActionId ACT_FABRICINGRESS_NEXT_MPLS_ROUTING_V6_ID = PiActionId.of("FabricIngress.next.mpls_routing_v6"); + public static final PiActionId ACT_FABRICEGRESS_PKT_IO_EGRESS_POP_VLAN_ID = + PiActionId.of("FabricEgress.pkt_io_egress.pop_vlan"); + public static final PiActionId ACT_FABRICINGRESS_NEXT_L3_ROUTING_VLAN_ID = + PiActionId.of("FabricIngress.next.l3_routing_vlan"); public static final PiActionId ACT_NOACTION_ID = PiActionId.of("NoAction"); public static final PiActionId ACT_FABRICINGRESS_NEXT_SET_MCAST_GROUP_ID = PiActionId.of("FabricIngress.next.set_mcast_group"); @@ -203,6 +219,5 @@ public final class FabricConstants { PiControlMetadataId.of("ingress_port"); public static final PiControlMetadataId CTRL_META_EGRESS_PORT_ID = PiControlMetadataId.of("egress_port"); - public static final int PORT_BITWIDTH = 9; } diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java index ef011ee182..fb85ff3050 100644 --- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java +++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java @@ -90,7 +90,10 @@ public class FabricInterpreter extends AbstractHandlerBehaviour FabricConstants.TBL_ACL_ID); private static final Set NEXT_CTRL_TBLS = ImmutableSet.of(FabricConstants.TBL_SIMPLE_ID, FabricConstants.TBL_HASHED_ID, - FabricConstants.TBL_MULTICAST_ID); + FabricConstants.TBL_MULTICAST_ID, + FabricConstants.TBL_VLAN_META_ID); + + private static final Set E_NEXT_CTRL_TBLS = ImmutableSet.of(FabricConstants.TBL_EGRESS_VLAN_ID); private static final ImmutableMap CRITERION_MAP = ImmutableMap.builder() @@ -161,6 +164,8 @@ public class FabricInterpreter extends AbstractHandlerBehaviour return FabricTreatmentInterpreter.mapForwardingTreatment(treatment); } else if (NEXT_CTRL_TBLS.contains(piTableId)) { return FabricTreatmentInterpreter.mapNextTreatment(treatment); + } else if (E_NEXT_CTRL_TBLS.contains(piTableId)) { + return FabricTreatmentInterpreter.mapEgressNextTreatment(treatment); } else { throw new PiInterpreterException(String.format("Table %s unsupported", piTableId)); } diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricTreatmentInterpreter.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricTreatmentInterpreter.java index 3dc2f41c4c..3be56bb988 100644 --- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricTreatmentInterpreter.java +++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricTreatmentInterpreter.java @@ -50,6 +50,13 @@ import static org.slf4j.LoggerFactory.getLogger; final class FabricTreatmentInterpreter { private static final Logger log = getLogger(FabricTreatmentInterpreter.class); private static final String INVALID_TREATMENT = "Invalid treatment for %s block: %s"; + private static final PiAction NOP = PiAction.builder() + .withId(FabricConstants.ACT_NOP_ID) + .build(); + + private static final PiAction POP_VLAN = PiAction.builder() + .withId(FabricConstants.ACT_FABRICEGRESS_EGRESS_NEXT_POP_VLAN_ID) + .build(); // Hide default constructor protected FabricTreatmentInterpreter() { @@ -72,9 +79,7 @@ final class FabricTreatmentInterpreter { Instruction noActInst = Instructions.createNoAction(); if (instructions.isEmpty() || instructions.contains(noActInst)) { // nop - return PiAction.builder() - .withId(FabricConstants.ACT_NOP_ID) - .build(); + return NOP; } L2ModificationInstruction.ModVlanHeaderInstruction pushVlanInst = null; @@ -159,17 +164,16 @@ final class FabricTreatmentInterpreter { * output * set_vlan_output * l3_routing + * l3_routing_vlan * mpls_routing_v4 * - * Unsupported, using PiAction directly: - * set_next_type - * * Unsupported, need to find a way to implement it * mpls_routing_v6 */ public static PiAction mapNextTreatment(TrafficTreatment treatment) throws PiInterpreterException { + // TODO: refactor this method List insts = treatment.allInstructions(); OutputInstruction outInst = null; ModEtherInstruction modEthDstInst = null; @@ -195,8 +199,6 @@ final class FabricTreatmentInterpreter { case MPLS_LABEL: modMplsInst = (ModMplsLabelInstruction) l2Inst; break; - case VLAN_PUSH: - break; default: log.warn("Unsupported l2 instruction sub type: {}", l2Inst.subtype()); break; @@ -212,8 +214,23 @@ final class FabricTreatmentInterpreter { } if (outInst == null) { - throw new PiInterpreterException(format(INVALID_TREATMENT, "next", treatment)); + // for vlan_meta table only + if (modVlanIdInst != null) { + // set_vlan + VlanId vlanId = modVlanIdInst.vlanId(); + PiActionParam newVlanParam = + new PiActionParam(FabricConstants.ACT_PRM_NEW_VLAN_ID_ID, + ImmutableByteSequence.copyFrom(vlanId.toShort())); + // set_vlan_output + return PiAction.builder() + .withId(FabricConstants.ACT_FABRICINGRESS_NEXT_SET_VLAN_ID) + .withParameter(newVlanParam) + .build(); + } else { + throw new PiInterpreterException(format(INVALID_TREATMENT, "next", treatment)); + } } + short portNum = (short) outInst.port().toLong(); PiActionParam portNumParam = new PiActionParam(FabricConstants.ACT_PRM_PORT_NUM_ID, ImmutableByteSequence.copyFrom(portNum)); @@ -267,15 +284,39 @@ final class FabricTreatmentInterpreter { } } - // L3 routing - return PiAction.builder() - .withId(FabricConstants.ACT_FABRICINGRESS_NEXT_L3_ROUTING_ID) - .withParameters(ImmutableList.of(portNumParam, - srcMacParam, - dstMacParam)) - .build(); + if (modVlanIdInst != null) { + VlanId vlanId = modVlanIdInst.vlanId(); + PiActionParam vlanParam = + new PiActionParam(FabricConstants.ACT_PRM_NEW_VLAN_ID_ID, + ImmutableByteSequence.copyFrom(vlanId.toShort())); + // L3 routing and set VLAN + return PiAction.builder() + .withId(FabricConstants.ACT_FABRICINGRESS_NEXT_L3_ROUTING_VLAN_ID) + .withParameters(ImmutableList.of(srcMacParam, dstMacParam, portNumParam, vlanParam)) + .build(); + } else { + // L3 routing + return PiAction.builder() + .withId(FabricConstants.ACT_FABRICINGRESS_NEXT_L3_ROUTING_ID) + .withParameters(ImmutableList.of(portNumParam, + srcMacParam, + dstMacParam)) + .build(); + } } throw new PiInterpreterException(format(INVALID_TREATMENT, "next", treatment)); } + + public static PiAction mapEgressNextTreatment(TrafficTreatment treatment) { + // Pop VLAN action for now, may add new action to this control block in the future. + return treatment.allInstructions() + .stream() + .filter(inst -> inst.type() == Instruction.Type.L2MODIFICATION) + .map(inst -> (L2ModificationInstruction) inst) + .filter(inst -> inst.subtype() == L2ModificationInstruction.L2SubType.VLAN_POP) + .findFirst() + .map(inst -> POP_VLAN) + .orElse(NOP); + } } diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipeliner.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipeliner.java index c7c76478af..12602b41e3 100644 --- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipeliner.java +++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipeliner.java @@ -16,16 +16,21 @@ package org.onosproject.pipelines.fabric.pipeliner; +import org.onlab.packet.VlanId; import org.onosproject.net.DeviceId; +import org.onosproject.net.PortNumber; import org.onosproject.net.driver.Driver; import org.onosproject.net.flow.DefaultFlowRule; import org.onosproject.net.flow.DefaultTrafficSelector; import org.onosproject.net.flow.DefaultTrafficTreatment; import org.onosproject.net.flow.TrafficSelector; import org.onosproject.net.flow.TrafficTreatment; +import org.onosproject.net.flow.criteria.Criterion; import org.onosproject.net.flow.criteria.PiCriterion; +import org.onosproject.net.flow.criteria.VlanIdCriterion; import org.onosproject.net.flow.instructions.Instruction; import org.onosproject.net.flow.instructions.Instructions.OutputInstruction; +import org.onosproject.net.flow.instructions.L2ModificationInstruction; import org.onosproject.net.flowobjective.DefaultNextObjective; import org.onosproject.net.flowobjective.NextObjective; import org.onosproject.net.flowobjective.Objective; @@ -44,8 +49,11 @@ import java.util.stream.Collectors; import static org.onosproject.pipelines.fabric.FabricConstants.ACT_PRF_FABRICINGRESS_NEXT_ECMP_SELECTOR_ID; import static org.onosproject.pipelines.fabric.FabricConstants.HF_FABRIC_METADATA_NEXT_ID_ID; +import static org.onosproject.pipelines.fabric.FabricConstants.HF_STANDARD_METADATA_EGRESS_PORT_ID; +import static org.onosproject.pipelines.fabric.FabricConstants.TBL_EGRESS_VLAN_ID; import static org.onosproject.pipelines.fabric.FabricConstants.TBL_HASHED_ID; import static org.onosproject.pipelines.fabric.FabricConstants.TBL_SIMPLE_ID; +import static org.onosproject.pipelines.fabric.FabricConstants.TBL_VLAN_META_ID; import static org.slf4j.LoggerFactory.getLogger; /** @@ -66,6 +74,8 @@ public class FabricNextPipeliner { public PipelinerTranslationResult next(NextObjective nextObjective) { PipelinerTranslationResult.Builder resultBuilder = PipelinerTranslationResult.builder(); + processNextVlanMeta(nextObjective, resultBuilder); + switch (nextObjective.type()) { case SIMPLE: processSimpleNext(nextObjective, resultBuilder); @@ -82,6 +92,38 @@ public class FabricNextPipeliner { return resultBuilder.build(); } + private void processNextVlanMeta(NextObjective next, + PipelinerTranslationResult.Builder resultBuilder) { + TrafficSelector meta = next.meta(); + if (meta == null) { + // do nothing if there is no metadata in the next objective. + return; + } + VlanIdCriterion vlanIdCriterion = + (VlanIdCriterion) meta.getCriterion(Criterion.Type.VLAN_VID); + + if (vlanIdCriterion == null) { + // do nothing if we can't find vlan from next objective metadata. + return; + } + + VlanId vlanId = vlanIdCriterion.vlanId(); + TrafficSelector selector = buildNextIdSelector(next.id()); + TrafficTreatment treatment = DefaultTrafficTreatment.builder() + .setVlanId(vlanId) + .build(); + + resultBuilder.addFlowRule(DefaultFlowRule.builder() + .withSelector(selector) + .withTreatment(treatment) + .forTable(TBL_VLAN_META_ID) + .makePermanent() + .withPriority(next.priority()) + .forDevice(deviceId) + .fromApp(next.appId()) + .build()); + } + private void processSimpleNext(NextObjective next, PipelinerTranslationResult.Builder resultBuilder) { @@ -93,18 +135,14 @@ public class FabricNextPipeliner { TrafficSelector selector = buildNextIdSelector(next.id()); TrafficTreatment treatment = next.next().iterator().next(); - OutputInstruction outputInst = treatment.allInstructions() - .stream() - .filter(inst -> inst.type() == Instruction.Type.OUTPUT) - .map(inst -> (OutputInstruction) inst) - .findFirst() - .orElse(null); + PortNumber outputPort = getOutputPort(treatment); - if (outputInst == null) { + if (outputPort == null) { log.warn("At least one output instruction in simple next objective"); resultBuilder.setError(ObjectiveError.BADPARAMS); return; } + resultBuilder.addFlowRule(DefaultFlowRule.builder() .withSelector(selector) .withTreatment(treatment) @@ -114,29 +152,81 @@ public class FabricNextPipeliner { .forDevice(deviceId) .fromApp(next.appId()) .build()); + + if (includesPopVlanInst(treatment)) { + processVlanPopRule(outputPort, next, resultBuilder); + } } - private void processHashedNext(NextObjective nextObjective, PipelinerTranslationResult.Builder resultBuilder) { + private PortNumber getOutputPort(TrafficTreatment treatment) { + return treatment.allInstructions() + .stream() + .filter(inst -> inst.type() == Instruction.Type.OUTPUT) + .map(inst -> (OutputInstruction) inst) + .findFirst() + .map(OutputInstruction::port) + .orElse(null); + } + + private boolean includesPopVlanInst(TrafficTreatment treatment) { + return treatment.allInstructions() + .stream() + .filter(inst -> inst.type() == Instruction.Type.L2MODIFICATION) + .map(inst -> (L2ModificationInstruction) inst) + .anyMatch(inst -> inst.subtype() == L2ModificationInstruction.L2SubType.VLAN_POP); + } + + private void processVlanPopRule(PortNumber port, NextObjective next, + PipelinerTranslationResult.Builder resultBuilder) { + TrafficSelector meta = next.meta(); + VlanIdCriterion vlanIdCriterion = + (VlanIdCriterion) meta.getCriterion(Criterion.Type.VLAN_VID); + VlanId vlanId = vlanIdCriterion.vlanId(); + + PiCriterion egressVlanTableMatch = PiCriterion.builder() + .matchExact(HF_STANDARD_METADATA_EGRESS_PORT_ID, + (short) port.toLong()) + .build(); + // Add VLAN pop rule to egress pipeline table + TrafficSelector selector = DefaultTrafficSelector.builder() + .matchPi(egressVlanTableMatch) + .matchVlanId(vlanId) + .build(); + TrafficTreatment treatment = DefaultTrafficTreatment.builder() + .popVlan() + .build(); + resultBuilder.addFlowRule(DefaultFlowRule.builder() + .withSelector(selector) + .withTreatment(treatment) + .forTable(TBL_EGRESS_VLAN_ID) + .makePermanent() + .withPriority(next.priority()) + .forDevice(deviceId) + .fromApp(next.appId()) + .build()); + } + + private void processHashedNext(NextObjective next, PipelinerTranslationResult.Builder resultBuilder) { boolean noHashedTable = Boolean.parseBoolean(driver.getProperty(NO_HASHED_TABLE)); if (noHashedTable) { - if (nextObjective.next().isEmpty()) { + if (next.next().isEmpty()) { return; } // use first action if not support hashed group - TrafficTreatment treatment = nextObjective.next().iterator().next(); + TrafficTreatment treatment = next.next().iterator().next(); NextObjective.Builder simpleNext = DefaultNextObjective.builder() .addTreatment(treatment) - .withId(nextObjective.id()) - .fromApp(nextObjective.appId()) + .withId(next.id()) + .fromApp(next.appId()) .makePermanent() - .withMeta(nextObjective.meta()) - .withPriority(nextObjective.priority()) + .withMeta(next.meta()) + .withPriority(next.priority()) .withType(NextObjective.Type.SIMPLE); - if (nextObjective.context().isPresent()) { - processSimpleNext(simpleNext.add(nextObjective.context().get()), resultBuilder); + if (next.context().isPresent()) { + processSimpleNext(simpleNext.add(next.context().get()), resultBuilder); } else { processSimpleNext(simpleNext.add(), resultBuilder); } @@ -144,15 +234,23 @@ public class FabricNextPipeliner { } // create hash groups - int groupId = nextObjective.id(); - List bucketList = nextObjective.next().stream() + int groupId = next.id(); + List bucketList = next.next().stream() .map(DefaultGroupBucket::createSelectGroupBucket) .collect(Collectors.toList()); - if (bucketList.size() != nextObjective.next().size()) { + // Egress VLAN handling + next.next().forEach(treatment -> { + PortNumber outputPort = getOutputPort(treatment); + if (includesPopVlanInst(treatment) && outputPort != null) { + processVlanPopRule(outputPort, next, resultBuilder); + } + }); + + if (bucketList.size() != next.next().size()) { // some action not converted // set error - log.warn("Expected bucket size {}, got {}", nextObjective.next().size(), bucketList.size()); + log.warn("Expected bucket size {}, got {}", next.next().size(), bucketList.size()); resultBuilder.setError(ObjectiveError.BADPARAMS); return; } @@ -167,18 +265,18 @@ public class FabricNextPipeliner { buckets, groupKey, groupId, - nextObjective.appId())); + next.appId())); // flow // If operation is ADD_TO_EXIST or REMOVE_FROM_EXIST, means we modify // group buckets only, no changes for flow rule - if (nextObjective.op() == Objective.Operation.ADD_TO_EXISTING || - nextObjective.op() == Objective.Operation.REMOVE_FROM_EXISTING) { + if (next.op() == Objective.Operation.ADD_TO_EXISTING || + next.op() == Objective.Operation.REMOVE_FROM_EXISTING) { return; } - TrafficSelector selector = buildNextIdSelector(nextObjective.id()); + TrafficSelector selector = buildNextIdSelector(next.id()); TrafficTreatment treatment = DefaultTrafficTreatment.builder() - .piTableAction(PiActionGroupId.of(nextObjective.id())) + .piTableAction(PiActionGroupId.of(next.id())) .build(); resultBuilder.addFlowRule(DefaultFlowRule.builder() @@ -186,9 +284,9 @@ public class FabricNextPipeliner { .withTreatment(treatment) .forTable(TBL_HASHED_ID) .makePermanent() - .withPriority(nextObjective.priority()) + .withPriority(next.priority()) .forDevice(deviceId) - .fromApp(nextObjective.appId()) + .fromApp(next.appId()) .build()); } diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java index 5c66474964..363a95c055 100644 --- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java +++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java @@ -263,7 +263,12 @@ public class FabricPipeliner extends AbstractHandlerBehaviour implements Pipeli }; FlowRuleOperations ops = buildFlowRuleOps(objective, flowRules, ctx); - flowRuleService.apply(ops); + if (ops != null) { + flowRuleService.apply(ops); + } else { + // remove pendings + flowRules.forEach(flowRule -> pendingInstallObjectiveFlows.remove(flowRule.id())); + } } private void installGroups(Objective objective, Collection groups) { @@ -317,8 +322,13 @@ public class FabricPipeliner extends AbstractHandlerBehaviour implements Pipeli case REMOVE: flowRules.forEach(ops::remove); break; + case ADD_TO_EXISTING: + case REMOVE_FROM_EXISTING: + // Next objective may use ADD_TO_EXIST or REMOVE_FROM_EXIST op + // No need to update FlowRuls for vlan_meta table. + return null; default: - log.warn("Unsupported op {} for {}", objective); + log.warn("Unsupported op {} for {}", objective.op(), objective); fail(objective, ObjectiveError.BADPARAMS); return null; } diff --git a/pipelines/fabric/src/main/resources/fabric.p4 b/pipelines/fabric/src/main/resources/fabric.p4 index 8205196c93..93e887e44d 100644 --- a/pipelines/fabric/src/main/resources/fabric.p4 +++ b/pipelines/fabric/src/main/resources/fabric.p4 @@ -39,7 +39,6 @@ inout standard_metadata_t standard_metadata) { Forwarding() forwarding; Next() next; PortCountersControl() port_counters_control; - EgressNextControl() egress_next; apply { packet_io_ingress.apply(hdr, fabric_metadata, standard_metadata); @@ -55,7 +54,7 @@ inout standard_metadata_t standard_metadata) { forwarding.apply(hdr, fabric_metadata, standard_metadata); next.apply(hdr, fabric_metadata, standard_metadata); port_counters_control.apply(hdr, fabric_metadata, standard_metadata); - egress_next.apply(hdr, fabric_metadata, standard_metadata); + } } @@ -63,7 +62,10 @@ control FabricEgress (inout parsed_headers_t hdr, inout fabric_metadata_t fabric_metadata, inout standard_metadata_t standard_metadata) { PacketIoEgress() pkt_io_egress; + EgressNextControl() egress_next; + apply { + egress_next.apply(hdr, fabric_metadata, standard_metadata); pkt_io_egress.apply(hdr, fabric_metadata, standard_metadata); #ifdef WITH_SPGW spgw_egress.apply(hdr.ipv4, hdr.gtpu_ipv4, hdr.gtpu_udp, hdr.gtpu, diff --git a/pipelines/fabric/src/main/resources/include/control/filtering.p4 b/pipelines/fabric/src/main/resources/include/control/filtering.p4 index 58bf147295..4f6e688c0e 100644 --- a/pipelines/fabric/src/main/resources/include/control/filtering.p4 +++ b/pipelines/fabric/src/main/resources/include/control/filtering.p4 @@ -45,8 +45,8 @@ control Filtering ( hdr.ethernet.ether_type = ETHERTYPE_VLAN; set_vlan(new_vlan_id); - // pop internal vlan before output - fabric_metadata.pop_vlan_at_egress = true; + // pop internal vlan before packet in + fabric_metadata.pop_vlan_when_packet_in = true; } action set_forwarding_type(fwd_type_t fwd_type) { diff --git a/pipelines/fabric/src/main/resources/include/control/next.p4 b/pipelines/fabric/src/main/resources/include/control/next.p4 index 7d551dd498..65f93753f0 100644 --- a/pipelines/fabric/src/main/resources/include/control/next.p4 +++ b/pipelines/fabric/src/main/resources/include/control/next.p4 @@ -25,6 +25,7 @@ control Next ( inout fabric_metadata_t fabric_metadata, inout standard_metadata_t standard_metadata) { action_selector(HashAlgorithm.crc16, 32w64, 32w16) ecmp_selector; + direct_counter(CounterType.packets_and_bytes) vlan_meta_counter; direct_counter(CounterType.packets_and_bytes) simple_counter; direct_counter(CounterType.packets_and_bytes) hashed_counter; @@ -32,11 +33,17 @@ control Next ( standard_metadata.egress_spec = port_num; } + action set_vlan(vlan_id_t new_vlan_id) { + hdr.vlan_tag.vlan_id = new_vlan_id; + } + + action pop_vlan() { + hdr.ethernet.ether_type = hdr.vlan_tag.ether_type; + hdr.vlan_tag.setInvalid(); + } + action set_vlan_output(vlan_id_t new_vlan_id, port_num_t port_num){ hdr.vlan_tag.vlan_id = new_vlan_id; - - // don't remove the vlan from egress since we set the vlan to it. - fabric_metadata.pop_vlan_at_egress = false; output(port_num); } @@ -54,6 +61,12 @@ control Next ( output(port_num); } + action l3_routing_vlan(port_num_t port_num, mac_addr_t smac, mac_addr_t dmac, vlan_id_t new_vlan_id) { + rewrite_smac(smac); + rewrite_dmac(dmac); + set_vlan_output(new_vlan_id, port_num); + } + action push_mpls (mpls_label_t label, bit<3> tc) { // Suppose that the maximum number of label is one. hdr.mpls.setValid(); @@ -80,6 +93,19 @@ control Next ( push_mpls(label, 3w0); } + table vlan_meta { + key = { + fabric_metadata.next_id: exact; + } + + actions = { + set_vlan; + nop; + } + default_action = nop; + counters = vlan_meta_counter; + } + table simple { key = { fabric_metadata.next_id: exact; @@ -90,6 +116,7 @@ control Next ( set_vlan_output; l3_routing; mpls_routing_v4; + l3_routing_vlan; } counters = simple_counter; } @@ -137,6 +164,7 @@ control Next ( #endif // WITH_MULTICAST apply { + vlan_meta.apply(); if (simple.apply().hit) { if (!hdr.mpls.isValid()) { if(hdr.ipv4.isValid()) { @@ -159,13 +187,26 @@ control Next ( control EgressNextControl ( inout parsed_headers_t hdr, inout fabric_metadata_t fabric_metadata, - inout standard_metadata_t standard_metadata){ + inout standard_metadata_t standard_metadata) { + + action pop_vlan() { + hdr.ethernet.ether_type = hdr.vlan_tag.ether_type; + hdr.vlan_tag.setInvalid(); + } + + table egress_vlan { + key = { + hdr.vlan_tag.vlan_id: exact; + standard_metadata.egress_port: exact; + } + actions = { + pop_vlan; + nop; + } + default_action = nop; + } apply { - // pop internal vlan if the meta is set - if (fabric_metadata.pop_vlan_at_egress) { - hdr.ethernet.ether_type = hdr.vlan_tag.ether_type; - hdr.vlan_tag.setInvalid(); - } + egress_vlan.apply(); } } diff --git a/pipelines/fabric/src/main/resources/include/control/packetio.p4 b/pipelines/fabric/src/main/resources/include/control/packetio.p4 index 9e0771c39f..7cd8cf2a89 100644 --- a/pipelines/fabric/src/main/resources/include/control/packetio.p4 +++ b/pipelines/fabric/src/main/resources/include/control/packetio.p4 @@ -34,8 +34,15 @@ control PacketIoEgress( inout parsed_headers_t hdr, inout fabric_metadata_t fabric_metadata, inout standard_metadata_t standard_metadata) { + action pop_vlan() { + hdr.ethernet.ether_type = hdr.vlan_tag.ether_type; + hdr.vlan_tag.setInvalid(); + } apply { if (standard_metadata.egress_port == CPU_PORT) { + if (hdr.vlan_tag.isValid() && fabric_metadata.pop_vlan_when_packet_in) { + pop_vlan(); + } hdr.packet_in.setValid(); hdr.packet_in.ingress_port = standard_metadata.ingress_port; } diff --git a/pipelines/fabric/src/main/resources/include/header.p4 b/pipelines/fabric/src/main/resources/include/header.p4 index 6cff586e0f..067d9c8a17 100644 --- a/pipelines/fabric/src/main/resources/include/header.p4 +++ b/pipelines/fabric/src/main/resources/include/header.p4 @@ -151,7 +151,7 @@ struct spgw_meta_t { struct fabric_metadata_t { fwd_type_t fwd_type; next_id_t next_id; - bool pop_vlan_at_egress; + bool pop_vlan_when_packet_in; bit<8> ip_proto; bit<16> l4_src_port; bit<16> l4_dst_port; diff --git a/pipelines/fabric/src/main/resources/include/parser.p4 b/pipelines/fabric/src/main/resources/include/parser.p4 index 8b03da102e..5c998384cc 100644 --- a/pipelines/fabric/src/main/resources/include/parser.p4 +++ b/pipelines/fabric/src/main/resources/include/parser.p4 @@ -54,6 +54,7 @@ inout standard_metadata_t standard_metadata) { state parse_vlan_tag { packet.extract(hdr.vlan_tag); + fabric_metadata.original_ether_type = hdr.vlan_tag.ether_type; transition select(hdr.vlan_tag.ether_type){ ETHERTYPE_ARP: parse_arp; ETHERTYPE_IPV4: parse_ipv4; diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.json b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.json index 56c04b4e52..efab709ecb 100644 --- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.json +++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.json @@ -19,7 +19,7 @@ ["spgw_ingress_hasReturned_0", 1, false], ["fabric_metadata_t.fwd_type", 3, false], ["fabric_metadata_t.next_id", 32, false], - ["fabric_metadata_t.pop_vlan_at_egress", 1, false], + ["fabric_metadata_t.pop_vlan_when_packet_in", 1, false], ["fabric_metadata_t.ip_proto", 8, false], ["fabric_metadata_t.l4_src_port", 16, false], ["fabric_metadata_t.l4_dst_port", 16, false], @@ -481,6 +481,19 @@ } ], "op" : "extract" + }, + { + "parameters" : [ + { + "type" : "field", + "value" : ["scalars", "fabric_metadata_t.original_ether_type"] + }, + { + "type" : "field", + "value" : ["vlan_tag", "ether_type"] + } + ], + "op" : "set" } ], "transitions" : [ @@ -961,7 +974,7 @@ "id" : 0, "source_info" : { "filename" : "./include/parser.p4", - "line" : 164, + "line" : 165, "column" : 8, "source_fragment" : "FabricDeparser" }, @@ -1031,26 +1044,32 @@ "binding" : "FabricIngress.forwarding.multicast_v6" }, { - "name" : "FabricIngress.next.simple_counter", + "name" : "FabricIngress.next.vlan_meta_counter", "id" : 10, "is_direct" : true, + "binding" : "FabricIngress.next.vlan_meta" + }, + { + "name" : "FabricIngress.next.simple_counter", + "id" : 11, + "is_direct" : true, "binding" : "FabricIngress.next.simple" }, { "name" : "FabricIngress.next.hashed_counter", - "id" : 11, + "id" : 12, "is_direct" : true, "binding" : "FabricIngress.next.hashed" }, { "name" : "FabricIngress.next.multicast_counter", - "id" : 12, + "id" : 13, "is_direct" : true, "binding" : "FabricIngress.next.multicast" }, { "name" : "FabricIngress.port_counters_control.egress_port_counter", - "id" : 13, + "id" : 14, "source_info" : { "filename" : "./include/control/port_counter.p4", "line" : 23, @@ -1062,7 +1081,7 @@ }, { "name" : "FabricIngress.port_counters_control.ingress_port_counter", - "id" : 14, + "id" : 15, "source_info" : { "filename" : "./include/control/port_counter.p4", "line" : 24, @@ -1340,9 +1359,15 @@ "primitives" : [] }, { - "name" : "FabricIngress.spgw_ingress.drop_now", + "name" : "nop", "id" : 15, "runtime_data" : [], + "primitives" : [] + }, + { + "name" : "FabricIngress.spgw_ingress.drop_now", + "id" : 16, + "runtime_data" : [], "primitives" : [ { "op" : "drop", @@ -1368,7 +1393,7 @@ }, { "name" : "FabricIngress.spgw_ingress.gtpu_decap", - "id" : 16, + "id" : 17, "runtime_data" : [], "primitives" : [ { @@ -1420,7 +1445,7 @@ }, { "name" : "FabricIngress.spgw_ingress.set_dl_sess_info", - "id" : 17, + "id" : 18, "runtime_data" : [ { "name" : "teid", @@ -1497,13 +1522,13 @@ }, { "name" : "FabricIngress.spgw_ingress.update_ue_cdr", - "id" : 18, + "id" : 19, "runtime_data" : [], "primitives" : [] }, { "name" : "FabricIngress.filtering.drop", - "id" : 19, + "id" : 20, "runtime_data" : [], "primitives" : [ { @@ -1520,7 +1545,7 @@ }, { "name" : "FabricIngress.filtering.set_vlan", - "id" : 20, + "id" : 21, "runtime_data" : [ { "name" : "new_vlan_id", @@ -1551,7 +1576,7 @@ }, { "name" : "FabricIngress.filtering.push_internal_vlan", - "id" : 21, + "id" : 22, "runtime_data" : [ { "name" : "new_vlan_id", @@ -1674,7 +1699,7 @@ "parameters" : [ { "type" : "field", - "value" : ["scalars", "fabric_metadata_t.pop_vlan_at_egress"] + "value" : ["scalars", "fabric_metadata_t.pop_vlan_when_packet_in"] }, { "type" : "expression", @@ -1695,14 +1720,14 @@ "filename" : "./include/control/filtering.p4", "line" : 49, "column" : 8, - "source_fragment" : "fabric_metadata.pop_vlan_at_egress = true" + "source_fragment" : "fabric_metadata.pop_vlan_when_packet_in = true" } } ] }, { "name" : "FabricIngress.filtering.set_forwarding_type", - "id" : 22, + "id" : 23, "runtime_data" : [ { "name" : "fwd_type", @@ -1733,7 +1758,7 @@ }, { "name" : "FabricIngress.forwarding.drop", - "id" : 23, + "id" : 24, "runtime_data" : [], "primitives" : [ { @@ -1748,37 +1773,6 @@ } ] }, - { - "name" : "FabricIngress.forwarding.set_next_id", - "id" : 24, - "runtime_data" : [ - { - "name" : "next_id", - "bitwidth" : 32 - } - ], - "primitives" : [ - { - "op" : "assign", - "parameters" : [ - { - "type" : "field", - "value" : ["scalars", "fabric_metadata_t.next_id"] - }, - { - "type" : "runtime_data", - "value" : 0 - } - ], - "source_info" : { - "filename" : "./include/control/forwarding.p4", - "line" : 40, - "column" : 8, - "source_fragment" : "fabric_metadata.next_id = next_id" - } - } - ] - }, { "name" : "FabricIngress.forwarding.set_next_id", "id" : 25, @@ -1935,7 +1929,7 @@ ] }, { - "name" : "FabricIngress.forwarding.pop_mpls_and_next", + "name" : "FabricIngress.forwarding.set_next_id", "id" : 30, "runtime_data" : [ { @@ -1943,6 +1937,37 @@ "bitwidth" : 32 } ], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["scalars", "fabric_metadata_t.next_id"] + }, + { + "type" : "runtime_data", + "value" : 0 + } + ], + "source_info" : { + "filename" : "./include/control/forwarding.p4", + "line" : 40, + "column" : 8, + "source_fragment" : "fabric_metadata.next_id = next_id" + } + } + ] + }, + { + "name" : "FabricIngress.forwarding.pop_mpls_and_next", + "id" : 31, + "runtime_data" : [ + { + "name" : "next_id", + "bitwidth" : 32 + } + ], "primitives" : [ { "op" : "remove_header", @@ -1982,7 +2007,7 @@ }, { "name" : "FabricIngress.forwarding.duplicate_to_controller", - "id" : 31, + "id" : 32, "runtime_data" : [], "primitives" : [ { @@ -2008,7 +2033,7 @@ }, { "name" : "FabricIngress.next.output", - "id" : 32, + "id" : 33, "runtime_data" : [ { "name" : "port_num", @@ -2030,16 +2055,47 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num" } } ] }, + { + "name" : "FabricIngress.next.set_vlan", + "id" : 34, + "runtime_data" : [ + { + "name" : "new_vlan_id", + "bitwidth" : 12 + } + ], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["vlan_tag", "vlan_id"] + }, + { + "type" : "runtime_data", + "value" : 0 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 37, + "column" : 8, + "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id" + } + } + ] + }, { "name" : "FabricIngress.next.set_vlan_output", - "id" : 33, + "id" : 35, "runtime_data" : [ { "name" : "new_vlan_id", @@ -2065,40 +2121,11 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 36, + "line" : 46, "column" : 8, "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id" } }, - { - "op" : "assign", - "parameters" : [ - { - "type" : "field", - "value" : ["scalars", "fabric_metadata_t.pop_vlan_at_egress"] - }, - { - "type" : "expression", - "value" : { - "type" : "expression", - "value" : { - "op" : "b2d", - "left" : null, - "right" : { - "type" : "bool", - "value" : false - } - } - } - } - ], - "source_info" : { - "filename" : "./include/control/next.p4", - "line" : 39, - "column" : 8, - "source_fragment" : "fabric_metadata.pop_vlan_at_egress = false" - } - }, { "op" : "assign", "parameters" : [ @@ -2113,7 +2140,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -2122,7 +2149,7 @@ }, { "name" : "FabricIngress.next.l3_routing", - "id" : 34, + "id" : 36, "runtime_data" : [ { "name" : "port_num", @@ -2152,7 +2179,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2171,7 +2198,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -2190,7 +2217,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -2199,7 +2226,7 @@ }, { "name" : "FabricIngress.next.l3_routing", - "id" : 35, + "id" : 37, "runtime_data" : [ { "name" : "port_num", @@ -2229,7 +2256,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2248,7 +2275,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -2267,7 +2294,107 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, + "column" : 8, + "source_fragment" : "standard_metadata.egress_spec = port_num; ..." + } + } + ] + }, + { + "name" : "FabricIngress.next.l3_routing_vlan", + "id" : 38, + "runtime_data" : [ + { + "name" : "port_num", + "bitwidth" : 9 + }, + { + "name" : "smac", + "bitwidth" : 48 + }, + { + "name" : "dmac", + "bitwidth" : 48 + }, + { + "name" : "new_vlan_id", + "bitwidth" : 12 + } + ], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["ethernet", "src_addr"] + }, + { + "type" : "runtime_data", + "value" : 1 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 51, + "column" : 8, + "source_fragment" : "hdr.ethernet.src_addr = smac; ..." + } + }, + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["ethernet", "dst_addr"] + }, + { + "type" : "runtime_data", + "value" : 2 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 55, + "column" : 8, + "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." + } + }, + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["vlan_tag", "vlan_id"] + }, + { + "type" : "runtime_data", + "value" : 3 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 46, + "column" : 8, + "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id; ..." + } + }, + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["standard_metadata", "egress_spec"] + }, + { + "type" : "runtime_data", + "value" : 0 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -2276,7 +2403,7 @@ }, { "name" : "FabricIngress.next.mpls_routing_v4", - "id" : 36, + "id" : 39, "runtime_data" : [ { "name" : "port_num", @@ -2310,7 +2437,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2329,7 +2456,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -2348,7 +2475,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -2363,7 +2490,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 59, + "line" : 72, "column" : 8, "source_fragment" : "hdr.mpls.setValid()" } @@ -2401,7 +2528,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 61, + "line" : 74, "column" : 8, "source_fragment" : "hdr.mpls.label = label; ..." } @@ -2420,7 +2547,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 62, + "line" : 75, "column" : 8, "source_fragment" : "hdr.mpls.tc = tc; ..." } @@ -2439,7 +2566,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 63, + "line" : 76, "column" : 8, "source_fragment" : "hdr.mpls.bos = 1w1" } @@ -2467,7 +2594,7 @@ }, { "name" : "FabricIngress.next.mpls_routing_v4", - "id" : 37, + "id" : 40, "runtime_data" : [ { "name" : "port_num", @@ -2501,7 +2628,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2520,7 +2647,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -2539,7 +2666,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -2554,7 +2681,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 59, + "line" : 72, "column" : 8, "source_fragment" : "hdr.mpls.setValid()" } @@ -2592,7 +2719,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 61, + "line" : 74, "column" : 8, "source_fragment" : "hdr.mpls.label = label; ..." } @@ -2611,7 +2738,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 62, + "line" : 75, "column" : 8, "source_fragment" : "hdr.mpls.tc = tc; ..." } @@ -2630,7 +2757,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 63, + "line" : 76, "column" : 8, "source_fragment" : "hdr.mpls.bos = 1w1" } @@ -2658,7 +2785,7 @@ }, { "name" : "FabricIngress.next.mpls_routing_v6", - "id" : 38, + "id" : 41, "runtime_data" : [ { "name" : "port_num", @@ -2692,7 +2819,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2711,7 +2838,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -2730,7 +2857,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -2745,7 +2872,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 59, + "line" : 72, "column" : 8, "source_fragment" : "hdr.mpls.setValid()" } @@ -2783,7 +2910,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 61, + "line" : 74, "column" : 8, "source_fragment" : "hdr.mpls.label = label; ..." } @@ -2802,7 +2929,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 62, + "line" : 75, "column" : 8, "source_fragment" : "hdr.mpls.tc = tc; ..." } @@ -2821,7 +2948,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 63, + "line" : 76, "column" : 8, "source_fragment" : "hdr.mpls.bos = 1w1" } @@ -2849,7 +2976,7 @@ }, { "name" : "FabricIngress.next.set_mcast_group", - "id" : 39, + "id" : 42, "runtime_data" : [ { "name" : "gid", @@ -2875,7 +3002,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 122, + "line" : 149, "column" : 8, "source_fragment" : "standard_metadata.mcast_grp = gid" } @@ -2894,7 +3021,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2903,7 +3030,7 @@ }, { "name" : "act", - "id" : 40, + "id" : 43, "runtime_data" : [], "primitives" : [ { @@ -2944,7 +3071,7 @@ }, { "name" : "act_0", - "id" : 41, + "id" : 44, "runtime_data" : [], "primitives" : [ { @@ -2974,7 +3101,7 @@ }, { "name" : "act_1", - "id" : 42, + "id" : 45, "runtime_data" : [], "primitives" : [ { @@ -3004,7 +3131,7 @@ }, { "name" : "act_2", - "id" : 43, + "id" : 46, "runtime_data" : [], "primitives" : [ { @@ -3087,7 +3214,7 @@ }, { "name" : "act_3", - "id" : 44, + "id" : 47, "runtime_data" : [], "primitives" : [ { @@ -3142,7 +3269,7 @@ }, { "name" : "act_4", - "id" : 45, + "id" : 48, "runtime_data" : [], "primitives" : [ { @@ -3172,7 +3299,7 @@ }, { "name" : "act_5", - "id" : 46, + "id" : 49, "runtime_data" : [], "primitives" : [ { @@ -3202,7 +3329,7 @@ }, { "name" : "act_6", - "id" : 47, + "id" : 50, "runtime_data" : [], "primitives" : [ { @@ -3257,7 +3384,7 @@ }, { "name" : "act_7", - "id" : 48, + "id" : 51, "runtime_data" : [], "primitives" : [ { @@ -3316,7 +3443,7 @@ }, { "name" : "act_8", - "id" : 49, + "id" : 52, "runtime_data" : [], "primitives" : [ { @@ -3352,7 +3479,7 @@ }, { "name" : "act_9", - "id" : 50, + "id" : 53, "runtime_data" : [], "primitives" : [ { @@ -3382,7 +3509,7 @@ }, { "name" : "act_10", - "id" : 51, + "id" : 54, "runtime_data" : [], "primitives" : [ { @@ -3412,7 +3539,7 @@ }, { "name" : "act_11", - "id" : 52, + "id" : 55, "runtime_data" : [], "primitives" : [ { @@ -3438,7 +3565,7 @@ }, { "name" : "act_12", - "id" : 53, + "id" : 56, "runtime_data" : [], "primitives" : [ { @@ -3483,7 +3610,7 @@ }, { "name" : "act_13", - "id" : 54, + "id" : 57, "runtime_data" : [], "primitives" : [ { @@ -3513,7 +3640,7 @@ }, { "name" : "act_14", - "id" : 55, + "id" : 58, "runtime_data" : [], "primitives" : [ { @@ -3543,7 +3670,7 @@ }, { "name" : "act_15", - "id" : 56, + "id" : 59, "runtime_data" : [], "primitives" : [ { @@ -3583,7 +3710,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 143, + "line" : 171, "column" : 20, "source_fragment" : "hdr.ipv4.ttl = hdr.ipv4.ttl - 1" } @@ -3592,7 +3719,7 @@ }, { "name" : "act_16", - "id" : 57, + "id" : 60, "runtime_data" : [], "primitives" : [ { @@ -3632,7 +3759,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 147, + "line" : 175, "column" : 20, "source_fragment" : "hdr.ipv6.hop_limit = hdr.ipv6.hop_limit - 1" } @@ -3641,7 +3768,7 @@ }, { "name" : "act_17", - "id" : 58, + "id" : 61, "runtime_data" : [], "primitives" : [ { @@ -3693,7 +3820,7 @@ }, { "name" : "act_18", - "id" : 59, + "id" : 62, "runtime_data" : [], "primitives" : [ { @@ -3744,49 +3871,14 @@ ] }, { - "name" : "act_19", - "id" : 60, + "name" : "nop", + "id" : 63, "runtime_data" : [], - "primitives" : [ - { - "op" : "assign", - "parameters" : [ - { - "type" : "field", - "value" : ["ethernet", "ether_type"] - }, - { - "type" : "field", - "value" : ["vlan_tag", "ether_type"] - } - ], - "source_info" : { - "filename" : "./include/control/next.p4", - "line" : 167, - "column" : 12, - "source_fragment" : "hdr.ethernet.ether_type = hdr.vlan_tag.ether_type" - } - }, - { - "op" : "remove_header", - "parameters" : [ - { - "type" : "header", - "value" : "vlan_tag" - } - ], - "source_info" : { - "filename" : "./include/control/next.p4", - "line" : 168, - "column" : 12, - "source_fragment" : "hdr.vlan_tag.setInvalid()" - } - } - ] + "primitives" : [] }, { "name" : "FabricEgress.spgw_egress.gtpu_encap", - "id" : 61, + "id" : 64, "runtime_data" : [], "primitives" : [ { @@ -4358,8 +4450,90 @@ ] }, { - "name" : "act_20", - "id" : 62, + "name" : "FabricEgress.pkt_io_egress.pop_vlan", + "id" : 65, + "runtime_data" : [], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["ethernet", "ether_type"] + }, + { + "type" : "field", + "value" : ["vlan_tag", "ether_type"] + } + ], + "source_info" : { + "filename" : "./include/control/packetio.p4", + "line" : 38, + "column" : 8, + "source_fragment" : "hdr.ethernet.ether_type = hdr.vlan_tag.ether_type" + } + }, + { + "op" : "remove_header", + "parameters" : [ + { + "type" : "header", + "value" : "vlan_tag" + } + ], + "source_info" : { + "filename" : "./include/control/packetio.p4", + "line" : 39, + "column" : 8, + "source_fragment" : "hdr.vlan_tag.setInvalid()" + } + } + ] + }, + { + "name" : "FabricEgress.egress_next.pop_vlan", + "id" : 66, + "runtime_data" : [], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["ethernet", "ether_type"] + }, + { + "type" : "field", + "value" : ["vlan_tag", "ether_type"] + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 193, + "column" : 8, + "source_fragment" : "hdr.ethernet.ether_type = hdr.vlan_tag.ether_type" + } + }, + { + "op" : "remove_header", + "parameters" : [ + { + "type" : "header", + "value" : "vlan_tag" + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 194, + "column" : 8, + "source_fragment" : "hdr.vlan_tag.setInvalid()" + } + } + ] + }, + { + "name" : "act_19", + "id" : 67, "runtime_data" : [], "primitives" : [ { @@ -4372,7 +4546,7 @@ ], "source_info" : { "filename" : "./include/control/packetio.p4", - "line" : 39, + "line" : 46, "column" : 12, "source_fragment" : "hdr.packet_in.setValid()" } @@ -4391,7 +4565,7 @@ ], "source_info" : { "filename" : "./include/control/packetio.p4", - "line" : 40, + "line" : 47, "column" : 12, "source_fragment" : "hdr.packet_in.ingress_port = standard_metadata.ingress_port" } @@ -4399,8 +4573,8 @@ ] }, { - "name" : "act_21", - "id" : 63, + "name" : "act_20", + "id" : 68, "runtime_data" : [], "primitives" : [ { @@ -4413,7 +4587,7 @@ ], "source_info" : { "filename" : "fabric.p4", - "line" : 69, + "line" : 71, "column" : 36, "source_fragment" : "hdr.gtpu_ipv4" } @@ -4428,7 +4602,7 @@ ], "source_info" : { "filename" : "fabric.p4", - "line" : 69, + "line" : 71, "column" : 51, "source_fragment" : "hdr.gtpu_udp" } @@ -4443,7 +4617,7 @@ ], "source_info" : { "filename" : "fabric.p4", - "line" : 69, + "line" : 71, "column" : 65, "source_fragment" : "hdr.gtpu" } @@ -4473,14 +4647,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [40], + "action_ids" : [43], "actions" : ["act"], "base_default_next" : null, "next_tables" : { "act" : null }, "default_entry" : { - "action_id" : 40, + "action_id" : 43, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4496,14 +4670,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [48], + "action_ids" : [51], "actions" : ["act_7"], "base_default_next" : "node_5", "next_tables" : { "act_7" : "node_5" }, "default_entry" : { - "action_id" : 48, + "action_id" : 51, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4519,14 +4693,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [43], + "action_ids" : [46], "actions" : ["act_2"], "base_default_next" : "FabricIngress.spgw_ingress.s1u_filter_table", "next_tables" : { "act_2" : "FabricIngress.spgw_ingress.s1u_filter_table" }, "default_entry" : { - "action_id" : 43, + "action_id" : 46, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4579,14 +4753,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [41], + "action_ids" : [44], "actions" : ["act_0"], "base_default_next" : "node_10", "next_tables" : { "act_0" : "node_10" }, "default_entry" : { - "action_id" : 41, + "action_id" : 44, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4602,14 +4776,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [42], + "action_ids" : [45], "actions" : ["act_1"], "base_default_next" : "node_10", "next_tables" : { "act_1" : "node_10" }, "default_entry" : { - "action_id" : 42, + "action_id" : 45, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4625,14 +4799,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [44], + "action_ids" : [47], "actions" : ["act_3"], "base_default_next" : "node_17", "next_tables" : { "act_3" : "node_17" }, "default_entry" : { - "action_id" : 44, + "action_id" : 47, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4685,14 +4859,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [45], + "action_ids" : [48], "actions" : ["act_4"], "base_default_next" : "node_15", "next_tables" : { "act_4" : "node_15" }, "default_entry" : { - "action_id" : 45, + "action_id" : 48, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4708,14 +4882,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [46], + "action_ids" : [49], "actions" : ["act_5"], "base_default_next" : "node_15", "next_tables" : { "act_5" : "node_15" }, "default_entry" : { - "action_id" : 46, + "action_id" : 49, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4731,14 +4905,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [47], + "action_ids" : [50], "actions" : ["act_6"], "base_default_next" : "node_17", "next_tables" : { "act_6" : "node_17" }, "default_entry" : { - "action_id" : 47, + "action_id" : 50, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4754,14 +4928,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [49], + "action_ids" : [52], "actions" : ["act_8"], "base_default_next" : "node_19", "next_tables" : { "act_8" : "node_19" }, "default_entry" : { - "action_id" : 49, + "action_id" : 52, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4777,14 +4951,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [16], + "action_ids" : [17], "actions" : ["FabricIngress.spgw_ingress.gtpu_decap"], "base_default_next" : "node_22", "next_tables" : { "FabricIngress.spgw_ingress.gtpu_decap" : "node_22" }, "default_entry" : { - "action_id" : 16, + "action_id" : 17, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4813,7 +4987,7 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [17, 2], + "action_ids" : [18, 2], "actions" : ["FabricIngress.spgw_ingress.set_dl_sess_info", "NoAction"], "base_default_next" : null, "next_tables" : { @@ -4837,14 +5011,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [50], + "action_ids" : [53], "actions" : ["act_9"], "base_default_next" : "node_26", "next_tables" : { "act_9" : "node_26" }, "default_entry" : { - "action_id" : 50, + "action_id" : 53, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4860,14 +5034,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [51], + "action_ids" : [54], "actions" : ["act_10"], "base_default_next" : "node_26", "next_tables" : { "act_10" : "node_26" }, "default_entry" : { - "action_id" : 51, + "action_id" : 54, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4883,14 +5057,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [15], + "action_ids" : [16], "actions" : ["FabricIngress.spgw_ingress.drop_now"], "base_default_next" : "FabricIngress.spgw_ingress.ue_cdr_table", "next_tables" : { "FabricIngress.spgw_ingress.drop_now" : "FabricIngress.spgw_ingress.ue_cdr_table" }, "default_entry" : { - "action_id" : 15, + "action_id" : 16, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4919,7 +5093,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [18, 3], + "action_ids" : [19, 3], "actions" : ["FabricIngress.spgw_ingress.update_ue_cdr", "NoAction"], "base_default_next" : "tbl_act_11", "next_tables" : { @@ -4943,14 +5117,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [52], + "action_ids" : [55], "actions" : ["act_11"], "base_default_next" : "FabricIngress.filtering.ingress_port_vlan", "next_tables" : { "act_11" : "FabricIngress.filtering.ingress_port_vlan" }, "default_entry" : { - "action_id" : 52, + "action_id" : 55, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4991,7 +5165,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [21, 20, 13, 19], + "action_ids" : [22, 21, 13, 20], "actions" : ["FabricIngress.filtering.push_internal_vlan", "FabricIngress.filtering.set_vlan", "nop", "FabricIngress.filtering.drop"], "base_default_next" : "FabricIngress.filtering.fwd_classifier", "next_tables" : { @@ -5042,14 +5216,14 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [22], + "action_ids" : [23], "actions" : ["FabricIngress.filtering.set_forwarding_type"], "base_default_next" : "node_32", "next_tables" : { "FabricIngress.filtering.set_forwarding_type" : "node_32" }, "default_entry" : { - "action_id" : 22, + "action_id" : 23, "action_const" : true, "action_data" : ["0x0"], "action_entry_const" : true @@ -5084,7 +5258,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [24, 4], + "action_ids" : [25, 4], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -5121,7 +5295,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [30, 5], + "action_ids" : [31, 5], "actions" : ["FabricIngress.forwarding.pop_mpls_and_next", "NoAction"], "base_default_next" : "tbl_act_12", "next_tables" : { @@ -5145,14 +5319,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [53], + "action_ids" : [56], "actions" : ["act_12"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { "act_12" : "FabricIngress.forwarding.acl" }, "default_entry" : { - "action_id" : 53, + "action_id" : 56, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -5181,7 +5355,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [25, 6], + "action_ids" : [26, 6], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -5224,7 +5398,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [26, 7], + "action_ids" : [27, 7], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -5261,7 +5435,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [27, 8], + "action_ids" : [28, 8], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -5304,7 +5478,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [28, 9], + "action_ids" : [29, 9], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -5407,14 +5581,14 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [29, 31, 23, 14], + "action_ids" : [30, 32, 24, 14], "actions" : ["FabricIngress.forwarding.set_next_id", "FabricIngress.forwarding.duplicate_to_controller", "FabricIngress.forwarding.drop", "nop"], - "base_default_next" : "FabricIngress.next.simple", + "base_default_next" : "FabricIngress.next.vlan_meta", "next_tables" : { - "FabricIngress.forwarding.set_next_id" : "FabricIngress.next.simple", - "FabricIngress.forwarding.duplicate_to_controller" : "FabricIngress.next.simple", - "FabricIngress.forwarding.drop" : "FabricIngress.next.simple", - "nop" : "FabricIngress.next.simple" + "FabricIngress.forwarding.set_next_id" : "FabricIngress.next.vlan_meta", + "FabricIngress.forwarding.duplicate_to_controller" : "FabricIngress.next.vlan_meta", + "FabricIngress.forwarding.drop" : "FabricIngress.next.vlan_meta", + "nop" : "FabricIngress.next.vlan_meta" }, "default_entry" : { "action_id" : 14, @@ -5424,11 +5598,48 @@ } }, { - "name" : "FabricIngress.next.simple", + "name" : "FabricIngress.next.vlan_meta", "id" : 29, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 83, + "line" : 96, + "column" : 10, + "source_fragment" : "vlan_meta" + }, + "key" : [ + { + "match_type" : "exact", + "name" : "fabric_metadata.next_id", + "target" : ["scalars", "fabric_metadata_t.next_id"], + "mask" : null + } + ], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : true, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [34, 15], + "actions" : ["FabricIngress.next.set_vlan", "nop"], + "base_default_next" : "FabricIngress.next.simple", + "next_tables" : { + "FabricIngress.next.set_vlan" : "FabricIngress.next.simple", + "nop" : "FabricIngress.next.simple" + }, + "default_entry" : { + "action_id" : 15, + "action_const" : false, + "action_data" : [], + "action_entry_const" : false + } + }, + { + "name" : "FabricIngress.next.simple", + "id" : 30, + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 109, "column" : 10, "source_fragment" : "simple" }, @@ -5446,8 +5657,8 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [32, 33, 34, 36, 10], - "actions" : ["FabricIngress.next.output", "FabricIngress.next.set_vlan_output", "FabricIngress.next.l3_routing", "FabricIngress.next.mpls_routing_v4", "NoAction"], + "action_ids" : [33, 35, 36, 39, 38, 10], + "actions" : ["FabricIngress.next.output", "FabricIngress.next.set_vlan_output", "FabricIngress.next.l3_routing", "FabricIngress.next.mpls_routing_v4", "FabricIngress.next.l3_routing_vlan", "NoAction"], "base_default_next" : null, "next_tables" : { "__HIT__" : "tbl_act_13", @@ -5462,29 +5673,6 @@ }, { "name" : "tbl_act_13", - "id" : 30, - "key" : [], - "match_type" : "exact", - "type" : "simple", - "max_size" : 1024, - "with_counters" : false, - "support_timeout" : false, - "direct_meters" : null, - "action_ids" : [54], - "actions" : ["act_13"], - "base_default_next" : "node_49", - "next_tables" : { - "act_13" : "node_49" - }, - "default_entry" : { - "action_id" : 54, - "action_const" : true, - "action_data" : [], - "action_entry_const" : true - } - }, - { - "name" : "tbl_act_14", "id" : 31, "key" : [], "match_type" : "exact", @@ -5493,57 +5681,11 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [55], - "actions" : ["act_14"], - "base_default_next" : "node_49", - "next_tables" : { - "act_14" : "node_49" - }, - "default_entry" : { - "action_id" : 55, - "action_const" : true, - "action_data" : [], - "action_entry_const" : true - } - }, - { - "name" : "tbl_act_15", - "id" : 32, - "key" : [], - "match_type" : "exact", - "type" : "simple", - "max_size" : 1024, - "with_counters" : false, - "support_timeout" : false, - "direct_meters" : null, - "action_ids" : [56], - "actions" : ["act_15"], - "base_default_next" : "FabricIngress.next.hashed", - "next_tables" : { - "act_15" : "FabricIngress.next.hashed" - }, - "default_entry" : { - "action_id" : 56, - "action_const" : true, - "action_data" : [], - "action_entry_const" : true - } - }, - { - "name" : "tbl_act_16", - "id" : 33, - "key" : [], - "match_type" : "exact", - "type" : "simple", - "max_size" : 1024, - "with_counters" : false, - "support_timeout" : false, - "direct_meters" : null, "action_ids" : [57], - "actions" : ["act_16"], - "base_default_next" : "FabricIngress.next.hashed", + "actions" : ["act_13"], + "base_default_next" : "node_50", "next_tables" : { - "act_16" : "FabricIngress.next.hashed" + "act_13" : "node_50" }, "default_entry" : { "action_id" : 57, @@ -5553,11 +5695,80 @@ } }, { - "name" : "FabricIngress.next.hashed", + "name" : "tbl_act_14", + "id" : 32, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [58], + "actions" : ["act_14"], + "base_default_next" : "node_50", + "next_tables" : { + "act_14" : "node_50" + }, + "default_entry" : { + "action_id" : 58, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "tbl_act_15", + "id" : 33, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [59], + "actions" : ["act_15"], + "base_default_next" : "FabricIngress.next.hashed", + "next_tables" : { + "act_15" : "FabricIngress.next.hashed" + }, + "default_entry" : { + "action_id" : 59, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "tbl_act_16", "id" : 34, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [60], + "actions" : ["act_16"], + "base_default_next" : "FabricIngress.next.hashed", + "next_tables" : { + "act_16" : "FabricIngress.next.hashed" + }, + "default_entry" : { + "action_id" : 60, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "FabricIngress.next.hashed", + "id" : 35, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 97, + "line" : 124, "column" : 10, "source_fragment" : "hashed" }, @@ -5576,7 +5787,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [35, 37, 38, 11], + "action_ids" : [37, 40, 41, 11], "actions" : ["FabricIngress.next.l3_routing", "FabricIngress.next.mpls_routing_v4", "FabricIngress.next.mpls_routing_v6", "NoAction"], "base_default_next" : "FabricIngress.next.multicast", "next_tables" : { @@ -5588,10 +5799,10 @@ }, { "name" : "FabricIngress.next.multicast", - "id" : 35, + "id" : 36, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 128, + "line" : 155, "column" : 10, "source_fragment" : "multicast" }, @@ -5609,12 +5820,12 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [39, 12], + "action_ids" : [42, 12], "actions" : ["FabricIngress.next.set_mcast_group", "NoAction"], - "base_default_next" : "node_57", + "base_default_next" : "node_58", "next_tables" : { - "FabricIngress.next.set_mcast_group" : "node_57", - "NoAction" : "node_57" + "FabricIngress.next.set_mcast_group" : "node_58", + "NoAction" : "node_58" }, "default_entry" : { "action_id" : 12, @@ -5625,29 +5836,6 @@ }, { "name" : "tbl_act_17", - "id" : 36, - "key" : [], - "match_type" : "exact", - "type" : "simple", - "max_size" : 1024, - "with_counters" : false, - "support_timeout" : false, - "direct_meters" : null, - "action_ids" : [58], - "actions" : ["act_17"], - "base_default_next" : "node_59", - "next_tables" : { - "act_17" : "node_59" - }, - "default_entry" : { - "action_id" : 58, - "action_const" : true, - "action_data" : [], - "action_entry_const" : true - } - }, - { - "name" : "tbl_act_18", "id" : 37, "key" : [], "match_type" : "exact", @@ -5656,21 +5844,21 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [59], - "actions" : ["act_18"], - "base_default_next" : "node_61", + "action_ids" : [61], + "actions" : ["act_17"], + "base_default_next" : "node_60", "next_tables" : { - "act_18" : "node_61" + "act_17" : "node_60" }, "default_entry" : { - "action_id" : 59, + "action_id" : 61, "action_const" : true, "action_data" : [], "action_entry_const" : true } }, { - "name" : "tbl_act_19", + "name" : "tbl_act_18", "id" : 38, "key" : [], "match_type" : "exact", @@ -5679,14 +5867,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [60], - "actions" : ["act_19"], + "action_ids" : [62], + "actions" : ["act_18"], "base_default_next" : null, "next_tables" : { - "act_19" : null + "act_18" : null }, "default_entry" : { - "action_id" : 60, + "action_id" : 62, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -6099,7 +6287,7 @@ "false_next" : "FabricIngress.forwarding.acl" }, { - "name" : "node_49", + "name" : "node_50", "id" : 15, "expression" : { "type" : "expression", @@ -6112,15 +6300,15 @@ } } }, - "true_next" : "node_50", + "true_next" : "node_51", "false_next" : "FabricIngress.next.hashed" }, { - "name" : "node_50", + "name" : "node_51", "id" : 16, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 141, + "line" : 169, "column" : 16, "source_fragment" : "!hdr.mpls.isValid()" }, @@ -6142,15 +6330,15 @@ } } }, - "true_next" : "node_51", + "true_next" : "node_52", "false_next" : "FabricIngress.next.hashed" }, { - "name" : "node_51", + "name" : "node_52", "id" : 17, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 142, + "line" : 170, "column" : 19, "source_fragment" : "hdr.ipv4.isValid()" }, @@ -6166,14 +6354,14 @@ } }, "true_next" : "tbl_act_15", - "false_next" : "node_53" + "false_next" : "node_54" }, { - "name" : "node_53", + "name" : "node_54", "id" : 18, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 146, + "line" : 174, "column" : 25, "source_fragment" : "hdr.ipv6.isValid()" }, @@ -6192,7 +6380,7 @@ "false_next" : "FabricIngress.next.hashed" }, { - "name" : "node_57", + "name" : "node_58", "id" : 19, "source_info" : { "filename" : "./include/control/port_counter.p4", @@ -6215,10 +6403,10 @@ } }, "true_next" : "tbl_act_17", - "false_next" : "node_59" + "false_next" : "node_60" }, { - "name" : "node_59", + "name" : "node_60", "id" : 20, "source_info" : { "filename" : "./include/control/port_counter.p4", @@ -6240,31 +6428,8 @@ } } }, - "true_next" : "tbl_act_18", - "false_next" : "node_61" - }, - { - "name" : "node_61", - "id" : 21, - "source_info" : { - "filename" : "./include/control/next.p4", - "line" : 166, - "column" : 12, - "source_fragment" : "fabric_metadata.pop_vlan_at_egress" - }, - "expression" : { - "type" : "expression", - "value" : { - "op" : "d2b", - "left" : null, - "right" : { - "type" : "field", - "value" : ["scalars", "fabric_metadata_t.pop_vlan_at_egress"] - } - } - }, "false_next" : null, - "true_next" : "tbl_act_19" + "true_next" : "tbl_act_18" } ] }, @@ -6273,37 +6438,57 @@ "id" : 1, "source_info" : { "filename" : "fabric.p4", - "line" : 62, + "line" : 61, "column" : 8, "source_fragment" : "FabricEgress" }, - "init_table" : "node_65", + "init_table" : "FabricEgress.egress_next.egress_vlan", "tables" : [ { - "name" : "tbl_act_20", + "name" : "FabricEgress.egress_next.egress_vlan", "id" : 39, - "key" : [], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 197, + "column" : 10, + "source_fragment" : "egress_vlan" + }, + "key" : [ + { + "match_type" : "exact", + "name" : "hdr.vlan_tag.vlan_id", + "target" : ["vlan_tag", "vlan_id"], + "mask" : null + }, + { + "match_type" : "exact", + "name" : "standard_metadata.egress_port", + "target" : ["standard_metadata", "egress_port"], + "mask" : null + } + ], "match_type" : "exact", "type" : "simple", "max_size" : 1024, "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [62], - "actions" : ["act_20"], - "base_default_next" : "tbl_act_21", + "action_ids" : [66, 63], + "actions" : ["FabricEgress.egress_next.pop_vlan", "nop"], + "base_default_next" : "node_65", "next_tables" : { - "act_20" : "tbl_act_21" + "FabricEgress.egress_next.pop_vlan" : "node_65", + "nop" : "node_65" }, "default_entry" : { - "action_id" : 62, - "action_const" : true, + "action_id" : 63, + "action_const" : false, "action_data" : [], - "action_entry_const" : true + "action_entry_const" : false } }, { - "name" : "tbl_act_21", + "name" : "tbl_pkt_io_egress_pop_vlan", "id" : 40, "key" : [], "match_type" : "exact", @@ -6312,21 +6497,21 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [63], - "actions" : ["act_21"], - "base_default_next" : "node_68", + "action_ids" : [65], + "actions" : ["FabricEgress.pkt_io_egress.pop_vlan"], + "base_default_next" : "tbl_act_19", "next_tables" : { - "act_21" : "node_68" + "FabricEgress.pkt_io_egress.pop_vlan" : "tbl_act_19" }, "default_entry" : { - "action_id" : 63, + "action_id" : 65, "action_const" : true, "action_data" : [], "action_entry_const" : true } }, { - "name" : "tbl_spgw_egress_gtpu_encap", + "name" : "tbl_act_19", "id" : 41, "key" : [], "match_type" : "exact", @@ -6335,14 +6520,60 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [61], + "action_ids" : [67], + "actions" : ["act_19"], + "base_default_next" : "tbl_act_20", + "next_tables" : { + "act_19" : "tbl_act_20" + }, + "default_entry" : { + "action_id" : 67, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "tbl_act_20", + "id" : 42, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [68], + "actions" : ["act_20"], + "base_default_next" : "node_70", + "next_tables" : { + "act_20" : "node_70" + }, + "default_entry" : { + "action_id" : 68, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "tbl_spgw_egress_gtpu_encap", + "id" : 43, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [64], "actions" : ["FabricEgress.spgw_egress.gtpu_encap"], "base_default_next" : null, "next_tables" : { "FabricEgress.spgw_egress.gtpu_encap" : null }, "default_entry" : { - "action_id" : 61, + "action_id" : 64, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -6353,10 +6584,10 @@ "conditionals" : [ { "name" : "node_65", - "id" : 22, + "id" : 21, "source_info" : { "filename" : "./include/control/packetio.p4", - "line" : 38, + "line" : 42, "column" : 12, "source_fragment" : "standard_metadata.egress_port == 255" }, @@ -6374,11 +6605,51 @@ } } }, - "true_next" : "tbl_act_20", - "false_next" : "tbl_act_21" + "true_next" : "node_66", + "false_next" : "tbl_act_20" }, { - "name" : "node_68", + "name" : "node_66", + "id" : 22, + "source_info" : { + "filename" : "./include/control/packetio.p4", + "line" : 43, + "column" : 16, + "source_fragment" : "hdr.vlan_tag.isValid() && fabric_metadata.pop_vlan_when_packet_in" + }, + "expression" : { + "type" : "expression", + "value" : { + "op" : "and", + "left" : { + "type" : "expression", + "value" : { + "op" : "d2b", + "left" : null, + "right" : { + "type" : "field", + "value" : ["vlan_tag", "$valid$"] + } + } + }, + "right" : { + "type" : "expression", + "value" : { + "op" : "d2b", + "left" : null, + "right" : { + "type" : "field", + "value" : ["scalars", "fabric_metadata_t.pop_vlan_when_packet_in"] + } + } + } + } + }, + "true_next" : "tbl_pkt_io_egress_pop_vlan", + "false_next" : "tbl_act_19" + }, + { + "name" : "node_70", "id" : 23, "source_info" : { "filename" : "./include/control/../spgw.p4", diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.p4info b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.p4info index bc8c786baa..38c5346402 100644 --- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.p4info +++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.p4info @@ -390,6 +390,27 @@ tables { direct_resource_ids: 301995056 size: 256 } +tables { + preamble { + id: 33562709 + name: "FabricIngress.next.vlan_meta" + alias: "vlan_meta" + } + match_fields { + id: 1 + name: "fabric_metadata.next_id" + bitwidth: 32 + match_type: EXACT + } + action_refs { + id: 16790685 + } + action_refs { + id: 16819938 + } + direct_resource_ids: 302008112 + size: 1024 +} tables { preamble { id: 33571723 @@ -414,6 +435,9 @@ tables { action_refs { id: 16780811 } + action_refs { + id: 16791579 + } action_refs { id: 16800567 annotations: "@defaultonly()" @@ -472,6 +496,32 @@ tables { direct_resource_ids: 302024536 size: 1024 } +tables { + preamble { + id: 33599342 + name: "FabricEgress.egress_next.egress_vlan" + alias: "egress_vlan" + } + match_fields { + id: 1 + name: "hdr.vlan_tag.vlan_id" + bitwidth: 12 + match_type: EXACT + } + match_fields { + id: 2 + name: "standard_metadata.egress_port" + bitwidth: 9 + match_type: EXACT + } + action_refs { + id: 16790030 + } + action_refs { + id: 16819938 + } + size: 1024 +} actions { preamble { id: 16800567 @@ -540,7 +590,7 @@ actions { preamble { id: 16793253 name: "FabricIngress.filtering.set_vlan" - alias: "set_vlan" + alias: "filtering.set_vlan" } params { id: 1 @@ -622,6 +672,18 @@ actions { bitwidth: 9 } } +actions { + preamble { + id: 16790685 + name: "FabricIngress.next.set_vlan" + alias: "next.set_vlan" + } + params { + id: 1 + name: "new_vlan_id" + bitwidth: 12 + } +} actions { preamble { id: 16808391 @@ -661,6 +723,33 @@ actions { bitwidth: 48 } } +actions { + preamble { + id: 16791579 + name: "FabricIngress.next.l3_routing_vlan" + alias: "l3_routing_vlan" + } + params { + id: 1 + name: "port_num" + bitwidth: 9 + } + params { + id: 2 + name: "smac" + bitwidth: 48 + } + params { + id: 3 + name: "dmac" + bitwidth: 48 + } + params { + id: 4 + name: "new_vlan_id" + bitwidth: 12 + } +} actions { preamble { id: 16780811 @@ -739,6 +828,20 @@ actions { alias: "gtpu_encap" } } +actions { + preamble { + id: 16801047 + name: "FabricEgress.pkt_io_egress.pop_vlan" + alias: "pkt_io_egress.pop_vlan" + } +} +actions { + preamble { + id: 16790030 + name: "FabricEgress.egress_next.pop_vlan" + alias: "egress_next.pop_vlan" + } +} action_profiles { preamble { id: 285233747 @@ -881,6 +984,17 @@ direct_counters { } direct_table_id: 33574876 } +direct_counters { + preamble { + id: 302008112 + name: "FabricIngress.next.vlan_meta_counter" + alias: "vlan_meta_counter" + } + spec { + unit: BOTH + } + direct_table_id: 33562709 +} direct_counters { preamble { id: 301991880 diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json index b1de928771..ebf5743253 100644 --- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json +++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json @@ -15,7 +15,7 @@ ["next_tmp_0", 1, false], ["fabric_metadata_t.fwd_type", 3, false], ["fabric_metadata_t.next_id", 32, false], - ["fabric_metadata_t.pop_vlan_at_egress", 1, false], + ["fabric_metadata_t.pop_vlan_when_packet_in", 1, false], ["fabric_metadata_t.ip_proto", 8, false], ["fabric_metadata_t.l4_src_port", 16, false], ["fabric_metadata_t.l4_dst_port", 16, false], @@ -421,6 +421,19 @@ } ], "op" : "extract" + }, + { + "parameters" : [ + { + "type" : "field", + "value" : ["scalars", "fabric_metadata_t.original_ether_type"] + }, + { + "type" : "field", + "value" : ["vlan_tag", "ether_type"] + } + ], + "op" : "set" } ], "transitions" : [ @@ -786,7 +799,7 @@ "id" : 0, "source_info" : { "filename" : "./include/parser.p4", - "line" : 164, + "line" : 165, "column" : 8, "source_fragment" : "FabricDeparser" }, @@ -850,26 +863,32 @@ "binding" : "FabricIngress.forwarding.multicast_v6" }, { - "name" : "FabricIngress.next.simple_counter", + "name" : "FabricIngress.next.vlan_meta_counter", "id" : 9, "is_direct" : true, + "binding" : "FabricIngress.next.vlan_meta" + }, + { + "name" : "FabricIngress.next.simple_counter", + "id" : 10, + "is_direct" : true, "binding" : "FabricIngress.next.simple" }, { "name" : "FabricIngress.next.hashed_counter", - "id" : 10, + "id" : 11, "is_direct" : true, "binding" : "FabricIngress.next.hashed" }, { "name" : "FabricIngress.next.multicast_counter", - "id" : 11, + "id" : 12, "is_direct" : true, "binding" : "FabricIngress.next.multicast" }, { "name" : "FabricIngress.port_counters_control.egress_port_counter", - "id" : 12, + "id" : 13, "source_info" : { "filename" : "./include/control/port_counter.p4", "line" : 23, @@ -881,7 +900,7 @@ }, { "name" : "FabricIngress.port_counters_control.ingress_port_counter", - "id" : 13, + "id" : 14, "source_info" : { "filename" : "./include/control/port_counter.p4", "line" : 24, @@ -1024,7 +1043,7 @@ "primitives" : [] }, { - "name" : "NoAction", + "name" : "nop", "id" : 2, "runtime_data" : [], "primitives" : [] @@ -1078,9 +1097,15 @@ "primitives" : [] }, { - "name" : "FabricIngress.filtering.drop", + "name" : "NoAction", "id" : 11, "runtime_data" : [], + "primitives" : [] + }, + { + "name" : "FabricIngress.filtering.drop", + "id" : 12, + "runtime_data" : [], "primitives" : [ { "op" : "drop", @@ -1096,7 +1121,7 @@ }, { "name" : "FabricIngress.filtering.set_vlan", - "id" : 12, + "id" : 13, "runtime_data" : [ { "name" : "new_vlan_id", @@ -1127,7 +1152,7 @@ }, { "name" : "FabricIngress.filtering.push_internal_vlan", - "id" : 13, + "id" : 14, "runtime_data" : [ { "name" : "new_vlan_id", @@ -1250,7 +1275,7 @@ "parameters" : [ { "type" : "field", - "value" : ["scalars", "fabric_metadata_t.pop_vlan_at_egress"] + "value" : ["scalars", "fabric_metadata_t.pop_vlan_when_packet_in"] }, { "type" : "expression", @@ -1271,14 +1296,14 @@ "filename" : "./include/control/filtering.p4", "line" : 49, "column" : 8, - "source_fragment" : "fabric_metadata.pop_vlan_at_egress = true" + "source_fragment" : "fabric_metadata.pop_vlan_when_packet_in = true" } } ] }, { "name" : "FabricIngress.filtering.set_forwarding_type", - "id" : 14, + "id" : 15, "runtime_data" : [ { "name" : "fwd_type", @@ -1309,7 +1334,7 @@ }, { "name" : "FabricIngress.forwarding.drop", - "id" : 15, + "id" : 16, "runtime_data" : [], "primitives" : [ { @@ -1324,37 +1349,6 @@ } ] }, - { - "name" : "FabricIngress.forwarding.set_next_id", - "id" : 16, - "runtime_data" : [ - { - "name" : "next_id", - "bitwidth" : 32 - } - ], - "primitives" : [ - { - "op" : "assign", - "parameters" : [ - { - "type" : "field", - "value" : ["scalars", "fabric_metadata_t.next_id"] - }, - { - "type" : "runtime_data", - "value" : 0 - } - ], - "source_info" : { - "filename" : "./include/control/forwarding.p4", - "line" : 40, - "column" : 8, - "source_fragment" : "fabric_metadata.next_id = next_id" - } - } - ] - }, { "name" : "FabricIngress.forwarding.set_next_id", "id" : 17, @@ -1511,7 +1505,7 @@ ] }, { - "name" : "FabricIngress.forwarding.pop_mpls_and_next", + "name" : "FabricIngress.forwarding.set_next_id", "id" : 22, "runtime_data" : [ { @@ -1519,6 +1513,37 @@ "bitwidth" : 32 } ], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["scalars", "fabric_metadata_t.next_id"] + }, + { + "type" : "runtime_data", + "value" : 0 + } + ], + "source_info" : { + "filename" : "./include/control/forwarding.p4", + "line" : 40, + "column" : 8, + "source_fragment" : "fabric_metadata.next_id = next_id" + } + } + ] + }, + { + "name" : "FabricIngress.forwarding.pop_mpls_and_next", + "id" : 23, + "runtime_data" : [ + { + "name" : "next_id", + "bitwidth" : 32 + } + ], "primitives" : [ { "op" : "remove_header", @@ -1558,7 +1583,7 @@ }, { "name" : "FabricIngress.forwarding.duplicate_to_controller", - "id" : 23, + "id" : 24, "runtime_data" : [], "primitives" : [ { @@ -1584,7 +1609,7 @@ }, { "name" : "FabricIngress.next.output", - "id" : 24, + "id" : 25, "runtime_data" : [ { "name" : "port_num", @@ -1606,16 +1631,47 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num" } } ] }, + { + "name" : "FabricIngress.next.set_vlan", + "id" : 26, + "runtime_data" : [ + { + "name" : "new_vlan_id", + "bitwidth" : 12 + } + ], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["vlan_tag", "vlan_id"] + }, + { + "type" : "runtime_data", + "value" : 0 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 37, + "column" : 8, + "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id" + } + } + ] + }, { "name" : "FabricIngress.next.set_vlan_output", - "id" : 25, + "id" : 27, "runtime_data" : [ { "name" : "new_vlan_id", @@ -1641,40 +1697,11 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 36, + "line" : 46, "column" : 8, "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id" } }, - { - "op" : "assign", - "parameters" : [ - { - "type" : "field", - "value" : ["scalars", "fabric_metadata_t.pop_vlan_at_egress"] - }, - { - "type" : "expression", - "value" : { - "type" : "expression", - "value" : { - "op" : "b2d", - "left" : null, - "right" : { - "type" : "bool", - "value" : false - } - } - } - } - ], - "source_info" : { - "filename" : "./include/control/next.p4", - "line" : 39, - "column" : 8, - "source_fragment" : "fabric_metadata.pop_vlan_at_egress = false" - } - }, { "op" : "assign", "parameters" : [ @@ -1689,7 +1716,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -1698,7 +1725,7 @@ }, { "name" : "FabricIngress.next.l3_routing", - "id" : 26, + "id" : 28, "runtime_data" : [ { "name" : "port_num", @@ -1728,7 +1755,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -1747,7 +1774,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -1766,7 +1793,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -1775,7 +1802,7 @@ }, { "name" : "FabricIngress.next.l3_routing", - "id" : 27, + "id" : 29, "runtime_data" : [ { "name" : "port_num", @@ -1805,7 +1832,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -1824,7 +1851,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -1843,7 +1870,107 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, + "column" : 8, + "source_fragment" : "standard_metadata.egress_spec = port_num; ..." + } + } + ] + }, + { + "name" : "FabricIngress.next.l3_routing_vlan", + "id" : 30, + "runtime_data" : [ + { + "name" : "port_num", + "bitwidth" : 9 + }, + { + "name" : "smac", + "bitwidth" : 48 + }, + { + "name" : "dmac", + "bitwidth" : 48 + }, + { + "name" : "new_vlan_id", + "bitwidth" : 12 + } + ], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["ethernet", "src_addr"] + }, + { + "type" : "runtime_data", + "value" : 1 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 51, + "column" : 8, + "source_fragment" : "hdr.ethernet.src_addr = smac; ..." + } + }, + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["ethernet", "dst_addr"] + }, + { + "type" : "runtime_data", + "value" : 2 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 55, + "column" : 8, + "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." + } + }, + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["vlan_tag", "vlan_id"] + }, + { + "type" : "runtime_data", + "value" : 3 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 46, + "column" : 8, + "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id; ..." + } + }, + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["standard_metadata", "egress_spec"] + }, + { + "type" : "runtime_data", + "value" : 0 + } + ], + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -1852,7 +1979,7 @@ }, { "name" : "FabricIngress.next.mpls_routing_v4", - "id" : 28, + "id" : 31, "runtime_data" : [ { "name" : "port_num", @@ -1886,7 +2013,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -1905,7 +2032,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -1924,7 +2051,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -1939,7 +2066,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 59, + "line" : 72, "column" : 8, "source_fragment" : "hdr.mpls.setValid()" } @@ -1977,7 +2104,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 61, + "line" : 74, "column" : 8, "source_fragment" : "hdr.mpls.label = label; ..." } @@ -1996,7 +2123,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 62, + "line" : 75, "column" : 8, "source_fragment" : "hdr.mpls.tc = tc; ..." } @@ -2015,7 +2142,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 63, + "line" : 76, "column" : 8, "source_fragment" : "hdr.mpls.bos = 1w1" } @@ -2043,7 +2170,7 @@ }, { "name" : "FabricIngress.next.mpls_routing_v4", - "id" : 29, + "id" : 32, "runtime_data" : [ { "name" : "port_num", @@ -2077,7 +2204,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2096,7 +2223,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -2115,7 +2242,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -2130,7 +2257,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 59, + "line" : 72, "column" : 8, "source_fragment" : "hdr.mpls.setValid()" } @@ -2168,7 +2295,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 61, + "line" : 74, "column" : 8, "source_fragment" : "hdr.mpls.label = label; ..." } @@ -2187,7 +2314,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 62, + "line" : 75, "column" : 8, "source_fragment" : "hdr.mpls.tc = tc; ..." } @@ -2206,7 +2333,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 63, + "line" : 76, "column" : 8, "source_fragment" : "hdr.mpls.bos = 1w1" } @@ -2234,7 +2361,7 @@ }, { "name" : "FabricIngress.next.mpls_routing_v6", - "id" : 30, + "id" : 33, "runtime_data" : [ { "name" : "port_num", @@ -2268,7 +2395,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2287,7 +2414,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 48, + "line" : 55, "column" : 8, "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..." } @@ -2306,7 +2433,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 32, + "line" : 33, "column" : 8, "source_fragment" : "standard_metadata.egress_spec = port_num; ..." } @@ -2321,7 +2448,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 59, + "line" : 72, "column" : 8, "source_fragment" : "hdr.mpls.setValid()" } @@ -2359,7 +2486,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 61, + "line" : 74, "column" : 8, "source_fragment" : "hdr.mpls.label = label; ..." } @@ -2378,7 +2505,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 62, + "line" : 75, "column" : 8, "source_fragment" : "hdr.mpls.tc = tc; ..." } @@ -2397,7 +2524,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 63, + "line" : 76, "column" : 8, "source_fragment" : "hdr.mpls.bos = 1w1" } @@ -2425,7 +2552,7 @@ }, { "name" : "FabricIngress.next.set_mcast_group", - "id" : 31, + "id" : 34, "runtime_data" : [ { "name" : "gid", @@ -2451,7 +2578,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 122, + "line" : 149, "column" : 8, "source_fragment" : "standard_metadata.mcast_grp = gid" } @@ -2470,7 +2597,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 44, + "line" : 51, "column" : 8, "source_fragment" : "hdr.ethernet.src_addr = smac; ..." } @@ -2479,7 +2606,7 @@ }, { "name" : "act", - "id" : 32, + "id" : 35, "runtime_data" : [], "primitives" : [ { @@ -2520,7 +2647,7 @@ }, { "name" : "act_0", - "id" : 33, + "id" : 36, "runtime_data" : [], "primitives" : [ { @@ -2565,7 +2692,7 @@ }, { "name" : "act_1", - "id" : 34, + "id" : 37, "runtime_data" : [], "primitives" : [ { @@ -2595,7 +2722,7 @@ }, { "name" : "act_2", - "id" : 35, + "id" : 38, "runtime_data" : [], "primitives" : [ { @@ -2625,7 +2752,7 @@ }, { "name" : "act_3", - "id" : 36, + "id" : 39, "runtime_data" : [], "primitives" : [ { @@ -2665,7 +2792,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 143, + "line" : 171, "column" : 20, "source_fragment" : "hdr.ipv4.ttl = hdr.ipv4.ttl - 1" } @@ -2674,7 +2801,7 @@ }, { "name" : "act_4", - "id" : 37, + "id" : 40, "runtime_data" : [], "primitives" : [ { @@ -2714,7 +2841,7 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 147, + "line" : 175, "column" : 20, "source_fragment" : "hdr.ipv6.hop_limit = hdr.ipv6.hop_limit - 1" } @@ -2723,7 +2850,7 @@ }, { "name" : "act_5", - "id" : 38, + "id" : 41, "runtime_data" : [], "primitives" : [ { @@ -2775,7 +2902,7 @@ }, { "name" : "act_6", - "id" : 39, + "id" : 42, "runtime_data" : [], "primitives" : [ { @@ -2826,8 +2953,55 @@ ] }, { - "name" : "act_7", - "id" : 40, + "name" : "nop", + "id" : 43, + "runtime_data" : [], + "primitives" : [] + }, + { + "name" : "FabricEgress.pkt_io_egress.pop_vlan", + "id" : 44, + "runtime_data" : [], + "primitives" : [ + { + "op" : "assign", + "parameters" : [ + { + "type" : "field", + "value" : ["ethernet", "ether_type"] + }, + { + "type" : "field", + "value" : ["vlan_tag", "ether_type"] + } + ], + "source_info" : { + "filename" : "./include/control/packetio.p4", + "line" : 38, + "column" : 8, + "source_fragment" : "hdr.ethernet.ether_type = hdr.vlan_tag.ether_type" + } + }, + { + "op" : "remove_header", + "parameters" : [ + { + "type" : "header", + "value" : "vlan_tag" + } + ], + "source_info" : { + "filename" : "./include/control/packetio.p4", + "line" : 39, + "column" : 8, + "source_fragment" : "hdr.vlan_tag.setInvalid()" + } + } + ] + }, + { + "name" : "FabricEgress.egress_next.pop_vlan", + "id" : 45, "runtime_data" : [], "primitives" : [ { @@ -2844,8 +3018,8 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 167, - "column" : 12, + "line" : 193, + "column" : 8, "source_fragment" : "hdr.ethernet.ether_type = hdr.vlan_tag.ether_type" } }, @@ -2859,16 +3033,16 @@ ], "source_info" : { "filename" : "./include/control/next.p4", - "line" : 168, - "column" : 12, + "line" : 194, + "column" : 8, "source_fragment" : "hdr.vlan_tag.setInvalid()" } } ] }, { - "name" : "act_8", - "id" : 41, + "name" : "act_7", + "id" : 46, "runtime_data" : [], "primitives" : [ { @@ -2881,7 +3055,7 @@ ], "source_info" : { "filename" : "./include/control/packetio.p4", - "line" : 39, + "line" : 46, "column" : 12, "source_fragment" : "hdr.packet_in.setValid()" } @@ -2900,7 +3074,7 @@ ], "source_info" : { "filename" : "./include/control/packetio.p4", - "line" : 40, + "line" : 47, "column" : 12, "source_fragment" : "hdr.packet_in.ingress_port = standard_metadata.ingress_port" } @@ -2930,14 +3104,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [32], + "action_ids" : [35], "actions" : ["act"], "base_default_next" : null, "next_tables" : { "act" : null }, "default_entry" : { - "action_id" : 32, + "action_id" : 35, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -2978,7 +3152,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [13, 12, 0, 11], + "action_ids" : [14, 13, 0, 12], "actions" : ["FabricIngress.filtering.push_internal_vlan", "FabricIngress.filtering.set_vlan", "nop", "FabricIngress.filtering.drop"], "base_default_next" : "FabricIngress.filtering.fwd_classifier", "next_tables" : { @@ -3029,14 +3203,14 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [14], + "action_ids" : [15], "actions" : ["FabricIngress.filtering.set_forwarding_type"], "base_default_next" : "node_6", "next_tables" : { "FabricIngress.filtering.set_forwarding_type" : "node_6" }, "default_entry" : { - "action_id" : 14, + "action_id" : 15, "action_const" : true, "action_data" : ["0x0"], "action_entry_const" : true @@ -3071,7 +3245,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [16, 2], + "action_ids" : [17, 3], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -3079,7 +3253,7 @@ "NoAction" : "FabricIngress.forwarding.acl" }, "default_entry" : { - "action_id" : 2, + "action_id" : 3, "action_const" : false, "action_data" : [], "action_entry_const" : false @@ -3108,7 +3282,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [22, 3], + "action_ids" : [23, 4], "actions" : ["FabricIngress.forwarding.pop_mpls_and_next", "NoAction"], "base_default_next" : "tbl_act_0", "next_tables" : { @@ -3116,7 +3290,7 @@ "NoAction" : "tbl_act_0" }, "default_entry" : { - "action_id" : 3, + "action_id" : 4, "action_const" : false, "action_data" : [], "action_entry_const" : false @@ -3132,14 +3306,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [33], + "action_ids" : [36], "actions" : ["act_0"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { "act_0" : "FabricIngress.forwarding.acl" }, "default_entry" : { - "action_id" : 33, + "action_id" : 36, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -3168,7 +3342,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [17, 4], + "action_ids" : [18, 5], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -3176,7 +3350,7 @@ "NoAction" : "FabricIngress.forwarding.acl" }, "default_entry" : { - "action_id" : 4, + "action_id" : 5, "action_const" : false, "action_data" : [], "action_entry_const" : false @@ -3211,7 +3385,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [18, 5], + "action_ids" : [19, 6], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -3219,7 +3393,7 @@ "NoAction" : "FabricIngress.forwarding.acl" }, "default_entry" : { - "action_id" : 5, + "action_id" : 6, "action_const" : false, "action_data" : [], "action_entry_const" : false @@ -3248,7 +3422,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [19, 6], + "action_ids" : [20, 7], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -3256,7 +3430,7 @@ "NoAction" : "FabricIngress.forwarding.acl" }, "default_entry" : { - "action_id" : 6, + "action_id" : 7, "action_const" : false, "action_data" : [], "action_entry_const" : false @@ -3291,7 +3465,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [20, 7], + "action_ids" : [21, 8], "actions" : ["FabricIngress.forwarding.set_next_id", "NoAction"], "base_default_next" : "FabricIngress.forwarding.acl", "next_tables" : { @@ -3299,7 +3473,7 @@ "NoAction" : "FabricIngress.forwarding.acl" }, "default_entry" : { - "action_id" : 7, + "action_id" : 8, "action_const" : false, "action_data" : [], "action_entry_const" : false @@ -3394,14 +3568,14 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [21, 23, 15, 1], + "action_ids" : [22, 24, 16, 1], "actions" : ["FabricIngress.forwarding.set_next_id", "FabricIngress.forwarding.duplicate_to_controller", "FabricIngress.forwarding.drop", "nop"], - "base_default_next" : "FabricIngress.next.simple", + "base_default_next" : "FabricIngress.next.vlan_meta", "next_tables" : { - "FabricIngress.forwarding.set_next_id" : "FabricIngress.next.simple", - "FabricIngress.forwarding.duplicate_to_controller" : "FabricIngress.next.simple", - "FabricIngress.forwarding.drop" : "FabricIngress.next.simple", - "nop" : "FabricIngress.next.simple" + "FabricIngress.forwarding.set_next_id" : "FabricIngress.next.vlan_meta", + "FabricIngress.forwarding.duplicate_to_controller" : "FabricIngress.next.vlan_meta", + "FabricIngress.forwarding.drop" : "FabricIngress.next.vlan_meta", + "nop" : "FabricIngress.next.vlan_meta" }, "default_entry" : { "action_id" : 1, @@ -3411,11 +3585,48 @@ } }, { - "name" : "FabricIngress.next.simple", + "name" : "FabricIngress.next.vlan_meta", "id" : 11, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 83, + "line" : 96, + "column" : 10, + "source_fragment" : "vlan_meta" + }, + "key" : [ + { + "match_type" : "exact", + "name" : "fabric_metadata.next_id", + "target" : ["scalars", "fabric_metadata_t.next_id"], + "mask" : null + } + ], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : true, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [26, 2], + "actions" : ["FabricIngress.next.set_vlan", "nop"], + "base_default_next" : "FabricIngress.next.simple", + "next_tables" : { + "FabricIngress.next.set_vlan" : "FabricIngress.next.simple", + "nop" : "FabricIngress.next.simple" + }, + "default_entry" : { + "action_id" : 2, + "action_const" : false, + "action_data" : [], + "action_entry_const" : false + } + }, + { + "name" : "FabricIngress.next.simple", + "id" : 12, + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 109, "column" : 10, "source_fragment" : "simple" }, @@ -3433,15 +3644,15 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [24, 25, 26, 28, 8], - "actions" : ["FabricIngress.next.output", "FabricIngress.next.set_vlan_output", "FabricIngress.next.l3_routing", "FabricIngress.next.mpls_routing_v4", "NoAction"], + "action_ids" : [25, 27, 28, 31, 30, 9], + "actions" : ["FabricIngress.next.output", "FabricIngress.next.set_vlan_output", "FabricIngress.next.l3_routing", "FabricIngress.next.mpls_routing_v4", "FabricIngress.next.l3_routing_vlan", "NoAction"], "base_default_next" : null, "next_tables" : { "__HIT__" : "tbl_act_1", "__MISS__" : "tbl_act_2" }, "default_entry" : { - "action_id" : 8, + "action_id" : 9, "action_const" : false, "action_data" : [], "action_entry_const" : false @@ -3449,29 +3660,6 @@ }, { "name" : "tbl_act_1", - "id" : 12, - "key" : [], - "match_type" : "exact", - "type" : "simple", - "max_size" : 1024, - "with_counters" : false, - "support_timeout" : false, - "direct_meters" : null, - "action_ids" : [34], - "actions" : ["act_1"], - "base_default_next" : "node_23", - "next_tables" : { - "act_1" : "node_23" - }, - "default_entry" : { - "action_id" : 34, - "action_const" : true, - "action_data" : [], - "action_entry_const" : true - } - }, - { - "name" : "tbl_act_2", "id" : 13, "key" : [], "match_type" : "exact", @@ -3480,57 +3668,11 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [35], - "actions" : ["act_2"], - "base_default_next" : "node_23", - "next_tables" : { - "act_2" : "node_23" - }, - "default_entry" : { - "action_id" : 35, - "action_const" : true, - "action_data" : [], - "action_entry_const" : true - } - }, - { - "name" : "tbl_act_3", - "id" : 14, - "key" : [], - "match_type" : "exact", - "type" : "simple", - "max_size" : 1024, - "with_counters" : false, - "support_timeout" : false, - "direct_meters" : null, - "action_ids" : [36], - "actions" : ["act_3"], - "base_default_next" : "FabricIngress.next.hashed", - "next_tables" : { - "act_3" : "FabricIngress.next.hashed" - }, - "default_entry" : { - "action_id" : 36, - "action_const" : true, - "action_data" : [], - "action_entry_const" : true - } - }, - { - "name" : "tbl_act_4", - "id" : 15, - "key" : [], - "match_type" : "exact", - "type" : "simple", - "max_size" : 1024, - "with_counters" : false, - "support_timeout" : false, - "direct_meters" : null, "action_ids" : [37], - "actions" : ["act_4"], - "base_default_next" : "FabricIngress.next.hashed", + "actions" : ["act_1"], + "base_default_next" : "node_24", "next_tables" : { - "act_4" : "FabricIngress.next.hashed" + "act_1" : "node_24" }, "default_entry" : { "action_id" : 37, @@ -3540,11 +3682,80 @@ } }, { - "name" : "FabricIngress.next.hashed", + "name" : "tbl_act_2", + "id" : 14, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [38], + "actions" : ["act_2"], + "base_default_next" : "node_24", + "next_tables" : { + "act_2" : "node_24" + }, + "default_entry" : { + "action_id" : 38, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "tbl_act_3", + "id" : 15, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [39], + "actions" : ["act_3"], + "base_default_next" : "FabricIngress.next.hashed", + "next_tables" : { + "act_3" : "FabricIngress.next.hashed" + }, + "default_entry" : { + "action_id" : 39, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "tbl_act_4", "id" : 16, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [40], + "actions" : ["act_4"], + "base_default_next" : "FabricIngress.next.hashed", + "next_tables" : { + "act_4" : "FabricIngress.next.hashed" + }, + "default_entry" : { + "action_id" : 40, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "FabricIngress.next.hashed", + "id" : 17, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 97, + "line" : 124, "column" : 10, "source_fragment" : "hashed" }, @@ -3563,7 +3774,7 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [27, 29, 30, 9], + "action_ids" : [29, 32, 33, 10], "actions" : ["FabricIngress.next.l3_routing", "FabricIngress.next.mpls_routing_v4", "FabricIngress.next.mpls_routing_v6", "NoAction"], "base_default_next" : "FabricIngress.next.multicast", "next_tables" : { @@ -3575,10 +3786,10 @@ }, { "name" : "FabricIngress.next.multicast", - "id" : 17, + "id" : 18, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 128, + "line" : 155, "column" : 10, "source_fragment" : "multicast" }, @@ -3596,15 +3807,15 @@ "with_counters" : true, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [31, 10], + "action_ids" : [34, 11], "actions" : ["FabricIngress.next.set_mcast_group", "NoAction"], - "base_default_next" : "node_31", + "base_default_next" : "node_32", "next_tables" : { - "FabricIngress.next.set_mcast_group" : "node_31", - "NoAction" : "node_31" + "FabricIngress.next.set_mcast_group" : "node_32", + "NoAction" : "node_32" }, "default_entry" : { - "action_id" : 10, + "action_id" : 11, "action_const" : false, "action_data" : [], "action_entry_const" : false @@ -3612,29 +3823,6 @@ }, { "name" : "tbl_act_5", - "id" : 18, - "key" : [], - "match_type" : "exact", - "type" : "simple", - "max_size" : 1024, - "with_counters" : false, - "support_timeout" : false, - "direct_meters" : null, - "action_ids" : [38], - "actions" : ["act_5"], - "base_default_next" : "node_33", - "next_tables" : { - "act_5" : "node_33" - }, - "default_entry" : { - "action_id" : 38, - "action_const" : true, - "action_data" : [], - "action_entry_const" : true - } - }, - { - "name" : "tbl_act_6", "id" : 19, "key" : [], "match_type" : "exact", @@ -3643,21 +3831,21 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [39], - "actions" : ["act_6"], - "base_default_next" : "node_35", + "action_ids" : [41], + "actions" : ["act_5"], + "base_default_next" : "node_34", "next_tables" : { - "act_6" : "node_35" + "act_5" : "node_34" }, "default_entry" : { - "action_id" : 39, + "action_id" : 41, "action_const" : true, "action_data" : [], "action_entry_const" : true } }, { - "name" : "tbl_act_7", + "name" : "tbl_act_6", "id" : 20, "key" : [], "match_type" : "exact", @@ -3666,14 +3854,14 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [40], - "actions" : ["act_7"], + "action_ids" : [42], + "actions" : ["act_6"], "base_default_next" : null, "next_tables" : { - "act_7" : null + "act_6" : null }, "default_entry" : { - "action_id" : 40, + "action_id" : 42, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -3893,7 +4081,7 @@ "false_next" : "FabricIngress.forwarding.acl" }, { - "name" : "node_23", + "name" : "node_24", "id" : 7, "expression" : { "type" : "expression", @@ -3906,15 +4094,15 @@ } } }, - "true_next" : "node_24", + "true_next" : "node_25", "false_next" : "FabricIngress.next.hashed" }, { - "name" : "node_24", + "name" : "node_25", "id" : 8, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 141, + "line" : 169, "column" : 16, "source_fragment" : "!hdr.mpls.isValid()" }, @@ -3936,15 +4124,15 @@ } } }, - "true_next" : "node_25", + "true_next" : "node_26", "false_next" : "FabricIngress.next.hashed" }, { - "name" : "node_25", + "name" : "node_26", "id" : 9, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 142, + "line" : 170, "column" : 19, "source_fragment" : "hdr.ipv4.isValid()" }, @@ -3960,14 +4148,14 @@ } }, "true_next" : "tbl_act_3", - "false_next" : "node_27" + "false_next" : "node_28" }, { - "name" : "node_27", + "name" : "node_28", "id" : 10, "source_info" : { "filename" : "./include/control/next.p4", - "line" : 146, + "line" : 174, "column" : 25, "source_fragment" : "hdr.ipv6.isValid()" }, @@ -3986,7 +4174,7 @@ "false_next" : "FabricIngress.next.hashed" }, { - "name" : "node_31", + "name" : "node_32", "id" : 11, "source_info" : { "filename" : "./include/control/port_counter.p4", @@ -4009,10 +4197,10 @@ } }, "true_next" : "tbl_act_5", - "false_next" : "node_33" + "false_next" : "node_34" }, { - "name" : "node_33", + "name" : "node_34", "id" : 12, "source_info" : { "filename" : "./include/control/port_counter.p4", @@ -4034,31 +4222,8 @@ } } }, - "true_next" : "tbl_act_6", - "false_next" : "node_35" - }, - { - "name" : "node_35", - "id" : 13, - "source_info" : { - "filename" : "./include/control/next.p4", - "line" : 166, - "column" : 12, - "source_fragment" : "fabric_metadata.pop_vlan_at_egress" - }, - "expression" : { - "type" : "expression", - "value" : { - "op" : "d2b", - "left" : null, - "right" : { - "type" : "field", - "value" : ["scalars", "fabric_metadata_t.pop_vlan_at_egress"] - } - } - }, "false_next" : null, - "true_next" : "tbl_act_7" + "true_next" : "tbl_act_6" } ] }, @@ -4067,15 +4232,58 @@ "id" : 1, "source_info" : { "filename" : "fabric.p4", - "line" : 62, + "line" : 61, "column" : 8, "source_fragment" : "FabricEgress" }, - "init_table" : "node_39", + "init_table" : "FabricEgress.egress_next.egress_vlan", "tables" : [ { - "name" : "tbl_act_8", + "name" : "FabricEgress.egress_next.egress_vlan", "id" : 21, + "source_info" : { + "filename" : "./include/control/next.p4", + "line" : 197, + "column" : 10, + "source_fragment" : "egress_vlan" + }, + "key" : [ + { + "match_type" : "exact", + "name" : "hdr.vlan_tag.vlan_id", + "target" : ["vlan_tag", "vlan_id"], + "mask" : null + }, + { + "match_type" : "exact", + "name" : "standard_metadata.egress_port", + "target" : ["standard_metadata", "egress_port"], + "mask" : null + } + ], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [45, 43], + "actions" : ["FabricEgress.egress_next.pop_vlan", "nop"], + "base_default_next" : "node_39", + "next_tables" : { + "FabricEgress.egress_next.pop_vlan" : "node_39", + "nop" : "node_39" + }, + "default_entry" : { + "action_id" : 43, + "action_const" : false, + "action_data" : [], + "action_entry_const" : false + } + }, + { + "name" : "tbl_pkt_io_egress_pop_vlan", + "id" : 22, "key" : [], "match_type" : "exact", "type" : "simple", @@ -4083,14 +4291,37 @@ "with_counters" : false, "support_timeout" : false, "direct_meters" : null, - "action_ids" : [41], - "actions" : ["act_8"], - "base_default_next" : null, + "action_ids" : [44], + "actions" : ["FabricEgress.pkt_io_egress.pop_vlan"], + "base_default_next" : "tbl_act_7", "next_tables" : { - "act_8" : null + "FabricEgress.pkt_io_egress.pop_vlan" : "tbl_act_7" }, "default_entry" : { - "action_id" : 41, + "action_id" : 44, + "action_const" : true, + "action_data" : [], + "action_entry_const" : true + } + }, + { + "name" : "tbl_act_7", + "id" : 23, + "key" : [], + "match_type" : "exact", + "type" : "simple", + "max_size" : 1024, + "with_counters" : false, + "support_timeout" : false, + "direct_meters" : null, + "action_ids" : [46], + "actions" : ["act_7"], + "base_default_next" : null, + "next_tables" : { + "act_7" : null + }, + "default_entry" : { + "action_id" : 46, "action_const" : true, "action_data" : [], "action_entry_const" : true @@ -4101,10 +4332,10 @@ "conditionals" : [ { "name" : "node_39", - "id" : 14, + "id" : 13, "source_info" : { "filename" : "./include/control/packetio.p4", - "line" : 38, + "line" : 42, "column" : 12, "source_fragment" : "standard_metadata.egress_port == 255" }, @@ -4123,7 +4354,47 @@ } }, "false_next" : null, - "true_next" : "tbl_act_8" + "true_next" : "node_40" + }, + { + "name" : "node_40", + "id" : 14, + "source_info" : { + "filename" : "./include/control/packetio.p4", + "line" : 43, + "column" : 16, + "source_fragment" : "hdr.vlan_tag.isValid() && fabric_metadata.pop_vlan_when_packet_in" + }, + "expression" : { + "type" : "expression", + "value" : { + "op" : "and", + "left" : { + "type" : "expression", + "value" : { + "op" : "d2b", + "left" : null, + "right" : { + "type" : "field", + "value" : ["vlan_tag", "$valid$"] + } + } + }, + "right" : { + "type" : "expression", + "value" : { + "op" : "d2b", + "left" : null, + "right" : { + "type" : "field", + "value" : ["scalars", "fabric_metadata_t.pop_vlan_when_packet_in"] + } + } + } + } + }, + "true_next" : "tbl_pkt_io_egress_pop_vlan", + "false_next" : "tbl_act_7" } ] } diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info index f1f91eabda..b4e460a154 100644 --- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info +++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info @@ -313,6 +313,27 @@ tables { direct_resource_ids: 301995056 size: 256 } +tables { + preamble { + id: 33562709 + name: "FabricIngress.next.vlan_meta" + alias: "vlan_meta" + } + match_fields { + id: 1 + name: "fabric_metadata.next_id" + bitwidth: 32 + match_type: EXACT + } + action_refs { + id: 16790685 + } + action_refs { + id: 16819938 + } + direct_resource_ids: 302008112 + size: 1024 +} tables { preamble { id: 33571723 @@ -337,6 +358,9 @@ tables { action_refs { id: 16780811 } + action_refs { + id: 16791579 + } action_refs { id: 16800567 annotations: "@defaultonly()" @@ -395,6 +419,32 @@ tables { direct_resource_ids: 302024536 size: 1024 } +tables { + preamble { + id: 33599342 + name: "FabricEgress.egress_next.egress_vlan" + alias: "egress_vlan" + } + match_fields { + id: 1 + name: "hdr.vlan_tag.vlan_id" + bitwidth: 12 + match_type: EXACT + } + match_fields { + id: 2 + name: "standard_metadata.egress_port" + bitwidth: 9 + match_type: EXACT + } + action_refs { + id: 16790030 + } + action_refs { + id: 16819938 + } + size: 1024 +} actions { preamble { id: 16819938 @@ -420,7 +470,7 @@ actions { preamble { id: 16793253 name: "FabricIngress.filtering.set_vlan" - alias: "set_vlan" + alias: "filtering.set_vlan" } params { id: 1 @@ -502,6 +552,18 @@ actions { bitwidth: 9 } } +actions { + preamble { + id: 16790685 + name: "FabricIngress.next.set_vlan" + alias: "next.set_vlan" + } + params { + id: 1 + name: "new_vlan_id" + bitwidth: 12 + } +} actions { preamble { id: 16808391 @@ -541,6 +603,33 @@ actions { bitwidth: 48 } } +actions { + preamble { + id: 16791579 + name: "FabricIngress.next.l3_routing_vlan" + alias: "l3_routing_vlan" + } + params { + id: 1 + name: "port_num" + bitwidth: 9 + } + params { + id: 2 + name: "smac" + bitwidth: 48 + } + params { + id: 3 + name: "dmac" + bitwidth: 48 + } + params { + id: 4 + name: "new_vlan_id" + bitwidth: 12 + } +} actions { preamble { id: 16780811 @@ -612,6 +701,20 @@ actions { bitwidth: 48 } } +actions { + preamble { + id: 16801047 + name: "FabricEgress.pkt_io_egress.pop_vlan" + alias: "pkt_io_egress.pop_vlan" + } +} +actions { + preamble { + id: 16790030 + name: "FabricEgress.egress_next.pop_vlan" + alias: "egress_next.pop_vlan" + } +} action_profiles { preamble { id: 285233747 @@ -743,6 +846,17 @@ direct_counters { } direct_table_id: 33574876 } +direct_counters { + preamble { + id: 302008112 + name: "FabricIngress.next.vlan_meta_counter" + alias: "vlan_meta_counter" + } + spec { + unit: BOTH + } + direct_table_id: 33562709 +} direct_counters { preamble { id: 301991880 diff --git a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipelinerTest.java b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipelinerTest.java index a21ca2a03a..a797a8355a 100644 --- a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipelinerTest.java +++ b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipelinerTest.java @@ -44,11 +44,36 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.onosproject.pipelines.fabric.FabricConstants.ACT_PRF_FABRICINGRESS_NEXT_ECMP_SELECTOR_ID; import static org.onosproject.pipelines.fabric.FabricConstants.TBL_HASHED_ID; +import static org.onosproject.pipelines.fabric.FabricConstants.TBL_VLAN_META_ID; /** * Test cases for fabric.p4 pipeline next control block. */ public class FabricNextPipelinerTest extends FabricPipelinerTest { + private FlowRule vlanMetaFlowRule; + + public FabricNextPipelinerTest() { + PiCriterion nextIdCriterion = PiCriterion.builder() + .matchExact(FabricConstants.HF_FABRIC_METADATA_NEXT_ID_ID, NEXT_ID_1) + .build(); + TrafficSelector selector = DefaultTrafficSelector.builder() + .matchPi(nextIdCriterion) + .build(); + TrafficTreatment treatment = DefaultTrafficTreatment.builder() + .setVlanId(VLAN_100) + .build(); + + vlanMetaFlowRule = DefaultFlowRule.builder() + .withSelector(selector) + .withTreatment(treatment) + .forTable(TBL_VLAN_META_ID) + .makePermanent() + // FIXME: currently next objective doesn't support priority, ignore this + .withPriority(0) + .forDevice(DEVICE_ID) + .fromApp(APP_ID) + .build(); + } /** * Test program output rule for Simple table. @@ -86,10 +111,25 @@ public class FabricNextPipelinerTest extends FabricPipelinerTest { testSimple(treatment); } + /** + * Test program set mac, set vlan, and output rule for Simple table. + */ + @Test + public void testSimpleOutputWithVlanAndMacTranslation() { + TrafficTreatment treatment = DefaultTrafficTreatment.builder() + .setEthSrc(ROUTER_MAC) + .setEthDst(HOST_MAC) + .setVlanId(VLAN_100) + .setOutput(PORT_1) + .build(); + testSimple(treatment); + } + private void testSimple(TrafficTreatment treatment) { NextObjective nextObjective = DefaultNextObjective.builder() .withId(NEXT_ID_1) .withPriority(PRIORITY) + .withMeta(VLAN_META) .addTreatment(treatment) .withType(NextObjective.Type.SIMPLE) .makePermanent() @@ -100,7 +140,7 @@ public class FabricNextPipelinerTest extends FabricPipelinerTest { List flowRulesInstalled = (List) result.flowRules(); List groupsInstalled = (List) result.groups(); - assertEquals(1, flowRulesInstalled.size()); + assertEquals(2, flowRulesInstalled.size()); assertTrue(groupsInstalled.isEmpty()); // Simple table @@ -110,7 +150,12 @@ public class FabricNextPipelinerTest extends FabricPipelinerTest { TrafficSelector nextIdSelector = DefaultTrafficSelector.builder() .matchPi(nextIdCriterion) .build(); + + // VLAN meta table FlowRule actualFlowRule = flowRulesInstalled.get(0); + assertTrue(actualFlowRule.exactMatch(vlanMetaFlowRule)); + + actualFlowRule = flowRulesInstalled.get(1); FlowRule expectedFlowRule = DefaultFlowRule.builder() .forDevice(DEVICE_ID) .fromApp(APP_ID) @@ -143,6 +188,7 @@ public class FabricNextPipelinerTest extends FabricPipelinerTest { NextObjective nextObjective = DefaultNextObjective.builder() .withId(NEXT_ID_1) .withPriority(PRIORITY) + .withMeta(VLAN_META) .addTreatment(treatment1) .addTreatment(treatment2) .withType(NextObjective.Type.HASHED) @@ -155,7 +201,7 @@ public class FabricNextPipelinerTest extends FabricPipelinerTest { // Should generates 2 flows and 1 group List flowRulesInstalled = (List) result.flowRules(); List groupsInstalled = (List) result.groups(); - assertEquals(1, flowRulesInstalled.size()); + assertEquals(2, flowRulesInstalled.size()); assertEquals(1, groupsInstalled.size()); // Hashed table @@ -169,7 +215,12 @@ public class FabricNextPipelinerTest extends FabricPipelinerTest { TrafficTreatment treatment = DefaultTrafficTreatment.builder() .piTableAction(actionGroupId) .build(); + + // VLAN meta table FlowRule actualFlowRule = flowRulesInstalled.get(0); + assertTrue(actualFlowRule.exactMatch(vlanMetaFlowRule)); + + actualFlowRule = flowRulesInstalled.get(1); FlowRule expectedFlowRule = DefaultFlowRule.builder() .forDevice(DEVICE_ID) .fromApp(APP_ID) diff --git a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest.java b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest.java index 5414998894..c605e99b94 100644 --- a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest.java +++ b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest.java @@ -30,6 +30,8 @@ import org.onosproject.net.PortNumber; import org.onosproject.net.behaviour.PipelinerContext; import org.onosproject.net.driver.Driver; import org.onosproject.net.driver.DriverHandler; +import org.onosproject.net.flow.DefaultTrafficSelector; +import org.onosproject.net.flow.TrafficSelector; import org.onosproject.net.flow.criteria.PiCriterion; import org.onosproject.net.group.GroupService; import org.onosproject.pipelines.fabric.FabricConstants; @@ -54,6 +56,9 @@ public abstract class FabricPipelinerTest { static final IpPrefix IPV6_MCAST_ADDR = IpPrefix.valueOf("ff00::1/32"); static final MplsLabel MPLS_10 = MplsLabel.mplsLabel(10); static final Integer NEXT_ID_1 = 1; + static final TrafficSelector VLAN_META = DefaultTrafficSelector.builder() + .matchVlanId(VLAN_100) + .build(); // Forwarding types static final byte FWD_BRIDGING = 0;