P4 DPDK Target Components ========================= p4-dpdk-target repo contains the P4-DPDK target specific code that supports the target independent Table Driven Interface (TDI). p4-dpdk-target works in conjunction with following repos: Table Driven Interface: (https://github.com/p4lang/tdi) TDI (Table Driven Interface) provides the target independent frontend interface while p4-dpdk-target provides the target dependent backend for DPDK SWX pipeline. p4-dpdk-target submodules tdi repo. p4-dpdk-target isn't currently defined in p4-dpdk-target/include/bf_rt directory. DPDK SWX Pipeline: (https://github.com/DPDK/dpdk/blob/main/lib/pipeline) P4 DPDK SWX pipeline implements the P4 pipeline in a DPDK software switch. The software switch is driven by artifacts generated by the P4 compiler for P4 DPDK SWX pipeline. p4-dpdk-target submodules dpdk repo to build P4 DPDK pipeline. Note about DPDK Patches (p4-dpdk-target/src/lld/dpdk/patch): DPDK patches 0001-pipeline-updated-instruction-label-check.patch and 0001-add-ctl-wrapper-api.patch are a temporary solution and will be removed. The fixes are being worked upon and will be committed soon. P4 Compiler DPDK Backend: (https://github.com/p4lang/p4c/tree/main/backends/dpdk) P4C DPDK backend creates the artifact files used by p4-dpdk-target and DPDK SWX pipeline. p4-dpdk-target uses bfrt.json to define the program independent frontend bf_rt interface. context.json is used to map the P4 runtime info to the P4 DPDK target specific info. The P4 DPDK spec file from P4C DPDK, which is used by DPDK SWX pipeline to setup the software pipeline, is also loaded through p4-dpdk-target. Target backend utilities: (https://github.com/p4lang/target-utils) (https://github.com/p4lang/target-syslibs) p4-dpdk-target utilizes the libraries built through target-utils and target-syslibs libraries. p4-dpdk-target uses these libraries in the install directory. P4-OVS: (https://github.com/ipdk-io/p4-ovs) The remote control plane interfaces like P4 Runtime and OpenConfig are supported through P4-OVS. P4-OVS maps these remote protocol messages and maps them to TDI interface. (Currently, it maps them to the interim bf_rt interface). Code Organization ================= The drivers are P4 independent. At the time of device initialization, they take artifacts associated with P4 as inputs. p4-dpdk-target is organized as follows include/ Header files associated with various driver modules bf_rt: bf_rt defines the interim frontend interface till TDI interface is supported. src/ Driver source files. Largely they are categorized into these submodules. pipe_mgr: P4 Pipeline Mgmt API (e.g. tables, actions, stats, meters) port_mgr: Port Mgmt API lld: Low Level Driver (e.g. DPDK library) dvm: Device Mgmt (e.g. device/port instantiation, HA sequences) bf_rt: P4 program independent and object driven implementation. bf_pal: Platform related code to support device and port management. ctx_json: Utility used for parsing cJSON structures in context JSON. bf_switchd/ Reference implementation of application to exercise the drivers. third-party/tdi Target independent frontend interface. (To be supported in future.) tools/ Scripts to help dependencies installation, ports setup and executing. dependencies/ Python requirements files used by the driver. doc/ Files used for doxygen. Building and installing ======================= The building of drivers produces a set of libraries that need to be loaded (or linked to) the application. Note: SDE is the top level directory with this p4-dpdk-target, syslibs and utils repo cloned in next step #Create install directory under SDE sudo -s mkdir install #Set environment variables To set environment variables for SDE, see below :- cd p4-dpdk-target/tools/setup source p4sde_env_setup.sh <path to SDE directory> Ensure SDE, SDE_INSTALL and LD_LIBRARY_PATH environment variables are set correctly # Clone remaining SDE repos cd $SDE git clone https://github.com/p4lang/target-utils --recursive utils git clone https://github.com/p4lang/target-syslibs --recursive syslibs # Install dependent packages To Install the dependencies for p4-driver on the platform Fedora 33, see below:- Note:- Make sure that your yum repository proxy and environment proxies are set properly and you have sudo access. pip3 install distro (dependency) cd p4-dpdk-target/tools/setup python3 install_dep.py # Building Utils cd $SDE/utils mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=$SDE_INSTALL -DCPYTHON=1 -DSTANDALONE=ON .. make -j make install # Building Syslibs cd $SDE/syslibs mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=$SDE_INSTALL .. make -j # Building P4 DPDK target cd $SDE/p4-dpdk-target git submodule update --init --recursive --force ./autogen.sh ./configure --prefix=$SDE_INSTALL make -j make install Artifacts installed =================== Here're the artifacts that get installed for p4-driver. Build artifacts: header files for driver API to $SDE_INSTALL/include/ libdriver.[a,la,so] to $SDE_INSTALL/lib/ driver library to manage the device bf_switchd to $SDE_INSTALL/bin reference implementation to exercise driver API Running Reference App ====================== bf_switchd is a reference application that can be configured through a debug CLI. # Running of bf_switchd cd $SDE_INSTALL/bin ./bf_switchd --install-dir $SDE_INSTALL --conf-file $SDE_INSTALL/share/dpdk/<P4 program name>/<P4 program name>.conf --init-mode=cold --status-port 7777 # Config file used by bf_switchd bf_switchd uses a config file to initialize. Following are some of the key fields: bfrt-config: Use file generated from the P4C DPDK for P4 pipeline definition. port-config: Optional file to describe initial ports topology. context: Use file generated from the P4C DPDK to map P4 to P4 DPDK. config: Use file generated from the P4C DPDK to setup P4 DPDK pipeline. { "chip_list": [ { "id": "asic-0", "chip_family": "dpdk", "instance": 0, } ], "instance": 0, "p4_devices": [ { "device-id": 0, "p4_programs": [ { "program-name": "<P4 program name>", "cpu_numa_node": "0", "bfrt-config": "share/dpdk/<P4 program name>/bf-rt.json", "port-config": "share/dpdk/<P4 program name>/ports_topology.json", "eal-args": "dummy -n 4 -c 3", "p4_pipelines": [ { "p4_pipeline_name": "pipe", "context": "share/dpdk/<P4 program name>/pipe/context.json", "config": "share/dpdk/<P4 program name>/pipe/<P4 program name>.spec", "path": "share/dpdk/<P4 program name>" } ] } ], } ] } # CLI interface Once bf_switchd starts running, bfshell is available. bfshell> bfrt_python bfrt.<P4 program>.enable pipe = bfrt.<P4 program>.pipe.ingress from netaddr import IPAddress pipe.<P4 table>.<P4 action>(<action parameters>) eg) pipe.ipv4_lpm.add_with_send(dst_addr=IPAddress('192.168.2.0'),dst_addr_p_length=24, port=1)
P4 driver SW for P4 DPDK target.
Overview
Comments
-
Does this DPDK target works for PNA programs?
p4c-dpdk can compile PNA programs into spec files. When I try to load it into the bf_switchd target, and run
bfrt.<program_name>.enable
, I get "Invalid struct field size." error. I think this is related to some of the PNA metadata fields are 3 bits likebit<3> pna_pre_input_metadata_pass
However, when I hack the .spec file to make them
bit<8>
, I got "Pipeline build error."Could you supply some sample programs that can load and run on this DPDK target? Maybe the l3_simple_demo example that is mentioned in the
tools
folder. -
Trying to run a simple p4 program
Hello, we're trying to run a simple main.p4 using p4-dpdk-target: main.p4:
#include <core.p4> #include <psa.p4> struct empty_metadata_t {} struct headers_t {} struct local_metadata_t {} parser packet_parser( packet_in packet, out headers_t headers, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t standard_metadata, in empty_metadata_t resub_meta, in empty_metadata_t recirc_meta) { state start { transition accept; } } control packet_deparser( packet_out packet, out empty_metadata_t clone_i2e_meta, out empty_metadata_t resubmit_meta, out empty_metadata_t normal_meta, inout headers_t headers, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { apply { } } control ingress( inout headers_t headers, inout local_metadata_t local_metadata1, in psa_ingress_input_metadata_t piim, inout psa_ingress_output_metadata_t piom) { apply { if (piim.ingress_port == (PortId_t)0) { piom.egress_port = (PortId_t)1; } else { piom.egress_port = (PortId_t)0; } } } control egress(inout headers_t headers, inout local_metadata_t local_metadata, in psa_egress_input_metadata_t istd, inout psa_egress_output_metadata_t ostd) { apply { } } parser egress_parser(packet_in buffer, out headers_t headers, inout local_metadata_t local_metadata, in psa_egress_parser_input_metadata_t istd, in empty_metadata_t normal_meta, in empty_metadata_t clone_i2e_meta, in empty_metadata_t clone_e2e_meta) { state start { transition accept; } } control egress_deparser(packet_out packet, out empty_metadata_t clone_e2e_meta, out empty_metadata_t recirculate_meta, inout headers_t headers, in local_metadata_t local_metadata, in psa_egress_output_metadata_t istd, in psa_egress_deparser_input_metadata_t edstd) { apply { } } IngressPipeline(packet_parser(), ingress(), packet_deparser()) ip; EgressPipeline(egress_parser(), egress(), egress_deparser()) ep; PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main;
We downloaded and installed p4c.
we installed p4-dpdk-target using @jafingerhut 's script and @Yi-Tseng 's script, (apparently one of the scripts did not work properly, but we do not know why.
we compile with:
p4c-dpdk main.p4 \ -o main.spec \ --arch psa \ --bf-rt-schema main.bfrt.json \ --context context.json \ --p4runtime-files main.pb.txt \ --p4runtime-format text
we try to run bf_switched with the following:
# Basic environment variables we need export SDE=$HOME/sde export SDE_INSTALL=$SDE/install export LD_LIBRARY_PATH=$SDE_INSTALL/lib:$SDE_INSTALL/lib64:$SDE_INSTALL/lib/x86_64-linux-gnu/:/usr/local/lib64:/usr/local/lib # We need to put SDE executable path before the system one since the bfrt_python # needs to use Python libraries from it and use the Python executable from SDE export PATH=$SDE_INSTALL/bin:$PATH hash -r # For security reason, the PATH and LD_LIBRARY_PATH won't pass to root user even if we use "sudo -E" # We must pass them in sudo to make sure it is correct. sudo -E PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH $SDE_INSTALL/bin/bf_switchd --install-dir $SDE_INSTALL --conf switch_config.json
but here we encounter an error :
bf_switchd: system services initialized bf_switchd: loading conf_file switch_config.json... bf_switchd: processing device configuration... Configuration for dev_id 0 Family : dpdk bf_switchd: processing P4 configuration... P4 profile for dev_id 0 P4 EAL args dummy -n 2 -c 0xC Debug CLI disable num mempool objs 1 mempool_name: MEMPOOL0 buffer_size: 2304 pool_size: 1024 cache_size: 256 numa_node: 0 num fixed functions 0 num P4 programs 1 p4_name: l1switch bfrt_config: /home/p4project/p4-dpdk-target-notes/l1switch/tdi.json port_config: /home/p4project/p4-dpdk-target-notes/l1switch/ports.json p4_pipeline_name: pipe core_id: 1 numa_node: 0 context: /home/p4project/p4-dpdk-target-notes/l1switch/context.json config: /home/p4project/p4-dpdk-target-notes/l1switch/main.spec Pipes in scope [0 1 2 3 ] Timer values [] Mirror Config n_slots: 4 n_sessions: 64 fast_clone: 0 diag: accton diag: non_default_port_ppgs: 0 SAI default initialize: 1 Operational mode set to DPDK MODEL Initialized the device types using PAL handler registration STUB:port_mgr_platform_init DPDK bf_switchd: drivers initialized EAL: Detected CPU lcores: 16 EAL: Detected NUMA nodes: 2 EAL: Detected shared linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'PA' EAL: VFIO support initialized EAL: DPDK is running on a NUMA system, but is compiled without NUMA support. EAL: This will have adverse consequences for performance and usability. EAL: Please use --legacy-mem option, or recompile with NUMA support. EAL: Device 0000:01:00.0 is not NUMA-aware EAL: Device 0000:01:00.1 is not NUMA-aware EAL: Device 0000:03:00.0 is not NUMA-aware EAL: Device 0000:07:00.0 is not NUMA-aware TELEMETRY: No legacy callbacks, legacy socket not created RING: Cannot reserve memory Error: Thread initialization failed (-1) 2022-12-27 16:19:13.789453 BF_PORT ERROR - parse_port_config_json:539: Could not open configuration file: /home/p4project/p4-dpdk-target-notes/l1switch/ports.json. 2022-12-27 16:19:13.789498 BF_PORT ERROR - port_mgr_config_import : Error in parsing the port config file 2022-12-27 16:19:13.789549 BF_DVM ERROR - Device add handling failed for dev 0, sts No system resources (2), Client port_mgr 2022-12-27 16:19:13.789594 BF_DVM ERROR - Device add failed for dev 0, sts No system resources (2) ERROR: bf_device_add failed(2) for dev_id 0 ERROR: bf_switchd_device_add failed(2) for dev_id 0 bf_switchd: initialized 0 devices bf_switchd_switchsai_lib_init starting SAI bf_switchd: spawning cli server thread bf_switchd: spawning driver shell bf_switchd: server started - listening on port 9999 ******************************************** * WARNING: Authorised Access Only * ******************************************** bfshell>
We tried looking up documentation for ports.json or switch_confiog.json, but alas we could not find any.
any help regarding how should the ports.json and switch_config.json should contain would be helpful. please know that we are still learning and don't completely understand things that may be obvious to the more experienced.
thank you
-
DPDK: Use generic CPU instructions
This commits removes AVX512 support and enables generic CPU options for the DPDK build. The IPDK CI builds on Azure VMs which support AVX512. However, since Virtualbox doesn't support this (see [1] and [2]), we should skip this for p4-dpdk-target when building DPDK.
Fixes: https://github.com/ipdk-io/ipdk/issues/118
[1] https://forums.virtualbox.org/viewtopic.php?t=86047 [2] https://forums.virtualbox.org/viewtopic.php?f=7&t=87131
Signed-off-by: Kyle Mestery [email protected]
-
Installation problems
Hello, we're trying to build and install but we're experiencing a lot of errors,
we'll be more than happy to get a list of repositories we need to clone and build and prerequisites we need to install. If there is a complete setup.sh somewhere it would be great. thank you for your time :)
-
Problem binding physical NIC in bf_switchd.
Hello, Has anyone gone through the situation I'm going through to link a physical NIC to p4-dpdk-target . I already have no idea what to do to successfully execute the binding. The problem only occurs when using BFRT, I tested it with the DPDK examples and the card links normally. The error that appears when trying to attach the physical card to bf_switchd is how it cannot read the ports.json file, but this only happens with physical cards.
Log syslog. Oct 19 23:48:13 master-node dummy[942929]: EAL: Probe PCI driver: net_nfp_pf (19ee:4000) device: 0000:41:00.0 (socket 1) Oct 19 23:48:13 master-node kernel: [34440.907257] igb_uio 0000:41:00.0: uio device registered with irq 87 MInha dúvida ao efetuar os teste descritos é:Oct 19 23:58:07 master-node dummy[957429]: 2022-10-19 23:58:07.648645 ERROR (BF_PORT:(file=null):(func=null):0) - port_config_json_parse_ports:507: Failed to add port LINK0 Oct 19 23:59:07 master-node dummy[957429]: 2022-10-19 23:58:07.648667 ERROR (BF_PORT:(file=null):(func=null):0) - parse_port_config_json:586: Failed to parse ports from Port Config JSON Oct 19 23:59:07 master-node dummy[957429]: 2022-10-19 23:58:07.648705 ERROR (BF_PORT:(file=null):(func=null):0) - port_mgr_config_import : Error in parsing the port config file Oct 19 23:59:07 master-node dummy[957429]: 2022-10-19 23:58:07.648744 ERROR (BF_DVM:(file=null):(func=null):0) - Device add handling failed for dev 0, sts No system resources (2), Client port_mgr Oct 19 23:59:07 master-node dummy[957429]: 2022-10-19 23:58:07.648764 ERROR (BF_DVM:(file=null):(func=null):0) - Device add failed for dev 0, sts No system resources (2)
Log bfshell LINK CREATE: Dev:0000:41:00.0 Args: dev_hotplug_enabled: 0 2022-10-19 09:54:00.196125 BF_LLD ERROR - Creation of Link Port LINK0 failed
2022-10-19 09:54:00.196285 BF_PORT ERROR - port_config_json_parse_ports:507: Failed to add port LINK0 2022-10-19 09:54:00.196322 BF_PORT ERROR - parse_port_config_json:586: Failed to parse ports from Port Config JSON 2022-10-19 09:54:00.196377 BF_PORT ERROR - port_mgr_config_import : Error in parsing the port config file 2022-10-19 09:54:00.196436 BF_DVM ERROR - Device add handling failed for dev 0, sts No system resources (2), Client port_mgr 2022-10-19 09:54:00.196466 BF_DVM ERROR - Device add failed for dev 0, sts No system resources (2) ERROR: bf_device_add failed(2) for dev_id 0 ERROR: bf_switchd_device_add failed(2) for dev_id 0
bf_switchd: initialized 0 devices bf_switchd_switchsai_lib_init starting SAI bf_switchd: spawning cli server thread bf_switchd: spawning driver shell bf_switchd: server started - listening on port 9999
******************************************** * WARNING: Authorised Access Only * ********************************************
Every help is welcome, Thanks.
-
TdiInfo:150 Error creating Table and parseContextJson:184 context Table object not found for
Hello again,
I am trying to run the example that is given. I have successfully compiled it according to the instructions and created a conf-file following the examples given. However, after running the switch I get the following errors:
2022-07-27 20:48:11.005078 BF_BFRT ERROR - TdiInfo:150 Error creating Table:$PORT_FP_IDX_INFO 2022-07-27 20:48:11.005909 BF_BFRT ERROR - TdiInfo:150 Error creating Table:$PORT_HDL_INFO 2022-07-27 20:48:11.006688 BF_BFRT ERROR - TdiInfo:150 Error creating Table:$PORT_STR_INFO 2022-07-27 20:48:11.007621 BF_BFRT ERROR - parseContextJson:184 context Table object not found for "$PORT" 2022-07-27 20:48:11.008474 BF_BFRT ERROR - parseContextJson:184 context Table object not found for "$PORT_STAT" 2022-07-27 20:48:11.009262 BF_BFRT ERROR - parseContextJson:184 context Table object not found for "ip.ingress.ipv4_host" 2022-07-27 20:48:11.010026 BF_BFRT ERROR - parseContextJson:184 context Table object not found for "ip.ingress.ipv4_lpm" 2022-07-27 20:48:11.010804 BF_BFRT ERROR - parseContextJson:184 context Table object not found for "ip.ingress.l2_fwd" 2022-07-27 20:48:11.011562 BF_BFRT ERROR - parseContextJson:184 context Table object not found for "ip.ingress.mymac"
Also when trying to enable the p4 program I get the following
------> bfrt.simple_l2l3_lpm.enable() 2022-07-27 20:51:16.399251 BF_PIPE ERROR - Number of ports added to DPDK Pipeline pipe in input direction should be a power of 2 2022-07-27 20:51:16.400320 BF_PIPE ERROR - Failed to Build Pipeline pipe 2022-07-27 20:51:16.401184 BF_BFRT ERROR - bf_rt_enable_pipeline:120 failed
I am not sure what exactly is the problem and if I am missing some file, or maybe change something?
-
Port topology example
Hello,
I have been trying to run some examples in p4-dpdk and I am not able to understand how you bind the interfaces to the switch using a port-config file.
I see that in the bf_switchd config file there exists a port-config file, but I couldn't find any example of such a port-config file somewhere in the repository.
-
Connection tracking timer support
Added support to configure the timer values from the conf file. Added a new timer array in conf file to hold the timer values. CT_timer_unit.txt CT_timer_unit_test.txt
-
Mistake in README for reference application config file
The example json config for the bf_switchd reference application has unnecessary commas on lines 6 and 29 that cause the program to fail to process the file. In the readme the example json given is
{ "chip_list": [ { "id": "asic-0", "chip_family": "dpdk", "instance": 0, } ], "instance": 0, "p4_devices": [ { "device-id": 0, "p4_programs": [ { "program-name": "<P4 program name>", "cpu_numa_node": "0", "bfrt-config": "share/dpdk/<P4 program name>/bf-rt.json", "port-config": "share/dpdk/<P4 program name>/ports_topology.json", "eal-args": "dummy -n 4 -c 3", "p4_pipelines": [ { "p4_pipeline_name": "pipe", "context": "share/dpdk/<P4 program name>/pipe/context.json", "config": "share/dpdk/<P4 program name>/pipe/<P4 program name>.spec", "path": "share/dpdk/<P4 program name>" } ] } ], } ] }
When it should be
{ "chip_list": [ { "id": "asic-0", "chip_family": "dpdk", "instance": 0 } ], "instance": 0, "p4_devices": [ { "device-id": 0, "p4_programs": [ { "program-name": "<P4 program name>", "cpu_numa_node": "0", "bfrt-config": "share/dpdk/<P4 program name>/bf-rt.json", "port-config": "share/dpdk/<P4 program name>/ports_topology.json", "eal-args": "dummy -n 4 -c 3", "p4_pipelines": [ { "p4_pipeline_name": "pipe", "context": "share/dpdk/<P4 program name>/pipe/context.json", "config": "share/dpdk/<P4 program name>/pipe/<P4 program name>.spec", "path": "share/dpdk/<P4 program name>" } ] } ] } ] }
Note the removed commas after
"instance": 0
and the second to last]
. -
Why are submodules repeated so often?
Here is the structure of submodules of this repository, and the submodules of those repositories, as of 2021-Dec-21:
+ p4-dpdk-target + target-syslibs @ f646177 + gperftools @ f7c6fb6 + zlog @ 876099f + target-utils @ 61969dd + cJSON @ d348621 + cpython @ 3d8993a + target-syslibs @ 580b5e5 Repeat of target-syslibs above. Why? + tommyds @ 5ada275 + xxHash @ 94e5f23 + tdi @ 21da36e + target-syslibs @ 4f765f5 Repeat of target-syslibs above. Why? + target-utils @ 243a99e Repeat of target-utils above. Why?
Is it intentional that so many submodules are repeated? If so, why?
-
Consider using fewer parallel processes during build
The
-j48
in theninja
command line requires at least about 8 GB of RAM on the system in order to avoid random process crashes due to the Linux kernel OOM process killer: https://github.com/p4lang/p4-dpdk-target/blob/0baaa0cd296008bb307cb750cd2419036dd804bc/src/lld/dpdk/Makefile.am#L5https://www.kernel.org/doc/gorman/html/understand/understand016.html
It also does not help builds go any faster on a system with relatively few CPU cores, e.g. 4 to 8.
Consider either hard-coding a smaller number (perhaps
-j8
?) or perhaps make it configurable via an environment variable. -
An example for ports.json
Hello, I want to run a simple program, however I get a
ERROR: bf_device_add failed(2) for dev_id 0
ERROR: bf_switchd_device_add failed(2) for dev_id 0
erros. I suspect it is because ports.json.I have searched the web for an example but alas, couldn't find any.
I would love a detailed explanation \ guide \ example that works, for how to write my ports.json..
thank you for your time !
Error:
023-01-08 13:29:26.912067 BF_PORT ERROR - port_config_json_parse_ports:507: Failed to add port ens33 2023-01-08 13:29:26.912226 BF_PORT ERROR - parse_port_config_json:586: Failed to parse ports from Port Config JSON 2023-01-08 13:29:26.912395 BF_PORT ERROR - port_mgr_config_import : Error in parsing the port config file 2023-01-08 13:29:26.912580 BF_DVM ERROR - Device add handling failed for dev 0, sts No system resources (2), Client port_mgr 2023-01-08 13:29:26.912706 BF_DVM ERROR - Device add failed for dev 0, sts No system resources (2) ERROR: bf_device_add failed(2) for dev_id 0 ERROR: bf_switchd_device_add failed(2) for dev_id 0
-
Issue with running bfswitchd
Hi, after changing the .json to:
Ports: `{ "ports": [ { "dev_port": 3, "port_name": "ens3", "mempool_name": "MEMPOOL0", "pipe_name": "pipe", "pipe_in":"pipe", "pipe_out":"pipe", "port_dir": "default", "port_in_id": 0, "port_out_id": 0, "port_type": "tap", "tap_port_attributes": { "mtu": 1500 } }, { "dev_port": 5, "port_name": "ens5", "mempool_name": "MEMPOOL0", "pipe_name": "pipe", "port_dir": "default", "port_in_id": 1, "pipe_in":"pipe", "pipe_out":"pipe", "port_out_id": 1, "port_type": "tap", "tap_port_attributes": { "mtu": 1500 } }
]
}`
switch config:
{ "chip_list": [ { "id": "asic-0", "chip_family": "dpdk", "instance": 0 } ], "instance": 0, "p4_devices": [ { "device-id": 0, "eal-args": "-n 1 -c 0x1", "mempools": [ { "name": "MEMPOOL0", "buffer_size": 2304, "pool_size": 1024, "cache_size": 256, "numa_node": 0 } ], "p4_programs": [ { "program-name": "l1switch", "bfrt-config": "/home/p4project/l1switch/tdi.json", "port-config": "/home/p4project/l1switch/ports.json", "p4_pipelines": [ { "p4_pipeline_name": "pipe", "core_id": 1, "numa_node": 0, "context": "/home/p4project/l1switch/context.json", "config": "/home/p4project/l1switch/main.spec", "pipe_scope": [ 0, 1, 2, 3 ], "path": "/home/p4project/l1switch/" } ] } ] } ] }
build.sh :
`#!/bin/bash p4c-dpdk main.p4
-o main.spec
--arch psa
--bf-rt-schema main.bfrt.json
--context context.json
--p4runtime-files main.pb.txt
--p4runtime-format text
--tdi tdi.jsonBasic environment variables we need
export SDE=$HOME/sde export SDE_INSTALL=$SDE/install export LD_LIBRARY_PATH=$SDE_INSTALL/lib:$SDE_INSTALL/lib64:$SDE_INSTALL/lib/x86_64-linux-gnu/:/usr/local/lib64:/usr/local/lib
We need to put SDE executable path before the system one since the bfrt_python
needs to use Python libraries from it and use the Python executable from SDE
export PATH=$SDE_INSTALL/bin:$PATH hash -r
For security reason, the PATH and LD_LIBRARY_PATH won't pass to root user even if we use "sudo -E"
We must pass them in sudo to make sure it is correct.
sudo -E PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH $SDE_INSTALL/bin/bf_switchd --install-dir $SDE_INSTALL --conf switch_config.json `
but sill see issues:
`p4project@p4project-S5520HC:~/l1switch$ ./build.sh Install dir: /home/p4project/sde/install (0x564c18724c20) bf_switchd: system services initialized bf_switchd: loading conf_file switch_config.json... bf_switchd: processing device configuration... Configuration for dev_id 0 Family : dpdk bf_switchd: processing P4 configuration... P4 profile for dev_id 0 P4 EAL args -n 1 -c 0x1 Debug CLI disable num mempool objs 1 mempool_name: MEMPOOL0 buffer_size: 2304 pool_size: 1024 cache_size: 256 numa_node: 0 num fixed functions 0 num P4 programs 1 p4_name: l1switch bfrt_config: /home/p4project/l1switch/tdi.json port_config: /home/p4project/l1switch/ports.json p4_pipeline_name: pipe core_id: 1 numa_node: 0 context: /home/p4project/l1switch/context.json config: /home/p4project/l1switch/main.spec Pipes in scope [0 1 2 3 ] Timer values [] Mirror Config n_slots: 4 n_sessions: 64 fast_clone: 0 diag: accton diag: non_default_port_ppgs: 0 SAI default initialize: 1 Operational mode set to DPDK MODEL Initialized the device types using PAL handler registration STUB:port_mgr_platform_init DPDK bf_switchd: drivers initialized EAL: Detected CPU lcores: 16 EAL: Detected NUMA nodes: 2 EAL: Detected shared linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'PA' EAL: VFIO support initialized EAL: DPDK is running on a NUMA system, but is compiled without NUMA support. EAL: This will have adverse consequences for performance and usability. EAL: Please use --legacy-mem option, or recompile with NUMA support. EAL: Device 0000:01:00.0 is not NUMA-aware EAL: Device 0000:01:00.1 is not NUMA-aware EAL: Device 0000:03:00.0 is not NUMA-aware EAL: Using IOMMU type 8 (No-IOMMU) EAL: Ignore mapping IO port bar(2) EAL: Probe PCI driver: net_ixgbe (8086:10fb) device: 0000:03:00.0 (socket -1) EAL: Device 0000:07:00.0 is not NUMA-aware EAL: Ignore mapping IO port bar(2) EAL: Probe PCI driver: net_ixgbe (8086:10fb) device: 0000:07:00.0 (socket -1) TELEMETRY: No legacy callbacks, legacy socket not created
bf_switchd: dev_id 0 initialized
bf_switchd: initialized 1 devices bf_switchd_switchsai_lib_init starting SAI bf_switchd: spawning cli server thread bf_switchd: spawning driver shell bf_switchd: server started - listening on port 9999
******************************************** * WARNING: Authorised Access Only * ********************************************
bfshell> bfrt_python cwd : /home/p4project/l1switch
We've found 1 p4 programs for device 0: l1switch Creating tree for dev 0 and program l1switch
Devices found : [0] /home/p4project/sde/install/lib/python3.10/site-packages/IPython/core/history.py:226: UserWarning: IPython History requires SQLite, your history will not be saved warn("IPython History requires SQLite, your history will not be saved") Python 3.10.8 (aaaf517424:aaaf517424, Dec 27 2022, 12:59:27) [GCC 11.3.0] Type 'copyright', 'credits' or 'license' for more information IPython 7.31.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: bfrt ------> bfrt() Available symbols: dump - Command enable - Command info - Command l1switch - Node port - Node
bfrt> l1switch.enable ----> l1switch.enable() 2022-12-28 18:27:04.276807 BF_PIPE ERROR - error :thread pipeline enable 2022-12-28 18:27:04.276956 BF_PIPE ERROR - Failed to Build Pipeline pipe 2022-12-28 18:27:04.277010 BF_BFRT ERROR - bf_rt_enable_pipeline:120 failed `
What should we write in switch_config.json and ports.json? We would appreciate a link to a full tutorial \ guide on how to write these .json files.
Thank you
-
Assigning Parameters for Physical NIC Devices in bf_switchd.
Hello, Does anyone know if there is any way to pass operating parameters (mtu, bsize ...) to the network card to be linked in the BF_Switchd through the .json file for port configuration? If yes, how? Or if there is any other way to do this with bf_Switchd running. Note: I use an Intel 82599ES 10-Gigabit SFI/SFP+ network card linked in 'link' mode. My port configuration is the one below, I believe I can assign these parameters in "link_port_attributes", but how/which ones are accepted?
{ "ports": [ { "dev_port": 0, "port_name": "LINK0", "mempool_name": "MEMPOOL0", "port_dir": "default", "port_in_id": 0, "pipe_in": "pipe", "port_out_id": 0, "pipe_out": "pipe", "port_type": "link", "net_port" : 0, "link_port_attributes": { "pcie_bdf": "0000:b3:00.0" } } ]Grateful.
-
Counters wildcard read doesn't show data
Problem Statement
While using P4Runtime on p4-DPDK-target ovs I want to gather all counter values in single query. This functionality is available in behavioral model and described in P4Runtime spec/proto, which should be target agnostic.
- I create CounterEntry
ce = counter_entry["someCounter"]
- I edit manually some counter entries, intentionally. Example:
ce.index=10
ce.packet_count=101
ce.modify
- If I want to see only single counter entry, data is visible
ce?
- But, If i want to see all entries in single query, data is not visible. Commands used:
ce.index=None
list(ce.read())
Steps to reproduce & Current output
P4 program with some counter (let's say 1024 in size, PACKETS type)
ce = counter_entry["someCounter"]
ce.index=10
ce.packet_count=101
ce.modify
ce.index=11
ce.packet_count=2000
ce.modify
ce.index=None
list(ce.read())
output:
... counter_id: 317030940 ("someCounter") index { index: 10 } data { } , counter_id: 317030940 ("someCounter") index { index: 11 } data { } ...
Expected output
... counter_id: 317030940 ("someCounter") index { index: 10 } data { packet_count: 101 } , counter_id: 317030940 ("someCounter") index { index: 11 } data { packet_count: 2000 } ...
- I create CounterEntry
-
Error when pushing a PNA pipeline
When loading a PNA program (like the PNA simple_lpm) with
bf_pal_device_add(dev_id, &device_profile)
we are seeing this error message:2022-11-09 21:55:56.747712 BF_PIPE ERROR - Error -17 at line 23: Struct registration error. . 2022-11-09 21:55:56.747830 BF_PIPE ERROR - Failed to Build Pipeline pipe 2022-11-09 21:55:56.747854 BF_DVM ERROR - Device add handling failed for dev 0, sts Unexpected error (15), Client pipe-mgr 2022-11-09 21:55:56.747871 BF_DVM ERROR - Device add failed for dev 0, sts Unexpected error (15)
The same build does work with PSA version of the pipeline.
Could be related to #16
Loads a signed kernel driver which allows you to map any driver to kernel mode without any traces of the signed / mapped driver.
CosMapper Loads a signed kernel driver (signed with leaked cert) which allows you to map any driver to kernel mode without any traces of the signed /
Photon OS DPDK and Packet Generator, RT Test, TF2 docker image.
photongen Photon OS DPDK and packet generator , cyclictest , TF2 with CUDA docker image. DPKD libs The build proccess builds and installs all shared l
A simple DPDK application that calculates stats for dropped and forwarded packets depending on the command line.
The DPDK Stats Description A small DPDK application that increments a basic packet counter for TCP or UDP packets depending on what's specified in the
A simple DPDK ping-pong benchmark with DPU forwarding
DPU Ping-Pong The repo contains code for two programs: dpdk_pingpong: A simple program to evaluate raw DPDK latency with DPU forwarding. The client se
A userspace TCP/IP stack based on dpdk
oceanus oceanus is a userspace TCP/IP stack based on dpdk. Quick Start build DPDK wget http://fast.dpdk.org/rel/dpdk-19.11.12.tar.xz tar xvf dpdk-19.1
Cobalt Strike beacon object file implementation for trusted path UAC bypass. The target executable will be called without involving
Beacon object file implementation for trusted path UAC bypass. The target executable will be called without involving "cmd.exe" by using DCOM object.
Little Computer 3, or LC-3, is a type of computer educational programming language, an assembly language, which is a type of low-level programming language. It features a relatively simple instruction set, but can be used to write moderately complex assembly programs, and is a viable target for a C compiler. It has a simplified instruction set compared to 'x86', but contains all the main ideas used in modern CPUs.
Little-Computer-3-LC-3 What is LC-3? Little Computer 3, or LC-3, is a type of computer educational programming language, an assembly language, which i
CSGO-P2C-Dumper is a process memory dumper aimed to target CS:GO internal cheats
CSGO-P2C-Dumper is a process memory dumper aimed to target CS:GO internal cheats, while offering additional reversing aid.
Scans all modules in target process for jmp/int3 hooks dissassembles then and follows jmps to destination
Scans all modules in target process for jmp/int3 hooks dissassembles then and follows jmps to destination.
x64 Windows kernel driver mapper, inject unsigned driver using anycall
anymapper x64 Windows kernel driver mapper, inject unsigned driver using anycall This project is WIP. Todo Fix: Can't make API calls from IAT nor func
Driver leap - Self-sustainable fork of SteamVR driver for Leap Motion controller with updated vendor libraries
Driver Leap Self-sustainable fork of SteamVR driver for Leap Motion controller with updated vendor libraries Installation (for users) Install Ultralea
Hygieia, a vulnerable driver traces scanner written in C++ as an x64 Windows kernel driver.
Hygieia The Greek goddess of health, her name is the source for the word "hygiene". Hygieia is a windows driver that works similarly to how pagewalkr
SinMapper - usermode driver mapper that forcefully loads any signed kernel driver
usermode driver mapper that forcefully loads any signed kernel driver (legit cert) with a big enough section (example: .data, .rdata) to map your driver over. the main focus of this project is to prevent modern anti-cheats (BattlEye, EAC) from finding your driver and having the power to hook anything due to being inside of legit memory (signed legit driver).
Lotus 1-2-3 R4D Display Driver for DOSEMU
Lotus 1-2-3 R4D Display Driver for DOSEMU2 This is a WIP display driver for Lotus 1-2-3 R4D to enable support for arbitrary text resolutions in DOSEMU
Simple Player-Glow & Driver Source Included
External-Apex-Cheat Install WDK Build in Release x64 Map driver using KDMapper Launch Game Run User-mode when in main menu Have Fun driver is indeed p
MPU-9250 sensor driver.
mpu9250 This library communicates with InvenSense MPU-9250 and MPU-9255 Inertial Measurement Units (IMUs). License Changelog Contributing guide Descri
An OpenVR Driver for VR Gloves
lucidgloves - LucidVR X Fngrs Developed by: Danwillm Lucas_VRTech What is this? This repository contains the OpenVR(SteamVR) driver for a DIY VR Hapti
Corsair LL Access driver abuse
CorsairLLeak Map physical addresses into userspace (RW), read/write MSRs, send/recieve data on I/O ports, and query/set bus configuration data with th
Valorant cheat that abuses Logitech GHUB driver input management.
valorant-cheat Valorant cheat that uses Logitech GHUB driver input management and color detection. features Triggerbot with customizable delay (VK_SHI