Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TDI Runtime Client fails to initialize. #107

Open
dnkanga opened this issue Jul 10, 2023 · 1 comment
Open

TDI Runtime Client fails to initialize. #107

dnkanga opened this issue Jul 10, 2023 · 1 comment

Comments

@dnkanga
Copy link

dnkanga commented Jul 10, 2023

Environment

OS

NAME="Rocky Linux"
VERSION="8.8 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.8 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2029-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.8"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.8"

Kernel

Linux mev-acc-rl 5.15.0_acc_g0fdad426 #1 SMP Wed May 17 22:54:14 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

Problem

I am trying to run the TDI Runtime Client on a Rocky Linux. I'm using the following configuration file for the P4 program

{
    "chip_list": [
    {
            "id": "asic-0",
            "chip_family": "mev",
            "instance": 0,
             "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:01.6",
            "pcie_bdf": "0000:00:01.6",
         "pcie_int_mode": 1,
            "iommu_grp_num": 5,
           "sds_fw_path": "share/tofino_sds_fw/avago/firmware"
    }
    ],
    "instance": 0,
    "p4_devices": [
        {
            "device-id": 0,
            "fixed_functions" : [],
            "eal-args": "--lcores=1-2 -a 00:01.6,vport=[0-1] -- -i --rxq=1 --txq=1",
            "p4_programs": [
                {
                    "program-name": "p4_e2100_default_1_0_1_2",
                    "bfrt-config": "/root/runtime_files/e2100-default-1.0.1.2.bfrt.json",
                    "p4_pipelines": [
                        {
                            "p4_pipeline_name": "main",
                            "context": "/root/runtime_files/e2100-default-1.0.1.2.context.json",
                            "config": "/root/runtime_files/e2100-default-1.0.1.2.pkg",
                            "pipe_scope": [
                                0,
                                1,
                                2,
                                3
                            ],
                            "path": "/root/runtime_files"
                        }
                    ]
                }
            ]
        }
    ]
}

After, specifying the configuration file, I run the following command to start bf_switchd

(test_venv) [root@mev-acc-rl ~]# /opt/p4/p4sde/bin/bf_switchd \
>   --background \
>   --install-dir /opt/p4/p4sde \
>   --conf-file /root/runtime_files/mev_sample.conf \
>   --init-mode cold \
>   --status-port 7777 \
>   --skip-hld mkt
Skip-hld-mgrs list is mkt
Unknown skip-hld option m
Unknown skip-hld option k
Unknown skip-hld option t
Install dir: /opt/p4/p4sde (0x20f75f30)
bf_switchd: system services initialized
bf_switchd: loading conf_file /root/runtime_files/mev_sample.conf...
bf_switchd: processing device configuration...
  pci_bdf       : 0000:00:01.6
  iommu_grp_num : 5
  host_id       : 0
  pf_num        : 0
Configuration for dev_id 0
  Family        : mev
bf_switchd: processing P4 configuration...
disable-cache : 0
batch_size    : 1
Num of Cfgqs  : 1
P4 profile for dev_id 0
P4 EAL args: --lcores=1-2 -a 00:01.6,vport=[0-1] -- -i --rxq=1 --txq=1
Debug CLI disable
num mempool objs 0
num fixed functions 0
num P4 programs 1
  p4_name: p4_e2100_default_1_0_1_2
  bfrt_config: /root/runtime_files/e2100-default-1.0.1.2.bfrt.json
  port_config:
  p4_pipeline_name: main
  core_id: 0
  numa_node: 0
    context: /root/runtime_files/e2100-default-1.0.1.2.context.json
    entries:
    config: /root/runtime_files/e2100-default-1.0.1.2.pkg
  Pipes in scope [0 1 2 3 ]
  Timer values []
  Mirror Config
    n_slots: 0
    n_sessions: 0
    fast_clone: 0
  diag:
  accton diag:
  non_default_port_ppgs: 0
  SAI default initialize: 1
