[stratum-dev] Query about accessing P4Runtime shell

2 views
Skip to first unread message

Prashanth Iyengar

unread,
Apr 23, 2021, 12:35:50 PM4/23/21
to strat...@lists.stratumproject.org
Hello Stratum team,

I am encountering some errors while attempting to access P4Runtime shell. Wanted to confirm if I am executing the correct procedure and commands.


##########################

Build environment
-----------------
$ uname -ar
Linux piyengar-OptiPlex-7050 4.15.0-136-generic #140~16.04.1-Ubuntu SMP Wed Feb 3 18:51:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Barefoot SDE v9.2.0

Target environment
------------------
Inventec D10056

##########################

Steps:
------
1. Build Stratum from source.

2. Run Startum on the hardware switch

root@localhost:~# start-stratum.sh -bf_switchd_background=false
bf_kdrv_mod found! Unloading first...
loading bf_kdrv_mod...
bf_sysfs_fname /sys/class/bf/bf0/device/dev_add
Install dir: /usr (0x55761024a020)
bf_switchd: system services initialized
bf_switchd: loading conf_file /usr/share/stratum/tofino_skip_p4_no_bsp.conf...
bf_switchd: processing device configuration...
Configuration for dev_id 0
  Family        : Tofino
  pci_sysfs_str : /sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0
  pci_domain    : 0
  pci_bus       : 5
  pci_fn        : 0
  pci_dev       : 0
  pci_int_mode  : 1
  sbus_master_fw: /usr/
  pcie_fw       : /usr/
  serdes_fw     : /usr/
  sds_fw_path   : /usr/
  microp_fw_path:
bf_switchd: processing P4 configuration...
P4 profile for dev_id 0
  p4_name: dummy
    libpd:
    libpdthrift:
    context:
    config:
  diag:
  accton diag:
  board-port-map: /usr/share/port_map.json
  non_default_port_ppgs: 0
  SAI default initialize: 1
loading board-map /usr/share/port_map.json...
BD_MAP : Parsing Board-lane-entries 57 found
BD_MAP : num-of-connectors:57

BD_MAP : Connector->2 device_id:0 mac_block:23 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :2/0 : 00000002

BD_MAP : Connector->1 device_id:0 mac_block:23 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :1/1 : 00000001

BD_MAP : Connector->4 device_id:0 mac_block:23 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :4/2 : 00000004

BD_MAP : Connector->3 device_id:0 mac_block:23 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :3/3 : 00000003

BD_MAP : Connector->6 device_id:0 mac_block:22 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:1 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :6/0 : 00000006

BD_MAP : Connector->5 device_id:0 mac_block:22 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :5/1 : 00000005

BD_MAP : Connector->8 device_id:0 mac_block:22 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :8/2 : 00000008

BD_MAP : Connector->7 device_id:0 mac_block:22 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :7/3 : 00000007

BD_MAP : Connector->10 device_id:0 mac_block:20 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :10/0 : 0000000a

BD_MAP : Connector->9 device_id:0 mac_block:20 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :9/1 : 00000009

BD_MAP : Connector->12 device_id:0 mac_block:20 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :12/2 : 0000000c

BD_MAP : Connector->11 device_id:0 mac_block:20 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :11/3 : 0000000b

BD_MAP : Connector->14 device_id:0 mac_block:18 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :14/0 : 0000000e

BD_MAP : Connector->13 device_id:0 mac_block:18 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :13/1 : 0000000d

BD_MAP : Connector->16 device_id:0 mac_block:18 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :16/2 : 00000010

BD_MAP : Connector->15 device_id:0 mac_block:18 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :15/3 : 0000000f

BD_MAP : Connector->18 device_id:0 mac_block:16 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :18/0 : 00000012

BD_MAP : Connector->17 device_id:0 mac_block:16 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :17/1 : 00000011

BD_MAP : Connector->20 device_id:0 mac_block:16 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :20/2 : 00000014

BD_MAP : Connector->19 device_id:0 mac_block:16 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :19/3 : 00000013

BD_MAP : Connector->22 device_id:0 mac_block:14 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :22/0 : 00000016

BD_MAP : Connector->21 device_id:0 mac_block:14 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :21/1 : 00000015

BD_MAP : Connector->24 device_id:0 mac_block:14 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :24/2 : 00000018

BD_MAP : Connector->23 device_id:0 mac_block:14 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :23/3 : 00000017

BD_MAP : Connector->25 device_id:0 mac_block:12 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :25/0 : 00000019

BD_MAP : Connector->26 device_id:0 mac_block:12 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :26/1 : 0000001a

BD_MAP : Connector->28 device_id:0 mac_block:12 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :28/2 : 0000001c

BD_MAP : Connector->27 device_id:0 mac_block:12 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :27/3 : 0000001b

BD_MAP : Connector->29 device_id:0 mac_block:10 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :29/0 : 0000001d

BD_MAP : Connector->30 device_id:0 mac_block:10 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :30/1 : 0000001e

BD_MAP : Connector->31 device_id:0 mac_block:10 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :31/2 : 0000001f

BD_MAP : Connector->32 device_id:0 mac_block:10 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:1 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :32/3 : 00000020

BD_MAP : Connector->34 device_id:0 mac_block:9 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :34/0 : 00000022

BD_MAP : Connector->33 device_id:0 mac_block:9 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :33/1 : 00000021

BD_MAP : Connector->36 device_id:0 mac_block:9 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :36/2 : 00000024

BD_MAP : Connector->35 device_id:0 mac_block:9 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :35/3 : 00000023

BD_MAP : Connector->38 device_id:0 mac_block:8 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :38/0 : 00000026

BD_MAP : Connector->40 device_id:0 mac_block:8 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :40/1 : 00000028

BD_MAP : Connector->37 device_id:0 mac_block:8 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :37/2 : 00000025

BD_MAP : Connector->39 device_id:0 mac_block:8 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :39/3 : 00000027

BD_MAP : Connector->41 device_id:0 mac_block:7 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :41/0 : 00000029

BD_MAP : Connector->44 device_id:0 mac_block:7 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:1 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :44/1 : 0000002c

BD_MAP : Connector->42 device_id:0 mac_block:7 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :42/2 : 0000002a

BD_MAP : Connector->43 device_id:0 mac_block:7 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :43/3 : 0000002b

BD_MAP : Connector->45 device_id:0 mac_block:6 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :45/0 : 0000002d

BD_MAP : Connector->47 device_id:0 mac_block:6 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:1 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :47/1 : 0000002f

BD_MAP : Connector->46 device_id:0 mac_block:6 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:2 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :46/2 : 0000002e

BD_MAP : Connector->48 device_id:0 mac_block:6 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :48/3 : 00000030

BD_MAP : Connector->50 device_id:0 mac_block:2 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :50/0 : 00000032
BD_MAP : lane1 mac_ch:1 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :50/1 : 00010032
BD_MAP : lane2 mac_ch:2 tx_lane:2, rx_lane:2, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :50/2 : 00020032
BD_MAP : lane3 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :50/3 : 00030032

BD_MAP : Connector->49 device_id:0 mac_block:4 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :49/0 : 00000031
BD_MAP : lane1 mac_ch:1 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :49/1 : 00010031
BD_MAP : lane2 mac_ch:2 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :49/2 : 00020031
BD_MAP : lane3 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :49/3 : 00030031

BD_MAP : Connector->52 device_id:0 mac_block:0 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :52/0 : 00000034
BD_MAP : lane1 mac_ch:1 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :52/1 : 00010034
BD_MAP : lane2 mac_ch:2 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :52/2 : 00020034
BD_MAP : lane3 mac_ch:3 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :52/3 : 00030034

BD_MAP : Connector->51 device_id:0 mac_block:30 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :51/0 : 00000033
BD_MAP : lane1 mac_ch:1 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :51/1 : 00010033
BD_MAP : lane2 mac_ch:2 tx_lane:3, rx_lane:3, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :51/2 : 00020033
BD_MAP : lane3 mac_ch:3 tx_lane:1, rx_lane:1, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :51/3 : 00030033

BD_MAP : Connector->54 device_id:0 mac_block:28 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :54/0 : 00000036
BD_MAP : lane1 mac_ch:1 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :54/1 : 00010036
BD_MAP : lane2 mac_ch:2 tx_lane:3, rx_lane:3, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :54/2 : 00020036
BD_MAP : lane3 mac_ch:3 tx_lane:1, rx_lane:1, tx_pn_swap:1 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :54/3 : 00030036

BD_MAP : Connector->53 device_id:0 mac_block:26 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :53/0 : 00000035
BD_MAP : lane1 mac_ch:1 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :53/1 : 00010035
BD_MAP : lane2 mac_ch:2 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :53/2 : 00020035
BD_MAP : lane3 mac_ch:3 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :53/3 : 00030035

BD_MAP : Connector->56 device_id:0 mac_block:24 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :56/0 : 00000038
BD_MAP : lane1 mac_ch:1 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :56/1 : 00010038
BD_MAP : lane2 mac_ch:2 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :56/2 : 00020038
BD_MAP : lane3 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :56/3 : 00030038

BD_MAP : Connector->55 device_id:0 mac_block:25 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :55/0 : 00000037
BD_MAP : lane1 mac_ch:1 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :55/1 : 00010037
BD_MAP : lane2 mac_ch:2 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:1
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :55/2 : 00020037
BD_MAP : lane3 mac_ch:3 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :55/3 : 00030037

BD_MAP : Connector->57 device_id:0 mac_block:32 media:copper enable-auto-neg:1
BD_MAP : lane0 mac_ch:0 tx_lane:0, rx_lane:0, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :57/0 : 00000039
BD_MAP : lane1 mac_ch:1 tx_lane:1, rx_lane:1, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :57/1 : 00010039
BD_MAP : lane2 mac_ch:2 tx_lane:2, rx_lane:2, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :57/2 : 00020039
BD_MAP : lane3 mac_ch:3 tx_lane:3, rx_lane:3, tx_pn_swap:0 rx_pn_swap:0
BD_MAP : tx_eq_pre:4 tx_eq_post:0 tx_eq_attn:0
BD_MAP : map-add dev:0: :57/3 : 00030039
Operational mode set to ASIC
ASIC detected at PCI /sys/class/bf/bf0/device
ASIC pci device id is 16
bf_switchd: drivers initialized
Skipping P4 program load for dev_id 0
Setting core_pll_ctrl0=cd44cbfe
bf_switchd: dev_id 0 initialized
bf_switchd: initialized 1 devices
Skip p4 lib init
Skip mav diag lib init
bf_switchd: spawning cli server thread
bf_switchd: spawning driver shell
bf_switchd: server started - listening on port 9999
I20210422 23:11:13.359033 32645 main_bfrt.cc:78] switchd started successfully
W20210422 23:11:13.359115 32645 credentials_manager.cc:45] Using insecure server credentials
Cannot read termcap database;
using dumb terminal settings.
bf-sde> I20210422 23:11:13.359495 32645 hal.cc:128] Setting up HAL in COLDBOOT mode...
I20210422 23:11:13.359575 32645 config_monitoring_service.cc:94] Pushing the saved chassis config read from /etc/stratum/x86-64-inventec-d10056-r0/chassis_config.pb.txt...
I20210422 23:11:13.369274 32645 onlp_wrapper.cc:99] Initializing ONLP.
I20210422 23:11:25.312541 32645 attribute_database.cc:213] PhalDB service is listening to localhost:28003...
I20210422 23:11:25.312696 32645 bf_chassis_manager.cc:1077] Port status notification callback registered successfully
I20210422 23:11:25.339576 32645 bf_chassis_manager.cc:87] Adding port 1 in node 1 (SDK Port 129).
2021-04-22 23:11:25.339610 BF_PM  INFO - bf_pm_port_add_with_lanes:4568 0:1/0:4(speed):0(fec):1(n_lanes)
2021-04-22 23:11:25.345516 BF_PM  INFO - bf_pm_port_direction_clear:4183 0:1/0
2021-04-22 23:11:25.345552 BF_PM  INFO - bf_pm_pltfm_front_port_eligible_for_autoneg:3895 0:1/0:1(an_eligibility)
2021-04-22 23:11:25.345576 BF_PM  INFO - bf_pm_pltfm_front_port_ready_for_bringup:3792 0:1/0:1(ready)
I20210422 23:11:25.346556 32645 bf_chassis_manager.cc:116] Enabling port 1 in node 1 (SDK Port 129).
2021-04-22 23:11:25.346573 BF_PM  INFO - bf_pm_port_enable:4827 0:1/0
I20210422 23:11:25.346642 32645 bf_chassis_manager.cc:87] Adding port 2 in node 1 (SDK Port 128).
2021-04-22 23:11:25.346657 BF_PM  INFO - bf_pm_port_add_with_lanes:4568 0:2/0:4(speed):0(fec):1(n_lanes)
2021-04-22 23:11:25.352851 BF_PM  INFO - bf_pm_port_direction_clear:4183 0:2/0
2021-04-22 23:11:25.352866 BF_PM  INFO - bf_pm_pltfm_front_port_eligible_for_autoneg:3895 0:2/0:1(an_eligibility)
2021-04-22 23:11:25.352874 BF_PM  INFO - bf_pm_pltfm_front_port_ready_for_bringup:3792 0:2/0:1(ready)
I20210422 23:11:25.355861 32645 bf_chassis_manager.cc:116] Enabling port 2 in node 1 (SDK Port 128).
2021-04-22 23:11:25.355881 BF_PM  INFO - bf_pm_port_enable:4827 0:2/0
[...]
I20210422 23:11:39.875691 32645 bfrt_switch.cc:60] Chassis config pushed successfully.
I20210422 23:11:39.875741   440 bf_chassis_manager.cc:1008] Transceiver event for port (slot: 1, port: 1): HW_STATE_PRESENT.
I20210422 23:11:39.948796 32645 p4_service.cc:121] Pushing the saved forwarding pipeline configs read from /etc/stratum/pipeline_cfg.pb.txt...
W20210422 23:11:39.949051 32645 p4_service.cc:142] Empty forwarding pipeline configs file: /etc/stratum/pipeline_cfg.pb.txt.
E20210422 23:11:39.949594 32645 hal.cc:221] Stratum external facing services are listening to 0.0.0.0:28000, 0.0.0.0:9339, 0.0.0.0:9559, localhost:28000...
E20210422 23:11:39.951107 32645 hal.cc:363] StratumErrorSpace::ERR_INTERNAL: Failed to check in with procmon: failed to connect to all addresses
E20210422 23:11:39.951534 32645 hal.cc:231] Error when checking in with procmon: Failed to check in with procmon: failed to connect to all addresses.
I20210422 23:11:43.260238   440 bf_chassis_manager.cc:1057] Transceiver (slot: 1, port: 1) is ready.
I20210422 23:11:43.260305   440 bf_chassis_manager.cc:1008] Transceiver event for port (slot: 1, port: 2): HW_STATE_PRESENT.
I20210422 23:11:46.511018   440 bf_chassis_manager.cc:1057] Transceiver (slot: 1, port: 2) is ready.

3. Verify Stratum gRPC ports are up

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      32645/stratum_bf
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      4633/rpcbind
tcp        0      0 0.0.0.0:17              0.0.0.0:*               LISTEN      4659/inetd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      4881/sshd
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN      4659/inetd
tcp6       0      0 :::111                  :::*                    LISTEN      4633/rpcbind
tcp6       0      0 :::22                   :::*                    LISTEN      4881/sshd
tcp6       0      0 :::9559                 :::*                    LISTEN      32645/stratum_bf
tcp6       0      0 :::9339                 :::*                    LISTEN      32645/stratum_bf
tcp6       0      0 127.0.0.1:28000         :::*                    LISTEN      32645/stratum_bf
tcp6       0      0 :::28000                :::*                    LISTEN      32645/stratum_bf
tcp6       0      0 127.0.0.1:28003         :::*                    LISTEN      32645/stratum_bf
udp        0      0 0.0.0.0:68              0.0.0.0:*                           4694/dhclient
udp        0      0 0.0.0.0:111             0.0.0.0:*                           4633/rpcbind
udp        0      0 0.0.0.0:161             0.0.0.0:*                           4812/snmpd
udp        0      0 0.0.0.0:37632           0.0.0.0:*                           4812/snmpd
udp        0      0 0.0.0.0:993             0.0.0.0:*                           4633/rpcbind
udp6       0      0 :::111                  :::*                                4633/rpcbind
udp6       0      0 ::1:161                 :::*                                4812/snmpd
udp6       0      0 :::993                  :::*                                4633/rpcbind

4. Compile sample P4 program

$ ~/bf-sde-9.2.0/install/bin/p4c -a tna -o . --p4runtime-format text --p4runtime-files /tmp/basic.pb.txt ~/bf-sde-9.2.0/pkgsrc/p4-examples/p4_16_programs/tna_simple_switch/tna_simple_switch.p4

$ ls -lRt tna_simple_switch.tofino/
tna_simple_switch.tofino/:
total 260
-rw-rw-r-- 1 piyengar piyengar   1499 Apr 22 11:59 tna_simple_switch.conf
-rw-rw-r-- 1 piyengar piyengar   1659 Apr 22 11:59 manifest.json
-rw-rw-r-- 1 piyengar piyengar 251513 Apr 22 11:58 bfrt.json
drwxr-xr-x 3 piyengar piyengar   4096 Apr 22 11:58 pipe

tna_simple_switch.tofino/pipe:
total 6804
-rw-rw-r-- 1 piyengar piyengar 5097918 Apr 22 11:59 context.json
-rw-rw-r-- 1 piyengar piyengar 1478311 Apr 22 11:59 tofino.bin
-rw-rw-r-- 1 piyengar piyengar  218936 Apr 22 11:59 tna_simple_switch.bfa
-rw-rw-r-- 1 piyengar piyengar      39 Apr 22 11:59 tna_simple_switch.dynhash.json
-rw-rw-r-- 1 piyengar piyengar  159145 Apr 22 11:59 tna_simple_switch.prim.json
drwxr-xr-x 2 piyengar piyengar    4096 Apr 22 11:58 logs

tna_simple_switch.tofino/pipe/logs:
total 56
-rw-rw-r-- 1 piyengar piyengar 40387 Apr 22 11:59 power.json
-rw-rw-r-- 1 piyengar piyengar 13917 Apr 22 11:59 parser.characterize.log

5. Use the config_builder script to generate compatible bin file

$ config_builders/tofino.py --ctx-json ~/stratum/tna_simple_switch.tofino/pipe/context.json --tofino-bin ~/stratum/tna_simple_switch.tofino/pipe/tofino.bin --out out.bin --name tna_simple_switch

6. Attempt to access P4Runtime shell

$ ./p4runtime-sh-docker --grpc-addr 10.4.16.67:28000 --device-id 1 --election-id 0,1 --config /tmp/basic.pb.txt,out.bin
CRITICAL:root:Error when setting config
CRITICAL:root:P4Runtime RPC error (INVALID_ARGUMENT): Unknown format for p4_device_config.

<On the switch>
====
bf-sde> I20210422 19:04:47.511440  2591 p4_service.cc:771] Controller (connection_id: 1, election_id: 1, uri: ipv4:10.4.17.235:47148) is connected as MASTER for node (aka device) with ID 1.
E20210422 19:04:48.125031  3212 bf_pipeline_utils.cc:43] StratumErrorSpace::ERR_INVALID_PARAM: Unknown format for p4_device_config.
E20210422 19:04:48.125089  3212 bfrt_node.cc:119] Return Error: ExtractBfPipelineConfig(config, &bf_config) failed with StratumErrorSpace::ERR_INVALID_PARAM: Unknown format for p4_device_config.
E20210422 19:04:48.125114  3212 bfrt_node.cc:63] Return Error: VerifyForwardingPipelineConfig(config) failed with StratumErrorSpace::ERR_INVALID_PARAM: Unknown format for p4_device_config.
E20210422 19:04:48.125135  3212 bfrt_node.cc:53] Return Error: SaveForwardingPipelineConfig(config) failed with StratumErrorSpace::ERR_INVALID_PARAM: Unknown format for p4_device_config.
E20210422 19:04:48.125154  3212 bfrt_switch.cc:74] Return Error: bfrt_node->PushForwardingPipelineConfig(config) failed with StratumErrorSpace::ERR_INVALID_PARAM: Unknown format for p4_device_config.
E20210422 19:04:48.125202  3212 error_buffer.cc:30] (p4_service.cc:451): Failed to set forwarding pipeline config for node 1: Unknown format for p4_device_config.
I20210422 19:04:48.128545  2591 p4_service.cc:798] Controller (connection_id: 1, election_id: 1, uri: ipv4:10.4.17.235:47148) which was MASTER for node (aka device) with ID 1 is disconnected. The node is now orphan :(
====

7. Followed instruction in the "P4Runtime p4_device_config formats" document to generate a compatible device config

$ bazel run //stratum/hal/bin/barefoot:bf_pipeline_builder -- -p4c_conf_file=/home/piyengar/stratum/tna_simple_switch.tofino/tna_simple_switch.conf -bf_pipeline_config_binary_file=$PWD/device_config.pb.bin
INFO: Analyzed target //stratum/hal/bin/barefoot:bf_pipeline_builder (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //stratum/hal/bin/barefoot:bf_pipeline_builder up-to-date:
  bazel-bin/stratum/hal/bin/barefoot/bf_pipeline_builder
INFO: Elapsed time: 0.109s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/stratum/hal/bin/barefoot/bf_pipeline_builder '-p4c_conf_file=/home/piyengar/stratum/tna_simple_switch.tofino/tna_simple_switch.conf' '-bf_pipeline_INFO: Build completed successfully, 1 total action
I20210422 14:32:04.412990  7301 bf_pipeline_builder.cc:113] Found P4 program: tna_simple_switch
I20210422 14:32:04.413036  7301 bf_pipeline_builder.cc:128]     Found pipeline: pipe

8. Attempt to start P4Runtime Shell

$ ./p4runtime-sh-docker --grpc-addr 10.4.16.67:28000 --device-id 1 --election-id 0,1 --config /tmp/basic.pb.txt,/home/piyengar/stratum/device_config.pb.bin
CRITICAL:root:Error when setting config
CRITICAL:root:P4Runtime RPC error (UNAVAILABLE): Socket closed
CRITICAL:root:StreamChannel error, closing stream
CRITICAL:root:P4Runtime RPC error (UNAVAILABLE): Socket closed

<On the switch>
====
bf-sde> I20210422 21:36:51.661512  3215 p4_service.cc:771] Controller (connection_id: 1, election_id: 1, uri: ipv4:10.4.17.235:47250) is connected as MASTER for node (aka device) with ID 1.
bf_switchd: starting warm init for dev_id 0 mode 1 serdes_upgrade 0
Skip diag lib deinit
2021-04-22 21:36:51.724572 BF_BFRT DEBUG - bfRtDeviceRemove:470 BfRt Device Remove called for dev : 0
2021-04-22 21:36:51.729000 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729020 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729034 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729049 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729064 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729076 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729090 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729103 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729116 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729132 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729146 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.729158 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:36:51.737972 BF_PORT  INFO - set chip part revision number, dev 0, part rev 1
2021-04-22 21:36:51.738026 BF_PORT  INFO - port_mgr_mac_block_init: core clock speed in ns = 1.220000
2021-04-22 21:36:51.743061 BF_SYS ERROR - /usr/lib/libdriver.so.0(ctx_json_parse+0x265) [0x7f4c5b7df7d5]
2021-04-22 21:36:51.743123 BF_SYS ERROR - /usr/lib/libdriver.so.0(+0xf1a6ec) [0x7f4c5b4e46ec]
2021-04-22 21:36:51.743144 BF_SYS ERROR - /usr/lib/libdriver.so.0(pipe_mgr_add_rmt_device+0x3e3) [0x7f4c5b6759b3]
2021-04-22 21:36:51.743162 BF_SYS ERROR - /usr/lib/libdriver.so.0(+0x106e75e) [0x7f4c5b63875e]
2021-04-22 21:36:51.743183 BF_SYS ERROR - /usr/lib/libdriver.so.0(bf_drv_notify_clients_dev_add+0x50) [0x7f4c5b570b70]
2021-04-22 21:36:51.743199 BF_SYS ERROR - /usr/lib/libdriver.so.0(bf_device_add+0x265) [0x7f4c5b56d9c5]
2021-04-22 21:36:51.743217 BF_SYS ERROR - /usr/bin/stratum_bf(+0x29ea09) [0x55667c5cba09]
2021-04-22 21:36:51.743233 BF_SYS ERROR - /usr/bin/stratum_bf(+0x29f3b7) [0x55667c5cc3b7]
2021-04-22 21:36:51.743254 BF_SYS ERROR - /usr/bin/stratum_bf(+0x142cd6) [0x55667c46fcd6]
2021-04-22 21:36:51.743271 BF_SYS ERROR - /usr/bin/stratum_bf(+0x20706d) [0x55667c53406d]
2021-04-22 21:36:51.743289 BF_SYS ERROR - /usr/bin/stratum_bf(+0x206606) [0x55667c533606]
2021-04-22 21:36:51.743306 BF_SYS ERROR - /usr/bin/stratum_bf(+0x1be03c) [0x55667c4eb03c]
2021-04-22 21:36:51.743323 BF_SYS ERROR - /usr/bin/stratum_bf(+0x794319) [0x55667cac1319]
2021-04-22 21:36:51.743340 BF_SYS ERROR - /usr/bin/stratum_bf(+0x84b8c2) [0x55667cb788c2]
2021-04-22 21:36:51.743357 BF_SYS ERROR - /usr/bin/stratum_bf(+0x84cb0f) [0x55667cb79b0f]
2021-04-22 21:36:51.743374 BF_SYS ERROR - /usr/bin/stratum_bf(+0x86a330) [0x55667cb97330]
2021-04-22 21:36:51.743392 BF_SYS ERROR - /usr/bin/stratum_bf(+0x860c76) [0x55667cb8dc76]
2021-04-22 21:36:51.743409 BF_SYS ERROR - /usr/bin/stratum_bf(+0x86a374) [0x55667cb97374]
2021-04-22 21:36:51.743427 BF_SYS ERROR - /usr/bin/stratum_bf(+0x860d27) [0x55667cb8dd27]
2021-04-22 21:36:51.743443 BF_SYS ERROR - /usr/bin/stratum_bf(+0xa99d03) [0x55667cdc6d03]
2021-04-22 21:36:51.743462 BF_SYS ERROR - /usr/bin/stratum_bf(+0xa99b21) [0x55667cdc6b21]
2021-04-22 21:36:51.743479 BF_SYS ERROR - /usr/bin/stratum_bf(+0xa9a265) [0x55667cdc7265]
2021-04-22 21:36:51.743503 BF_SYS ERROR - /usr/bin/stratum_bf(+0xab503b) [0x55667cde203b]
2021-04-22 21:36:51.743520 BF_SYS ERROR - /usr/bin/stratum_bf(+0xab46a9) [0x55667cde16a9]
2021-04-22 21:36:51.743539 BF_SYS ERROR - /usr/bin/stratum_bf(+0xab4568) [0x55667cde1568]
2021-04-22 21:36:51.743556 BF_SYS ERROR - /usr/bin/stratum_bf(+0xab4588) [0x55667cde1588]
2021-04-22 21:36:51.743573 BF_SYS ERROR - /usr/bin/stratum_bf(+0xce85e6) [0x55667d0155e6]
2021-04-22 21:36:51.743587 BF_SYS ERROR - /usr/bin/stratum_bf(+0xce862b) [0x55667d01562b]
2021-04-22 21:36:51.743605 BF_SYS ERROR - /lib/x86_64-linux-gnu/libpthread.so.0(+0x74a4) [0x7f4c59ee24a4]
2021-04-22 21:36:51.743622 BF_SYS ERROR - /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f4c59809d0f]
stratum_bf: /tmp/bf-sde-9.4.0/pkgsrc/bf-drivers/src/pipe_mgr/pipe_mgr_ctx_json_rmt_cfg.c:6646: ctx_json_parse: Assertion `feof(file)' failed.
*** Aborted at 1619127411 (unix time) try "date -d @1619127411" if you are using GNU date ***
PC: @                0x0 (unknown)
*** SIGABRT (@0x899) received by PID 2201 (TID 0x7f4c40858700) from PID 2201; stack trace: ***
    @     0x7f4c59eec0e0 (unknown)
    @     0x7f4c59753fff gsignal
    @     0x7f4c5975542a abort
    @     0x7f4c5974ce67 (unknown)
    @     0x7f4c5974cf12 __assert_fail
    @     0x7f4c5b7e281e ctx_json_parse
    @     0x7f4c5b4e46ec pipe_mgr_rmt_import
    @     0x7f4c5b6759b3 pipe_mgr_add_rmt_device
    @     0x7f4c5b63875e pipe_mgr_add_device
    @     0x7f4c5b570b70 bf_drv_notify_clients_dev_add
    @     0x7f4c5b56d9c5 bf_device_add
    @     0x55667c5cba09 bf_switchd_device_add.part.6
    @     0x55667c5cc3b7 bf_switchd_device_add_with_p4.part.7
    @     0x55667c46fcd6 stratum::hal::barefoot::BfSdeWrapper::AddDevice()
    @     0x55667c53406d stratum::hal::barefoot::BfrtNode::CommitForwardingPipelineConfig()
    @     0x55667c533606 stratum::hal::barefoot::BfrtNode::PushForwardingPipelineConfig()
    @     0x55667c4eb03c stratum::hal::barefoot::BfrtSwitch::PushForwardingPipelineConfig()
    @     0x55667cac1319 stratum::hal::P4Service::SetForwardingPipelineConfig()
    @     0x55667cb788c2 _ZZN2p42v19P4Runtime7ServiceC4EvENKUlPS2_PN9grpc_impl13ServerContextEPKNS0_34SetForwardingPipelineConfigRequestEPNS0_35SetForwardingPipelineConfigResponseEE1_clES3_S6_S9_SB_
    @     0x55667cb79b0f _ZNSt17_Function_handlerIFN4grpc6StatusEPN2p42v19P4Runtime7ServiceEPN9grpc_impl13ServerContextEPKNS3_34SetForwardingPipelineConfigRequestEPNS3_35SetForwardingPipelineConfigResponseEEZNS5_C4EvEUlS6_S9_SC_SE_E1_E9_M_invokeERKSt9_Any_dataOS6_OS9_OSC_OSE_
    @     0x55667cb97330 std::function<>::operator()()
    @     0x55667cb8dc76 _ZZN9grpc_impl8internal16RpcMethodHandlerIN2p42v19P4Runtime7ServiceENS3_34SetForwardingPipelineConfigRequestENS3_35SetForwardingPipelineConfigResponseEE10RunHandlerERKN4grpc8internal13MethodHandler16HandlerParameterEENKUlvE_clEv
    @     0x55667cb97374 _ZN9grpc_impl8internal23CatchingFunctionHandlerIZNS0_16RpcMethodHandlerIN2p42v19P4Runtime7ServiceENS4_34SetForwardingPipelineConfigRequestENS4_35SetForwardingPipelineConfigResponseEE10RunHandlerERKN4grpc8internal13MethodHandler16HandlerParameterEEUlvE_EENSA_6StatusEOT_
    @     0x55667cb8dd27 grpc_impl::internal::RpcMethodHandler<>::RunHandler()
    @     0x55667cdc6d03 grpc_impl::Server::SyncRequest::CallData::ContinueRunAfterInterception()
    @     0x55667cdc6b21 grpc_impl::Server::SyncRequest::CallData::Run()
    @     0x55667cdc7265 grpc_impl::Server::SyncRequestThreadManager::DoWork()
    @     0x55667cde203b grpc::ThreadManager::MainWorkLoop()
    @     0x55667cde16a9 grpc::ThreadManager::WorkerThread::Run()
    @     0x55667cde1568 _ZZN4grpc13ThreadManager12WorkerThreadC4EPS0_ENKUlPvE_clES3_
    @     0x55667cde1588 _ZZN4grpc13ThreadManager12WorkerThreadC4EPS0_ENUlPvE_4_FUNES3_
    @     0x55667d0155e6 _ZZN9grpc_core12_GLOBAL__N_120ThreadInternalsPosixC4EPKcPFvPvES4_PbRKNS_6Thread7OptionsEENKUlS4_E_clES4_
Aborted
====

9. Based on the suggestion for a similar query, compile P4 program with `--p4runtime-force-std-externs` flag. See https://lists.stratumproject.org/archives/stratum-dev/2020-August/000142.html.

$ ~/bf-sde-9.2.0/install/bin/p4c -a tna -o . --p4runtime-format text --p4runtime-files /tmp/basic.pb.txt  --p4runtime-force-std-externs ~/bf-sde-9.2.0/pkgsrc/p4-examples/p4_16_programs/tna_simple_switch/tna_simple_switch.p4

$ ls -lRt tna_simple_switch.tofino/
tna_simple_switch.tofino/:
total 260
-rw-rw-r-- 1 piyengar piyengar   1499 Apr 22 14:41 tna_simple_switch.conf
-rw-rw-r-- 1 piyengar piyengar   1689 Apr 22 14:41 manifest.json
-rw-rw-r-- 1 piyengar piyengar 251513 Apr 22 14:41 bfrt.json
drwxr-xr-x 3 piyengar piyengar   4096 Apr 22 11:58 pipe

tna_simple_switch.tofino/pipe:
total 6804
-rw-rw-r-- 1 piyengar piyengar 5097918 Apr 22 14:41 context.json
-rw-rw-r-- 1 piyengar piyengar 1478311 Apr 22 14:41 tofino.bin
-rw-rw-r-- 1 piyengar piyengar  218936 Apr 22 14:41 tna_simple_switch.bfa
-rw-rw-r-- 1 piyengar piyengar      39 Apr 22 14:41 tna_simple_switch.dynhash.json
-rw-rw-r-- 1 piyengar piyengar  159145 Apr 22 14:41 tna_simple_switch.prim.json
drwxr-xr-x 2 piyengar piyengar    4096 Apr 22 11:58 logs

tna_simple_switch.tofino/pipe/logs:
total 56
-rw-rw-r-- 1 piyengar piyengar 40387 Apr 22 14:41 power.json
-rw-rw-r-- 1 piyengar piyengar 13917 Apr 22 14:41 parser.characterize.log

10. Run the config_builder script again

$ config_builders/tofino.py --ctx-json ~/stratum/tna_simple_switch.tofino/pipe/context.json --tofino-bin ~/stratum/tna_simple_switch.tofino/pipe/tofino.bin --out out.bin --name tna_simple_switch

11. Attempt to start P4Runtime shell

$ ./p4runtime-sh-docker --grpc-addr 10.4.16.67:28000 --device-id 1 --election-id 0,1 --config /tmp/basic.pb.txt,out.bin
CRITICAL:root:Error when setting config
CRITICAL:root:P4Runtime RPC error (INVALID_ARGUMENT): Unknown format for p4_device_config.

12. Use config_builder to generate compatible device config

$ bazel run //stratum/hal/bin/barefoot:bf_pipeline_builder -- -p4c_conf_file=/home/piyengar/stratum/tna_simple_switch.tofino/tna_simple_switch.conf -bf_pipeline_config_binary_file=$PWD/device_config.pb.bin
INFO: Analyzed target //stratum/hal/bin/barefoot:bf_pipeline_builder (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //stratum/hal/bin/barefoot:bf_pipeline_builder up-to-date:
  bazel-bin/stratum/hal/bin/barefoot/bf_pipeline_builder
INFO: Elapsed time: 0.100s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/stratum/hal/bin/barefoot/bf_pipeline_builder '-p4c_conf_file=/home/piyengar/stratum/tna_simple_switch.tofino/tna_simple_switch.conf' '-bf_pipeline_INFO: Build completed successfully, 1 total action
I20210422 14:49:16.241858  8447 bf_pipeline_builder.cc:113] Found P4 program: tna_simple_switch
I20210422 14:49:16.241894  8447 bf_pipeline_builder.cc:128]     Found pipeline: pipe

13. Attempt to access P4Runtime shell

$ ./p4runtime-sh-docker --grpc-addr 10.4.16.67:28000 --device-id 1 --election-id 0,1 --config /tmp/basic.pb.txt,/home/piyengar/stratum/device_config.pb.bin
CRITICAL:root:StreamChannel error, closing stream
CRITICAL:root:P4Runtime RPC error (UNAVAILABLE): Socket closed
CRITICAL:root:Error when setting config
CRITICAL:root:P4Runtime RPC error (UNAVAILABLE): Socket closed

<On the switch>
====
bf-sde> I20210422 21:50:15.943732 32238 p4_service.cc:771] Controller (connection_id: 1, election_id: 1, uri: ipv4:10.4.17.235:47260) is connected as MASTER for node (aka device) with ID 1.
bf_switchd: starting warm init for dev_id 0 mode 1 serdes_upgrade 0
Skip diag lib deinit
2021-04-22 21:50:15.975977 BF_BFRT DEBUG - bfRtDeviceRemove:470 BfRt Device Remove called for dev : 0
2021-04-22 21:50:15.983955 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.983970 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.983978 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.983989 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.983997 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.984006 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.984016 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.984026 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.984034 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.984044 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.984053 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.984063 BF_PORT  WARN - port_mgr_map_dev_port_to_all returned error code (1)
2021-04-22 21:50:15.991101 BF_PORT  INFO - set chip part revision number, dev 0, part rev 1
2021-04-22 21:50:15.991142 BF_PORT  INFO - port_mgr_mac_block_init: core clock speed in ns = 1.220000
2021-04-22 21:50:15.995723 BF_SYS ERROR - /usr/lib/libdriver.so.0(ctx_json_parse+0x265) [0x7f18672bd7d5]
2021-04-22 21:50:15.995780 BF_SYS ERROR - /usr/lib/libdriver.so.0(+0xf1a6ec) [0x7f1866fc26ec]
2021-04-22 21:50:15.995796 BF_SYS ERROR - /usr/lib/libdriver.so.0(pipe_mgr_add_rmt_device+0x3e3) [0x7f18671539b3]
2021-04-22 21:50:15.995809 BF_SYS ERROR - /usr/lib/libdriver.so.0(+0x106e75e) [0x7f186711675e]
2021-04-22 21:50:15.995821 BF_SYS ERROR - /usr/lib/libdriver.so.0(bf_drv_notify_clients_dev_add+0x50) [0x7f186704eb70]
2021-04-22 21:50:15.995834 BF_SYS ERROR - /usr/lib/libdriver.so.0(bf_device_add+0x265) [0x7f186704b9c5]
2021-04-22 21:50:15.995845 BF_SYS ERROR - /usr/bin/stratum_bf(+0x29ea09) [0x55a151d5fa09]
2021-04-22 21:50:15.995856 BF_SYS ERROR - /usr/bin/stratum_bf(+0x29f3b7) [0x55a151d603b7]
2021-04-22 21:50:15.995868 BF_SYS ERROR - /usr/bin/stratum_bf(+0x142cd6) [0x55a151c03cd6]
2021-04-22 21:50:15.995881 BF_SYS ERROR - /usr/bin/stratum_bf(+0x20706d) [0x55a151cc806d]
2021-04-22 21:50:15.995893 BF_SYS ERROR - /usr/bin/stratum_bf(+0x206606) [0x55a151cc7606]
2021-04-22 21:50:15.995906 BF_SYS ERROR - /usr/bin/stratum_bf(+0x1be03c) [0x55a151c7f03c]
2021-04-22 21:50:15.995918 BF_SYS ERROR - /usr/bin/stratum_bf(+0x794319) [0x55a152255319]
2021-04-22 21:50:15.995931 BF_SYS ERROR - /usr/bin/stratum_bf(+0x84b8c2) [0x55a15230c8c2]
2021-04-22 21:50:15.995943 BF_SYS ERROR - /usr/bin/stratum_bf(+0x84cb0f) [0x55a15230db0f]
2021-04-22 21:50:15.995955 BF_SYS ERROR - /usr/bin/stratum_bf(+0x86a330) [0x55a15232b330]
2021-04-22 21:50:15.995967 BF_SYS ERROR - /usr/bin/stratum_bf(+0x860c76) [0x55a152321c76]
2021-04-22 21:50:15.995984 BF_SYS ERROR - /usr/bin/stratum_bf(+0x86a374) [0x55a15232b374]
2021-04-22 21:50:15.995997 BF_SYS ERROR - /usr/bin/stratum_bf(+0x860d27) [0x55a152321d27]
2021-04-22 21:50:15.996008 BF_SYS ERROR - /usr/bin/stratum_bf(+0xa99d03) [0x55a15255ad03]
2021-04-22 21:50:15.996020 BF_SYS ERROR - /usr/bin/stratum_bf(+0xa99b21) [0x55a15255ab21]
2021-04-22 21:50:15.996033 BF_SYS ERROR - /usr/bin/stratum_bf(+0xa9a265) [0x55a15255b265]
2021-04-22 21:50:15.996053 BF_SYS ERROR - /usr/bin/stratum_bf(+0xab503b) [0x55a15257603b]
2021-04-22 21:50:15.996065 BF_SYS ERROR - /usr/bin/stratum_bf(+0xab46a9) [0x55a1525756a9]
2021-04-22 21:50:15.996076 BF_SYS ERROR - /usr/bin/stratum_bf(+0xab4568) [0x55a152575568]
2021-04-22 21:50:15.996089 BF_SYS ERROR - /usr/bin/stratum_bf(+0xab4588) [0x55a152575588]
2021-04-22 21:50:15.996101 BF_SYS ERROR - /usr/bin/stratum_bf(+0xce85e6) [0x55a1527a95e6]
2021-04-22 21:50:15.996113 BF_SYS ERROR - /usr/bin/stratum_bf(+0xce862b) [0x55a1527a962b]
2021-04-22 21:50:15.996126 BF_SYS ERROR - /lib/x86_64-linux-gnu/libpthread.so.0(+0x74a4) [0x7f18659c04a4]
2021-04-22 21:50:15.996142 BF_SYS ERROR - /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f18652e7d0f]
stratum_bf: /tmp/bf-sde-9.4.0/pkgsrc/bf-drivers/src/pipe_mgr/pipe_mgr_ctx_json_rmt_cfg.c:6646: ctx_json_parse: Assertion `feof(file)' failed.
*** Aborted at 1619128215 (unix time) try "date -d @1619128215" if you are using GNU date ***
PC: @                0x0 (unknown)
*** SIGABRT (@0x7a9e) received by PID 31390 (TID 0x7f184c258700) from PID 31390; stack trace: ***
    @     0x7f18659ca0e0 (unknown)
    @     0x7f1865231fff gsignal
    @     0x7f186523342a abort
    @     0x7f186522ae67 (unknown)
    @     0x7f186522af12 __assert_fail
    @     0x7f18672c081e ctx_json_parse
    @     0x7f1866fc26ec pipe_mgr_rmt_import
    @     0x7f18671539b3 pipe_mgr_add_rmt_device
    @     0x7f186711675e pipe_mgr_add_device
    @     0x7f186704eb70 bf_drv_notify_clients_dev_add
    @     0x7f186704b9c5 bf_device_add
    @     0x55a151d5fa09 bf_switchd_device_add.part.6
    @     0x55a151d603b7 bf_switchd_device_add_with_p4.part.7
    @     0x55a151c03cd6 stratum::hal::barefoot::BfSdeWrapper::AddDevice()
    @     0x55a151cc806d stratum::hal::barefoot::BfrtNode::CommitForwardingPipelineConfig()
    @     0x55a151cc7606 stratum::hal::barefoot::BfrtNode::PushForwardingPipelineConfig()
    @     0x55a151c7f03c stratum::hal::barefoot::BfrtSwitch::PushForwardingPipelineConfig()
    @     0x55a152255319 stratum::hal::P4Service::SetForwardingPipelineConfig()
    @     0x55a15230c8c2 _ZZN2p42v19P4Runtime7ServiceC4EvENKUlPS2_PN9grpc_impl13ServerContextEPKNS0_34SetForwardingPipelineConfigRequestEPNS0_35SetForwardingPipelineConfigResponseEE1_clES3_S6_S9_SB_
    @     0x55a15230db0f _ZNSt17_Function_handlerIFN4grpc6StatusEPN2p42v19P4Runtime7ServiceEPN9grpc_impl13ServerContextEPKNS3_34SetForwardingPipelineConfigRequestEPNS3_35SetForwardingPipelineConfigResponseEEZNS5_C4EvEUlS6_S9_SC_SE_E1_E9_M_invokeERKSt9_Any_dataOS6_OS9_OSC_OSE_
    @     0x55a15232b330 std::function<>::operator()()
    @     0x55a152321c76 _ZZN9grpc_impl8internal16RpcMethodHandlerIN2p42v19P4Runtime7ServiceENS3_34SetForwardingPipelineConfigRequestENS3_35SetForwardingPipelineConfigResponseEE10RunHandlerERKN4grpc8internal13MethodHandler16HandlerParameterEENKUlvE_clEv
    @     0x55a15232b374 _ZN9grpc_impl8internal23CatchingFunctionHandlerIZNS0_16RpcMethodHandlerIN2p42v19P4Runtime7ServiceENS4_34SetForwardingPipelineConfigRequestENS4_35SetForwardingPipelineConfigResponseEE10RunHandlerERKN4grpc8internal13MethodHandler16HandlerParameterEEUlvE_EENSA_6StatusEOT_
    @     0x55a152321d27 grpc_impl::internal::RpcMethodHandler<>::RunHandler()
    @     0x55a15255ad03 grpc_impl::Server::SyncRequest::CallData::ContinueRunAfterInterception()
    @     0x55a15255ab21 grpc_impl::Server::SyncRequest::CallData::Run()
    @     0x55a15255b265 grpc_impl::Server::SyncRequestThreadManager::DoWork()
    @     0x55a15257603b grpc::ThreadManager::MainWorkLoop()
    @     0x55a1525756a9 grpc::ThreadManager::WorkerThread::Run()
    @     0x55a152575568 _ZZN4grpc13ThreadManager12WorkerThreadC4EPS0_ENKUlPvE_clES3_
    @     0x55a152575588 _ZZN4grpc13ThreadManager12WorkerThreadC4EPS0_ENUlPvE_4_FUNES3_
    @     0x55a1527a95e6 _ZZN9grpc_core12_GLOBAL__N_120ThreadInternalsPosixC4EPKcPFvPvES4_PbRKNS_6Thread7OptionsEENKUlS4_E_clES4_
Aborted
====

##########################

Would like to know how to fix/troubleshoot "P4Runtime RPC error (INVALID_ARGUMENT): Unknown format for p4_device_config."
Wondering if you can help me understand what is missing or wrong here.

Any guidance in the regard would be really helpful.

Thanks,
Prashanth

Maximilian Pudelko

unread,
Apr 23, 2021, 8:29:29 PM4/23/21
to Prashanth Iyengar, strat...@lists.stratumproject.org
Hi Prashanth,

From the logs it looks like the SDE is unable to parse the context json file: ctx_json_parse: Assertion `feof(file)' failed.
Maybe it got mangled during packing or transport. You already found bf_pipeline_builder which is the only and correct
way to build the pipeline for Stratum-bfrt on Tofino. Are you using Stratum-bf or Stratum-bfrt?

Without the P4 files any debugging is going to be pretty difficult. Can you share them?

Best
Max



_______________________________________________
stratum-dev mailing list
strat...@lists.stratumproject.org
https://lists.stratumproject.org/listinfo/stratum-dev

Prashanth Iyengar

unread,
Apr 27, 2021, 12:18:53 PM4/27/21
to Maximilian Pudelko, strat...@lists.stratumproject.org
Hi Max,

Based on your response, I tried a few more things.

 tna_simple_switch.p4 is one of the sample programs included in the SDE, which I am just using as a reference P4 program to configure the forwarding pipeline.

I can access the P4Runtime Shell by passing the config bin file generated by config_builders/tofino.py for stratum-bf images (stratum-bf-21.03-9.2.0-amd64.deb & stratum-bf-21.03-9.4.0-amd64.deb).

But, I encountered the previously reported error - "ctx_json_parse: Assertion `feof(file)' failed." for stratum-bfrt images (stratum-bfrt-21.03-9.2.0-amd64.deb & stratum-bfrt-21.03-9.4.0-amd64.deb) after passing the config bin file generated by the bf_pipeline_builder.

Unsure if it will be possible to share the P4 program or files generated after compilation here, as they are part of the SDE from Barefoot.

Is there something else that I can try to help troubleshoot this error?

Thanks,
Prashanth

Maximilian Pudelko

unread,
Apr 27, 2021, 2:46:28 PM4/27/21
to Prashanth Iyengar, strat...@lists.stratumproject.org
Hi Prashanth,

I missed the tna_simple_switch.p4 part in the logs before. We have access to the SDE, so I'll try to reproduce this locally,
no need to share the files.

Max

Maximilian Pudelko

unread,
Apr 27, 2021, 5:03:37 PM4/27/21
to Maximilian Pudelko, Prashanth Iyengar, strat...@lists.stratumproject.org
I managed to compile and upload the example pipeline without problems with Statum-bfrt.
I'm using SDE 9.3.1 and the latest Stratum code (10703c) on a Wedge100bf-32QS.
Here are my exact steps inside the development docker container:

pwd # /stratum inside docker
echo $SDE_INSTALL
/stratum/bf-sde-9.3.1-install/
ls p4-examples-9.3.1/ # copied from SDE
mkdir p4-tna-debug && cd p4-tna-debug/
/stratum/bf-sde-9.3.1-install/bin/bf-p4c --arch tna -o $(realpath .) -I /stratum/p4-examples-9.3.1/p4_16_programs/common/ --p4runtime-files ./p4info.pb.txt --p4runtime-force-std-externs /stratum/p4-examples-9.3.1/p4_16_programs/tna_simple_switch/tna_simple_switch.p4
bazel run //stratum/hal/bin/barefoot:bf_pipeline_builder -- -p4c_conf_file=$PWD/tna_simple_switch.conf  -bf_pipeline_config_binary_file=$PWD/tna_simple_switch.pb.bin
cd ~/p4runtime-shell # local checkout of p4runtime-shell repo, can also be run outside of docker
./p4runtime-sh-docker --grpc-addr 10.128.13.29:28001 --device-id 1 --election-id 0,1 --config /stratum/p4-tna-debug/p4info.pb.txt,/stratum/p4-tna-debug/tna_simple_switch.pb.bin
P4Runtime sh >>> tables
SwitchEgress.decap.decap_inner_ip
SwitchEgress.decap.decap_inner_l4
[...]

You might have to adjust some paths, depending on your setup, but it loads without problems.

With Stratum-bf I encountered this error, which is not surprising as TNA support is limited there:
2021-04-27 20:56:27.505299 BF_BFRT ERROR - bfRtDeviceAdd:327 No BF-RT json file found for program tna_simple_switch Not adding BF-RT Info object for it
E20210427 20:56:27.520689  4219 PI-device_mgr.cpp:0] Failed to query default entry handle from target for table 37403834
E20210427 20:56:27.521143  4219 bf_switch.cc:135] Return Error: pi_node->PushForwardingPipelineConfig(config) failed with generic::unknown: Failed to query default entry handle from target for table 37403834
E20210427 20:56:27.523460  4219 error_buffer.cc:30] (p4_service.cc:451): Failed to set forwarding pipeline config for node 1: Failed to query default entry handle from target for table 37403834.


Please compare the steps with your workflow and see if you can make it work.

Max


On Tue, Apr 27, 2021 at 11:46 AM Maximilian Pudelko via stratum-dev <strat...@lists.stratumproject.org> wrote:
Hi Prashanth,

I missed the tna_simple_switch.p4 part in the logs before. We have access to the SDE, so I'll try to reproduce this locally,
no need to share the files.

Max

On Tue, Apr 27, 2021 at 9:19 AM Prashanth Iyengar <prashanth...@gmail.com> wrote:

Maximilian Pudelko

unread,
Apr 27, 2021, 5:09:33 PM4/27/21
to Maximilian Pudelko, Prashanth Iyengar, strat...@lists.stratumproject.org
Forgot to mention the Stratum-tna work.
We're actively working on a Stratum P4 pipeline for Tofino devices. It is fully integrated in Bazel which makes deployment and testing a lot easier.
If you'd like to try this as a sanity check, checkout the p4-dev branch from this PR. Running the whole thing is as easy as:
bazel run //stratum/pipelines/stratum-tna:stratum_tna_test -- --grpc_addr=10.128.13.29:28001

Prashanth Iyengar

unread,
Apr 29, 2021, 2:47:07 PM4/29/21
to Maximilian Pudelko, strat...@lists.stratumproject.org
Hi Max,

Followed your suggestions and can access the P4Runtime shell now. Thank you so much!
Used SDE 9.3.1 and stratum-bfrt-21.03-9.4.0-amd64.deb.
The only difference was that I did not building the BfPipeline inside the Docker dev environment before.
As a result, it did not generate the proper binary config file.

I can confirm that the approach using the integrated Bazel pipeline for TNA also works for me.

With SDE 9.4.0, I encountered the following error ...

$ ./p4runtime-sh-docker --grpc-addr 10.4.16.67:9559 --device-id 1 --election-id 0,1 --config/stratum/p4-forwarding-pipeline/p4info.pb.txt,/stratum/p4-forwarding-pipeline/tna_simple_switch.pb.bin

CRITICAL:root:Error when setting config
CRITICAL:root:P4Runtime RPC error (INTERNAL): Unable to find bfrt ID for P4Info entity SwitchEgress.encap.encap_outer_l4 with ID 37403834.

< On the switch >

2021-04-29 03:26:52.356933 BF_BFRT ERROR - getStartBit:2711 ERROR hdr.udp.$valid Context json node not found for the key field. Hence unable to determine the start bit
2021-04-29 03:26:52.357011 BF_BFRT ERROR - keyByteSizeAndOffsetGet:1181 pipe.SwitchEgress.encap.encap_outer_l4 ERROR key field name hdr.udp.$valid not found in match_key_field_name_to_position_map
2021-04-29 03:26:52.357031 BF_BFRT ERROR - parseTable:1635 pipe.SwitchEgress.encap.encap_outer_l4 ERROR in processing key field hdr.udp.$valid while trying to get field size and offset
2021-04-29 03:26:52.357402 BF_BFRT  WARN - parseTable:1803 Action SwitchIngress.lag.lag_miss present in context json but not in bfrt json                  for table pipe.SwitchIngress.lag.lag
2021-04-29 03:26:52.357411 BF_BFRT  WARN - parseTable:1803 Action SwitchIngress.lag.set_port present in context json but not in bfrt json                  for table pipe.SwitchIngress.lag.lag
2021-04-29 03:26:52.357546 BF_BFRT  WARN - parseTable:1803 Action NoAction present in context json but not in bfrt json                  for table pipe.SwitchIngress.nexthop.ecmp
2021-04-29 03:26:52.357552 BF_BFRT  WARN - parseTable:1803 Action SwitchIngress.nexthop.set_nexthop_attributes present in context json but not in bfrt json                  for table pipe.SwitchIngress.nexthop.ecmp
2021-04-29 03:26:52.357966 BF_BFRT  WARN - parseTable:1803 Action NoAction present in context json but not in bfrt json                  for table pipe.SwitchIngress.port_mapping.port_vlan_to_bd_mapping
2021-04-29 03:26:52.357973 BF_BFRT  WARN - parseTable:1803 Action SwitchIngress.port_mapping.set_bd_attributes present in context json but not in bfrt json                  for table pipe.SwitchIngress.port_mapping.port_vlan_to_bd_mapping
2021-04-29 03:26:52.716704 BF_BFRT ERROR - bfrtTableFromIdGet:2544 Table_id "37403834" not found
2021-04-29 03:26:52.716777 BF_BFRT ERROR - bfrtTableFromNameGet:2532 Table "SwitchEgress.encap.encap_outer_l4" not found
E20210429 03:26:52.716871 15300 bfrt_id_mapper.cc:136] StratumErrorSpace::ERR_INTERNAL: Unable to find bfrt ID for P4Info entity SwitchEgress.encap.encap_outer_l4 with ID 37403834.
E20210429 03:26:52.716902 15300 bfrt_id_mapper.cc:38] Return Error: BuildMapping(table.preamble().id(), table.preamble().name(), bfrt_info) failed with StratumErrorSpace::ERR_INTERNAL: Unable to find bfrt ID for P4Info entity SwitchEgress.encap.encap_outer_l4 with ID 37403834.
E20210429 03:26:52.716919 15300 bf_sde_wrapper.cc:1414] Return Error: bfrt_id_mapper_->PushForwardingPipelineConfig(device_config, bfrt_info_) failed with StratumErrorSpace::ERR_INTERNAL: Unable to find bfrt ID for P4Info entity SwitchEgress.encap.encap_outer_l4 with ID 37403834.
E20210429 03:26:52.716943 15300 bfrt_node.cc:95] Return Error: bf_sde_interface_->AddDevice(device_id_, bfrt_config_) failed with StratumErrorSpace::ERR_INTERNAL: Unable to find bfrt ID for P4Info entity SwitchEgress.encap.encap_outer_l4 with ID 37403834.
E20210429 03:26:52.716962 15300 bfrt_switch.cc:74] Return Error: bfrt_node->PushForwardingPipelineConfig(config) failed with StratumErrorSpace::ERR_INTERNAL: Unable to find bfrt ID for P4Info entity SwitchEgress.encap.encap_outer_l4 with ID 37403834.
E20210429 03:26:52.717759 15300 error_buffer.cc:30] (p4_service.cc:451): Failed to set forwarding pipeline config for node 1: Unable to find bfrt ID for P4Info entity SwitchEgress.encap.encap_outer_l4 with ID 37403834.
I20210429 03:26:52.721956 15315 p4_service.cc:798] Controller (connection_id: 1, election_id: 1, uri: ipv4:10.4.17.235:47382) which was MASTER for node (aka device) with ID 1 is disconnected. The node is now orphan :(


Wondering if you have seen this error before. I haven't debugged this yet but, it seems that missing tables and actions are defined in the context.json, bfrt.json, and the P4Info file.
It is not very critical for me at this point since I am just exploring.

Thanks,
Prashanth

Maximilian Pudelko

unread,
Apr 29, 2021, 2:59:07 PM4/29/21
to Prashanth Iyengar, strat...@lists.stratumproject.org
Hi Prashanth,

Glad you made it work.
No, I have not seen these errors before when pushing the tna_simple_switch pipeline.
But we're still only SDE 9.3.1 internally and have not done much testing beyond it.
From the logs, I would make sure you're packing the correct bfrt.json and p4info files.

Max
Reply all
Reply to author
Forward
0 new messages