Make the Basic pipeline more portable

This change makes the Basic pipeline compile better with different
compilers. One change is this: the type parameter for a v1model meter
instance cannot be a programmer-defined enum. This is because in P4_16,
enums don't necessarily have underlying bitstring types and the
language doesn't specify that enum members should be assigned a
numerical value in any given way.

Change-Id: Id2b758eb2b6e76aa708c2e03e7a001667efddb3d
This commit is contained in:
Keesjan Karsten 2018-05-22 10:46:01 +00:00 committed by Carmelo Cascone
parent 3ad8213fc0
commit 2336889e82
15 changed files with 422 additions and 607 deletions

View File

@ -68,7 +68,7 @@ import static org.onlab.util.ImmutableByteSequence.copyFrom;
import static org.onosproject.net.group.GroupDescription.Type.SELECT; import static org.onosproject.net.group.GroupDescription.Type.SELECT;
import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRF_WCMP_SELECTOR_ID; import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRF_WCMP_SELECTOR_ID;
import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRM_PORT_ID; import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRM_PORT_ID;
import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_ID; import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_WCMP_ID;
import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_DST_ID; import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_DST_ID;
import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_SRC_ID; import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_SRC_ID;
import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_TYPE_ID; import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_TYPE_ID;
@ -222,7 +222,7 @@ public class PiTranslatorServiceTest {
private static GroupBucket outputBucket(int portNum) { private static GroupBucket outputBucket(int portNum) {
ImmutableByteSequence paramVal = copyFrom(portNum); ImmutableByteSequence paramVal = copyFrom(portNum);
PiActionParam param = new PiActionParam(ACT_PRM_PORT_ID, paramVal); PiActionParam param = new PiActionParam(ACT_PRM_PORT_ID, paramVal);
PiTableAction action = PiAction.builder().withId(ACT_SET_EGRESS_PORT_ID).withParameter(param).build(); PiTableAction action = PiAction.builder().withId(ACT_SET_EGRESS_PORT_WCMP_ID).withParameter(param).build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder() TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.add(Instructions.piTableAction(action)) .add(Instructions.piTableAction(action))
.build(); .build();
@ -233,7 +233,7 @@ public class PiTranslatorServiceTest {
throws ImmutableByteSequence.ByteSequenceTrimException { throws ImmutableByteSequence.ByteSequenceTrimException {
PiActionParam param = new PiActionParam(ACT_PRM_PORT_ID, copyFrom(portNum).fit(PORT_BITWIDTH)); PiActionParam param = new PiActionParam(ACT_PRM_PORT_ID, copyFrom(portNum).fit(PORT_BITWIDTH));
PiAction piAction = PiAction.builder() PiAction piAction = PiAction.builder()
.withId(ACT_SET_EGRESS_PORT_ID) .withId(ACT_SET_EGRESS_PORT_WCMP_ID)
.withParameter(param).build(); .withParameter(param).build();
return PiActionGroupMember.builder() return PiActionGroupMember.builder()
.withAction(piAction) .withAction(piAction)

View File

@ -81,12 +81,14 @@ public final class BasicConstants {
PiActionId.of("NoAction"); PiActionId.of("NoAction");
public static final PiActionId ACT_DROP_ID = public static final PiActionId ACT_DROP_ID =
PiActionId.of("_drop"); PiActionId.of("_drop");
public static final PiActionId ACT_SET_EGRESS_PORT_ID = public static final PiActionId ACT_SET_EGRESS_PORT_TABLE0_ID =
PiActionId.of("set_egress_port"); PiActionId.of(TABLE0_CTRL + DOT + "set_egress_port");
public static final PiActionId ACT_SET_EGRESS_PORT_WCMP_ID =
PiActionId.of(WCMP_CTRL + DOT + "set_egress_port");
public static final PiActionId ACT_SET_NEXT_HOP_ID = public static final PiActionId ACT_SET_NEXT_HOP_ID =
PiActionId.of(TABLE0_CTRL + DOT + "set_next_hop_id"); PiActionId.of(TABLE0_CTRL + DOT + "set_next_hop_id");
public static final PiActionId ACT_SEND_TO_CPU_ID = public static final PiActionId ACT_SEND_TO_CPU_ID =
PiActionId.of("send_to_cpu"); PiActionId.of(TABLE0_CTRL + DOT + "send_to_cpu");
// Action Param IDs // Action Param IDs
public static final PiActionParamId ACT_PRM_PORT_ID = public static final PiActionParamId ACT_PRM_PORT_ID =
PiActionParamId.of("port"); PiActionParamId.of("port");

View File

@ -35,6 +35,7 @@ import org.onosproject.net.packet.OutboundPacket;
import org.onosproject.net.pi.model.PiMatchFieldId; import org.onosproject.net.pi.model.PiMatchFieldId;
import org.onosproject.net.pi.model.PiPipelineInterpreter; import org.onosproject.net.pi.model.PiPipelineInterpreter;
import org.onosproject.net.pi.model.PiTableId; import org.onosproject.net.pi.model.PiTableId;
import org.onosproject.net.pi.model.PiActionId;
import org.onosproject.net.pi.runtime.PiAction; import org.onosproject.net.pi.runtime.PiAction;
import org.onosproject.net.pi.runtime.PiActionParam; import org.onosproject.net.pi.runtime.PiActionParam;
import org.onosproject.net.pi.runtime.PiControlMetadata; import org.onosproject.net.pi.runtime.PiControlMetadata;
@ -57,7 +58,8 @@ import static org.onosproject.pipelines.basic.BasicConstants.ACT_DROP_ID;
import static org.onosproject.pipelines.basic.BasicConstants.ACT_NOACTION_ID; import static org.onosproject.pipelines.basic.BasicConstants.ACT_NOACTION_ID;
import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRM_PORT_ID; import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRM_PORT_ID;
import static org.onosproject.pipelines.basic.BasicConstants.ACT_SEND_TO_CPU_ID; import static org.onosproject.pipelines.basic.BasicConstants.ACT_SEND_TO_CPU_ID;
import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_ID; import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_TABLE0_ID;
import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_WCMP_ID;
import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_DST_ID; import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_DST_ID;
import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_SRC_ID; import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_SRC_ID;
import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_TYPE_ID; import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_TYPE_ID;
@ -68,6 +70,7 @@ import static org.onosproject.pipelines.basic.BasicConstants.PKT_META_EGRESS_POR
import static org.onosproject.pipelines.basic.BasicConstants.PKT_META_INGRESS_PORT_ID; import static org.onosproject.pipelines.basic.BasicConstants.PKT_META_INGRESS_PORT_ID;
import static org.onosproject.pipelines.basic.BasicConstants.PORT_BITWIDTH; import static org.onosproject.pipelines.basic.BasicConstants.PORT_BITWIDTH;
import static org.onosproject.pipelines.basic.BasicConstants.TBL_TABLE0_ID; import static org.onosproject.pipelines.basic.BasicConstants.TBL_TABLE0_ID;
import static org.onosproject.pipelines.basic.BasicConstants.TBL_WCMP_TABLE_ID;
/** /**
* Interpreter implementation for basic.p4. * Interpreter implementation for basic.p4.
@ -104,7 +107,14 @@ public class BasicInterpreterImpl extends AbstractHandlerBehaviour
Instruction instruction = treatment.allInstructions().get(0); Instruction instruction = treatment.allInstructions().get(0);
switch (instruction.type()) { switch (instruction.type()) {
case OUTPUT: case OUTPUT:
return outputPiAction((OutputInstruction) instruction); if (piTableId == TBL_TABLE0_ID) {
return outputPiAction((OutputInstruction) instruction, ACT_SET_EGRESS_PORT_TABLE0_ID);
} else if (piTableId == TBL_WCMP_TABLE_ID) {
return outputPiAction((OutputInstruction) instruction, ACT_SET_EGRESS_PORT_WCMP_ID);
} else {
throw new PiInterpreterException(
"Output instruction not supported in table " + piTableId);
}
case NOACTION: case NOACTION:
return PiAction.builder().withId(ACT_NOACTION_ID).build(); return PiAction.builder().withId(ACT_NOACTION_ID).build();
default: default:
@ -113,13 +123,13 @@ public class BasicInterpreterImpl extends AbstractHandlerBehaviour
} }
} }
private PiAction outputPiAction(OutputInstruction outInstruction) private PiAction outputPiAction(OutputInstruction outInstruction, PiActionId piActionId)
throws PiInterpreterException { throws PiInterpreterException {
PortNumber port = outInstruction.port(); PortNumber port = outInstruction.port();
if (!port.isLogical()) { if (!port.isLogical()) {
try { try {
return PiAction.builder() return PiAction.builder()
.withId(ACT_SET_EGRESS_PORT_ID) .withId(piActionId)
.withParameter(new PiActionParam(ACT_PRM_PORT_ID, .withParameter(new PiActionParam(ACT_PRM_PORT_ID,
copyFrom(port.toLong()).fit(PORT_BITWIDTH))) copyFrom(port.toLong()).fit(PORT_BITWIDTH)))
.build(); .build();

View File

@ -20,14 +20,6 @@
#include "headers.p4" #include "headers.p4"
#include "defines.p4" #include "defines.p4"
action send_to_cpu(inout standard_metadata_t standard_metadata) {
standard_metadata.egress_spec = CPU_PORT;
}
action set_egress_port(inout standard_metadata_t standard_metadata, port_t port) {
standard_metadata.egress_spec = port;
}
action _drop() { action _drop() {
mark_to_drop(); mark_to_drop();
} }

View File

@ -29,7 +29,6 @@ struct local_metadata_t {
bit<16> l4_src_port; bit<16> l4_src_port;
bit<16> l4_dst_port; bit<16> l4_dst_port;
next_hop_id_t next_hop_id; next_hop_id_t next_hop_id;
bit<32> meter_tag;
} }
#endif #endif

View File

@ -27,5 +27,8 @@ typedef bit<16> next_hop_id_t;
const port_t CPU_PORT = 255; const port_t CPU_PORT = 255;
enum MeterColor_t {GREEN, YELLOW, RED}; typedef bit<8> MeterColor;
const MeterColor MeterColor_GREEN = 8w0;
const MeterColor MeterColor_YELLOW = 8w1;
const MeterColor MeterColor_RED = 8w2;
#endif #endif

View File

@ -22,11 +22,13 @@
@controller_header("packet_in") @controller_header("packet_in")
header packet_in_header_t { header packet_in_header_t {
bit<9> ingress_port; bit<9> ingress_port;
bit<7> _padding;
} }
@controller_header("packet_out") @controller_header("packet_out")
header packet_out_header_t { header packet_out_header_t {
bit<9> egress_port; bit<9> egress_port;
bit<7> _padding;
} }
header ethernet_t { header ethernet_t {

View File

@ -23,11 +23,11 @@
control host_meter_control(inout headers_t hdr, control host_meter_control(inout headers_t hdr,
inout local_metadata_t local_metadata, inout local_metadata_t local_metadata,
inout standard_metadata_t standard_metadata) { inout standard_metadata_t standard_metadata) {
MeterColor meter_tag = MeterColor_GREEN;
direct_meter<bit<32>>(MeterType.bytes) host_meter; direct_meter<MeterColor>(MeterType.bytes) host_meter;
action read_meter() { action read_meter() {
host_meter.read(local_metadata.meter_tag); host_meter.read(meter_tag);
} }
table host_meter_table { table host_meter_table {
@ -43,7 +43,8 @@ control host_meter_control(inout headers_t hdr,
} }
apply { apply {
if (host_meter_table.apply().hit && local_metadata.meter_tag == 2) { host_meter_table.apply();
if (meter_tag == MeterColor_RED) {
mark_to_drop(); mark_to_drop();
} }
} }

View File

@ -21,11 +21,11 @@
control port_meters_ingress(inout headers_t hdr, control port_meters_ingress(inout headers_t hdr,
inout standard_metadata_t standard_metadata) { inout standard_metadata_t standard_metadata) {
meter(MAX_PORTS, MeterType.bytes) ingress_port_meter; meter(MAX_PORTS, MeterType.bytes) ingress_port_meter;
MeterColor_t ingress_color = MeterColor_t.GREEN; MeterColor ingress_color = MeterColor_GREEN;
apply { apply {
ingress_port_meter.execute_meter<MeterColor_t>((bit<32>)standard_metadata.ingress_port, ingress_color); ingress_port_meter.execute_meter<MeterColor>((bit<32>)standard_metadata.ingress_port, ingress_color);
if (ingress_color == MeterColor_t.RED) { if (ingress_color == MeterColor_RED) {
mark_to_drop(); mark_to_drop();
} }
} }
@ -35,11 +35,11 @@ control port_meters_egress(inout headers_t hdr,
inout standard_metadata_t standard_metadata) { inout standard_metadata_t standard_metadata) {
meter(MAX_PORTS, MeterType.bytes) egress_port_meter; meter(MAX_PORTS, MeterType.bytes) egress_port_meter;
MeterColor_t egress_color = MeterColor_t.GREEN; MeterColor egress_color = MeterColor_GREEN;
apply { apply {
egress_port_meter.execute_meter<MeterColor_t>((bit<32>)standard_metadata.egress_port, egress_color); egress_port_meter.execute_meter<MeterColor>((bit<32>)standard_metadata.egress_port, egress_color);
if (egress_color == MeterColor_t.RED) { if (egress_color == MeterColor_RED) {
mark_to_drop(); mark_to_drop();
} }
} }

View File

@ -30,6 +30,14 @@ control table0_control(inout headers_t hdr,
local_metadata.next_hop_id = next_hop_id; local_metadata.next_hop_id = next_hop_id;
} }
action send_to_cpu() {
standard_metadata.egress_spec = CPU_PORT;
}
action set_egress_port(port_t port) {
standard_metadata.egress_spec = port;
}
table table0 { table table0 {
key = { key = {
standard_metadata.ingress_port : ternary; standard_metadata.ingress_port : ternary;
@ -43,10 +51,10 @@ control table0_control(inout headers_t hdr,
local_metadata.l4_dst_port : ternary; local_metadata.l4_dst_port : ternary;
} }
actions = { actions = {
set_egress_port(standard_metadata); set_egress_port;
send_to_cpu(standard_metadata); send_to_cpu;
set_next_hop_id(); set_next_hop_id;
_drop(); _drop;
} }
const default_action = _drop(); const default_action = _drop();
counters = table0_counter; counters = table0_counter;

View File

@ -27,6 +27,10 @@ control wcmp_control(inout headers_t hdr,
direct_counter(CounterType.packets_and_bytes) wcmp_table_counter; direct_counter(CounterType.packets_and_bytes) wcmp_table_counter;
action_selector(HashAlgorithm.crc16, 32w64, 32w16) wcmp_selector; action_selector(HashAlgorithm.crc16, 32w64, 32w16) wcmp_selector;
action set_egress_port(port_t port) {
standard_metadata.egress_spec = port;
}
table wcmp_table { table wcmp_table {
support_timeout = false; support_timeout = false;
key = { key = {
@ -38,7 +42,7 @@ control wcmp_control(inout headers_t hdr,
local_metadata.l4_dst_port : selector; local_metadata.l4_dst_port : selector;
} }
actions = { actions = {
set_egress_port(standard_metadata); set_egress_port;
} }
implementation = wcmp_selector; implementation = wcmp_selector;
counters = wcmp_table_counter; counters = wcmp_table_counter;

View File

@ -11,17 +11,14 @@
"fields" : [ "fields" : [
["tmp", 32, false], ["tmp", 32, false],
["tmp_0", 32, false], ["tmp_0", 32, false],
["port_meters_ingress_ingress_color_0", 32, false], ["port_meters_ingress_ingress_color_0", 8, false],
["host_meter_control_tmp_1", 1, false], ["host_meter_control_meter_tag_0", 8, false],
["host_meter_control_tmp_2", 1, false],
["tmp_1", 32, false], ["tmp_1", 32, false],
["tmp_2", 32, false], ["tmp_2", 32, false],
["port_meters_egress_egress_color_0", 32, false], ["port_meters_egress_egress_color_0", 8, false],
["local_metadata_t.l4_src_port", 16, false], ["local_metadata_t.l4_src_port", 16, false],
["local_metadata_t.l4_dst_port", 16, false], ["local_metadata_t.l4_dst_port", 16, false],
["local_metadata_t.next_hop_id", 16, false], ["local_metadata_t.next_hop_id", 16, false]
["local_metadata_t.meter_tag", 32, false],
["_padding_2", 6, false]
] ]
}, },
{ {
@ -37,7 +34,7 @@
"id" : 2, "id" : 2,
"fields" : [ "fields" : [
["ingress_port", 9, false], ["ingress_port", 9, false],
["_padding_0", 7, false] ["_padding", 7, false]
] ]
}, },
{ {
@ -119,7 +116,7 @@
["egress_rid", 16, false], ["egress_rid", 16, false],
["checksum_error", 1, false], ["checksum_error", 1, false],
["recirculate_flag", 32, false], ["recirculate_flag", 32, false],
["_padding_1", 5, false] ["_padding_0", 5, false]
] ]
} }
], ],
@ -194,16 +191,7 @@
["HeaderTooShort", 5], ["HeaderTooShort", 5],
["ParserTimeout", 6] ["ParserTimeout", 6]
], ],
"enums" : [ "enums" : [],
{
"name" : "MeterColor_t",
"entries" : [
["GREEN", 0],
["RED", 2],
["YELLOW", 1]
]
}
],
"parsers" : [ "parsers" : [
{ {
"name" : "parser", "name" : "parser",
@ -467,7 +455,7 @@
"source_info" : { "source_info" : {
"filename" : "include/host_meter_table.p4", "filename" : "include/host_meter_table.p4",
"line" : 27, "line" : 27,
"column" : 43, "column" : 46,
"source_fragment" : "host_meter" "source_fragment" : "host_meter"
}, },
"is_direct" : true, "is_direct" : true,
@ -475,7 +463,7 @@
"type" : "bytes", "type" : "bytes",
"size" : 1024, "size" : 1024,
"binding" : "ingress.host_meter_control.host_meter_table", "binding" : "ingress.host_meter_control.host_meter_table",
"result_target" : ["scalars", "local_metadata_t.meter_tag"] "result_target" : ["scalars", "host_meter_control_meter_tag_0"]
}, },
{ {
"name" : "egress.port_meters_egress.egress_port_meter", "name" : "egress.port_meters_egress.egress_port_meter",
@ -534,97 +522,9 @@
"calculations" : [], "calculations" : [],
"learn_lists" : [], "learn_lists" : [],
"actions" : [ "actions" : [
{
"name" : "set_egress_port",
"id" : 0,
"runtime_data" : [
{
"name" : "port",
"bitwidth" : 9
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "include/actions.p4",
"line" : 28,
"column" : 36,
"source_fragment" : "port; ..."
}
}
]
},
{
"name" : "set_egress_port",
"id" : 1,
"runtime_data" : [
{
"name" : "port",
"bitwidth" : 9
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "include/actions.p4",
"line" : 28,
"column" : 36,
"source_fragment" : "port; ..."
}
}
]
},
{
"name" : "send_to_cpu",
"id" : 2,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "hexstr",
"value" : "0x00ff"
}
],
"source_info" : {
"filename" : "include/defines.p4",
"line" : 28,
"column" : 24,
"source_fragment" : "255; ..."
}
}
]
},
{ {
"name" : "_drop", "name" : "_drop",
"id" : 3, "id" : 0,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [ "primitives" : [
{ {
@ -632,7 +532,7 @@
"parameters" : [], "parameters" : [],
"source_info" : { "source_info" : {
"filename" : "include/actions.p4", "filename" : "include/actions.p4",
"line" : 32, "line" : 24,
"column" : 4, "column" : 4,
"source_fragment" : "mark_to_drop()" "source_fragment" : "mark_to_drop()"
} }
@ -641,19 +541,19 @@
}, },
{ {
"name" : "NoAction", "name" : "NoAction",
"id" : 4, "id" : 1,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [] "primitives" : []
}, },
{ {
"name" : "NoAction", "name" : "NoAction",
"id" : 5, "id" : 2,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [] "primitives" : []
}, },
{ {
"name" : "ingress.table0_control.set_next_hop_id", "name" : "ingress.table0_control.set_next_hop_id",
"id" : 6, "id" : 3,
"runtime_data" : [ "runtime_data" : [
{ {
"name" : "next_hop_id", "name" : "next_hop_id",
@ -682,12 +582,100 @@
} }
] ]
}, },
{
"name" : "ingress.table0_control.send_to_cpu",
"id" : 4,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "hexstr",
"value" : "0x00ff"
}
],
"source_info" : {
"filename" : "include/defines.p4",
"line" : 28,
"column" : 24,
"source_fragment" : "255; ..."
}
}
]
},
{
"name" : "ingress.table0_control.set_egress_port",
"id" : 5,
"runtime_data" : [
{
"name" : "port",
"bitwidth" : 9
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "include/table0.p4",
"line" : 38,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port"
}
}
]
},
{ {
"name" : "ingress.host_meter_control.read_meter", "name" : "ingress.host_meter_control.read_meter",
"id" : 7, "id" : 6,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [] "primitives" : []
}, },
{
"name" : "ingress.wcmp_control.set_egress_port",
"id" : 7,
"runtime_data" : [
{
"name" : "port",
"bitwidth" : 9
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "include/wcmp.p4",
"line" : 31,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port"
}
}
]
},
{ {
"name" : "act", "name" : "act",
"id" : 8, "id" : 8,
@ -801,7 +789,7 @@
"filename" : "include/port_meters.p4", "filename" : "include/port_meters.p4",
"line" : 27, "line" : 27,
"column" : 8, "column" : 8,
"source_fragment" : "ingress_port_meter.execute_meter<MeterColor_t>((bit<32>)standard_metadata.ingress_port, ingress_color)" "source_fragment" : "ingress_port_meter.execute_meter<MeterColor>((bit<32>)standard_metadata.ingress_port, ingress_color)"
} }
} }
] ]
@ -857,23 +845,19 @@
"parameters" : [ "parameters" : [
{ {
"type" : "field", "type" : "field",
"value" : ["scalars", "host_meter_control_tmp_1"] "value" : ["scalars", "host_meter_control_meter_tag_0"]
}, },
{ {
"type" : "expression", "type" : "hexstr",
"value" : { "value" : "0x00"
"type" : "expression",
"value" : {
"op" : "b2d",
"left" : null,
"right" : {
"type" : "bool",
"value" : true
}
}
}
} }
] ],
"source_info" : {
"filename" : "include/defines.p4",
"line" : 31,
"column" : 36,
"source_fragment" : "8w0; ..."
}
} }
] ]
}, },
@ -881,125 +865,13 @@
"name" : "act_3", "name" : "act_3",
"id" : 12, "id" : 12,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "host_meter_control_tmp_1"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "b2d",
"left" : null,
"right" : {
"type" : "bool",
"value" : false
}
}
}
}
]
}
]
},
{
"name" : "act_4",
"id" : 13,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "host_meter_control_tmp_2"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "b2d",
"left" : null,
"right" : {
"type" : "bool",
"value" : false
}
}
}
}
],
"source_info" : {
"filename" : "include/host_meter_table.p4",
"line" : 46,
"column" : 12,
"source_fragment" : "host_meter_table.apply().hit && local_metadata.meter_tag == 2"
}
}
]
},
{
"name" : "act_5",
"id" : 14,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "host_meter_control_tmp_2"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "b2d",
"left" : null,
"right" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["scalars", "local_metadata_t.meter_tag"]
},
"right" : {
"type" : "hexstr",
"value" : "0x00000002"
}
}
}
}
}
}
],
"source_info" : {
"filename" : "include/host_meter_table.p4",
"line" : 46,
"column" : 12,
"source_fragment" : "host_meter_table.apply().hit && local_metadata.meter_tag == 2"
}
}
]
},
{
"name" : "act_6",
"id" : 15,
"runtime_data" : [],
"primitives" : [ "primitives" : [
{ {
"op" : "drop", "op" : "drop",
"parameters" : [], "parameters" : [],
"source_info" : { "source_info" : {
"filename" : "include/host_meter_table.p4", "filename" : "include/host_meter_table.p4",
"line" : 47, "line" : 48,
"column" : 12, "column" : 12,
"source_fragment" : "mark_to_drop()" "source_fragment" : "mark_to_drop()"
} }
@ -1007,8 +879,8 @@
] ]
}, },
{ {
"name" : "act_7", "name" : "act_4",
"id" : 16, "id" : 13,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [ "primitives" : [
{ {
@ -1024,8 +896,8 @@
] ]
}, },
{ {
"name" : "act_8", "name" : "act_5",
"id" : 17, "id" : 14,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [ "primitives" : [
{ {
@ -1119,14 +991,14 @@
"filename" : "include/port_meters.p4", "filename" : "include/port_meters.p4",
"line" : 41, "line" : 41,
"column" : 8, "column" : 8,
"source_fragment" : "egress_port_meter.execute_meter<MeterColor_t>((bit<32>)standard_metadata.egress_port, egress_color)" "source_fragment" : "egress_port_meter.execute_meter<MeterColor>((bit<32>)standard_metadata.egress_port, egress_color)"
} }
} }
] ]
}, },
{ {
"name" : "act_9", "name" : "act_6",
"id" : 18, "id" : 15,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [ "primitives" : [
{ {
@ -1252,7 +1124,7 @@
"id" : 3, "id" : 3,
"source_info" : { "source_info" : {
"filename" : "include/table0.p4", "filename" : "include/table0.p4",
"line" : 33, "line" : 41,
"column" : 10, "column" : 10,
"source_fragment" : "table0" "source_fragment" : "table0"
}, },
@ -1318,17 +1190,40 @@
"with_counters" : true, "with_counters" : true,
"support_timeout" : false, "support_timeout" : false,
"direct_meters" : null, "direct_meters" : null,
"action_ids" : [0, 2, 6, 3], "action_ids" : [5, 4, 3, 0],
"actions" : ["set_egress_port", "send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"], "actions" : ["ingress.table0_control.set_egress_port", "ingress.table0_control.send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
"base_default_next" : "ingress.host_meter_control.host_meter_table", "base_default_next" : "tbl_act_2",
"next_tables" : { "next_tables" : {
"set_egress_port" : "ingress.host_meter_control.host_meter_table", "ingress.table0_control.set_egress_port" : "tbl_act_2",
"send_to_cpu" : "ingress.host_meter_control.host_meter_table", "ingress.table0_control.send_to_cpu" : "tbl_act_2",
"ingress.table0_control.set_next_hop_id" : "ingress.host_meter_control.host_meter_table", "ingress.table0_control.set_next_hop_id" : "tbl_act_2",
"_drop" : "ingress.host_meter_control.host_meter_table" "_drop" : "tbl_act_2"
}, },
"default_entry" : { "default_entry" : {
"action_id" : 3, "action_id" : 0,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_2",
"id" : 4,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [11],
"actions" : ["act_2"],
"base_default_next" : "ingress.host_meter_control.host_meter_table",
"next_tables" : {
"act_2" : "ingress.host_meter_control.host_meter_table"
},
"default_entry" : {
"action_id" : 11,
"action_const" : true, "action_const" : true,
"action_data" : [], "action_data" : [],
"action_entry_const" : true "action_entry_const" : true
@ -1336,7 +1231,7 @@
}, },
{ {
"name" : "ingress.host_meter_control.host_meter_table", "name" : "ingress.host_meter_control.host_meter_table",
"id" : 4, "id" : 5,
"source_info" : { "source_info" : {
"filename" : "include/host_meter_table.p4", "filename" : "include/host_meter_table.p4",
"line" : 33, "line" : 33,
@ -1357,43 +1252,20 @@
"with_counters" : false, "with_counters" : false,
"support_timeout" : false, "support_timeout" : false,
"direct_meters" : "ingress.host_meter_control.host_meter", "direct_meters" : "ingress.host_meter_control.host_meter",
"action_ids" : [7, 4], "action_ids" : [6, 1],
"actions" : ["ingress.host_meter_control.read_meter", "NoAction"], "actions" : ["ingress.host_meter_control.read_meter", "NoAction"],
"base_default_next" : null, "base_default_next" : "node_10",
"next_tables" : { "next_tables" : {
"__HIT__" : "tbl_act_2", "ingress.host_meter_control.read_meter" : "node_10",
"__MISS__" : "tbl_act_3" "NoAction" : "node_10"
}, },
"default_entry" : { "default_entry" : {
"action_id" : 4, "action_id" : 1,
"action_const" : false, "action_const" : false,
"action_data" : [], "action_data" : [],
"action_entry_const" : false "action_entry_const" : false
} }
}, },
{
"name" : "tbl_act_2",
"id" : 5,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [11],
"actions" : ["act_2"],
"base_default_next" : "node_11",
"next_tables" : {
"act_2" : "node_11"
},
"default_entry" : {
"action_id" : 11,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{ {
"name" : "tbl_act_3", "name" : "tbl_act_3",
"id" : 6, "id" : 6,
@ -1406,9 +1278,9 @@
"direct_meters" : null, "direct_meters" : null,
"action_ids" : [12], "action_ids" : [12],
"actions" : ["act_3"], "actions" : ["act_3"],
"base_default_next" : "node_11", "base_default_next" : "node_12",
"next_tables" : { "next_tables" : {
"act_3" : "node_11" "act_3" : "node_12"
}, },
"default_entry" : { "default_entry" : {
"action_id" : 12, "action_id" : 12,
@ -1417,81 +1289,12 @@
"action_entry_const" : true "action_entry_const" : true
} }
}, },
{
"name" : "tbl_act_4",
"id" : 7,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [13],
"actions" : ["act_4"],
"base_default_next" : "node_14",
"next_tables" : {
"act_4" : "node_14"
},
"default_entry" : {
"action_id" : 13,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_5",
"id" : 8,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [14],
"actions" : ["act_5"],
"base_default_next" : "node_14",
"next_tables" : {
"act_5" : "node_14"
},
"default_entry" : {
"action_id" : 14,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_6",
"id" : 9,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [15],
"actions" : ["act_6"],
"base_default_next" : "node_16",
"next_tables" : {
"act_6" : "node_16"
},
"default_entry" : {
"action_id" : 15,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{ {
"name" : "ingress.wcmp_control.wcmp_table", "name" : "ingress.wcmp_control.wcmp_table",
"id" : 10, "id" : 7,
"source_info" : { "source_info" : {
"filename" : "include/wcmp.p4", "filename" : "include/wcmp.p4",
"line" : 30, "line" : 34,
"column" : 10, "column" : 10,
"source_fragment" : "wcmp_table" "source_fragment" : "wcmp_table"
}, },
@ -1510,11 +1313,11 @@
"with_counters" : true, "with_counters" : true,
"support_timeout" : false, "support_timeout" : false,
"direct_meters" : null, "direct_meters" : null,
"action_ids" : [1, 5], "action_ids" : [7, 2],
"actions" : ["set_egress_port", "NoAction"], "actions" : ["ingress.wcmp_control.set_egress_port", "NoAction"],
"base_default_next" : null, "base_default_next" : null,
"next_tables" : { "next_tables" : {
"set_egress_port" : null, "ingress.wcmp_control.set_egress_port" : null,
"NoAction" : null "NoAction" : null
} }
} }
@ -1559,7 +1362,7 @@
"filename" : "include/port_meters.p4", "filename" : "include/port_meters.p4",
"line" : 28, "line" : 28,
"column" : 12, "column" : 12,
"source_fragment" : "ingress_color == MeterColor_t.RED" "source_fragment" : "ingress_color == MeterColor_RED"
}, },
"expression" : { "expression" : {
"type" : "expression", "type" : "expression",
@ -1571,7 +1374,7 @@
}, },
"right" : { "right" : {
"type" : "hexstr", "type" : "hexstr",
"value" : "0x00000002" "value" : "0x02"
} }
} }
}, },
@ -1605,52 +1408,37 @@
"false_next" : "ingress.table0_control.table0" "false_next" : "ingress.table0_control.table0"
}, },
{ {
"name" : "node_11", "name" : "node_10",
"id" : 2, "id" : 2,
"expression" : { "source_info" : {
"type" : "expression", "filename" : "include/host_meter_table.p4",
"value" : { "line" : 47,
"op" : "not", "column" : 12,
"left" : null, "source_fragment" : "meter_tag == MeterColor_RED"
"right" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["scalars", "host_meter_control_tmp_1"]
}
}
}
}
}, },
"true_next" : "tbl_act_4",
"false_next" : "tbl_act_5"
},
{
"name" : "node_14",
"id" : 3,
"expression" : { "expression" : {
"type" : "expression", "type" : "expression",
"value" : { "value" : {
"op" : "d2b", "op" : "==",
"left" : null, "left" : {
"right" : {
"type" : "field", "type" : "field",
"value" : ["scalars", "host_meter_control_tmp_2"] "value" : ["scalars", "host_meter_control_meter_tag_0"]
},
"right" : {
"type" : "hexstr",
"value" : "0x02"
} }
} }
}, },
"true_next" : "tbl_act_6", "true_next" : "tbl_act_3",
"false_next" : "node_16" "false_next" : "node_12"
}, },
{ {
"name" : "node_16", "name" : "node_12",
"id" : 4, "id" : 3,
"source_info" : { "source_info" : {
"filename" : "include/wcmp.p4", "filename" : "include/wcmp.p4",
"line" : 48, "line" : 52,
"column" : 12, "column" : 12,
"source_fragment" : "local_metadata.next_hop_id != 0" "source_fragment" : "local_metadata.next_hop_id != 0"
}, },
@ -1682,11 +1470,11 @@
"column" : 8, "column" : 8,
"source_fragment" : "egress" "source_fragment" : "egress"
}, },
"init_table" : "tbl_act_7", "init_table" : "tbl_act_4",
"tables" : [ "tables" : [
{ {
"name" : "tbl_act_7", "name" : "tbl_act_4",
"id" : 11, "id" : 8,
"key" : [], "key" : [],
"match_type" : "exact", "match_type" : "exact",
"type" : "simple", "type" : "simple",
@ -1694,22 +1482,22 @@
"with_counters" : false, "with_counters" : false,
"support_timeout" : false, "support_timeout" : false,
"direct_meters" : null, "direct_meters" : null,
"action_ids" : [17], "action_ids" : [14],
"actions" : ["act_8"], "actions" : ["act_5"],
"base_default_next" : "node_21", "base_default_next" : "node_17",
"next_tables" : { "next_tables" : {
"act_8" : "node_21" "act_5" : "node_17"
}, },
"default_entry" : { "default_entry" : {
"action_id" : 17, "action_id" : 14,
"action_const" : true, "action_const" : true,
"action_data" : [], "action_data" : [],
"action_entry_const" : true "action_entry_const" : true
} }
}, },
{ {
"name" : "tbl_act_8", "name" : "tbl_act_5",
"id" : 12, "id" : 9,
"key" : [], "key" : [],
"match_type" : "exact", "match_type" : "exact",
"type" : "simple", "type" : "simple",
@ -1717,22 +1505,22 @@
"with_counters" : false, "with_counters" : false,
"support_timeout" : false, "support_timeout" : false,
"direct_meters" : null, "direct_meters" : null,
"action_ids" : [16], "action_ids" : [13],
"actions" : ["act_7"], "actions" : ["act_4"],
"base_default_next" : "node_23", "base_default_next" : "node_19",
"next_tables" : { "next_tables" : {
"act_7" : "node_23" "act_4" : "node_19"
}, },
"default_entry" : { "default_entry" : {
"action_id" : 16, "action_id" : 13,
"action_const" : true, "action_const" : true,
"action_data" : [], "action_data" : [],
"action_entry_const" : true "action_entry_const" : true
} }
}, },
{ {
"name" : "tbl_act_9", "name" : "tbl_act_6",
"id" : 13, "id" : 10,
"key" : [], "key" : [],
"match_type" : "exact", "match_type" : "exact",
"type" : "simple", "type" : "simple",
@ -1740,14 +1528,14 @@
"with_counters" : false, "with_counters" : false,
"support_timeout" : false, "support_timeout" : false,
"direct_meters" : null, "direct_meters" : null,
"action_ids" : [18], "action_ids" : [15],
"actions" : ["act_9"], "actions" : ["act_6"],
"base_default_next" : null, "base_default_next" : null,
"next_tables" : { "next_tables" : {
"act_9" : null "act_6" : null
}, },
"default_entry" : { "default_entry" : {
"action_id" : 18, "action_id" : 15,
"action_const" : true, "action_const" : true,
"action_data" : [], "action_data" : [],
"action_entry_const" : true "action_entry_const" : true
@ -1757,13 +1545,13 @@
"action_profiles" : [], "action_profiles" : [],
"conditionals" : [ "conditionals" : [
{ {
"name" : "node_21", "name" : "node_17",
"id" : 5, "id" : 4,
"source_info" : { "source_info" : {
"filename" : "include/port_meters.p4", "filename" : "include/port_meters.p4",
"line" : 42, "line" : 42,
"column" : 12, "column" : 12,
"source_fragment" : "egress_color == MeterColor_t.RED" "source_fragment" : "egress_color == MeterColor_RED"
}, },
"expression" : { "expression" : {
"type" : "expression", "type" : "expression",
@ -1775,16 +1563,16 @@
}, },
"right" : { "right" : {
"type" : "hexstr", "type" : "hexstr",
"value" : "0x00000002" "value" : "0x02"
} }
} }
}, },
"true_next" : "tbl_act_8", "true_next" : "tbl_act_5",
"false_next" : "node_23" "false_next" : "node_19"
}, },
{ {
"name" : "node_23", "name" : "node_19",
"id" : 6, "id" : 5,
"source_info" : { "source_info" : {
"filename" : "include/packet_io.p4", "filename" : "include/packet_io.p4",
"line" : 37, "line" : 37,
@ -1806,7 +1594,7 @@
} }
}, },
"false_next" : null, "false_next" : null,
"true_next" : "tbl_act_9" "true_next" : "tbl_act_6"
} }
] ]
} }

View File

@ -59,10 +59,10 @@ tables {
match_type: TERNARY match_type: TERNARY
} }
action_refs { action_refs {
id: 16794308 id: 16822046
} }
action_refs { action_refs {
id: 16829080 id: 16783057
} }
action_refs { action_refs {
id: 16777316 id: 16777316
@ -108,7 +108,7 @@ tables {
match_type: EXACT match_type: EXACT
} }
action_refs { action_refs {
id: 16794308 id: 16796092
} }
action_refs { action_refs {
id: 16800567 id: 16800567
@ -118,25 +118,6 @@ tables {
direct_resource_ids: 302034578 direct_resource_ids: 302034578
size: 1024 size: 1024
} }
actions {
preamble {
id: 16794308
name: "set_egress_port"
alias: "set_egress_port"
}
params {
id: 1
name: "port"
bitwidth: 9
}
}
actions {
preamble {
id: 16829080
name: "send_to_cpu"
alias: "send_to_cpu"
}
}
actions { actions {
preamble { preamble {
id: 16784184 id: 16784184
@ -163,6 +144,25 @@ actions {
bitwidth: 16 bitwidth: 16
} }
} }
actions {
preamble {
id: 16783057
name: "ingress.table0_control.send_to_cpu"
alias: "send_to_cpu"
}
}
actions {
preamble {
id: 16822046
name: "ingress.table0_control.set_egress_port"
alias: "table0_control.set_egress_port"
}
params {
id: 1
name: "port"
bitwidth: 9
}
}
actions { actions {
preamble { preamble {
id: 16823832 id: 16823832
@ -170,6 +170,18 @@ actions {
alias: "read_meter" alias: "read_meter"
} }
} }
actions {
preamble {
id: 16796092
name: "ingress.wcmp_control.set_egress_port"
alias: "wcmp_control.set_egress_port"
}
params {
id: 1
name: "port"
bitwidth: 9
}
}
action_profiles { action_profiles {
preamble { preamble {
id: 285253634 id: 285253634
@ -268,6 +280,11 @@ controller_packet_metadata {
name: "ingress_port" name: "ingress_port"
bitwidth: 9 bitwidth: 9
} }
metadata {
id: 2
name: "_padding"
bitwidth: 7
}
} }
controller_packet_metadata { controller_packet_metadata {
preamble { preamble {
@ -280,4 +297,9 @@ controller_packet_metadata {
name: "egress_port" name: "egress_port"
bitwidth: 9 bitwidth: 9
} }
metadata {
id: 2
name: "_padding"
bitwidth: 7
}
} }

View File

@ -18,7 +18,7 @@
["local_metadata_t.l4_dst_port", 16, false], ["local_metadata_t.l4_dst_port", 16, false],
["local_metadata_t.next_hop_id", 16, false], ["local_metadata_t.next_hop_id", 16, false],
["local_metadata_t.selector", 16, false], ["local_metadata_t.selector", 16, false],
["_padding_3", 6, false] ["_padding_2", 6, false]
] ]
}, },
{ {
@ -34,7 +34,7 @@
"id" : 2, "id" : 2,
"fields" : [ "fields" : [
["ingress_port", 9, false], ["ingress_port", 9, false],
["_padding_0", 7, false] ["_padding", 7, false]
] ]
}, },
{ {
@ -208,7 +208,7 @@
["mirror_id", 8, false], ["mirror_id", 8, false],
["flow_id", 16, false], ["flow_id", 16, false],
["metadata_len", 8, false], ["metadata_len", 8, false],
["_padding_1", 6, false] ["_padding_0", 6, false]
] ]
}, },
{ {
@ -235,7 +235,7 @@
["egress_rid", 16, false], ["egress_rid", 16, false],
["checksum_error", 1, false], ["checksum_error", 1, false],
["recirculate_flag", 32, false], ["recirculate_flag", 32, false],
["_padding_2", 5, false] ["_padding_1", 5, false]
] ]
} }
], ],
@ -1037,66 +1037,9 @@
"calculations" : [], "calculations" : [],
"learn_lists" : [], "learn_lists" : [],
"actions" : [ "actions" : [
{
"name" : "set_egress_port",
"id" : 0,
"runtime_data" : [
{
"name" : "port",
"bitwidth" : 9
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "include/actions.p4",
"line" : 28,
"column" : 36,
"source_fragment" : "port; ..."
}
}
]
},
{
"name" : "send_to_cpu",
"id" : 1,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "hexstr",
"value" : "0x00ff"
}
],
"source_info" : {
"filename" : "include/defines.p4",
"line" : 28,
"column" : 24,
"source_fragment" : "255; ..."
}
}
]
},
{ {
"name" : "_drop", "name" : "_drop",
"id" : 2, "id" : 0,
"runtime_data" : [], "runtime_data" : [],
"primitives" : [ "primitives" : [
{ {
@ -1104,7 +1047,7 @@
"parameters" : [], "parameters" : [],
"source_info" : { "source_info" : {
"filename" : "include/actions.p4", "filename" : "include/actions.p4",
"line" : 32, "line" : 24,
"column" : 4, "column" : 4,
"source_fragment" : "mark_to_drop()" "source_fragment" : "mark_to_drop()"
} }
@ -1113,7 +1056,7 @@
}, },
{ {
"name" : "ingress.table0_control.set_next_hop_id", "name" : "ingress.table0_control.set_next_hop_id",
"id" : 3, "id" : 1,
"runtime_data" : [ "runtime_data" : [
{ {
"name" : "next_hop_id", "name" : "next_hop_id",
@ -1142,6 +1085,63 @@
} }
] ]
}, },
{
"name" : "ingress.table0_control.send_to_cpu",
"id" : 2,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "hexstr",
"value" : "0x00ff"
}
],
"source_info" : {
"filename" : "include/defines.p4",
"line" : 28,
"column" : 24,
"source_fragment" : "255; ..."
}
}
]
},
{
"name" : "ingress.table0_control.set_egress_port",
"id" : 3,
"runtime_data" : [
{
"name" : "port",
"bitwidth" : 9
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "include/table0.p4",
"line" : 38,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port"
}
}
]
},
{ {
"name" : "act", "name" : "act",
"id" : 4, "id" : 4,
@ -6076,7 +6076,7 @@
"id" : 2, "id" : 2,
"source_info" : { "source_info" : {
"filename" : "include/table0.p4", "filename" : "include/table0.p4",
"line" : 33, "line" : 41,
"column" : 10, "column" : 10,
"source_fragment" : "table0" "source_fragment" : "table0"
}, },
@ -6142,17 +6142,17 @@
"with_counters" : true, "with_counters" : true,
"support_timeout" : false, "support_timeout" : false,
"direct_meters" : null, "direct_meters" : null,
"action_ids" : [0, 1, 3, 2], "action_ids" : [3, 2, 1, 0],
"actions" : ["set_egress_port", "send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"], "actions" : ["ingress.table0_control.set_egress_port", "ingress.table0_control.send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
"base_default_next" : null, "base_default_next" : null,
"next_tables" : { "next_tables" : {
"set_egress_port" : null, "ingress.table0_control.set_egress_port" : null,
"send_to_cpu" : null, "ingress.table0_control.send_to_cpu" : null,
"ingress.table0_control.set_next_hop_id" : null, "ingress.table0_control.set_next_hop_id" : null,
"_drop" : null "_drop" : null
}, },
"default_entry" : { "default_entry" : {
"action_id" : 2, "action_id" : 0,
"action_const" : true, "action_const" : true,
"action_data" : [], "action_data" : [],
"action_entry_const" : true "action_entry_const" : true
@ -6613,9 +6613,9 @@
"direct_meters" : null, "direct_meters" : null,
"action_ids" : [55], "action_ids" : [55],
"actions" : ["act_2"], "actions" : ["act_2"],
"base_default_next" : "node_29", "base_default_next" : "node_28",
"next_tables" : { "next_tables" : {
"act_2" : "node_29" "act_2" : "node_28"
}, },
"default_entry" : { "default_entry" : {
"action_id" : 55, "action_id" : 55,
@ -6871,38 +6871,12 @@
} }
} }
}, },
"true_next" : "node_25",
"false_next" : "tbl_act_1"
},
{
"name" : "node_25",
"id" : 8,
"source_info" : {
"filename" : "include/int_sink.p4",
"line" : 51,
"column" : 12,
"source_fragment" : "local_metadata.int_meta.sink == 1"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["userMetadata.int_meta", "sink"]
},
"right" : {
"type" : "hexstr",
"value" : "0x01"
}
}
},
"true_next" : "tbl_process_int_sink_restore_header", "true_next" : "tbl_process_int_sink_restore_header",
"false_next" : "tbl_act_1" "false_next" : "tbl_act_1"
}, },
{ {
"name" : "node_29", "name" : "node_28",
"id" : 9, "id" : 8,
"source_info" : { "source_info" : {
"filename" : "include/packet_io.p4", "filename" : "include/packet_io.p4",
"line" : 37, "line" : 37,

View File

@ -59,10 +59,10 @@ tables {
match_type: TERNARY match_type: TERNARY
} }
action_refs { action_refs {
id: 16794308 id: 16822046
} }
action_refs { action_refs {
id: 16829080 id: 16783057
} }
action_refs { action_refs {
id: 16777316 id: 16777316
@ -308,25 +308,6 @@ tables {
direct_resource_ids: 301998415 direct_resource_ids: 301998415
size: 16 size: 16
} }
actions {
preamble {
id: 16794308
name: "set_egress_port"
alias: "set_egress_port"
}
params {
id: 1
name: "port"
bitwidth: 9
}
}
actions {
preamble {
id: 16829080
name: "send_to_cpu"
alias: "send_to_cpu"
}
}
actions { actions {
preamble { preamble {
id: 16784184 id: 16784184
@ -346,6 +327,25 @@ actions {
bitwidth: 16 bitwidth: 16
} }
} }
actions {
preamble {
id: 16783057
name: "ingress.table0_control.send_to_cpu"
alias: "send_to_cpu"
}
}
actions {
preamble {
id: 16822046
name: "ingress.table0_control.set_egress_port"
alias: "set_egress_port"
}
params {
id: 1
name: "port"
bitwidth: 9
}
}
actions { actions {
preamble { preamble {
id: 16800567 id: 16800567
@ -782,6 +782,11 @@ controller_packet_metadata {
name: "ingress_port" name: "ingress_port"
bitwidth: 9 bitwidth: 9
} }
metadata {
id: 2
name: "_padding"
bitwidth: 7
}
} }
controller_packet_metadata { controller_packet_metadata {
preamble { preamble {
@ -794,4 +799,9 @@ controller_packet_metadata {
name: "egress_port" name: "egress_port"
bitwidth: 9 bitwidth: 9
} }
metadata {
id: 2
name: "_padding"
bitwidth: 7
}
} }