Commit bc8d9766 authored by Shah Rinku's avatar Shah Rinku

Adding preliminary modules for dispatching at NIC

parent 128b235b
{"id":"192.168.0.106","master_node":"192.168.0.105"} {"id":"10.129.2.201","master_node":"192.168.0.105"}
\ No newline at end of file \ No newline at end of file
...@@ -97,19 +97,32 @@ function runContainer(metadata) { ...@@ -97,19 +97,32 @@ function runContainer(metadata) {
else { else {
let process = null; let process = null;
if (constants.network.use_bridge) if (constants.network.use_bridge)
process = spawn('docker', ["run", "--rm", `--network=${constants.network.network_bridge}`, "-p", `${port}:${port}`, process = spawn('docker', ["create", "--rm", `--network=${constants.network.network_bridge}`, "-p", `${port}:${port}`,
"--name", resource_id, registry_url + imageName, "-p", `${port}:${port}/udp`, "--name", resource_id, registry_url + imageName,
resource_id, imageName, port, "container", constants.network.internal.kafka_host]); resource_id, imageName, port, "container", constants.network.internal.kafka_host]);
else else
process = spawn('docker', ["run", "--rm", "-p", `${port}:${port}`, process = spawn('docker', ["create", "--rm", "-p", `${port}:${port}`,
"--name", resource_id, registry_url + imageName, "-p", `${port}:${port}/udp`, "--name", resource_id, registry_url + imageName,
resource_id, imageName, port, "container", constants.network.internal.kafka_host]); resource_id, imageName, port, "container", constants.network.internal.kafka_host]);
let result = ""; let result = "";
// timeStart = Date.now() // timeStart = Date.now()
process.stdout.on('data', (data) => { process.stdout.on('data', (data) => {
logger.info(`stdout: ${data}`); logger.info(`stdout: ${data}`);
let timeDifference = Math.ceil((Date.now() - timeStart)) let timeDifference = Math.ceil((Date.now() - timeStart))
logger.info("container run time taken: ", timeDifference); logger.info("container run time taken: ", timeDifference);
let add_network = spawn('docker', ['network', 'connect', 'pub_net', resource_id])
let _ = spawn('docker', ['start', resource_id])
_.on('data', (data) => {
console.log("container started", data);
})
// add_network.stderr.on('data', (data) => {
// // console.log("network add error", data);
// })
add_network.on('close', (code) => {
logger.info("Ran command");
})
result += data; result += data;
resolve(resource_id); resolve(resource_id);
}); });
...@@ -129,21 +142,43 @@ function runContainer(metadata) { ...@@ -129,21 +142,43 @@ function runContainer(metadata) {
} else { } else {
logger.info("container starting at port", port); logger.info("container starting at port", port);
let process = null; let process = null;
/**
* create docker on the default bridge
*/
if (constants.network.use_bridge) if (constants.network.use_bridge)
process = spawn('docker', ["run", "--rm", `--network=${constants.network.network_bridge}`, process = spawn('docker', ["create", "--rm", `--network=${constants.network.network_bridge}`,
"-p", `${port}:${port}`, "--name", resource_id, "-p", `${port}:${port}`, "-p", `${port}:${port}/udp`, "--name", resource_id,
registry_url + imageName, resource_id, imageName, port, "container", constants.network.internal.kafka_host]); registry_url + imageName, resource_id, imageName, port, "container", constants.network.internal.kafka_host]);
else else
process = spawn('docker', ["run", "--rm", process = spawn('docker', ["create",
"-p", `${port}:${port}`, "--name", resource_id, "-p", `${port}:${port}`, "-p", `${port}:${port}/udp`, "--name", resource_id,
registry_url + imageName, resource_id, imageName, port, "container", constants.network.internal.kafka_host]); registry_url + imageName, resource_id, imageName, port, "container", constants.network.internal.kafka_host]);
let result = ""; let result = "";
// timeStart = Date.now() // timeStart = Date.now()
process.stdout.on('data', (data) => { process.stdout.on('data', (data) => {
logger.info(`stdout: ${data}`); logger.info(`stdout: ${data.toString()}`);
let timeDifference = Math.ceil((Date.now() - timeStart)) let timeDifference = Math.ceil((Date.now() - timeStart))
logger.info("container run time taken: ", timeDifference); logger.info("container run time taken: ", timeDifference);
/**
* attach smartnic interface
*/
let add_network = spawn('docker', ['network', 'connect', 'pub_net', resource_id])
let _ = spawn('docker', ['start', resource_id])
_.stdout.on('data', (data) => {
logger.info(data.toString())
resolve(resource_id); resolve(resource_id);
})
_.stderr.on('data', (data) => {
logger.info(data.toString())
})
_.on('close', (data) => {
logger.info("exit exit")
logger.info(data.toString())
})
}); });
process.stderr.on('data', (data) => { process.stderr.on('data', (data) => {
......
...@@ -21,7 +21,7 @@ function updateConfig() { ...@@ -21,7 +21,7 @@ function updateConfig() {
data = data.substr(0, data.indexOf("\n")).trim() data = data.substr(0, data.indexOf("\n")).trim()
data = data.split(' ') data = data.split(' ')
file.id = data[data.length - 3] file.id = data[data.length - 1]
fs.writeFileSync('./config.json', JSON.stringify(file)); fs.writeFileSync('./config.json', JSON.stringify(file));
console.log("Updated Config file"); console.log("Updated Config file");
} }
......
...@@ -295,6 +295,15 @@ function postDeploy(message) { ...@@ -295,6 +295,15 @@ function postDeploy(message) {
return; return;
} }
/**
* IP changes in case MACVLAN is used to connect worker endpoints
*/
if (resourceMap.has(message.resource_id)) {
let resource = resourceMap.get(message.resource_id)
resource.node_id = message.node_id.trim()
}
if (functionToResource.has(id)) { if (functionToResource.has(id)) {
let resourceHeap = functionToResource.get(id) let resourceHeap = functionToResource.get(id)
heap.push(resourceHeap, { heap.push(resourceHeap, {
...@@ -621,6 +630,6 @@ async function speculative_deployment(req, runtime) { ...@@ -621,6 +630,6 @@ async function speculative_deployment(req, runtime) {
} }
} }
setInterval(libSupport.metrics.broadcastMetrics, 5000) setInterval(libSupport.metrics.broadcastMetrics, 5000)
setInterval(autoscalar, 1000); // setInterval(autoscalar, 1000);
setInterval(dispatch, 1000); setInterval(dispatch, 1000);
app.listen(port, () => logger.info(`Server listening on port ${port}!`)) app.listen(port, () => logger.info(`Server listening on port ${port}!`))
\ No newline at end of file
jspack @ 4753fb1a
Subproject commit 4753fb1a8deb8e2871d34dda049cb01958137f6b
...@@ -75,7 +75,7 @@ function generateExecutor(functionPath, functionHash) { ...@@ -75,7 +75,7 @@ function generateExecutor(functionPath, functionHash) {
* @param {JSON} res Object to use to return the response to the user * @param {JSON} res Object to use to return the response to the user
*/ */
async function reverseProxy(req, res) { async function reverseProxy(req, res) {
if (req.headers['x-chain-type'] !== 'explicit') if (req.headers['x-chain-type'] !== 'explicit' && req.body.type === "tcp")
branchChainPredictor(req) branchChainPredictor(req)
let runtime = req.body.runtime let runtime = req.body.runtime
let id = req.params.id + runtime let id = req.params.id + runtime
...@@ -148,11 +148,11 @@ async function reverseProxy(req, res) { ...@@ -148,11 +148,11 @@ async function reverseProxy(req, res) {
req.body.request_id = request_id req.body.request_id = request_id
// res.request_id = request_id // res.request_id = request_id
requestFlightQueue.set(request_id, res) requestFlightQueue.set(request_id, res)
let payload = req.body.payload let payload = req.body
payload.request_id = request_id payload.request_id = request_id
payload = JSON.stringify(payload) payload = JSON.stringify(payload)
udpProxy.send(payload, 0, payload.length, resource.port, resource.node_id, function (err, bytes) { udpProxy.send(payload, 0, payload.length, resource.port, resource.node_id, function (err, bytes) {
logger.info("forwarded request via UDP") // logger.info(`forwarded request via UDP, IP 192.168.2.5 Port ${resource.port}`)
}) })
} }
} }
......
#
# Generated Makefile for echo
#
ifndef SDKDIR
export SDKDIR=/opt/netronome
endif
ifndef SDKTOOLSDIR
SDKTOOLSDIR=$(SDKDIR)/bin
endif
ifndef SDKP4DIR
SDKP4DIR=$(SDKDIR)/p4
endif
ifndef OUTDIR
OUTDIR=p4src
endif
ifndef PIFOUTDIR
PIFOUTDIR=p4src/out
endif
NFP4C_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfp4c ]; then echo "found"; fi)
ifneq ($(NFP4C_FOUND),found)
$(warning warning: nfp4c not found or not executable, on windows please run nfp4term.bat)
endif
NFIRC_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfirc ]; then echo "found"; fi)
ifneq ($(NFIRC_FOUND),found)
$(warning warning: nfirc not found or not executable, on windows please run nfp4term.bat)
endif
NFLD_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfld ]; then echo "found"; fi)
ifneq ($(NFLD_FOUND),found)
$(warning warning: nfld not found or not executable, on windows please run nfp4term.bat)
endif
NFCC_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfcc ]; then echo "found"; fi)
ifneq ($(NFCC_FOUND),found)
$(warning warning: nfcc not found or not executable, on windows please run nfp4term.bat)
endif
NFAS_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfas ]; then echo "found"; fi)
ifneq ($(NFAS_FOUND),found)
$(warning warning: nfas not found or not executable, on windows please run nfp4term.bat)
endif
NFP4C_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfp4c ]; then echo "found"; fi)
ifneq ($(NFP4C_FOUND),found)
$(warning warning: nfp4c not found or not executable, on windows please run nfp4term.bat)
endif
NFIRC_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfirc ]; then echo "found"; fi)
ifneq ($(NFIRC_FOUND),found)
$(warning warning: nfirc not found or not executable, on windows please run nfp4term.bat)
endif
NFLD_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfld ]; then echo "found"; fi)
ifneq ($(NFLD_FOUND),found)
$(warning warning: nfld not found or not executable, on windows please run nfp4term.bat)
endif
NFCC_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfcc ]; then echo "found"; fi)
ifneq ($(NFCC_FOUND),found)
$(warning warning: nfcc not found or not executable, on windows please run nfp4term.bat)
endif
NFAS_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfas ]; then echo "found"; fi)
ifneq ($(NFAS_FOUND),found)
$(warning warning: nfas not found or not executable, on windows please run nfp4term.bat)
endif
NFP4C_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfp4c ]; then echo "found"; fi)
ifneq ($(NFP4C_FOUND),found)
$(warning warning: nfp4c not found or not executable, on windows please run nfp4term.bat)
endif
NFIRC_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfirc ]; then echo "found"; fi)
ifneq ($(NFIRC_FOUND),found)
$(warning warning: nfirc not found or not executable, on windows please run nfp4term.bat)
endif
NFLD_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfld ]; then echo "found"; fi)
ifneq ($(NFLD_FOUND),found)
$(warning warning: nfld not found or not executable, on windows please run nfp4term.bat)
endif
NFCC_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfcc ]; then echo "found"; fi)
ifneq ($(NFCC_FOUND),found)
$(warning warning: nfcc not found or not executable, on windows please run nfp4term.bat)
endif
NFAS_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfas ]; then echo "found"; fi)
ifneq ($(NFAS_FOUND),found)
$(warning warning: nfas not found or not executable, on windows please run nfp4term.bat)
endif
NFP4C_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfp4c ]; then echo "found"; fi)
ifneq ($(NFP4C_FOUND),found)
$(warning warning: nfp4c not found or not executable, on windows please run nfp4term.bat)
endif
NFIRC_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfirc ]; then echo "found"; fi)
ifneq ($(NFIRC_FOUND),found)
$(warning warning: nfirc not found or not executable, on windows please run nfp4term.bat)
endif
NFLD_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfld ]; then echo "found"; fi)
ifneq ($(NFLD_FOUND),found)
$(warning warning: nfld not found or not executable, on windows please run nfp4term.bat)
endif
NFCC_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfcc ]; then echo "found"; fi)
ifneq ($(NFCC_FOUND),found)
$(warning warning: nfcc not found or not executable, on windows please run nfp4term.bat)
endif
NFAS_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfas ]; then echo "found"; fi)
ifneq ($(NFAS_FOUND),found)
$(warning warning: nfas not found or not executable, on windows please run nfp4term.bat)
endif
$(OUTDIR)/echo.nffw: $(OUTDIR)/nfd_pcie0_pd0.list/nfd_pcie0_pd0.list \
$(OUTDIR)/nfd_pcie0_pci_in_issue1.list/nfd_pcie0_pci_in_issue1.list \
$(OUTDIR)/nfd_pcie0_pci_out_me0.list/nfd_pcie0_pci_out_me0.list \
$(OUTDIR)/nbi_init_csr.list/nbi_init_csr.list \
$(OUTDIR)/nfd_pcie0_pd1.list/nfd_pcie0_pd1.list \
$(OUTDIR)/nfd_pcie0_pci_in_issue0.list/nfd_pcie0_pci_in_issue0.list \
$(OUTDIR)/gro1.list/gro1.list \
$(OUTDIR)/pif_app_nfd.list/pif_app_nfd.list \
$(OUTDIR)/app_master.list/app_master.list \
$(OUTDIR)/nfd_svc.list/nfd_svc.list \
$(OUTDIR)/blm0.list/blm0.list \
$(OUTDIR)/gro0.list/gro0.list \
$(OUTDIR)/nfd_pcie0_notify.list/nfd_pcie0_notify.list \
$(OUTDIR)/nfd_pcie0_pci_in_gather.list/nfd_pcie0_pci_in_gather.list \
$(OUTDIR)/flowcache_timeout_emu0.list/flowcache_timeout_emu0.list \
$(OUTDIR)/nfd_pcie0_sb.list/nfd_pcie0_sb.list \
$(PIFOUTDIR)/build_info.json \
$(MAKEFILE_LIST)
@echo ---------
@echo linking $@
@echo ---------
$(SDKTOOLSDIR)/nfld -rtsyms -mip -user_note_f pif_debug_json "$(PIFOUTDIR)/pif_debug.json" -user_note_f build_info_json "$(PIFOUTDIR)/build_info.json" -g -user_note_f pif_design_json "$(PIFOUTDIR)/pif_design.json" \
-i i8 -e $(SDKDIR)/components/standardlibrary/picocode/nfp6000/catamaran/catamaran.npfw \
-chip nfp-4xxxc-b0 -g -o $@ \
-u i36.me9 $(OUTDIR)/nfd_pcie0_pd0.list/nfd_pcie0_pd0.list \
-u pcie0.me3 $(OUTDIR)/nfd_pcie0_pci_in_issue1.list/nfd_pcie0_pci_in_issue1.list \
-u pcie0.me0 $(OUTDIR)/nfd_pcie0_pci_out_me0.list/nfd_pcie0_pci_out_me0.list \
-u i36.me7 $(OUTDIR)/nfd_pcie0_pd1.list/nfd_pcie0_pd1.list \
-u pcie0.me2 $(OUTDIR)/nfd_pcie0_pci_in_issue0.list/nfd_pcie0_pci_in_issue0.list \
-u i48.me1 $(OUTDIR)/gro1.list/gro1.list \
-u i32.me0 i33.me0 i34.me0 i35.me0 i36.me0 i32.me1 i33.me1 \
i34.me1 i35.me1 i36.me1 i32.me2 i33.me2 i34.me2 i35.me2 \
i36.me2 i32.me3 i33.me3 i34.me3 i35.me3 i36.me3 i32.me4 \
i33.me4 i34.me4 i35.me4 i36.me4 i32.me5 i33.me5 i34.me5 \
i35.me5 i36.me5 i32.me6 i33.me6 i34.me6 i35.me6 i32.me7 \
i33.me7 i34.me7 i35.me7 i32.me8 i33.me8 i34.me8 i35.me8 \
i32.me9 i33.me9 i34.me9 i35.me9 i32.me10 i33.me10 i34.me10 \
i35.me10 i32.me11 i33.me11 i34.me11 i35.me11 $(OUTDIR)/pif_app_nfd.list/pif_app_nfd.list \
-u i36.me11 $(OUTDIR)/app_master.list/app_master.list \
-u i48.me2 $(OUTDIR)/nfd_svc.list/nfd_svc.list \
-u i48.me3 $(OUTDIR)/blm0.list/blm0.list \
-u i48.me0 $(OUTDIR)/gro0.list/gro0.list \
-u i36.me6 $(OUTDIR)/nfd_pcie0_notify.list/nfd_pcie0_notify.list \
-u pcie0.me1 $(OUTDIR)/nfd_pcie0_pci_in_gather.list/nfd_pcie0_pci_in_gather.list \
-u i36.me10 $(OUTDIR)/flowcache_timeout_emu0.list/flowcache_timeout_emu0.list \
-u i36.me8 $(OUTDIR)/nfd_pcie0_sb.list/nfd_pcie0_sb.list \
-L $(OUTDIR)/nbi_init_csr.list/nbi_init_csr.list
#
# Generate build info json
#
$(PIFOUTDIR)/build_info.json: $(MAKEFILE_LIST)
@echo ---------
@echo generating $@
@echo ---------
@mkdir -p $(PIFOUTDIR)
@echo -n {\"sku\": \"nfp-4xxxc-b0\", \"worker_mes\": [\"i32.me0\", \"i33.me0\", \"i34.me0\", \"i35.me0\", \"i36.me0\", \"i32.me1\", \"i33.me1\", \"i34.me1\", \"i35.me1\", \"i36.me1\", \"i32.me2\", \"i33.me2\", \"i34.me2\", \"i35.me2\", \"i36.me2\", \"i32.me3\", \"i33.me3\", \"i34.me3\", \"i35.me3\", \"i36.me3\", \"i32.me4\", \"i33.me4\", \"i34.me4\", \"i35.me4\", \"i36.me4\", \"i32.me5\", \"i33.me5\", \"i34.me5\", \"i35.me5\", \"i36.me5\", \"i32.me6\", \"i33.me6\", \"i34.me6\", \"i35.me6\", \"i32.me7\", \"i33.me7\", \"i34.me7\", \"i35.me7\", \"i32.me8\", \"i33.me8\", \"i34.me8\", \"i35.me8\", \"i32.me9\", \"i33.me9\", \"i34.me9\", \"i35.me9\", \"i32.me10\", \"i33.me10\", \"i34.me10\", \"i35.me10\", \"i32.me11\", \"i33.me11\", \"i34.me11\", \"i35.me11\"], \"reduced_thread_usage\": true, \"debug_info\": true, \"simulation\": false} >$@
#
# Generate IR from P4
#
$(OUTDIR)/echo.yml: p4src/echo.p4 \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling p4 $@
@echo ---------
@mkdir -p $(PIFOUTDIR)
$(SDKP4DIR)/bin/nfp4c -o $(OUTDIR)/echo.yml \
--p4-version 16 \
--p4-compiler p4c-nfp \
--source_info \
p4src/echo.p4
#
# Generate PIF from IR
#
$(PIFOUTDIR)/pif_design%c \
$(PIFOUTDIR)/pif_design%h \
$(PIFOUTDIR)/pif_parrep%c \
$(PIFOUTDIR)/pif_parrep%h \
$(PIFOUTDIR)/pif_actions%c \
$(PIFOUTDIR)/pif_actions%h \
$(PIFOUTDIR)/pif_global%c \
$(PIFOUTDIR)/pif_global%h \
$(PIFOUTDIR)/pif_ctlflow%c \
$(PIFOUTDIR)/pif_ctlflow%h \
$(PIFOUTDIR)/pif_tables%c \
$(PIFOUTDIR)/pif_tables%h \
$(PIFOUTDIR)/pif_deparse%c \
$(PIFOUTDIR)/pif_digests%c \
$(PIFOUTDIR)/pif_digests%h \
$(PIFOUTDIR)/pif_meters%c \
$(PIFOUTDIR)/pif_meters%h \
$(PIFOUTDIR)/pif_registers%c \
$(PIFOUTDIR)/pif_registers%h \
$(PIFOUTDIR)/pif_pkt_recurse%c \
$(PIFOUTDIR)/pif_pkt_recurse%h \
$(PIFOUTDIR)/pif_pkt_clone%c \
$(PIFOUTDIR)/pif_pkt_clone%h \
$(PIFOUTDIR)/pif_flcalc%c \
$(PIFOUTDIR)/pif_flcalc%h \
$(PIFOUTDIR)/pif_field_lists%h \
$(PIFOUTDIR)/pif_parrep_pvs_sync%c : $(OUTDIR)/echo%yml $(MAKEFILE_LIST)
@echo ---------
@echo generating pif $@
@echo ---------
@mkdir -p $(PIFOUTDIR)
$(SDKP4DIR)/bin/nfirc -o $(PIFOUTDIR)/ \
--p4info $(OUTDIR)/echo.p4info.json \
--debugpoints \
$(OUTDIR)/echo.yml
#
# NFD_PCIE0_PD0
#
$(OUTDIR)/nfd_pcie0_pd0.list/nfd_pcie0_pd0.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_pd.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pd0.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DSTAGE_BATCH_MANAGER_CTX=0 \
-DNFD_OUT_SB_WQ_NUM=15 \
-DNFD_OUT_STAGE_ME="__nfp_idstr2meid(\"i36.me8\")" \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-go \
-t \
-W3 \
-R \
-lm 0 \
-C \
-Of \
-Os \
-O \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_uc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_pd.uc
#
# NFD_PCIE0_PCI_IN_ISSUE1
#
$(OUTDIR)/nfd_pcie0_pci_in_issue1.list/nfd_pcie0_pci_in_issue1.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me1.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pci_in_issue1.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_IN_NOTIFY_ME="__nfp_idstr2meid(\"i36.me6\")" \
-DPCI_IN_ISSUE_DMA_IDX=1 \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=4 \
-Qnctx_mode=4 \
-Qlmpt_reserve_option=0xc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_pci_in_issue1.list/ \
-Fe$(OUTDIR)/nfd_pcie0_pci_in_issue1.list/nfd_pcie0_pci_in_issue1 $(NFCC_FLAGS) \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me1.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# NFD_PCIE0_PCI_OUT_ME0
#
$(OUTDIR)/nfd_pcie0_pci_out_me0.list/nfd_pcie0_pci_out_me0.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_me0.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pci_out_me0.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_CFG_SIG_NEXT_ME="nfd_cfg_sig_sb" \
-DNFD_CFG_NEXT_ME="__nfp_idstr2meid(\"i36.me8\")" \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-Qlm_start=512 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_pci_out_me0.list/ \
-Fe$(OUTDIR)/nfd_pcie0_pci_out_me0.list/nfd_pcie0_pci_out_me0 $(NFCC_FLAGS) \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_me0.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# NBI_INIT_CSR
#
$(OUTDIR)/nbi_init_csr.list/nbi_init_csr.list: $(SDKP4DIR)/components/nfp_pif/me/apps/common/src/nbi_init.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/nbi_init_csr.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-chip nfp-4xxxc-b0 \
-go \
-W3 \
-R \
-C \
-permit_dram_unaligned \
-preproc64 \
-keep_unreachable_code \
-lm 0 \
-codeless \
-I$(SDKDIR)/components/flowenv/me/blocks/init \
-I$(SDKDIR)/components/flowenv/me/blocks/init/_uc \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKP4DIR)/components/nfp_pif/me/apps/common/src/nbi_init.uc
#
# NFD_PCIE0_PD1
#
$(OUTDIR)/nfd_pcie0_pd1.list/nfd_pcie0_pd1.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_pd.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pd1.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DSTAGE_BATCH_MANAGER_CTX=0 \
-DNFD_OUT_SB_WQ_NUM=15 \
-DNFD_OUT_STAGE_ME="__nfp_idstr2meid(\"i36.me8\")" \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-go \
-t \
-W3 \
-R \
-lm 0 \
-C \
-Of \
-Os \
-O \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_uc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_pd.uc
#
# NFD_PCIE0_PCI_IN_ISSUE0
#
$(OUTDIR)/nfd_pcie0_pci_in_issue0.list/nfd_pcie0_pci_in_issue0.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me1.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pci_in_issue0.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_IN_NOTIFY_ME="__nfp_idstr2meid(\"i36.me6\")" \
-DPCI_IN_ISSUE_DMA_IDX=0 \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=4 \
-Qnctx_mode=4 \
-Qlmpt_reserve_option=0xc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_pci_in_issue0.list/ \
-Fe$(OUTDIR)/nfd_pcie0_pci_in_issue0.list/nfd_pcie0_pci_in_issue0 $(NFCC_FLAGS) \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me1.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# GRO1
#
$(OUTDIR)/gro1.list/gro1.list: $(SDKP4DIR)/components/gro/me/gro_out.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/gro1.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_VERSION=0x03010000 \
-DNFP_LIB_ANY_NFAS_VERSION \
-DGRO_BLOCK_NUM=1 \
-chip nfp-4xxxc-b0 \
-go \
-W3 \
-R \
-C \
-indirect_ref_format_nfp6000 \
-third_party_addressing_40_bit \
-permit_dram_unaligned \
-preproc64 \
-keep_unreachable_code \
-lm 0 \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/gro \
-I$(SDKP4DIR)/components/gro/me \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKP4DIR)/components/gro/me/gro_out.uc
#
# PIF_APP_NFD
#
$(OUTDIR)/pif_app_nfd.list/pif_app_nfd.list: $(SDKP4DIR)/components/nfp_pif/me/apps/common/src/fc.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/src/camp_hash.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_cam_add_inc.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cam.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pif_app_nfd.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pkt_clone.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/mcast.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pif_app_controller.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/cflow_tstamp/src/cflow_tstamp.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKDIR)/components/flowenv/me/lib/pktio/libpktio.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/libnfd.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflushuser.c \
$(PIFOUTDIR)/pif_design.c \
$(PIFOUTDIR)/pif_parrep.c \
$(PIFOUTDIR)/pif_actions.c \
$(PIFOUTDIR)/pif_global.c \
$(PIFOUTDIR)/pif_ctlflow.c \
$(PIFOUTDIR)/pif_tables.c \
$(PIFOUTDIR)/pif_deparse.c \
$(PIFOUTDIR)/pif_digests.c \
$(PIFOUTDIR)/pif_meters.c \
$(PIFOUTDIR)/pif_registers.c \
$(PIFOUTDIR)/pif_pkt_recurse.c \
$(PIFOUTDIR)/pif_pkt_clone.c \
$(PIFOUTDIR)/pif_flcalc.c \
$(SDKP4DIR)/components/gro/libgro.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/mac_time_user.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_action_common.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_meter.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_lookup.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_pkt.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_counters.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_init.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_flcalc_algorithms.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_memops.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
p4src/prime.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/pif_app_nfd.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DPIF_APP_MASTER_ME=0x204 \
-DHASHMAP_CAMPHASH \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=4 \
-Qnctx_mode=4 \
-Qnn_mode=1 \
-Qspill=3 \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/include \
-I$(SDKP4DIR)/components/flowcache/me/lib/flowcache \
-I$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/cflow_tstamp/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/nfp_pif/shared/include \
-I$(SDKDIR)/components/ng_nfd/me/lib \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/lib \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/gro \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/pif/include \
-I$(SDKP4DIR)/components/dcfl/me/lib/dcfl \
-I$(SDKP4DIR)/components/dcfl/shared/include/dcfl \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/pif_app_nfd.list/ \
-Fe$(OUTDIR)/pif_app_nfd.list/pif_app_nfd $(NFCC_FLAGS) \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/fc.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/src/camp_hash.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_cam_add_inc.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cam.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pif_app_nfd.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pkt_clone.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/mcast.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pif_app_controller.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/cflow_tstamp/src/cflow_tstamp.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKDIR)/components/flowenv/me/lib/pktio/libpktio.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/libnfd.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflushuser.c \
$(PIFOUTDIR)/pif_design.c \
$(PIFOUTDIR)/pif_parrep.c \
$(PIFOUTDIR)/pif_actions.c \
$(PIFOUTDIR)/pif_global.c \
$(PIFOUTDIR)/pif_ctlflow.c \
$(PIFOUTDIR)/pif_tables.c \
$(PIFOUTDIR)/pif_deparse.c \
$(PIFOUTDIR)/pif_digests.c \
$(PIFOUTDIR)/pif_meters.c \
$(PIFOUTDIR)/pif_registers.c \
$(PIFOUTDIR)/pif_pkt_recurse.c \
$(PIFOUTDIR)/pif_pkt_clone.c \
$(PIFOUTDIR)/pif_flcalc.c \
$(SDKP4DIR)/components/gro/libgro.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/mac_time_user.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_action_common.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_meter.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_lookup.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_pkt.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_counters.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_init.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_flcalc_algorithms.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_memops.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
p4src/prime.c
#
# APP_MASTER
#
$(OUTDIR)/app_master.list/app_master.list: $(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/src/camp_hash.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/libnfd.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflushuser.c \
$(SDKP4DIR)/components/gro/libgro.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/src/app_master.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/app_master_common.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_init.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/mac_time.c \
$(PIFOUTDIR)/pif_digests.c \
$(PIFOUTDIR)/pif_parrep_pvs_sync.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflush.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_cam_add_inc.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cam.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/app_master.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DPKT_MOD_SCRIPT_INIT_CSR \
-DGLOBAL_INIT \
-DHASHMAP_CAMPHASH \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-Qnn_mode=1 \
-Qspill=3 \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/nfp_pif/shared/include \
-I$(SDKDIR)/components/ng_nfd/me/lib \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/lib \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/gro \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/pif/include \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/macflush \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKP4DIR)/components/flowcache/me/lib/flowcache \
-I$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary \
-I$(SDKP4DIR)/components/dcfl/me/lib/dcfl \
-I$(SDKP4DIR)/components/dcfl/shared/include/dcfl \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/app_master.list/ \
-Fe$(OUTDIR)/app_master.list/app_master $(NFCC_FLAGS) \
$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/src/camp_hash.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/libnfd.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflushuser.c \
$(SDKP4DIR)/components/gro/libgro.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/src/app_master.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/app_master_common.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_init.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/mac_time.c \
$(PIFOUTDIR)/pif_digests.c \
$(PIFOUTDIR)/pif_parrep_pvs_sync.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflush.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_cam_add_inc.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cam.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c
#
# NFD_SVC
#
$(OUTDIR)/nfd_svc.list/nfd_svc.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/svc_me.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_svc.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_CFG_NEXT_ME0="__nfp_idstr2meid(\"i36.me11\")" \
-DNFD_CFG_SIG_NEXT_ME0="nfd_cfg_sig_app_master0" \
-DNFD_CFG_NEXT_ME1="__nfp_idstr2meid(\"i36.me11\")" \
-DNFD_CFG_SIG_NEXT_ME1="nfd_cfg_sig_app_master1" \
-DNFD_CFG_NEXT_ME2="__nfp_idstr2meid(\"i36.me11\")" \
-DNFD_CFG_SIG_NEXT_ME2="nfd_cfg_sig_app_master2" \
-DNFD_CFG_NEXT_ME3="__nfp_idstr2meid(\"i36.me11\")" \
-DNFD_CFG_SIG_NEXT_ME3="nfd_cfg_sig_app_master3" \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-Qnn_mode=1 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_svc.list/ \
-Fe$(OUTDIR)/nfd_svc.list/nfd_svc $(NFCC_FLAGS) \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/svc_me.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# BLM0
#
$(OUTDIR)/blm0.list/blm0.list: $(SDKDIR)/components/flowenv/me/blocks/blm/blm_main.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/blm0.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DBLM_0_ISLAND_48 \
-DNBII=8 \
-DBLM_INSTANCE_ID=0 \
-DBLM_INIT_EMU_RINGS \
-DBLM_BLQ_EMEM_TYPE=emem \
-chip nfp-4xxxc-b0 \
-go \
-W3 \
-R \
-C \
-Of \
-Os \
-O \
-indirect_ref_format_nfp6000 \
-third_party_addressing_40_bit \
-permit_dram_unaligned \
-preproc64 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_uc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKDIR)/components/flowenv/me/blocks/blm/blm_main.uc
#
# GRO0
#
$(OUTDIR)/gro0.list/gro0.list: $(SDKP4DIR)/components/gro/me/gro_out.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/gro0.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_VERSION=0x03010000 \
-DNFP_LIB_ANY_NFAS_VERSION \
-DGRO_BLOCK_NUM=0 \
-chip nfp-4xxxc-b0 \
-go \
-W3 \
-R \
-C \
-indirect_ref_format_nfp6000 \
-third_party_addressing_40_bit \
-permit_dram_unaligned \
-preproc64 \
-keep_unreachable_code \
-lm 0 \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/gro \
-I$(SDKP4DIR)/components/gro/me \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKP4DIR)/components/gro/me/gro_out.uc
#
# NFD_PCIE0_NOTIFY
#
$(OUTDIR)/nfd_pcie0_notify.list/nfd_pcie0_notify.list: $(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in/notify.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_notify.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_IN_DATA_DMA_ME0="__nfp_idstr2meid(\"pcie0.me2\")" \
-DNFD_IN_DATA_DMA_ME1="__nfp_idstr2meid(\"pcie0.me3\")" \
-DPCIE_ISL=0 \
-DNFD_IN_NOTIFY_DBG_CHKS \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=4 \
-Qnctx_mode=4 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_notify.list/ \
-Fe$(OUTDIR)/nfd_pcie0_notify.list/nfd_pcie0_notify $(NFCC_FLAGS) \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in/notify.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# NFD_PCIE0_PCI_IN_GATHER
#
$(OUTDIR)/nfd_pcie0_pci_in_gather.list/nfd_pcie0_pci_in_gather.list: $(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me0.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pci_in_gather.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_IN_DATA_DMA_ME0="__nfp_idstr2meid(\"pcie0.me2\")" \
-DNFD_IN_DATA_DMA_ME1="__nfp_idstr2meid(\"pcie0.me3\")" \
-DNFD_OUT_CACHE_ME="__nfp_idstr2meid(\"pcie0.me0\")" \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_pci_in_gather.list/ \
-Fe$(OUTDIR)/nfd_pcie0_pci_in_gather.list/nfd_pcie0_pci_in_gather $(NFCC_FLAGS) \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me0.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# FLOWCACHE_TIMEOUT_EMU0
#
$(OUTDIR)/flowcache_timeout_emu0.list/flowcache_timeout_emu0.list: $(SDKP4DIR)/components/nfp_pif/me/apps/common/src/fc.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timeout.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timeout_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/flowcache_timeout_emu0.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DFC_TIMEOUT_EMU=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-Qnn_mode=1 \
-Qspill=3 \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/nfp_pif/shared/include \
-I$(SDKP4DIR)/components/flowcache/me/lib/flowcache \
-I$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary \
-I$(SDKP4DIR)/components/dcfl/me/lib/dcfl \
-I$(SDKP4DIR)/components/dcfl/shared/include/dcfl \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/flowcache_timeout_emu0.list/ \
-Fe$(OUTDIR)/flowcache_timeout_emu0.list/flowcache_timeout_emu0 $(NFCC_FLAGS) \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/fc.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timeout.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timeout_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# NFD_PCIE0_SB
#
$(OUTDIR)/nfd_pcie0_sb.list/nfd_pcie0_sb.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_sb.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_sb.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_CFG_SIG_NEXT_ME="_nfd_cfg_sig_svc_me0" \
-DPCIE_ISL=0 \
-DSTAGE_BATCH_MANAGER_CTX=0 \
-DSTAGE_BATCH_FIRST_WORKER=1 \
-DSTAGE_BATCH_NUM_WORKERS=7 \
-DNFD_OUT_SB_WQ_NUM=15 \
-DNFD_CFG_NEXT_ME="__nfp_idstr2meid(\"i48.me2\")" \
-chip nfp-4xxxc-b0 \
-go \
-t \
-W3 \
-R \
-lm 0 \
-C \
-Of \
-Os \
-O \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_sb.uc
clean:
rm -f $(OUTDIR)/*.nffw $(OUTDIR)/*.elf \
$(OUTDIR)/*.mif $(OUTDIR)/*.mift \
$(OUTDIR)/*.uci $(OUTDIR)/*.ucp \
$(OUTDIR)/*.dbg
rm -rf $(OUTDIR)/nfd_pcie0_pd0.list
rm -rf $(OUTDIR)/nfd_pcie0_pci_in_issue1.list
rm -rf $(OUTDIR)/nfd_pcie0_pci_out_me0.list
rm -rf $(OUTDIR)/nbi_init_csr.list
rm -rf $(OUTDIR)/nfd_pcie0_pd1.list
rm -rf $(OUTDIR)/nfd_pcie0_pci_in_issue0.list
rm -rf $(OUTDIR)/gro1.list
rm -rf $(OUTDIR)/pif_app_nfd.list
rm -rf $(OUTDIR)/app_master.list
rm -rf $(OUTDIR)/nfd_svc.list
rm -rf $(OUTDIR)/blm0.list
rm -rf $(OUTDIR)/gro0.list
rm -rf $(OUTDIR)/nfd_pcie0_notify.list
rm -rf $(OUTDIR)/nfd_pcie0_pci_in_gather.list
rm -rf $(OUTDIR)/flowcache_timeout_emu0.list
rm -rf $(OUTDIR)/nfd_pcie0_sb.list
rm -f $(OUTDIR)/*.yml $(OUTDIR)/*.svg
rm -f $(PIFOUTDIR)/*.c $(PIFOUTDIR)/*.h $(PIFOUTDIR)/*.json \
$(PIFOUTDIR)/*.txt $(PIFOUTDIR)/*.svg $(PIFOUTDIR)/*.csv
rm -rf $(PIFOUTDIR)/callbackapi
#
# Copyright (C) 2017, Netronome Systems, Inc. All rights reserved.
#
import os, sys, struct, pprint, threading, json
from urlparse import urlparse
from contextlib import contextmanager
import grpc
from RTERPCInterface import (DesignBase, CountersBase, TablesBase,
ParserValueSetsBase, RegistersBase, MetersBase, TrafficClassBase,
DigestsBase, MulticastBase, DebugCtlBase, SystemBase)
from sdk6_rte_grpc import netro_runtime_pb2, netro_runtime_pb2_grpc
from sdk6_rte_grpc import p4runtime_pb2, p4runtime_pb2_grpc
from p4.config import p4info_pb2
import RTERPCInterface
# XXX remaining issues:
# XXX * master arbitration via p4runtime.StreamChannel not implemented
# XXX * globally unique ids, we do not have the compiler assigned ids in bmv2
# XXX * will rte assign?
# XXX * how does this map to published ids?
# XXX * rules (TableEntry) do not have names, required by user configs, inspectors
# XXX * other missing rule fields: default_rule, timeout
# XXX * missing counter field: width
# XXX * meter config fields mismitch:
# XXX * cir, cburst, pir, pburst vs rate_k, burst_k, array_offset, count
# XXX * digests not available in p4runtime.proto, use p4.config.v1model ?
# XXX * registers not available in p4runtime.proto, implemented via Externs?
# XXX * parser value sets, multicast, traffic class not available, implemented via Externs?
# XXX * rte thrift interface has nothing equivalent to p4info.actions
COUNTER_CLASS_MAP = {
p4info_pb2.CounterSpec.UNSPECIFIED: RTERPCInterface.P4CounterClass.Unspecified,
p4info_pb2.CounterSpec.PACKETS: RTERPCInterface.P4CounterClass.Packets,
p4info_pb2.CounterSpec.BYTES: RTERPCInterface.P4CounterClass.Bytes,
p4info_pb2.CounterSpec.BOTH: RTERPCInterface.P4CounterClass.Both,
}
METER_CLASS_MAP = {
p4info_pb2.MeterSpec.UNSPECIFIED: RTERPCInterface.MeterClass.Unspecified,
p4info_pb2.MeterSpec.PACKETS: RTERPCInterface.MeterClass.Packets,
p4info_pb2.MeterSpec.BYTES: RTERPCInterface.MeterClass.Bytes,
}
MATCH_TYPE_MAP = {
p4info_pb2.MatchField.UNSPECIFIED: RTERPCInterface.MatchType.Unspecified,
p4info_pb2.MatchField.VALID: RTERPCInterface.MatchType.Valid,
p4info_pb2.MatchField.EXACT: RTERPCInterface.MatchType.Exact,
p4info_pb2.MatchField.LPM: RTERPCInterface.MatchType.LPM,
p4info_pb2.MatchField.TERNARY: RTERPCInterface.MatchType.Ternary,
p4info_pb2.MatchField.RANGE: RTERPCInterface.MatchType.Range,
}
def HandleRteReturn(rte_ret):
if rte_ret.value != netro_runtime_pb2.RteReturn.SUCCESS:
#error = err_msg
#if err_msg is None:
# error = 'Error in %s'%func.func_name
error = 'RTE error'
reason = ''
if rte_ret.reason:
reason = ": %s.\nPlease see RTE log for more info"%rte_ret.reason
raise RTERPCInterface.RTEReturnError, '%s: %s%s'%(RTERPCInterface.RTE_RETURN_CODES[rte_ret.value], error, reason)
# decorator to transform non SUCCESS RteReturn values to exceptions
def RteReturnHandler(err_msg=None):
def _RteReturnHandler(func):
def __RteReturnHandler(*args, **kwargs):
try:
rte_ret = func(*args, **kwargs)
except grpc.RpcError, err:
raise RTERPCInterface.RTECommError, "Communication failure with RPC server: %s"%str(err)
else:
HandleRteReturn(rte_ret)
return __RteReturnHandler
return _RteReturnHandler
# decorator to catch grpc communication failures
def RPC(func):
def _RPC(self, *args, **kwargs):
with self.rte.GRPC_API_LOCK:
try:
return func(self, *args, **kwargs)
except grpc.RpcError, err:
raise RTERPCInterface.RTECommError, "Communication failure with RPC server: %s"%str(err)
return _RPC
def EncodeBytes(v, fmt):
if fmt == p4runtime_pb2.RAW:
return ''.join([chr(int(c)) for c in v])
elif fmt == p4runtime_pb2.AUTO:
return v
def DecodeBytes(v, fmt):
if fmt == p4runtime_pb2.RAW:
return ''.join([str(ord(c)) for c in v])
elif fmt == p4runtime_pb2.AUTO:
return v
class Design(DesignBase):
def GetDesignCommandRequest(self, device_id=0, election_id=0):
req = netro_runtime_pb2.DesignCommandRequest()
req.device_id = device_id
req.election_id.Clear()
return req
def RefreshP4Schema(self):
req = p4runtime_pb2.GetForwardingPipelineConfigRequest(device_ids=[self.rte.device_id])
self.rte.p4info = self.rte.p4_rt.GetForwardingPipelineConfig(req).configs[0].p4info
self.rte._direct_counters = set()
self.rte._counters_by_id = {}
for cntr in self.rte.p4info.direct_counters:
self.rte._direct_counters.add(cntr.preamble.id)
self.rte._counters_by_id[cntr.preamble.id] = cntr
for cntr in self.rte.p4info.counters:
self.rte._counters_by_id[cntr.preamble.id] = cntr
self.rte._direct_meters = set()
self.rte._meters_by_id = {}
for mtr in self.rte.p4info.direct_meters:
self.rte._direct_meters.add(mtr.preamble.id)
self.rte._meters_by_id[mtr.preamble.id] = mtr
for mtr in self.rte.p4info.meters:
self.rte._meters_by_id[mtr.preamble.id] = mtr
self.rte._tables_by_id = {}
for tbl in self.rte.p4info.tables:
self.rte._tables_by_id[tbl.preamble.id] = tbl
self.rte._actions_by_id = {}
self.rte._actions_by_name = {}
for act in self.rte.p4info.actions:
self.rte._actions_by_id[act.preamble.id] = act
self.rte._actions_by_name[act.preamble.name] = act
@RPC
def Load(self, elf_fw, pif_design, pif_config):
with open(elf_fw, "rb") as f:
elf_fw_data = f.read()
pif_design_data = ""
if pif_design:
with open(pif_design, "rb") as f:
pif_design_data = f.read()
pif_config_data = ""
if pif_config:
with open(pif_config, "rb") as f:
pif_config_data = f.read()
self.Unload()
req = self.GetDesignCommandRequest()
req.command.design_load.nfpfw = elf_fw_data
req.command.design_load.pif_design_json = pif_design_data
req.command.design_load.pif_config_json = pif_config_data
HandleRteReturn(self.rte.netro_rt.DesignCommand(req).rte_return)
self.RefreshP4Schema()
@RPC
def Unload(self):
req = self.GetDesignCommandRequest()
req.command.design_unload.Clear()
HandleRteReturn(self.rte.netro_rt.DesignCommand(req).rte_return)
self.rte.p4info = None
@RPC
def ConfigReload(self, pif_config):
req = self.GetDesignCommandRequest()
with open(pif_config, "rb") as f:
req.command.design_reload.pif_config_json = f.read()
HandleRteReturn(self.rte.netro_rt.DesignCommand(req).rte_return)
@RPC
def LoadStatus(self):
req = self.GetDesignCommandRequest()
req.command.design_status.Clear()
resp = self.rte.netro_rt.DesignCommand(req)
HandleRteReturn(resp.rte_return)
if resp.HasField('load_status'):
return {
'is_loaded': resp.load_status.is_loaded,
'uuid': resp.load_status.uuid,
'frontend_build_date': resp.load_status.frontend_build_date,
'frontend_source': resp.load_status.frontend_source,
'frontend_version': resp.load_status.frontend_version,
'uptime': resp.load_status.uptime,
}
else:
return {
'is_loaded': False,
'uuid': '',
'frontend_build_date': '',
'frontend_source': '',
'frontend_version': '',
'uptime': 0,
}
class Counters(CountersBase):
def ExtractRteValue(self, rv):
return rv.intval if rv.type == RteValueType.Int64 else int(rv.stringval)
def GetWriteRequest(self, device_id=0, election_id=0):
req = p4runtime_pb2.WriteRequest()
req.device_id = device_id
req.election_id.Clear()
return req
def GetReadRequest(self, device_id=0):
req = p4runtime_pb2.ReadRequest()
req.device_id = device_id
return req
@RPC
def ListP4Counters(self):
cntrs = []
for cntr in self.rte.p4info.counters:
cntrs.append({
'count': cntr.size,
'name': cntr.preamble.name,
'width': 0,
'tableid': 0,
'table': '',
'type': RTERPCInterface.P4CounterType.Global,
'id': cntr.preamble.id,
})
for cntr in self.rte.p4info.direct_counters:
cntrs.append({
'count': 1,
'name': cntr.preamble.name,
'width': 0,
'tableid': cntr.direct_table_id,
'table': self.rte._tables_by_id[cntr.direct_table_id].preamble.name,
'type': RTERPCInterface.P4CounterType.Direct,
'id': cntr.preamble.id,
})
return cntrs
@RPC
def GetP4Counter(self, counter):
counter_id = self.ResolveToCounterId(counter)
direct = counter_id in self.rte._direct_counters
cntr_info = self.rte._direct_by_id[counter_id]
req = self.GetReadRequest()
cntr = req.entities.add()
if direct:
cntr.direct_counter_entry.counter_id = counter_id
else:
cntr.counter_entry.counter_id = counter_id
cntr.counter_entry.index = 0 # return all
result = []
for resp in self.rte.p4_rt.Read(req):
for ent in resp.entities:
if direct:
if cntr_info.spec.unit in (p4info_pb2.CounterSpec.PACKETS, p4info_pb2.CounterSpec.BOTH):
result.append(ent.direct_counter_entry.data.packet_count)
if cntr_info.spec.unit in (p4info_pb2.CounterSpec.BYTES, p4info_pb2.CounterSpec.BOTH):
result.append(ent.direct_counter_entry.data.bytes_count)
else:
if cntr_info.spec.unit in (p4info_pb2.CounterSpec.PACKETS, p4info_pb2.CounterSpec.BOTH):
result.append(ent.counter_entry.data.packet_count)
if cntr_info.spec.unit in (p4info_pb2.CounterSpec.BYTES, p4info_pb2.CounterSpec.BOTH):
result.append(ent.counter_entry.data.bytes_count)
return result
@RPC
def ClearP4Counter(self, counter):
counter_id = self.ResolveToCounterId(counter)
req = self.GetWriteRequest()
update = req.updates.add()
update.type = p4runtime_pb2.Update.DELETE
if counter_id in self.rte._direct_counters:
update.entity.direct_counter_entry.counter_id = counter_id
else:
update.entity.counter_entry.counter_id = counter_id
self.rte.p4_rt.Write(req)
@RPC
def ClearAllP4Counters(self):
req = self.GetWriteRequest()
update = req.updates.add()
update.type = p4runtime_pb2.Update.DELETE
update.entity.counter_entry.counter_id = 0
update = req.updates.add()
update.type = p4runtime_pb2.Update.DELETE
update.entity.direct_counter_entry.counter_id = 0
self.rte.p4_rt.Write(req)
@RPC
def GetSystemCounters(self):
req = self.rte.System.GetSystemInfoReadRequest()
info = req.info.add()
info.system_cntrs.Clear()
return [{
'name': sc.name,
'value': sc.int_count,
'id': sc.id,
} for sc in self.rte.netro_rt.ReadSystemInfo(req).info[0].system_cntrs.system_cntrs]
@RPC
def ClearAllSysCounters(self):
req = self.rte.System.GetSystemCommandRequest()
req.command.clear_system_cntrs.Clear()
HandleRteReturn(self.rte.netro_rt.SendSystemCommand(req).rte_return)
class Tables(TablesBase):
def UpdateRule(self, update_type, tbl_id, rule_name, default_rule, match, actions, priority = None, timeout = None):
tbl_id = self.ResolveToTableId(tbl_id)
acts = json.loads(actions) if actions else {}
matches = json.loads(match) if match else {}
req = p4runtime_pb2.WriteRequest()
req.device_id = self.rte.device_id
req.election_id.Clear()
update = req.updates.add()
update.type = update_type
update.entity.table_entry.table_id = tbl_id
if priority is not None:
update.entity.table_entry.priority = priority
if 'type' in acts:
act_info = self.rte._actions_by_name[acts['type']]
update.entity.table_entry.action.action.action_id = act_info.preamble.id
if 'data' in acts:
for param_info in act_info.params:
if param_info.name in acts['data']:
p = update.entity.table_entry.action.action.params.add()
p.param_id = param_info.id
p.format = p4runtime_pb2.AUTO
p.value = EncodeBytes(str(acts['data'][param_info.name]['value']), p4runtime_pb2.AUTO)
if matches:
for (fld, match_vals), fld_info in zip(matches.items(), self.rte._tables_by_id[tbl_id].match_fields):
match = update.entity.table_entry.match.add()
match.field_id = fld_info.id
match.format = p4runtime_pb2.AUTO
mtype = MATCH_TYPE_MAP[fld_info.match_type]
if mtype == RTERPCInterface.MatchType.Exact:
match.exact.value = EncodeBytes(str(match_vals['value']), p4runtime_pb2.AUTO)
elif mtype == RTERPCInterface.MatchType.LPM:
match.lpm.value = EncodeBytes(str(match_vals['value']), p4runtime_pb2.AUTO)
if 'prefix' in match_vals:
match.lpm.prefix_len = str(match_vals['prefix'])
elif mtype == RTERPCInterface.MatchType.Ternary:
match.ternary.value = EncodeBytes(str(match_vals['value']), p4runtime_pb2.AUTO)
if 'mask' in match_vals:
match.ternary.mask = EncodeBytes(str(match_vals['mask']), p4runtime_pb2.AUTO)
elif mtype == RTERPCInterface.MatchType.Range:
match.range.low = EncodeBytes(str(match_vals['value']), p4runtime_pb2.AUTO)
if 'rangeto' in match_vals:
match.range.high = EncodeBytes(str(match_vals['rangeto']), p4runtime_pb2.AUTO)
elif mtype == RTERPCInterface.MatchType.Valid:
match.valid.value = match_vals['value'] == 'valid'
self.rte.p4_rt.Write(req)
@RPC
def AddRule(self, tbl_id, rule_name, default_rule, match, actions, priority = None, timeout = None):
self.UpdateRule(p4runtime_pb2.Update.INSERT, tbl_id, rule_name, default_rule, match, actions, priority, timeout)
@RPC
def EditRule(self, tbl_id, rule_name, default_rule, match, actions, priority = None, timeout = None):
self.UpdateRule(p4runtime_pb2.Update.MODIFY, tbl_id, rule_name, default_rule, match, actions, priority, timeout)
@RPC
def DeleteRule(self, tbl_id, rule_name, default_rule, match, actions):
self.UpdateRule(p4runtime_pb2.Update.DELETE, tbl_id, rule_name, default_rule, match, actions)
@RPC
def List(self):
return [{
'tbl_name': td.preamble.name,
'tbl_id': td.preamble.id,
'support_timeout': td.with_entry_timeout,
'tbl_entries_max': td.size,
} for td in self.rte.p4info.tables]
@RPC
def ListRules(self, tbl_id):
tbl_id = self.ResolveToTableId(tbl_id)
req = p4runtime_pb2.ReadRequest()
req.device_id = self.rte.device_id
req.format = p4runtime_pb2.AUTO
tble = req.entities.add()
tble.table_entry.table_id = tbl_id
rules = []
for resp in self.rte.p4_rt.Read(req):
for ent in resp.entities:
assert ent.HasField('table_entry')
act = self.rte._actions_by_id[ent.table_entry.action.action.action_id]
data = {}
for param_info, param_value in zip(act.params, ent.table_entry.action.action.params):
data[param_info.name] = {'value': DecodeBytes(param_value.value, param_value.format)}
actions = {'type': act.preamble.name, 'data': data}
matches = {}
for match, match_info in zip(ent.table_entry.match, self.rte._tables_by_id[ent.table_entry.table_id].match_fields):
matches[match_info.name] = vals = {}
if match_info.match_type == p4info_pb2.MatchField.EXACT and match.HasField('exact'):
vals['value'] = DecodeBytes(match.exact.value, match.format)
elif match_info.match_type == p4info_pb2.MatchField.TERNARY and match.HasField('ternary'):
vals['value'] = DecodeBytes(match.ternary.value, match.format)
vals['mask'] = DecodeBytes(match.ternary.mask, match.format)
elif match_info.match_type == p4info_pb2.MatchField.LPM and match.HasField('lpm'):
vals['value'] = DecodeBytes(match.lpm.value, match.format)
vals['prefix'] = match.lpm.prefix_len
elif match_info.match_type == p4info_pb2.MatchField.RANGE and match.HasField('range'):
vals['value'] = DecodeBytes(match.range.low, match.format)
vals['rangeto'] = DecodeBytes(match.range.high, match.format)
elif match_info.match_type == p4info_pb2.MatchField.VALID and match.HasField('valid'):
vals['value'] = 'valid' if match.valid.value else 'invalid'
rules.append({
'timeout_seconds': -1,
'actions': json.dumps(actions),
'priority': ent.table_entry.priority,
'rule_name': '???', # XXX p4runtime TableEntry does not have a name
'default_rule': '???', # XXX use p4info.tables[X].const_default_action_id
'match': json.dumps(matches),
})
return rules
@RPC
def GetVersion(self):
raise RTERPCInterface.RTERPCNotImplemented
class Registers(RegistersBase):
@RPC
def List(self):
raise RTERPCInterface.RTERPCNotImplemented
def ResolveToRegisterArrayArg(self, register, index, count):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Get(self, register, index=0, count=1):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Clear(self, register, index=0, count=1):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Set(self, register, values, index=0, count=1):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def SetField(self, register, field_id, value, index=0, count=1):
raise RTERPCInterface.RTERPCNotImplemented
class TrafficClass(TrafficClassBase):
@RPC
def Get(self, port_id):
req = netro_runtime_pb2.SystemInfoReadRequest()
req.device_id = self.rte.device_id
info = req.info.add()
info.traffic_class_list.port_id = port_id
res = self.rte.netro_rt.ReadSystemInfo(req).info[0].traffic_class_list.traffic_class
return [{
'class_id': tcc.class_id,
'weight': tcc.weight,
'queue_no': tcc.queue_no,
'committed': tcc.committed,
} for tcc in res]
@RPC
def Set(self, port_id, cfgs):
req = netro_runtime_pb2.SystemCommandRequest()
req.device_id = self.rte.device_id
req.election_id.Clear()
req.command.set_traffic_class.port_id = port_id
for cfg in cfgs:
tccfg = req.command.set_traffic_class.traffic_class_cfgs.add()
tccfg.class_id = cfg['class_id']
tccfg.weight = cfg['weight']
tccfg.queue_no = cfg['queue_no']
HandleRteReturn(self.rte.netro_rt.SendSystemCommand(req).rte_return)
@RPC
def Commit(self, port_id):
req = netro_runtime_pb2.SystemCommandRequest()
req.device_id = self.rte.device_id
req.election_id.Clear()
req.command.commit_traffic_class.port_id = port_id
HandleRteReturn(self.rte.netro_rt.SendSystemCommand(req).rte_return)
class Meters(MetersBase):
def GetReadRequest(self, device_id=0):
req = p4runtime_pb2.ReadRequest()
req.device_id = device_id
return req
def GetWriteRequest(self, device_id=0, election_id=0):
req = p4runtime_pb2.WriteRequest()
req.device_id = device_id
req.election_id.Clear()
return req
@RPC
def List(self):
mtrs = []
for mtr in self.rte.p4info.meters:
mtrs.append({
'count': mtr.size,
'name': mtr.preamble.name,
'width': 0,
'tableid': 0,
'table': '',
'mclass': RTEGRPCInterface.METER_CLASS_MAP[mtr.spec.unit],
'type': RTERPCInterface.MeterType.Global,
'id': mtr.preamble.id,
})
for mtr in self.rte.p4info.direct_meters:
mtrs.append({
'count': 1,
'name': mtr.preamble.name,
'width': 0,
'tableid': mtr.direct_table_id,
'table': self.rte._tables_by_id[mtr.direct_table_id].preamble.name,
'mclass': RTEGRPCInterface.METER_CLASS_MAP[mtr.spec.unit],
'type': RTERPCInterface.MeterType.Direct,
'id': mtr.preamble.id,
})
return mtrs
@RPC
def GetConfig(self, meter_id):
req = self.GetReadRequest()
direct = meter_id in self.rte._direct_meters
mtr = req.entities.add()
if direct:
mtr.direct_meter_entry.meter_id = meter_id
else:
mtr.meter_entry.meter_id = meter_id
mtr.meter_entry.index = 0 # return all
mtrcfgs = []
for resp in self.rte.p4_rt.Read(req):
for ent in resp.entities:
if direct:
mtrcfgs.append({
'rate_k': ent.direct_meter_entry.config.cir,
'burst_k': ent.direct_meter_entry.config.cburst,
'array_offset': 0, # XXX ? .pir
'count': 0, # XXX ? .pburst
})
else:
mtrcfgs.append({
'rate_k': ent.meter_entry.config.cir,
'burst_k': ent.meter_entry.config.cburst,
'array_offset': 0, # XXX ? .pir
'count': 0, # XXX ? .pburst
})
return mtrcfgs
@RPC
def SetConfig(self, meter_id, configs):
for idx, mtrcfg in enumerate(configs):
req = self.GetWriteRequest()
update = req.updates.add()
update.type = p4runtime_pb2.Update.MODIFY
update.meter_entry.config.cir = mtrcfg['rate']
update.meter_entry.config.cburst = mtrcfg['burst']
# XXX mtrcfg['off'], mtrcfg['cnt'] not handled
self.rte.p4_rt.Write(req)
class Digests(DigestsBase):
@RPC
def List(self):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Register(self, digest_id):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Deregister(self, digest_regid):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Get(self, digest_handle):
raise RTERPCInterface.RTERPCNotImplemented
class Multicast(MulticastBase):
@RPC
def List(self):
req = netro_runtime_pb2.SystemInfoReadRequest()
req.device_id = self.rte.device_id
info = req.info.add()
info.mcast_cfg_list.Clear()
res = self.rte.netro_rt.ReadSystemInfo(req).info[0].mcast_cfg_list.mcast_list
return [{
'group_id': mcce.group_id,
'max_entries': mcce.max_entries,
'ports': [p for p in mcce.ports],
} for mcce in res]
@RPC
def SetConfig(self, group_id, ports):
req = netro_runtime_pb2.SystemCommandRequest()
req.device_id = self.rte.device_id
req.election_id.Clear()
req.command.mcast_cfg_set.mcast_entry.group_id = group_id
for port in ports:
req.command.mcast_cfg_set.mcast_entry.ports.append(port)
HandleRteReturn(self.rte.netro_rt.SendSystemCommand(req).rte_return)
class System(SystemBase):
def GetSystemCommandRequest(self):
req = netro_runtime_pb2.SystemCommandRequest()
req.device_id = self.rte.device_id
req.election_id.Clear()
return req
def GetSystemInfoReadRequest(self):
req = netro_runtime_pb2.SystemInfoReadRequest()
req.device_id = self.rte.device_id
return req
@RPC
def Shutdown(self):
req = self.GetSystemCommandRequest()
cmd = req.command.shutdown_cmd.Clear()
HandleRteReturn(self.rte.netro_rt.SendSystemCommand(req).rte_return)
@RPC
def Ping(self):
req = self.GetSystemCommandRequest()
cmd = req.command.ping.Clear()
HandleRteReturn(self.rte.netro_rt.SendSystemCommand(req).rte_return)
@RPC
def Echo(self, echo_msg):
req = self.GetSystemCommandRequest()
cmd = req.command.echo.message = echo_msg
HandleRteReturn(self.rte.netro_rt.SendSystemCommand(req).rte_return)
@RPC
def GetVersion(self):
req = self.GetSystemInfoReadRequest()
info = req.info.add()
info.version_info.version = ''
return self.rte.netro_rt.ReadSystemInfo(req).info[0].version_info.version
@RPC
def GetLogLevel(self):
req = self.GetSystemInfoReadRequest()
info = req.info.add()
info.log_level.log_level = netro_runtime_pb2.GetLogLevel.UNKNOWN
return self.rte.netro_rt.ReadSystemInfo(req).info[0].log_level.log_level
@RPC
def SetLogLevel(self, level):
req = self.GetSystemCommandRequest()
cmd = req.command.set_log_level.log_level = level
HandleRteReturn(self.rte.netro_rt.SendSystemCommand(req).rte_return)
@RPC
def GetPortInfo(self):
req = self.GetSystemInfoReadRequest()
info = req.info.add()
info.ports_info.Clear()
ports_info = self.rte.netro_rt.ReadSystemInfo(req).info[0].ports_info
return [{
'id': pi.id,
'info': pi.info,
'token': pi.token,
} for pi in ports_info.ports]
class DebugCtl(DebugCtlBase):
def Execute(self, debug_id, debug_data):
req = netro_runtime_pb2.DebugControlRequest()
req.device_id = self.rte.device_id
req.election_id.Clear()
req.debug_id = debug_id
req.debug_data = debug_data
resp = self.rte.netro_rt.DebugControl(req)
if resp.return_value != netro_runtime_pb2.DebugControlResponse.SUCCESS:
raise RTERPCInterface.RTEReturnError, 'error during DebugControlRequest'
return resp.return_data
class ParserValueSets(ParserValueSetsBase):
@RPC
def List(self):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Clear(self, pvs_id):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Add(self, pvs_id, pvs_entries):
raise RTERPCInterface.RTERPCNotImplemented
@RPC
def Retrieve(self, pvs_id):
raise RTERPCInterface.RTERPCNotImplemented
def DoConnect(conn, host, port, device_id=0, use_zlib=True, serialise_api=False):
conn.channel = grpc.insecure_channel('%s:%d'%(host, port))
conn.netro_rt = netro_runtime_pb2_grpc.NetroRuntimeStub(conn.channel)
conn.p4_rt = p4runtime_pb2_grpc.P4RuntimeStub(conn.channel)
conn.device_id = device_id
conn.GRPC_API_LOCK = threading.Lock() if serialise_api else RTERPCInterface.NullCtx()
def DoDisconnect(conn):
pass
#
# Copyright (C) 2015-2017, Netronome Systems, Inc. All rights reserved.
#
import os, sys, struct, pprint, threading
from urlparse import urlparse
from contextlib import contextmanager
from RTERPCInterface import *
class RTEInterfaceConnection(object):
def __init__(self):
self.transport = None
self.Design = None
self.Counters = None
self.Tables = None
self.ParserValueSets = None
self.Registers = None
self.Meters = None
self.TrafficClass = None
self.Digests = None
self.Multicast = None
self.DebugCtl = None
self.System = None
self._DoConnect = None
self._DoDisconnect = None
def Connect(self, rpc, host, port, device_id=0, use_zlib=True, serialise_api=False):
if rpc == 'thrift':
from RTEThriftInterface import (Design, Counters, Tables, ParserValueSets,
Registers, Meters, TrafficClass, Digests, Multicast, DebugCtl, System)
from RTEThriftInterface import RteReturnHandler, DoConnect, DoDisconnect
global P4CounterType, RegisterType
from RTEThriftInterface import P4CounterType, RegisterType
elif rpc == 'grpc':
from RTEGRPCInterface import (Design, Counters, Tables, ParserValueSets,
Registers, Meters, TrafficClass, Digests, Multicast, DebugCtl, System)
from RTEGRPCInterface import (RteReturnHandler, DoConnect, DoDisconnect)
else:
raise Exception, 'unsupported rpc: %s'%rpc
DoConnect(self, host, port, device_id, use_zlib, serialise_api)
self.Design = Design(self)
self.Counters = Counters(self)
self.Tables = Tables(self)
self.ParserValueSets = ParserValueSets(self)
self.Registers = Registers(self)
self.Meters = Meters(self)
self.TrafficClass = TrafficClass(self)
self.Digests = Digests(self)
self.Multicast = Multicast(self)
self.DebugCtl = DebugCtl(self)
self.System = System(self)
self._DoConnect = DoConnect
self._DoDisconnect = DoDisconnect
status = self.Design.LoadStatus()
if rpc == 'grpc' and status['is_loaded']:
self.Design.RefreshP4Schema()
def Disconnect(self):
if self._DoDisconnect is not None:
self._DoDisconnect(self)
@contextmanager
def ConnectCtx(self, rpc, host, port, device_id=0, use_zlib=True, serialise_api=False):
try:
self.Connect(rpc, host, port, device_id, use_zlib, serialise_api)
yield self
finally:
self.Disconnect()
def Shutdown(self):
self.System.Shutdown()
self.Disconnect()
RTEInterface = RTEInterfaceConnection()
#
# Copyright (C) 2017, Netronome Systems, Inc. All rights reserved.
#
import os, sys, struct, pprint, threading
from urlparse import urlparse
from contextlib import contextmanager
class RTEError(Exception): pass
class RTECommError(RTEError): pass
class RTERPCNotImplemented(RTEError): pass
class RTEReturnError(RTEError): pass
RTE_RETURN_CODES = [
'SUCCESS',
'ERROR', # error reason string provided
'ARGINVALID', # invalid argument
'IOERROR', # platform IO error
'MEMORYERROR', # memory allocation error
'FILEIOERROR', # file IO error
'NOTLOADED', # firmware not loaded
'HWINCOMPATIBLE', # platform doesn't support operation
]
# XXX a hack for now, but these should be shared definitions for thrift/grpc
class LogLevel(object):
UNKNOWN = 0
DISABLE = 1
FATAL = 2
ERROR = 3
WARN = 4
INFO = 5
DEBUG = 6
EXTRA = 7
HEAVY = 8
class P4CounterType(object):
Global = 'P4CounterType.Global'
Direct = 'P4CounterType.Direct'
Static = 'P4CounterType.Static'
class P4CounterClass(object):
Invalid = 'P4CounterClass.Invalid'
Unspecified = 'P4CounterClass.Unspecified'
Packets = 'P4CounterClass.Packets'
Bytes = 'P4CounterClass.Bytes'
Both = 'P4CounterClass.Both'
class RegisterType(object):
Global = 'RegisterType.Global'
Direct = 'RegisterType.Direct'
Static = 'RegisterType.Static'
class MeterType(object):
Invalid = 'MeterType.Invalid'
Global = 'MeterType.Global'
Direct = 'MeterType.Direct'
Static = 'MeterType.Static'
class MeterClass(object):
Invalid = 'MeterClass.Invalid'
Unspecified = 'MeterClass.Unspecified'
Packets = 'MeterClass.Packets'
Bytes = 'MeterClass.Bytes'
class MatchType(object):
Unspecified = 'MatchType.Unspecified'
Valid = 'MatchType.Valid'
Exact = 'MatchType.Exact'
LPM = 'MatchType.LPM'
Ternary = 'MatchType.Ternary'
Range = 'MatchType.Range'
#class RegisterFieldDesc(object):
#class RegisterType(object):
def REV_MAP(m):
res = {}
for k, v in m.items():
res['v'] = k
return res
class NullCtx():
def __enter__(*args): pass
def __exit__(*exc_info): pass
class RTEModule(object):
def __init__(self, rte):
self.rte = rte
class DesignBase(RTEModule):
def Load(self, elf_fw, pif_design, pif_config):
raise RTERPCNotImplemented
def Unload(self):
raise RTERPCNotImplemented
def ConfigReload(self, pif_config):
raise RTERPCNotImplemented
def LoadStatus(self):
raise RTERPCNotImplemented
class CountersBase(RTEModule):
def ResolveToCounterId(self, counter):
if isinstance(counter, (int, long)):
counter_id = counter
elif isinstance(counter, basestring):
counter_id = self.GetP4CounterByName(counter)['id']
elif isinstance(counter, dict):
counter_id = counter['id']
else:
raise RTEError, "Unexpected counter parameter type %s"%type(counter)
def GetP4Counters(self):
return [(counter, self.GetP4Counter(counter)) for counter in self.ListP4Counters()]
def GetP4CounterByName(self, counter_name):
for counter in self.ListP4Counters():
if counter['name'] == counter_name:
return counter
raise RTEError, "Counter '%s' not found"%counter_name
def ExtractRteValue(self, rv):
raise RTERPCNotImplemented
def ListP4Counters(self):
raise RTERPCNotImplemented
def GetP4Counter(self, counter):
raise RTERPCNotImplemented
def ClearP4Counter(self, counter):
raise RTERPCNotImplemented
def ClearAllP4Counters(self):
raise RTERPCNotImplemented
def GetSystemCounters(self):
raise RTERPCNotImplemented
def ClearAllSysCounters(self):
raise RTERPCNotImplemented
class TablesBase(RTEModule):
def GetTableByName(self, table_name):
for table in self.List():
if table['tbl_name'] == table_name:
return table
raise RTEError, "Table '%s' not found"%table_name
def ResolveToTableId(self, tbl_id):
if isinstance(tbl_id, int):
return tbl_id
elif isinstance(tbl_id, basestring):
return self.GetTableByName(tbl_id)['tbl_id']
else:
raise RTEError, 'Unsupported table name type: %s'%type(tbl_id)
def AddRule(self, tbl_id, rule_name, default_rule, match, actions, priority = None, timeout = None):
raise RTERPCNotImplemented
def EditRule(self, tbl_id, rule_name, default_rule, match, actions, priority = None, timeout = None):
raise RTERPCNotImplemented
def DeleteRule(self, tbl_id, rule_name, default_rule, match, actions):
raise RTERPCNotImplemented
def List(self):
raise RTERPCNotImplemented
def ListRules(self, tbl_id):
raise RTERPCNotImplemented
def GetVersion(self):
raise RTERPCNotImplemented
class RegistersBase(RTEModule):
def GetRegisterByName(self, register_name):
for reg in self.List():
if reg['name'] == register_name:
return reg
raise RTEError, "Register '%s' not found"%register_name
def List(self):
raise RTERPCNotImplemented
def ResolveToRegisterArrayArg(self, register, index, count):
raise RTERPCNotImplemented
def Get(self, register, index=0, count=1):
raise RTERPCNotImplemented
def Clear(self, register, index=0, count=1):
raise RTERPCNotImplemented
def Set(self, register, values, index=0, count=1):
raise RTERPCNotImplemented
def SetField(self, register, field_id, value, index=0, count=1):
raise RTERPCNotImplemented
class TrafficClassBase(RTEModule):
def Get(self, port_id):
raise RTERPCNotImplemented
def Set(self, port_id, cfgs):
raise RTERPCNotImplemented
def Commit(self, port_id):
raise RTERPCNotImplemented
class MetersBase(RTEModule):
def List(self):
raise RTERPCNotImplemented
def GetConfig(self, meter_id):
raise RTERPCNotImplemented
def SetConfig(self, meter_id, configs):
raise RTERPCNotImplemented
class DigestsBase(RTEModule):
def List(self):
raise RTERPCNotImplemented
def Register(self, digest_id):
raise RTERPCNotImplemented
def Deregister(self, digest_regid):
raise RTERPCNotImplemented
def Get(self, digest_handle):
raise RTERPCNotImplemented
class MulticastBase(RTEModule):
def List(self):
raise RTERPCNotImplemented
def SetConfig(self, group_id, ports):
raise RTERPCNotImplemented
class SystemBase(RTEModule):
def Shutdown(self):
raise RTERPCNotImplemented
def Ping(self):
raise RTERPCNotImplemented
def Echo(self, echo_msg):
raise RTERPCNotImplemented
def GetVersion(self):
raise RTERPCNotImplemented
def GetLogLevel(self):
raise RTERPCNotImplemented
def SetLogLevel(self, level):
raise RTERPCNotImplemented
def GetPortInfo(self):
raise RTERPCNotImplemented
class DebugCtlBase(RTEModule):
def Execute(self, debug_id, debug_data):
raise RTERPCNotImplemented
def SetRuleBreakpoint(self, table_name, rule_name, enable):
self.Execute('netro_rule_bpt', 'table %s rule %s enabled %s'%(table_name, rule_name, int(enable)))
def GetRuleBreakpoint(self, table_name, rule_name):
res = self.Execute('netro_rule_bpt', 'table %s rule %s'%(table_name, rule_name))
name, val = res.split(None, 1)
assert name=='enabled'
return bool(int(val))
def SetMacConfig(self, nbi0_config, nbi1_config):
for (conf_id, conf_json) in (('nbi_mac8_json', nbi0_config),
('nbi_mac9_json', nbi1_config)):
if conf_json:
with open(conf_json, "rb") as f:
self.Execute(conf_id, f.read())
class ParserValueSetsBase(RTEModule):
def List(self):
raise RTERPCNotImplemented
def Clear(self, pvs_id):
raise RTERPCNotImplemented
def Add(self, pvs_id, pvs_entries):
raise RTERPCNotImplemented
def Retrieve(self, pvs_id):
raise RTERPCNotImplemented
#
# Copyright (C) 2015-2017, Netronome Systems, Inc. All rights reserved.
#
import os, sys, struct, pprint, threading
from urlparse import urlparse
from contextlib import contextmanager
#sys.path.append('../../out/gen_thrift/py')
from thrift.transport import TTransport, TZlibTransport, TSocket
from thrift.protocol import TBinaryProtocol
from RTERPCInterface import (DesignBase, CountersBase, TablesBase,
ParserValueSetsBase, RegistersBase, MetersBase, TrafficClassBase,
DigestsBase, MulticastBase, DebugCtlBase, SystemBase)
from sdk6_rte import RunTimeEnvironment
from sdk6_rte.ttypes import *
import RTERPCInterface
COUNTER_TYPE_MAP = {
P4CounterType.Global: RTERPCInterface.P4CounterType.Global,
P4CounterType.Direct: RTERPCInterface.P4CounterType.Direct,
P4CounterType.Static: RTERPCInterface.P4CounterType.Static,
}
REGISTER_TYPE_MAP = {
RegisterType.Global: RTERPCInterface.RegisterType.Global,
RegisterType.Direct: RTERPCInterface.RegisterType.Direct,
RegisterType.Static: RTERPCInterface.RegisterType.Static,
}
METER_TYPE_MAP = {
MeterType.Invalid: RTERPCInterface.MeterType.Invalid,
MeterType.Global: RTERPCInterface.MeterType.Global,
MeterType.Direct: RTERPCInterface.MeterType.Direct,
MeterType.Static: RTERPCInterface.MeterType.Static,
}
METER_CLASS_MAP = {
MeterClass.Invalid: RTERPCInterface.MeterClass.Invalid,
MeterClass.Packets: RTERPCInterface.MeterClass.Packets,
MeterClass.Bytes: RTERPCInterface.MeterClass.Bytes,
}
# decorator to transform non SUCCESS RteReturn values to exceptions
def RteReturnHandler(err_msg=None):
def _RteReturnHandler(func):
def __RteReturnHandler(*args, **kwargs):
try:
rte_ret = func(*args, **kwargs)
except TException, err:
raise RTERPCInterface.RTECommError, "Communication failure with RPC server: %s"%str(err)
else:
if rte_ret.value != RteReturnValue.SUCCESS:
error = err_msg
if err_msg is None:
error = 'Error in %s'%func.func_name
reason = ''
if rte_ret.reason:
reason = ": %s.\nPlease see RTE log for more info"%rte_ret.reason
raise RTERPCInterface.RTEReturnError, '%s: %s%s'%(RTERPCInterface.RTE_RETURN_CODES[rte_ret.value], error, reason)
return __RteReturnHandler
return _RteReturnHandler
# decorator to catch thrift communication failures
def RPC(func):
def _RPC(self, *args, **kwargs):
with self.rte.THRIFT_API_LOCK:
try:
return func(self, *args, **kwargs)
except TException, err:
raise RTERPCInterface.RTECommError, "Communication failure with RPC server: %s"%str(err)
return _RPC
class Design(DesignBase):
@RPC
def Load(self, elf_fw, pif_design, pif_config):
with open(elf_fw, "rb") as f:
elf_fw_data = f.read()
pif_design_data = ""
if pif_design:
with open(pif_design, "rb") as f:
pif_design_data = f.read()
pif_config_data = ""
if pif_config:
with open(pif_config, "rb") as f:
pif_config_data = f.read()
self.rte.client.design_unload()
self.rte.client.design_load(DesignLoadArgs(
nfpfw=elf_fw_data,
pif_design_json=pif_design_data,
pif_config_json=pif_config_data,
))
return True, ''
@RPC
def Unload(self):
self.rte.client.design_unload()
@RPC
def ConfigReload(self, pif_config):
with open(pif_config, "rb") as f:
self.rte.client.design_reconfig(f.read())
@RPC
def LoadStatus(self):
ls = self.rte.client.design_load_status()
return {
'is_loaded': ls.is_loaded,
'uuid': ls.uuid,
'frontend_build_date': ls.frontend_build_date,
'frontend_source': ls.frontend_source,
'frontend_version': ls.frontend_version if ls.frontend_version is not None else '',
'uptime': ls.uptime,
}
class Counters(CountersBase):
def ExtractRteValue(self, rv):
return rv.intval if rv.type == RteValueType.Int64 else int(rv.stringval)
@RPC
def ListP4Counters(self):
return [{
'count': cntr.count,
'name': cntr.name,
'width': cntr.width,
'tableid': cntr.tableid,
'table': cntr.table,
'type': COUNTER_TYPE_MAP[cntr.type],
'id': cntr.id,
} for cntr in self.rte.client.p4_counter_list_all()]
@RPC
def GetP4Counter(self, counter):
counterId = self.ResolveToCounterId(counter)
counterReturn = self.rte.client.p4_counter_retrieve(counterId)
if counterReturn.count != -1:
return struct.unpack('%sQ'%(counterReturn.count/8), counterReturn.data)
else:
return ()
@RPC
def ClearP4Counter(self, counter):
counterId = self.ResolveToCounterId(counter)
self.rte.client.p4_counter_clear(counterId)
@RPC
def ClearAllP4Counters(self):
self.rte.client.p4_counter_clear_all()
@RPC
def GetSystemCounters(self):
return [{
'name': sc.name,
'value': self.ExtractRteValue(sc.value),
'id': sc.id,
} for sc in self.rte.client.sys_counter_retrieve_all()]
@RPC
def ClearAllSysCounters(self):
self.rte.client.sys_counter_clear_all()
class Tables(TablesBase):
@RPC
def AddRule(self, tbl_id, rule_name, default_rule, match, actions, priority = None, timeout = None):
tbl_entry = TableEntry()
tbl_entry.rule_name = rule_name
tbl_entry.default_rule = default_rule
tbl_entry.match = match
tbl_entry.actions = actions
if priority != None:
tbl_entry.priority = priority
if timeout != None:
tbl_entry.timeout_seconds = timeout
self.rte.client.table_entry_add(self.ResolveToTableId(tbl_id), tbl_entry)
@RPC
def EditRule(self, tbl_id, rule_name, default_rule, match, actions, priority = None, timeout = None):
tbl_entry = TableEntry()
tbl_entry.rule_name = rule_name
tbl_entry.default_rule = default_rule
tbl_entry.match = match
tbl_entry.actions = actions
if priority != None:
tbl_entry.priority = priority
if timeout != None:
tbl_entry.timeout_seconds = timeout
self.rte.client.table_entry_edit(self.ResolveToTableId(tbl_id), tbl_entry)
@RPC
def DeleteRule(self, tbl_id, rule_name, default_rule, match, actions):
tbl_entry = TableEntry()
tbl_entry.rule_name = rule_name
tbl_entry.default_rule = default_rule
tbl_entry.match = match
tbl_entry.actions = actions
self.rte.client.table_entry_delete(self.ResolveToTableId(tbl_id), tbl_entry)
@RPC
def List(self):
return [{
'tbl_name': td.tbl_name,
'tbl_id': td.tbl_id,
'support_timeout': td.support_timeout,
'tbl_entries_max': td.tbl_entries_max,
} for td in self.rte.client.table_list_all()]
@RPC
def ListRules(self, tbl_id):
return [{
'timeout_seconds': te.timeout_seconds,
'actions': te.actions,
'priority': te.priority,
'rule_name': te.rule_name,
'default_rule': te.default_rule,
'match': te.match,
} for te in self.rte.client.table_retrieve(self.ResolveToTableId(tbl_id))]
@RPC
def GetVersion(self):
return self.rte.client.table_version_get()
class Registers(RegistersBase):
@RPC
def List(self):
return [{
'name': reg.name,
'id': reg.id,
'type': REGISTER_TYPE_MAP[reg.type],
'count': reg.count,
'table': reg.table,
'tableid': reg.tableid,
'fields': [{
'name': fld.name,
'width': fld.width,
} for fld in reg.fields],
} for reg in self.rte.client.register_list_all()]
def ResolveToRegisterArrayArg(self, register, index, count):
reg = None
if isinstance(register, int):
reg_id = register
elif isinstance(register, str):
reg = self.GetRegisterByName(register)
reg_id = reg['id']
else:
raise RTERPCInterface.RTEError, "Unhandled register parameter type: %s"%type(register)
if count == -1:
if reg is None:
reg = self.GetRegisterByName(register)
count = reg['count']
return RegisterArrayArg(reg_id=reg_id, index=index, count=count)
@RPC
def Get(self, register, index=0, count=1):
return self.rte.client.register_retrieve(self.ResolveToRegisterArrayArg(register, index, count))
@RPC
def Clear(self, register, index=0, count=1):
self.rte.client.register_clear(self.ResolveToRegisterArrayArg(register, index, count))
@RPC
def Set(self, register, values, index=0, count=1):
self.rte.client.register_set(self.ResolveToRegisterArrayArg(register, index, count), values)
@RPC
def SetField(self, register, field_id, value, index=0, count=1):
self.rte.client.register_field_set(self.ResolveToRegisterArrayArg(register, index, count), field_id, value)
class TrafficClass(TrafficClassBase):
@RPC
def Get(self, port_id):
return [{
'class_id': tcc.class_id,
'weight': tcc.weight,
'queue_no': tcc.queue_no,
'committed': tcc.committed,
} for tcc in self.rte.client.traffic_class_get(port_id)]
@RPC
def Set(self, port_id, cfgs):
self.rte.client.traffic_class_set(port_id, [TrafficClassCfg(**cfg) for cfg in cfgs])
@RPC
def Commit(self, port_id):
self.rte.client.traffic_class_commit(port_id)
class Meters(MetersBase):
@RPC
def List(self):
return [{
'name': mtr.name,
'id': mtr.id,
'type': METER_TYPE_MAP[mtr.type],
'mclass': METER_CLASS_MAP[mtr.mclass],
'count': mtr.count,
'table': mtr.table,
'tableid': mtr.tableid,
} for mtr in self.rte.client.meter_list_all()]
@RPC
def GetConfig(self, meter_id):
return [{
'rate_k': mcfg.rate_k,
'burst_k': mcfg.burst_k,
'array_offset': mcfg.array_offset,
'count': mcfg.count,
} for mcfg in self.rte.client.meter_config_get(meter_id)]
@RPC
def SetConfig(self, meter_id, configs):
ops = [MeterCfg(cfg['rate'], cfg['burst'], cfg['off'], cfg['cnt']) for cfg in configs]
self.rte.client.meter_config_set(meter_id, ops)
class Digests(DigestsBase):
@RPC
def List(self):
return [{
'name': dd.name,
'id': dd.id,
'app_id': dd.app_id,
'field_list_name': dd.field_list_name,
'fields': [{
'name': fld.name,
'width': fld.width,
} for fld in dd.fields],
} for dd in self.rte.client.digest_list_all()]
@RPC
def Register(self, digest_id):
return self.rte.client.digest_register(digest_id)
@RPC
def Deregister(self, digest_regid):
return self.rte.client.digest_deregister(digest_regid)
@RPC
def Get(self, digest_handle):
return self.rte.client.digest_retrieve(digest_handle)
class Multicast(MulticastBase):
@RPC
def List(self):
return [{
'group_id': mcce.group_id,
'max_entries': mcce.max_entries,
'ports': [] if mcce.ports is None else mcce.ports,
} for mcce in self.rte.client.mcast_config_get_all()]
@RPC
def SetConfig(self, group_id, ports):
cfg = McastCfgEntry(group_id, len(ports), ports)
self.rte.client.mcast_config_set(cfg)
class System(SystemBase):
@RPC
def Shutdown(self):
return self.rte.client.sys_shutdown()
@RPC
def Ping(self):
return self.rte.client.sys_ping()
@RPC
def Echo(self, echo_msg):
return self.rte.client.sys_echo(echo_msg)
@RPC
def GetVersion(self):
return self.rte.client.sys_version_get()
@RPC
def GetLogLevel(self):
return self.rte.client.sys_log_level_get()
@RPC
def SetLogLevel(self, level):
self.rte.client.sys_log_level_set(level)
@RPC
def GetPortInfo(self):
return [{
'id': pi.id,
'token': pi.token,
'info': pi.info,
} for pi in self.rte.client.ports_info_retrieve()]
class DebugCtl(DebugCtlBase):
@RPC
def Execute(self, debug_id, debug_data):
res = self.rte.client.debugctl(debug_id, debug_data)
if res.return_value == -1:
raise RTERPCInterface.RTEError, "Error encountered during debugctl '%s'"%debug_id
return res.return_data
class ParserValueSets(ParserValueSetsBase):
@RPC
def List(self):
return [{
'pvs_id': pvs.pvs_id,
'pvs_name': pvs.pvs_name,
'pvs_entries_max': pvs.pvs_entries_max,
'key_layout': [{
'name': fld.name,
'width': fld.width,
} for fld in pvs.key_layout],
} for pvs in self.rte.client.parser_value_set_list_all()]
@RPC
def Clear(self, pvs_id):
self.rte.client.parser_value_set_clear(pvs_id)
@RPC
def Add(self, pvs_id, pvs_entries):
pvs_value_entries = []
for e in pvs_entries:
pvs_value_entries.append(ParserValueSetEntry(value=e[0], mask=e[1]))
self.rte.client.parser_value_set_add(pvs_id, pvs_value_entries)
@RPC
def Retrieve(self, pvs_id):
return [{
'value': pvse.value,
'mask': pvse.mask,
} for pvse in self.rte.client.parser_value_set_retrieve(pvs_id)]
def DoConnect(conn, host, port, device_id=0, use_zlib=True, serialise_api=False):
conn.transport = TTransport.TBufferedTransport(TSocket.TSocket(host, port))
if use_zlib:
conn.transport = TZlibTransport.TZlibTransport(conn.transport)
conn.client = RunTimeEnvironment.Client(TBinaryProtocol.TBinaryProtocol(conn.transport))
# post apply decorators
conn.client.design_load = RteReturnHandler('Loading firmware failed')(conn.client.design_load)
conn.client.design_unload = RteReturnHandler('Unloading firmware failed')(conn.client.design_unload)
conn.client.design_reconfig = RteReturnHandler('Reload of user config failed')(conn.client.design_reconfig)
conn.client.sys_log_level_set = RteReturnHandler('Set log level failed')(conn.client.sys_log_level_set)
conn.client.table_entry_add = RteReturnHandler('Adding table entry failed')(conn.client.table_entry_add)
conn.client.table_entry_edit = RteReturnHandler('Editing table entry failed')(conn.client.table_entry_edit)
conn.client.table_entry_delete = RteReturnHandler('Deleting table entry failed')(conn.client.table_entry_delete)
conn.client.p4_counter_clear = RteReturnHandler('P4 counter clear failed')(conn.client.p4_counter_clear)
conn.client.p4_counter_clear_all = RteReturnHandler('P4 counter clear allfailed')(conn.client.p4_counter_clear_all)
conn.client.sys_counter_clear_all = RteReturnHandler('System counter clear all failed')(conn.client.sys_counter_clear_all)
conn.client.register_clear = RteReturnHandler('Register clear failed')(conn.client.register_clear)
conn.client.register_field_set = RteReturnHandler('Register field set failed')(conn.client.register_field_set)
conn.client.register_set = RteReturnHandler('Register set failed')(conn.client.register_set)
conn.client.mcast_config_set = RteReturnHandler('Multicast config set failed')(conn.client.mcast_config_set)
conn.client.meter_config_set = RteReturnHandler('Meter config set failed')(conn.client.meter_config_set)
conn.client.digest_deregister = RteReturnHandler('Digest deregister failed')(conn.client.digest_deregister)
conn.client.parser_value_set_add = RteReturnHandler('Parser value set add failed')(conn.client.parser_value_set_add)
conn.client.parser_value_set_clear = RteReturnHandler('Parser value set clear failed')(conn.client.parser_value_set_clear)
conn.client.traffic_class_commit = RteReturnHandler('Traffic Class commit failed')(conn.client.traffic_class_commit)
conn.client.traffic_class_set = RteReturnHandler('Traffic Class set failed')(conn.client.traffic_class_set)
try:
conn.transport.open()
except TException, err:
raise RTERPCInterface.RTECommError, "Communication failure with RPC server: %s"%str(err)
conn.THRIFT_API_LOCK = threading.Lock() if serialise_api else RTERPCInterface.NullCtx()
def DoDisconnect(conn):
if conn.transport is not None:
conn.transport.close()
conn.transport = None
#!/bin/bash -x
sudo ifconfig vf0_0 192.168.2.2/24 up
sudo ifconfig vf0_1 192.168.2.3/24 up
# create a MAC VLAN for docker attached to vf0_1
echo "y" | docker system prune
docker network create -d macvlan --subnet=192.168.2.0/24 --aux-address="vf0_0=192.168.2.2" --aux-address="vf0_1=192.168.2.3" -o parent=vf0_1 pub_net
# move vf0_0 into its own namespace
# sudo ip netns exec ns_server ip link set vf0_0 netns 1
# sudo ip netns delete ns_server
# sudo ip netns add ns_server
# sudo ip link set vf0_0 netns ns_server
# sudo ip netns exec ns_server ip addr add dev vf0_0 192.168.2.2/24
# sudo ip netns exec ns_server ip link set dev vf0_0 up
# sudo ip netns exec ns_server arp -s 192.168.2.3 00:22:22:22:22:22 -i vf0_0
# sudo ip netns exec ns_server arp -s 192.168.2.4 00:33:33:33:33:33 -i vf0_0
# sudo arp -s 192.168.2.2 00:11:11:11:11:11 -i vf0_1
# sudo arp -s 192.168.2.4 00:33:33:33:33:33 -i vf0_1
\ No newline at end of file
#! /bin/bash -x
compile_flag=0
location=$(pwd)
while getopts 'c' flag; do
case "${flag}" in
c) compile_flag=1 ;;
esac
done
if [[ $compile_flag -eq 1 ]]
then
# compile the nfp code
sudo /opt/netronome/p4/bin/nfp4build -o ./p4src/echo.nffw -p ./p4src/out -4 ./p4src/echo.p4 -l lithium --nfp4c_p4_version 16 --nfp4c_p4_compiler p4c-nfp -c ./p4src/prime.c
fi
# move to p4 bin
cd /opt/netronome/p4/bin/
# #offload
sudo ./rtecli design-load -f $location/p4src/echo.nffw -c $location/p4src/echo.p4cfg -p $location/p4src/out/pif_design.json
# returning back to base
cd $location
\ No newline at end of file
#!/usr/bin/env python
#
# based on the RunTimeEnvironment-remote example
# that comes generated by thrift
#
import argparse
import struct
import sys
import pprint
import collections
import time
sys.path.append('../../out/gen_thrift/py')
from urlparse import urlparse
from thrift.transport import TTransport
from thrift.transport import TZlibTransport
from thrift.transport import TSocket
#from thrift.transport import TSSLSocket
from thrift.transport import THttpClient
from thrift.protocol import TBinaryProtocol
from sdk6_rte import RunTimeEnvironment
from sdk6_rte.ttypes import *
if __name__ == '__main__':
#
# Argument handling
#
parser = argparse.ArgumentParser()
parser.add_argument('-s','--server',
dest='rpc_server', default='localhost',
type=str,
help="Thrift RPC host (DEFAULT: localhost)")
parser.add_argument('-p','--port',
dest='rpc_port', default='20206',
type=str,
help="Thrift RPC port (DEFAULT: 20206)")
parser.set_defaults()
args = parser.parse_args()
use_zlib = 1
host = args.rpc_server
port = int(args.rpc_port)
socket = TSocket.TSocket(host, port)
transport = TTransport.TBufferedTransport(socket)
if use_zlib:
transport = TZlibTransport.TZlibTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = RunTimeEnvironment.Client(protocol)
transport.open()
try:
client.sys_ping()
except TException:
transport.close()
sys.stderr.write("Basic communication with RPC server failed\n")
sys.exit(1)
# grab all the digest info
digests = client.digest_list_all()
# a map for associating registration handle with digest data
digest_map = collections.OrderedDict()
# register for each digest
for d in digests:
# get the digest registration handle
dh = client.digest_register(d.id)
if dh < 0:
sys.stderr.write("Failed to register for digest %s\n" % d.name)
sys.exit(1)
# associate the registration handle with the digest data
digest_map[dh] = {'desc' : d, 'count' : 0}
print "polling for digests events"
# okay now periodically retrieve and dump the digest data
try:
while 1:
for dh, dgdata in digest_map.items():
values = client.digest_retrieve(dh)
if len(values) == 0: # no data
continue
fldcnt = len(dgdata['desc'].fields)
if len(values) % fldcnt != 0:
sys.stderr.write("Invalid field layout from digest %s" %
dgdata['desc'].name)
sys.exit(1)
for i in range(len(values) / fldcnt):
print "digest %s (P4 ID %d, P4 fieldlist %s)[%d] {" % (
dgdata['desc'].name,
dgdata['desc'].app_id,
dgdata['desc'].field_list_name,
dgdata['count'])
for flddesc, fielddata in zip(dgdata['desc'].fields, values[fldcnt * i:fldcnt * (i + 1)]):
print " %s : %s" % (flddesc.name, fielddata)
print "}\n"
dgdata['count'] += 1
time.sleep(2)
except KeyboardInterrupt: # exit on control-c
pass
transport.close()
This source diff could not be displayed because it is too large. You can view the blob instead.
#
# Generated Makefile for echo
#
ifndef SDKDIR
export SDKDIR=/opt/netronome
endif
ifndef SDKTOOLSDIR
SDKTOOLSDIR=$(SDKDIR)/bin
endif
ifndef SDKP4DIR
SDKP4DIR=$(SDKDIR)/p4
endif
ifndef OUTDIR
OUTDIR=.
endif
ifndef PIFOUTDIR
PIFOUTDIR=out
endif
NFP4C_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfp4c ]; then echo "found"; fi)
ifneq ($(NFP4C_FOUND),found)
$(warning warning: nfp4c not found or not executable, on windows please run nfp4term.bat)
endif
NFIRC_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfirc ]; then echo "found"; fi)
ifneq ($(NFIRC_FOUND),found)
$(warning warning: nfirc not found or not executable, on windows please run nfp4term.bat)
endif
NFLD_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfld ]; then echo "found"; fi)
ifneq ($(NFLD_FOUND),found)
$(warning warning: nfld not found or not executable, on windows please run nfp4term.bat)
endif
NFCC_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfcc ]; then echo "found"; fi)
ifneq ($(NFCC_FOUND),found)
$(warning warning: nfcc not found or not executable, on windows please run nfp4term.bat)
endif
NFAS_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfas ]; then echo "found"; fi)
ifneq ($(NFAS_FOUND),found)
$(warning warning: nfas not found or not executable, on windows please run nfp4term.bat)
endif
NFP4C_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfp4c ]; then echo "found"; fi)
ifneq ($(NFP4C_FOUND),found)
$(warning warning: nfp4c not found or not executable, on windows please run nfp4term.bat)
endif
NFIRC_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfirc ]; then echo "found"; fi)
ifneq ($(NFIRC_FOUND),found)
$(warning warning: nfirc not found or not executable, on windows please run nfp4term.bat)
endif
NFLD_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfld ]; then echo "found"; fi)
ifneq ($(NFLD_FOUND),found)
$(warning warning: nfld not found or not executable, on windows please run nfp4term.bat)
endif
NFCC_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfcc ]; then echo "found"; fi)
ifneq ($(NFCC_FOUND),found)
$(warning warning: nfcc not found or not executable, on windows please run nfp4term.bat)
endif
NFAS_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfas ]; then echo "found"; fi)
ifneq ($(NFAS_FOUND),found)
$(warning warning: nfas not found or not executable, on windows please run nfp4term.bat)
endif
NFP4C_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfp4c ]; then echo "found"; fi)
ifneq ($(NFP4C_FOUND),found)
$(warning warning: nfp4c not found or not executable, on windows please run nfp4term.bat)
endif
NFIRC_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfirc ]; then echo "found"; fi)
ifneq ($(NFIRC_FOUND),found)
$(warning warning: nfirc not found or not executable, on windows please run nfp4term.bat)
endif
NFLD_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfld ]; then echo "found"; fi)
ifneq ($(NFLD_FOUND),found)
$(warning warning: nfld not found or not executable, on windows please run nfp4term.bat)
endif
NFCC_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfcc ]; then echo "found"; fi)
ifneq ($(NFCC_FOUND),found)
$(warning warning: nfcc not found or not executable, on windows please run nfp4term.bat)
endif
NFAS_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfas ]; then echo "found"; fi)
ifneq ($(NFAS_FOUND),found)
$(warning warning: nfas not found or not executable, on windows please run nfp4term.bat)
endif
NFP4C_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfp4c ]; then echo "found"; fi)
ifneq ($(NFP4C_FOUND),found)
$(warning warning: nfp4c not found or not executable, on windows please run nfp4term.bat)
endif
NFIRC_FOUND = $(shell if [ -x $(SDKP4DIR)/bin/nfirc ]; then echo "found"; fi)
ifneq ($(NFIRC_FOUND),found)
$(warning warning: nfirc not found or not executable, on windows please run nfp4term.bat)
endif
NFLD_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfld ]; then echo "found"; fi)
ifneq ($(NFLD_FOUND),found)
$(warning warning: nfld not found or not executable, on windows please run nfp4term.bat)
endif
NFCC_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfcc ]; then echo "found"; fi)
ifneq ($(NFCC_FOUND),found)
$(warning warning: nfcc not found or not executable, on windows please run nfp4term.bat)
endif
NFAS_FOUND = $(shell if [ -x $(SDKTOOLSDIR)/nfas ]; then echo "found"; fi)
ifneq ($(NFAS_FOUND),found)
$(warning warning: nfas not found or not executable, on windows please run nfp4term.bat)
endif
$(OUTDIR)/echo.nffw: $(OUTDIR)/nfd_pcie0_pd0.list/nfd_pcie0_pd0.list \
$(OUTDIR)/nfd_pcie0_pci_in_issue1.list/nfd_pcie0_pci_in_issue1.list \
$(OUTDIR)/nfd_pcie0_pci_out_me0.list/nfd_pcie0_pci_out_me0.list \
$(OUTDIR)/nbi_init_csr.list/nbi_init_csr.list \
$(OUTDIR)/nfd_pcie0_pd1.list/nfd_pcie0_pd1.list \
$(OUTDIR)/nfd_pcie0_pci_in_issue0.list/nfd_pcie0_pci_in_issue0.list \
$(OUTDIR)/gro1.list/gro1.list \
$(OUTDIR)/pif_app_nfd.list/pif_app_nfd.list \
$(OUTDIR)/app_master.list/app_master.list \
$(OUTDIR)/nfd_svc.list/nfd_svc.list \
$(OUTDIR)/blm0.list/blm0.list \
$(OUTDIR)/gro0.list/gro0.list \
$(OUTDIR)/nfd_pcie0_notify.list/nfd_pcie0_notify.list \
$(OUTDIR)/nfd_pcie0_pci_in_gather.list/nfd_pcie0_pci_in_gather.list \
$(OUTDIR)/flowcache_timeout_emu0.list/flowcache_timeout_emu0.list \
$(OUTDIR)/nfd_pcie0_sb.list/nfd_pcie0_sb.list \
$(PIFOUTDIR)/build_info.json \
$(MAKEFILE_LIST)
@echo ---------
@echo linking $@
@echo ---------
$(SDKTOOLSDIR)/nfld -rtsyms -mip -user_note_f pif_debug_json "$(PIFOUTDIR)/pif_debug.json" -user_note_f build_info_json "$(PIFOUTDIR)/build_info.json" -g -user_note_f pif_design_json "$(PIFOUTDIR)/pif_design.json" \
-i i8 -e $(SDKDIR)/components/standardlibrary/picocode/nfp6000/catamaran/catamaran.npfw \
-chip nfp-4xxxc-b0 -g -o $@ \
-u i36.me9 $(OUTDIR)/nfd_pcie0_pd0.list/nfd_pcie0_pd0.list \
-u pcie0.me3 $(OUTDIR)/nfd_pcie0_pci_in_issue1.list/nfd_pcie0_pci_in_issue1.list \
-u pcie0.me0 $(OUTDIR)/nfd_pcie0_pci_out_me0.list/nfd_pcie0_pci_out_me0.list \
-u i36.me7 $(OUTDIR)/nfd_pcie0_pd1.list/nfd_pcie0_pd1.list \
-u pcie0.me2 $(OUTDIR)/nfd_pcie0_pci_in_issue0.list/nfd_pcie0_pci_in_issue0.list \
-u i48.me1 $(OUTDIR)/gro1.list/gro1.list \
-u i32.me0 i33.me0 i34.me0 i35.me0 i36.me0 i32.me1 i33.me1 \
i34.me1 i35.me1 i36.me1 i32.me2 i33.me2 i34.me2 i35.me2 \
i36.me2 i32.me3 i33.me3 i34.me3 i35.me3 i36.me3 i32.me4 \
i33.me4 i34.me4 i35.me4 i36.me4 i32.me5 i33.me5 i34.me5 \
i35.me5 i36.me5 i32.me6 i33.me6 i34.me6 i35.me6 i32.me7 \
i33.me7 i34.me7 i35.me7 i32.me8 i33.me8 i34.me8 i35.me8 \
i32.me9 i33.me9 i34.me9 i35.me9 i32.me10 i33.me10 i34.me10 \
i35.me10 i32.me11 i33.me11 i34.me11 i35.me11 $(OUTDIR)/pif_app_nfd.list/pif_app_nfd.list \
-u i36.me11 $(OUTDIR)/app_master.list/app_master.list \
-u i48.me2 $(OUTDIR)/nfd_svc.list/nfd_svc.list \
-u i48.me3 $(OUTDIR)/blm0.list/blm0.list \
-u i48.me0 $(OUTDIR)/gro0.list/gro0.list \
-u i36.me6 $(OUTDIR)/nfd_pcie0_notify.list/nfd_pcie0_notify.list \
-u pcie0.me1 $(OUTDIR)/nfd_pcie0_pci_in_gather.list/nfd_pcie0_pci_in_gather.list \
-u i36.me10 $(OUTDIR)/flowcache_timeout_emu0.list/flowcache_timeout_emu0.list \
-u i36.me8 $(OUTDIR)/nfd_pcie0_sb.list/nfd_pcie0_sb.list \
-L $(OUTDIR)/nbi_init_csr.list/nbi_init_csr.list
#
# Generate build info json
#
$(PIFOUTDIR)/build_info.json: $(MAKEFILE_LIST)
@echo ---------
@echo generating $@
@echo ---------
@mkdir -p $(PIFOUTDIR)
@echo -n {\"sku\": \"nfp-4xxxc-b0\", \"worker_mes\": [\"i32.me0\", \"i33.me0\", \"i34.me0\", \"i35.me0\", \"i36.me0\", \"i32.me1\", \"i33.me1\", \"i34.me1\", \"i35.me1\", \"i36.me1\", \"i32.me2\", \"i33.me2\", \"i34.me2\", \"i35.me2\", \"i36.me2\", \"i32.me3\", \"i33.me3\", \"i34.me3\", \"i35.me3\", \"i36.me3\", \"i32.me4\", \"i33.me4\", \"i34.me4\", \"i35.me4\", \"i36.me4\", \"i32.me5\", \"i33.me5\", \"i34.me5\", \"i35.me5\", \"i36.me5\", \"i32.me6\", \"i33.me6\", \"i34.me6\", \"i35.me6\", \"i32.me7\", \"i33.me7\", \"i34.me7\", \"i35.me7\", \"i32.me8\", \"i33.me8\", \"i34.me8\", \"i35.me8\", \"i32.me9\", \"i33.me9\", \"i34.me9\", \"i35.me9\", \"i32.me10\", \"i33.me10\", \"i34.me10\", \"i35.me10\", \"i32.me11\", \"i33.me11\", \"i34.me11\", \"i35.me11\"], \"reduced_thread_usage\": true, \"debug_info\": true, \"simulation\": false} >$@
#
# Generate IR from P4
#
$(OUTDIR)/echo.yml: echo.p4 \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling p4 $@
@echo ---------
@mkdir -p $(PIFOUTDIR)
$(SDKP4DIR)/bin/nfp4c -o $(OUTDIR)/echo.yml \
--p4-version 16 \
--p4-compiler p4c-nfp \
--source_info \
echo.p4
#
# Generate PIF from IR
#
$(PIFOUTDIR)/pif_design%c \
$(PIFOUTDIR)/pif_design%h \
$(PIFOUTDIR)/pif_parrep%c \
$(PIFOUTDIR)/pif_parrep%h \
$(PIFOUTDIR)/pif_actions%c \
$(PIFOUTDIR)/pif_actions%h \
$(PIFOUTDIR)/pif_global%c \
$(PIFOUTDIR)/pif_global%h \
$(PIFOUTDIR)/pif_ctlflow%c \
$(PIFOUTDIR)/pif_ctlflow%h \
$(PIFOUTDIR)/pif_tables%c \
$(PIFOUTDIR)/pif_tables%h \
$(PIFOUTDIR)/pif_deparse%c \
$(PIFOUTDIR)/pif_digests%c \
$(PIFOUTDIR)/pif_digests%h \
$(PIFOUTDIR)/pif_meters%c \
$(PIFOUTDIR)/pif_meters%h \
$(PIFOUTDIR)/pif_registers%c \
$(PIFOUTDIR)/pif_registers%h \
$(PIFOUTDIR)/pif_pkt_recurse%c \
$(PIFOUTDIR)/pif_pkt_recurse%h \
$(PIFOUTDIR)/pif_pkt_clone%c \
$(PIFOUTDIR)/pif_pkt_clone%h \
$(PIFOUTDIR)/pif_flcalc%c \
$(PIFOUTDIR)/pif_flcalc%h \
$(PIFOUTDIR)/pif_field_lists%h \
$(PIFOUTDIR)/pif_parrep_pvs_sync%c : $(OUTDIR)/echo%yml $(MAKEFILE_LIST)
@echo ---------
@echo generating pif $@
@echo ---------
@mkdir -p $(PIFOUTDIR)
$(SDKP4DIR)/bin/nfirc -o $(PIFOUTDIR)/ \
--p4info $(OUTDIR)/echo.p4info.json \
--debugpoints \
$(OUTDIR)/echo.yml
#
# NFD_PCIE0_PD0
#
$(OUTDIR)/nfd_pcie0_pd0.list/nfd_pcie0_pd0.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_pd.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pd0.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DSTAGE_BATCH_MANAGER_CTX=0 \
-DNFD_OUT_SB_WQ_NUM=15 \
-DNFD_OUT_STAGE_ME="__nfp_idstr2meid(\"i36.me8\")" \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-go \
-t \
-W3 \
-R \
-lm 0 \
-C \
-Of \
-Os \
-O \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_uc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_pd.uc
#
# NFD_PCIE0_PCI_IN_ISSUE1
#
$(OUTDIR)/nfd_pcie0_pci_in_issue1.list/nfd_pcie0_pci_in_issue1.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me1.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pci_in_issue1.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_IN_NOTIFY_ME="__nfp_idstr2meid(\"i36.me6\")" \
-DPCI_IN_ISSUE_DMA_IDX=1 \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=4 \
-Qnctx_mode=4 \
-Qlmpt_reserve_option=0xc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_pci_in_issue1.list/ \
-Fe$(OUTDIR)/nfd_pcie0_pci_in_issue1.list/nfd_pcie0_pci_in_issue1 $(NFCC_FLAGS) \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me1.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# NFD_PCIE0_PCI_OUT_ME0
#
$(OUTDIR)/nfd_pcie0_pci_out_me0.list/nfd_pcie0_pci_out_me0.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_me0.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pci_out_me0.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_CFG_SIG_NEXT_ME="nfd_cfg_sig_sb" \
-DNFD_CFG_NEXT_ME="__nfp_idstr2meid(\"i36.me8\")" \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-Qlm_start=512 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_pci_out_me0.list/ \
-Fe$(OUTDIR)/nfd_pcie0_pci_out_me0.list/nfd_pcie0_pci_out_me0 $(NFCC_FLAGS) \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_me0.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# NBI_INIT_CSR
#
$(OUTDIR)/nbi_init_csr.list/nbi_init_csr.list: $(SDKP4DIR)/components/nfp_pif/me/apps/common/src/nbi_init.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/nbi_init_csr.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-chip nfp-4xxxc-b0 \
-go \
-W3 \
-R \
-C \
-permit_dram_unaligned \
-preproc64 \
-keep_unreachable_code \
-lm 0 \
-codeless \
-I$(SDKDIR)/components/flowenv/me/blocks/init \
-I$(SDKDIR)/components/flowenv/me/blocks/init/_uc \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKP4DIR)/components/nfp_pif/me/apps/common/src/nbi_init.uc
#
# NFD_PCIE0_PD1
#
$(OUTDIR)/nfd_pcie0_pd1.list/nfd_pcie0_pd1.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_pd.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pd1.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DSTAGE_BATCH_MANAGER_CTX=0 \
-DNFD_OUT_SB_WQ_NUM=15 \
-DNFD_OUT_STAGE_ME="__nfp_idstr2meid(\"i36.me8\")" \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-go \
-t \
-W3 \
-R \
-lm 0 \
-C \
-Of \
-Os \
-O \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_uc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_pd.uc
#
# NFD_PCIE0_PCI_IN_ISSUE0
#
$(OUTDIR)/nfd_pcie0_pci_in_issue0.list/nfd_pcie0_pci_in_issue0.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me1.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pci_in_issue0.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_IN_NOTIFY_ME="__nfp_idstr2meid(\"i36.me6\")" \
-DPCI_IN_ISSUE_DMA_IDX=0 \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=4 \
-Qnctx_mode=4 \
-Qlmpt_reserve_option=0xc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_pci_in_issue0.list/ \
-Fe$(OUTDIR)/nfd_pcie0_pci_in_issue0.list/nfd_pcie0_pci_in_issue0 $(NFCC_FLAGS) \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me1.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# GRO1
#
$(OUTDIR)/gro1.list/gro1.list: $(SDKP4DIR)/components/gro/me/gro_out.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/gro1.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_VERSION=0x03010000 \
-DNFP_LIB_ANY_NFAS_VERSION \
-DGRO_BLOCK_NUM=1 \
-chip nfp-4xxxc-b0 \
-go \
-W3 \
-R \
-C \
-indirect_ref_format_nfp6000 \
-third_party_addressing_40_bit \
-permit_dram_unaligned \
-preproc64 \
-keep_unreachable_code \
-lm 0 \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/gro \
-I$(SDKP4DIR)/components/gro/me \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKP4DIR)/components/gro/me/gro_out.uc
#
# PIF_APP_NFD
#
$(OUTDIR)/pif_app_nfd.list/pif_app_nfd.list: $(SDKP4DIR)/components/nfp_pif/me/apps/common/src/fc.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/src/camp_hash.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_cam_add_inc.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cam.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pif_app_nfd.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pkt_clone.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/mcast.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pif_app_controller.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/cflow_tstamp/src/cflow_tstamp.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKDIR)/components/flowenv/me/lib/pktio/libpktio.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/libnfd.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflushuser.c \
$(PIFOUTDIR)/pif_design.c \
$(PIFOUTDIR)/pif_parrep.c \
$(PIFOUTDIR)/pif_actions.c \
$(PIFOUTDIR)/pif_global.c \
$(PIFOUTDIR)/pif_ctlflow.c \
$(PIFOUTDIR)/pif_tables.c \
$(PIFOUTDIR)/pif_deparse.c \
$(PIFOUTDIR)/pif_digests.c \
$(PIFOUTDIR)/pif_meters.c \
$(PIFOUTDIR)/pif_registers.c \
$(PIFOUTDIR)/pif_pkt_recurse.c \
$(PIFOUTDIR)/pif_pkt_clone.c \
$(PIFOUTDIR)/pif_flcalc.c \
$(SDKP4DIR)/components/gro/libgro.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/mac_time_user.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_action_common.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_meter.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_lookup.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_pkt.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_counters.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_init.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_flcalc_algorithms.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_memops.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
prime.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/pif_app_nfd.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DPIF_APP_MASTER_ME=0x204 \
-DHASHMAP_CAMPHASH \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=4 \
-Qnctx_mode=4 \
-Qnn_mode=1 \
-Qspill=3 \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/include \
-I$(SDKP4DIR)/components/flowcache/me/lib/flowcache \
-I$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/cflow_tstamp/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/nfp_pif/shared/include \
-I$(SDKDIR)/components/ng_nfd/me/lib \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/lib \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/gro \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/pif/include \
-I$(SDKP4DIR)/components/dcfl/me/lib/dcfl \
-I$(SDKP4DIR)/components/dcfl/shared/include/dcfl \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/pif_app_nfd.list/ \
-Fe$(OUTDIR)/pif_app_nfd.list/pif_app_nfd $(NFCC_FLAGS) \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/fc.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/src/camp_hash.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_cam_add_inc.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cam.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pif_app_nfd.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pkt_clone.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/mcast.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/pif_app_controller.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/cflow_tstamp/src/cflow_tstamp.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKDIR)/components/flowenv/me/lib/pktio/libpktio.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/libnfd.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflushuser.c \
$(PIFOUTDIR)/pif_design.c \
$(PIFOUTDIR)/pif_parrep.c \
$(PIFOUTDIR)/pif_actions.c \
$(PIFOUTDIR)/pif_global.c \
$(PIFOUTDIR)/pif_ctlflow.c \
$(PIFOUTDIR)/pif_tables.c \
$(PIFOUTDIR)/pif_deparse.c \
$(PIFOUTDIR)/pif_digests.c \
$(PIFOUTDIR)/pif_meters.c \
$(PIFOUTDIR)/pif_registers.c \
$(PIFOUTDIR)/pif_pkt_recurse.c \
$(PIFOUTDIR)/pif_pkt_clone.c \
$(PIFOUTDIR)/pif_flcalc.c \
$(SDKP4DIR)/components/gro/libgro.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/mac_time_user.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_action_common.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_meter.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_lookup.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_pkt.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_counters.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_init.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_flcalc_algorithms.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_memops.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
prime.c
#
# APP_MASTER
#
$(OUTDIR)/app_master.list/app_master.list: $(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/src/camp_hash.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/libnfd.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflushuser.c \
$(SDKP4DIR)/components/gro/libgro.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/src/app_master.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/app_master_common.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_init.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/mac_time.c \
$(PIFOUTDIR)/pif_digests.c \
$(PIFOUTDIR)/pif_parrep_pvs_sync.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflush.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_cam_add_inc.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cam.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/app_master.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DPKT_MOD_SCRIPT_INIT_CSR \
-DGLOBAL_INIT \
-DHASHMAP_CAMPHASH \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-Qnn_mode=1 \
-Qspill=3 \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/nfp_pif/shared/include \
-I$(SDKDIR)/components/ng_nfd/me/lib \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/lib \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/gro \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/pif/include \
-I$(SDKP4DIR)/components/nfp_pif/me/lib/macflush \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKP4DIR)/components/flowcache/me/lib/flowcache \
-I$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary \
-I$(SDKP4DIR)/components/dcfl/me/lib/dcfl \
-I$(SDKP4DIR)/components/dcfl/shared/include/dcfl \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/app_master.list/ \
-Fe$(OUTDIR)/app_master.list/app_master $(NFCC_FLAGS) \
$(SDKP4DIR)/components/nfp_pif/me/lib/hashmap/src/camp_hash.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/libnfd.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflushuser.c \
$(SDKP4DIR)/components/gro/libgro.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/src/app_master.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/app_master_common.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/pif_init.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/pif/src/mac_time.c \
$(PIFOUTDIR)/pif_digests.c \
$(PIFOUTDIR)/pif_parrep_pvs_sync.c \
$(SDKP4DIR)/components/nfp_pif/me/lib/macflush/libmacflush.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_cam_add_inc.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cam.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c
#
# NFD_SVC
#
$(OUTDIR)/nfd_svc.list/nfd_svc.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/svc_me.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_svc.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_CFG_NEXT_ME0="__nfp_idstr2meid(\"i36.me11\")" \
-DNFD_CFG_SIG_NEXT_ME0="nfd_cfg_sig_app_master0" \
-DNFD_CFG_NEXT_ME1="__nfp_idstr2meid(\"i36.me11\")" \
-DNFD_CFG_SIG_NEXT_ME1="nfd_cfg_sig_app_master1" \
-DNFD_CFG_NEXT_ME2="__nfp_idstr2meid(\"i36.me11\")" \
-DNFD_CFG_SIG_NEXT_ME2="nfd_cfg_sig_app_master2" \
-DNFD_CFG_NEXT_ME3="__nfp_idstr2meid(\"i36.me11\")" \
-DNFD_CFG_SIG_NEXT_ME3="nfd_cfg_sig_app_master3" \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-Qnn_mode=1 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_svc.list/ \
-Fe$(OUTDIR)/nfd_svc.list/nfd_svc $(NFCC_FLAGS) \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/svc_me.c \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# BLM0
#
$(OUTDIR)/blm0.list/blm0.list: $(SDKDIR)/components/flowenv/me/blocks/blm/blm_main.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/blm0.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DBLM_0_ISLAND_48 \
-DNBII=8 \
-DBLM_INSTANCE_ID=0 \
-DBLM_INIT_EMU_RINGS \
-DBLM_BLQ_EMEM_TYPE=emem \
-chip nfp-4xxxc-b0 \
-go \
-W3 \
-R \
-C \
-Of \
-Os \
-O \
-indirect_ref_format_nfp6000 \
-third_party_addressing_40_bit \
-permit_dram_unaligned \
-preproc64 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_uc \
-I$(SDKDIR)/components/flowenv/me/blocks/blm \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKDIR)/components/flowenv/me/blocks/blm/blm_main.uc
#
# GRO0
#
$(OUTDIR)/gro0.list/gro0.list: $(SDKP4DIR)/components/gro/me/gro_out.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/gro0.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_VERSION=0x03010000 \
-DNFP_LIB_ANY_NFAS_VERSION \
-DGRO_BLOCK_NUM=0 \
-chip nfp-4xxxc-b0 \
-go \
-W3 \
-R \
-C \
-indirect_ref_format_nfp6000 \
-third_party_addressing_40_bit \
-permit_dram_unaligned \
-preproc64 \
-keep_unreachable_code \
-lm 0 \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/gro \
-I$(SDKP4DIR)/components/gro/me \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKP4DIR)/components/gro/me/gro_out.uc
#
# NFD_PCIE0_NOTIFY
#
$(OUTDIR)/nfd_pcie0_notify.list/nfd_pcie0_notify.list: $(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in/notify.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_notify.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_IN_DATA_DMA_ME0="__nfp_idstr2meid(\"pcie0.me2\")" \
-DNFD_IN_DATA_DMA_ME1="__nfp_idstr2meid(\"pcie0.me3\")" \
-DPCIE_ISL=0 \
-DNFD_IN_NOTIFY_DBG_CHKS \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=4 \
-Qnctx_mode=4 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_notify.list/ \
-Fe$(OUTDIR)/nfd_pcie0_notify.list/nfd_pcie0_notify $(NFCC_FLAGS) \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in/notify.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# NFD_PCIE0_PCI_IN_GATHER
#
$(OUTDIR)/nfd_pcie0_pci_in_gather.list/nfd_pcie0_pci_in_gather.list: $(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me0.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_pci_in_gather.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_IN_DATA_DMA_ME0="__nfp_idstr2meid(\"pcie0.me2\")" \
-DNFD_IN_DATA_DMA_ME1="__nfp_idstr2meid(\"pcie0.me3\")" \
-DNFD_OUT_CACHE_ME="__nfp_idstr2meid(\"pcie0.me0\")" \
-DPCIE_ISL=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-I$(SDKDIR)/components/flowenv/me/blocks/blm/_h \
-I$(SDKDIR)/components/flowenv/me/blocks \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKDIR)/components/ng_nfd \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/nfd_pcie0_pci_in_gather.list/ \
-Fe$(OUTDIR)/nfd_pcie0_pci_in_gather.list/nfd_pcie0_pci_in_gather $(NFCC_FLAGS) \
$(SDKDIR)/components/flowenv/me/blocks/blm/libblm.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_in_me0.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/utils/libutils.c \
$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared/nfd_cfg.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# FLOWCACHE_TIMEOUT_EMU0
#
$(OUTDIR)/flowcache_timeout_emu0.list/flowcache_timeout_emu0.list: $(SDKP4DIR)/components/nfp_pif/me/apps/common/src/fc.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timeout.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timeout_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo compiling $@
@echo ---------
@mkdir -p $(OUTDIR)/flowcache_timeout_emu0.list
$(SDKTOOLSDIR)/nfcc -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DFC_TIMEOUT_EMU=0 \
-chip nfp-4xxxc-b0 \
-W3 \
-Qno_decl_volatile \
-O2 \
-mIPOPT_nfp=2 \
-Zi \
-ng \
-Qnctx=8 \
-Qnctx_mode=8 \
-Qnn_mode=1 \
-Qspill=3 \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKP4DIR)/components/nfp_pif/shared/include \
-I$(SDKP4DIR)/components/flowcache/me/lib/flowcache \
-I$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary \
-I$(SDKP4DIR)/components/dcfl/me/lib/dcfl \
-I$(SDKP4DIR)/components/dcfl/shared/include/dcfl \
-I$(SDKDIR)/components/standardlibrary/microc/include \
-I$(SDKDIR)/components/standardlibrary/microc/src \
-I$(SDKDIR)/components/flowenv/me/include \
-I$(SDKDIR)/components/flowenv/me/include/nfp6000 \
-I$(SDKDIR)/components/flowenv/me/lib \
-I$(SDKDIR)/components/flowenv/me/lib/nfp \
-I$(PIFOUTDIR)/ \
-I$(PIFOUTDIR)/callbackapi \
-I$(SDKDIR)/components/standardlibrary/include \
-FI$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-Fo$(OUTDIR)/flowcache_timeout_emu0.list/ \
-Fe$(OUTDIR)/flowcache_timeout_emu0.list/flowcache_timeout_emu0 $(NFCC_FLAGS) \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/fc.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/dcfl_init.c \
$(SDKP4DIR)/components/nfp_pif/me/apps/common/src/system_init.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_remove.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timeout.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timeout_lock.c \
$(SDKP4DIR)/components/flowcache/me/lib/flowcache/_c/flow_cache_timestamp.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/cluster_target.c \
$(SDKP4DIR)/components/flowcache/me/lib/standardlibrary/_c/mem_atomic_indirect.c \
$(SDKP4DIR)/components/dcfl/me/lib/dcfl/libdcfl.c \
$(SDKDIR)/components/standardlibrary/microc/src/intrinsic.c \
$(SDKDIR)/components/standardlibrary/microc/src/rtl.c \
$(SDKDIR)/components/flowenv/me/lib/nfp/libnfp.c \
$(SDKDIR)/components/flowenv/me/lib/std/libstd.c \
$(SDKDIR)/components/flowenv/me/lib/pkt/libpkt.c \
$(SDKDIR)/components/flowenv/me/lib/pktdma/libpktdma.c \
$(SDKDIR)/components/flowenv/me/lib/net/libnet.c \
$(SDKDIR)/components/flowenv/me/lib/modscript/libmodscript.c
#
# NFD_PCIE0_SB
#
$(OUTDIR)/nfd_pcie0_sb.list/nfd_pcie0_sb.list: $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_sb.uc \
$(PIFOUTDIR)/pif_design.h \
$(MAKEFILE_LIST)
@echo ---------
@echo assembling $@
@echo ---------
@mkdir -p $(OUTDIR)/nfd_pcie0_sb.list
$(SDKTOOLSDIR)/nfas -DPLATFORM_PORT_SELECTION=H_PLATFORM \
-DPIF_APP_CONFIG=PIF_APP_DEFAULT \
-DNUM_IMU=1 \
-DNUM_EMU=1 \
-DSIMULATION=0 \
-DPIF_APP_REDUCED_THREADS=1 \
-DPIF_DEBUG=1 \
-DNFD_CFG_SIG_NEXT_ME="_nfd_cfg_sig_svc_me0" \
-DPCIE_ISL=0 \
-DSTAGE_BATCH_MANAGER_CTX=0 \
-DSTAGE_BATCH_FIRST_WORKER=1 \
-DSTAGE_BATCH_NUM_WORKERS=7 \
-DNFD_OUT_SB_WQ_NUM=15 \
-DNFD_CFG_NEXT_ME="__nfp_idstr2meid(\"i48.me2\")" \
-chip nfp-4xxxc-b0 \
-go \
-t \
-W3 \
-R \
-lm 0 \
-C \
-Of \
-Os \
-O \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic \
-I$(SDKDIR)/components/ng_nfd/me/blocks/vnic/shared \
-I$(SDKDIR)/components/ng_nfd/me/blocks \
-I$(SDKDIR)/components/ng_nfd/shared \
-I$(SDKP4DIR)/components/nfp_pif/me/apps/common/include \
-I$(SDKDIR)/components/standardlibrary/microcode/src \
-I$(SDKDIR)/components/standardlibrary/microcode/include \
-I$(PIFOUTDIR)/ \
-I$(SDKDIR)/components/standardlibrary/include \
-include $(SDKP4DIR)/components/nfp_pif/me/apps/pif_app_nfd/include/config.h \
-o $@ $(SDKDIR)/components/ng_nfd/me/blocks/vnic/pci_out_sb.uc
clean:
rm -f $(OUTDIR)/*.nffw $(OUTDIR)/*.elf \
$(OUTDIR)/*.mif $(OUTDIR)/*.mift \
$(OUTDIR)/*.uci $(OUTDIR)/*.ucp \
$(OUTDIR)/*.dbg
rm -rf $(OUTDIR)/nfd_pcie0_pd0.list
rm -rf $(OUTDIR)/nfd_pcie0_pci_in_issue1.list
rm -rf $(OUTDIR)/nfd_pcie0_pci_out_me0.list
rm -rf $(OUTDIR)/nbi_init_csr.list
rm -rf $(OUTDIR)/nfd_pcie0_pd1.list
rm -rf $(OUTDIR)/nfd_pcie0_pci_in_issue0.list
rm -rf $(OUTDIR)/gro1.list
rm -rf $(OUTDIR)/pif_app_nfd.list
rm -rf $(OUTDIR)/app_master.list
rm -rf $(OUTDIR)/nfd_svc.list
rm -rf $(OUTDIR)/blm0.list
rm -rf $(OUTDIR)/gro0.list
rm -rf $(OUTDIR)/nfd_pcie0_notify.list
rm -rf $(OUTDIR)/nfd_pcie0_pci_in_gather.list
rm -rf $(OUTDIR)/flowcache_timeout_emu0.list
rm -rf $(OUTDIR)/nfd_pcie0_sb.list
rm -f $(OUTDIR)/*.yml $(OUTDIR)/*.svg
rm -f $(PIFOUTDIR)/*.c $(PIFOUTDIR)/*.h $(PIFOUTDIR)/*.json \
$(PIFOUTDIR)/*.txt $(PIFOUTDIR)/*.svg $(PIFOUTDIR)/*.csv
rm -rf $(PIFOUTDIR)/callbackapi
sudo ./pif_rte -n 0 -p 20207 -I -z -s /opt/nfp_pif/scripts/pif_ctl_nfd.sh -f ~/nilanjan/test/offload/p4src/routing_benchmark.nffw -d ~/nilanjan/test/offload/p4src/out_dir/pif_design.json -c ~/nilanjan/test/offload/p4src/echo.p4cfg --log_file /var/log/nfp-sdk6-rte.log
{
"program" : "p4src/echo.p4",
"__meta__" : {
"version" : [2, 7],
"compiler" : "https://github.com/p4lang/p4c"
},
"header_types" : [
{
"name" : "scalars_0",
"id" : 0,
"fields" : [
["temp", 32, false],
["tempEth", 48, false]
]
},
{
"name" : "ethernet_t",
"id" : 1,
"fields" : [
["dstAddr", 48, false],
["srcAddr", 48, false],
["etherType", 16, false]
]
},
{
"name" : "ipv4_t",
"id" : 2,
"fields" : [
["version", 4, false],
["ihl", 4, false],
["diffserv", 8, false],
["totalLen", 16, false],
["identification", 16, false],
["flags", 3, false],
["fragOffset", 13, false],
["ttl", 8, false],
["protocol", 8, false],
["hdrChecksum", 16, false],
["srcAddr", 32, false],
["dstAddr", 32, false]
]
},
{
"name" : "udp_t",
"id" : 3,
"fields" : [
["srcPort", 16, false],
["dstPort", 16, false],
["length_", 16, false],
["checksum", 16, false]
]
},
{
"name" : "map_hdr_t",
"id" : 4,
"fields" : [
["chain_id", 32, false],
["exec_id", 32, false],
["function_id", 8, false],
["data", 32, false],
["function_count", 8, false],
["f0", 8, false],
["f1", 8, false],
["f2", 8, false],
["f3", 8, false],
["f4", 8, false]
]
},
{
"name" : "ingress_metadata_t",
"id" : 5,
"fields" : [
["drop", 1, false],
["egress_port", 9, false],
["packet_type", 4, false],
["_padding", 2, false]
]
},
{
"name" : "resubmit_meta_t",
"id" : 6,
"fields" : [
["current_state", 8, false],
["data", 32, false]
]
},
{
"name" : "exec_hdr_t",
"id" : 7,
"fields" : [
["function_count", 8, false],
["function", 8, false]
]
},
{
"name" : "standard_metadata",
"id" : 8,
"fields" : [
["ingress_port", 16, false],
["packet_length", 14, false],
["egress_spec", 16, false],
["egress_port", 16, false],
["egress_instance", 10, false],
["instance_type", 4, false],
["clone_spec", 32, false],
["parser_error_location", 8, false],
["parser_status", 3, false],
["checksum_error", 1, false]
]
}
],
"headers" : [
{
"name" : "scalars",
"id" : 0,
"header_type" : "scalars_0",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "standard_metadata",
"id" : 1,
"header_type" : "standard_metadata",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "ethernet",
"id" : 2,
"header_type" : "ethernet_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "ipv4",
"id" : 3,
"header_type" : "ipv4_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "udp",
"id" : 4,
"header_type" : "udp_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "map_hdr",
"id" : 5,
"header_type" : "map_hdr_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "ing_metadata",
"id" : 6,
"header_type" : "ingress_metadata_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "resubmit_meta",
"id" : 7,
"header_type" : "resubmit_meta_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "exec_hdr",
"id" : 8,
"header_type" : "exec_hdr_t",
"metadata" : true,
"pi_omit" : true
}
],
"header_stacks" : [],
"header_union_types" : [],
"header_unions" : [],
"header_union_stacks" : [],
"field_lists" : [],
"errors" : [
["NoError", 1],
["PacketTooShort", 2],
["NoMatch", 3],
["StackOutOfBounds", 4],
["HeaderTooShort", 5],
["ParserTimeout", 6]
],
"enums" : [],
"parsers" : [
{
"name" : "parser",
"id" : 0,
"init_state" : "start",
"parse_states" : [
{
"name" : "parse_ipv4",
"id" : 0,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "ipv4"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x00000511",
"mask" : "0x00000fff",
"next_state" : "parse_udp"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
}
],
"source_info" : {
"filename" : "p4src/includes/parsers.p4",
"line" : 3,
"column" : 31,
"source_fragment" : "parse_ipv4"
}
},
{
"name" : "parse_udp",
"id" : 1,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "udp"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x22b9",
"mask" : null,
"next_state" : "parse_map_hdr"
},
{
"value" : "0x2328",
"mask" : null,
"next_state" : "parse_map_hdr"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["udp", "dstPort"]
}
],
"source_info" : {
"filename" : "p4src/includes/parsers.p4",
"line" : 11,
"column" : 30,
"source_fragment" : "parse_udp"
}
},
{
"name" : "parse_map_hdr",
"id" : 2,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "map_hdr"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [],
"source_info" : {
"filename" : "p4src/includes/parsers.p4",
"line" : 20,
"column" : 34,
"source_fragment" : "parse_map_hdr"
}
},
{
"name" : "start",
"id" : 3,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "ethernet"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x0800",
"mask" : null,
"next_state" : "parse_ipv4"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["ethernet", "etherType"]
}
],
"source_info" : {
"filename" : "p4src/includes/parsers.p4",
"line" : 25,
"column" : 26,
"source_fragment" : "start"
}
}
]
}
],
"deparsers" : [
{
"name" : "deparser",
"id" : 0,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 97,
"column" : 8,
"source_fragment" : "DeparserImpl"
},
"order" : ["ethernet", "ipv4", "udp", "map_hdr"]
}
],
"meter_arrays" : [],
"counter_arrays" : [],
"register_arrays" : [
{
"name" : "current_state",
"id" : 0,
"source_info" : {
"filename" : "p4src/includes/headers.p4",
"line" : 12,
"column" : 25,
"source_fragment" : "current_state"
},
"size" : 16384,
"bitwidth" : 8
},
{
"name" : "dispatch_state",
"id" : 1,
"source_info" : {
"filename" : "p4src/includes/headers.p4",
"line" : 13,
"column" : 25,
"source_fragment" : "dispatch_state"
},
"size" : 16384,
"bitwidth" : 8
}
],
"calculations" : [
{
"name" : "calc",
"id" : 0,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 108,
"column" : 8,
"source_fragment" : "verify_checksum( ..."
},
"algo" : "csum16",
"input" : [
{
"type" : "field",
"value" : ["ipv4", "version"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "diffserv"]
},
{
"type" : "field",
"value" : ["ipv4", "totalLen"]
},
{
"type" : "field",
"value" : ["ipv4", "identification"]
},
{
"type" : "field",
"value" : ["ipv4", "flags"]
},
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"output_width" : 16
},
{
"name" : "calc_0",
"id" : 1,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 128,
"column" : 8,
"source_fragment" : "update_checksum( ..."
},
"algo" : "csum16",
"input" : [
{
"type" : "field",
"value" : ["ipv4", "version"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "diffserv"]
},
{
"type" : "field",
"value" : ["ipv4", "totalLen"]
},
{
"type" : "field",
"value" : ["ipv4", "identification"]
},
{
"type" : "field",
"value" : ["ipv4", "flags"]
},
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"output_width" : 16
}
],
"learn_lists" : [],
"actions" : [
{
"name" : "NoAction",
"id" : 0,
"runtime_data" : [],
"primitives" : [],
"source_info" : {
"filename" : "/opt/netronome/p4/include/16/p4include/core.p4",
"line" : 68,
"column" : 7,
"source_fragment" : "NoAction"
}
},
{
"name" : "NoAction",
"id" : 1,
"runtime_data" : [],
"primitives" : [],
"source_info" : {
"filename" : "/opt/netronome/p4/include/16/p4include/core.p4",
"line" : 68,
"column" : 7,
"source_fragment" : "NoAction"
}
},
{
"name" : "set_egress",
"id" : 2,
"runtime_data" : [],
"primitives" : [
{
"op" : "prime",
"parameters" : []
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "temp"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 16,
"column" : 8,
"source_fragment" : "bit<32> temp = hdr.ipv4.dstAddr;"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 17,
"column" : 8,
"source_fragment" : "hdr.ipv4.dstAddr = hdr.ipv4.srcAddr"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["scalars", "temp"]
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 18,
"column" : 8,
"source_fragment" : "hdr.ipv4.srcAddr = temp"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "dstPort"]
},
{
"type" : "hexstr",
"value" : "0x2328"
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 19,
"column" : 8,
"source_fragment" : "hdr.udp.dstPort = 9000"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "tempEth"]
},
{
"type" : "field",
"value" : ["ethernet", "dstAddr"]
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 20,
"column" : 8,
"source_fragment" : "bit<48> tempEth = hdr.ethernet.dstAddr;"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ethernet", "dstAddr"]
},
{
"type" : "field",
"value" : ["ethernet", "srcAddr"]
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 21,
"column" : 8,
"source_fragment" : "hdr.ethernet.dstAddr = hdr.ethernet.srcAddr"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ethernet", "srcAddr"]
},
{
"type" : "field",
"value" : ["scalars", "tempEth"]
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 22,
"column" : 8,
"source_fragment" : "hdr.ethernet.srcAddr = tempEth"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "field",
"value" : ["standard_metadata", "ingress_port"]
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 23,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = standard_metadata.ingress_port"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "expression",
"value" : {
"op" : "+",
"left" : {
"type" : "field",
"value" : ["ipv4", "ttl"]
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
}
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 24,
"column" : 8,
"source_fragment" : "hdr.ipv4.ttl = hdr.ipv4.ttl - 8w1"
}
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 12,
"column" : 32,
"source_fragment" : "set_egress"
}
},
{
"name" : "fwd_act",
"id" : 3,
"runtime_data" : [
{
"name" : "port",
"bitwidth" : 16
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 28,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port"
}
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 27,
"column" : 29,
"source_fragment" : "fwd_act"
}
},
{
"name" : "dispatch_act",
"id" : 4,
"runtime_data" : [
{
"name" : "dstAddr",
"bitwidth" : 32
},
{
"name" : "dstPort",
"bitwidth" : 16
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "hdr.ipv4.dstAddr = dstAddr"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "dstPort"]
},
{
"type" : "runtime_data",
"value" : 1
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 42,
"column" : 8,
"source_fragment" : "hdr.udp.dstPort = dstPort"
}
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 40,
"column" : 34,
"source_fragment" : "dispatch_act"
}
},
{
"name" : "fix_checksum",
"id" : 5,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "checksum"]
},
{
"type" : "hexstr",
"value" : "0x0000"
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 85,
"column" : 8,
"source_fragment" : "hdr.udp.checksum = 16w0"
}
}
],
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 84,
"column" : 33,
"source_fragment" : "fix_checksum"
}
}
],
"pipelines" : [
{
"name" : "ingress",
"id" : 0,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 10,
"column" : 8,
"source_fragment" : "ingress"
},
"init_table" : "node_2",
"tables" : [
{
"name" : "tbl_set_egress",
"id" : 0,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [2],
"actions" : ["set_egress"],
"base_default_next" : null,
"next_tables" : {
"set_egress" : null
},
"default_entry" : {
"action_id" : 2,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "dispatch",
"id" : 1,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 45,
"column" : 29,
"source_fragment" : "dispatch"
},
"key" : [
{
"match_type" : "exact",
"target" : ["map_hdr", "chain_id"],
"mask" : null
}
],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [4, 1],
"actions" : ["dispatch_act", "NoAction"],
"base_default_next" : "fwd",
"next_tables" : {
"dispatch_act" : "fwd",
"NoAction" : "fwd"
},
"default_entry" : {
"action_id" : 1,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
},
{
"name" : "fwd",
"id" : 2,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 31,
"column" : 24,
"source_fragment" : "fwd"
},
"key" : [
{
"match_type" : "exact",
"target" : ["standard_metadata", "ingress_port"],
"mask" : null
}
],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [3, 0],
"actions" : ["fwd_act", "NoAction"],
"base_default_next" : null,
"next_tables" : {
"fwd_act" : null,
"NoAction" : null
},
"default_entry" : {
"action_id" : 0,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
}
],
"action_profiles" : [],
"conditionals" : [
{
"name" : "node_2",
"id" : 0,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 55,
"column" : 12,
"source_fragment" : "hdr.ipv4.isValid() && hdr.udp.dstPort == 8889"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "and",
"left" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"right" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x22b9"
}
}
}
}
},
"true_next" : "tbl_set_egress",
"false_next" : "node_4"
},
{
"name" : "node_4",
"id" : 1,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 60,
"column" : 16,
"source_fragment" : "hdr.ipv4.isValid() && hdr.udp.dstPort == 8080"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "and",
"left" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"right" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x1f90"
}
}
}
}
},
"true_next" : "dispatch",
"false_next" : "fwd"
}
]
},
{
"name" : "egress",
"id" : 1,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 69,
"column" : 8,
"source_fragment" : "egress"
},
"init_table" : "tbl_fix_checksum",
"tables" : [
{
"name" : "tbl_fix_checksum",
"id" : 3,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [5],
"actions" : ["fix_checksum"],
"base_default_next" : null,
"next_tables" : {
"fix_checksum" : null
},
"default_entry" : {
"action_id" : 5,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
}
],
"action_profiles" : [],
"conditionals" : []
}
],
"checksums" : [
{
"name" : "cksum",
"id" : 0,
"target" : ["ipv4", "hdrChecksum"],
"calculation" : "calc",
"verify" : true,
"if_cond" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"type" : "generic"
},
{
"name" : "cksum_0",
"id" : 1,
"target" : ["ipv4", "hdrChecksum"],
"calculation" : "calc_0",
"verify" : false,
"if_cond" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"type" : "generic"
}
],
"force_arith" : [],
"extern_instances" : [],
"extern_function_instances" : [
{
"name" : "prime",
"id" : 0,
"source_info" : {
"filename" : "p4src/echo.p4",
"line" : 8,
"column" : 12,
"source_fragment" : "prime"
}
}
],
"field_aliases" : [],
"flow_variables" : [
{
"flow" : "ingress",
"header" : "scalars",
"field" : "temp"
},
{
"flow" : "ingress",
"header" : "scalars",
"field" : "tempEth"
}
]
}
\ No newline at end of file
#include <core.p4>
#define V1MODEL_VERSION 20200408
#include <v1model.p4>
#include "includes/defines.p4"
#include "includes/headers.p4"
#include "includes/parsers.p4"
extern void prime();
control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name(".set_egress") action set_egress() {
prime();
bit<32> temp = hdr.ipv4.dstAddr;
hdr.ipv4.dstAddr = hdr.ipv4.srcAddr;
hdr.ipv4.srcAddr = temp;
hdr.udp.dstPort = 9000;
bit<48> tempEth = hdr.ethernet.dstAddr;
hdr.ethernet.dstAddr = hdr.ethernet.srcAddr;
hdr.ethernet.srcAddr = tempEth;
standard_metadata.egress_spec = standard_metadata.ingress_port;
hdr.ipv4.ttl = hdr.ipv4.ttl - 8w1;
}
@name(".fwd_act") action fwd_act(bit<16> port) {
standard_metadata.egress_spec = port;
}
@name(".fwd") table fwd {
actions = {
fwd_act;
}
key = {
standard_metadata.ingress_port : exact;
}
}
@name(".dispatch_act") action dispatch_act(bit<32> dstAddr, bit<16> dstPort) {
hdr.ipv4.dstAddr = dstAddr;
hdr.udp.dstPort = dstPort;
}
@name(".dispatch") table dispatch {
actions = {
dispatch_act;
}
key = {
hdr.map_hdr.chain_id : exact;
}
}
apply {
if (hdr.ipv4.isValid() && hdr.udp.dstPort == MDS_PORT) {
// hdr.map_hdr.data = 32w100;
set_egress();
} else {
if (hdr.ipv4.isValid() && hdr.udp.dstPort == 8080) {
dispatch.apply();
}
fwd.apply();
}
//fwd.apply();
}
}
control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
// @name(".ethernet_set_mac_act") action ethernet_set_mac_act(bit<48> smac, bit<48> dmac) {
// hdr.ethernet.srcAddr = smac;
// hdr.ethernet.dstAddr = dmac;
// }
// @name(".ethernet_set_mac") table ethernet_set_mac {
// actions = {
// ethernet_set_mac_act;
// }
// key = {
// standard_metadata.egress_port: exact;
// }
// }
@name("fix_checksum") action fix_checksum() {
hdr.udp.checksum = 16w0;
}
apply {
// if (hdr.udp.dstPort == MDS_PORT) {
// ethernet_set_mac.apply();
// }
fix_checksum();
}
}
control DeparserImpl(packet_out packet, in headers hdr) {
apply {
packet.emit<ethernet_t>(hdr.ethernet);
packet.emit<ipv4_t>(hdr.ipv4);
packet.emit<udp_t>(hdr.udp);
packet.emit<map_hdr_t>(hdr.map_hdr);
}
}
control verifyChecksum(inout headers hdr, inout metadata meta) {
apply {
verify_checksum(
hdr.ipv4.isValid(),
{ hdr.ipv4.version,
hdr.ipv4.ihl,
hdr.ipv4.diffserv,
hdr.ipv4.totalLen,
hdr.ipv4.identification,
hdr.ipv4.flags,
hdr.ipv4.fragOffset,
hdr.ipv4.ttl,
hdr.ipv4.protocol,
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr },
hdr.ipv4.hdrChecksum,
HashAlgorithm.csum16);
}
}
control computeChecksum(inout headers hdr, inout metadata meta) {
apply {
update_checksum(
hdr.ipv4.isValid(),
{ hdr.ipv4.version,
hdr.ipv4.ihl,
hdr.ipv4.diffserv,
hdr.ipv4.totalLen,
hdr.ipv4.identification,
hdr.ipv4.flags,
hdr.ipv4.fragOffset,
hdr.ipv4.ttl,
hdr.ipv4.protocol,
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr },
hdr.ipv4.hdrChecksum,
HashAlgorithm.csum16);
}
}
V1Switch<headers, metadata>(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main;
{
"registers": {
"configs": []
},
"tables": {
"ingress::fwd": {
"rules": [
{
"action": {
"type": "ingress::fwd_act",
"data": {
"port": {
"value": "p0"
}
}
},
"name": "host_to_net",
"match": {
"standard_metadata.ingress_port": {
"value": "v0.0"
}
}
},
{
"action": {
"type": "ingress::fwd_act",
"data": {
"port": {
"value": "v0.1"
}
}
},
"name": "net_to_host",
"match": {
"standard_metadata.ingress_port": {
"value": "p1"
}
}
},
{
"action": {
"type": "ingress::fwd_act",
"data": {
"port": {
"value": "v0.0"
}
}
},
"name": "net_to_host",
"match": {
"standard_metadata.ingress_port": {
"value": "p0"
}
}
},
{
"action": {
"type": "ingress::fwd_act",
"data": {
"port": {
"value": "p1"
}
}
},
"name": "net_to_host",
"match": {
"standard_metadata.ingress_port": {
"value": "v0.1"
}
}
}
]
},
"ingress::dispatch": {
"rules": [
]
}
},
"multicast": {},
"meters": {
"configs": []
}
}
{
"tables": [
{
"preamble": {
"id": 33595533,
"name": "fwd",
"alias": "fwd"
},
"matchFields": [
{
"id": 1,
"name": "standard_metadata.ingress_port",
"bitwidth": 16,
"matchType": "EXACT"
}
],
"actionRefs": [
{
"id": 16805069
},
{
"id": 16800567,
"annotations": [
"@defaultonly()"
]
}
],
"size": "1024"
},
{
"preamble": {
"id": 33612818,
"name": "dispatch",
"alias": "dispatch"
},
"matchFields": [
{
"id": 1,
"name": "map_hdr.chain_id",
"bitwidth": 32,
"matchType": "EXACT"
}
],
"actionRefs": [
{
"id": 16786857
},
{
"id": 16800567,
"annotations": [
"@defaultonly()"
]
}
],
"size": "1024"
}
],
"actions": [
{
"preamble": {
"id": 16800567,
"name": "NoAction",
"alias": "NoAction"
}
},
{
"preamble": {
"id": 16816129,
"name": "set_egress",
"alias": "set_egress"
}
},
{
"preamble": {
"id": 16805069,
"name": "fwd_act",
"alias": "fwd_act"
},
"params": [
{
"id": 1,
"name": "port",
"bitwidth": 16
}
]
},
{
"preamble": {
"id": 16786857,
"name": "dispatch_act",
"alias": "dispatch_act"
},
"params": [
{
"id": 1,
"name": "dstAddr",
"bitwidth": 32
},
{
"id": 2,
"name": "dstPort",
"bitwidth": 16
}
]
},
{
"preamble": {
"id": 16841338,
"name": "fix_checksum",
"alias": "fix_checksum"
}
}
]
}
##########################################
# Header instance definitions #
##########################################
errors:
type: enum
values:
- NoError: 1
- PacketTooShort: 2
- NoMatch: 3
- StackOutOfBounds: 4
- HeaderTooShort: 5
- ParserTimeout: 6
ethernet:
fields:
- dstAddr: 48
- srcAddr: 48
- etherType: 16
type: header
exec_hdr:
fields:
- function_count: 8
- function: 8
type: metadata
ing_metadata:
fields:
- drop: 1
- egress_port: 9
- packet_type: 4
- _padding: 2
type: metadata
ingress::set_egress::scalars:
fields:
- temp: 32
- tempEth: 48
type: metadata
ipv4:
calculated_fields:
- condition: valid(ipv4)
field: hdrChecksum
func: calc
type: verify
- condition: valid(ipv4)
field: hdrChecksum
func: calc_0
type: update
fields:
- version: 4
- ihl: 4
- diffserv: 8
- totalLen: 16
- identification: 16
- flags: 3
- fragOffset: 13
- ttl: 8
- protocol: 8
- hdrChecksum: 16
- srcAddr: 32
- dstAddr: 32
type: header
map_hdr:
fields:
- chain_id: 32
- exec_id: 32
- function_id: 8
- data: 32
- function_count: 8
- f0: 8
- f1: 8
- f2: 8
- f3: 8
- f4: 8
type: header
resubmit_meta:
fields:
- current_state: 8
- data: 32
type: metadata
standard_metadata:
fields:
- ingress_port: 16
- packet_length: 14
- egress_spec: 16
- egress_port: 16
- egress_instance: 10
- instance_type: 4
- clone_spec: 32
- parser_error_location: 8
- parser_status: 3
- checksum_error: 1
type: metadata
udp:
fields:
- srcPort: 16
- dstPort: 16
- length_: 16
- checksum: 16
type: header
##########################################
# Register definitions #
##########################################
current_state:
class: global
fields:
- value: 8
instance_count: 16384
type: register
dispatch_state:
class: global
fields:
- value: 8
instance_count: 16384
type: register
##########################################
# Field list definitions #
##########################################
field_list_1:
fields:
- ipv4.version
- ipv4.ihl
- ipv4.diffserv
- ipv4.totalLen
- ipv4.identification
- ipv4.flags
- ipv4.fragOffset
- ipv4.ttl
- ipv4.protocol
- ipv4.srcAddr
- ipv4.dstAddr
type: field_list
##########################################
# Field list calculations #
##########################################
calc:
algorithm: csum16
inputs:
- field_list_1
output_width: 16
type: field_list_calculation
calc_0:
algorithm: csum16
inputs:
- field_list_1
output_width: 16
type: field_list_calculation
##########################################
# Parse states #
##########################################
parse_ipv4:
implementation: extract(ipv4);
select_value:
- ipv4.fragOffset
- ipv4.ihl
- ipv4.protocol
src_filename: p4src/includes/parsers.p4
src_lineno: 3
type: parse_state
parse_map_hdr:
implementation: extract(map_hdr);
src_filename: p4src/includes/parsers.p4
src_lineno: 20
type: parse_state
parse_udp:
implementation: extract(udp);
select_value:
- udp.dstPort
src_filename: p4src/includes/parsers.p4
src_lineno: 11
type: parse_state
start:
implementation: extract(ethernet);
select_value:
- ethernet.etherType
src_filename: p4src/includes/parsers.p4
src_lineno: 25
type: parse_state
##########################################
# Parser #
##########################################
parser:
format: dot
implementation: |-
digraph {
start -> parse_ipv4 [value="0x0800", mask="none", order="0"]
start -> exit [value="default", mask="none", order="1"]
parse_ipv4 -> parse_udp [value="0x00000511", mask="0x00000fff", order="0"]
parse_ipv4 -> exit [value="default", mask="none", order="1"]
parse_udp -> parse_map_hdr [value="0x22b9", mask="none", order="0"]
parse_udp -> parse_map_hdr [value="0x2328", mask="none", order="1"]
parse_udp -> exit [value="default", mask="none", order="2"]
parse_map_hdr -> exit [value="default", mask="none", order="0"]
}
start_state: start
type: parser
##########################################
# External functions #
##########################################
prime__0:
name: prime
type: external_action
##########################################
# Action Expressions #
##########################################
_expression_set_egress_0:
expression: ((((ipv4.ttl) + (0xff))) & (0xff))
format: bracketed_expr
type: expression
##########################################
# Action sets #
##########################################
egress::fix_checksum:
implementation: modify_field(udp.checksum, 0x0000);
src_filename: p4src/echo.p4
src_lineno: 84
type: action
ingress::dispatch_act:
implementation: |-
modify_field(ipv4.dstAddr, dstAddr);
modify_field(udp.dstPort, dstPort);
parameter_list:
- dstAddr: 32
- dstPort: 16
src_filename: p4src/echo.p4
src_lineno: 40
type: action
ingress::fwd_act:
implementation: modify_field(standard_metadata.egress_spec, port);
parameter_list:
- port: 16
src_filename: p4src/echo.p4
src_lineno: 27
type: action
ingress::set_egress:
implementation: |-
prime();
modify_field(ingress::set_egress::scalars.temp, ipv4.dstAddr);
modify_field(ipv4.dstAddr, ipv4.srcAddr);
modify_field(ipv4.srcAddr, ingress::set_egress::scalars.temp);
modify_field(udp.dstPort, 0x2328);
modify_field(ingress::set_egress::scalars.tempEth, ethernet.dstAddr);
modify_field(ethernet.dstAddr, ethernet.srcAddr);
modify_field(ethernet.srcAddr, ingress::set_egress::scalars.tempEth);
modify_field(standard_metadata.egress_spec, standard_metadata.ingress_port);
modify_field(ipv4.ttl, _expression_set_egress_0);
src_filename: p4src/echo.p4
src_lineno: 12
type: action
##########################################
# Ingress and Egress tables #
##########################################
egress::tbl_fix_checksum:
allowed_actions:
- egress::fix_checksum
default_entry:
action: egress::fix_checksum
const: true
max_entries: 1025
src_filename: ''
src_lineno: 1
type: table
ingress::dispatch:
allowed_actions:
- ingress::dispatch_act
match_on:
map_hdr.chain_id: exact
max_entries: 1025
src_filename: p4src/echo.p4
src_lineno: 45
type: table
ingress::fwd:
allowed_actions:
- ingress::fwd_act
match_on:
standard_metadata.ingress_port: exact
max_entries: 1025
src_filename: p4src/echo.p4
src_lineno: 31
type: table
ingress::tbl_set_egress:
allowed_actions:
- ingress::set_egress
default_entry:
action: ingress::set_egress
const: true
max_entries: 1025
src_filename: ''
src_lineno: 1
type: table
##########################################
# Ingress conditionals sets #
##########################################
_condition_0:
condition: (((valid(ipv4))) and (((udp.dstPort) == (8889))))
format: bracketed_expr
src_filename: p4src/echo.p4
src_lineno: 55
type: conditional
_condition_1:
condition: (((valid(ipv4))) and (((udp.dstPort) == (8080))))
format: bracketed_expr
src_filename: p4src/echo.p4
src_lineno: 60
type: conditional
##########################################
# Ingress control flow #
##########################################
ingress_flow:
doc: control flow for ingress
format: dot
implementation: |-
digraph {
"_condition_0" -> "_condition_1" [condition = false]
"_condition_0" -> "ingress::tbl_set_egress" [condition = true]
"_condition_1" -> "ingress::fwd" [condition = false]
"_condition_1" -> "ingress::dispatch" [condition = true]
"ingress::fwd" -> "exit_control_flow" [action = always]
"ingress::dispatch" -> "ingress::fwd" [action = always]
"ingress::tbl_set_egress" -> "exit_control_flow" [action = always]
}
start_state: _condition_0
type: control_flow
##########################################
# Egress control flow #
##########################################
egress_flow:
doc: control flow for egress
format: dot
implementation: |-
digraph {
"egress::tbl_fix_checksum" -> "exit_control_flow" [action = always]
}
start_state: egress::tbl_fix_checksum
type: control_flow
##########################################
# Deparsers #
##########################################
deparser:
order:
- ethernet
- ipv4
- udp
- map_hdr
type: deparser
##########################################
# Processor layout #
##########################################
layout:
format: list
implementation:
- parser
- ingress
- egress
type: processor_layout
##########################################
# Source info #
##########################################
source_info:
date: 2021/02/22 11:12:59
output_file: p4src/echo.yml
p4_version: '16'
source_files:
- ''
- p4src/echo.p4
- /opt/netronome/p4/include/16/p4include/core.p4
type: source_info
action ethernet_set_mac_act (smac, dmac) {
modify_field (ethernet.srcAddr, smac);
modify_field (ethernet.dstAddr, dmac);
}
table ethernet_set_mac {
reads {
standard_metadata.egress_port: exact;
}
actions {
ethernet_set_mac_act;
}
}
field_list ipv4_field_list {
ipv4.version;
ipv4.ihl;
ipv4.diffserv;
ipv4.totalLen;
ipv4.identification;
ipv4.flags;
ipv4.fragOffset;
ipv4.ttl;
ipv4.protocol;
ipv4.srcAddr;
ipv4.dstAddr;
}
field_list_calculation ipv4_chksum_calc {
input {
ipv4_field_list;
}
algorithm : csum16;
output_width: 16;
}
calculated_field ipv4.hdrChecksum {
update ipv4_chksum_calc;
}
field_list udp_checksum_list {
// IPv4 Pseudo Header Format. Must modify for IPv6 support.
ipv4.srcAddr;
ipv4.dstAddr;
8'0;
ipv4.protocol;
udp.len;
udp.srcPort;
udp.dstPort;
udp.len;
// udp.checksum;
payload;
}
field_list_calculation udp_checksum {
input {
udp_checksum_list;
}
algorithm : csum16;
output_width : 16;
}
calculated_field udp.checksum {
update udp_checksum;
}
#define REPLY_PORT 9000
#define MDS_PORT 8889
#define NUM_CACHE 128
#define CLUSTER_COUNT 2
#define DEAD_EGRESS_PORT 9
#define CONTROLLER_IP 0x0a000002
#define SERVER_IP 0x0a000001
#define NC_READ_REQUEST 0
#define NC_READ_REPLY 1
#define NC_HOT_READ_REQUEST 2
#define NC_WRITE_REQUEST 4
#define NC_WRITE_REPLY 5
#define NC_UPDATE_REQUEST 8
#define NC_UPDATE_REPLY 9
#define PKT_INSTANCE_TYPE_NORMAL 0
#define PKT_INSTANCE_TYPE_INGRESS_CLONE 1
#define PKT_INSTANCE_TYPE_EGRESS_CLONE 2
#define PKT_INSTANCE_TYPE_COALESCED 3
#define PKT_INSTANCE_TYPE_INGRESS_RECIRC 4
#define PKT_INSTANCE_TYPE_REPLICATION 5
#define PKT_INSTANCE_TYPE_RESUBMIT 6
\ No newline at end of file
struct resubmit_meta_t {
bit<8> current_state;
bit<32> data;
}
struct ingress_metadata_t {
bit<1> drop;
bit<9> egress_port;
bit<4> packet_type;
}
register< bit<8>>(16384) current_state;
register< bit<8>>(16384) dispatch_state;
header ethernet_t {
bit<48> dstAddr;
bit<48> srcAddr;
bit<16> etherType;
}
header ipv4_t {
bit<4> version;
bit<4> ihl;
bit<8> diffserv;
bit<16> totalLen;
bit<16> identification;
bit<3> flags;
bit<13> fragOffset;
bit<8> ttl;
bit<8> protocol;
bit<16> hdrChecksum;
bit<32> srcAddr;
bit<32> dstAddr;
}
header udp_t {
bit<16> srcPort;
bit<16> dstPort;
bit<16> length_;
bit<16> checksum;
}
header map_hdr_t {
bit<32> chain_id;
bit<32> exec_id;
bit<8> function_id;
bit<32> data;
bit<8> function_count;
bit<8> f0;
bit<8> f1;
bit<8> f2;
bit<8> f3;
bit<8> f4;
}
struct exec_hdr_t {
bit<8> function_count;
bit<8> function;
}
struct metadata {
@name(".ing_metadata")
ingress_metadata_t ing_metadata;
@name(".resubmit_meta")
resubmit_meta_t resubmit_meta;
@name(".exec_hdr")
exec_hdr_t exec_hdr;
}
struct headers {
@name(".ethernet")
ethernet_t ethernet;
@name(".ipv4")
ipv4_t ipv4;
@name(".udp")
udp_t udp;
@name(".map_hdr")
map_hdr_t map_hdr;
}
\ No newline at end of file
struct resubmit_meta_t {
bit<8> current_state;
bit<32> data;
}
struct ingress_metadata_t {
bit<1> drop;
bit<9> egress_port;
bit<4> packet_type;
}
header ethernet_t {
bit<48> dstAddr;
bit<48> srcAddr;
bit<16> etherType;
}
header ipv4_t {
bit<4> version;
bit<4> ihl;
bit<8> diffserv;
bit<16> totalLen;
bit<16> identification;
bit<3> flags;
bit<13> fragOffset;
bit<8> ttl;
bit<8> protocol;
bit<16> hdrChecksum;
bit<32> srcAddr;
bit<32> dstAddr;
}
header udp_t {
bit<16> srcPort;
bit<16> dstPort;
bit<16> length_;
bit<16> checksum;
}
header map_hdr_t {
bit<32> chain_id;
bit<32> exec_id;
bit<8> function_id;
bit<32> data;
bit<8> function_count;
bit<8> f0;
bit<8> f1;
bit<8> f2;
bit<8> f3;
bit<8> f4;
}
struct exec_hdr_t {
bit<8> function_count;
bit<8> function;
}
struct metadata {
@name(".ing_metadata")
ingress_metadata_t ing_metadata;
@name(".resubmit_meta")
resubmit_meta_t resubmit_meta;
@name(".exec_hdr")
exec_hdr_t exec_hdr;
}
struct headers {
@name(".ethernet")
ethernet_t ethernet;
@name(".ipv4")
ipv4_t ipv4;
@name(".udp")
udp_t udp;
@name(".map_hdr")
map_hdr_t map_hdr;
}
\ No newline at end of file
parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name(".parse_ipv4") state parse_ipv4 {
packet.extract<ipv4_t>(hdr.ipv4);
transition select(hdr.ipv4.fragOffset, hdr.ipv4.ihl, hdr.ipv4.protocol) {
(13w0x0 &&& 13w0x0, 4w0x5 &&& 4w0xf, 8w0x11 &&& 8w0xff): parse_udp;
default: accept;
}
}
@name(".parse_udp") state parse_udp {
packet.extract<udp_t>(hdr.udp);
transition select(hdr.udp.dstPort) {
MDS_PORT: parse_map_hdr;
REPLY_PORT: parse_map_hdr;
default: accept;
}
}
@name(".parse_map_hdr") state parse_map_hdr {
packet.extract(hdr.map_hdr);
transition accept;
}
@name(".start") state start {
packet.extract<ethernet_t>(hdr.ethernet);
transition select(hdr.ethernet.etherType) {
16w0x800: parse_ipv4;
default: accept;
}
}
}
\ No newline at end of file
action set_egress(egress_spec) {
modify_field(standard_metadata.egress_spec, egress_spec);
add_to_field(ipv4.ttl, -1);
}
@pragma stage 11
table ipv4_route {
reads {
ipv4.dstAddr : exact;
}
actions {
set_egress;
}
size : 8192;
}
#define ROUTER_HASH_WIDTH 8
header_type router_t {
fields {
router_index: 8;
}
}
metadata router_t router;
action update_dst_act(dstAddr) {
modify_field (ipv4.dstAddr, dstAddr);
modify_field (udp.dstPort, NC_PORT);
}
table update_dst {
reads {
router.router_index: exact;
}
actions {
update_dst_act;
}
}
field_list router_hash_fields {
router_hdr.key;
}
field_list_calculation router_hash {
input {
router_hash_fields;
}
algorithm : crc32;
output_width : ROUTER_HASH_WIDTH;
}
action calculate_router_hash_act() {
modify_field_with_hash_based_offset(router.router_index, 0, router_hash, CLUSTER_COUNT);
}
table calculate_router_hash {
actions {
calculate_router_hash_act;
}
}
control routePacket {
apply(calculate_router_hash);
apply(update_dst);
}
//=============================================================================================================
#include <stdint.h>
#include<stdlib.h>
#include <nfp/me.h>
#include <nfp/mem_atomic.h>
#include <pif_common.h>
#include "pif_plugin.h"
//=============================================================================================================
int pif_plugin_prime(EXTRACTED_HEADERS_T *headers, MATCH_DATA_T *match_data) {
PIF_PLUGIN_map_hdr_T *mapHdr = pif_plugin_hdr_get_map_hdr(headers);
__gpr uint32_t i = 1, j = 0;
uint32_t length = mapHdr->data;
__gpr uint64_t ar[10000];
int idx = -1;
for (; j < length; j++) {
for (;i < 10000; i++) {
idx = rand() % (10001);
ar[idx] = rand();
}
}
mapHdr->data = idx;
return PIF_PLUGIN_RETURN_FORWARD;
}
\ No newline at end of file
{
"program" : "test.p4",
"__meta__" : {
"version" : [2, 7],
"compiler" : "https://github.com/p4lang/p4c"
},
"header_types" : [
{
"name" : "scalars_0",
"id" : 0,
"fields" : [
["chain_state", 8, false],
["dependency", 8, false],
["chain_state_2", 8, false],
["function_state", 8, false],
["function_dispatch_state", 8, false]
]
},
{
"name" : "ethernet_t",
"id" : 1,
"fields" : [
["dstAddr", 48, false],
["srcAddr", 48, false],
["etherType", 16, false]
]
},
{
"name" : "ipv4_t",
"id" : 2,
"fields" : [
["version", 4, false],
["ihl", 4, false],
["diffserv", 8, false],
["totalLen", 16, false],
["identification", 16, false],
["flags", 3, false],
["fragOffset", 13, false],
["ttl", 8, false],
["protocol", 8, false],
["hdrChecksum", 16, false],
["srcAddr", 32, false],
["dstAddr", 32, false]
]
},
{
"name" : "udp_t",
"id" : 3,
"fields" : [
["srcPort", 16, false],
["dstPort", 16, false],
["length_", 16, false],
["checksum", 16, false]
]
},
{
"name" : "map_hdr_t",
"id" : 4,
"fields" : [
["chain_id", 32, false],
["exec_id", 32, false],
["function_id", 8, false],
["data", 32, false],
["function_count", 8, false],
["f0", 8, false],
["f1", 8, false],
["f2", 8, false],
["f3", 8, false],
["f4", 8, false]
]
},
{
"name" : "ingress_metadata_t",
"id" : 5,
"fields" : [
["drop", 1, false],
["egress_port", 9, false],
["packet_type", 4, false],
["_padding", 2, false]
]
},
{
"name" : "resubmit_meta_t",
"id" : 6,
"fields" : [
["current_state", 8, false],
["data", 32, false]
]
},
{
"name" : "exec_hdr_t",
"id" : 7,
"fields" : [
["function_count", 8, false],
["function", 8, false]
]
},
{
"name" : "standard_metadata",
"id" : 8,
"fields" : [
["ingress_port", 16, false],
["packet_length", 14, false],
["egress_spec", 16, false],
["egress_port", 16, false],
["egress_instance", 10, false],
["instance_type", 4, false],
["clone_spec", 32, false],
["parser_error_location", 8, false],
["parser_status", 3, false],
["checksum_error", 1, false]
]
}
],
"headers" : [
{
"name" : "scalars",
"id" : 0,
"header_type" : "scalars_0",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "standard_metadata",
"id" : 1,
"header_type" : "standard_metadata",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "ethernet",
"id" : 2,
"header_type" : "ethernet_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "ipv4",
"id" : 3,
"header_type" : "ipv4_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "udp",
"id" : 4,
"header_type" : "udp_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "map_hdr",
"id" : 5,
"header_type" : "map_hdr_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "ing_metadata",
"id" : 6,
"header_type" : "ingress_metadata_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "resubmit_meta",
"id" : 7,
"header_type" : "resubmit_meta_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "exec_hdr",
"id" : 8,
"header_type" : "exec_hdr_t",
"metadata" : true,
"pi_omit" : true
}
],
"header_stacks" : [],
"header_union_types" : [],
"header_unions" : [],
"header_union_stacks" : [],
"field_lists" : [
{
"id" : 0,
"name" : "fl",
"elements" : [
{
"type" : "field",
"value" : ["standard_metadata", "ingress_port"]
},
{
"type" : "field",
"value" : ["standard_metadata", "packet_length"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_port"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_instance"]
},
{
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
{
"type" : "field",
"value" : ["standard_metadata", "clone_spec"]
},
{
"type" : "field",
"value" : ["standard_metadata", "parser_error_location"]
},
{
"type" : "field",
"value" : ["standard_metadata", "parser_status"]
},
{
"type" : "field",
"value" : ["standard_metadata", "checksum_error"]
},
{
"type" : "field",
"value" : ["ing_metadata", "drop"]
},
{
"type" : "field",
"value" : ["ing_metadata", "egress_port"]
},
{
"type" : "field",
"value" : ["ing_metadata", "packet_type"]
},
{
"type" : "field",
"value" : ["resubmit_meta", "current_state"]
},
{
"type" : "field",
"value" : ["resubmit_meta", "data"]
},
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
{
"type" : "field",
"value" : ["exec_hdr", "function"]
}
]
},
{
"id" : 1,
"name" : "tuple_0",
"elements" : [
{
"type" : "field",
"value" : ["standard_metadata", "ingress_port"]
},
{
"type" : "field",
"value" : ["standard_metadata", "packet_length"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_port"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_instance"]
},
{
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
{
"type" : "field",
"value" : ["standard_metadata", "clone_spec"]
},
{
"type" : "field",
"value" : ["standard_metadata", "parser_error_location"]
},
{
"type" : "field",
"value" : ["standard_metadata", "parser_status"]
},
{
"type" : "field",
"value" : ["standard_metadata", "checksum_error"]
},
{
"type" : "field",
"value" : ["ing_metadata", "drop"]
},
{
"type" : "field",
"value" : ["ing_metadata", "egress_port"]
},
{
"type" : "field",
"value" : ["ing_metadata", "packet_type"]
},
{
"type" : "field",
"value" : ["resubmit_meta", "current_state"]
},
{
"type" : "field",
"value" : ["resubmit_meta", "data"]
},
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
{
"type" : "field",
"value" : ["exec_hdr", "function"]
}
]
}
],
"errors" : [
["NoError", 1],
["PacketTooShort", 2],
["NoMatch", 3],
["StackOutOfBounds", 4],
["HeaderTooShort", 5],
["ParserTimeout", 6]
],
"enums" : [],
"parsers" : [
{
"name" : "parser",
"id" : 0,
"init_state" : "start",
"parse_states" : [
{
"name" : "parse_ipv4",
"id" : 0,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "ipv4"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x00000511",
"mask" : "0x00000fff",
"next_state" : "parse_udp"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 3,
"column" : 31,
"source_fragment" : "parse_ipv4"
}
},
{
"name" : "parse_udp",
"id" : 1,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "udp"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x22b9",
"mask" : null,
"next_state" : "parse_map_hdr"
},
{
"value" : "0x2328",
"mask" : null,
"next_state" : "parse_map_hdr"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["udp", "dstPort"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 11,
"column" : 30,
"source_fragment" : "parse_udp"
}
},
{
"name" : "parse_map_hdr",
"id" : 2,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "map_hdr"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 20,
"column" : 34,
"source_fragment" : "parse_map_hdr"
}
},
{
"name" : "start",
"id" : 3,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "ethernet"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x0800",
"mask" : null,
"next_state" : "parse_ipv4"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["ethernet", "etherType"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 25,
"column" : 26,
"source_fragment" : "start"
}
}
]
}
],
"deparsers" : [
{
"name" : "deparser",
"id" : 0,
"source_info" : {
"filename" : "test.p4",
"line" : 163,
"column" : 8,
"source_fragment" : "DeparserImpl"
},
"order" : ["ethernet", "ipv4", "udp", "map_hdr"]
}
],
"meter_arrays" : [],
"counter_arrays" : [],
"register_arrays" : [
{
"name" : "current_state",
"id" : 0,
"source_info" : {
"filename" : "includes/headers.p4",
"line" : 12,
"column" : 25,
"source_fragment" : "current_state"
},
"size" : 16384,
"bitwidth" : 8
},
{
"name" : "dispatch_state",
"id" : 1,
"source_info" : {
"filename" : "includes/headers.p4",
"line" : 13,
"column" : 25,
"source_fragment" : "dispatch_state"
},
"size" : 16384,
"bitwidth" : 8
}
],
"calculations" : [
{
"name" : "calc",
"id" : 0,
"source_info" : {
"filename" : "test.p4",
"line" : 174,
"column" : 8,
"source_fragment" : "verify_checksum( ..."
},
"algo" : "csum16",
"input" : [
{
"type" : "field",
"value" : ["ipv4", "version"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "diffserv"]
},
{
"type" : "field",
"value" : ["ipv4", "totalLen"]
},
{
"type" : "field",
"value" : ["ipv4", "identification"]
},
{
"type" : "field",
"value" : ["ipv4", "flags"]
},
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"output_width" : 16
},
{
"name" : "calc_0",
"id" : 1,
"source_info" : {
"filename" : "test.p4",
"line" : 194,
"column" : 8,
"source_fragment" : "update_checksum( ..."
},
"algo" : "csum16",
"input" : [
{
"type" : "field",
"value" : ["ipv4", "version"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "diffserv"]
},
{
"type" : "field",
"value" : ["ipv4", "totalLen"]
},
{
"type" : "field",
"value" : ["ipv4", "identification"]
},
{
"type" : "field",
"value" : ["ipv4", "flags"]
},
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"output_width" : 16
}
],
"learn_lists" : [],
"actions" : [
{
"name" : "NoAction",
"id" : 0,
"runtime_data" : [],
"primitives" : [],
"source_info" : {
"filename" : "/opt/netronome/p4/include/16/p4include/core.p4",
"line" : 68,
"column" : 7,
"source_fragment" : "NoAction"
}
},
{
"name" : "set_egress",
"id" : 1,
"runtime_data" : [
{
"name" : "egress_spec",
"bitwidth" : 16
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "checksum"]
},
{
"type" : "hexstr",
"value" : "0x0000"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 13,
"column" : 8,
"source_fragment" : "hdr.udp.checksum = 16w0"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 14,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = egress_spec"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "expression",
"value" : {
"op" : "+",
"left" : {
"type" : "field",
"value" : ["ipv4", "ttl"]
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 15,
"column" : 8,
"source_fragment" : "hdr.ipv4.ttl = hdr.ipv4.ttl - 8w1"
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 12,
"column" : 32,
"source_fragment" : "set_egress"
}
},
{
"name" : "act",
"id" : 2,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["resubmit_meta", "data"]
},
{
"type" : "field",
"value" : ["map_hdr", "data"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 31,
"column" : 20,
"source_fragment" : "meta.resubmit_meta.data = hdr.map_hdr.data"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["resubmit_meta", "current_state"]
},
{
"type" : "hexstr",
"value" : "0x00"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 32,
"column" : 20,
"source_fragment" : "meta.resubmit_meta.current_state = 8w0"
}
}
]
},
{
"name" : "act_0",
"id" : 3,
"runtime_data" : [],
"primitives" : [
{
"op" : "register_read",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "chain_state"]
},
{
"type" : "register_array",
"value" : "current_state"
},
{
"type" : "field",
"value" : ["map_hdr", "exec_id"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 39,
"column" : 20,
"source_fragment" : "current_state.read(chain_state, index)"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "chain_state"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "|",
"left" : {
"type" : "field",
"value" : ["scalars", "chain_state"]
},
"right" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "expression",
"value" : {
"op" : "<<",
"left" : {
"type" : "hexstr",
"value" : "0x01"
},
"right" : {
"type" : "field",
"value" : ["map_hdr", "function_id"]
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
}
}
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 40,
"column" : 20,
"source_fragment" : "chain_state = chain_state | (8w1 << hdr.map_hdr.function_id)"
}
},
{
"op" : "register_write",
"parameters" : [
{
"type" : "register_array",
"value" : "current_state"
},
{
"type" : "field",
"value" : ["map_hdr", "exec_id"]
},
{
"type" : "field",
"value" : ["scalars", "chain_state"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 41,
"column" : 20,
"source_fragment" : "current_state.write(index, chain_state)"
}
}
]
},
{
"name" : "NoAction",
"id" : 4,
"runtime_data" : [],
"primitives" : [],
"source_info" : {
"filename" : "/opt/netronome/p4/include/16/p4include/core.p4",
"line" : 68,
"column" : 7,
"source_fragment" : "NoAction"
}
},
{
"name" : "NoAction",
"id" : 5,
"runtime_data" : [],
"primitives" : [],
"source_info" : {
"filename" : "/opt/netronome/p4/include/16/p4include/core.p4",
"line" : 68,
"column" : 7,
"source_fragment" : "NoAction"
}
},
{
"name" : "ethernet_set_mac_act",
"id" : 6,
"runtime_data" : [
{
"name" : "smac",
"bitwidth" : 48
},
{
"name" : "dmac",
"bitwidth" : 48
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ethernet", "srcAddr"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 54,
"column" : 8,
"source_fragment" : "hdr.ethernet.srcAddr = smac"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ethernet", "dstAddr"]
},
{
"type" : "runtime_data",
"value" : 1
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 55,
"column" : 8,
"source_fragment" : "hdr.ethernet.dstAddr = dmac"
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 53,
"column" : 42,
"source_fragment" : "ethernet_set_mac_act"
}
},
{
"name" : "clone_packet",
"id" : 7,
"runtime_data" : [],
"primitives" : [
{
"op" : "clone_egress_pkt_to_egress",
"parameters" : [
{
"type" : "hexstr",
"value" : "0x00000004"
},
{
"type" : "hexstr",
"value" : "0x0"
}
]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 67,
"column" : 34,
"source_fragment" : "clone_packet"
}
},
{
"name" : "recirculate_packet",
"id" : 8,
"runtime_data" : [],
"primitives" : [
{
"op" : "recirculate",
"parameters" : [
{
"type" : "hexstr",
"value" : "0x1"
}
]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 71,
"column" : 40,
"source_fragment" : "recirculate_packet"
}
},
{
"name" : "update_packet",
"id" : 9,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "dstPort"]
},
{
"type" : "hexstr",
"value" : "0x22b9"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 76,
"column" : 8,
"source_fragment" : "hdr.udp.dstPort = 8889"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "srcPort"]
},
{
"type" : "hexstr",
"value" : "0x2328"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 77,
"column" : 8,
"source_fragment" : "hdr.udp.srcPort = 9000"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
},
{
"type" : "hexstr",
"value" : "0x0a000002"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 78,
"column" : 8,
"source_fragment" : "hdr.ipv4.dstAddr = 0x0a000002"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "hexstr",
"value" : "0x0a000001"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 79,
"column" : 8,
"source_fragment" : "hdr.ipv4.srcAddr = 0x0a000001"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_port"]
},
{
"type" : "hexstr",
"value" : "0x0004"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 80,
"column" : 8,
"source_fragment" : "standard_metadata.egress_port = 4"
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 75,
"column" : 35,
"source_fragment" : "update_packet"
}
},
{
"name" : "reroute_packet_act",
"id" : 10,
"runtime_data" : [
{
"name" : "dstAddr",
"bitwidth" : 32
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 84,
"column" : 8,
"source_fragment" : "hdr.ipv4.dstAddr = dstAddr"
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 83,
"column" : 40,
"source_fragment" : "reroute_packet_act"
}
},
{
"name" : "act_1",
"id" : 11,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
{
"type" : "field",
"value" : ["map_hdr", "function_count"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 99,
"column" : 16,
"source_fragment" : "meta.exec_hdr.function_count = hdr.map_hdr.function_count"
}
}
]
},
{
"name" : "act_2",
"id" : 12,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "expression",
"value" : {
"op" : "+",
"left" : {
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 102,
"column" : 16,
"source_fragment" : "meta.exec_hdr.function_count = meta.exec_hdr.function_count - 8w1"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["map_hdr", "function_id"]
},
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 103,
"column" : 16,
"source_fragment" : "hdr.map_hdr.function_id = meta.exec_hdr.function_count"
}
}
]
},
{
"name" : "act_3",
"id" : 13,
"runtime_data" : [],
"primitives" : [
{
"op" : "register_read",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "chain_state_2"]
},
{
"type" : "register_array",
"value" : "current_state"
},
{
"type" : "field",
"value" : ["map_hdr", "exec_id"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 116,
"column" : 16,
"source_fragment" : "current_state.read(chain_state, hdr.map_hdr.exec_id)"
}
}
]
},
{
"name" : "act_4",
"id" : 14,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "dependency"]
},
{
"type" : "hexstr",
"value" : "0x00"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 112,
"column" : 12,
"source_fragment" : "bit<8> dependency = 8w0;"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "function_state"]
},
{
"type" : "hexstr",
"value" : "0x00"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 114,
"column" : 12,
"source_fragment" : "bit<8> function_state = 8w0;"
}
}
]
},
{
"name" : "act_5",
"id" : 15,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "dependency"]
},
{
"type" : "field",
"value" : ["map_hdr", "f0"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 119,
"column" : 16,
"source_fragment" : "dependency = hdr.map_hdr.f0"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "function_state"]
},
{
"type" : "hexstr",
"value" : "0x01"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 120,
"column" : 16,
"source_fragment" : "function_state = 8w1"
}
}
]
},
{
"name" : "act_6",
"id" : 16,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "dependency"]
},
{
"type" : "field",
"value" : ["map_hdr", "f1"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 122,
"column" : 16,
"source_fragment" : "dependency = hdr.map_hdr.f1"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "function_state"]
},
{
"type" : "hexstr",
"value" : "0x02"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 123,
"column" : 16,
"source_fragment" : "function_state = 8w1 << 1"
}
}
]
},
{
"name" : "act_7",
"id" : 17,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "dependency"]
},
{
"type" : "field",
"value" : ["map_hdr", "f2"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 125,
"column" : 16,
"source_fragment" : "dependency = hdr.map_hdr.f2"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "function_state"]
},
{
"type" : "hexstr",
"value" : "0x04"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 126,
"column" : 16,
"source_fragment" : "function_state = 8w1 << 2"
}
}
]
},
{
"name" : "act_8",
"id" : 18,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "dependency"]
},
{
"type" : "field",
"value" : ["map_hdr", "f3"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 128,
"column" : 16,
"source_fragment" : "dependency = hdr.map_hdr.f3"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "function_state"]
},
{
"type" : "hexstr",
"value" : "0x08"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 129,
"column" : 16,
"source_fragment" : "function_state = 8w1 << 3"
}
}
]
},
{
"name" : "act_9",
"id" : 19,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "dependency"]
},
{
"type" : "field",
"value" : ["map_hdr", "f4"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 131,
"column" : 16,
"source_fragment" : "dependency = hdr.map_hdr.f4"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "function_state"]
},
{
"type" : "hexstr",
"value" : "0x10"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 132,
"column" : 16,
"source_fragment" : "function_state = 8w1 << 4"
}
}
]
},
{
"name" : "act_10",
"id" : 20,
"runtime_data" : [],
"primitives" : [
{
"op" : "register_read",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "function_dispatch_state"]
},
{
"type" : "register_array",
"value" : "dispatch_state"
},
{
"type" : "field",
"value" : ["map_hdr", "exec_id"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 142,
"column" : 16,
"source_fragment" : "dispatch_state.read(function_dispatch_state, hdr.map_hdr.exec_id)"
}
}
]
},
{
"name" : "act_11",
"id" : 21,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "function_dispatch_state"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "|",
"left" : {
"type" : "field",
"value" : ["scalars", "function_dispatch_state"]
},
"right" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "expression",
"value" : {
"op" : "<<",
"left" : {
"type" : "hexstr",
"value" : "0x01"
},
"right" : {
"type" : "field",
"value" : ["scalars", "function_state"]
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
}
}
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 147,
"column" : 20,
"source_fragment" : "function_dispatch_state = function_dispatch_state | (8w1 << function_state)"
}
},
{
"op" : "register_write",
"parameters" : [
{
"type" : "register_array",
"value" : "dispatch_state"
},
{
"type" : "field",
"value" : ["map_hdr", "exec_id"]
},
{
"type" : "field",
"value" : ["scalars", "function_dispatch_state"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 148,
"column" : 20,
"source_fragment" : "dispatch_state.write(hdr.map_hdr.exec_id, function_dispatch_state)"
}
}
]
},
{
"name" : "act_12",
"id" : 22,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
},
{
"type" : "hexstr",
"value" : "0x0a000009"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 153,
"column" : 16,
"source_fragment" : "hdr.ipv4.dstAddr = 0x0a000009"
}
}
]
}
],
"pipelines" : [
{
"name" : "ingress",
"id" : 0,
"source_info" : {
"filename" : "test.p4",
"line" : 9,
"column" : 8,
"source_fragment" : "ingress"
},
"init_table" : "node_2",
"tables" : [
{
"name" : "tbl_act",
"id" : 0,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [2],
"actions" : ["act"],
"base_default_next" : "ipv4_route",
"next_tables" : {
"act" : "ipv4_route"
},
"default_entry" : {
"action_id" : 2,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "ipv4_route",
"id" : 1,
"source_info" : {
"filename" : "test.p4",
"line" : 17,
"column" : 31,
"source_fragment" : "ipv4_route"
},
"key" : [
{
"match_type" : "exact",
"target" : ["ipv4", "dstAddr"],
"mask" : null
}
],
"match_type" : "exact",
"type" : "simple",
"max_size" : 8192,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [1, 0],
"actions" : ["set_egress", "NoAction"],
"base_default_next" : null,
"next_tables" : {
"set_egress" : null,
"NoAction" : null
},
"default_entry" : {
"action_id" : 0,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
},
{
"name" : "tbl_act_0",
"id" : 2,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [3],
"actions" : ["act_0"],
"base_default_next" : "ipv4_route",
"next_tables" : {
"act_0" : "ipv4_route"
},
"default_entry" : {
"action_id" : 3,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "ipv4_route",
"id" : 3,
"source_info" : {
"filename" : "test.p4",
"line" : 17,
"column" : 31,
"source_fragment" : "ipv4_route"
},
"key" : [
{
"match_type" : "exact",
"target" : ["ipv4", "dstAddr"],
"mask" : null
}
],
"match_type" : "exact",
"type" : "simple",
"max_size" : 8192,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [1, 0],
"actions" : ["set_egress", "NoAction"],
"base_default_next" : null,
"next_tables" : {
"set_egress" : null,
"NoAction" : null
},
"default_entry" : {
"action_id" : 0,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
}
],
"action_profiles" : [],
"conditionals" : [
{
"name" : "node_2",
"id" : 0,
"source_info" : {
"filename" : "test.p4",
"line" : 28,
"column" : 12,
"source_fragment" : "hdr.ipv4.isValid()"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"false_next" : null,
"true_next" : "node_3"
},
{
"name" : "node_3",
"id" : 1,
"source_info" : {
"filename" : "test.p4",
"line" : 29,
"column" : 16,
"source_fragment" : "hdr.udp.dstPort == 8889"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x22b9"
}
}
},
"true_next" : "node_4",
"false_next" : "node_7"
},
{
"name" : "node_4",
"id" : 2,
"source_info" : {
"filename" : "test.p4",
"line" : 30,
"column" : 20,
"source_fragment" : "standard_metadata.instance_type == 0"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0x00"
}
}
},
"false_next" : null,
"true_next" : "tbl_act"
},
{
"name" : "node_7",
"id" : 3,
"source_info" : {
"filename" : "test.p4",
"line" : 35,
"column" : 23,
"source_fragment" : "hdr.udp.dstPort == 9000"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x2328"
}
}
},
"false_next" : null,
"true_next" : "tbl_act_0"
}
]
},
{
"name" : "egress",
"id" : 1,
"source_info" : {
"filename" : "test.p4",
"line" : 51,
"column" : 8,
"source_fragment" : "egress"
},
"init_table" : "node_12",
"tables" : [
{
"name" : "tbl_act_1",
"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_1"],
"base_default_next" : "node_17",
"next_tables" : {
"act_1" : "node_17"
},
"default_entry" : {
"action_id" : 11,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"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" : [12],
"actions" : ["act_2"],
"base_default_next" : "node_17",
"next_tables" : {
"act_2" : "node_17"
},
"default_entry" : {
"action_id" : 12,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_clone_packet",
"id" : 6,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [7],
"actions" : ["clone_packet"],
"base_default_next" : "tbl_act_3",
"next_tables" : {
"clone_packet" : "tbl_act_3"
},
"default_entry" : {
"action_id" : 7,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_3",
"id" : 7,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [14],
"actions" : ["act_4"],
"base_default_next" : "tbl_act_4",
"next_tables" : {
"act_4" : "tbl_act_4"
},
"default_entry" : {
"action_id" : 14,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_4",
"id" : 8,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [13],
"actions" : ["act_3"],
"base_default_next" : "node_21",
"next_tables" : {
"act_3" : "node_21"
},
"default_entry" : {
"action_id" : 13,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_5",
"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_5"],
"base_default_next" : "tbl_act_10",
"next_tables" : {
"act_5" : "tbl_act_10"
},
"default_entry" : {
"action_id" : 15,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_6",
"id" : 10,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [16],
"actions" : ["act_6"],
"base_default_next" : "tbl_act_10",
"next_tables" : {
"act_6" : "tbl_act_10"
},
"default_entry" : {
"action_id" : 16,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_7",
"id" : 11,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [17],
"actions" : ["act_7"],
"base_default_next" : "tbl_act_10",
"next_tables" : {
"act_7" : "tbl_act_10"
},
"default_entry" : {
"action_id" : 17,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_8",
"id" : 12,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [18],
"actions" : ["act_8"],
"base_default_next" : "tbl_act_10",
"next_tables" : {
"act_8" : "tbl_act_10"
},
"default_entry" : {
"action_id" : 18,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_9",
"id" : 13,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [19],
"actions" : ["act_9"],
"base_default_next" : "tbl_act_10",
"next_tables" : {
"act_9" : "tbl_act_10"
},
"default_entry" : {
"action_id" : 19,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_10",
"id" : 14,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [20],
"actions" : ["act_10"],
"base_default_next" : "node_32",
"next_tables" : {
"act_10" : "node_32"
},
"default_entry" : {
"action_id" : 20,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_11",
"id" : 15,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [21],
"actions" : ["act_11"],
"base_default_next" : "reroute_packet",
"next_tables" : {
"act_11" : "reroute_packet"
},
"default_entry" : {
"action_id" : 21,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "reroute_packet",
"id" : 16,
"source_info" : {
"filename" : "test.p4",
"line" : 87,
"column" : 33,
"source_fragment" : "reroute_packet"
},
"key" : [
{
"match_type" : "exact",
"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" : [10, 5],
"actions" : ["reroute_packet_act", "NoAction"],
"base_default_next" : "ethernet_set_mac",
"next_tables" : {
"reroute_packet_act" : "ethernet_set_mac",
"NoAction" : "ethernet_set_mac"
},
"default_entry" : {
"action_id" : 5,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
},
{
"name" : "tbl_act_12",
"id" : 17,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [22],
"actions" : ["act_12"],
"base_default_next" : "ethernet_set_mac",
"next_tables" : {
"act_12" : "ethernet_set_mac"
},
"default_entry" : {
"action_id" : 22,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_update_packet",
"id" : 18,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [9],
"actions" : ["update_packet"],
"base_default_next" : "tbl_recirculate_packet",
"next_tables" : {
"update_packet" : "tbl_recirculate_packet"
},
"default_entry" : {
"action_id" : 9,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_recirculate_packet",
"id" : 19,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [8],
"actions" : ["recirculate_packet"],
"base_default_next" : "ethernet_set_mac",
"next_tables" : {
"recirculate_packet" : "ethernet_set_mac"
},
"default_entry" : {
"action_id" : 8,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "ethernet_set_mac",
"id" : 20,
"source_info" : {
"filename" : "test.p4",
"line" : 57,
"column" : 37,
"source_fragment" : "ethernet_set_mac"
},
"key" : [
{
"match_type" : "exact",
"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" : [6, 4],
"actions" : ["ethernet_set_mac_act", "NoAction"],
"base_default_next" : null,
"next_tables" : {
"ethernet_set_mac_act" : null,
"NoAction" : null
},
"default_entry" : {
"action_id" : 4,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
}
],
"action_profiles" : [],
"conditionals" : [
{
"name" : "node_12",
"id" : 4,
"source_info" : {
"filename" : "test.p4",
"line" : 97,
"column" : 12,
"source_fragment" : "hdr.udp.dstPort == 8889"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x22b9"
}
}
},
"true_next" : "node_13",
"false_next" : "node_36"
},
{
"name" : "node_13",
"id" : 5,
"source_info" : {
"filename" : "test.p4",
"line" : 98,
"column" : 16,
"source_fragment" : "standard_metadata.instance_type == 0 || standard_metadata.instance_type == 4"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "or",
"left" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0x00"
}
}
},
"right" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0x04"
}
}
}
}
},
"true_next" : "tbl_act_1",
"false_next" : "node_15"
},
{
"name" : "node_15",
"id" : 6,
"source_info" : {
"filename" : "test.p4",
"line" : 101,
"column" : 23,
"source_fragment" : "standard_metadata.instance_type == 2"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0x02"
}
}
},
"true_next" : "tbl_act_2",
"false_next" : "node_17"
},
{
"name" : "node_17",
"id" : 7,
"source_info" : {
"filename" : "test.p4",
"line" : 108,
"column" : 16,
"source_fragment" : "meta.exec_hdr.function_count > 0"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : ">",
"left" : {
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
"right" : {
"type" : "hexstr",
"value" : "0x00"
}
}
},
"true_next" : "tbl_clone_packet",
"false_next" : "tbl_act_3"
},
{
"name" : "node_21",
"id" : 8,
"source_info" : {
"filename" : "test.p4",
"line" : 118,
"column" : 16,
"source_fragment" : "meta.exec_hdr.function_count == 8w0"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
"right" : {
"type" : "hexstr",
"value" : "0x00"
}
}
},
"true_next" : "tbl_act_5",
"false_next" : "node_23"
},
{
"name" : "node_23",
"id" : 9,
"source_info" : {
"filename" : "test.p4",
"line" : 121,
"column" : 23,
"source_fragment" : "meta.exec_hdr.function_count == 8w1"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
"right" : {
"type" : "hexstr",
"value" : "0x01"
}
}
},
"true_next" : "tbl_act_6",
"false_next" : "node_25"
},
{
"name" : "node_25",
"id" : 10,
"source_info" : {
"filename" : "test.p4",
"line" : 124,
"column" : 23,
"source_fragment" : "meta.exec_hdr.function_count == 8w2"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
"right" : {
"type" : "hexstr",
"value" : "0x02"
}
}
},
"true_next" : "tbl_act_7",
"false_next" : "node_27"
},
{
"name" : "node_27",
"id" : 11,
"source_info" : {
"filename" : "test.p4",
"line" : 127,
"column" : 23,
"source_fragment" : "meta.exec_hdr.function_count == 8w3"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
"right" : {
"type" : "hexstr",
"value" : "0x03"
}
}
},
"true_next" : "tbl_act_8",
"false_next" : "node_29"
},
{
"name" : "node_29",
"id" : 12,
"source_info" : {
"filename" : "test.p4",
"line" : 130,
"column" : 23,
"source_fragment" : "meta.exec_hdr.function_count == 8w4"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
"right" : {
"type" : "hexstr",
"value" : "0x04"
}
}
},
"true_next" : "tbl_act_9",
"false_next" : "tbl_act_10"
},
{
"name" : "node_32",
"id" : 13,
"source_info" : {
"filename" : "test.p4",
"line" : 145,
"column" : 16,
"source_fragment" : "((chain_state & function_state) == 8w0) && ((chain_state & dependency) == dependency)"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "and",
"left" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "field",
"value" : ["scalars", "chain_state_2"]
},
"right" : {
"type" : "field",
"value" : ["scalars", "function_state"]
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0x00"
}
}
},
"right" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "field",
"value" : ["scalars", "chain_state_2"]
},
"right" : {
"type" : "field",
"value" : ["scalars", "dependency"]
}
}
},
"right" : {
"type" : "field",
"value" : ["scalars", "dependency"]
}
}
}
}
},
"true_next" : "tbl_act_11",
"false_next" : "tbl_act_12"
},
{
"name" : "node_36",
"id" : 14,
"source_info" : {
"filename" : "test.p4",
"line" : 155,
"column" : 19,
"source_fragment" : "hdr.udp.dstPort == 9000"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x2328"
}
}
},
"true_next" : "tbl_update_packet",
"false_next" : "ethernet_set_mac"
}
]
}
],
"checksums" : [
{
"name" : "cksum",
"id" : 0,
"target" : ["ipv4", "hdrChecksum"],
"calculation" : "calc",
"verify" : true,
"if_cond" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"type" : "generic"
},
{
"name" : "cksum_0",
"id" : 1,
"target" : ["ipv4", "hdrChecksum"],
"calculation" : "calc_0",
"verify" : false,
"if_cond" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"type" : "generic"
}
],
"force_arith" : [],
"extern_instances" : [],
"extern_function_instances" : [],
"field_aliases" : [],
"flow_variables" : [
{
"flow" : "ingress",
"header" : "scalars",
"field" : "chain_state"
},
{
"flow" : "egress",
"header" : "scalars",
"field" : "dependency"
},
{
"flow" : "egress",
"header" : "scalars",
"field" : "chain_state_2"
},
{
"flow" : "egress",
"header" : "scalars",
"field" : "function_state"
},
{
"flow" : "egress",
"header" : "scalars",
"field" : "function_dispatch_state"
}
]
}
\ No newline at end of file
{
"tables": [
{
"preamble": {
"id": 33595418,
"name": "ipv4_route",
"alias": "ipv4_route"
},
"matchFields": [
{
"id": 1,
"name": "ipv4.dstAddr",
"bitwidth": 32,
"matchType": "EXACT"
}
],
"actionRefs": [
{
"id": 16816129
},
{
"id": 16800567,
"annotations": [
"@defaultonly()"
]
}
],
"size": "8192"
},
{
"preamble": {
"id": 33576407,
"name": "ethernet_set_mac",
"alias": "ethernet_set_mac"
},
"matchFields": [
{
"id": 1,
"name": "standard_metadata.egress_port",
"bitwidth": 16,
"matchType": "EXACT"
}
],
"actionRefs": [
{
"id": 16797539
},
{
"id": 16800567,
"annotations": [
"@defaultonly()"
]
}
],
"size": "1024"
},
{
"preamble": {
"id": 33609421,
"name": "reroute_packet",
"alias": "reroute_packet"
},
"matchFields": [
{
"id": 1,
"name": "standard_metadata.egress_port",
"bitwidth": 16,
"matchType": "EXACT"
}
],
"actionRefs": [
{
"id": 16793773
},
{
"id": 16800567,
"annotations": [
"@defaultonly()"
]
}
],
"size": "1024"
}
],
"actions": [
{
"preamble": {
"id": 16800567,
"name": "NoAction",
"alias": "NoAction"
}
},
{
"preamble": {
"id": 16816129,
"name": "set_egress",
"alias": "set_egress"
},
"params": [
{
"id": 1,
"name": "egress_spec",
"bitwidth": 16
}
]
},
{
"preamble": {
"id": 16797539,
"name": "ethernet_set_mac_act",
"alias": "ethernet_set_mac_act"
},
"params": [
{
"id": 1,
"name": "smac",
"bitwidth": 48
},
{
"id": 2,
"name": "dmac",
"bitwidth": 48
}
]
},
{
"preamble": {
"id": 16834936,
"name": "clone_packet",
"alias": "clone_packet"
}
},
{
"preamble": {
"id": 16806395,
"name": "recirculate_packet",
"alias": "recirculate_packet"
}
},
{
"preamble": {
"id": 16781354,
"name": "update_packet",
"alias": "update_packet"
}
},
{
"preamble": {
"id": 16793773,
"name": "reroute_packet_act",
"alias": "reroute_packet_act"
},
"params": [
{
"id": 1,
"name": "dstAddr",
"bitwidth": 32
}
]
}
]
}
pkg_info {
arch: "v1model"
}
tables {
preamble {
id: 35506667
name: "_resubmit"
alias: "_resubmit"
}
action_refs {
id: 25440205
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 1024
}
tables {
preamble {
id: 49919998
name: "copy_meta"
alias: "copy_meta"
}
action_refs {
id: 26528747
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 1024
}
tables {
preamble {
id: 37913844
name: "increase"
alias: "increase"
}
action_refs {
id: 22407208
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 1024
}
tables {
preamble {
id: 49389594
name: "ipv4_route"
alias: "ipv4_route"
annotations: "@stage(11)"
}
match_fields {
id: 1
name: "ipv4.dstAddr"
bitwidth: 32
match_type: EXACT
}
action_refs {
id: 30447617
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 8192
}
tables {
preamble {
id: 43603415
name: "ethernet_set_mac"
alias: "ethernet_set_mac"
}
match_fields {
id: 1
name: "standard_metadata.egress_port"
bitwidth: 9
match_type: EXACT
}
action_refs {
id: 20729699
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 1024
}
actions {
preamble {
id: 21257015
name: "NoAction"
alias: "NoAction"
annotations: "@noWarn(\"unused\")"
}
}
actions {
preamble {
id: 25440205
name: "_resubmit_act"
alias: "_resubmit_act"
}
}
actions {
preamble {
id: 26528747
name: "copy_meta_act"
alias: "copy_meta_act"
}
}
actions {
preamble {
id: 22407208
name: "increase_act"
alias: "increase_act"
}
}
actions {
preamble {
id: 30447617
name: "set_egress"
alias: "set_egress"
}
params {
id: 1
name: "egress_spec"
bitwidth: 9
}
}
actions {
preamble {
id: 20729699
name: "ethernet_set_mac_act"
alias: "ethernet_set_mac_act"
}
params {
id: 1
name: "smac"
bitwidth: 48
}
params {
id: 2
name: "dmac"
bitwidth: 48
}
}
type_info {
}
//=============================================================================================================
#include <stdint.h>
#include <nfp/me.h>
#include <nfp/mem_atomic.h>
#include <pif_common.h>
#include "pif_plugin.h"
//=============================================================================================================
int pif_plugin_prime(EXTRACTED_HEADERS_T *headers, MATCH_DATA_T *match_data) {
PIF_PLUGIN_map_hdr_T *mapHdr = pif_plugin_hdr_get_map_hdr(headers);
__gpr uint32_t i = 1;
uint32_t prime = mapHdr->data;
uint32_t j = 2;
uint32_t x = 1;
__gpr uint32_t calc_prime = 1;
short b = 0;
for (;i < prime; i++) {
b = 0;
for (j = 2; j <= (i / 2); j++) {
if (i % j == 0) {
b = 1;
break;
}
}
if (b == 0)
calc_prime = i;
}
mapHdr->data = prime;
return PIF_PLUGIN_RETURN_FORWARD;
}
\ No newline at end of file
{
"program" : "routing_benchmark.p4",
"__meta__" : {
"version" : [2, 7],
"compiler" : "https://github.com/p4lang/p4c"
},
"header_types" : [
{
"name" : "scalars_0",
"id" : 0,
"fields" : []
},
{
"name" : "ethernet_t",
"id" : 1,
"fields" : [
["dstAddr", 48, false],
["srcAddr", 48, false],
["etherType", 16, false]
]
},
{
"name" : "ipv4_t",
"id" : 2,
"fields" : [
["version", 4, false],
["ihl", 4, false],
["diffserv", 8, false],
["totalLen", 16, false],
["identification", 16, false],
["flags", 3, false],
["fragOffset", 13, false],
["ttl", 8, false],
["protocol", 8, false],
["hdrChecksum", 16, false],
["srcAddr", 32, false],
["dstAddr", 32, false]
]
},
{
"name" : "udp_t",
"id" : 3,
"fields" : [
["srcPort", 16, false],
["dstPort", 16, false],
["length_", 16, false],
["checksum", 16, false]
]
},
{
"name" : "map_hdr_t",
"id" : 4,
"fields" : [
["chain_id", 32, false],
["exec_id", 32, false],
["function_id", 8, false],
["data", 32, false],
["function_count", 8, false],
["f0", 8, false],
["f1", 8, false],
["f2", 8, false],
["f3", 8, false],
["f4", 8, false]
]
},
{
"name" : "ingress_metadata_t",
"id" : 5,
"fields" : [
["drop", 1, false],
["egress_port", 9, false],
["packet_type", 4, false],
["_padding", 2, false]
]
},
{
"name" : "resubmit_meta_t",
"id" : 6,
"fields" : [
["current_state", 8, false],
["data", 32, false]
]
},
{
"name" : "exec_hdr_t",
"id" : 7,
"fields" : [
["function_count", 8, false],
["function", 8, false]
]
},
{
"name" : "standard_metadata",
"id" : 8,
"fields" : [
["ingress_port", 16, false],
["packet_length", 14, false],
["egress_spec", 16, false],
["egress_port", 16, false],
["egress_instance", 10, false],
["instance_type", 4, false],
["clone_spec", 32, false],
["parser_error_location", 8, false],
["parser_status", 3, false],
["checksum_error", 1, false]
]
}
],
"headers" : [
{
"name" : "scalars",
"id" : 0,
"header_type" : "scalars_0",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "standard_metadata",
"id" : 1,
"header_type" : "standard_metadata",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "ethernet",
"id" : 2,
"header_type" : "ethernet_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "ipv4",
"id" : 3,
"header_type" : "ipv4_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "udp",
"id" : 4,
"header_type" : "udp_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "map_hdr",
"id" : 5,
"header_type" : "map_hdr_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "ing_metadata",
"id" : 6,
"header_type" : "ingress_metadata_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "resubmit_meta",
"id" : 7,
"header_type" : "resubmit_meta_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "exec_hdr",
"id" : 8,
"header_type" : "exec_hdr_t",
"metadata" : true,
"pi_omit" : true
}
],
"header_stacks" : [],
"header_union_types" : [],
"header_unions" : [],
"header_union_stacks" : [],
"field_lists" : [],
"errors" : [
["NoError", 1],
["PacketTooShort", 2],
["NoMatch", 3],
["StackOutOfBounds", 4],
["HeaderTooShort", 5],
["ParserTimeout", 6]
],
"enums" : [],
"parsers" : [
{
"name" : "parser",
"id" : 0,
"init_state" : "start",
"parse_states" : [
{
"name" : "parse_ipv4",
"id" : 0,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "ipv4"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x00000511",
"mask" : "0x00000fff",
"next_state" : "parse_udp"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 3,
"column" : 31,
"source_fragment" : "parse_ipv4"
}
},
{
"name" : "parse_udp",
"id" : 1,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "udp"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x22b9",
"mask" : null,
"next_state" : "parse_map_hdr"
},
{
"value" : "0x2328",
"mask" : null,
"next_state" : "parse_map_hdr"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["udp", "dstPort"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 11,
"column" : 30,
"source_fragment" : "parse_udp"
}
},
{
"name" : "parse_map_hdr",
"id" : 2,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "map_hdr"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 20,
"column" : 34,
"source_fragment" : "parse_map_hdr"
}
},
{
"name" : "start",
"id" : 3,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "ethernet"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x0800",
"mask" : null,
"next_state" : "parse_ipv4"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["ethernet", "etherType"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 25,
"column" : 26,
"source_fragment" : "start"
}
}
]
}
],
"deparsers" : [
{
"name" : "deparser",
"id" : 0,
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 80,
"column" : 8,
"source_fragment" : "DeparserImpl"
},
"order" : ["ethernet", "ipv4", "udp", "map_hdr"]
}
],
"meter_arrays" : [],
"counter_arrays" : [],
"register_arrays" : [],
"calculations" : [
{
"name" : "calc",
"id" : 0,
"algo" : "crc32",
"input" : [
{
"type" : "field",
"value" : ["map_hdr", "data"]
}
],
"output_width" : 16
},
{
"name" : "calc_0",
"id" : 1,
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 91,
"column" : 8,
"source_fragment" : "verify_checksum( ..."
},
"algo" : "csum16",
"input" : [
{
"type" : "field",
"value" : ["ipv4", "version"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "diffserv"]
},
{
"type" : "field",
"value" : ["ipv4", "totalLen"]
},
{
"type" : "field",
"value" : ["ipv4", "identification"]
},
{
"type" : "field",
"value" : ["ipv4", "flags"]
},
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"output_width" : 16
},
{
"name" : "calc_1",
"id" : 2,
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 111,
"column" : 8,
"source_fragment" : "update_checksum( ..."
},
"algo" : "csum16",
"input" : [
{
"type" : "field",
"value" : ["ipv4", "version"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "diffserv"]
},
{
"type" : "field",
"value" : ["ipv4", "totalLen"]
},
{
"type" : "field",
"value" : ["ipv4", "identification"]
},
{
"type" : "field",
"value" : ["ipv4", "flags"]
},
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"output_width" : 16
}
],
"learn_lists" : [],
"actions" : [
{
"name" : "NoAction",
"id" : 0,
"runtime_data" : [],
"primitives" : [],
"source_info" : {
"filename" : "../../../../../../opt/netronome/p4/include/16/p4include/core.p4",
"line" : 68,
"column" : 7,
"source_fragment" : "NoAction"
}
},
{
"name" : "set_ecmp_select",
"id" : 1,
"runtime_data" : [],
"primitives" : [
{
"op" : "modify_field_with_hash_based_offset",
"parameters" : [
{
"type" : "field",
"value" : ["map_hdr", "chain_id"]
},
{
"type" : "hexstr",
"value" : "0x0000"
},
{
"type" : "calculation",
"value" : "calc"
},
{
"type" : "hexstr",
"value" : "0x00000004"
}
],
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 24,
"column" : 8,
"source_fragment" : "hash(hdr.map_hdr.chain_id, ..."
}
}
],
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 23,
"column" : 11,
"source_fragment" : "set_ecmp_select"
}
},
{
"name" : "fwd_act",
"id" : 2,
"runtime_data" : [
{
"name" : "port",
"bitwidth" : 16
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 32,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port"
}
}
],
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 31,
"column" : 29,
"source_fragment" : "fwd_act"
}
},
{
"name" : "fix_checksum",
"id" : 3,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "checksum"]
},
{
"type" : "hexstr",
"value" : "0x0000"
}
],
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 68,
"column" : 8,
"source_fragment" : "hdr.udp.checksum = 16w0"
}
}
],
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 67,
"column" : 33,
"source_fragment" : "fix_checksum"
}
}
],
"pipelines" : [
{
"name" : "ingress",
"id" : 0,
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 8,
"column" : 8,
"source_fragment" : "ingress"
},
"init_table" : "node_2",
"tables" : [
{
"name" : "tbl_set_ecmp_select",
"id" : 0,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [1],
"actions" : ["set_ecmp_select"],
"base_default_next" : "fwd",
"next_tables" : {
"set_ecmp_select" : "fwd"
},
"default_entry" : {
"action_id" : 1,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "fwd",
"id" : 1,
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 35,
"column" : 24,
"source_fragment" : "fwd"
},
"key" : [
{
"match_type" : "exact",
"target" : ["standard_metadata", "ingress_port"],
"mask" : null
}
],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [2, 0],
"actions" : ["fwd_act", "NoAction"],
"base_default_next" : null,
"next_tables" : {
"fwd_act" : null,
"NoAction" : null
},
"default_entry" : {
"action_id" : 0,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
}
],
"action_profiles" : [],
"conditionals" : [
{
"name" : "node_2",
"id" : 0,
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 45,
"column" : 12,
"source_fragment" : "hdr.ipv4.isValid() && hdr.udp.dstPort == 9000"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "and",
"left" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"right" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x2328"
}
}
}
}
},
"true_next" : "tbl_set_ecmp_select",
"false_next" : "fwd"
}
]
},
{
"name" : "egress",
"id" : 1,
"source_info" : {
"filename" : "routing_benchmark.p4",
"line" : 52,
"column" : 8,
"source_fragment" : "egress"
},
"init_table" : "tbl_fix_checksum",
"tables" : [
{
"name" : "tbl_fix_checksum",
"id" : 2,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [3],
"actions" : ["fix_checksum"],
"base_default_next" : null,
"next_tables" : {
"fix_checksum" : null
},
"default_entry" : {
"action_id" : 3,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
}
],
"action_profiles" : [],
"conditionals" : []
}
],
"checksums" : [
{
"name" : "cksum",
"id" : 0,
"target" : ["ipv4", "hdrChecksum"],
"calculation" : "calc_0",
"verify" : true,
"if_cond" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"type" : "generic"
},
{
"name" : "cksum_0",
"id" : 1,
"target" : ["ipv4", "hdrChecksum"],
"calculation" : "calc_1",
"verify" : false,
"if_cond" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"type" : "generic"
}
],
"force_arith" : [],
"extern_instances" : [],
"extern_function_instances" : [],
"field_aliases" : [],
"flow_variables" : []
}
\ No newline at end of file
#include <core.p4>
#define V1MODEL_VERSION 20200408
#include <v1model.p4>
#include "includes/defines.p4"
#include "includes/headers_mininet.p4"
#include "includes/parsers.p4"
control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
// @name(".set_egress") action set_egress() {
// bit<32> temp = hdr.ipv4.dstAddr;
// hdr.ipv4.dstAddr = hdr.ipv4.srcAddr;
// hdr.ipv4.srcAddr = temp;
// hdr.udp.dstPort = 9000;
// bit<48> tempEth = hdr.ethernet.dstAddr;
// hdr.ethernet.dstAddr = hdr.ethernet.srcAddr;
// hdr.ethernet.srcAddr = tempEth;
// standard_metadata.egress_spec = standard_metadata.ingress_port;
// hdr.ipv4.ttl = hdr.ipv4.ttl - 8w1;
// }
action set_ecmp_select(bit<16> ecmp_base, bit<32> ecmp_count) {
hash(hdr.map_hdr.chain_id,
HashAlgorithm.crc32,
ecmp_base,
{ hdr.map_hdr.data },
ecmp_count);
}
@name(".fwd_act") action fwd_act(bit<16> port) {
standard_metadata.egress_spec = port;
}
@name(".fwd") table fwd {
actions = {
fwd_act;
}
key = {
standard_metadata.ingress_port : exact;
}
}
apply {
if (hdr.ipv4.isValid() && hdr.udp.dstPort == REPLY_PORT) {
set_ecmp_select(0, 4);
}
fwd.apply();
}
}
control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
// @name(".ethernet_set_mac_act") action ethernet_set_mac_act(bit<48> smac, bit<48> dmac) {
// hdr.ethernet.srcAddr = smac;
// hdr.ethernet.dstAddr = dmac;
// }
// @name(".ethernet_set_mac") table ethernet_set_mac {
// actions = {
// ethernet_set_mac_act;
// }
// key = {
// standard_metadata.egress_port: exact;
// }
// }
@name("fix_checksum") action fix_checksum() {
hdr.udp.checksum = 16w0;
}
apply {
// if (hdr.udp.dstPort == MDS_PORT) {
// ethernet_set_mac.apply();
// }
fix_checksum();
}
}
control DeparserImpl(packet_out packet, in headers hdr) {
apply {
packet.emit<ethernet_t>(hdr.ethernet);
packet.emit<ipv4_t>(hdr.ipv4);
packet.emit<udp_t>(hdr.udp);
packet.emit<map_hdr_t>(hdr.map_hdr);
}
}
control verifyChecksum(inout headers hdr, inout metadata meta) {
apply {
verify_checksum(
hdr.ipv4.isValid(),
{ hdr.ipv4.version,
hdr.ipv4.ihl,
hdr.ipv4.diffserv,
hdr.ipv4.totalLen,
hdr.ipv4.identification,
hdr.ipv4.flags,
hdr.ipv4.fragOffset,
hdr.ipv4.ttl,
hdr.ipv4.protocol,
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr },
hdr.ipv4.hdrChecksum,
HashAlgorithm.csum16);
}
}
control computeChecksum(inout headers hdr, inout metadata meta) {
apply {
update_checksum(
hdr.ipv4.isValid(),
{ hdr.ipv4.version,
hdr.ipv4.ihl,
hdr.ipv4.diffserv,
hdr.ipv4.totalLen,
hdr.ipv4.identification,
hdr.ipv4.flags,
hdr.ipv4.fragOffset,
hdr.ipv4.ttl,
hdr.ipv4.protocol,
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr },
hdr.ipv4.hdrChecksum,
HashAlgorithm.csum16);
}
}
V1Switch<headers, metadata>(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main;
{
"tables": [
{
"preamble": {
"id": 33595533,
"name": "fwd",
"alias": "fwd"
},
"matchFields": [
{
"id": 1,
"name": "standard_metadata.ingress_port",
"bitwidth": 16,
"matchType": "EXACT"
}
],
"actionRefs": [
{
"id": 16805069
},
{
"id": 16800567,
"annotations": [
"@defaultonly()"
]
}
],
"size": "1024"
}
],
"actions": [
{
"preamble": {
"id": 16800567,
"name": "NoAction",
"alias": "NoAction"
}
},
{
"preamble": {
"id": 16839725,
"name": "set_ecmp_select",
"alias": "set_ecmp_select"
}
},
{
"preamble": {
"id": 16805069,
"name": "fwd_act",
"alias": "fwd_act"
},
"params": [
{
"id": 1,
"name": "port",
"bitwidth": 16
}
]
},
{
"preamble": {
"id": 16841338,
"name": "fix_checksum",
"alias": "fix_checksum"
}
}
]
}
##########################################
# Header instance definitions #
##########################################
errors:
type: enum
values:
- NoError: 1
- PacketTooShort: 2
- NoMatch: 3
- StackOutOfBounds: 4
- HeaderTooShort: 5
- ParserTimeout: 6
ethernet:
fields:
- dstAddr: 48
- srcAddr: 48
- etherType: 16
type: header
exec_hdr:
fields:
- function_count: 8
- function: 8
type: metadata
ing_metadata:
fields:
- drop: 1
- egress_port: 9
- packet_type: 4
- _padding: 2
type: metadata
ipv4:
calculated_fields:
- condition: valid(ipv4)
field: hdrChecksum
func: calc_0
type: verify
- condition: valid(ipv4)
field: hdrChecksum
func: calc_1
type: update
fields:
- version: 4
- ihl: 4
- diffserv: 8
- totalLen: 16
- identification: 16
- flags: 3
- fragOffset: 13
- ttl: 8
- protocol: 8
- hdrChecksum: 16
- srcAddr: 32
- dstAddr: 32
type: header
map_hdr:
fields:
- chain_id: 32
- exec_id: 32
- function_id: 8
- data: 32
- function_count: 8
- f0: 8
- f1: 8
- f2: 8
- f3: 8
- f4: 8
type: header
resubmit_meta:
fields:
- current_state: 8
- data: 32
type: metadata
standard_metadata:
fields:
- ingress_port: 16
- packet_length: 14
- egress_spec: 16
- egress_port: 16
- egress_instance: 10
- instance_type: 4
- clone_spec: 32
- parser_error_location: 8
- parser_status: 3
- checksum_error: 1
type: metadata
udp:
fields:
- srcPort: 16
- dstPort: 16
- length_: 16
- checksum: 16
type: header
##########################################
# Field list definitions #
##########################################
field_list_1:
fields:
- map_hdr.data
type: field_list
field_list_2:
fields:
- ipv4.version
- ipv4.ihl
- ipv4.diffserv
- ipv4.totalLen
- ipv4.identification
- ipv4.flags
- ipv4.fragOffset
- ipv4.ttl
- ipv4.protocol
- ipv4.srcAddr
- ipv4.dstAddr
type: field_list
##########################################
# Field list calculations #
##########################################
calc:
algorithm: crc32
inputs:
- field_list_1
output_width: 16
type: field_list_calculation
calc_0:
algorithm: csum16
inputs:
- field_list_2
output_width: 16
type: field_list_calculation
calc_1:
algorithm: csum16
inputs:
- field_list_2
output_width: 16
type: field_list_calculation
##########################################
# Parse states #
##########################################
parse_ipv4:
implementation: extract(ipv4);
select_value:
- ipv4.fragOffset
- ipv4.ihl
- ipv4.protocol
src_filename: includes/parsers.p4
src_lineno: 3
type: parse_state
parse_map_hdr:
implementation: extract(map_hdr);
src_filename: includes/parsers.p4
src_lineno: 20
type: parse_state
parse_udp:
implementation: extract(udp);
select_value:
- udp.dstPort
src_filename: includes/parsers.p4
src_lineno: 11
type: parse_state
start:
implementation: extract(ethernet);
select_value:
- ethernet.etherType
src_filename: includes/parsers.p4
src_lineno: 25
type: parse_state
##########################################
# Parser #
##########################################
parser:
format: dot
implementation: |-
digraph {
start -> parse_ipv4 [value="0x0800", mask="none", order="0"]
start -> exit [value="default", mask="none", order="1"]
parse_ipv4 -> parse_udp [value="0x00000511", mask="0x00000fff", order="0"]
parse_ipv4 -> exit [value="default", mask="none", order="1"]
parse_udp -> parse_map_hdr [value="0x22b9", mask="none", order="0"]
parse_udp -> parse_map_hdr [value="0x2328", mask="none", order="1"]
parse_udp -> exit [value="default", mask="none", order="2"]
parse_map_hdr -> exit [value="default", mask="none", order="0"]
}
start_state: start
type: parser
##########################################
# Action sets #
##########################################
egress::fix_checksum:
implementation: modify_field(udp.checksum, 0x0000);
src_filename: routing_benchmark.p4
src_lineno: 67
type: action
ingress::fwd_act:
implementation: modify_field(standard_metadata.egress_spec, port);
parameter_list:
- port: 16
src_filename: routing_benchmark.p4
src_lineno: 31
type: action
ingress::set_ecmp_select:
implementation: modify_field_with_hash_based_offset(map_hdr.chain_id, 0x0000,
calc, 0x00000004);
src_filename: routing_benchmark.p4
src_lineno: 23
type: action
##########################################
# Ingress and Egress tables #
##########################################
egress::tbl_fix_checksum:
allowed_actions:
- egress::fix_checksum
default_entry:
action: egress::fix_checksum
const: true
max_entries: 1025
src_filename: ''
src_lineno: 1
type: table
ingress::fwd:
allowed_actions:
- ingress::fwd_act
match_on:
standard_metadata.ingress_port: exact
max_entries: 1025
src_filename: routing_benchmark.p4
src_lineno: 35
type: table
ingress::tbl_set_ecmp_select:
allowed_actions:
- ingress::set_ecmp_select
default_entry:
action: ingress::set_ecmp_select
const: true
max_entries: 1025
src_filename: ''
src_lineno: 1
type: table
##########################################
# Ingress conditionals sets #
##########################################
_condition_0:
condition: (((valid(ipv4))) and (((udp.dstPort) == (9000))))
format: bracketed_expr
src_filename: routing_benchmark.p4
src_lineno: 45
type: conditional
##########################################
# Ingress control flow #
##########################################
ingress_flow:
doc: control flow for ingress
format: dot
implementation: |-
digraph {
"_condition_0" -> "ingress::fwd" [condition = false]
"_condition_0" -> "ingress::tbl_set_ecmp_select" [condition = true]
"ingress::fwd" -> "exit_control_flow" [action = always]
"ingress::tbl_set_ecmp_select" -> "ingress::fwd" [action = always]
}
start_state: _condition_0
type: control_flow
##########################################
# Egress control flow #
##########################################
egress_flow:
doc: control flow for egress
format: dot
implementation: |-
digraph {
"egress::tbl_fix_checksum" -> "exit_control_flow" [action = always]
}
start_state: egress::tbl_fix_checksum
type: control_flow
##########################################
# Deparsers #
##########################################
deparser:
order:
- ethernet
- ipv4
- udp
- map_hdr
type: deparser
##########################################
# Processor layout #
##########################################
layout:
format: list
implementation:
- parser
- ingress
- egress
type: processor_layout
##########################################
# Source info #
##########################################
source_info:
date: 2021/01/01 11:07:44
output_file: ./routing_benchmark.yml
p4_version: '16'
source_files:
- ''
- routing_benchmark.p4
- ../../../../../../opt/netronome/p4/include/16/p4include/core.p4
type: source_info
#include "includes/defines.p4"
#include "includes/headers.p4"
#include "includes/parsers.p4"
#include "includes/checksum.p4"
#include "ethernet.p4"
#include "ipv4.p4"
#define PKT_INSTANCE_TYPE_NORMAL 0
#define PKT_INSTANCE_TYPE_INGRESS_CLONE 1
#define PKT_INSTANCE_TYPE_EGRESS_CLONE 2
#define PKT_INSTANCE_TYPE_COALESCED 3
#define PKT_INSTANCE_TYPE_INGRESS_RECIRC 4
#define PKT_INSTANCE_TYPE_REPLICATION 5
#define PKT_INSTANCE_TYPE_RESUBMIT 6
register runtime {
width: 8;
instance_count: 1000;
}
header_type resubmit_meta_t {
fields {
resubmit_key: 32;
}
}
metadata resubmit_meta_t resubmit_meta;
field_list resubmit_metadata {
resubmit_meta.resubmit_key;
}
action _resubmit_act() {
resubmit(resubmit_metadata);
}
table _resubmit{
actions {
_resubmit_act;
}
}
action copy_meta_act() {
modify_field(router_hdr.key, resubmit_meta.resubmit_key);
}
table copy_meta {
actions {
copy_meta_act;
}
}
action increase_act() {
add_to_field(resubmit_meta.resubmit_key, 1);
modify_field(router_hdr.key, resubmit_meta.resubmit_key);
}
table increase {
actions {
increase_act;
}
}
control ingress {
if ((resubmit_meta.resubmit_key == 0 and router_hdr.f1 == 1) or (resubmit_meta.resubmit_key == 1 and router_hdr.f2 == 1)) {
apply(increase);
apply(_resubmit);
}
// else if (resubmit_meta.resubmit_key == 2 and router_hdr.f3 == 1) {
// apply(increase);
// apply(_resubmit);
// }
// else if (resubmit_meta.resubmit_key == 3 and router_hdr.f4 == 1) {
// apply(increase);
// apply(_resubmit);
// }
// else if (resubmit_meta.resubmit_key == 4 and router_hdr.f5 == 1) {
// apply(increase);
// apply(_resubmit);
else {
apply(copy_meta);
apply(ipv4_route);
}
}
control egress {
apply(ethernet_set_mac);
}
\ No newline at end of file
pkg_info {
arch: "v1model"
}
tables {
preamble {
id: 35506667
name: "_resubmit"
alias: "_resubmit"
}
action_refs {
id: 25440205
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 1024
}
tables {
preamble {
id: 49919998
name: "copy_meta"
alias: "copy_meta"
}
action_refs {
id: 26528747
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 1024
}
tables {
preamble {
id: 37913844
name: "increase"
alias: "increase"
}
action_refs {
id: 22407208
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 1024
}
tables {
preamble {
id: 49389594
name: "ipv4_route"
alias: "ipv4_route"
annotations: "@stage(11)"
}
match_fields {
id: 1
name: "ipv4.dstAddr"
bitwidth: 32
match_type: EXACT
}
action_refs {
id: 30447617
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 8192
}
tables {
preamble {
id: 43603415
name: "ethernet_set_mac"
alias: "ethernet_set_mac"
}
match_fields {
id: 1
name: "standard_metadata.egress_port"
bitwidth: 9
match_type: EXACT
}
action_refs {
id: 20729699
}
action_refs {
id: 21257015
annotations: "@defaultonly"
scope: DEFAULT_ONLY
}
size: 1024
}
actions {
preamble {
id: 21257015
name: "NoAction"
alias: "NoAction"
annotations: "@noWarn(\"unused\")"
}
}
actions {
preamble {
id: 25440205
name: "_resubmit_act"
alias: "_resubmit_act"
}
}
actions {
preamble {
id: 26528747
name: "copy_meta_act"
alias: "copy_meta_act"
}
}
actions {
preamble {
id: 22407208
name: "increase_act"
alias: "increase_act"
}
}
actions {
preamble {
id: 30447617
name: "set_egress"
alias: "set_egress"
}
params {
id: 1
name: "egress_spec"
bitwidth: 9
}
}
actions {
preamble {
id: 20729699
name: "ethernet_set_mac_act"
alias: "ethernet_set_mac_act"
}
params {
id: 1
name: "smac"
bitwidth: 48
}
params {
id: 2
name: "dmac"
bitwidth: 48
}
}
type_info {
}
#include <core.p4>
#define V1MODEL_VERSION 20200408
#include <v1model.p4>
#include "includes/defines.p4"
#include "includes/headers.p4"
#include "includes/parsers.p4"
control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name(".ethernet_set_mac_act") action ethernet_set_mac_act(bit<48> smac, bit<48> dmac) {
hdr.ethernet.srcAddr = smac;
hdr.ethernet.dstAddr = dmac;
}
@name(".ethernet_set_mac") table ethernet_set_mac {
actions = {
ethernet_set_mac_act;
}
key = {
standard_metadata.egress_port: exact;
}
}
apply {
ethernet_set_mac.apply();
}
}
control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name("._resubmit_act") action _resubmit_act() {
resubmit({ standard_metadata, meta.resubmit_meta });
}
@name("._resubmit") table _resubmit {
actions = {
_resubmit_act;
}
}
@name(".copy_meta_act") action copy_meta_act() {
hdr.map_hdr.data = meta.resubmit_meta.data;
}
@name(".copy_meta") table copy_meta {
actions = {
copy_meta_act;
}
}
@name(".function1_act") action function1_act() {
meta.resubmit_meta.data = meta.resubmit_meta.data + 32w1;
hdr.map_hdr.data = meta.resubmit_meta.data;
}
@name(".function1") table function1 {
actions = {
function1_act;
}
}
@name(".function2_act") action function2_act() {
meta.resubmit_meta.data = meta.resubmit_meta.data + 32w2;
hdr.map_hdr.data = meta.resubmit_meta.data;
}
@name(".function2") table function2 {
actions = {
function2_act;
}
}
@name(".set_egress") action set_egress(bit<9> egress_spec) {
hdr.udp.checksum = 16w0; // TODO: check later how to calculate checksum for payload.
standard_metadata.egress_spec = egress_spec;
hdr.ipv4.ttl = hdr.ipv4.ttl - 8w1;
}
// @stage(11)
@name(".ipv4_route") table ipv4_route {
actions = {
set_egress;
}
key = {
hdr.ipv4.dstAddr: exact;
}
size = 8192;
}
apply {
// bit<8> tmp = meta.resubmit_meta.current_state;
// if ((tmp & 8w1 == 0) && (tmp & hdr.map_hdr.f1) == hdr.map_hdr.f1) {
// function1.apply();
// meta.resubmit_meta.current_state = meta.resubmit_meta.current_state | 8w1;
// _resubmit.apply();
// // } else if (tmp & 8w2 == 0 && (tmp & hdr.map_hdr.f2) == hdr.map_hdr.f2) {
// // function2.apply();
// // meta.resubmit_meta.current_state = meta.resubmit_meta.current_state | 8w2;
// // _resubmit.apply();
// } else {
// copy_meta.apply();
// ipv4_route.apply();
// }
// copy_meta.apply();
ipv4_route.apply();
}
}
control DeparserImpl(packet_out packet, in headers hdr) {
apply {
packet.emit(hdr.ethernet);
packet.emit(hdr.ipv4);
packet.emit(hdr.udp);
packet.emit(hdr.map_hdr);
packet.emit(hdr.tcp);
}
}
control verifyChecksum(inout headers hdr, inout metadata meta) {
apply {
}
}
control computeChecksum(inout headers hdr, inout metadata meta) {
apply {
update_checksum(true, {
hdr.ipv4.version,
hdr.ipv4.ihl,
hdr.ipv4.diffserv,
hdr.ipv4.totalLen,
hdr.ipv4.identification,
hdr.ipv4.flags,
hdr.ipv4.fragOffset,
hdr.ipv4.ttl,
hdr.ipv4.protocol,
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr },
hdr.ipv4.hdrChecksum,
HashAlgorithm.csum16
);
}
}
V1Switch(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main;
{
"program" : "test.p4",
"__meta__" : {
"version" : [2, 7],
"compiler" : "https://github.com/p4lang/p4c"
},
"header_types" : [
{
"name" : "scalars_0",
"id" : 0,
"fields" : [
["chain_state", 8, false],
["chain_state_2", 8, false]
]
},
{
"name" : "ethernet_t",
"id" : 1,
"fields" : [
["dstAddr", 48, false],
["srcAddr", 48, false],
["etherType", 16, false]
]
},
{
"name" : "ipv4_t",
"id" : 2,
"fields" : [
["version", 4, false],
["ihl", 4, false],
["diffserv", 8, false],
["totalLen", 16, false],
["identification", 16, false],
["flags", 3, false],
["fragOffset", 13, false],
["ttl", 8, false],
["protocol", 8, false],
["hdrChecksum", 16, false],
["srcAddr", 32, false],
["dstAddr", 32, false]
]
},
{
"name" : "udp_t",
"id" : 3,
"fields" : [
["srcPort", 16, false],
["dstPort", 16, false],
["length_", 16, false],
["checksum", 16, false]
]
},
{
"name" : "map_hdr_t",
"id" : 4,
"fields" : [
["chain_id", 32, false],
["exec_id", 32, false],
["function_id", 8, false],
["data", 32, false],
["function_count", 8, false],
["f0", 8, false],
["f1", 8, false],
["f2", 8, false],
["f3", 8, false],
["f4", 8, false]
]
},
{
"name" : "ingress_metadata_t",
"id" : 5,
"fields" : [
["drop", 1, false],
["egress_port", 9, false],
["packet_type", 4, false],
["_padding", 2, false]
]
},
{
"name" : "resubmit_meta_t",
"id" : 6,
"fields" : [
["current_state", 8, false],
["data", 32, false]
]
},
{
"name" : "exec_hdr_t",
"id" : 7,
"fields" : [
["function_count", 8, false],
["function", 8, false]
]
},
{
"name" : "standard_metadata",
"id" : 8,
"fields" : [
["ingress_port", 16, false],
["packet_length", 14, false],
["egress_spec", 16, false],
["egress_port", 16, false],
["egress_instance", 10, false],
["instance_type", 4, false],
["clone_spec", 32, false],
["parser_error_location", 8, false],
["parser_status", 3, false],
["checksum_error", 1, false]
]
}
],
"headers" : [
{
"name" : "scalars",
"id" : 0,
"header_type" : "scalars_0",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "standard_metadata",
"id" : 1,
"header_type" : "standard_metadata",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "ethernet",
"id" : 2,
"header_type" : "ethernet_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "ipv4",
"id" : 3,
"header_type" : "ipv4_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "udp",
"id" : 4,
"header_type" : "udp_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "map_hdr",
"id" : 5,
"header_type" : "map_hdr_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "ing_metadata",
"id" : 6,
"header_type" : "ingress_metadata_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "resubmit_meta",
"id" : 7,
"header_type" : "resubmit_meta_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "exec_hdr",
"id" : 8,
"header_type" : "exec_hdr_t",
"metadata" : true,
"pi_omit" : true
}
],
"header_stacks" : [],
"header_union_types" : [],
"header_unions" : [],
"header_union_stacks" : [],
"field_lists" : [
{
"id" : 0,
"name" : "tuple_0",
"elements" : [
{
"type" : "field",
"value" : ["standard_metadata", "ingress_port"]
},
{
"type" : "field",
"value" : ["standard_metadata", "packet_length"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_port"]
},
{
"type" : "field",
"value" : ["standard_metadata", "egress_instance"]
},
{
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
{
"type" : "field",
"value" : ["standard_metadata", "clone_spec"]
},
{
"type" : "field",
"value" : ["standard_metadata", "parser_error_location"]
},
{
"type" : "field",
"value" : ["standard_metadata", "parser_status"]
},
{
"type" : "field",
"value" : ["standard_metadata", "checksum_error"]
},
{
"type" : "field",
"value" : ["ing_metadata", "drop"]
},
{
"type" : "field",
"value" : ["ing_metadata", "egress_port"]
},
{
"type" : "field",
"value" : ["ing_metadata", "packet_type"]
},
{
"type" : "field",
"value" : ["resubmit_meta", "current_state"]
},
{
"type" : "field",
"value" : ["resubmit_meta", "data"]
},
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
{
"type" : "field",
"value" : ["exec_hdr", "function"]
}
]
}
],
"errors" : [
["NoError", 1],
["PacketTooShort", 2],
["NoMatch", 3],
["StackOutOfBounds", 4],
["HeaderTooShort", 5],
["ParserTimeout", 6]
],
"enums" : [],
"parsers" : [
{
"name" : "parser",
"id" : 0,
"init_state" : "start",
"parse_states" : [
{
"name" : "parse_ipv4",
"id" : 0,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "ipv4"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x00000511",
"mask" : "0x00000fff",
"next_state" : "parse_udp"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 3,
"column" : 31,
"source_fragment" : "parse_ipv4"
}
},
{
"name" : "parse_udp",
"id" : 1,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "udp"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x22b9",
"mask" : null,
"next_state" : "parse_map_hdr"
},
{
"value" : "0x2328",
"mask" : null,
"next_state" : "parse_map_hdr"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["udp", "dstPort"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 11,
"column" : 30,
"source_fragment" : "parse_udp"
}
},
{
"name" : "parse_map_hdr",
"id" : 2,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "map_hdr"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 20,
"column" : 34,
"source_fragment" : "parse_map_hdr"
}
},
{
"name" : "start",
"id" : 3,
"parser_ops" : [
{
"parameters" : [
{
"type" : "regular",
"value" : "ethernet"
}
],
"op" : "extract"
}
],
"transitions" : [
{
"value" : "0x0800",
"mask" : null,
"next_state" : "parse_ipv4"
},
{
"value" : "default",
"mask" : null,
"next_state" : null
}
],
"transition_key" : [
{
"type" : "field",
"value" : ["ethernet", "etherType"]
}
],
"source_info" : {
"filename" : "includes/parsers.p4",
"line" : 25,
"column" : 26,
"source_fragment" : "start"
}
}
]
}
],
"deparsers" : [
{
"name" : "deparser",
"id" : 0,
"source_info" : {
"filename" : "test.p4",
"line" : 167,
"column" : 8,
"source_fragment" : "DeparserImpl"
},
"order" : ["ethernet", "ipv4", "udp", "map_hdr"]
}
],
"meter_arrays" : [],
"counter_arrays" : [],
"register_arrays" : [
{
"name" : "current_state",
"id" : 0,
"source_info" : {
"filename" : "includes/headers.p4",
"line" : 12,
"column" : 25,
"source_fragment" : "current_state"
},
"size" : 16384,
"bitwidth" : 8
},
{
"name" : "dispatch_state",
"id" : 1,
"source_info" : {
"filename" : "includes/headers.p4",
"line" : 13,
"column" : 25,
"source_fragment" : "dispatch_state"
},
"size" : 16384,
"bitwidth" : 8
}
],
"calculations" : [
{
"name" : "calc",
"id" : 0,
"source_info" : {
"filename" : "test.p4",
"line" : 178,
"column" : 8,
"source_fragment" : "verify_checksum( ..."
},
"algo" : "csum16",
"input" : [
{
"type" : "field",
"value" : ["ipv4", "version"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "diffserv"]
},
{
"type" : "field",
"value" : ["ipv4", "totalLen"]
},
{
"type" : "field",
"value" : ["ipv4", "identification"]
},
{
"type" : "field",
"value" : ["ipv4", "flags"]
},
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"output_width" : 16
},
{
"name" : "calc_0",
"id" : 1,
"source_info" : {
"filename" : "test.p4",
"line" : 198,
"column" : 8,
"source_fragment" : "update_checksum( ..."
},
"algo" : "csum16",
"input" : [
{
"type" : "field",
"value" : ["ipv4", "version"]
},
{
"type" : "field",
"value" : ["ipv4", "ihl"]
},
{
"type" : "field",
"value" : ["ipv4", "diffserv"]
},
{
"type" : "field",
"value" : ["ipv4", "totalLen"]
},
{
"type" : "field",
"value" : ["ipv4", "identification"]
},
{
"type" : "field",
"value" : ["ipv4", "flags"]
},
{
"type" : "field",
"value" : ["ipv4", "fragOffset"]
},
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "field",
"value" : ["ipv4", "protocol"]
},
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
}
],
"output_width" : 16
}
],
"learn_lists" : [],
"actions" : [
{
"name" : "NoAction",
"id" : 0,
"runtime_data" : [],
"primitives" : [],
"source_info" : {
"filename" : "/opt/netronome/p4/include/16/p4include/core.p4",
"line" : 68,
"column" : 7,
"source_fragment" : "NoAction"
}
},
{
"name" : "set_egress",
"id" : 1,
"runtime_data" : [
{
"name" : "egress_spec",
"bitwidth" : 16
}
],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "checksum"]
},
{
"type" : "hexstr",
"value" : "0x0000"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 13,
"column" : 8,
"source_fragment" : "hdr.udp.checksum = 16w0"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_spec"]
},
{
"type" : "runtime_data",
"value" : 0
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 14,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = egress_spec"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "ttl"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "expression",
"value" : {
"op" : "+",
"left" : {
"type" : "field",
"value" : ["ipv4", "ttl"]
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 15,
"column" : 8,
"source_fragment" : "hdr.ipv4.ttl = hdr.ipv4.ttl - 8w1"
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 12,
"column" : 32,
"source_fragment" : "set_egress"
}
},
{
"name" : "act",
"id" : 2,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["resubmit_meta", "data"]
},
{
"type" : "field",
"value" : ["map_hdr", "data"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 31,
"column" : 20,
"source_fragment" : "meta.resubmit_meta.data = hdr.map_hdr.data"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["resubmit_meta", "current_state"]
},
{
"type" : "hexstr",
"value" : "0x00"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 32,
"column" : 20,
"source_fragment" : "meta.resubmit_meta.current_state = 8w0"
}
}
]
},
{
"name" : "act_0",
"id" : 3,
"runtime_data" : [],
"primitives" : [
{
"op" : "register_read",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "chain_state"]
},
{
"type" : "register_array",
"value" : "current_state"
},
{
"type" : "field",
"value" : ["map_hdr", "exec_id"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 39,
"column" : 20,
"source_fragment" : "current_state.read(chain_state, index)"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "chain_state"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "|",
"left" : {
"type" : "field",
"value" : ["scalars", "chain_state"]
},
"right" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "expression",
"value" : {
"op" : "<<",
"left" : {
"type" : "hexstr",
"value" : "0x01"
},
"right" : {
"type" : "field",
"value" : ["map_hdr", "function_id"]
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
}
}
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 40,
"column" : 20,
"source_fragment" : "chain_state = chain_state | (8w1 << hdr.map_hdr.function_id)"
}
},
{
"op" : "register_write",
"parameters" : [
{
"type" : "register_array",
"value" : "current_state"
},
{
"type" : "field",
"value" : ["map_hdr", "exec_id"]
},
{
"type" : "field",
"value" : ["scalars", "chain_state"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 41,
"column" : 20,
"source_fragment" : "current_state.write(index, chain_state)"
}
}
]
},
{
"name" : "recirculate_packet",
"id" : 4,
"runtime_data" : [],
"primitives" : [
{
"op" : "recirculate",
"parameters" : [
{
"type" : "hexstr",
"value" : "0x0"
}
]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 71,
"column" : 40,
"source_fragment" : "recirculate_packet"
}
},
{
"name" : "update_packet",
"id" : 5,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "dstPort"]
},
{
"type" : "hexstr",
"value" : "0x22b9"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 76,
"column" : 8,
"source_fragment" : "hdr.udp.dstPort = 8889"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["udp", "srcPort"]
},
{
"type" : "hexstr",
"value" : "0x2328"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 77,
"column" : 8,
"source_fragment" : "hdr.udp.srcPort = 9000"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "dstAddr"]
},
{
"type" : "hexstr",
"value" : "0x0a000002"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 78,
"column" : 8,
"source_fragment" : "hdr.ipv4.dstAddr = 0x0a000002"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["ipv4", "srcAddr"]
},
{
"type" : "hexstr",
"value" : "0x0a000001"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 79,
"column" : 8,
"source_fragment" : "hdr.ipv4.srcAddr = 0x0a000001"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["standard_metadata", "egress_port"]
},
{
"type" : "hexstr",
"value" : "0x0004"
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 80,
"column" : 8,
"source_fragment" : "standard_metadata.egress_port = 4"
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 75,
"column" : 35,
"source_fragment" : "update_packet"
}
},
{
"name" : "act_1",
"id" : 6,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
{
"type" : "field",
"value" : ["map_hdr", "function_count"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 100,
"column" : 16,
"source_fragment" : "meta.exec_hdr.function_count = hdr.map_hdr.function_count"
}
}
]
},
{
"name" : "act_2",
"id" : 7,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "expression",
"value" : {
"op" : "+",
"left" : {
"type" : "field",
"value" : ["exec_hdr", "function_count"]
},
"right" : {
"type" : "hexstr",
"value" : "0xfe"
}
}
},
"right" : {
"type" : "hexstr",
"value" : "0xff"
}
}
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 103,
"column" : 16,
"source_fragment" : "meta.exec_hdr.function_count = meta.exec_hdr.function_count - 8w2"
}
},
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["map_hdr", "function_id"]
},
{
"type" : "field",
"value" : ["exec_hdr", "function_count"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 104,
"column" : 16,
"source_fragment" : "hdr.map_hdr.function_id = meta.exec_hdr.function_count"
}
}
]
},
{
"name" : "act_3",
"id" : 8,
"runtime_data" : [],
"primitives" : [
{
"op" : "assign",
"parameters" : [
{
"type" : "field",
"value" : ["map_hdr", "data"]
},
{
"type" : "expression",
"value" : {
"type" : "expression",
"value" : {
"op" : "&",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0xffffffff"
}
}
}
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 107,
"column" : 12,
"source_fragment" : "hdr.map_hdr.data = (bit<32>)standard_metadata.instance_type"
}
},
{
"op" : "register_read",
"parameters" : [
{
"type" : "field",
"value" : ["scalars", "chain_state_2"]
},
{
"type" : "register_array",
"value" : "current_state"
},
{
"type" : "field",
"value" : ["map_hdr", "exec_id"]
}
],
"source_info" : {
"filename" : "test.p4",
"line" : 118,
"column" : 16,
"source_fragment" : "current_state.read(chain_state, hdr.map_hdr.exec_id)"
}
}
]
}
],
"pipelines" : [
{
"name" : "ingress",
"id" : 0,
"source_info" : {
"filename" : "test.p4",
"line" : 9,
"column" : 8,
"source_fragment" : "ingress"
},
"init_table" : "node_2",
"tables" : [
{
"name" : "tbl_act",
"id" : 0,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [2],
"actions" : ["act"],
"base_default_next" : "ipv4_route",
"next_tables" : {
"act" : "ipv4_route"
},
"default_entry" : {
"action_id" : 2,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "ipv4_route",
"id" : 1,
"source_info" : {
"filename" : "test.p4",
"line" : 17,
"column" : 31,
"source_fragment" : "fwd"
},
"key" : [
{
"match_type" : "exact",
"target" : ["standard_metadata", "ingress_port"],
"mask" : null
}
],
"match_type" : "exact",
"type" : "simple",
"max_size" : 8192,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [1, 0],
"actions" : ["set_egress", "NoAction"],
"base_default_next" : null,
"next_tables" : {
"set_egress" : null,
"NoAction" : null
},
"default_entry" : {
"action_id" : 0,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
},
{
"name" : "tbl_act_0",
"id" : 2,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [3],
"actions" : ["act_0"],
"base_default_next" : "ipv4_route",
"next_tables" : {
"act_0" : "ipv4_route"
},
"default_entry" : {
"action_id" : 3,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "ipv4_route",
"id" : 3,
"source_info" : {
"filename" : "test.p4",
"line" : 17,
"column" : 31,
"source_fragment" : "fwd"
},
"key" : [
{
"match_type" : "exact",
"target" : ["standard_metadata", "ingress_port"],
"mask" : null
}
],
"match_type" : "exact",
"type" : "simple",
"max_size" : 8192,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [1, 0],
"actions" : ["set_egress", "NoAction"],
"base_default_next" : null,
"next_tables" : {
"set_egress" : null,
"NoAction" : null
},
"default_entry" : {
"action_id" : 0,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
}
}
],
"action_profiles" : [],
"conditionals" : [
{
"name" : "node_2",
"id" : 0,
"source_info" : {
"filename" : "test.p4",
"line" : 28,
"column" : 12,
"source_fragment" : "hdr.ipv4.isValid()"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"false_next" : null,
"true_next" : "node_3"
},
{
"name" : "node_3",
"id" : 1,
"source_info" : {
"filename" : "test.p4",
"line" : 29,
"column" : 16,
"source_fragment" : "hdr.udp.dstPort == 8889"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x22b9"
}
}
},
"true_next" : "node_4",
"false_next" : "node_7"
},
{
"name" : "node_4",
"id" : 2,
"source_info" : {
"filename" : "test.p4",
"line" : 30,
"column" : 20,
"source_fragment" : "standard_metadata.instance_type == 0"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0x00"
}
}
},
"false_next" : null,
"true_next" : "tbl_act"
},
{
"name" : "node_7",
"id" : 3,
"source_info" : {
"filename" : "test.p4",
"line" : 35,
"column" : 23,
"source_fragment" : "hdr.udp.dstPort == 9000"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x2328"
}
}
},
"false_next" : null,
"true_next" : "tbl_act_0"
}
]
},
{
"name" : "egress",
"id" : 1,
"source_info" : {
"filename" : "test.p4",
"line" : 51,
"column" : 8,
"source_fragment" : "egress"
},
"init_table" : "node_12",
"tables" : [
{
"name" : "tbl_act_1",
"id" : 4,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [6],
"actions" : ["act_1"],
"base_default_next" : "tbl_act_3",
"next_tables" : {
"act_1" : "tbl_act_3"
},
"default_entry" : {
"action_id" : 6,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"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" : [7],
"actions" : ["act_2"],
"base_default_next" : "tbl_act_3",
"next_tables" : {
"act_2" : "tbl_act_3"
},
"default_entry" : {
"action_id" : 7,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_act_3",
"id" : 6,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [8],
"actions" : ["act_3"],
"base_default_next" : null,
"next_tables" : {
"act_3" : null
},
"default_entry" : {
"action_id" : 8,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_update_packet",
"id" : 7,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [5],
"actions" : ["update_packet"],
"base_default_next" : "tbl_recirculate_packet",
"next_tables" : {
"update_packet" : "tbl_recirculate_packet"
},
"default_entry" : {
"action_id" : 5,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
},
{
"name" : "tbl_recirculate_packet",
"id" : 8,
"key" : [],
"match_type" : "exact",
"type" : "simple",
"max_size" : 1024,
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
"action_ids" : [4],
"actions" : ["recirculate_packet"],
"base_default_next" : null,
"next_tables" : {
"recirculate_packet" : null
},
"default_entry" : {
"action_id" : 4,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
}
}
],
"action_profiles" : [],
"conditionals" : [
{
"name" : "node_12",
"id" : 4,
"source_info" : {
"filename" : "test.p4",
"line" : 98,
"column" : 12,
"source_fragment" : "hdr.udp.dstPort == 8889"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x22b9"
}
}
},
"true_next" : "node_13",
"false_next" : "node_18"
},
{
"name" : "node_13",
"id" : 5,
"source_info" : {
"filename" : "test.p4",
"line" : 99,
"column" : 16,
"source_fragment" : "standard_metadata.instance_type == 0 || standard_metadata.instance_type == 3"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "or",
"left" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0x00"
}
}
},
"right" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0x03"
}
}
}
}
},
"true_next" : "tbl_act_1",
"false_next" : "node_15"
},
{
"name" : "node_15",
"id" : 6,
"source_info" : {
"filename" : "test.p4",
"line" : 102,
"column" : 23,
"source_fragment" : "standard_metadata.instance_type == 9"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["standard_metadata", "instance_type"]
},
"right" : {
"type" : "hexstr",
"value" : "0x09"
}
}
},
"true_next" : "tbl_act_2",
"false_next" : "tbl_act_3"
},
{
"name" : "node_18",
"id" : 7,
"source_info" : {
"filename" : "test.p4",
"line" : 158,
"column" : 19,
"source_fragment" : "hdr.udp.dstPort == 9000"
},
"expression" : {
"type" : "expression",
"value" : {
"op" : "==",
"left" : {
"type" : "field",
"value" : ["udp", "dstPort"]
},
"right" : {
"type" : "hexstr",
"value" : "0x2328"
}
}
},
"false_next" : null,
"true_next" : "tbl_update_packet"
}
]
}
],
"checksums" : [
{
"name" : "cksum",
"id" : 0,
"target" : ["ipv4", "hdrChecksum"],
"calculation" : "calc",
"verify" : true,
"if_cond" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"type" : "generic"
},
{
"name" : "cksum_0",
"id" : 1,
"target" : ["ipv4", "hdrChecksum"],
"calculation" : "calc_0",
"verify" : false,
"if_cond" : {
"type" : "expression",
"value" : {
"op" : "d2b",
"left" : null,
"right" : {
"type" : "field",
"value" : ["ipv4", "$valid$"]
}
}
},
"type" : "generic"
}
],
"force_arith" : [],
"extern_instances" : [],
"extern_function_instances" : [],
"field_aliases" : [],
"flow_variables" : [
{
"flow" : "ingress",
"header" : "scalars",
"field" : "chain_state"
},
{
"flow" : "egress",
"header" : "scalars",
"field" : "chain_state_2"
}
]
}
\ No newline at end of file
#include <core.p4>
#define V1MODEL_VERSION 20200408
#include <v1model.p4>
#include "includes/defines.p4"
#include "includes/headers.p4"
#include "includes/parsers.p4"
control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name(".set_egress") action set_egress(bit<16> egress_spec) {
hdr.udp.checksum = 16w0;
standard_metadata.egress_spec = egress_spec;
hdr.ipv4.ttl = hdr.ipv4.ttl - 8w1;
}
@name(".ipv4_route") table fwd {
actions = {
set_egress;
}
key = {
standard_metadata.ingress_port : exact;
}
size = 8192;
}
apply {
if (hdr.ipv4.isValid()) {
if (hdr.udp.dstPort == MDS_PORT) {
if (standard_metadata.instance_type == PKT_INSTANCE_TYPE_NORMAL) {
meta.resubmit_meta.data = hdr.map_hdr.data;
meta.resubmit_meta.current_state = 8w0;
fwd.apply();
}
} else if (hdr.udp.dstPort == REPLY_PORT) {
bit<8> chain_state;
bit<32> index = (bit<32>) hdr.map_hdr.exec_id;
@atomic {
current_state.read(chain_state, index);
chain_state = chain_state | (8w1 << hdr.map_hdr.function_id);
current_state.write(index, chain_state);
}
// hdr.map_hdr.data = (bit<32>)chain_state;
fwd.apply();
}
}
}
}
control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name(".ethernet_set_mac_act") action ethernet_set_mac_act(bit<48> smac, bit<48> dmac) {
hdr.ethernet.srcAddr = smac;
hdr.ethernet.dstAddr = dmac;
}
@name(".ethernet_set_mac") table ethernet_set_mac {
actions = {
ethernet_set_mac_act;
}
key = {
standard_metadata.egress_port: exact;
}
}
@name(".clone_packet") action clone_packet() {
clone3(CloneType.E2E, 4, {standard_metadata, meta});
}
@name(".recirculate_packet") action recirculate_packet() {
recirculate({standard_metadata, meta});
}
@name(".update_packet") action update_packet() {
hdr.udp.dstPort = MDS_PORT;
hdr.udp.srcPort = REPLY_PORT;
hdr.ipv4.dstAddr = CONTROLLER_IP;
hdr.ipv4.srcAddr = SERVER_IP;
standard_metadata.egress_port = 4;
}
@name(".reroute_packet_act") action reroute_packet_act(bit<32> dstAddr) {
hdr.ipv4.dstAddr = dstAddr;
}
@name("reroute_packet")table reroute_packet {
actions = {
reroute_packet_act;
}
key = {
standard_metadata.egress_port: exact;
}
}
apply {
if (hdr.udp.dstPort == MDS_PORT) {
if (standard_metadata.instance_type == PKT_INSTANCE_TYPE_NORMAL || standard_metadata.instance_type == PKT_INSTANCE_TYPE_INGRESS_RECIRC) {
meta.exec_hdr.function_count = hdr.map_hdr.function_count;
// hdr.map_hdr.data = (bit<32>)standard_metadata.egress_port;
} else if (standard_metadata.instance_type == PKT_INSTANCE_TYPE_EGRESS_CLONE) {
meta.exec_hdr.function_count = meta.exec_hdr.function_count - 8w1;
hdr.map_hdr.function_id = meta.exec_hdr.function_count;
}
/**
* create a packet replica for next function to be checked
**/
if (meta.exec_hdr.function_count > 0) {
clone_packet();
hdr.map_hdr.data = (bit<32>)standard_metadata.instance_type;
}
bit<8> dependency = 8w0;
bit<8> chain_state;
bit<8> function_state = 8w0;
@atomic {
current_state.read(chain_state, hdr.map_hdr.exec_id);
}
if (meta.exec_hdr.function_count == 8w0) {
dependency = hdr.map_hdr.f0;
function_state = 8w1 << 0;
} else if (meta.exec_hdr.function_count == 8w1) {
dependency = hdr.map_hdr.f1;
function_state = 8w1 << 1;
} else if (meta.exec_hdr.function_count == 8w2) {
dependency = hdr.map_hdr.f2;
function_state = 8w1 << 2;
} else if (meta.exec_hdr.function_count == 8w3) {
dependency = hdr.map_hdr.f3;
function_state = 8w1 << 3;
} else if (meta.exec_hdr.function_count == 8w4) {
dependency = hdr.map_hdr.f4;
function_state = 8w1 << 4;
}
// hdr.map_hdr.data = (bit<32>)(chain_state & function_state);
/**
* if current function under scanner has not executed
* and its dependency condition is met continue
**/
// hdr.map_hdr.data = (bit<32>)123;
bit<8> function_dispatch_state;
@atomic {
dispatch_state.read(function_dispatch_state, hdr.map_hdr.exec_id);
// hdr.map_hdr.data = (bit<32>) function_dispatch_state;
if (((function_dispatch_state & function_state) == 8w0) && ((chain_state & dependency) == dependency)) {
function_dispatch_state = function_dispatch_state | (function_state);
dispatch_state.write(hdr.map_hdr.exec_id, function_dispatch_state);
// reroute_packet.apply();
} else {
hdr.ipv4.dstAddr = 0x0a000009;
}
}
} else if (hdr.udp.dstPort == REPLY_PORT) {
update_packet();
recirculate_packet();
}
// ethernet_set_mac.apply();
}
}
control DeparserImpl(packet_out packet, in headers hdr) {
apply {
packet.emit<ethernet_t>(hdr.ethernet);
packet.emit<ipv4_t>(hdr.ipv4);
packet.emit<udp_t>(hdr.udp);
packet.emit<map_hdr_t>(hdr.map_hdr);
}
}
control verifyChecksum(inout headers hdr, inout metadata meta) {
apply {
verify_checksum(
hdr.ipv4.isValid(),
{ hdr.ipv4.version,
hdr.ipv4.ihl,
hdr.ipv4.diffserv,
hdr.ipv4.totalLen,
hdr.ipv4.identification,
hdr.ipv4.flags,
hdr.ipv4.fragOffset,
hdr.ipv4.ttl,
hdr.ipv4.protocol,
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr },
hdr.ipv4.hdrChecksum,
HashAlgorithm.csum16);
}
}
control computeChecksum(inout headers hdr, inout metadata meta) {
apply {
update_checksum(
hdr.ipv4.isValid(),
{ hdr.ipv4.version,
hdr.ipv4.ihl,
hdr.ipv4.diffserv,
hdr.ipv4.totalLen,
hdr.ipv4.identification,
hdr.ipv4.flags,
hdr.ipv4.fragOffset,
hdr.ipv4.ttl,
hdr.ipv4.protocol,
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr },
hdr.ipv4.hdrChecksum,
HashAlgorithm.csum16);
}
}
V1Switch<headers, metadata>(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main;
{
"registers": {
"configs": []
},
"tables": {
"ingress::ipv4_route": {
"rules": [
{
"action": {
"type": "ingress::set_egress",
"data": {
"egress_spec": {
"value": "p0"
}
}
},
"name": "host_to_net",
"match": {
"standard_metadata.ingress_port": {
"value": "v0.0"
}
}
},
{
"action": {
"type": "ingress::set_egress",
"data": {
"egress_spec": {
"value": "v0.1"
}
}
},
"name": "net_to_host",
"match": {
"standard_metadata.ingress_port": {
"value": "p1"
}
}
},
{
"action": {
"type": "ingress::set_egress",
"data": {
"egress_spec": {
"value": "v0.0"
}
}
},
"name": "net_to_host",
"match": {
"standard_metadata.ingress_port": {
"value": "p0"
}
}
},
{
"action": {
"type": "ingress::set_egress",
"data": {
"egress_spec": {
"value": "p1"
}
}
},
"name": "net_to_host",
"match": {
"standard_metadata.ingress_port": {
"value": "v0.1"
}
}
}
]
}
},
"multicast": {},
"meters": {
"configs": []
}
}
{
"tables": [
{
"preamble": {
"id": 33595418,
"name": "ipv4_route",
"alias": "ipv4_route"
},
"matchFields": [
{
"id": 1,
"name": "standard_metadata.ingress_port",
"bitwidth": 16,
"matchType": "EXACT"
}
],
"actionRefs": [
{
"id": 16816129
},
{
"id": 16800567,
"annotations": [
"@defaultonly()"
]
}
],
"size": "8192"
}
],
"actions": [
{
"preamble": {
"id": 16800567,
"name": "NoAction",
"alias": "NoAction"
}
},
{
"preamble": {
"id": 16816129,
"name": "set_egress",
"alias": "set_egress"
},
"params": [
{
"id": 1,
"name": "egress_spec",
"bitwidth": 16
}
]
},
{
"preamble": {
"id": 16806395,
"name": "recirculate_packet",
"alias": "recirculate_packet"
}
},
{
"preamble": {
"id": 16781354,
"name": "update_packet",
"alias": "update_packet"
}
}
]
}
NAME
sdk6_cli - Netronome SDK6 RTE Command Line Interface
SYNOPSIS
./sdk6_cli.py [options] command [positional arg] [flag [argument] [flag ...]]
DESCRIPTION
The sdk6_cli is program providing a command line interface for the Netronome
P4 based SDK6 Run Time Environment based on a Thrift generated python RPC
client. It provides and interface for user to load P4 model (consisting
of userspace configuration and firmware for supported NFP devies), populate
and modify P4 tables entries and show the current state of the P4 model
through current table entries, defined counters, meters and registers and
other features.
COMMAND DESCRIPTIONS
ping
Send a ping request to the RTE server, if a succesfull connection was
estabilished the message "Ping reply from RTE" will be displayed.
echo "message"
Sends text message to the RTE server, if succesfullly received the text
will be sent out via RTE logging service as an INFO level log message.
config-reload <path_to_file/config.json>
Sends contents of the specified JSON containing new user configuration
(set of table entries) to RTE to replace current user configuration. This
means the original configuration and any entries added/edited up to now
will be overwriten.
list-tables
List all the tables with their properties as defined in the currently
loaded design configuration.
add-entry
edit-entry
delete-entry
list-entries
list-counters
get-counter
clear-counter
clear-all-counters
list-registers
get-register
clear-register
get-sys-counters
clear-sys-counters
\ No newline at end of file
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
import sys
import pprint
from urlparse import urlparse
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.transport import THttpClient
from thrift.protocol import TBinaryProtocol
from sdk6_rte import RunTimeEnvironment
from sdk6_rte.ttypes import *
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ''
print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
print ''
print 'Functions:'
print ' string sys_ping()'
print ' void sys_echo(string echo_msg)'
print ' void sys_shutdown()'
print ' string sys_version_get()'
print ' LogLevel sys_log_level_get()'
print ' RteReturn sys_log_level_set(LogLevel level)'
print ' RteReturn design_load(DesignLoadArgs arguments)'
print ' RteReturn design_unload()'
print ' RteReturn design_reconfig(string pif_config_json)'
print ' DesignLoadStatus design_load_status()'
print ' ports_info_retrieve()'
print ' table_list_all()'
print ' RteReturn table_entry_add(i32 tbl_id, TableEntry entry)'
print ' RteReturn table_entry_edit(i32 tbl_id, TableEntry entry)'
print ' RteReturn table_entry_delete(i32 tbl_id, TableEntry entry)'
print ' table_retrieve(i32 tbl_id)'
print ' i64 table_version_get()'
print ' parser_value_set_list_all()'
print ' RteReturn parser_value_set_add(i32 pvs_id, entries)'
print ' RteReturn parser_value_set_clear(i32 pvs_id)'
print ' parser_value_set_retrieve(i32 pvs_id)'
print ' p4_counter_list_all()'
print ' P4CounterReturn p4_counter_retrieve(i32 counter_id)'
print ' RteReturn p4_counter_clear(i32 counter_id)'
print ' RteReturn p4_counter_clear_all()'
print ' register_list_all()'
print ' register_retrieve(RegisterArrayArg regarr)'
print ' RteReturn register_clear(RegisterArrayArg regarr)'
print ' RteReturn register_field_set(RegisterArrayArg regarr, i32 field_id, string value)'
print ' RteReturn register_set(RegisterArrayArg regarr, values)'
print ' sys_counter_retrieve_all()'
print ' RteReturn sys_counter_clear_all()'
print ' mcast_config_get_all()'
print ' McastCfgEntry mcast_config_get(i32 mcast_group)'
print ' RteReturn mcast_config_set(McastCfgEntry cfg)'
print ' meter_list_all()'
print ' meter_config_get(i32 meter_id)'
print ' RteReturn meter_config_set(i32 meter_id, cfgs)'
print ' digest_list_all()'
print ' i64 digest_register(i32 digest_id)'
print ' RteReturn digest_deregister(i64 digest_regid)'
print ' digest_retrieve(i64 digest_regid)'
print ' RteReturn traffic_class_set(i64 port_id, cfgs)'
print ' RteReturn traffic_class_commit(i64 port_id)'
print ' traffic_class_get(i64 port_id)'
print ' DebugCtlReturn debugctl(string debug_id, string debug_data)'
print ''
sys.exit(0)
pp = pprint.PrettyPrinter(indent = 2)
host = 'localhost'
port = 9090
uri = ''
framed = False
http = False
argi = 1
if sys.argv[argi] == '-h':
parts = sys.argv[argi+1].split(':')
host = parts[0]
if len(parts) > 1:
port = int(parts[1])
argi += 2
if sys.argv[argi] == '-u':
url = urlparse(sys.argv[argi+1])
parts = url[1].split(':')
host = parts[0]
if len(parts) > 1:
port = int(parts[1])
else:
port = 80
uri = url[2]
if url[4]:
uri += '?%s' % url[4]
http = True
argi += 2
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
framed = True
argi += 1
cmd = sys.argv[argi]
args = sys.argv[argi+1:]
if http:
transport = THttpClient.THttpClient(host, port, uri)
else:
socket = TSocket.TSocket(host, port)
if framed:
transport = TTransport.TFramedTransport(socket)
else:
transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = RunTimeEnvironment.Client(protocol)
transport.open()
if cmd == 'sys_ping':
if len(args) != 0:
print 'sys_ping requires 0 args'
sys.exit(1)
pp.pprint(client.sys_ping())
elif cmd == 'sys_echo':
if len(args) != 1:
print 'sys_echo requires 1 args'
sys.exit(1)
pp.pprint(client.sys_echo(args[0],))
elif cmd == 'sys_shutdown':
if len(args) != 0:
print 'sys_shutdown requires 0 args'
sys.exit(1)
pp.pprint(client.sys_shutdown())
elif cmd == 'sys_version_get':
if len(args) != 0:
print 'sys_version_get requires 0 args'
sys.exit(1)
pp.pprint(client.sys_version_get())
elif cmd == 'sys_log_level_get':
if len(args) != 0:
print 'sys_log_level_get requires 0 args'
sys.exit(1)
pp.pprint(client.sys_log_level_get())
elif cmd == 'sys_log_level_set':
if len(args) != 1:
print 'sys_log_level_set requires 1 args'
sys.exit(1)
pp.pprint(client.sys_log_level_set(eval(args[0]),))
elif cmd == 'design_load':
if len(args) != 1:
print 'design_load requires 1 args'
sys.exit(1)
pp.pprint(client.design_load(eval(args[0]),))
elif cmd == 'design_unload':
if len(args) != 0:
print 'design_unload requires 0 args'
sys.exit(1)
pp.pprint(client.design_unload())
elif cmd == 'design_reconfig':
if len(args) != 1:
print 'design_reconfig requires 1 args'
sys.exit(1)
pp.pprint(client.design_reconfig(args[0],))
elif cmd == 'design_load_status':
if len(args) != 0:
print 'design_load_status requires 0 args'
sys.exit(1)
pp.pprint(client.design_load_status())
elif cmd == 'ports_info_retrieve':
if len(args) != 0:
print 'ports_info_retrieve requires 0 args'
sys.exit(1)
pp.pprint(client.ports_info_retrieve())
elif cmd == 'table_list_all':
if len(args) != 0:
print 'table_list_all requires 0 args'
sys.exit(1)
pp.pprint(client.table_list_all())
elif cmd == 'table_entry_add':
if len(args) != 2:
print 'table_entry_add requires 2 args'
sys.exit(1)
pp.pprint(client.table_entry_add(eval(args[0]),eval(args[1]),))
elif cmd == 'table_entry_edit':
if len(args) != 2:
print 'table_entry_edit requires 2 args'
sys.exit(1)
pp.pprint(client.table_entry_edit(eval(args[0]),eval(args[1]),))
elif cmd == 'table_entry_delete':
if len(args) != 2:
print 'table_entry_delete requires 2 args'
sys.exit(1)
pp.pprint(client.table_entry_delete(eval(args[0]),eval(args[1]),))
elif cmd == 'table_retrieve':
if len(args) != 1:
print 'table_retrieve requires 1 args'
sys.exit(1)
pp.pprint(client.table_retrieve(eval(args[0]),))
elif cmd == 'table_version_get':
if len(args) != 0:
print 'table_version_get requires 0 args'
sys.exit(1)
pp.pprint(client.table_version_get())
elif cmd == 'parser_value_set_list_all':
if len(args) != 0:
print 'parser_value_set_list_all requires 0 args'
sys.exit(1)
pp.pprint(client.parser_value_set_list_all())
elif cmd == 'parser_value_set_add':
if len(args) != 2:
print 'parser_value_set_add requires 2 args'
sys.exit(1)
pp.pprint(client.parser_value_set_add(eval(args[0]),eval(args[1]),))
elif cmd == 'parser_value_set_clear':
if len(args) != 1:
print 'parser_value_set_clear requires 1 args'
sys.exit(1)
pp.pprint(client.parser_value_set_clear(eval(args[0]),))
elif cmd == 'parser_value_set_retrieve':
if len(args) != 1:
print 'parser_value_set_retrieve requires 1 args'
sys.exit(1)
pp.pprint(client.parser_value_set_retrieve(eval(args[0]),))
elif cmd == 'p4_counter_list_all':
if len(args) != 0:
print 'p4_counter_list_all requires 0 args'
sys.exit(1)
pp.pprint(client.p4_counter_list_all())
elif cmd == 'p4_counter_retrieve':
if len(args) != 1:
print 'p4_counter_retrieve requires 1 args'
sys.exit(1)
pp.pprint(client.p4_counter_retrieve(eval(args[0]),))
elif cmd == 'p4_counter_clear':
if len(args) != 1:
print 'p4_counter_clear requires 1 args'
sys.exit(1)
pp.pprint(client.p4_counter_clear(eval(args[0]),))
elif cmd == 'p4_counter_clear_all':
if len(args) != 0:
print 'p4_counter_clear_all requires 0 args'
sys.exit(1)
pp.pprint(client.p4_counter_clear_all())
elif cmd == 'register_list_all':
if len(args) != 0:
print 'register_list_all requires 0 args'
sys.exit(1)
pp.pprint(client.register_list_all())
elif cmd == 'register_retrieve':
if len(args) != 1:
print 'register_retrieve requires 1 args'
sys.exit(1)
pp.pprint(client.register_retrieve(eval(args[0]),))
elif cmd == 'register_clear':
if len(args) != 1:
print 'register_clear requires 1 args'
sys.exit(1)
pp.pprint(client.register_clear(eval(args[0]),))
elif cmd == 'register_field_set':
if len(args) != 3:
print 'register_field_set requires 3 args'
sys.exit(1)
pp.pprint(client.register_field_set(eval(args[0]),eval(args[1]),args[2],))
elif cmd == 'register_set':
if len(args) != 2:
print 'register_set requires 2 args'
sys.exit(1)
pp.pprint(client.register_set(eval(args[0]),eval(args[1]),))
elif cmd == 'sys_counter_retrieve_all':
if len(args) != 0:
print 'sys_counter_retrieve_all requires 0 args'
sys.exit(1)
pp.pprint(client.sys_counter_retrieve_all())
elif cmd == 'sys_counter_clear_all':
if len(args) != 0:
print 'sys_counter_clear_all requires 0 args'
sys.exit(1)
pp.pprint(client.sys_counter_clear_all())
elif cmd == 'mcast_config_get_all':
if len(args) != 0:
print 'mcast_config_get_all requires 0 args'
sys.exit(1)
pp.pprint(client.mcast_config_get_all())
elif cmd == 'mcast_config_get':
if len(args) != 1:
print 'mcast_config_get requires 1 args'
sys.exit(1)
pp.pprint(client.mcast_config_get(eval(args[0]),))
elif cmd == 'mcast_config_set':
if len(args) != 1:
print 'mcast_config_set requires 1 args'
sys.exit(1)
pp.pprint(client.mcast_config_set(eval(args[0]),))
elif cmd == 'meter_list_all':
if len(args) != 0:
print 'meter_list_all requires 0 args'
sys.exit(1)
pp.pprint(client.meter_list_all())
elif cmd == 'meter_config_get':
if len(args) != 1:
print 'meter_config_get requires 1 args'
sys.exit(1)
pp.pprint(client.meter_config_get(eval(args[0]),))
elif cmd == 'meter_config_set':
if len(args) != 2:
print 'meter_config_set requires 2 args'
sys.exit(1)
pp.pprint(client.meter_config_set(eval(args[0]),eval(args[1]),))
elif cmd == 'digest_list_all':
if len(args) != 0:
print 'digest_list_all requires 0 args'
sys.exit(1)
pp.pprint(client.digest_list_all())
elif cmd == 'digest_register':
if len(args) != 1:
print 'digest_register requires 1 args'
sys.exit(1)
pp.pprint(client.digest_register(eval(args[0]),))
elif cmd == 'digest_deregister':
if len(args) != 1:
print 'digest_deregister requires 1 args'
sys.exit(1)
pp.pprint(client.digest_deregister(eval(args[0]),))
elif cmd == 'digest_retrieve':
if len(args) != 1:
print 'digest_retrieve requires 1 args'
sys.exit(1)
pp.pprint(client.digest_retrieve(eval(args[0]),))
elif cmd == 'traffic_class_set':
if len(args) != 2:
print 'traffic_class_set requires 2 args'
sys.exit(1)
pp.pprint(client.traffic_class_set(eval(args[0]),eval(args[1]),))
elif cmd == 'traffic_class_commit':
if len(args) != 1:
print 'traffic_class_commit requires 1 args'
sys.exit(1)
pp.pprint(client.traffic_class_commit(eval(args[0]),))
elif cmd == 'traffic_class_get':
if len(args) != 1:
print 'traffic_class_get requires 1 args'
sys.exit(1)
pp.pprint(client.traffic_class_get(eval(args[0]),))
elif cmd == 'debugctl':
if len(args) != 2:
print 'debugctl requires 2 args'
sys.exit(1)
pp.pprint(client.debugctl(args[0],args[1],))
else:
print 'Unrecognized method %s' % cmd
sys.exit(1)
transport.close()
This source diff could not be displayed because it is too large. You can view the blob instead.
__all__ = ['ttypes', 'constants', 'RunTimeEnvironment']
#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *
#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
from thrift.protocol import fastbinary
except:
fastbinary = None
class RteReturnValue:
"""
************************************************************
Global structures/defines *
************************************************************
"""
SUCCESS = 0
QUALIFIED = 1
ARGINVALID = 2
IOERROR = 3
MEMORYERROR = 4
FILEIOERROR = 5
NOTLOADED = 6
HWINCOMPATIBLE = 7
NOTIMPLEMENTED = 8
_VALUES_TO_NAMES = {
0: "SUCCESS",
1: "QUALIFIED",
2: "ARGINVALID",
3: "IOERROR",
4: "MEMORYERROR",
5: "FILEIOERROR",
6: "NOTLOADED",
7: "HWINCOMPATIBLE",
8: "NOTIMPLEMENTED",
}
_NAMES_TO_VALUES = {
"SUCCESS": 0,
"QUALIFIED": 1,
"ARGINVALID": 2,
"IOERROR": 3,
"MEMORYERROR": 4,
"FILEIOERROR": 5,
"NOTLOADED": 6,
"HWINCOMPATIBLE": 7,
"NOTIMPLEMENTED": 8,
}
class RteValueType:
Invalid = 0
Int64 = 1
String = 2
_VALUES_TO_NAMES = {
0: "Invalid",
1: "Int64",
2: "String",
}
_NAMES_TO_VALUES = {
"Invalid": 0,
"Int64": 1,
"String": 2,
}
class LogLevel:
"""
************************************************************
Defines for general functions *
************************************************************
"""
Unknown = 0
Disable = 1
Fatal = 2
Error = 3
Warn = 4
Info = 5
Debug = 6
Extra = 7
Heavy = 8
_VALUES_TO_NAMES = {
0: "Unknown",
1: "Disable",
2: "Fatal",
3: "Error",
4: "Warn",
5: "Info",
6: "Debug",
7: "Extra",
8: "Heavy",
}
_NAMES_TO_VALUES = {
"Unknown": 0,
"Disable": 1,
"Fatal": 2,
"Error": 3,
"Warn": 4,
"Info": 5,
"Debug": 6,
"Extra": 7,
"Heavy": 8,
}
class RegisterType:
Invalid = 0
Global = 1
Direct = 2
Static = 3
_VALUES_TO_NAMES = {
0: "Invalid",
1: "Global",
2: "Direct",
3: "Static",
}
_NAMES_TO_VALUES = {
"Invalid": 0,
"Global": 1,
"Direct": 2,
"Static": 3,
}
class P4CounterType:
"""
************************************************************
Structure for Counters *
************************************************************
"""
Invalid = 0
Global = 1
Direct = 2
Static = 3
_VALUES_TO_NAMES = {
0: "Invalid",
1: "Global",
2: "Direct",
3: "Static",
}
_NAMES_TO_VALUES = {
"Invalid": 0,
"Global": 1,
"Direct": 2,
"Static": 3,
}
class MeterType:
"""
************************************************************
Meters *
************************************************************
"""
Invalid = 0
Global = 1
Direct = 2
Static = 3
_VALUES_TO_NAMES = {
0: "Invalid",
1: "Global",
2: "Direct",
3: "Static",
}
_NAMES_TO_VALUES = {
"Invalid": 0,
"Global": 1,
"Direct": 2,
"Static": 3,
}
class MeterClass:
Invalid = 0
Packets = 1
Bytes = 2
_VALUES_TO_NAMES = {
0: "Invalid",
1: "Packets",
2: "Bytes",
}
_NAMES_TO_VALUES = {
"Invalid": 0,
"Packets": 1,
"Bytes": 2,
}
class RteReturn:
"""
Attributes:
- value
- reason
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'value', None, None, ), # 1
(2, TType.STRING, 'reason', None, None, ), # 2
)
def __init__(self, value=None, reason=None,):
self.value = value
self.reason = reason
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.value = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.reason = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RteReturn')
if self.value is not None:
oprot.writeFieldBegin('value', TType.I32, 1)
oprot.writeI32(self.value)
oprot.writeFieldEnd()
if self.reason is not None:
oprot.writeFieldBegin('reason', TType.STRING, 2)
oprot.writeString(self.reason)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.value is None:
raise TProtocol.TProtocolException(message='Required field value is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RteValue:
"""
Attributes:
- type
- stringval
- intval
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'type', None, None, ), # 1
(2, TType.STRING, 'stringval', None, None, ), # 2
(3, TType.I64, 'intval', None, None, ), # 3
)
def __init__(self, type=None, stringval=None, intval=None,):
self.type = type
self.stringval = stringval
self.intval = intval
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.type = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.stringval = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I64:
self.intval = iprot.readI64();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RteValue')
if self.type is not None:
oprot.writeFieldBegin('type', TType.I32, 1)
oprot.writeI32(self.type)
oprot.writeFieldEnd()
if self.stringval is not None:
oprot.writeFieldBegin('stringval', TType.STRING, 2)
oprot.writeString(self.stringval)
oprot.writeFieldEnd()
if self.intval is not None:
oprot.writeFieldBegin('intval', TType.I64, 3)
oprot.writeI64(self.intval)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.type is None:
raise TProtocol.TProtocolException(message='Required field type is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class DesignLoadArgs:
"""
************************************************************
Structure for design load/unload/reload *
************************************************************
Attributes:
- nfpfw
- pif_design_json
- pif_config_json
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'nfpfw', None, None, ), # 1
(2, TType.STRING, 'pif_design_json', None, None, ), # 2
(3, TType.STRING, 'pif_config_json', None, None, ), # 3
)
def __init__(self, nfpfw=None, pif_design_json=None, pif_config_json=None,):
self.nfpfw = nfpfw
self.pif_design_json = pif_design_json
self.pif_config_json = pif_config_json
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.nfpfw = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.pif_design_json = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.pif_config_json = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('DesignLoadArgs')
if self.nfpfw is not None:
oprot.writeFieldBegin('nfpfw', TType.STRING, 1)
oprot.writeString(self.nfpfw)
oprot.writeFieldEnd()
if self.pif_design_json is not None:
oprot.writeFieldBegin('pif_design_json', TType.STRING, 2)
oprot.writeString(self.pif_design_json)
oprot.writeFieldEnd()
if self.pif_config_json is not None:
oprot.writeFieldBegin('pif_config_json', TType.STRING, 3)
oprot.writeString(self.pif_config_json)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.nfpfw is None:
raise TProtocol.TProtocolException(message='Required field nfpfw is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class DesignLoadStatus:
"""
Attributes:
- is_loaded
- uuid
- frontend_build_date
- frontend_source
- frontend_version
- uptime
"""
thrift_spec = (
None, # 0
(1, TType.BOOL, 'is_loaded', None, None, ), # 1
(2, TType.STRING, 'uuid', None, None, ), # 2
(3, TType.STRING, 'frontend_build_date', None, None, ), # 3
(4, TType.STRING, 'frontend_source', None, None, ), # 4
(5, TType.STRING, 'frontend_version', None, None, ), # 5
(6, TType.I64, 'uptime', None, None, ), # 6
)
def __init__(self, is_loaded=None, uuid=None, frontend_build_date=None, frontend_source=None, frontend_version=None, uptime=None,):
self.is_loaded = is_loaded
self.uuid = uuid
self.frontend_build_date = frontend_build_date
self.frontend_source = frontend_source
self.frontend_version = frontend_version
self.uptime = uptime
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.BOOL:
self.is_loaded = iprot.readBool();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.uuid = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.frontend_build_date = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.frontend_source = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.frontend_version = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I64:
self.uptime = iprot.readI64();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('DesignLoadStatus')
if self.is_loaded is not None:
oprot.writeFieldBegin('is_loaded', TType.BOOL, 1)
oprot.writeBool(self.is_loaded)
oprot.writeFieldEnd()
if self.uuid is not None:
oprot.writeFieldBegin('uuid', TType.STRING, 2)
oprot.writeString(self.uuid)
oprot.writeFieldEnd()
if self.frontend_build_date is not None:
oprot.writeFieldBegin('frontend_build_date', TType.STRING, 3)
oprot.writeString(self.frontend_build_date)
oprot.writeFieldEnd()
if self.frontend_source is not None:
oprot.writeFieldBegin('frontend_source', TType.STRING, 4)
oprot.writeString(self.frontend_source)
oprot.writeFieldEnd()
if self.frontend_version is not None:
oprot.writeFieldBegin('frontend_version', TType.STRING, 5)
oprot.writeString(self.frontend_version)
oprot.writeFieldEnd()
if self.uptime is not None:
oprot.writeFieldBegin('uptime', TType.I64, 6)
oprot.writeI64(self.uptime)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.is_loaded is None:
raise TProtocol.TProtocolException(message='Required field is_loaded is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RegisterArrayArg:
"""
************************************************************
Structure for Register *
************************************************************
Attributes:
- reg_id
- index
- count
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'reg_id', None, None, ), # 1
(2, TType.I32, 'index', None, None, ), # 2
(3, TType.I32, 'count', None, None, ), # 3
)
def __init__(self, reg_id=None, index=None, count=None,):
self.reg_id = reg_id
self.index = index
self.count = count
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.reg_id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.index = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RegisterArrayArg')
if self.reg_id is not None:
oprot.writeFieldBegin('reg_id', TType.I32, 1)
oprot.writeI32(self.reg_id)
oprot.writeFieldEnd()
if self.index is not None:
oprot.writeFieldBegin('index', TType.I32, 2)
oprot.writeI32(self.index)
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 3)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RegisterFieldDesc:
"""
Attributes:
- name
- width
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.I32, 'width', None, None, ), # 2
)
def __init__(self, name=None, width=None,):
self.name = name
self.width = width
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.width = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RegisterFieldDesc')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.width is not None:
oprot.writeFieldBegin('width', TType.I32, 2)
oprot.writeI32(self.width)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RegisterDesc:
"""
Attributes:
- name
- id
- type
- count
- table
- tableid
- fields
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.I32, 'id', None, None, ), # 2
(3, TType.I32, 'type', None, None, ), # 3
(4, TType.I32, 'count', None, None, ), # 4
(5, TType.STRING, 'table', None, None, ), # 5
(6, TType.I32, 'tableid', None, None, ), # 6
(7, TType.LIST, 'fields', (TType.STRUCT,(RegisterFieldDesc, RegisterFieldDesc.thrift_spec)), None, ), # 7
)
def __init__(self, name=None, id=None, type=None, count=None, table=None, tableid=None, fields=None,):
self.name = name
self.id = id
self.type = type
self.count = count
self.table = table
self.tableid = tableid
self.fields = fields
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.type = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.table = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I32:
self.tableid = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.LIST:
self.fields = []
(_etype3, _size0) = iprot.readListBegin()
for _i4 in xrange(_size0):
_elem5 = RegisterFieldDesc()
_elem5.read(iprot)
self.fields.append(_elem5)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RegisterDesc')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.id is not None:
oprot.writeFieldBegin('id', TType.I32, 2)
oprot.writeI32(self.id)
oprot.writeFieldEnd()
if self.type is not None:
oprot.writeFieldBegin('type', TType.I32, 3)
oprot.writeI32(self.type)
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 4)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
if self.table is not None:
oprot.writeFieldBegin('table', TType.STRING, 5)
oprot.writeString(self.table)
oprot.writeFieldEnd()
if self.tableid is not None:
oprot.writeFieldBegin('tableid', TType.I32, 6)
oprot.writeI32(self.tableid)
oprot.writeFieldEnd()
if self.fields is not None:
oprot.writeFieldBegin('fields', TType.LIST, 7)
oprot.writeListBegin(TType.STRUCT, len(self.fields))
for iter6 in self.fields:
iter6.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class P4CounterDesc:
"""
Attributes:
- name
- id
- type
- count
- table
- tableid
- width
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.I32, 'id', None, None, ), # 2
(3, TType.I32, 'type', None, None, ), # 3
(4, TType.I32, 'count', None, None, ), # 4
(5, TType.STRING, 'table', None, None, ), # 5
(6, TType.I32, 'tableid', None, None, ), # 6
(7, TType.I32, 'width', None, None, ), # 7
)
def __init__(self, name=None, id=None, type=None, count=None, table=None, tableid=None, width=None,):
self.name = name
self.id = id
self.type = type
self.count = count
self.table = table
self.tableid = tableid
self.width = width
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.type = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.table = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I32:
self.tableid = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.I32:
self.width = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('P4CounterDesc')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.id is not None:
oprot.writeFieldBegin('id', TType.I32, 2)
oprot.writeI32(self.id)
oprot.writeFieldEnd()
if self.type is not None:
oprot.writeFieldBegin('type', TType.I32, 3)
oprot.writeI32(self.type)
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 4)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
if self.table is not None:
oprot.writeFieldBegin('table', TType.STRING, 5)
oprot.writeString(self.table)
oprot.writeFieldEnd()
if self.tableid is not None:
oprot.writeFieldBegin('tableid', TType.I32, 6)
oprot.writeI32(self.tableid)
oprot.writeFieldEnd()
if self.width is not None:
oprot.writeFieldBegin('width', TType.I32, 7)
oprot.writeI32(self.width)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class SysCounterValue:
"""
Attributes:
- name
- id
- value
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.I32, 'id', None, None, ), # 2
(3, TType.STRUCT, 'value', (RteValue, RteValue.thrift_spec), None, ), # 3
)
def __init__(self, name=None, id=None, value=None,):
self.name = name
self.id = id
self.value = value
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.value = RteValue()
self.value.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('SysCounterValue')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.id is not None:
oprot.writeFieldBegin('id', TType.I32, 2)
oprot.writeI32(self.id)
oprot.writeFieldEnd()
if self.value is not None:
oprot.writeFieldBegin('value', TType.STRUCT, 3)
self.value.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class P4CounterReturn:
"""
Attributes:
- data
- count
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'data', None, None, ), # 1
(2, TType.I32, 'count', None, None, ), # 2
)
def __init__(self, data=None, count=None,):
self.data = data
self.count = count
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.data = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('P4CounterReturn')
if self.data is not None:
oprot.writeFieldBegin('data', TType.STRING, 1)
oprot.writeString(self.data)
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 2)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TableEntry:
"""
************************************************************
Structure for Table Entry Modification *
************************************************************
Attributes:
- rule_name
- default_rule
- match
- actions
- priority
- timeout_seconds
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'rule_name', None, None, ), # 1
(2, TType.BOOL, 'default_rule', None, None, ), # 2
(3, TType.STRING, 'match', None, None, ), # 3
(4, TType.STRING, 'actions', None, None, ), # 4
(5, TType.I32, 'priority', None, None, ), # 5
(6, TType.I32, 'timeout_seconds', None, None, ), # 6
)
def __init__(self, rule_name=None, default_rule=None, match=None, actions=None, priority=None, timeout_seconds=None,):
self.rule_name = rule_name
self.default_rule = default_rule
self.match = match
self.actions = actions
self.priority = priority
self.timeout_seconds = timeout_seconds
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.rule_name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.BOOL:
self.default_rule = iprot.readBool();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.match = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.actions = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.I32:
self.priority = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I32:
self.timeout_seconds = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('TableEntry')
if self.rule_name is not None:
oprot.writeFieldBegin('rule_name', TType.STRING, 1)
oprot.writeString(self.rule_name)
oprot.writeFieldEnd()
if self.default_rule is not None:
oprot.writeFieldBegin('default_rule', TType.BOOL, 2)
oprot.writeBool(self.default_rule)
oprot.writeFieldEnd()
if self.match is not None:
oprot.writeFieldBegin('match', TType.STRING, 3)
oprot.writeString(self.match)
oprot.writeFieldEnd()
if self.actions is not None:
oprot.writeFieldBegin('actions', TType.STRING, 4)
oprot.writeString(self.actions)
oprot.writeFieldEnd()
if self.priority is not None:
oprot.writeFieldBegin('priority', TType.I32, 5)
oprot.writeI32(self.priority)
oprot.writeFieldEnd()
if self.timeout_seconds is not None:
oprot.writeFieldBegin('timeout_seconds', TType.I32, 6)
oprot.writeI32(self.timeout_seconds)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.rule_name is None:
raise TProtocol.TProtocolException(message='Required field rule_name is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TableDesc:
"""
Attributes:
- tbl_id
- tbl_name
- tbl_entries_max
- support_timeout
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'tbl_id', None, None, ), # 1
(2, TType.STRING, 'tbl_name', None, None, ), # 2
(3, TType.I32, 'tbl_entries_max', None, None, ), # 3
(4, TType.BOOL, 'support_timeout', None, None, ), # 4
)
def __init__(self, tbl_id=None, tbl_name=None, tbl_entries_max=None, support_timeout=None,):
self.tbl_id = tbl_id
self.tbl_name = tbl_name
self.tbl_entries_max = tbl_entries_max
self.support_timeout = support_timeout
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.tbl_id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.tbl_name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.tbl_entries_max = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.BOOL:
self.support_timeout = iprot.readBool();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('TableDesc')
if self.tbl_id is not None:
oprot.writeFieldBegin('tbl_id', TType.I32, 1)
oprot.writeI32(self.tbl_id)
oprot.writeFieldEnd()
if self.tbl_name is not None:
oprot.writeFieldBegin('tbl_name', TType.STRING, 2)
oprot.writeString(self.tbl_name)
oprot.writeFieldEnd()
if self.tbl_entries_max is not None:
oprot.writeFieldBegin('tbl_entries_max', TType.I32, 3)
oprot.writeI32(self.tbl_entries_max)
oprot.writeFieldEnd()
if self.support_timeout is not None:
oprot.writeFieldBegin('support_timeout', TType.BOOL, 4)
oprot.writeBool(self.support_timeout)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.tbl_id is None:
raise TProtocol.TProtocolException(message='Required field tbl_id is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class McastCfgEntry:
"""
************************************************************
Multicast Group Configuration *
************************************************************
Attributes:
- group_id
- max_entries
- ports
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'group_id', None, None, ), # 1
(2, TType.I32, 'max_entries', None, None, ), # 2
(3, TType.LIST, 'ports', (TType.I32,None), None, ), # 3
)
def __init__(self, group_id=None, max_entries=None, ports=None,):
self.group_id = group_id
self.max_entries = max_entries
self.ports = ports
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.group_id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.max_entries = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.LIST:
self.ports = []
(_etype10, _size7) = iprot.readListBegin()
for _i11 in xrange(_size7):
_elem12 = iprot.readI32();
self.ports.append(_elem12)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('McastCfgEntry')
if self.group_id is not None:
oprot.writeFieldBegin('group_id', TType.I32, 1)
oprot.writeI32(self.group_id)
oprot.writeFieldEnd()
if self.max_entries is not None:
oprot.writeFieldBegin('max_entries', TType.I32, 2)
oprot.writeI32(self.max_entries)
oprot.writeFieldEnd()
if self.ports is not None:
oprot.writeFieldBegin('ports', TType.LIST, 3)
oprot.writeListBegin(TType.I32, len(self.ports))
for iter13 in self.ports:
oprot.writeI32(iter13)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class PortInfo:
"""
************************************************************
Port information *
************************************************************
Attributes:
- id
- token
- info
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'id', None, None, ), # 1
(2, TType.STRING, 'token', None, None, ), # 2
(3, TType.STRING, 'info', None, None, ), # 3
)
def __init__(self, id=None, token=None, info=None,):
self.id = id
self.token = token
self.info = info
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.token = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.info = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('PortInfo')
if self.id is not None:
oprot.writeFieldBegin('id', TType.I32, 1)
oprot.writeI32(self.id)
oprot.writeFieldEnd()
if self.token is not None:
oprot.writeFieldBegin('token', TType.STRING, 2)
oprot.writeString(self.token)
oprot.writeFieldEnd()
if self.info is not None:
oprot.writeFieldBegin('info', TType.STRING, 3)
oprot.writeString(self.info)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ParserValueSetFieldDesc:
"""
************************************************************
Structure for Parser Value Sets *
************************************************************
Attributes:
- name
- width
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.I32, 'width', None, None, ), # 2
)
def __init__(self, name=None, width=None,):
self.name = name
self.width = width
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.width = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ParserValueSetFieldDesc')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.width is not None:
oprot.writeFieldBegin('width', TType.I32, 2)
oprot.writeI32(self.width)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ParserValueSetEntry:
"""
Attributes:
- value
- mask
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'value', None, None, ), # 1
(2, TType.STRING, 'mask', None, None, ), # 2
)
def __init__(self, value=None, mask=None,):
self.value = value
self.mask = mask
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.value = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.mask = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ParserValueSetEntry')
if self.value is not None:
oprot.writeFieldBegin('value', TType.STRING, 1)
oprot.writeString(self.value)
oprot.writeFieldEnd()
if self.mask is not None:
oprot.writeFieldBegin('mask', TType.STRING, 2)
oprot.writeString(self.mask)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.value is None:
raise TProtocol.TProtocolException(message='Required field value is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class ParserValueSetDesc:
"""
Attributes:
- pvs_id
- pvs_name
- pvs_entries_max
- key_layout
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'pvs_id', None, None, ), # 1
(2, TType.STRING, 'pvs_name', None, None, ), # 2
(3, TType.I32, 'pvs_entries_max', None, None, ), # 3
(4, TType.LIST, 'key_layout', (TType.STRUCT,(ParserValueSetFieldDesc, ParserValueSetFieldDesc.thrift_spec)), None, ), # 4
)
def __init__(self, pvs_id=None, pvs_name=None, pvs_entries_max=None, key_layout=None,):
self.pvs_id = pvs_id
self.pvs_name = pvs_name
self.pvs_entries_max = pvs_entries_max
self.key_layout = key_layout
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.pvs_id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.pvs_name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.pvs_entries_max = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.LIST:
self.key_layout = []
(_etype17, _size14) = iprot.readListBegin()
for _i18 in xrange(_size14):
_elem19 = ParserValueSetFieldDesc()
_elem19.read(iprot)
self.key_layout.append(_elem19)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('ParserValueSetDesc')
if self.pvs_id is not None:
oprot.writeFieldBegin('pvs_id', TType.I32, 1)
oprot.writeI32(self.pvs_id)
oprot.writeFieldEnd()
if self.pvs_name is not None:
oprot.writeFieldBegin('pvs_name', TType.STRING, 2)
oprot.writeString(self.pvs_name)
oprot.writeFieldEnd()
if self.pvs_entries_max is not None:
oprot.writeFieldBegin('pvs_entries_max', TType.I32, 3)
oprot.writeI32(self.pvs_entries_max)
oprot.writeFieldEnd()
if self.key_layout is not None:
oprot.writeFieldBegin('key_layout', TType.LIST, 4)
oprot.writeListBegin(TType.STRUCT, len(self.key_layout))
for iter20 in self.key_layout:
iter20.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.pvs_id is None:
raise TProtocol.TProtocolException(message='Required field pvs_id is unset!')
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class MeterCfg:
"""
Attributes:
- rate_k
- burst_k
- array_offset
- count
"""
thrift_spec = (
None, # 0
(1, TType.DOUBLE, 'rate_k', None, None, ), # 1
(2, TType.I32, 'burst_k', None, None, ), # 2
(3, TType.I32, 'array_offset', None, None, ), # 3
(4, TType.I32, 'count', None, None, ), # 4
)
def __init__(self, rate_k=None, burst_k=None, array_offset=None, count=None,):
self.rate_k = rate_k
self.burst_k = burst_k
self.array_offset = array_offset
self.count = count
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.DOUBLE:
self.rate_k = iprot.readDouble();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.burst_k = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.array_offset = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('MeterCfg')
if self.rate_k is not None:
oprot.writeFieldBegin('rate_k', TType.DOUBLE, 1)
oprot.writeDouble(self.rate_k)
oprot.writeFieldEnd()
if self.burst_k is not None:
oprot.writeFieldBegin('burst_k', TType.I32, 2)
oprot.writeI32(self.burst_k)
oprot.writeFieldEnd()
if self.array_offset is not None:
oprot.writeFieldBegin('array_offset', TType.I32, 3)
oprot.writeI32(self.array_offset)
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 4)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class MeterDesc:
"""
Attributes:
- name
- id
- type
- mclass
- count
- table
- tableid
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.I32, 'id', None, None, ), # 2
(3, TType.I32, 'type', None, None, ), # 3
(4, TType.I32, 'mclass', None, None, ), # 4
(5, TType.I32, 'count', None, None, ), # 5
(6, TType.STRING, 'table', None, None, ), # 6
(7, TType.I32, 'tableid', None, None, ), # 7
)
def __init__(self, name=None, id=None, type=None, mclass=None, count=None, table=None, tableid=None,):
self.name = name
self.id = id
self.type = type
self.mclass = mclass
self.count = count
self.table = table
self.tableid = tableid
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.type = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.I32:
self.mclass = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.STRING:
self.table = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.I32:
self.tableid = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('MeterDesc')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.id is not None:
oprot.writeFieldBegin('id', TType.I32, 2)
oprot.writeI32(self.id)
oprot.writeFieldEnd()
if self.type is not None:
oprot.writeFieldBegin('type', TType.I32, 3)
oprot.writeI32(self.type)
oprot.writeFieldEnd()
if self.mclass is not None:
oprot.writeFieldBegin('mclass', TType.I32, 4)
oprot.writeI32(self.mclass)
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 5)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
if self.table is not None:
oprot.writeFieldBegin('table', TType.STRING, 6)
oprot.writeString(self.table)
oprot.writeFieldEnd()
if self.tableid is not None:
oprot.writeFieldBegin('tableid', TType.I32, 7)
oprot.writeI32(self.tableid)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class DigestFieldDesc:
"""
************************************************************
Digests *
************************************************************
Attributes:
- name
- width
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.I32, 'width', None, None, ), # 2
)
def __init__(self, name=None, width=None,):
self.name = name
self.width = width
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.width = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('DigestFieldDesc')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.width is not None:
oprot.writeFieldBegin('width', TType.I32, 2)
oprot.writeI32(self.width)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class DigestDesc:
"""
Attributes:
- name
- id
- app_id
- field_list_name
- fields
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, None, ), # 1
(2, TType.I32, 'id', None, None, ), # 2
(3, TType.I32, 'app_id', None, None, ), # 3
(4, TType.STRING, 'field_list_name', None, None, ), # 4
(5, TType.LIST, 'fields', (TType.STRUCT,(DigestFieldDesc, DigestFieldDesc.thrift_spec)), None, ), # 5
)
def __init__(self, name=None, id=None, app_id=None, field_list_name=None, fields=None,):
self.name = name
self.id = id
self.app_id = app_id
self.field_list_name = field_list_name
self.fields = fields
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.app_id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.field_list_name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.LIST:
self.fields = []
(_etype24, _size21) = iprot.readListBegin()
for _i25 in xrange(_size21):
_elem26 = DigestFieldDesc()
_elem26.read(iprot)
self.fields.append(_elem26)
iprot.readListEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('DigestDesc')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.id is not None:
oprot.writeFieldBegin('id', TType.I32, 2)
oprot.writeI32(self.id)
oprot.writeFieldEnd()
if self.app_id is not None:
oprot.writeFieldBegin('app_id', TType.I32, 3)
oprot.writeI32(self.app_id)
oprot.writeFieldEnd()
if self.field_list_name is not None:
oprot.writeFieldBegin('field_list_name', TType.STRING, 4)
oprot.writeString(self.field_list_name)
oprot.writeFieldEnd()
if self.fields is not None:
oprot.writeFieldBegin('fields', TType.LIST, 5)
oprot.writeListBegin(TType.STRUCT, len(self.fields))
for iter27 in self.fields:
iter27.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class TrafficClassCfg:
"""
************************************************************
Traffic Management *
************************************************************
Attributes:
- class_id
- weight
- queue_no
- committed
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'class_id', None, None, ), # 1
(2, TType.I64, 'weight', None, None, ), # 2
(3, TType.I32, 'queue_no', None, None, ), # 3
(4, TType.BOOL, 'committed', None, None, ), # 4
)
def __init__(self, class_id=None, weight=None, queue_no=None, committed=None,):
self.class_id = class_id
self.weight = weight
self.queue_no = queue_no
self.committed = committed
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.class_id = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I64:
self.weight = iprot.readI64();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.queue_no = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.BOOL:
self.committed = iprot.readBool();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('TrafficClassCfg')
if self.class_id is not None:
oprot.writeFieldBegin('class_id', TType.I32, 1)
oprot.writeI32(self.class_id)
oprot.writeFieldEnd()
if self.weight is not None:
oprot.writeFieldBegin('weight', TType.I64, 2)
oprot.writeI64(self.weight)
oprot.writeFieldEnd()
if self.queue_no is not None:
oprot.writeFieldBegin('queue_no', TType.I32, 3)
oprot.writeI32(self.queue_no)
oprot.writeFieldEnd()
if self.committed is not None:
oprot.writeFieldBegin('committed', TType.BOOL, 4)
oprot.writeBool(self.committed)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class DebugCtlReturn:
"""
************************************************************
Opaque debug interface *
************************************************************
Attributes:
- return_value
- return_data
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'return_value', None, None, ), # 1
(2, TType.STRING, 'return_data', None, None, ), # 2
)
def __init__(self, return_value=None, return_data=None,):
self.return_value = return_value
self.return_data = return_data
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.return_value = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.return_data = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('DebugCtlReturn')
if self.return_value is not None:
oprot.writeFieldBegin('return_value', TType.I32, 1)
oprot.writeI32(self.return_value)
oprot.writeFieldEnd()
if self.return_data is not None:
oprot.writeFieldBegin('return_data', TType.STRING, 2)
oprot.writeString(self.return_data)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
import os, sys, argparse, pprint, collections, time, traceback, json
VERSION = '0.3.0'
DESCRIPTION = 'RTE command line interface'
try:
from nfp_pif_gen import __repo_version__
VERSION += '-'+__repo_version__.HASH
except ImportError, err:
VERSION += '-devel'
def main():
try:
# running from tools
from nfp_pif_rte.RTEInterface import RTEInterface
except ImportError, err:
# running inplace
from RTEInterface import RTEInterface
def _parse_slice_fmt(expr):
name = start = count = None
if '[' in expr and ']' in expr:
name, start = expr.split('[', 1)
if ':' in start:
start, end = start.split(':', 1)
start = int(start)
count = int(end[:-1]) - start
else:
start = int(start[:-1])
count = 1
else:
name = expr
return name, start, count
def rte_cmd(func):
def _rte_cmd(args):
with RTEInterface.ConnectCtx(args.rpc, args.rte_host, args.rte_port,
args.device_id, not args.rte_no_zlib):
res = func(args)
if args.json:
print json.dumps(res, indent=4)
elif res is not None:
pprint.pprint(res)
return _rte_cmd
@rte_cmd
def rte_version(args):
return RTEInterface.System.GetVersion()
@rte_cmd
def rte_status(args):
return RTEInterface.Design.LoadStatus()
@rte_cmd
def design_load(args):
RTEInterface.Design.Load(args.firmware_file, args.pif_design, args.pif_config)
@rte_cmd
def design_unload(args):
RTEInterface.Design.Unload()
@rte_cmd
def design_config_reload(args):
RTEInterface.Design.ConfigReload(args.pif_config)
@rte_cmd
def counters(args):
if args.counter_cmd == 'list':
return RTEInterface.Counters.ListP4Counters()
elif args.counter_cmd == 'list-system':
return RTEInterface.Counters.GetSystemCounters()
elif args.counter_cmd == 'clear-all':
RTEInterface.Counters.ClearAllP4Counters()
return "All P4 counters cleared"
elif args.counter_cmd == 'clear-all-system':
RTEInterface.Counters.ClearAllSysCounters()
return "All system counters cleared"
else:
if not args.counter_name: raise Exception, 'counter name is required'
counter_id = RTEInterface.Counters.GetP4CounterByName(args.counter_name)['id']
if args.counter_cmd == 'clear':
RTEInterface.Counters.ClearP4Counter(counter_id)
return "P4 counter %s cleared" % args.counter_name
elif args.counter_cmd == 'get':
values = RTEInterface.Counters.GetP4Counter(counter_id)
if args.counter_index == None:
return values
else:
if args.counter_index < 0 or args.counter_index >= len(values):
raise Exception, 'invalid index'
return values[args.counter_index]
@rte_cmd
def tables(args):
if args.table_cmd == 'list':
return RTEInterface.Tables.List()
else:
if not args.tbl_name and args.tbl_id == -1: raise Exception, 'table name/id is required'
tbl_id = args.tbl_id if args.tbl_id != -1 else args.tbl_name
if args.table_cmd == 'list-rules':
return RTEInterface.Tables.ListRules(tbl_id)
else:
if not args.rule_name: raise Exception, 'rule name is required'
if args.table_cmd in ['add', 'edit']:
if not args.match:
if not args.default_rule:
raise Exception, 'match is required'
if not args.action: raise Exception, 'action is required'
if args.table_cmd == 'add':
RTEInterface.Tables.AddRule(tbl_id, args.rule_name,
args.default_rule, args.match, args.action,
priority=args.priority, timeout=args.timeout)
return "Rule %s added to table %s" % (args.rule_name, tbl_id)
elif args.table_cmd == 'edit':
RTEInterface.Tables.EditRule(tbl_id, args.rule_name,
args.default_rule, args.match, args.action,
priority=args.priority, timeout=args.timeout)
return "Rule %s in table %s edited" % (args.rule_name, tbl_id)
elif args.table_cmd == 'delete':
RTEInterface.Tables.DeleteRule(tbl_id, args.rule_name,
args.default_rule, args.match, args.action)
return "Rule %s in table %s deleted" % (args.rule_name, tbl_id)
@rte_cmd
def registers(args):
if args.register_cmd == 'list':
return RTEInterface.Registers.List()
else:
if not args.register_name: raise Exception, 'register name is required'
name, start, end = _parse_slice_fmt(args.register_name)
args_rn = args.register_name if name is None else name
args_index = args.index if start is None else start
args_count = args.count if end is None and start is None else end
if args_index is None: raise Exception, 'register index required'
if args_count is None: raise Exception, 'register count required'
if args.register_cmd == 'get':
return RTEInterface.Registers.Get(args_rn, args_index, args_count)
elif args.register_cmd == 'clear':
RTEInterface.Registers.Clear(args_rn, args_index, args_count)
return "Register %s cleared" % args.register_name
elif args.register_cmd == 'set':
if not args.values: raise Exception, 'register values are required'
RTEInterface.Registers.Set(args_rn, args.values, args_index, args_count)
return "Register %s set to %s" % (args.register_name, args.values)
elif args.register_cmd == 'set-field':
if args.field_id == -1: raise Exception, 'register field id is required'
if not args.field_value: raise Exception, 'register field value is required'
RTEInterface.Registers.SetField(args_rn, args.field_id, args.field_value, args_index, args_count)
return "Register %s field %s set to %s" % (args.register_name, args.field_id, args.field_value)
@rte_cmd
def meters(args):
if args.meter_cmd == 'list':
return RTEInterface.Meters.List()
else:
if args.meter_id == -1: raise Exception, 'meter id is required'
if args.meter_cmd == 'get':
return RTEInterface.Meters.GetConfig(args.meter_id)
elif args.meter_cmd == 'set':
ops_str = args.meter_configs.split(",")
ops = []
for o_str in ops_str:
off_cnt, rate_burst = o_str.split('=')
off, cnt = off_cnt.split(':')
rate, burst = rate_burst.split(':')
mtrcfg = {'rate': float(rate),
'burst': int(burst, 0),
'off': int(off, 0),
'cnt': int(cnt, 0)}
ops.append(mtrcfg)
RTEInterface.Meters.SetConfig(args.meter_id, ops)
return "Configured meter"
@rte_cmd
def traffic_class(args):
if args.port_id == -1: raise Exception, 'port id is required'
if args.tc_cmd == 'get':
return RTEInterface.TrafficClass.Get(args.port_id)
elif args.tc_cmd == 'set':
cfgs = []
if args.traffic_class_configs:
for cfg in args.traffic_class_configs.split(','):
cls, wht, que = [int(c) for c in cfg.split(':')]
cfgs.append( {'class_id': cls, 'weight': wht, 'queue_no': que} )
RTEInterface.TrafficClass.Set(args.port_id, cfgs)
return "Configured traffic classes"
elif args.tc_cmd == 'commit':
RTEInterface.TrafficClass.Commit(args.port_id)
return "Commited traffic classes"
@rte_cmd
def digests(args):
if args.digest_cmd == 'list':
return RTEInterface.Digests.List()
elif args.digest_cmd == 'poll':
if args.json and args.poll_time == -1:
raise Exception, 'poll time required for json output'
# grab all the digest info
digests = RTEInterface.Digests.List()
# a map for associating registration handle with digest data
digest_map = collections.OrderedDict()
# register for each digest
for d in digests:
# get the digest registration handle
dh = RTEInterface.Digests.Register(d['id'])
if dh < 0:
raise Exception, "Failed to register for digest %s" % d['name']
# associate the registration handle with the digest data
digest_map[dh] = {'desc' : d, 'count' : 0}
results = []
# exit if no digests defined
if not args.json:
if digest_map:
print "polling for digests events"
else:
print "no digests available"
return
elif not digest_map:
return results
# okay now periodically retrieve and dump the digest data
try:
start = time.time()
while 1:
if time.time()-start > args.poll_time:
break
for dh, dgdata in digest_map.items():
values = RTEInterface.Digests.Get(dh)
if len(values) == 0: # no data
continue
fldcnt = len(dgdata['desc']['fields'])
if len(values) % fldcnt != 0:
raise Exception, "Invalid field layout from digest %s" % dgdata['desc']['name']
for i in range(len(values) / fldcnt):
fieldsdata = [(flddesc['name'], fielddata)
for flddesc, fielddata in zip(dgdata['desc']['fields'], values[fldcnt * i:fldcnt * (i + 1)])]
if not args.json:
print "digest %s (P4 ID %d, P4 fieldlist %s)[%d] {" % (
dgdata['desc']['name'],
dgdata['desc']['app_id'],
dgdata['desc']['field_list_name'],
dgdata['count'])
for flddesc, fielddata in fieldsdata:
print " %s : %s" % (flddesc, fielddata)
print "}\n"
else:
results.append( (dgdata, fieldsdata) )
dgdata['count'] += 1
time.sleep(2)
except KeyboardInterrupt: # exit on control-c
pass
if args.json:
return results
@rte_cmd
def parser_value_sets(args):
pvs_list = RTEInterface.ParserValueSets.List()
# build up an name->ID map
id_map = {}
for s in pvs_list:
id_map[s['pvs_name']] = s['pvs_id']
# allow the ID to be the name too
id_map[str(s['pvs_id'])] = s['pvs_id']
if args.pvs_cmd == 'list':
return pvs_list
elif args.pvs_cmd == 'retrieve':
if args.pvs_id == None: raise Exception, 'parser value set ID is required'
if args.pvs_id not in id_map:
raise Exception, 'invalid parser value set ID'
return RTEInterface.ParserValueSets.Retrieve(id_map[args.pvs_id])
elif args.pvs_cmd == 'clear':
if args.pvs_id == None: raise Exception, 'parser value set ID is required'
if args.pvs_id not in id_map:
raise Exception, 'invalid parser value set ID'
RTEInterface.ParserValueSets.Clear(id_map[args.pvs_id])
return "cleared parser value set %s" % args.pvs_id
elif args.pvs_cmd == 'add':
if args.pvs_id == None: raise Exception, 'parser value set ID is required'
if args.pvs_id not in id_map:
raise Exception, 'invalid parser value set ID'
if args.pvs_entries == None:
raise Exception, 'parser value set entries are required'
pvs_entries_spl = args.pvs_entries.split(',')
pvs_entries_list = []
for spl in pvs_entries_spl:
vals = spl.split(':')
if len(vals) > 2:
raise Exception, 'invalid parser value set entry ' + spl
if len(vals) == 1 and len(vals[0].strip()) == 0:
continue
value = vals[0].strip()
if len(vals) > 1:
mask = vals[1].strip()
else:
mask = None
try:
val = long(value, 0)
if mask:
val = long(mask, 0)
except:
raise Exception, 'invalid parser value set entry ' + spl
pvs_entries_list.append((value, mask))
if len(pvs_entries_list) == 0:
raise Exception, 'must supply at least one valid entry'
RTEInterface.ParserValueSets.Add(id_map[args.pvs_id], pvs_entries_list)
return "added %d entries to parser value set %s" % (len(pvs_entries_list), args.pvs_id)
@rte_cmd
def ports(args):
if args.ports_cmd == 'list':
return RTEInterface.System.GetPortInfo()
@rte_cmd
def multicast(args):
if args.mcast_cmd == 'ports':
return RTEInterface.System.GetPortInfo()
elif args.mcast_cmd == 'list':
return RTEInterface.Multicast.List()
elif args.mcast_cmd == 'set':
if args.group_id == -1: raise Exception, 'group id is required'
# convert a list of comma seperated items into ports
# we can use the port token notation
ports = []
ports_info = RTEInterface.System.GetPortInfo()
ports_map = collections.OrderedDict()
for pi in ports_info:
ports_map[pi['token']] = pi['id']
for tok in args.ports.split(","):
if tok in ports_map:
# use the string if possible
ports.append(ports_map[tok])
continue
ports.append(int(tok))
RTEInterface.Multicast.SetConfig(args.group_id, ports)
return "Configured multicast group %d" % args.group_id
@rte_cmd
def debugctl(args):
if args.debugctl_cmd == 'exec':
if not args.debug_id: raise Exception, 'debug_id is required'
if not args.debug_data: raise Exception, 'debug_data is required'
return RTEInterface.DebugCtl.Execute(args.debug_id, args.debug_data)
elif args.debugctl_cmd == 'get-rule-break':
if not args.table_name: raise Exception, 'table_name is required'
if not args.rule_name: raise Exception, 'rule_name is required'
return RTEInterface.DebugCtl.GetRuleBreakpoint(args.table_name, args.rule_name)
elif args.debugctl_cmd == 'set-rule-break':
if not args.table_name: raise Exception, 'table_name is required'
if not args.rule_name: raise Exception, 'rule_name is required'
RTEInterface.DebugCtl.SetRuleBreakpoint(args.table_name, args.rule_name, args.enable)
return 'Rule breakpoint %s at table: %s, rule: %s'%(
'set' if args.enable else 'cleared', args.table_name, args.rule_name)
parser = argparse.ArgumentParser(
description=DESCRIPTION,
epilog='Copyright (C) 2016, 2017 Netronome Systems, Inc. All rights reserved.')
parser.add_argument('--version', action='version', version=VERSION)
parser.add_argument('-r', '--rte-host', dest='rte_host', type=str, default='localhost',
help='rte host, default localhost')
parser.add_argument('-p', '--rte-port', dest='rte_port', type=int, default=20206,
help='rte port, default 20206')
parser.add_argument('-n', '--rte-no-zlib', dest='rte_no_zlib', action='store_true',
help="don't use zlib for buffer transport")
parser.add_argument('-t', '--rpc', dest='rpc', default='thrift', choices=('thrift', 'grpc'),
help="set the rpc connection method to the rte")
parser.add_argument('-d', '--device-id', dest='device_id', default=0,
help="device id to connect to (used by grpc)")
parser.add_argument('-j', '--json', dest='json', action='store_true',
help="return results as json")
parser.add_argument('--debug-script', dest='debug_script', action='store_true',
help=argparse.SUPPRESS)
subparsers = parser.add_subparsers(help='rte client commands')
load_design_parser = subparsers.add_parser('design-load', help='load a pif design')
load_design_parser.add_argument('-f', '--firmware-file', dest='firmware_file', required=True,
help='firmware file')
load_design_parser.add_argument('-p', '--pif-design', dest='pif_design', default='',
help='pif design json file')
load_design_parser.add_argument('-c', '--user-config', dest='pif_config', default='',
help='user config json rules file')
load_design_parser.set_defaults(func=design_load)
rte_version_parser = subparsers.add_parser('version', help='get the remote version number')
rte_version_parser.set_defaults(func=rte_version)
rte_status_parser = subparsers.add_parser('status', help='get the remote load status')
rte_status_parser.set_defaults(func=rte_status)
unload_design_parser = subparsers.add_parser('design-unload', help='unload a pif design')
unload_design_parser.set_defaults(func=design_unload)
config_reload_parser = subparsers.add_parser('config-reload', help='reload a user config')
config_reload_parser.add_argument('-c', '--user-config', dest='pif_config', required=True,
help='user config json rules file')
config_reload_parser.set_defaults(func=design_config_reload)
counters_parser = subparsers.add_parser('counters', help='counter commands')
counters_parser.add_argument('counter_cmd',
choices=('list', 'list-system', 'clear', 'clear-all',
'clear-all-system', 'get'),
help='counter command')
counters_parser.add_argument('-c', '--counter', dest='counter_name', default='',
help='counter name')
counters_parser.add_argument('-i', '--index', dest='counter_index', default=None,
type=int,
help='counter index')
counters_parser.set_defaults(func=counters)
tables_parser = subparsers.add_parser('tables', help='table commands')
tables_parser.add_argument('table_cmd',
choices=('list', 'list-rules', 'add', 'edit', 'delete'),
help='table command')
tables_parser.add_argument('-t', '--table-name', dest='tbl_name', default='', type=str,
help="name of command target table")
tables_parser.add_argument('-i', '--table-id', dest='tbl_id', default=-1, type=int,
help="name of command target table id")
tables_parser.add_argument('-r', '--rule', dest='rule_name', default='', type=str,
help="name of command target rule")
tables_parser.add_argument('-d', '--default-rule', dest='default_rule', action='store_true',
help="flag to set whether rule is target table default rule")
tables_parser.add_argument('-m', '--match', dest='match', default='', type=str,
help="matchfields in JSON format for entry commands")
tables_parser.add_argument('-a', '--action', dest='action', default='', type=str,
help="actions in JSON format for entry commands")
tables_parser.add_argument('-p', '--priority', dest='priority', default=None, type=int,
help="optional priority for rule")
tables_parser.add_argument('-o', '--timeout', dest='timeout', default=None, type=int,
help="optional timeout in seconds for rule")
tables_parser.set_defaults(func=tables)
registers_parser = subparsers.add_parser('registers', help='register commands')
registers_parser.add_argument('register_cmd',
choices=('list', 'get', 'clear', 'set', 'set-field'),
help='register command')
registers_parser.add_argument('-r', '--register', dest='register_name', default='', type=str,
help="register name")
registers_parser.add_argument('-i', '--index', dest='index', default=0, type=int,
help="index to start from, default 0")
registers_parser.add_argument('-c', '--count', dest='count', default=-1, type=int,
help="number of entries to read, default -1 (all)")
registers_parser.add_argument('-s', '--values', dest='values', nargs='+', default=[],
help="values to set (in hex format)")
registers_parser.add_argument('-v', '--field-value', dest='field_value', default='', type=str,
help="field value to set (in hex format)")
registers_parser.add_argument('-f', '--field-id', dest='field_id', default=-1, type=int,
help="field id to set")
registers_parser.set_defaults(func=registers)
meters_parser = subparsers.add_parser('meters', help='meter commands')
meters_parser.add_argument('meter_cmd',
choices=('list', 'get', 'set'),
help='meter command')
meters_parser.add_argument('-m', '--meter-id', dest='meter_id', default=-1, type=int,
help="meter id")
meters_parser.add_argument('-c', '--meter-configs', dest='meter_configs', default='', type=str,
help="meter configs, in the format: off0:cnt0=rate0:burst0,offN:cntN=rateN:burstN")
meters_parser.set_defaults(func=meters)
traffic_class_parser = subparsers.add_parser('traffic-classes', help='traffic class commands')
traffic_class_parser.add_argument('tc_cmd',
choices=('set', 'commit', 'get'),
help='traffic class command')
traffic_class_parser.add_argument('-p', '--port-id', dest='port_id', default=-1, type=int,
help="port id")
traffic_class_parser.add_argument('-c', '--traffic-class-configs', dest='traffic_class_configs', default='', type=str,
help="traffic class configs, in the format: class0:weight0:queue0,classN:weightN:queueN")
traffic_class_parser.set_defaults(func=traffic_class)
digests_parser = subparsers.add_parser('digests', help='digest commands')
digests_parser.add_argument('digest_cmd',
choices=('list', 'poll'),
help='digest command')
digests_parser.add_argument('-t', '--poll-time', dest='poll_time', default=-1, type=float,
help="time to poll for digests")
digests_parser.set_defaults(func=digests)
pvs_parser = subparsers.add_parser('parser_value_sets', help='parser_value_sets commands')
pvs_parser.add_argument('pvs_cmd',
choices=('list', 'add', 'clear', 'retrieve'),
help='parser_value_sets command')
pvs_parser.add_argument('-p', '--parser-value-set-id', dest='pvs_id', default=None, type=str,
help="value set id")
pvs_parser.add_argument('-e', '--parser-value-set-entries', dest='pvs_entries', default=None, type=str,
help="parser value set entries to load: comma seperated list <val>[:mask],<val>[:mask],...")
pvs_parser.set_defaults(func=parser_value_sets)
ports_parser = subparsers.add_parser('ports', help='ports commands')
ports_parser.add_argument('ports_cmd',
choices=('list',),
help='ports command')
ports_parser.set_defaults(func=ports)
mcast_parser = subparsers.add_parser('multicast', help='multicast commands')
mcast_parser.add_argument('mcast_cmd',
choices=('ports', 'list', 'set'),
help='multicast command')
mcast_parser.add_argument('-g', '--group-id', dest='group_id', default=-1, type=int,
help="group id")
mcast_parser.add_argument('-p', '--ports', dest='ports', default='', type=str,
help="ports, in the format: port0,port1...")
mcast_parser.set_defaults(func=multicast)
debugctl_parser = subparsers.add_parser('debugctl', help=argparse.SUPPRESS)
debugctl_parser.add_argument('debugctl_cmd', type=str,
choices=('exec', 'get-rule-break', 'set-rule-break'),
help=argparse.SUPPRESS)
debugctl_parser.add_argument('-i', '--debug-id', dest='debug_id', default='', type=str,
help=argparse.SUPPRESS)
debugctl_parser.add_argument('-d', '--debug-data', dest='debug_data', default='', type=str,
help=argparse.SUPPRESS)
debugctl_parser.add_argument('-t', '--table-name', dest='table_name', default='', type=str,
help=argparse.SUPPRESS)
debugctl_parser.add_argument('-r', '--rule-name', dest='rule_name', default='', type=str,
help=argparse.SUPPRESS)
debugctl_parser.add_argument('-e', '--enable', dest='enable', default=True, type=bool,
help=argparse.SUPPRESS)
debugctl_parser.set_defaults(func=debugctl)
args = parser.parse_args()
try:
args.func(args)
except Exception, err:
if args.debug_script:
print >> sys.stderr, traceback.format_exc()
else:
print >> sys.stderr, "error: %s"%str(err)
sys.exit(1)
if __name__ == '__main__':
main()
import sys
import json, ast
from RTEInterface import RTEInterface
from kafka import KafkaConsumer
consumer = KafkaConsumer('deployed', 'removeWorker',
"request", bootstrap_servers='10.129.6.5:9092')
RTEInterface.Connect('thrift', "10.129.2.201", 20206)
tableId = "ingress::dispatch"
rule_name = "dispatch_to_worker"
# default_rule = True
actions = '''{ "type" : "ingress::dispatch_act",
"data" : { "dstAddr" : { "value" : "%s" },
"dstPort" : { "value" : "%d" } } }''' % ("192.168.2.2", 8080)
print actions
# RTEInterface.Tables.AddRule(tableId, rule_name, default_rule, actions)
ruleList = RTEInterface.Tables.ListRules(tableId)
print ruleList
for msg in consumer:
print msg, msg.topic
if msg.topic == "deployed":
msg = msg.value.decode('utf-8')
# worker = str(msg.value)
# worker = ast.literal_eval(json.dumps(worker))
worker = json.loads(msg)
print worker, worker[u'node_id']
print str(worker[u'node_id']).strip()
print int(worker[u'portExternal'])
default_rule = False
actions = '''{ "type" : "ingress::dispatch_act",
"data" : { "dstAddr" : { "value" : "%s" },
"dstPort" : { "value" : "%d" } } }''' % (str(worker[u'node_id']).strip(), \
int(worker[u'portExternal']))
print actions
# % (data.param3)
match = '{ "map_hdr.chain_id" : { "value" : "0"} } '
RTEInterface.Tables.AddRule(tableId, rule_name, default_rule, match, actions)
ruleList = RTEInterface.Tables.ListRules(tableId)
print ruleList
elif msg.topic == "removeWorker":
{
"folders": [
{
"path": "../.."
},
{
"path": "../../../../test/offload"
}
],
"settings": {}
}
\ No newline at end of file
const struct = require('./jspack/jspack')
f0 = 0; f1 = 0; f2 = 2; f3 = 6; f4 = 2
a = []
chain_id = struct.PackTo(">I", chain_id)
exec_id = struct.PackTo(">I", exec_id)
dataInt = random.randint(1, 1000)
data = struct.PackTo(">I", dataInt)
function_count = struct.PackTo("B", function_count)
function_id = struct.PackTo("B", function_id)
f0 = struct.PackTo("B", f0)
f1 = struct.PackTo("B", f1)
f2 = struct.PackTo("B", f2)
f3 = struct.PackTo("B", f3)
f4 = struct.PackTo("B", f4)
base = 0
// chain_id = struct.unpack(">I", )
// base += 4
// exec_id = struct.unpack(">I", packet[base: base + 4])[0]
// base += 4
// function_id = struct.unpack("B", packet[base])[0]
// base += 1
// data = struct.unpack(">I", packet[base: base + 4])[0]
base += 4
\ No newline at end of file
...@@ -5,12 +5,13 @@ const process = require('process') ...@@ -5,12 +5,13 @@ const process = require('process')
const dgram = require('dgram'); const dgram = require('dgram');
const { constants } = require('buffer'); const { constants } = require('buffer');
const { spawnSync, execSync } = require('child_process');
// const { logger } = require('../../lib'); // const { logger } = require('../../lib');
const server = dgram.createSocket('udp4'); const server = dgram.createSocket('udp4');
const udpProxy = dgram.createSocket('udp4'); const udpProxy = dgram.createSocket('udp4');
const app = express() const app = express()
let port = 5000, resource_id, functionHash, runtime, idleTime = 60, flagFirstRequest = true let port = 5000, resource_id, functionHash, runtime, idleTime = 600, flagFirstRequest = true
let waitTime let waitTime
resource_id = process.argv[2] resource_id = process.argv[2]
...@@ -72,11 +73,20 @@ async function executor(payload) { ...@@ -72,11 +73,20 @@ async function executor(payload) {
app.listen(port, () => { app.listen(port, () => {
console.log(`Resource ${resource_id} Server listening on port ${port}!`) console.log(`Resource ${resource_id} Server listening on port ${port}!`)
let node_id = execSync('ip a | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep 192.168 | head -n 1').toString()
console.log({
topic: "deployed",
messages: JSON.stringify({
functionHash, portExternal: port, node_id: node_id.trim(),
runtime, resource_id, entity_id: process.pid
}),
"status": true
});
if (producer) if (producer)
producer.send( producer.send(
[{ [{
topic: "deployed", topic: "deployed",
messages: JSON.stringify({ functionHash, portExternal: port, messages: JSON.stringify({ functionHash, portExternal: port, node_id,
runtime, resource_id, entity_id: process.pid}), runtime, resource_id, entity_id: process.pid}),
"status": true "status": true
}], () => { }) }], () => { })
...@@ -115,18 +125,19 @@ server.on('error', (err) => { ...@@ -115,18 +125,19 @@ server.on('error', (err) => {
}); });
server.on('message', (msg, rinfo) => { server.on('message', (msg, rinfo) => {
console.log("message", msg)
let payload = JSON.parse(msg) let payload = {}
console.log(payload, typeof payload); // console.log(payload, typeof payload);
lastRequest = Date.now()
totalRequest++
executor(payload).then(result => { executor(payload).then(result => {
result = JSON.stringify(result) result = ""
try { try {
udpProxy.send(result, 0, result.length, "8080", "localhost", function (err, bytes) { udpProxy.send(result, 0, result.length, "8080", "192.168.2.2", function (err, bytes) {
if (err) if (err)
console.log(err) console.log(err)
console.log("response via UDP") // console.log("response via UDP")
}) })
} catch (e) { } catch (e) {
console.log(e) console.log(e)
......
import sys
sys.path.append('/opt/nfp_pif/thrift/client')
from RTEInterface import RTEInterface
tableId = "ingress::fwd"
print RTEInterface
RTEInterface.Connect('thrift', "10.129.2.201", "20207")
ruleList = RTEInterface.Tables.ListRules(tableId)
print ruleList
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment