Running Stratum Natively on Netberg Aurora 610, 710, and 750

Introduction

There is a guide on how to build Stratum on Intel Tofino-based switches.

It seems plain and simple but not always working.

We worked out two methods to build and run Stratum on our Aurora 610, 710, and 750 switches. The guide is valid for the SDE 9.4.0.

There are two ways to run Stratum on Tofino-enabled switches – BSP-less and BSP-enabled. The recommended mode is BSP-less.

The BSP-less mode comes with ONLPv2 and a JSON “port mapping” file. That JSON file has a list of all switch ports and serdes parameters with preemphasis values. However, it sets parameters only for copper cables. High signal levels of copper cables might damage optical transceivers. Thus, only copper cables are working.

The BSP from a vendor has all parameters for all supported cables and optics.

BSP-less pros:

  • No changes to the SDE are needed.
  • All automated.

BSP-less cons:

  • Only DAC cables are working.
  • Platforms with repeaters (i.e., all 64-port systems, such as Aurora 750) are not supported.

BSP-enabled pros:

  • Support for all platforms.
  • Support for DAC and optics embedded in the BSP.

BSP-enable cons:

  • A bit more complicated building process.

Aurora 610

The easiest way to run STRATUM on Aurora 610 switch is the prebuilt ONLv2 image and Stratum package based on SDE 9.4.0.

  1. Get the ONLv2 image

    sha256: 43addd473d5a23d188f228ed95f8949fe0d494e6089b8371981dcde524995a9d

  2. Install the image on Aurora 610.
  3. Install the Stratum package.

Login to ONL – root/onl.

[sudo] apt update --allow-unauthenticated --allow-insecure-repositories
[sudo ] apt-get install ca-certificates
wget https://netbergtw.com/wp-content/uploads/Files/stratum_bf_deb.deb
[sudo] apt-get install -y --reinstall ./stratum_bf_deb.deb
start-stratum.sh

That’s it!

Aurora 710-750

Note Access to the SDE is required.

It’s the BSP-enabled mode and Method 4: Build the SDE and Stratum locally

The guide doesn’t mention a very convenient script, setup_dev_env.sh – after execution, one gets into a temporary container with all tools with required versions.

as@build:~/src/stratum$ ./setup_dev_env.sh
Sending build context to Docker daemon   2.56kB
Step 1/9 : FROM stratumproject/build:build
 ---> 50293771c041
Step 2/9 : ARG USER_NAME=default
 ---> Using cache
 ---> 0e96401d5827
Step 3/9 : ARG USER_ID=1000
 ---> Using cache
 ---> 3a8fe59c82f6
Step 4/9 : ARG GIT_GLOBAL_NAME=
 ---> Using cache
 ---> 10cc03b35e65
Step 5/9 : ARG GIT_GLOBAL_EMAIL=
 ---> Using cache
 ---> a0d9f60b1bb2
Step 6/9 : ARG GIT_GLOBAL_EDITOR=vim
 ---> Using cache
 ---> 5f724abcfb62
Step 7/9 : RUN useradd -ms /bin/bash -l -u $USER_ID $USER_NAME &&     adduser $USER_NAME sudo &&     echo "%sudo ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers
 ---> Using cache
 ---> a53cf6b6f01d
Step 8/9 : USER $USER_NAME
 ---> Using cache
 ---> 8d271b97e7f7
Step 9/9 : RUN (test "$GIT_GLOBAL_NAME" = "" || git config --global user.name "$GIT_GLOBAL_NAME") &&     (test "$GIT_GLOBAL_EMAIL" = "" || git config --global user.email "$GIT_GLOBAL_EMAIL") &&     (test "$GIT_GLOBAL_EDITOR" = "" || git config --global code.editor "$GIT_GLOBAL_EDITOR")
 ---> Using cache
 ---> ad78a13fb252
Successfully built ad78a13fb252
Successfully tagged stratum-dev:latest
as@d44b5bbe482c:/stratum$

This container is the best environment for building SDE+BSP and Stratum.
It should be trivial, but arguments are missing:

./p4studio_build.py -up profiles/stratum_profile.yaml --bsp-path $BSP_PATH [-kdir <path/to/linux/sources>]

This string needs -shc, –skip-kernelheader-check, or the process will fail.

So, the final SDE build command could look like the following:

./p4studio_build.py -up profiles/stratum_profile.yaml -shc -kdir /home/as/linux-4.19.81.tar.gz --bsp-path /sde/bf-platforms-netberg-bsp-9.4.0/

This way uses the stratum_profile.yaml from the SDE, not from Stratum. They are different. Stratum wants the bf-runtime package,
and with incorrect stratum_profile.yaml version it will fail with these errors:

bazel-out/k8-fastbuild/bin/stratum/hal/lib/barefoot/_objs/bf_sde_wrapper/bf_sde_wrapper.pic.o:bf_sde_wrapper.cc:function stratum::hal::barefoot::Bf SdeWrapper::AddDevice(int, stratum::hal::barefoot::BfrtDeviceConfig const&): error: undefined reference to 'bfrt::BfRtDevMgr::getInstance()'
bazel-out/k8-fastbuild/bin/stratum/hal/lib/barefoot/_objs/bf_sde_wrapper/bf_sde_wrapper.pic.o:bf_sde_wrapper.cc:function stratum::hal::barefoot::Bf SdeWrapper::AddDevice(int, stratum::hal::barefoot::BfrtDeviceConfig const&): error: undefined reference to 'bfrt::BfRtDevMgr::bfRtInfoGet(int const &, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bfrt::BfRtInfo const**) const'
bazel-out/k8-fastbuild/bin/stratum/hal/lib/barefoot/_objs/bf_sde_wrapper/bf_sde_wrapper.pic.o:bf_sde_wrapper.cc:function stratum::hal::barefoot::Bf SdeWrapper::Session::CreateSession(): error: undefined reference to 'bfrt::BfRtSession::sessionCreate()'
collect2: error: ld returned 1 exit status
1618719818.492073245: src/main/tools/linux-sandbox-pid1.cc:410: wait returned pid=2, status=0x100
1618719818.492090115: src/main/tools/linux-sandbox-pid1.cc:428: child exited normally with code 1
1618719818.566307425: src/main/tools/linux-sandbox.cc:233: child exited normally with code 1
Target //stratum/hal/bin/barefoot:stratum_bf_deb failed to build

Stratum could also fails with this error:

/usr/bin/x86_64-linux-gnu-ld.gold: error: requires dynamic R_X86_64_PC32 reloc against 'xxx_xxx_xxx' which may overflow at runtime; recompile with -fPIC
It means that bf-sde-9.4.0/pkgsrc/bf-drivers/Makefile.am needs two flags:
CFLAGS += -fPIC
CPPFLAGS += -fPIC

Now executing bazel build –sandbox_debug –verbose_failures //stratum/hal/bin/barefoot:stratum_bf_deb will deliver the necessary package.

Install and run it:

[sudo] apt-get install -y --reinstall ./stratum_bf_deb.deb
start-stratum.sh
NEWS

Latest news