EAL: Detected CPU lcores: 16
EAL: Detected NUMA nodes: 1
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: VFIO support initialized
EAL: Using IOMMU type 1 (Type 1)
EAL: Probe PCI driver: net_cpfl (8086:1453) device: 0000:00:01.6 (socket -1)
cpfl_tdi_init(): tdi module is not initialized
TELEMETRY: No legacy callbacks, legacy socket not created
bf_switchd: drivers initialized
2023-07-10 16:39:48.663411 BF_LLD ERROR - Open failed! Err: 2 (No such file or directory)
2023-07-10 16:39:48.663441 BF_LLD ERROR - LLD FXP mem map init failed

Initialized lld_cpchnl control path
2023-07-10 16:39:48.666407 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666443 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666458 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666474 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666488 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666500 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666515 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666529 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666542 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666553 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666565 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666581 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666593 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666605 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666617 BF_PIPE ERROR - Invalid action:selector
2023-07-10 16:39:48.666628 BF_PIPE ERROR - Invalid action:selector
1 config queues are assigned. Start Qid 385

bf_switchd: dev_id 0 initialized
cpfl_dev_configure(): RSS is not supported.
cpfl_set_rx_function(): Using Split Scalar Rx (port 0).
cpfl_set_tx_function(): Using Split Scalar Tx (port 0).
2023-07-10 16:39:49.950280 BF_PORT ERROR - vPort Info not found. Exiting vport_mgr_set_vport_state
Port 0 MAC: 00 1a 00 01 03 20
cpfl_dev_configure(): RSS is not supported.
cpfl_set_rx_function(): Using Split Scalar Rx (port 1).
cpfl_set_tx_function(): Using Split Scalar Tx (port 1).
2023-07-10 16:39:51.050407 BF_PORT ERROR - vPort Info not found. Exiting vport_mgr_set_vport_state
Port 1 MAC: 00 1b 00 02 03 20

bf_switchd: initialized 1 devices
bf_switchd: spawning cli server thread
bf_switchd: running in background; driver shell is disabled
bf_switchd: server started - listening on port 9999

After starting bf_switch in the background, I tried to run the tdiRtCli.py script, but it failed with the following error:

(test_venv) [root@mev-acc-rl python3.10]# export SDE_INSTALL=/opt/p4/p4sde
(test_venv) [root@mev-acc-rl python3.10]# export LD_LIBRARY_PATH=$SDE_INSTALL/lib
(test_venv) [root@mev-acc-rl python3.10]# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SDE_INSTALL/lib64
(test_venv) [root@mev-acc-rl python3.10]# python tdiRtCli.py
cwd : /opt/p4/p4sde/lib/python3.10

We've found -1 p4 programs for device 0:
Traceback (most recent call last):
  File "/opt/p4/p4sde/lib/python3.10/tdiRtCli.py", line 628, in <module>
    main()
  File "/opt/p4/p4sde/lib/python3.10/tdiRtCli.py", line 625, in main
    start_tdi_rt(0, 1, os.getcwd(), [0])
  File "/opt/p4/p4sde/lib/python3.10/tdiRtCli.py", line 622, in start_tdi_rt
    return tdi_rt_cli.start_tdi(in_fd, out_fd, dev_id_list, udf, interactive)
  File "/opt/p4/p4sde/lib/python3.10/tdicli.py", line 2181, in start_tdi
    sts = self.load_tdi(dev_id_list)
  File "/opt/p4/p4sde/lib/python3.10/tdicli.py", line 2255, in load_tdi
    sts = self.populate_tdi(dev_id_list)
  File "/opt/p4/p4sde/lib/python3.10/tdicli.py", line 2281, in populate_tdi
    cintf = self.cIntf_cls(dev_id, TdiTable, TdiInfo)
  File "/opt/p4/p4sde/lib/python3.10/tdiRtCli.py", line 411, in __init__
    super().__init__(dev_id, TdiRtTable, TdiInfo, self._driver_path)
  File "/opt/p4/p4sde/lib/python3.10/tdicli.py", line 70, in __init__
    sts = self._init_programs()
  File "/opt/p4/p4sde/lib/python3.10/tdicli.py", line 181, in _init_programs
    array_type = c_char_p * num_names.value
ValueError: Array length must be >= 0, not -1

Any help would be appreciated. Thanks!

@Inbanoth
Copy link

you need to run bfshell, that will connect to bf_switchd server listening on 9999. because you ran bf_switchd as a seperatre process and tdiRtCli.py as a separate tdicli doesn't know about the switchd initialization.

Otherwise try running both under single process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants